How to use the @instructure/ui-prop-types.Children.oneOf function in @instructure/ui-prop-types

To help you get started, we’ve selected a few @instructure/ui-prop-types 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 instructure / instructure-ui / packages / ui-select / src / Select / Group / index.js View on Github external
---
parent: Select
id: Select.Group
---
@module Group
**/
class Group extends Component {
  static propTypes = {
    /**
    * The label associated with the group options.
    */
    renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
    /**
    * Children of type `` that will be considered part of the group.
    */
    children: ChildrenPropTypes.oneOf([Option]),
  }

  static defaultProps = {
    children: null
  }

  /* istanbul ignore next */
  render () {
    // this component is only used for prop validation. Select.Group children
    // are parsed in Select and rendered as Options components
    return null
  }
}

export default Group
export { Group }
github instructure / instructure-ui / packages / ui-breadcrumb / src / Breadcrumb / index.js View on Github external
import theme from './theme'

/**
---
category: components
---
**/

@testable()
@themeable(theme, styles)
class Breadcrumb extends Component {
  static propTypes = {
    /**
    * children of type Breadcrumb.Link
    */
    children: Children.oneOf([BreadcrumbLink]),
    /**
    * An accessible label for the navigation
    */
    label: PropTypes.string.isRequired,
    /**
    * Sets the font-size of the breadcrumb text
    */
    size: PropTypes.oneOf(['small', 'medium', 'large']),
    /**
    * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
    * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
    * familiar CSS-like shorthand. For example: `margin="small auto large"`.
    */
    margin: ThemeablePropTypes.spacing
  }
github instructure / instructure-ui / packages / ui-options / src / Options / index.js View on Github external
* Element type to render as
    */
    as: PropTypes.elementType,
    /**
    * The aria role of the element
    */
    role: PropTypes.string,
    /**
    * The the actual list element
    */
    elementRef: PropTypes.func,
    /**
    * Content to render as a label. Mostly for when the component is nested
    */
    renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
    children: ChildrenPropTypes.oneOf(['Options', 'Item', 'Separator'])
  }

  static defaultProps = {
    as: 'span',
    role: 'list',
    elementRef: (node) => {},
    renderLabel: null,
    children: null
  }

  _labelId = uid('Options-label')

  get childAs () {
    const { as } = this.props
    if (as === 'ul' || as === 'ol') {
      return 'li'
github instructure / instructure-ui / packages / ui-forms / src / CheckboxGroup / index.js View on Github external
* when used with the `value` prop, the component will not control its own state
    */
    onChange: PropTypes.func,
    disabled: PropTypes.bool,
    readOnly: PropTypes.bool,
    /**
    * object with shape: `{
    text: PropTypes.string,
    type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
      }`
    */
    messages: PropTypes.arrayOf(FormPropTypes.message),
    /**
    * children of type `Checkbox`
    */
    children: ChildrenPropTypes.oneOf([Checkbox]),
    size: PropTypes.oneOf(['small', 'medium', 'large']),
    layout: PropTypes.oneOf([
      'stacked',
      'columns',
      'inline'
    ])
  }

  static defaultProps = {
    disabled: false,
    readOnly: false,
    size: 'medium',
    layout: 'stacked',
    defaultValue: undefined,
    messages: undefined,
    value: undefined,
github instructure / instructure-ui / packages / ui-menu / src / Menu / MenuItemGroup / index.js View on Github external
/**
---
parent: Menu
id: Menu.Group
---
**/
@testable()
@themeable(theme, styles)
class MenuItemGroup extends Component {
  static propTypes = {
    label: PropTypes.node.isRequired,
    allowMultiple: PropTypes.bool,
    /**
    * children of type `Menu.Item`, `Menu.Separator`
    */
    children: ChildrenPropTypes.oneOf([MenuItem, MenuItemSeparator]),
    /**
    * an array of the values (or indeces by default) for the selected items
    */
    selected: controllable(PropTypes.array, 'onSelect', 'defaultSelected'),
    /**
    * an array of the values (or indeces by default) for the selected items on initial render
    */
    defaultSelected: PropTypes.array,
    /**
    * call this function when a menu item is selected
    */
    onSelect: PropTypes.func,
    onMouseOver: PropTypes.func,
    onKeyDown: PropTypes.func,
    /**
    * the id of the element that the menu items will act upon
github instructure / instructure-ui / packages / ui-tabs / src / components / TabList / index.js View on Github external
import theme from './theme'

/**
---
category: components
---
**/

@testable()
@themeable(theme, styles)
export default class TabList extends Component {
  static propTypes = {
    /**
    * children of type `TabPanel`
    */
    children: Children.oneOf([TabPanel, null]),

    variant: PropTypes.oneOf(['simple', 'minimal']),
    /**
    * the index (zero based) of the panel that should be selected on initial render
    */
    defaultSelectedIndex: PropTypes.number,
    /**
    * the index (zero based) of the panel that should be selected (should be accompanied by `onChange`)
    */
    selectedIndex: controllable(PropTypes.number, 'onChange', 'defaultSelectedIndex'),
    /**
    * Call this function when the selected tab changes. When used with `selectedIndex`,
    * the component will not control its own state.
    */
    onChange: PropTypes.func,
    /**
github instructure / instructure-ui / packages / ui-elements / src / List / index.js View on Github external
import styles from './styles.css'
import theme from './theme'

/**
---
category: components
---
**/
@testable()
@themeable(theme, styles)
class List extends Component {
  static propTypes = {
    /**
    * Only accepts `` as a child
    */
    children: ChildrenPropTypes.oneOf([ListItem]),
    as: PropTypes.oneOf(['ul', 'ol']),
    /**
    * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
    * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
    * familiar CSS-like shorthand. For example: `margin="small auto large"`.
    */
    margin: ThemeablePropTypes.spacing,
    size: PropTypes.oneOf(['small', 'medium', 'large']),
    variant: PropTypes.oneOf(['default', 'unstyled', 'inline']),
    delimiter: PropTypes.oneOf(['none', 'pipe', 'slash', 'arrow', 'dashed', 'solid']),
    /**
    * Sets the margin separating each ListItem.
    */
    itemSpacing: PropTypes.oneOf([
      'none',
      'xxx-small',
github instructure / instructure-ui / packages / ui-navigation / src / AppNav / index.js View on Github external
---
category: components
---
**/
@testable()
@themeable(theme, styles)
class AppNav extends Component {
  static propTypes = {
    /**
    * Screenreader label for the overall navigation
    */
    screenReaderLabel: PropTypes.string.isRequired,
    /**
     * Only accepts `AppNav.Item` as children
     */
    children: ChildrenPropTypes.oneOf([Item]),
    /**
    * The rate (in ms) the component responds to container resizing or
    * an update to one of its child items
    */
    debounce: PropTypes.number,
    /**
    * Content to display before the navigation items, such as a logo
    */
    renderBeforeItems: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
    /**
    * Content to display after the navigation items, aligned to the far end
    * of the navigation
    */
    renderAfterItems: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
    /**
    * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
github instructure / instructure-ui / packages / ui-breadcrumb / src / Breadcrumb / index.js View on Github external
import theme from './theme'

/**
---
category: components
---
**/

@testable()
@themeable(theme, styles)
class Breadcrumb extends Component {
  static propTypes = {
    /**
    * children of type Breadcrumb.Link
    */
    children: Children.oneOf([BreadcrumbLink]),
    /**
    * An accessible label for the navigation
    */
    label: PropTypes.string.isRequired,
    /**
    * Sets the font-size of the breadcrumb text
    */
    size: PropTypes.oneOf(['small', 'medium', 'large']),
    /**
    * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
    * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
    * familiar CSS-like shorthand. For example: `margin="small auto large"`.
    */
    margin: ThemeablePropTypes.spacing
  }
github instructure / instructure-ui / packages / ui-flex / src / Flex / index.js View on Github external
@module Flex
**/
@deprecated('8.0.0', {
  inline: 'display',
  wrapItems: 'wrap',
  visualDeug: 'withVisualDebug'
})
@themeable(theme, styles)
class Flex extends Component {
  static Item = Item

  static propTypes = {
    /**
    * Flex only accepts Flex.Item as a child
    */
    children: ChildrenPropTypes.oneOf([Item]),
    /**
    * the element type to render as
    */
    as: PropTypes.elementType,
    /**
    * provides a reference to the underlying html root element
    */
    elementRef: PropTypes.func,
    /**
    * Sets the height of the component's container (optional)
    */
    height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    /**
    * Sets the width of the component's container (optional)
    */
    width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),