How to use the @instructure/ui-position.PositionPropTypes.constrain function in @instructure/ui-position

To help you get started, we’ve selected a few @instructure/ui-position 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-layout / src / Position / index.js View on Github external
* An element or a function returning an element to use as the mount node
     * for the `` (defaults to `document.body`)
     */
    mountNode: PositionPropTypes.mountNode,

    /**
     * Insert the element at the 'top' of the mountNode or at the 'bottom'
     */
    insertAt: PropTypes.oneOf(['bottom', 'top']),

    /**
     * The parent in which to constrain the placement.
     * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
     * or a function returning an element
     */
    constrain: PositionPropTypes.constrain,
    id: PropTypes.string
  }

  static defaultProps = {
    trackPosition: true,
    placement: 'bottom center',
    offsetX: 0,
    offsetY: 0,
    mountNode: null,
    target: null,
    insertAt: 'bottom',
    over: false,
    onPositioned: position => {},
    onPositionChanged: position => {},
    constrain: 'window',
    children: null,
github instructure / instructure-ui / packages / ui-popover / src / Popover / index.js View on Github external
*/
    screenReaderLabel: PropTypes.string,
    /**
     * The horizontal offset for the positioned content
     */
    offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    /**
     * The vertical offset for the positioned content
     */
    offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    /**
     * The parent in which to constrain the popover.
     * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
     * or a function returning an element
     */
    constrain: PositionPropTypes.constrain,
    /**
     * Target element for positioning the Popover (if it differs from the trigger)
     */
    positionTarget: PropTypes.oneOfType([element, PropTypes.func]),
    /**
     * An element or a function returning an element to use as the mount node
     * for the `` (defaults to `document.body`)
     */
    mountNode: PositionPropTypes.mountNode,
    /**
     * Insert the element at the 'top' of the mountNode or at the 'bottom'
     */
    insertAt: PropTypes.oneOf(['bottom', 'top']),
    /**
     * An element, function returning an element, or array of elements that will
     * not be hidden from the screen reader when the `` is open
github instructure / instructure-ui / packages / ui-menu / src / Menu / index.js View on Github external
menuRef: PropTypes.func,
    /**
     * A function that returns a reference to the ``
     */
    popoverRef: PropTypes.func,
    /**
     * If a trigger is supplied, an element or a function returning an element to use as the mount node
     * for the `<menu>` (defaults to `document.body`)
     */
    mountNode: PositionPropTypes.mountNode,
    /**
     * The parent in which to constrain the menu.
     * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
     * or a function returning an element
     */
    constrain: PositionPropTypes.constrain,
    /**
     * If a trigger is supplied, an element, function returning an element, or array of elements that will not
     * be hidden from the screen reader when the `<menu>` is open
     */
    liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
    /**
     * If a trigger is supplied, should the `<menu>` hide when an item is selected
     */
    shouldHideOnSelect: PropTypes.bool,
    /**
     * If a trigger is supplied, should the `<menu>` focus the trigger on after closing
     */
    shouldFocusTriggerOnClose: PropTypes.bool,
    /**
     * The type of `<menu>`
     */</menu></menu></menu></menu></menu>
github instructure / instructure-ui / packages / ui-select / src / Select / index.js View on Github external
* Displays messages and validation for the input. It should be an object
    * with the following shape:
    * `{
    *   text: PropTypes.string,
    *   type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
    * }`
    */
    messages: PropTypes.arrayOf(FormPropTypes.message),
    /**
    * The placement of the options list.
    */
    placement: PositionPropTypes.placement,
    /**
    * The parent in which to constrain the placement.
    */
    constrain: PositionPropTypes.constrain,
    /**
    * Callback fired when text input receives focus.
    */
    onFocus: PropTypes.func,
    /**
    * Callback fired when text input loses focus.
    */
    onBlur: PropTypes.func,
    /**
    * Callback fired when text input value changes.
    */
    onInputChange: PropTypes.func,
    /**
    * Callback fired requesting that the options list be shown.
    */
    onRequestShowOptions: PropTypes.func,