How to use the @fluentui/react-proptypes.every function in @fluentui/react-proptypes

To help you get started, we’ve selected a few @fluentui/react-proptypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / fluent-ui-react / packages / react / src / components / SplitButton / SplitButton.tsx View on Github external
static propTypes = {
    ...commonPropTypes.createCommon({
      content: false,
    }),
    button: customPropTypes.itemShorthand,
    defaultOpen: PropTypes.bool,
    menu: PropTypes.oneOfType([
      customPropTypes.itemShorthand,
      PropTypes.arrayOf(customPropTypes.itemShorthandWithoutJSX),
    ]),
    onMainButtonClick: PropTypes.func,
    onMenuItemClick: PropTypes.func,
    onOpenChange: PropTypes.func,
    open: PropTypes.bool,
    primary: customPropTypes.every([customPropTypes.disallow(['secondary']), PropTypes.bool]),
    secondary: customPropTypes.every([customPropTypes.disallow(['primary']), PropTypes.bool]),
    toggleButton: customPropTypes.itemShorthand,
  }

  static defaultProps = {
    accessibility: splitButtonBehavior,
    as: 'span',
    toggleButton: {},
  }

  static autoControlledProps = ['open']

  getInitialAutoControlledState(): SplitButtonState {
    return {
      isFromKeyboard: false,
      open: false,
github microsoft / fluent-ui-react / packages / react / src / components / Tooltip / Tooltip.tsx View on Github external
animated: false,
      as: false,
      content: false,
    }),
    align: PropTypes.oneOf(ALIGNMENTS),
    defaultOpen: PropTypes.bool,
    inline: PropTypes.bool,
    mountNode: customPropTypes.domNode,
    mouseLeaveDelay: PropTypes.number,
    offset: PropTypes.string,
    open: PropTypes.bool,
    onOpenChange: PropTypes.func,
    pointing: PropTypes.bool,
    position: PropTypes.oneOf(POSITIONS),
    target: customPropTypes.domNode,
    trigger: customPropTypes.every([customPropTypes.disallow(['children']), PropTypes.element]),
    content: customPropTypes.shorthandAllowingChildren,
  }

  static defaultProps: TooltipProps = {
    align: 'center',
    position: 'above',
    mouseLeaveDelay: 10,
    pointing: true,
    accessibility: tooltipAsLabelBehavior,
  }

  static autoControlledProps = ['open']

  static create: ShorthandFactory

  pointerTargetRef = React.createRef()
github microsoft / fluent-ui-react / packages / react / src / components / Menu / Menu.tsx View on Github external
static create: ShorthandFactory

  static propTypes = {
    ...commonPropTypes.createCommon({
      content: false,
    }),
    activeIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    defaultActiveIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    fluid: PropTypes.bool,
    iconOnly: PropTypes.bool,
    items: customPropTypes.collectionShorthandWithKindProp(['divider', 'item']),
    onItemClick: PropTypes.func,
    pills: PropTypes.bool,
    pointing: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['start', 'end'])]),
    primary: customPropTypes.every([customPropTypes.disallow(['secondary']), PropTypes.bool]),
    secondary: customPropTypes.every([customPropTypes.disallow(['primary']), PropTypes.bool]),
    underlined: PropTypes.bool,
    vertical: PropTypes.bool,
    submenu: PropTypes.bool,
    indicator: customPropTypes.itemShorthandWithoutJSX,
  }

  static defaultProps = {
    as: 'ul',
    accessibility: menuBehavior as Accessibility,
  }

  static autoControlledProps = ['activeIndex']

  static Item = MenuItem
  static Divider = MenuDivider
github microsoft / fluent-ui-react / packages / react / src / components / Carousel / CarouselNavigationItem.tsx View on Github external
class CarouselNavigationItem extends UIComponent> {
  static displayName = 'CarouselNavigationItem'

  static className = 'ui-carousel__navigationitem'

  static create: ShorthandFactory

  static propTypes = {
    ...commonPropTypes.createCommon(),
    active: PropTypes.bool,
    icon: customPropTypes.itemShorthandWithoutJSX,
    iconOnly: PropTypes.bool,
    index: PropTypes.number,
    onClick: PropTypes.func,
    primary: customPropTypes.every([customPropTypes.disallow(['secondary']), PropTypes.bool]),
    secondary: customPropTypes.every([customPropTypes.disallow(['primary']), PropTypes.bool]),
    vertical: PropTypes.bool,
  }

  static defaultProps = {
    accessibility: tabBehavior as Accessibility,
    as: 'li',
    icon: { name: 'icon-circle', size: 'smallest' as SizeValue },
  }

  renderComponent({ ElementType, classes, accessibility, styles, variables, unhandledProps }) {
    const { children, content, icon } = this.props

    return childrenExist(children) ? (
      children
    ) : (
github microsoft / fluent-ui-react / packages / react / src / components / List / List.tsx View on Github external
static displayName = 'List'

  static className = 'ui-list'

  static slotClassNames: ListSlotClassNames = {
    item: `${List.className}__item`,
  }

  static propTypes = {
    ...commonPropTypes.createCommon({
      content: false,
    }),
    debug: PropTypes.bool,
    items: customPropTypes.collectionShorthand,
    selectable: customPropTypes.every([customPropTypes.disallow(['navigable']), PropTypes.bool]),
    navigable: customPropTypes.every([customPropTypes.disallow(['selectable']), PropTypes.bool]),
    truncateContent: PropTypes.bool,
    truncateHeader: PropTypes.bool,
    selectedIndex: PropTypes.number,
    defaultSelectedIndex: PropTypes.number,
    onSelectedIndexChange: PropTypes.func,
    horizontal: PropTypes.bool,
  }

  static defaultProps = {
    as: 'ul',
    accessibility: listBehavior as Accessibility,
  }

  static autoControlledProps = ['selectedIndex']

  getInitialAutoControlledState() {
github microsoft / fluent-ui-react / packages / react / src / components / Menu / Menu.tsx View on Github external
static create: ShorthandFactory

  static propTypes = {
    ...commonPropTypes.createCommon({
      content: false,
    }),
    activeIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    defaultActiveIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    fluid: PropTypes.bool,
    iconOnly: PropTypes.bool,
    items: customPropTypes.collectionShorthandWithKindProp(['divider', 'item']),
    onItemClick: PropTypes.func,
    pills: PropTypes.bool,
    pointing: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['start', 'end'])]),
    primary: customPropTypes.every([customPropTypes.disallow(['secondary']), PropTypes.bool]),
    secondary: customPropTypes.every([customPropTypes.disallow(['primary']), PropTypes.bool]),
    underlined: PropTypes.bool,
    vertical: PropTypes.bool,
    submenu: PropTypes.bool,
    indicator: customPropTypes.itemShorthandWithoutJSX,
  }

  static defaultProps = {
    as: 'ul',
    accessibility: menuBehavior as Accessibility,
  }

  static autoControlledProps = ['activeIndex']

  static Item = MenuItem
  static Divider = MenuDivider
github microsoft / fluent-ui-react / packages / react / src / components / Carousel / CarouselNavigation.tsx View on Github external
static displayName = 'CarouselNavigation'

  static className = 'ui-carousel__navigation'

  static create: ShorthandFactory

  static propTypes = {
    ...commonPropTypes.createCommon({
      content: false,
    }),
    activeIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    iconOnly: PropTypes.bool,
    items: customPropTypes.collectionShorthand,
    onItemClick: PropTypes.func,
    primary: customPropTypes.every([customPropTypes.disallow(['secondary']), PropTypes.bool]),
    secondary: customPropTypes.every([customPropTypes.disallow(['primary']), PropTypes.bool]),
    vertical: PropTypes.bool,
  }

  static defaultProps = {
    accessibility: tabListBehavior,
    as: 'ul',
  }

  handleItemOverrides = variables => predefinedProps => ({
    onClick: (e, itemProps) => {
      _.invoke(this.props, 'onItemClick', e, itemProps)
      _.invoke(predefinedProps, 'onClick', e, itemProps)
    },
    variables: mergeComponentVariables(variables, predefinedProps.variables),
  })