@teamturing/react-kit 2.51.2 → 2.51.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1342 -37064
- package/esm/_virtual/_commonjsHelpers.js +1 -3
- package/esm/core/ActionList/ActionListItem.js +18 -20
- package/esm/core/ActionList/ActionListSectionDivider.js +2 -2
- package/esm/core/ActionList/ActionListSectionHeader.js +3 -3
- package/esm/core/ActionList/index.js +3 -3
- package/esm/core/AnimatePresence/index.js +2 -5
- package/esm/core/Avatar/index.js +3 -3
- package/esm/core/AvatarGroup/AvatarGroupItem.js +4 -4
- package/esm/core/AvatarGroup/index.js +13 -13
- package/esm/core/BadgeAttacher/index.js +2 -2
- package/esm/core/Breadcrumbs/BreadcrumbsItem.js +4 -4
- package/esm/core/Breadcrumbs/index.js +5 -5
- package/esm/core/Button/index.js +7 -7
- package/esm/core/Card/index.js +1 -1
- package/esm/core/Checkbox/index.js +3 -3
- package/esm/core/Chip/index.js +4 -4
- package/esm/core/ClickArea/index.js +2 -2
- package/esm/core/CounterBadge/index.js +3 -3
- package/esm/core/Datagrid/DatagridBody.js +3 -3
- package/esm/core/Datagrid/DatagridCell.js +2 -2
- package/esm/core/Datagrid/DatagridHeader.js +7 -7
- package/esm/core/Datagrid/DatagridRow.js +3 -3
- package/esm/core/Datagrid/DatagridSubheader.js +3 -3
- package/esm/core/Datagrid/index.js +4 -4
- package/esm/core/DescriptionList/index.js +11 -11
- package/esm/core/Dialog/DialogBody.js +2 -2
- package/esm/core/Dialog/DialogFooter.js +2 -2
- package/esm/core/Dialog/DialogHeader.js +2 -2
- package/esm/core/Dialog/DialogHeaderSubtitle.js +2 -2
- package/esm/core/Dialog/DialogHeaderTitle.js +2 -2
- package/esm/core/Dialog/index.js +8 -8
- package/esm/core/Drawer/DrawerBody.js +2 -2
- package/esm/core/Drawer/DrawerFooter.js +2 -2
- package/esm/core/Drawer/DrawerHeader.js +2 -2
- package/esm/core/Drawer/DrawerHeaderIconButton.js +2 -2
- package/esm/core/Drawer/index.js +12 -13
- package/esm/core/EmptyState/index.js +8 -9
- package/esm/core/Flash/index.js +12 -15
- package/esm/core/FormControl/FormControlCaption.js +2 -2
- package/esm/core/FormControl/FormControlErrorMessage.js +2 -2
- package/esm/core/FormControl/FormControlLabel.js +5 -5
- package/esm/core/FormControl/FormControlSuccessMessage.js +2 -2
- package/esm/core/FormControl/FormControlTooltipIcon.js +5 -6
- package/esm/core/FormControl/index.js +8 -8
- package/esm/core/Grid/index.js +4 -6
- package/esm/core/HorizontalDivider/index.js +2 -2
- package/esm/core/IconButton/index.js +3 -3
- package/esm/core/IconToggleButton/index.js +3 -3
- package/esm/core/ItemList/index.js +2 -2
- package/esm/core/MotionView/index.js +1 -1
- package/esm/core/Overlay/index.js +4 -4
- package/esm/core/OverlayPopper/index.js +4 -6
- package/esm/core/Pagination/index.js +15 -17
- package/esm/core/Pill/index.js +11 -12
- package/esm/core/Radio/index.js +3 -3
- package/esm/core/SearchSelectInput/index.js +22 -28
- package/esm/core/Select/SelectOption.js +3 -3
- package/esm/core/Select/index.js +11 -13
- package/esm/core/Spinner/index.js +2 -3
- package/esm/core/Stack/index.js +4 -4
- package/esm/core/StyledIcon/index.js +3 -3
- package/esm/core/Switch/index.js +3 -3
- package/esm/core/Tab/TabItem.js +5 -5
- package/esm/core/Tab/index.js +18 -19
- package/esm/core/TextInput/TextInputTrailingAction.js +4 -4
- package/esm/core/TextInput/index.js +9 -11
- package/esm/core/Textarea/index.js +6 -8
- package/esm/core/ThemeProvider/index.js +2 -2
- package/esm/core/Toast/index.js +6 -8
- package/esm/core/Tooltip/BaseTooltip.js +8 -8
- package/esm/core/Tooltip/index.js +4 -4
- package/esm/core/Tooltip/useTooltip.js +1 -3
- package/esm/enigma/EnigmaUI/index.js +3 -4
- package/esm/enigma/Layout/SingleColumnLayout/index.js +4 -4
- package/esm/enigma/View/ChipGroupView/index.js +6 -6
- package/esm/enigma/View/GridView/index.js +5 -5
- package/esm/enigma/View/HorizontalDividerView/index.js +2 -2
- package/esm/enigma/View/IconView/index.js +4 -4
- package/esm/enigma/View/ImageView/index.js +2 -2
- package/esm/enigma/View/TextView/index.js +2 -2
- package/esm/hook/useFocusTrap.js +5 -5
- package/esm/hook/useFocusZone.js +2 -2
- package/esm/hook/useResize.js +1 -1
- package/esm/index.js +1 -1
- package/esm/theme/index.js +1 -13
- package/package.json +2 -2
- package/esm/_virtual/index.js +0 -3
- package/esm/_virtual/index2.js +0 -3
- package/esm/_virtual/index3.js +0 -3
- package/esm/_virtual/jsx-runtime.js +0 -3
- package/esm/_virtual/react-dom.development.js +0 -3
- package/esm/_virtual/react-dom.production.min.js +0 -3
- package/esm/_virtual/react-is.development.js +0 -3
- package/esm/_virtual/react-is.production.min.js +0 -3
- package/esm/_virtual/react-jsx-runtime.development.js +0 -3
- package/esm/_virtual/react-jsx-runtime.production.min.js +0 -3
- package/esm/_virtual/scheduler.development.js +0 -3
- package/esm/_virtual/scheduler.production.min.js +0 -3
- package/esm/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -593
- package/esm/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -731
- package/esm/node_modules/@floating-ui/react/dist/floating-ui.react.js +0 -1621
- package/esm/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +0 -233
- package/esm/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -321
- package/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -161
- package/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -136
- package/esm/node_modules/@primer/behaviors/dist/esm/focus-trap.js +0 -105
- package/esm/node_modules/@primer/behaviors/dist/esm/focus-zone.js +0 -436
- package/esm/node_modules/@primer/behaviors/dist/esm/polyfills/event-listener-signal.js +0 -38
- package/esm/node_modules/@primer/behaviors/dist/esm/utils/iterate-focusable-elements.js +0 -65
- package/esm/node_modules/@primer/behaviors/dist/esm/utils/unique-id.js +0 -6
- package/esm/node_modules/@primer/behaviors/dist/esm/utils/user-agent.js +0 -9
- package/esm/node_modules/framer-motion/dist/es/animation/animators/instant.js +0 -40
- package/esm/node_modules/framer-motion/dist/es/animation/animators/js/driver-frameloop.js +0 -16
- package/esm/node_modules/framer-motion/dist/es/animation/animators/js/index.js +0 -303
- package/esm/node_modules/framer-motion/dist/es/animation/animators/waapi/create-accelerated-animation.js +0 -199
- package/esm/node_modules/framer-motion/dist/es/animation/animators/waapi/easing.js +0 -31
- package/esm/node_modules/framer-motion/dist/es/animation/animators/waapi/index.js +0 -23
- package/esm/node_modules/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/animation/generators/inertia.js +0 -87
- package/esm/node_modules/framer-motion/dist/es/animation/generators/keyframes.js +0 -51
- package/esm/node_modules/framer-motion/dist/es/animation/generators/spring/find.js +0 -89
- package/esm/node_modules/framer-motion/dist/es/animation/generators/spring/index.js +0 -129
- package/esm/node_modules/framer-motion/dist/es/animation/generators/utils/calc-duration.js +0 -17
- package/esm/node_modules/framer-motion/dist/es/animation/generators/utils/velocity.js +0 -9
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/motion-value.js +0 -101
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/single-value.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/visual-element-target.js +0 -71
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/visual-element-variant.js +0 -63
- package/esm/node_modules/framer-motion/dist/es/animation/interfaces/visual-element.js +0 -24
- package/esm/node_modules/framer-motion/dist/es/animation/optimized-appear/data-id.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/animation/utils/default-transitions.js +0 -40
- package/esm/node_modules/framer-motion/dist/es/animation/utils/is-animatable.js +0 -30
- package/esm/node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/animation/utils/is-none.js +0 -12
- package/esm/node_modules/framer-motion/dist/es/animation/utils/keyframes.js +0 -45
- package/esm/node_modules/framer-motion/dist/es/animation/utils/transitions.js +0 -13
- package/esm/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +0 -71
- package/esm/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +0 -56
- package/esm/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +0 -158
- package/esm/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.js +0 -40
- package/esm/node_modules/framer-motion/dist/es/context/LayoutGroupContext.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/context/LazyContext.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/context/MotionConfigContext.js +0 -12
- package/esm/node_modules/framer-motion/dist/es/context/MotionContext/create.js +0 -13
- package/esm/node_modules/framer-motion/dist/es/context/MotionContext/index.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +0 -17
- package/esm/node_modules/framer-motion/dist/es/context/PresenceContext.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/debug/record.js +0 -7
- package/esm/node_modules/framer-motion/dist/es/easing/anticipate.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/easing/back.js +0 -9
- package/esm/node_modules/framer-motion/dist/es/easing/circ.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/easing/cubic-bezier.js +0 -51
- package/esm/node_modules/framer-motion/dist/es/easing/ease.js +0 -7
- package/esm/node_modules/framer-motion/dist/es/easing/modifiers/mirror.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/easing/modifiers/reverse.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/easing/utils/is-bezier-definition.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/easing/utils/is-easing-array.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/easing/utils/map.js +0 -37
- package/esm/node_modules/framer-motion/dist/es/events/add-dom-event.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/events/add-pointer-event.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/events/event-info.js +0 -15
- package/esm/node_modules/framer-motion/dist/es/events/utils/is-primary-pointer.js +0 -18
- package/esm/node_modules/framer-motion/dist/es/frameloop/batcher.js +0 -60
- package/esm/node_modules/framer-motion/dist/es/frameloop/frame.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/frameloop/render-step.js +0 -104
- package/esm/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +0 -457
- package/esm/node_modules/framer-motion/dist/es/gestures/drag/index.js +0 -27
- package/esm/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +0 -125
- package/esm/node_modules/framer-motion/dist/es/gestures/drag/utils/lock.js +0 -53
- package/esm/node_modules/framer-motion/dist/es/gestures/focus.js +0 -41
- package/esm/node_modules/framer-motion/dist/es/gestures/hover.js +0 -32
- package/esm/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +0 -148
- package/esm/node_modules/framer-motion/dist/es/gestures/pan/index.js +0 -46
- package/esm/node_modules/framer-motion/dist/es/gestures/press.js +0 -120
- package/esm/node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.js +0 -20
- package/esm/node_modules/framer-motion/dist/es/motion/features/Feature.js +0 -9
- package/esm/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +0 -31
- package/esm/node_modules/framer-motion/dist/es/motion/features/animation/index.js +0 -38
- package/esm/node_modules/framer-motion/dist/es/motion/features/animations.js +0 -13
- package/esm/node_modules/framer-motion/dist/es/motion/features/definitions.js +0 -28
- package/esm/node_modules/framer-motion/dist/es/motion/features/drag.js +0 -17
- package/esm/node_modules/framer-motion/dist/es/motion/features/gestures.js +0 -21
- package/esm/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +0 -131
- package/esm/node_modules/framer-motion/dist/es/motion/features/layout.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/motion/features/load-features.js +0 -12
- package/esm/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +0 -72
- package/esm/node_modules/framer-motion/dist/es/motion/features/viewport/observers.js +0 -49
- package/esm/node_modules/framer-motion/dist/es/motion/index.js +0 -79
- package/esm/node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/motion/utils/symbol.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +0 -33
- package/esm/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +0 -75
- package/esm/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +0 -81
- package/esm/node_modules/framer-motion/dist/es/motion/utils/valid-prop.js +0 -59
- package/esm/node_modules/framer-motion/dist/es/projection/animation/mix-values.js +0 -93
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/conversion.js +0 -33
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/copy.js +0 -20
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/delta-apply.js +0 -122
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/delta-calc.js +0 -41
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/delta-remove.js +0 -54
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/models.js +0 -17
- package/esm/node_modules/framer-motion/dist/es/projection/geometry/utils.js +0 -25
- package/esm/node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.js +0 -13
- package/esm/node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.js +0 -27
- package/esm/node_modules/framer-motion/dist/es/projection/node/create-projection-node.js +0 -1494
- package/esm/node_modules/framer-motion/dist/es/projection/node/state.js +0 -19
- package/esm/node_modules/framer-motion/dist/es/projection/shared/stack.js +0 -112
- package/esm/node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.js +0 -41
- package/esm/node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.js +0 -35
- package/esm/node_modules/framer-motion/dist/es/projection/styles/scale-correction.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/projection/styles/transform.js +0 -42
- package/esm/node_modules/framer-motion/dist/es/projection/utils/each-axis.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/projection/utils/has-transform.js +0 -24
- package/esm/node_modules/framer-motion/dist/es/projection/utils/measure.js +0 -17
- package/esm/node_modules/framer-motion/dist/es/render/VisualElement.js +0 -507
- package/esm/node_modules/framer-motion/dist/es/render/dom/DOMVisualElement.js +0 -48
- package/esm/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/render/dom/motion-proxy.js +0 -47
- package/esm/node_modules/framer-motion/dist/es/render/dom/motion.js +0 -23
- package/esm/node_modules/framer-motion/dist/es/render/dom/use-render.js +0 -35
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/create-config.js +0 -19
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.js +0 -89
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.js +0 -57
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.js +0 -30
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-element.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/parse-dom-variant.js +0 -15
- package/esm/node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.js +0 -230
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.js +0 -15
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/defaults.js +0 -30
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.js +0 -15
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/find.js +0 -15
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.js +0 -10
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/number.js +0 -72
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/test.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.js +0 -9
- package/esm/node_modules/framer-motion/dist/es/render/dom/value-types/type-int.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.js +0 -55
- package/esm/node_modules/framer-motion/dist/es/render/html/config-motion.js +0 -12
- package/esm/node_modules/framer-motion/dist/es/render/html/use-props.js +0 -57
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/build-styles.js +0 -74
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/build-transform.js +0 -45
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/render.js +0 -9
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.js +0 -17
- package/esm/node_modules/framer-motion/dist/es/render/html/utils/transform.js +0 -28
- package/esm/node_modules/framer-motion/dist/es/render/store.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.js +0 -46
- package/esm/node_modules/framer-motion/dist/es/render/svg/config-motion.js +0 -40
- package/esm/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.js +0 -33
- package/esm/node_modules/framer-motion/dist/es/render/svg/use-props.js +0 -24
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.js +0 -52
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.js +0 -30
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/is-svg-tag.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/path.js +0 -32
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/render.js +0 -12
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.js +0 -18
- package/esm/node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.js +0 -18
- package/esm/node_modules/framer-motion/dist/es/render/utils/animation-state.js +0 -319
- package/esm/node_modules/framer-motion/dist/es/render/utils/compare-by-depth.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/render/utils/flat-tree.js +0 -24
- package/esm/node_modules/framer-motion/dist/es/render/utils/is-controlling-variants.js +0 -13
- package/esm/node_modules/framer-motion/dist/es/render/utils/is-variant-label.js +0 -8
- package/esm/node_modules/framer-motion/dist/es/render/utils/motion-values.js +0 -63
- package/esm/node_modules/framer-motion/dist/es/render/utils/resolve-dynamic-variants.js +0 -24
- package/esm/node_modules/framer-motion/dist/es/render/utils/resolve-variants.js +0 -26
- package/esm/node_modules/framer-motion/dist/es/render/utils/setters.js +0 -101
- package/esm/node_modules/framer-motion/dist/es/render/utils/variant-props.js +0 -12
- package/esm/node_modules/framer-motion/dist/es/utils/array.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/utils/clamp.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/utils/delay.js +0 -19
- package/esm/node_modules/framer-motion/dist/es/utils/distance.js +0 -9
- package/esm/node_modules/framer-motion/dist/es/utils/errors.js +0 -18
- package/esm/node_modules/framer-motion/dist/es/utils/hsla-to-rgba.js +0 -42
- package/esm/node_modules/framer-motion/dist/es/utils/interpolate.js +0 -92
- package/esm/node_modules/framer-motion/dist/es/utils/is-browser.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/utils/is-numerical-string.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/utils/is-ref-object.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/utils/is-zero-value-string.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/utils/memo.js +0 -10
- package/esm/node_modules/framer-motion/dist/es/utils/mix-color.js +0 -40
- package/esm/node_modules/framer-motion/dist/es/utils/mix-complex.js +0 -64
- package/esm/node_modules/framer-motion/dist/es/utils/mix.js +0 -24
- package/esm/node_modules/framer-motion/dist/es/utils/noop.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/utils/offsets/default.js +0 -9
- package/esm/node_modules/framer-motion/dist/es/utils/offsets/fill.js +0 -12
- package/esm/node_modules/framer-motion/dist/es/utils/offsets/time.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/utils/pipe.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/utils/progress.js +0 -18
- package/esm/node_modules/framer-motion/dist/es/utils/reduced-motion/index.js +0 -19
- package/esm/node_modules/framer-motion/dist/es/utils/reduced-motion/state.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/utils/resolve-value.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/utils/shallow-compare.js +0 -14
- package/esm/node_modules/framer-motion/dist/es/utils/subscription-manager.js +0 -40
- package/esm/node_modules/framer-motion/dist/es/utils/time-conversion.js +0 -10
- package/esm/node_modules/framer-motion/dist/es/utils/use-constant.js +0 -18
- package/esm/node_modules/framer-motion/dist/es/utils/use-force-update.js +0 -19
- package/esm/node_modules/framer-motion/dist/es/utils/use-instant-transition-state.js +0 -5
- package/esm/node_modules/framer-motion/dist/es/utils/use-is-mounted.js +0 -15
- package/esm/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.js +0 -6
- package/esm/node_modules/framer-motion/dist/es/utils/use-unmount-effect.js +0 -7
- package/esm/node_modules/framer-motion/dist/es/utils/velocity-per-second.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/utils/warn-once.js +0 -11
- package/esm/node_modules/framer-motion/dist/es/value/index.js +0 -331
- package/esm/node_modules/framer-motion/dist/es/value/types/color/hex.js +0 -40
- package/esm/node_modules/framer-motion/dist/es/value/types/color/hsla.js +0 -22
- package/esm/node_modules/framer-motion/dist/es/value/types/color/index.js +0 -28
- package/esm/node_modules/framer-motion/dist/es/value/types/color/rgba.js +0 -25
- package/esm/node_modules/framer-motion/dist/es/value/types/color/utils.js +0 -23
- package/esm/node_modules/framer-motion/dist/es/value/types/complex/filter.js +0 -30
- package/esm/node_modules/framer-motion/dist/es/value/types/complex/index.js +0 -92
- package/esm/node_modules/framer-motion/dist/es/value/types/numbers/index.js +0 -17
- package/esm/node_modules/framer-motion/dist/es/value/types/numbers/units.js +0 -19
- package/esm/node_modules/framer-motion/dist/es/value/types/utils.js +0 -15
- package/esm/node_modules/framer-motion/dist/es/value/use-will-change/is.js +0 -7
- package/esm/node_modules/framer-motion/dist/es/value/utils/is-motion-value.js +0 -3
- package/esm/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.js +0 -16
- package/esm/node_modules/lodash.debounce/index.js +0 -363
- package/esm/node_modules/lodash.throttle/index.js +0 -424
- package/esm/node_modules/lodash.toarray/index.js +0 -849
- package/esm/node_modules/react/cjs/react-jsx-runtime.development.js +0 -1140
- package/esm/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -53
- package/esm/node_modules/react/jsx-runtime.js +0 -12
- package/esm/node_modules/react-dom/cjs/react-dom.development.js +0 -4940
- package/esm/node_modules/react-dom/cjs/react-dom.production.min.js +0 -7140
- package/esm/node_modules/react-dom/index.js +0 -39
- package/esm/node_modules/react-is/cjs/react-is.development.js +0 -211
- package/esm/node_modules/react-is/cjs/react-is.production.min.js +0 -123
- package/esm/node_modules/react-is/index.js +0 -12
- package/esm/node_modules/scheduler/cjs/scheduler.development.js +0 -528
- package/esm/node_modules/scheduler/cjs/scheduler.production.min.js +0 -267
- package/esm/node_modules/scheduler/index.js +0 -17
- package/esm/node_modules/tabbable/dist/index.esm.js +0 -560
- package/esm/packages/icons/esm/AHorizontalLine.js +0 -15
- package/esm/packages/icons/esm/AInCircleFilled.js +0 -21
- package/esm/packages/icons/esm/AVertialLine.js +0 -15
- package/esm/packages/icons/esm/Ai.js +0 -23
- package/esm/packages/icons/esm/AiColor.js +0 -23
- package/esm/packages/icons/esm/AiSad.js +0 -24
- package/esm/packages/icons/esm/Alarm.js +0 -17
- package/esm/packages/icons/esm/AppleColor.js +0 -18
- package/esm/packages/icons/esm/ArrowBelow.js +0 -17
- package/esm/packages/icons/esm/ArrowDiagonal.js +0 -15
- package/esm/packages/icons/esm/ArrowDown.js +0 -17
- package/esm/packages/icons/esm/ArrowLeft.js +0 -17
- package/esm/packages/icons/esm/ArrowLeftCircle.js +0 -15
- package/esm/packages/icons/esm/ArrowLeftLimit.js +0 -17
- package/esm/packages/icons/esm/ArrowLeftRight.js +0 -17
- package/esm/packages/icons/esm/ArrowRight.js +0 -17
- package/esm/packages/icons/esm/ArrowRightCircle.js +0 -15
- package/esm/packages/icons/esm/ArrowRightLimit.js +0 -17
- package/esm/packages/icons/esm/ArrowUp.js +0 -17
- package/esm/packages/icons/esm/ArrowUpDown.js +0 -17
- package/esm/packages/icons/esm/ArrowUpLimit.js +0 -17
- package/esm/packages/icons/esm/Barchart.js +0 -15
- package/esm/packages/icons/esm/Book.js +0 -17
- package/esm/packages/icons/esm/BookColor.js +0 -28
- package/esm/packages/icons/esm/Bookmark.js +0 -17
- package/esm/packages/icons/esm/BookmarkAnimation.js +0 -17
- package/esm/packages/icons/esm/Box.js +0 -24
- package/esm/packages/icons/esm/BoxPlus.js +0 -15
- package/esm/packages/icons/esm/BusColor.js +0 -36
- package/esm/packages/icons/esm/Calendar.js +0 -22
- package/esm/packages/icons/esm/CalendarCheck.js +0 -17
- package/esm/packages/icons/esm/CalendarCheckColor.js +0 -20
- package/esm/packages/icons/esm/CalendarColor.js +0 -36
- package/esm/packages/icons/esm/Camera.js +0 -22
- package/esm/packages/icons/esm/CameraColor.js +0 -30
- package/esm/packages/icons/esm/Card.js +0 -17
- package/esm/packages/icons/esm/CardsPercent.js +0 -19
- package/esm/packages/icons/esm/CardsPercentColor.js +0 -23
- package/esm/packages/icons/esm/CaretDown.js +0 -15
- package/esm/packages/icons/esm/CaretLeft.js +0 -15
- package/esm/packages/icons/esm/CaretRight.js +0 -15
- package/esm/packages/icons/esm/CaretUp.js +0 -15
- package/esm/packages/icons/esm/Cart.js +0 -17
- package/esm/packages/icons/esm/ChatBubble.js +0 -17
- package/esm/packages/icons/esm/ChatBubbleBadgeColor.js +0 -32
- package/esm/packages/icons/esm/ChatBubbleCorrect.js +0 -24
- package/esm/packages/icons/esm/ChatBubbleCorrectColor.js +0 -22
- package/esm/packages/icons/esm/ChatBubbleDots.js +0 -17
- package/esm/packages/icons/esm/ChatBubbleQuestion.js +0 -17
- package/esm/packages/icons/esm/ChatBubbleQuestionAnimation.js +0 -16
- package/esm/packages/icons/esm/ChatBubbleQuestionColor.js +0 -20
- package/esm/packages/icons/esm/Check.js +0 -15
- package/esm/packages/icons/esm/CheckInCircle.js +0 -17
- package/esm/packages/icons/esm/CheckInCircleColor.js +0 -20
- package/esm/packages/icons/esm/CheckInCircleLine.js +0 -20
- package/esm/packages/icons/esm/ChevronDown.js +0 -17
- package/esm/packages/icons/esm/ChevronDownTwo.js +0 -23
- package/esm/packages/icons/esm/ChevronLeft.js +0 -17
- package/esm/packages/icons/esm/ChevronRight.js +0 -17
- package/esm/packages/icons/esm/ChevronRightTwo.js +0 -23
- package/esm/packages/icons/esm/ChevronUp.js +0 -17
- package/esm/packages/icons/esm/ChevronUpTwo.js +0 -23
- package/esm/packages/icons/esm/Circles.js +0 -17
- package/esm/packages/icons/esm/Clip.js +0 -15
- package/esm/packages/icons/esm/Close.js +0 -17
- package/esm/packages/icons/esm/CloseInCircle.js +0 -17
- package/esm/packages/icons/esm/Coin.js +0 -17
- package/esm/packages/icons/esm/Contact.js +0 -17
- package/esm/packages/icons/esm/Copy.js +0 -22
- package/esm/packages/icons/esm/Correct.js +0 -16
- package/esm/packages/icons/esm/Coupon.js +0 -17
- package/esm/packages/icons/esm/Crop.js +0 -24
- package/esm/packages/icons/esm/Crown.js +0 -17
- package/esm/packages/icons/esm/Curriculum.js +0 -31
- package/esm/packages/icons/esm/CurriculumColor.js +0 -38
- package/esm/packages/icons/esm/Cursor.js +0 -22
- package/esm/packages/icons/esm/Delete.js +0 -17
- package/esm/packages/icons/esm/Document.js +0 -22
- package/esm/packages/icons/esm/Dots.js +0 -17
- package/esm/packages/icons/esm/Download.js +0 -18
- package/esm/packages/icons/esm/Emoji.js +0 -17
- package/esm/packages/icons/esm/EmojiPlus.js +0 -22
- package/esm/packages/icons/esm/EmojiPlusDash.js +0 -17
- package/esm/packages/icons/esm/Eng.js +0 -20
- package/esm/packages/icons/esm/Enter.js +0 -17
- package/esm/packages/icons/esm/Equal.js +0 -17
- package/esm/packages/icons/esm/Eraser.js +0 -17
- package/esm/packages/icons/esm/ExclamationPointInCircle.js +0 -17
- package/esm/packages/icons/esm/ExternalLink.js +0 -27
- package/esm/packages/icons/esm/EyeOff.js +0 -15
- package/esm/packages/icons/esm/EyeOn.js +0 -22
- package/esm/packages/icons/esm/EyesTwo.js +0 -15
- package/esm/packages/icons/esm/FaceHappy.js +0 -17
- package/esm/packages/icons/esm/FaceSad.js +0 -17
- package/esm/packages/icons/esm/Facebook.js +0 -15
- package/esm/packages/icons/esm/FacebookColor.js +0 -20
- package/esm/packages/icons/esm/Filter.js +0 -17
- package/esm/packages/icons/esm/Find.js +0 -17
- package/esm/packages/icons/esm/Fire.js +0 -15
- package/esm/packages/icons/esm/FireColor.js +0 -27
- package/esm/packages/icons/esm/Flag.js +0 -15
- package/esm/packages/icons/esm/Folder.js +0 -17
- package/esm/packages/icons/esm/Frame.js +0 -17
- package/esm/packages/icons/esm/Glasses.js +0 -17
- package/esm/packages/icons/esm/Global.js +0 -17
- package/esm/packages/icons/esm/GoogleColor.js +0 -35
- package/esm/packages/icons/esm/Graph.js +0 -17
- package/esm/packages/icons/esm/Hair.js +0 -17
- package/esm/packages/icons/esm/Headphone.js +0 -17
- package/esm/packages/icons/esm/Heart.js +0 -17
- package/esm/packages/icons/esm/Home.js +0 -17
- package/esm/packages/icons/esm/Infinite.js +0 -15
- package/esm/packages/icons/esm/InfoInCircle.js +0 -17
- package/esm/packages/icons/esm/Instagram.js +0 -17
- package/esm/packages/icons/esm/KakaoColor.js +0 -20
- package/esm/packages/icons/esm/Kor.js +0 -20
- package/esm/packages/icons/esm/LandscapeArrow.js +0 -20
- package/esm/packages/icons/esm/League.js +0 -17
- package/esm/packages/icons/esm/Letter.js +0 -17
- package/esm/packages/icons/esm/LetterCrownColor.js +0 -26
- package/esm/packages/icons/esm/LetterCrownOpenColor.js +0 -35
- package/esm/packages/icons/esm/LetterHeartColor.js +0 -26
- package/esm/packages/icons/esm/LetterHeartOpenColor.js +0 -35
- package/esm/packages/icons/esm/LineThree.js +0 -17
- package/esm/packages/icons/esm/Link.js +0 -22
- package/esm/packages/icons/esm/Lock.js +0 -17
- package/esm/packages/icons/esm/LogoApple.js +0 -17
- package/esm/packages/icons/esm/LogoColor.js +0 -22
- package/esm/packages/icons/esm/LogoFacebook.js +0 -17
- package/esm/packages/icons/esm/LogoKakao.js +0 -17
- package/esm/packages/icons/esm/LogoNaver.js +0 -15
- package/esm/packages/icons/esm/MagicWand.js +0 -22
- package/esm/packages/icons/esm/Maxsize.js +0 -15
- package/esm/packages/icons/esm/Minsize.js +0 -17
- package/esm/packages/icons/esm/Minus.js +0 -17
- package/esm/packages/icons/esm/MinusInCircle.js +0 -17
- package/esm/packages/icons/esm/Moneybag.js +0 -17
- package/esm/packages/icons/esm/MoneybagColor.js +0 -20
- package/esm/packages/icons/esm/Moon.js +0 -15
- package/esm/packages/icons/esm/More.js +0 -17
- package/esm/packages/icons/esm/MyBubble.js +0 -17
- package/esm/packages/icons/esm/NaverColor.js +0 -18
- package/esm/packages/icons/esm/New.js +0 -22
- package/esm/packages/icons/esm/Note.js +0 -17
- package/esm/packages/icons/esm/NoteColor.js +0 -18
- package/esm/packages/icons/esm/NotePenColor.js +0 -46
- package/esm/packages/icons/esm/NumberFiveFilled.js +0 -17
- package/esm/packages/icons/esm/NumberFiveOutlined.js +0 -20
- package/esm/packages/icons/esm/NumberFourFilled.js +0 -17
- package/esm/packages/icons/esm/NumberFourOutlined.js +0 -20
- package/esm/packages/icons/esm/NumberOneFilled.js +0 -17
- package/esm/packages/icons/esm/NumberOneOutlined.js +0 -20
- package/esm/packages/icons/esm/NumberThreeFilled.js +0 -17
- package/esm/packages/icons/esm/NumberThreeOutlined.js +0 -20
- package/esm/packages/icons/esm/NumberTwoFilled.js +0 -17
- package/esm/packages/icons/esm/NumberTwoOutlined.js +0 -20
- package/esm/packages/icons/esm/Out.js +0 -17
- package/esm/packages/icons/esm/PalmTreeColor.js +0 -41
- package/esm/packages/icons/esm/PaperCheck.js +0 -36
- package/esm/packages/icons/esm/PaperPen.js +0 -31
- package/esm/packages/icons/esm/PaperPenColor.js +0 -20
- package/esm/packages/icons/esm/PaperTwo.js +0 -18
- package/esm/packages/icons/esm/Pause.js +0 -17
- package/esm/packages/icons/esm/Pen.js +0 -17
- package/esm/packages/icons/esm/PercentInCircle.js +0 -22
- package/esm/packages/icons/esm/Picture.js +0 -17
- package/esm/packages/icons/esm/Pill.js +0 -25
- package/esm/packages/icons/esm/PillColor.js +0 -18
- package/esm/packages/icons/esm/Pin.js +0 -17
- package/esm/packages/icons/esm/PinColorRed.js +0 -26
- package/esm/packages/icons/esm/Play.js +0 -15
- package/esm/packages/icons/esm/Plus.js +0 -17
- package/esm/packages/icons/esm/PlusInCircle.js +0 -17
- package/esm/packages/icons/esm/PointInCircle.js +0 -22
- package/esm/packages/icons/esm/PointInCircleColor.js +0 -27
- package/esm/packages/icons/esm/PortraitArrow.js +0 -20
- package/esm/packages/icons/esm/Present.js +0 -21
- package/esm/packages/icons/esm/PresentColor.js +0 -20
- package/esm/packages/icons/esm/Print.js +0 -20
- package/esm/packages/icons/esm/Problem.js +0 -15
- package/esm/packages/icons/esm/Profile.js +0 -17
- package/esm/packages/icons/esm/ProgressGradient.js +0 -41
- package/esm/packages/icons/esm/QuestionMarkInCircle.js +0 -17
- package/esm/packages/icons/esm/QuestionMarkInCircleOutlined.js +0 -20
- package/esm/packages/icons/esm/QuizColor.js +0 -28
- package/esm/packages/icons/esm/RaffleColor.js +0 -113
- package/esm/packages/icons/esm/Receipt.js +0 -17
- package/esm/packages/icons/esm/Refresh.js +0 -17
- package/esm/packages/icons/esm/Repeat.js +0 -15
- package/esm/packages/icons/esm/ReportColor.js +0 -30
- package/esm/packages/icons/esm/School.js +0 -20
- package/esm/packages/icons/esm/SchoolColor.js +0 -27
- package/esm/packages/icons/esm/Scroll.js +0 -22
- package/esm/packages/icons/esm/Search.js +0 -15
- package/esm/packages/icons/esm/Set.js +0 -20
- package/esm/packages/icons/esm/Setting.js +0 -17
- package/esm/packages/icons/esm/Share.js +0 -22
- package/esm/packages/icons/esm/ShieldCheck.js +0 -15
- package/esm/packages/icons/esm/Sidebar.js +0 -17
- package/esm/packages/icons/esm/Siren.js +0 -17
- package/esm/packages/icons/esm/Skipback.js +0 -17
- package/esm/packages/icons/esm/Skipforward.js +0 -17
- package/esm/packages/icons/esm/SoundOff.js +0 -15
- package/esm/packages/icons/esm/SoundOn.js +0 -25
- package/esm/packages/icons/esm/SoundPaper.js +0 -20
- package/esm/packages/icons/esm/Speaker.js +0 -17
- package/esm/packages/icons/esm/Stackup.js +0 -27
- package/esm/packages/icons/esm/Star.js +0 -17
- package/esm/packages/icons/esm/StarColor.js +0 -21
- package/esm/packages/icons/esm/Store.js +0 -15
- package/esm/packages/icons/esm/Sun.js +0 -15
- package/esm/packages/icons/esm/Sync.js +0 -17
- package/esm/packages/icons/esm/TestUploadColor.js +0 -26
- package/esm/packages/icons/esm/Thumbdown.js +0 -17
- package/esm/packages/icons/esm/Thumbup.js +0 -17
- package/esm/packages/icons/esm/Thunder.js +0 -17
- package/esm/packages/icons/esm/Ticket.js +0 -17
- package/esm/packages/icons/esm/TicketColor.js +0 -29
- package/esm/packages/icons/esm/Time.js +0 -17
- package/esm/packages/icons/esm/Timer.js +0 -17
- package/esm/packages/icons/esm/Top.js +0 -17
- package/esm/packages/icons/esm/Touch.js +0 -26
- package/esm/packages/icons/esm/Trash.js +0 -17
- package/esm/packages/icons/esm/Treasurebox.js +0 -22
- package/esm/packages/icons/esm/Trophy.js +0 -17
- package/esm/packages/icons/esm/Twinkle.js +0 -15
- package/esm/packages/icons/esm/TwinkleColor.js +0 -48
- package/esm/packages/icons/esm/Undo.js +0 -17
- package/esm/packages/icons/esm/University.js +0 -26
- package/esm/packages/icons/esm/UserBlocked.js +0 -17
- package/esm/packages/icons/esm/UserCheck.js +0 -17
- package/esm/packages/icons/esm/UserPlus.js +0 -17
- package/esm/packages/icons/esm/UserTwo.js +0 -23
- package/esm/packages/icons/esm/Video.js +0 -17
- package/esm/packages/icons/esm/VideoColor.js +0 -18
- package/esm/packages/icons/esm/VoteColor.js +0 -24
- package/esm/packages/icons/esm/Warning.js +0 -17
- package/esm/packages/icons/esm/Wifi.js +0 -27
- package/esm/packages/icons/esm/Workbook.js +0 -28
- package/esm/packages/icons/esm/WorkbookColor.js +0 -29
- package/esm/packages/icons/esm/Wrong.js +0 -20
- package/esm/packages/icons/esm/Youtube.js +0 -17
- package/esm/packages/icons/esm/_virtual/_rollupPluginBabelHelpers.js +0 -16
- package/esm/packages/icons/esm/index.js +0 -242
- package/esm/packages/token-studio/esm/foundation/breakpoint/device.js +0 -7
- package/esm/packages/token-studio/esm/foundation/gradient/colorStopList/index.js +0 -9
- package/esm/packages/token-studio/esm/foundation/gradient/direction/index.js +0 -9
- package/esm/packages/token-studio/esm/foundation/opacity/index.js +0 -5
- package/esm/packages/token-studio/esm/foundation/palette/index.js +0 -169
- package/esm/packages/token-studio/esm/foundation/rounding/index.js +0 -13
- package/esm/packages/token-studio/esm/foundation/shadow/index.js +0 -5
- package/esm/packages/token-studio/esm/foundation/spacing/index.js +0 -56
- package/esm/packages/token-studio/esm/foundation/typography/fontSize/index.js +0 -18
- package/esm/packages/token-studio/esm/foundation/typography/fontWeight/index.js +0 -13
- package/esm/packages/token-studio/esm/foundation/typography/lineHeight/index.js +0 -6
- package/esm/packages/token-studio/esm/token/breakpoints/index.js +0 -6
- package/esm/packages/token-studio/esm/token/color/gpai/dark.js +0 -223
- package/esm/packages/token-studio/esm/token/color/gpai/light.js +0 -223
- package/esm/packages/token-studio/esm/token/color/index.js +0 -223
- package/esm/packages/token-studio/esm/token/elevation/index.js +0 -7
- package/esm/packages/token-studio/esm/token/gradient/index.js +0 -41
- package/esm/packages/token-studio/esm/token/opacity/index.js +0 -7
- package/esm/packages/token-studio/esm/token/radii/index.js +0 -15
- package/esm/packages/token-studio/esm/token/space/index.js +0 -55
- package/esm/packages/token-studio/esm/token/typography/fontSizes.js +0 -17
- package/esm/packages/token-studio/esm/token/typography/fontWeights.js +0 -9
- package/esm/packages/token-studio/esm/token/typography/index.js +0 -133
- package/esm/packages/token-studio/esm/token/typography/lineHeights.js +0 -8
- package/esm/packages/utils/esm/commaizeNumber.js +0 -10
- package/esm/packages/utils/esm/forcePixelValue.js +0 -8
- package/esm/packages/utils/esm/isArray.js +0 -3
- package/esm/packages/utils/esm/isFunction.js +0 -3
- package/esm/packages/utils/esm/isNullable.js +0 -3
- package/esm/packages/utils/esm/noop.js +0 -6
- package/esm/packages/utils/esm/scrollIntoView.js +0 -46
|
@@ -1,1621 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useModernLayoutEffect as index, enableFocusInside, isOutsideEvent, getPreviousTabbable, getNextTabbable, useEffectEvent, useLatestRef, getDocument, isMouseLikePointerType, isSafari, getNodeChildren, isReactEvent, getTarget, isRootElement, contains, isEventTargetWithin, isTypeableElement, matchesFocusVisible, activeElement, getFloatingFocusElement, disableFocusInside, isMac } from './floating-ui.react.utils.js';
|
|
3
|
-
import { j as jsxRuntimeExports } from '../../../react/jsx-runtime.js';
|
|
4
|
-
import { isElement, getComputedStyle, isNode, isLastTraversableNode, getParentNode, isHTMLElement, getOverflowAncestors, getWindow, isWebKit } from '../../utils/dist/floating-ui.utils.dom.js';
|
|
5
|
-
import { r as reactDomExports } from '../../../react-dom/index.js';
|
|
6
|
-
import { useFloating as useFloating$1 } from '../../react-dom/dist/floating-ui.react-dom.js';
|
|
7
|
-
export { arrow, flip, offset, shift } from '../../react-dom/dist/floating-ui.react-dom.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Merges an array of refs into a single memoized callback ref or `null`.
|
|
11
|
-
* @see https://floating-ui.com/docs/react-utils#usemergerefs
|
|
12
|
-
*/
|
|
13
|
-
function useMergeRefs(refs) {
|
|
14
|
-
const cleanupRef = React.useRef(undefined);
|
|
15
|
-
const refEffect = React.useCallback(instance => {
|
|
16
|
-
const cleanups = refs.map(ref => {
|
|
17
|
-
if (ref == null) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (typeof ref === 'function') {
|
|
21
|
-
const refCallback = ref;
|
|
22
|
-
const refCleanup = refCallback(instance);
|
|
23
|
-
return typeof refCleanup === 'function' ? refCleanup : () => {
|
|
24
|
-
refCallback(null);
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
ref.current = instance;
|
|
28
|
-
return () => {
|
|
29
|
-
ref.current = null;
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
return () => {
|
|
33
|
-
cleanups.forEach(refCleanup => refCleanup == null ? void 0 : refCleanup());
|
|
34
|
-
};
|
|
35
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
-
}, refs);
|
|
37
|
-
return React.useMemo(() => {
|
|
38
|
-
if (refs.every(ref => ref == null)) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return value => {
|
|
42
|
-
if (cleanupRef.current) {
|
|
43
|
-
cleanupRef.current();
|
|
44
|
-
cleanupRef.current = undefined;
|
|
45
|
-
}
|
|
46
|
-
if (value != null) {
|
|
47
|
-
cleanupRef.current = refEffect(value);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
-
}, refs);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const FOCUSABLE_ATTRIBUTE = 'data-floating-ui-focusable';
|
|
55
|
-
const ACTIVE_KEY = 'active';
|
|
56
|
-
const SELECTED_KEY = 'selected';
|
|
57
|
-
|
|
58
|
-
// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379
|
|
59
|
-
const SafeReact = {
|
|
60
|
-
...React
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
let serverHandoffComplete = false;
|
|
64
|
-
let count = 0;
|
|
65
|
-
const genId = () => // Ensure the id is unique with multiple independent versions of Floating UI
|
|
66
|
-
// on <React 18
|
|
67
|
-
"floating-ui-" + Math.random().toString(36).slice(2, 6) + count++;
|
|
68
|
-
function useFloatingId() {
|
|
69
|
-
const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : undefined);
|
|
70
|
-
index(() => {
|
|
71
|
-
if (id == null) {
|
|
72
|
-
setId(genId());
|
|
73
|
-
}
|
|
74
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
-
}, []);
|
|
76
|
-
React.useEffect(() => {
|
|
77
|
-
serverHandoffComplete = true;
|
|
78
|
-
}, []);
|
|
79
|
-
return id;
|
|
80
|
-
}
|
|
81
|
-
const useReactId = SafeReact.useId;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Uses React 18's built-in `useId()` when available, or falls back to a
|
|
85
|
-
* slightly less performant (requiring a double render) implementation for
|
|
86
|
-
* earlier React versions.
|
|
87
|
-
* @see https://floating-ui.com/docs/react-utils#useid
|
|
88
|
-
*/
|
|
89
|
-
const useId = useReactId || useFloatingId;
|
|
90
|
-
|
|
91
|
-
let devMessageSet;
|
|
92
|
-
if (process.env.NODE_ENV !== "production") {
|
|
93
|
-
devMessageSet = /*#__PURE__*/new Set();
|
|
94
|
-
}
|
|
95
|
-
function warn() {
|
|
96
|
-
var _devMessageSet;
|
|
97
|
-
for (var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
98
|
-
messages[_key] = arguments[_key];
|
|
99
|
-
}
|
|
100
|
-
const message = "Floating UI: " + messages.join(' ');
|
|
101
|
-
if (!((_devMessageSet = devMessageSet) != null && _devMessageSet.has(message))) {
|
|
102
|
-
var _devMessageSet2;
|
|
103
|
-
(_devMessageSet2 = devMessageSet) == null || _devMessageSet2.add(message);
|
|
104
|
-
console.warn(message);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function error() {
|
|
108
|
-
var _devMessageSet3;
|
|
109
|
-
for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
110
|
-
messages[_key2] = arguments[_key2];
|
|
111
|
-
}
|
|
112
|
-
const message = "Floating UI: " + messages.join(' ');
|
|
113
|
-
if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
|
|
114
|
-
var _devMessageSet4;
|
|
115
|
-
(_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
|
|
116
|
-
console.error(message);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Renders a pointing arrow triangle.
|
|
122
|
-
* @see https://floating-ui.com/docs/FloatingArrow
|
|
123
|
-
*/
|
|
124
|
-
const FloatingArrow = /*#__PURE__*/React.forwardRef(function FloatingArrow(props, ref) {
|
|
125
|
-
const {
|
|
126
|
-
context: {
|
|
127
|
-
placement,
|
|
128
|
-
elements: {
|
|
129
|
-
floating
|
|
130
|
-
},
|
|
131
|
-
middlewareData: {
|
|
132
|
-
arrow,
|
|
133
|
-
shift
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
width = 14,
|
|
137
|
-
height = 7,
|
|
138
|
-
tipRadius = 0,
|
|
139
|
-
strokeWidth = 0,
|
|
140
|
-
staticOffset,
|
|
141
|
-
stroke,
|
|
142
|
-
d,
|
|
143
|
-
style: {
|
|
144
|
-
transform,
|
|
145
|
-
...restStyle
|
|
146
|
-
} = {},
|
|
147
|
-
...rest
|
|
148
|
-
} = props;
|
|
149
|
-
if (process.env.NODE_ENV !== "production") {
|
|
150
|
-
if (!ref) {
|
|
151
|
-
warn('The `ref` prop is required for `FloatingArrow`.');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
const clipPathId = useId();
|
|
155
|
-
const [isRTL, setIsRTL] = React.useState(false);
|
|
156
|
-
|
|
157
|
-
// https://github.com/floating-ui/floating-ui/issues/2932
|
|
158
|
-
index(() => {
|
|
159
|
-
if (!floating) return;
|
|
160
|
-
const isRTL = getComputedStyle(floating).direction === 'rtl';
|
|
161
|
-
if (isRTL) {
|
|
162
|
-
setIsRTL(true);
|
|
163
|
-
}
|
|
164
|
-
}, [floating]);
|
|
165
|
-
if (!floating) {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
const [side, alignment] = placement.split('-');
|
|
169
|
-
const isVerticalSide = side === 'top' || side === 'bottom';
|
|
170
|
-
let computedStaticOffset = staticOffset;
|
|
171
|
-
if (isVerticalSide && shift != null && shift.x || !isVerticalSide && shift != null && shift.y) {
|
|
172
|
-
computedStaticOffset = null;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Strokes must be double the border width, this ensures the stroke's width
|
|
176
|
-
// works as you'd expect.
|
|
177
|
-
const computedStrokeWidth = strokeWidth * 2;
|
|
178
|
-
const halfStrokeWidth = computedStrokeWidth / 2;
|
|
179
|
-
const svgX = width / 2 * (tipRadius / -8 + 1);
|
|
180
|
-
const svgY = height / 2 * tipRadius / 4;
|
|
181
|
-
const isCustomShape = !!d;
|
|
182
|
-
const yOffsetProp = computedStaticOffset && alignment === 'end' ? 'bottom' : 'top';
|
|
183
|
-
let xOffsetProp = computedStaticOffset && alignment === 'end' ? 'right' : 'left';
|
|
184
|
-
if (computedStaticOffset && isRTL) {
|
|
185
|
-
xOffsetProp = alignment === 'end' ? 'left' : 'right';
|
|
186
|
-
}
|
|
187
|
-
const arrowX = (arrow == null ? void 0 : arrow.x) != null ? computedStaticOffset || arrow.x : '';
|
|
188
|
-
const arrowY = (arrow == null ? void 0 : arrow.y) != null ? computedStaticOffset || arrow.y : '';
|
|
189
|
-
const dValue = d || 'M0,0' + (" H" + width) + (" L" + (width - svgX) + "," + (height - svgY)) + (" Q" + width / 2 + "," + height + " " + svgX + "," + (height - svgY)) + ' Z';
|
|
190
|
-
const rotation = {
|
|
191
|
-
top: isCustomShape ? 'rotate(180deg)' : '',
|
|
192
|
-
left: isCustomShape ? 'rotate(90deg)' : 'rotate(-90deg)',
|
|
193
|
-
bottom: isCustomShape ? '' : 'rotate(180deg)',
|
|
194
|
-
right: isCustomShape ? 'rotate(-90deg)' : 'rotate(90deg)'
|
|
195
|
-
}[side];
|
|
196
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs("svg", {
|
|
197
|
-
...rest,
|
|
198
|
-
"aria-hidden": true,
|
|
199
|
-
ref: ref,
|
|
200
|
-
width: isCustomShape ? width : width + computedStrokeWidth,
|
|
201
|
-
height: width,
|
|
202
|
-
viewBox: "0 0 " + width + " " + (height > width ? height : width),
|
|
203
|
-
style: {
|
|
204
|
-
position: 'absolute',
|
|
205
|
-
pointerEvents: 'none',
|
|
206
|
-
[xOffsetProp]: arrowX,
|
|
207
|
-
[yOffsetProp]: arrowY,
|
|
208
|
-
[side]: isVerticalSide || isCustomShape ? '100%' : "calc(100% - " + computedStrokeWidth / 2 + "px)",
|
|
209
|
-
transform: [rotation, transform].filter(t => !!t).join(' '),
|
|
210
|
-
...restStyle
|
|
211
|
-
},
|
|
212
|
-
children: [computedStrokeWidth > 0 && /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
213
|
-
clipPath: "url(#" + clipPathId + ")",
|
|
214
|
-
fill: "none",
|
|
215
|
-
stroke: stroke
|
|
216
|
-
// Account for the stroke on the fill path rendered below.
|
|
217
|
-
,
|
|
218
|
-
strokeWidth: computedStrokeWidth + (d ? 0 : 1),
|
|
219
|
-
d: dValue
|
|
220
|
-
}), /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
221
|
-
stroke: computedStrokeWidth && !d ? rest.fill : 'none',
|
|
222
|
-
d: dValue
|
|
223
|
-
}), /*#__PURE__*/jsxRuntimeExports.jsx("clipPath", {
|
|
224
|
-
id: clipPathId,
|
|
225
|
-
children: /*#__PURE__*/jsxRuntimeExports.jsx("rect", {
|
|
226
|
-
x: -halfStrokeWidth,
|
|
227
|
-
y: halfStrokeWidth * (isCustomShape ? -1 : 1),
|
|
228
|
-
width: width + computedStrokeWidth,
|
|
229
|
-
height: width
|
|
230
|
-
})
|
|
231
|
-
})]
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
function createEventEmitter() {
|
|
236
|
-
const map = new Map();
|
|
237
|
-
return {
|
|
238
|
-
emit(event, data) {
|
|
239
|
-
var _map$get;
|
|
240
|
-
(_map$get = map.get(event)) == null || _map$get.forEach(listener => listener(data));
|
|
241
|
-
},
|
|
242
|
-
on(event, listener) {
|
|
243
|
-
if (!map.has(event)) {
|
|
244
|
-
map.set(event, new Set());
|
|
245
|
-
}
|
|
246
|
-
map.get(event).add(listener);
|
|
247
|
-
},
|
|
248
|
-
off(event, listener) {
|
|
249
|
-
var _map$get2;
|
|
250
|
-
(_map$get2 = map.get(event)) == null || _map$get2.delete(listener);
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const FloatingNodeContext = /*#__PURE__*/React.createContext(null);
|
|
256
|
-
const FloatingTreeContext = /*#__PURE__*/React.createContext(null);
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Returns the parent node id for nested floating elements, if available.
|
|
260
|
-
* Returns `null` for top-level floating elements.
|
|
261
|
-
*/
|
|
262
|
-
const useFloatingParentNodeId = () => {
|
|
263
|
-
var _React$useContext;
|
|
264
|
-
return ((_React$useContext = React.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Returns the nearest floating tree context, if available.
|
|
269
|
-
*/
|
|
270
|
-
const useFloatingTree = () => React.useContext(FloatingTreeContext);
|
|
271
|
-
|
|
272
|
-
function createAttribute(name) {
|
|
273
|
-
return "data-floating-ui-" + name;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function clearTimeoutIfSet(timeoutRef) {
|
|
277
|
-
if (timeoutRef.current !== -1) {
|
|
278
|
-
clearTimeout(timeoutRef.current);
|
|
279
|
-
timeoutRef.current = -1;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const safePolygonIdentifier = /*#__PURE__*/createAttribute('safe-polygon');
|
|
284
|
-
function getDelay(value, prop, pointerType) {
|
|
285
|
-
if (pointerType && !isMouseLikePointerType(pointerType)) {
|
|
286
|
-
return 0;
|
|
287
|
-
}
|
|
288
|
-
if (typeof value === 'number') {
|
|
289
|
-
return value;
|
|
290
|
-
}
|
|
291
|
-
if (typeof value === 'function') {
|
|
292
|
-
const result = value();
|
|
293
|
-
if (typeof result === 'number') {
|
|
294
|
-
return result;
|
|
295
|
-
}
|
|
296
|
-
return result == null ? void 0 : result[prop];
|
|
297
|
-
}
|
|
298
|
-
return value == null ? void 0 : value[prop];
|
|
299
|
-
}
|
|
300
|
-
function getRestMs(value) {
|
|
301
|
-
if (typeof value === 'function') {
|
|
302
|
-
return value();
|
|
303
|
-
}
|
|
304
|
-
return value;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Opens the floating element while hovering over the reference element, like
|
|
308
|
-
* CSS `:hover`.
|
|
309
|
-
* @see https://floating-ui.com/docs/useHover
|
|
310
|
-
*/
|
|
311
|
-
function useHover(context, props) {
|
|
312
|
-
if (props === void 0) {
|
|
313
|
-
props = {};
|
|
314
|
-
}
|
|
315
|
-
const {
|
|
316
|
-
open,
|
|
317
|
-
onOpenChange,
|
|
318
|
-
dataRef,
|
|
319
|
-
events,
|
|
320
|
-
elements
|
|
321
|
-
} = context;
|
|
322
|
-
const {
|
|
323
|
-
enabled = true,
|
|
324
|
-
delay = 0,
|
|
325
|
-
handleClose = null,
|
|
326
|
-
mouseOnly = false,
|
|
327
|
-
restMs = 0,
|
|
328
|
-
move = true
|
|
329
|
-
} = props;
|
|
330
|
-
const tree = useFloatingTree();
|
|
331
|
-
const parentId = useFloatingParentNodeId();
|
|
332
|
-
const handleCloseRef = useLatestRef(handleClose);
|
|
333
|
-
const delayRef = useLatestRef(delay);
|
|
334
|
-
const openRef = useLatestRef(open);
|
|
335
|
-
const restMsRef = useLatestRef(restMs);
|
|
336
|
-
const pointerTypeRef = React.useRef();
|
|
337
|
-
const timeoutRef = React.useRef(-1);
|
|
338
|
-
const handlerRef = React.useRef();
|
|
339
|
-
const restTimeoutRef = React.useRef(-1);
|
|
340
|
-
const blockMouseMoveRef = React.useRef(true);
|
|
341
|
-
const performedPointerEventsMutationRef = React.useRef(false);
|
|
342
|
-
const unbindMouseMoveRef = React.useRef(() => {});
|
|
343
|
-
const restTimeoutPendingRef = React.useRef(false);
|
|
344
|
-
const isHoverOpen = useEffectEvent(() => {
|
|
345
|
-
var _dataRef$current$open;
|
|
346
|
-
const type = (_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type;
|
|
347
|
-
return (type == null ? void 0 : type.includes('mouse')) && type !== 'mousedown';
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
// When closing before opening, clear the delay timeouts to cancel it
|
|
351
|
-
// from showing.
|
|
352
|
-
React.useEffect(() => {
|
|
353
|
-
if (!enabled) return;
|
|
354
|
-
function onOpenChange(_ref) {
|
|
355
|
-
let {
|
|
356
|
-
open
|
|
357
|
-
} = _ref;
|
|
358
|
-
if (!open) {
|
|
359
|
-
clearTimeoutIfSet(timeoutRef);
|
|
360
|
-
clearTimeoutIfSet(restTimeoutRef);
|
|
361
|
-
blockMouseMoveRef.current = true;
|
|
362
|
-
restTimeoutPendingRef.current = false;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
events.on('openchange', onOpenChange);
|
|
366
|
-
return () => {
|
|
367
|
-
events.off('openchange', onOpenChange);
|
|
368
|
-
};
|
|
369
|
-
}, [enabled, events]);
|
|
370
|
-
React.useEffect(() => {
|
|
371
|
-
if (!enabled) return;
|
|
372
|
-
if (!handleCloseRef.current) return;
|
|
373
|
-
if (!open) return;
|
|
374
|
-
function onLeave(event) {
|
|
375
|
-
if (isHoverOpen()) {
|
|
376
|
-
onOpenChange(false, event, 'hover');
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
const html = getDocument(elements.floating).documentElement;
|
|
380
|
-
html.addEventListener('mouseleave', onLeave);
|
|
381
|
-
return () => {
|
|
382
|
-
html.removeEventListener('mouseleave', onLeave);
|
|
383
|
-
};
|
|
384
|
-
}, [elements.floating, open, onOpenChange, enabled, handleCloseRef, isHoverOpen]);
|
|
385
|
-
const closeWithDelay = React.useCallback(function (event, runElseBranch, reason) {
|
|
386
|
-
if (runElseBranch === void 0) {
|
|
387
|
-
runElseBranch = true;
|
|
388
|
-
}
|
|
389
|
-
if (reason === void 0) {
|
|
390
|
-
reason = 'hover';
|
|
391
|
-
}
|
|
392
|
-
const closeDelay = getDelay(delayRef.current, 'close', pointerTypeRef.current);
|
|
393
|
-
if (closeDelay && !handlerRef.current) {
|
|
394
|
-
clearTimeoutIfSet(timeoutRef);
|
|
395
|
-
timeoutRef.current = window.setTimeout(() => onOpenChange(false, event, reason), closeDelay);
|
|
396
|
-
} else if (runElseBranch) {
|
|
397
|
-
clearTimeoutIfSet(timeoutRef);
|
|
398
|
-
onOpenChange(false, event, reason);
|
|
399
|
-
}
|
|
400
|
-
}, [delayRef, onOpenChange]);
|
|
401
|
-
const cleanupMouseMoveHandler = useEffectEvent(() => {
|
|
402
|
-
unbindMouseMoveRef.current();
|
|
403
|
-
handlerRef.current = undefined;
|
|
404
|
-
});
|
|
405
|
-
const clearPointerEvents = useEffectEvent(() => {
|
|
406
|
-
if (performedPointerEventsMutationRef.current) {
|
|
407
|
-
const body = getDocument(elements.floating).body;
|
|
408
|
-
body.style.pointerEvents = '';
|
|
409
|
-
body.removeAttribute(safePolygonIdentifier);
|
|
410
|
-
performedPointerEventsMutationRef.current = false;
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
const isClickLikeOpenEvent = useEffectEvent(() => {
|
|
414
|
-
return dataRef.current.openEvent ? ['click', 'mousedown'].includes(dataRef.current.openEvent.type) : false;
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
// Registering the mouse events on the reference directly to bypass React's
|
|
418
|
-
// delegation system. If the cursor was on a disabled element and then entered
|
|
419
|
-
// the reference (no gap), `mouseenter` doesn't fire in the delegation system.
|
|
420
|
-
React.useEffect(() => {
|
|
421
|
-
if (!enabled) return;
|
|
422
|
-
function onReferenceMouseEnter(event) {
|
|
423
|
-
clearTimeoutIfSet(timeoutRef);
|
|
424
|
-
blockMouseMoveRef.current = false;
|
|
425
|
-
if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current) || getRestMs(restMsRef.current) > 0 && !getDelay(delayRef.current, 'open')) {
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
const openDelay = getDelay(delayRef.current, 'open', pointerTypeRef.current);
|
|
429
|
-
if (openDelay) {
|
|
430
|
-
timeoutRef.current = window.setTimeout(() => {
|
|
431
|
-
if (!openRef.current) {
|
|
432
|
-
onOpenChange(true, event, 'hover');
|
|
433
|
-
}
|
|
434
|
-
}, openDelay);
|
|
435
|
-
} else if (!open) {
|
|
436
|
-
onOpenChange(true, event, 'hover');
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
function onReferenceMouseLeave(event) {
|
|
440
|
-
if (isClickLikeOpenEvent()) {
|
|
441
|
-
clearPointerEvents();
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
unbindMouseMoveRef.current();
|
|
445
|
-
const doc = getDocument(elements.floating);
|
|
446
|
-
clearTimeoutIfSet(restTimeoutRef);
|
|
447
|
-
restTimeoutPendingRef.current = false;
|
|
448
|
-
if (handleCloseRef.current && dataRef.current.floatingContext) {
|
|
449
|
-
// Prevent clearing `onScrollMouseLeave` timeout.
|
|
450
|
-
if (!open) {
|
|
451
|
-
clearTimeoutIfSet(timeoutRef);
|
|
452
|
-
}
|
|
453
|
-
handlerRef.current = handleCloseRef.current({
|
|
454
|
-
...dataRef.current.floatingContext,
|
|
455
|
-
tree,
|
|
456
|
-
x: event.clientX,
|
|
457
|
-
y: event.clientY,
|
|
458
|
-
onClose() {
|
|
459
|
-
clearPointerEvents();
|
|
460
|
-
cleanupMouseMoveHandler();
|
|
461
|
-
if (!isClickLikeOpenEvent()) {
|
|
462
|
-
closeWithDelay(event, true, 'safe-polygon');
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
const handler = handlerRef.current;
|
|
467
|
-
doc.addEventListener('mousemove', handler);
|
|
468
|
-
unbindMouseMoveRef.current = () => {
|
|
469
|
-
doc.removeEventListener('mousemove', handler);
|
|
470
|
-
};
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
// Allow interactivity without `safePolygon` on touch devices. With a
|
|
475
|
-
// pointer, a short close delay is an alternative, so it should work
|
|
476
|
-
// consistently.
|
|
477
|
-
const shouldClose = pointerTypeRef.current === 'touch' ? !contains(elements.floating, event.relatedTarget) : true;
|
|
478
|
-
if (shouldClose) {
|
|
479
|
-
closeWithDelay(event);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
// Ensure the floating element closes after scrolling even if the pointer
|
|
484
|
-
// did not move.
|
|
485
|
-
// https://github.com/floating-ui/floating-ui/discussions/1692
|
|
486
|
-
function onScrollMouseLeave(event) {
|
|
487
|
-
if (isClickLikeOpenEvent()) return;
|
|
488
|
-
if (!dataRef.current.floatingContext) return;
|
|
489
|
-
handleCloseRef.current == null || handleCloseRef.current({
|
|
490
|
-
...dataRef.current.floatingContext,
|
|
491
|
-
tree,
|
|
492
|
-
x: event.clientX,
|
|
493
|
-
y: event.clientY,
|
|
494
|
-
onClose() {
|
|
495
|
-
clearPointerEvents();
|
|
496
|
-
cleanupMouseMoveHandler();
|
|
497
|
-
if (!isClickLikeOpenEvent()) {
|
|
498
|
-
closeWithDelay(event);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
})(event);
|
|
502
|
-
}
|
|
503
|
-
function onFloatingMouseEnter() {
|
|
504
|
-
clearTimeoutIfSet(timeoutRef);
|
|
505
|
-
}
|
|
506
|
-
function onFloatingMouseLeave(event) {
|
|
507
|
-
if (!isClickLikeOpenEvent()) {
|
|
508
|
-
closeWithDelay(event, false);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
if (isElement(elements.domReference)) {
|
|
512
|
-
const reference = elements.domReference;
|
|
513
|
-
const floating = elements.floating;
|
|
514
|
-
if (open) {
|
|
515
|
-
reference.addEventListener('mouseleave', onScrollMouseLeave);
|
|
516
|
-
}
|
|
517
|
-
if (move) {
|
|
518
|
-
reference.addEventListener('mousemove', onReferenceMouseEnter, {
|
|
519
|
-
once: true
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
reference.addEventListener('mouseenter', onReferenceMouseEnter);
|
|
523
|
-
reference.addEventListener('mouseleave', onReferenceMouseLeave);
|
|
524
|
-
if (floating) {
|
|
525
|
-
floating.addEventListener('mouseleave', onScrollMouseLeave);
|
|
526
|
-
floating.addEventListener('mouseenter', onFloatingMouseEnter);
|
|
527
|
-
floating.addEventListener('mouseleave', onFloatingMouseLeave);
|
|
528
|
-
}
|
|
529
|
-
return () => {
|
|
530
|
-
if (open) {
|
|
531
|
-
reference.removeEventListener('mouseleave', onScrollMouseLeave);
|
|
532
|
-
}
|
|
533
|
-
if (move) {
|
|
534
|
-
reference.removeEventListener('mousemove', onReferenceMouseEnter);
|
|
535
|
-
}
|
|
536
|
-
reference.removeEventListener('mouseenter', onReferenceMouseEnter);
|
|
537
|
-
reference.removeEventListener('mouseleave', onReferenceMouseLeave);
|
|
538
|
-
if (floating) {
|
|
539
|
-
floating.removeEventListener('mouseleave', onScrollMouseLeave);
|
|
540
|
-
floating.removeEventListener('mouseenter', onFloatingMouseEnter);
|
|
541
|
-
floating.removeEventListener('mouseleave', onFloatingMouseLeave);
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
}, [elements, enabled, context, mouseOnly, move, closeWithDelay, cleanupMouseMoveHandler, clearPointerEvents, onOpenChange, open, openRef, tree, delayRef, handleCloseRef, dataRef, isClickLikeOpenEvent, restMsRef]);
|
|
546
|
-
|
|
547
|
-
// Block pointer-events of every element other than the reference and floating
|
|
548
|
-
// while the floating element is open and has a `handleClose` handler. Also
|
|
549
|
-
// handles nested floating elements.
|
|
550
|
-
// https://github.com/floating-ui/floating-ui/issues/1722
|
|
551
|
-
index(() => {
|
|
552
|
-
var _handleCloseRef$curre;
|
|
553
|
-
if (!enabled) return;
|
|
554
|
-
if (open && (_handleCloseRef$curre = handleCloseRef.current) != null && (_handleCloseRef$curre = _handleCloseRef$curre.__options) != null && _handleCloseRef$curre.blockPointerEvents && isHoverOpen()) {
|
|
555
|
-
performedPointerEventsMutationRef.current = true;
|
|
556
|
-
const floatingEl = elements.floating;
|
|
557
|
-
if (isElement(elements.domReference) && floatingEl) {
|
|
558
|
-
var _tree$nodesRef$curren;
|
|
559
|
-
const body = getDocument(elements.floating).body;
|
|
560
|
-
body.setAttribute(safePolygonIdentifier, '');
|
|
561
|
-
const ref = elements.domReference;
|
|
562
|
-
const parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating;
|
|
563
|
-
if (parentFloating) {
|
|
564
|
-
parentFloating.style.pointerEvents = '';
|
|
565
|
-
}
|
|
566
|
-
body.style.pointerEvents = 'none';
|
|
567
|
-
ref.style.pointerEvents = 'auto';
|
|
568
|
-
floatingEl.style.pointerEvents = 'auto';
|
|
569
|
-
return () => {
|
|
570
|
-
body.style.pointerEvents = '';
|
|
571
|
-
ref.style.pointerEvents = '';
|
|
572
|
-
floatingEl.style.pointerEvents = '';
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
}, [enabled, open, parentId, elements, tree, handleCloseRef, isHoverOpen]);
|
|
577
|
-
index(() => {
|
|
578
|
-
if (!open) {
|
|
579
|
-
pointerTypeRef.current = undefined;
|
|
580
|
-
restTimeoutPendingRef.current = false;
|
|
581
|
-
cleanupMouseMoveHandler();
|
|
582
|
-
clearPointerEvents();
|
|
583
|
-
}
|
|
584
|
-
}, [open, cleanupMouseMoveHandler, clearPointerEvents]);
|
|
585
|
-
React.useEffect(() => {
|
|
586
|
-
return () => {
|
|
587
|
-
cleanupMouseMoveHandler();
|
|
588
|
-
clearTimeoutIfSet(timeoutRef);
|
|
589
|
-
clearTimeoutIfSet(restTimeoutRef);
|
|
590
|
-
clearPointerEvents();
|
|
591
|
-
};
|
|
592
|
-
}, [enabled, elements.domReference, cleanupMouseMoveHandler, clearPointerEvents]);
|
|
593
|
-
const reference = React.useMemo(() => {
|
|
594
|
-
function setPointerRef(event) {
|
|
595
|
-
pointerTypeRef.current = event.pointerType;
|
|
596
|
-
}
|
|
597
|
-
return {
|
|
598
|
-
onPointerDown: setPointerRef,
|
|
599
|
-
onPointerEnter: setPointerRef,
|
|
600
|
-
onMouseMove(event) {
|
|
601
|
-
const {
|
|
602
|
-
nativeEvent
|
|
603
|
-
} = event;
|
|
604
|
-
function handleMouseMove() {
|
|
605
|
-
if (!blockMouseMoveRef.current && !openRef.current) {
|
|
606
|
-
onOpenChange(true, nativeEvent, 'hover');
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current)) {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
if (open || getRestMs(restMsRef.current) === 0) {
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// Ignore insignificant movements to account for tremors.
|
|
617
|
-
if (restTimeoutPendingRef.current && event.movementX ** 2 + event.movementY ** 2 < 2) {
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
clearTimeoutIfSet(restTimeoutRef);
|
|
621
|
-
if (pointerTypeRef.current === 'touch') {
|
|
622
|
-
handleMouseMove();
|
|
623
|
-
} else {
|
|
624
|
-
restTimeoutPendingRef.current = true;
|
|
625
|
-
restTimeoutRef.current = window.setTimeout(handleMouseMove, getRestMs(restMsRef.current));
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
}, [mouseOnly, onOpenChange, open, openRef, restMsRef]);
|
|
630
|
-
return React.useMemo(() => enabled ? {
|
|
631
|
-
reference
|
|
632
|
-
} : {}, [enabled, reference]);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
const HIDDEN_STYLES = {
|
|
636
|
-
border: 0,
|
|
637
|
-
clip: 'rect(0 0 0 0)',
|
|
638
|
-
height: '1px',
|
|
639
|
-
margin: '-1px',
|
|
640
|
-
overflow: 'hidden',
|
|
641
|
-
padding: 0,
|
|
642
|
-
position: 'fixed',
|
|
643
|
-
whiteSpace: 'nowrap',
|
|
644
|
-
width: '1px',
|
|
645
|
-
top: 0,
|
|
646
|
-
left: 0
|
|
647
|
-
};
|
|
648
|
-
const FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {
|
|
649
|
-
const [role, setRole] = React.useState();
|
|
650
|
-
index(() => {
|
|
651
|
-
if (isSafari()) {
|
|
652
|
-
// Unlike other screen readers such as NVDA and JAWS, the virtual cursor
|
|
653
|
-
// on VoiceOver does trigger the onFocus event, so we can use the focus
|
|
654
|
-
// trap element. On Safari, only buttons trigger the onFocus event.
|
|
655
|
-
// NB: "group" role in the Sandbox no longer appears to work, must be a
|
|
656
|
-
// button role.
|
|
657
|
-
setRole('button');
|
|
658
|
-
}
|
|
659
|
-
}, []);
|
|
660
|
-
const restProps = {
|
|
661
|
-
ref,
|
|
662
|
-
tabIndex: 0,
|
|
663
|
-
// Role is only for VoiceOver
|
|
664
|
-
role,
|
|
665
|
-
'aria-hidden': role ? undefined : true,
|
|
666
|
-
[createAttribute('focus-guard')]: '',
|
|
667
|
-
style: HIDDEN_STYLES
|
|
668
|
-
};
|
|
669
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
670
|
-
...props,
|
|
671
|
-
...restProps
|
|
672
|
-
});
|
|
673
|
-
});
|
|
674
|
-
|
|
675
|
-
const PortalContext = /*#__PURE__*/React.createContext(null);
|
|
676
|
-
const attr = /*#__PURE__*/createAttribute('portal');
|
|
677
|
-
/**
|
|
678
|
-
* @see https://floating-ui.com/docs/FloatingPortal#usefloatingportalnode
|
|
679
|
-
*/
|
|
680
|
-
function useFloatingPortalNode(props) {
|
|
681
|
-
if (props === void 0) {
|
|
682
|
-
props = {};
|
|
683
|
-
}
|
|
684
|
-
const {
|
|
685
|
-
id,
|
|
686
|
-
root
|
|
687
|
-
} = props;
|
|
688
|
-
const uniqueId = useId();
|
|
689
|
-
const portalContext = usePortalContext();
|
|
690
|
-
const [portalNode, setPortalNode] = React.useState(null);
|
|
691
|
-
const portalNodeRef = React.useRef(null);
|
|
692
|
-
index(() => {
|
|
693
|
-
return () => {
|
|
694
|
-
portalNode == null || portalNode.remove();
|
|
695
|
-
// Allow the subsequent layout effects to create a new node on updates.
|
|
696
|
-
// The portal node will still be cleaned up on unmount.
|
|
697
|
-
// https://github.com/floating-ui/floating-ui/issues/2454
|
|
698
|
-
queueMicrotask(() => {
|
|
699
|
-
portalNodeRef.current = null;
|
|
700
|
-
});
|
|
701
|
-
};
|
|
702
|
-
}, [portalNode]);
|
|
703
|
-
index(() => {
|
|
704
|
-
// Wait for the uniqueId to be generated before creating the portal node in
|
|
705
|
-
// React <18 (using `useFloatingId` instead of the native `useId`).
|
|
706
|
-
// https://github.com/floating-ui/floating-ui/issues/2778
|
|
707
|
-
if (!uniqueId) return;
|
|
708
|
-
if (portalNodeRef.current) return;
|
|
709
|
-
const existingIdRoot = id ? document.getElementById(id) : null;
|
|
710
|
-
if (!existingIdRoot) return;
|
|
711
|
-
const subRoot = document.createElement('div');
|
|
712
|
-
subRoot.id = uniqueId;
|
|
713
|
-
subRoot.setAttribute(attr, '');
|
|
714
|
-
existingIdRoot.appendChild(subRoot);
|
|
715
|
-
portalNodeRef.current = subRoot;
|
|
716
|
-
setPortalNode(subRoot);
|
|
717
|
-
}, [id, uniqueId]);
|
|
718
|
-
index(() => {
|
|
719
|
-
// Wait for the root to exist before creating the portal node. The root must
|
|
720
|
-
// be stored in state, not a ref, for this to work reactively.
|
|
721
|
-
if (root === null) return;
|
|
722
|
-
if (!uniqueId) return;
|
|
723
|
-
if (portalNodeRef.current) return;
|
|
724
|
-
let container = root || (portalContext == null ? void 0 : portalContext.portalNode);
|
|
725
|
-
if (container && !isNode(container)) container = container.current;
|
|
726
|
-
container = container || document.body;
|
|
727
|
-
let idWrapper = null;
|
|
728
|
-
if (id) {
|
|
729
|
-
idWrapper = document.createElement('div');
|
|
730
|
-
idWrapper.id = id;
|
|
731
|
-
container.appendChild(idWrapper);
|
|
732
|
-
}
|
|
733
|
-
const subRoot = document.createElement('div');
|
|
734
|
-
subRoot.id = uniqueId;
|
|
735
|
-
subRoot.setAttribute(attr, '');
|
|
736
|
-
container = idWrapper || container;
|
|
737
|
-
container.appendChild(subRoot);
|
|
738
|
-
portalNodeRef.current = subRoot;
|
|
739
|
-
setPortalNode(subRoot);
|
|
740
|
-
}, [id, root, uniqueId, portalContext]);
|
|
741
|
-
return portalNode;
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* Portals the floating element into a given container element — by default,
|
|
745
|
-
* outside of the app root and into the body.
|
|
746
|
-
* This is necessary to ensure the floating element can appear outside any
|
|
747
|
-
* potential parent containers that cause clipping (such as `overflow: hidden`),
|
|
748
|
-
* while retaining its location in the React tree.
|
|
749
|
-
* @see https://floating-ui.com/docs/FloatingPortal
|
|
750
|
-
*/
|
|
751
|
-
function FloatingPortal(props) {
|
|
752
|
-
const {
|
|
753
|
-
children,
|
|
754
|
-
id,
|
|
755
|
-
root,
|
|
756
|
-
preserveTabOrder = true
|
|
757
|
-
} = props;
|
|
758
|
-
const portalNode = useFloatingPortalNode({
|
|
759
|
-
id,
|
|
760
|
-
root
|
|
761
|
-
});
|
|
762
|
-
const [focusManagerState, setFocusManagerState] = React.useState(null);
|
|
763
|
-
const beforeOutsideRef = React.useRef(null);
|
|
764
|
-
const afterOutsideRef = React.useRef(null);
|
|
765
|
-
const beforeInsideRef = React.useRef(null);
|
|
766
|
-
const afterInsideRef = React.useRef(null);
|
|
767
|
-
const modal = focusManagerState == null ? void 0 : focusManagerState.modal;
|
|
768
|
-
const open = focusManagerState == null ? void 0 : focusManagerState.open;
|
|
769
|
-
const shouldRenderGuards =
|
|
770
|
-
// The FocusManager and therefore floating element are currently open/
|
|
771
|
-
// rendered.
|
|
772
|
-
!!focusManagerState &&
|
|
773
|
-
// Guards are only for non-modal focus management.
|
|
774
|
-
!focusManagerState.modal &&
|
|
775
|
-
// Don't render if unmount is transitioning.
|
|
776
|
-
focusManagerState.open && preserveTabOrder && !!(root || portalNode);
|
|
777
|
-
|
|
778
|
-
// https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx
|
|
779
|
-
React.useEffect(() => {
|
|
780
|
-
if (!portalNode || !preserveTabOrder || modal) {
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
// Make sure elements inside the portal element are tabbable only when the
|
|
785
|
-
// portal has already been focused, either by tabbing into a focus trap
|
|
786
|
-
// element outside or using the mouse.
|
|
787
|
-
function onFocus(event) {
|
|
788
|
-
if (portalNode && isOutsideEvent(event)) {
|
|
789
|
-
const focusing = event.type === 'focusin';
|
|
790
|
-
const manageFocus = focusing ? enableFocusInside : disableFocusInside;
|
|
791
|
-
manageFocus(portalNode);
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
// Listen to the event on the capture phase so they run before the focus
|
|
795
|
-
// trap elements onFocus prop is called.
|
|
796
|
-
portalNode.addEventListener('focusin', onFocus, true);
|
|
797
|
-
portalNode.addEventListener('focusout', onFocus, true);
|
|
798
|
-
return () => {
|
|
799
|
-
portalNode.removeEventListener('focusin', onFocus, true);
|
|
800
|
-
portalNode.removeEventListener('focusout', onFocus, true);
|
|
801
|
-
};
|
|
802
|
-
}, [portalNode, preserveTabOrder, modal]);
|
|
803
|
-
React.useEffect(() => {
|
|
804
|
-
if (!portalNode) return;
|
|
805
|
-
if (open) return;
|
|
806
|
-
enableFocusInside(portalNode);
|
|
807
|
-
}, [open, portalNode]);
|
|
808
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(PortalContext.Provider, {
|
|
809
|
-
value: React.useMemo(() => ({
|
|
810
|
-
preserveTabOrder,
|
|
811
|
-
beforeOutsideRef,
|
|
812
|
-
afterOutsideRef,
|
|
813
|
-
beforeInsideRef,
|
|
814
|
-
afterInsideRef,
|
|
815
|
-
portalNode,
|
|
816
|
-
setFocusManagerState
|
|
817
|
-
}), [preserveTabOrder, portalNode]),
|
|
818
|
-
children: [shouldRenderGuards && portalNode && /*#__PURE__*/jsxRuntimeExports.jsx(FocusGuard, {
|
|
819
|
-
"data-type": "outside",
|
|
820
|
-
ref: beforeOutsideRef,
|
|
821
|
-
onFocus: event => {
|
|
822
|
-
if (isOutsideEvent(event, portalNode)) {
|
|
823
|
-
var _beforeInsideRef$curr;
|
|
824
|
-
(_beforeInsideRef$curr = beforeInsideRef.current) == null || _beforeInsideRef$curr.focus();
|
|
825
|
-
} else {
|
|
826
|
-
const domReference = focusManagerState ? focusManagerState.domReference : null;
|
|
827
|
-
const prevTabbable = getPreviousTabbable(domReference);
|
|
828
|
-
prevTabbable == null || prevTabbable.focus();
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
}), shouldRenderGuards && portalNode && /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
832
|
-
"aria-owns": portalNode.id,
|
|
833
|
-
style: HIDDEN_STYLES
|
|
834
|
-
}), portalNode && /*#__PURE__*/reactDomExports.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/jsxRuntimeExports.jsx(FocusGuard, {
|
|
835
|
-
"data-type": "outside",
|
|
836
|
-
ref: afterOutsideRef,
|
|
837
|
-
onFocus: event => {
|
|
838
|
-
if (isOutsideEvent(event, portalNode)) {
|
|
839
|
-
var _afterInsideRef$curre;
|
|
840
|
-
(_afterInsideRef$curre = afterInsideRef.current) == null || _afterInsideRef$curre.focus();
|
|
841
|
-
} else {
|
|
842
|
-
const domReference = focusManagerState ? focusManagerState.domReference : null;
|
|
843
|
-
const nextTabbable = getNextTabbable(domReference);
|
|
844
|
-
nextTabbable == null || nextTabbable.focus();
|
|
845
|
-
(focusManagerState == null ? void 0 : focusManagerState.closeOnFocusOut) && (focusManagerState == null ? void 0 : focusManagerState.onOpenChange(false, event.nativeEvent, 'focus-out'));
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
})]
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
const usePortalContext = () => React.useContext(PortalContext);
|
|
852
|
-
|
|
853
|
-
const bubbleHandlerKeys = {
|
|
854
|
-
pointerdown: 'onPointerDown',
|
|
855
|
-
mousedown: 'onMouseDown',
|
|
856
|
-
click: 'onClick'
|
|
857
|
-
};
|
|
858
|
-
const captureHandlerKeys = {
|
|
859
|
-
pointerdown: 'onPointerDownCapture',
|
|
860
|
-
mousedown: 'onMouseDownCapture',
|
|
861
|
-
click: 'onClickCapture'
|
|
862
|
-
};
|
|
863
|
-
const normalizeProp = normalizable => {
|
|
864
|
-
var _normalizable$escapeK, _normalizable$outside;
|
|
865
|
-
return {
|
|
866
|
-
escapeKey: typeof normalizable === 'boolean' ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false,
|
|
867
|
-
outsidePress: typeof normalizable === 'boolean' ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true
|
|
868
|
-
};
|
|
869
|
-
};
|
|
870
|
-
/**
|
|
871
|
-
* Closes the floating element when a dismissal is requested — by default, when
|
|
872
|
-
* the user presses the `escape` key or outside of the floating element.
|
|
873
|
-
* @see https://floating-ui.com/docs/useDismiss
|
|
874
|
-
*/
|
|
875
|
-
function useDismiss(context, props) {
|
|
876
|
-
if (props === void 0) {
|
|
877
|
-
props = {};
|
|
878
|
-
}
|
|
879
|
-
const {
|
|
880
|
-
open,
|
|
881
|
-
onOpenChange,
|
|
882
|
-
elements,
|
|
883
|
-
dataRef
|
|
884
|
-
} = context;
|
|
885
|
-
const {
|
|
886
|
-
enabled = true,
|
|
887
|
-
escapeKey = true,
|
|
888
|
-
outsidePress: unstable_outsidePress = true,
|
|
889
|
-
outsidePressEvent = 'pointerdown',
|
|
890
|
-
referencePress = false,
|
|
891
|
-
referencePressEvent = 'pointerdown',
|
|
892
|
-
ancestorScroll = false,
|
|
893
|
-
bubbles,
|
|
894
|
-
capture
|
|
895
|
-
} = props;
|
|
896
|
-
const tree = useFloatingTree();
|
|
897
|
-
const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === 'function' ? unstable_outsidePress : () => false);
|
|
898
|
-
const outsidePress = typeof unstable_outsidePress === 'function' ? outsidePressFn : unstable_outsidePress;
|
|
899
|
-
const endedOrStartedInsideRef = React.useRef(false);
|
|
900
|
-
const {
|
|
901
|
-
escapeKey: escapeKeyBubbles,
|
|
902
|
-
outsidePress: outsidePressBubbles
|
|
903
|
-
} = normalizeProp(bubbles);
|
|
904
|
-
const {
|
|
905
|
-
escapeKey: escapeKeyCapture,
|
|
906
|
-
outsidePress: outsidePressCapture
|
|
907
|
-
} = normalizeProp(capture);
|
|
908
|
-
const isComposingRef = React.useRef(false);
|
|
909
|
-
const closeOnEscapeKeyDown = useEffectEvent(event => {
|
|
910
|
-
var _dataRef$current$floa;
|
|
911
|
-
if (!open || !enabled || !escapeKey || event.key !== 'Escape') {
|
|
912
|
-
return;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
// Wait until IME is settled. Pressing `Escape` while composing should
|
|
916
|
-
// close the compose menu, but not the floating element.
|
|
917
|
-
if (isComposingRef.current) {
|
|
918
|
-
return;
|
|
919
|
-
}
|
|
920
|
-
const nodeId = (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;
|
|
921
|
-
const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
|
|
922
|
-
if (!escapeKeyBubbles) {
|
|
923
|
-
event.stopPropagation();
|
|
924
|
-
if (children.length > 0) {
|
|
925
|
-
let shouldDismiss = true;
|
|
926
|
-
children.forEach(child => {
|
|
927
|
-
var _child$context;
|
|
928
|
-
if ((_child$context = child.context) != null && _child$context.open && !child.context.dataRef.current.__escapeKeyBubbles) {
|
|
929
|
-
shouldDismiss = false;
|
|
930
|
-
return;
|
|
931
|
-
}
|
|
932
|
-
});
|
|
933
|
-
if (!shouldDismiss) {
|
|
934
|
-
return;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, 'escape-key');
|
|
939
|
-
});
|
|
940
|
-
const closeOnEscapeKeyDownCapture = useEffectEvent(event => {
|
|
941
|
-
var _getTarget2;
|
|
942
|
-
const callback = () => {
|
|
943
|
-
var _getTarget;
|
|
944
|
-
closeOnEscapeKeyDown(event);
|
|
945
|
-
(_getTarget = getTarget(event)) == null || _getTarget.removeEventListener('keydown', callback);
|
|
946
|
-
};
|
|
947
|
-
(_getTarget2 = getTarget(event)) == null || _getTarget2.addEventListener('keydown', callback);
|
|
948
|
-
});
|
|
949
|
-
const closeOnPressOutside = useEffectEvent(event => {
|
|
950
|
-
var _dataRef$current$floa2;
|
|
951
|
-
// Given developers can stop the propagation of the synthetic event,
|
|
952
|
-
// we can only be confident with a positive value.
|
|
953
|
-
const insideReactTree = dataRef.current.insideReactTree;
|
|
954
|
-
dataRef.current.insideReactTree = false;
|
|
955
|
-
|
|
956
|
-
// When click outside is lazy (`click` event), handle dragging.
|
|
957
|
-
// Don't close if:
|
|
958
|
-
// - The click started inside the floating element.
|
|
959
|
-
// - The click ended inside the floating element.
|
|
960
|
-
const endedOrStartedInside = endedOrStartedInsideRef.current;
|
|
961
|
-
endedOrStartedInsideRef.current = false;
|
|
962
|
-
if (outsidePressEvent === 'click' && endedOrStartedInside) {
|
|
963
|
-
return;
|
|
964
|
-
}
|
|
965
|
-
if (insideReactTree) {
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
if (typeof outsidePress === 'function' && !outsidePress(event)) {
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
const target = getTarget(event);
|
|
972
|
-
const inertSelector = "[" + createAttribute('inert') + "]";
|
|
973
|
-
const markers = getDocument(elements.floating).querySelectorAll(inertSelector);
|
|
974
|
-
let targetRootAncestor = isElement(target) ? target : null;
|
|
975
|
-
while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
|
|
976
|
-
const nextParent = getParentNode(targetRootAncestor);
|
|
977
|
-
if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
|
|
978
|
-
break;
|
|
979
|
-
}
|
|
980
|
-
targetRootAncestor = nextParent;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
// Check if the click occurred on a third-party element injected after the
|
|
984
|
-
// floating element rendered.
|
|
985
|
-
if (markers.length && isElement(target) && !isRootElement(target) &&
|
|
986
|
-
// Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
987
|
-
!contains(target, elements.floating) &&
|
|
988
|
-
// If the target root element contains none of the markers, then the
|
|
989
|
-
// element was injected after the floating element rendered.
|
|
990
|
-
Array.from(markers).every(marker => !contains(targetRootAncestor, marker))) {
|
|
991
|
-
return;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
// Check if the click occurred on the scrollbar
|
|
995
|
-
if (isHTMLElement(target) && floating) {
|
|
996
|
-
const lastTraversableNode = isLastTraversableNode(target);
|
|
997
|
-
const style = getComputedStyle(target);
|
|
998
|
-
const scrollRe = /auto|scroll/;
|
|
999
|
-
const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
|
|
1000
|
-
const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
|
|
1001
|
-
const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
|
|
1002
|
-
const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
|
|
1003
|
-
const isRTL = style.direction === 'rtl';
|
|
1004
|
-
|
|
1005
|
-
// Check click position relative to scrollbar.
|
|
1006
|
-
// In some browsers it is possible to change the <body> (or window)
|
|
1007
|
-
// scrollbar to the left side, but is very rare and is difficult to
|
|
1008
|
-
// check for. Plus, for modal dialogs with backdrops, it is more
|
|
1009
|
-
// important that the backdrop is checked but not so much the window.
|
|
1010
|
-
const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
|
|
1011
|
-
const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
|
|
1012
|
-
if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
|
|
1013
|
-
return;
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId;
|
|
1017
|
-
const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some(node => {
|
|
1018
|
-
var _node$context;
|
|
1019
|
-
return isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating);
|
|
1020
|
-
});
|
|
1021
|
-
if (isEventTargetWithin(event, elements.floating) || isEventTargetWithin(event, elements.domReference) || targetIsInsideChildren) {
|
|
1022
|
-
return;
|
|
1023
|
-
}
|
|
1024
|
-
const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
|
|
1025
|
-
if (children.length > 0) {
|
|
1026
|
-
let shouldDismiss = true;
|
|
1027
|
-
children.forEach(child => {
|
|
1028
|
-
var _child$context2;
|
|
1029
|
-
if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) {
|
|
1030
|
-
shouldDismiss = false;
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
if (!shouldDismiss) {
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
onOpenChange(false, event, 'outside-press');
|
|
1039
|
-
});
|
|
1040
|
-
const closeOnPressOutsideCapture = useEffectEvent(event => {
|
|
1041
|
-
var _getTarget4;
|
|
1042
|
-
const callback = () => {
|
|
1043
|
-
var _getTarget3;
|
|
1044
|
-
closeOnPressOutside(event);
|
|
1045
|
-
(_getTarget3 = getTarget(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback);
|
|
1046
|
-
};
|
|
1047
|
-
(_getTarget4 = getTarget(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback);
|
|
1048
|
-
});
|
|
1049
|
-
React.useEffect(() => {
|
|
1050
|
-
if (!open || !enabled) {
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
|
|
1054
|
-
dataRef.current.__outsidePressBubbles = outsidePressBubbles;
|
|
1055
|
-
let compositionTimeout = -1;
|
|
1056
|
-
function onScroll(event) {
|
|
1057
|
-
onOpenChange(false, event, 'ancestor-scroll');
|
|
1058
|
-
}
|
|
1059
|
-
function handleCompositionStart() {
|
|
1060
|
-
window.clearTimeout(compositionTimeout);
|
|
1061
|
-
isComposingRef.current = true;
|
|
1062
|
-
}
|
|
1063
|
-
function handleCompositionEnd() {
|
|
1064
|
-
// Safari fires `compositionend` before `keydown`, so we need to wait
|
|
1065
|
-
// until the next tick to set `isComposing` to `false`.
|
|
1066
|
-
// https://bugs.webkit.org/show_bug.cgi?id=165004
|
|
1067
|
-
compositionTimeout = window.setTimeout(() => {
|
|
1068
|
-
isComposingRef.current = false;
|
|
1069
|
-
},
|
|
1070
|
-
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
1071
|
-
// Only apply to WebKit for the test to remain 0ms.
|
|
1072
|
-
isWebKit() ? 5 : 0);
|
|
1073
|
-
}
|
|
1074
|
-
const doc = getDocument(elements.floating);
|
|
1075
|
-
if (escapeKey) {
|
|
1076
|
-
doc.addEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
|
|
1077
|
-
doc.addEventListener('compositionstart', handleCompositionStart);
|
|
1078
|
-
doc.addEventListener('compositionend', handleCompositionEnd);
|
|
1079
|
-
}
|
|
1080
|
-
outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
|
|
1081
|
-
let ancestors = [];
|
|
1082
|
-
if (ancestorScroll) {
|
|
1083
|
-
if (isElement(elements.domReference)) {
|
|
1084
|
-
ancestors = getOverflowAncestors(elements.domReference);
|
|
1085
|
-
}
|
|
1086
|
-
if (isElement(elements.floating)) {
|
|
1087
|
-
ancestors = ancestors.concat(getOverflowAncestors(elements.floating));
|
|
1088
|
-
}
|
|
1089
|
-
if (!isElement(elements.reference) && elements.reference && elements.reference.contextElement) {
|
|
1090
|
-
ancestors = ancestors.concat(getOverflowAncestors(elements.reference.contextElement));
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
// Ignore the visual viewport for scrolling dismissal (allow pinch-zoom)
|
|
1095
|
-
ancestors = ancestors.filter(ancestor => {
|
|
1096
|
-
var _doc$defaultView;
|
|
1097
|
-
return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);
|
|
1098
|
-
});
|
|
1099
|
-
ancestors.forEach(ancestor => {
|
|
1100
|
-
ancestor.addEventListener('scroll', onScroll, {
|
|
1101
|
-
passive: true
|
|
1102
|
-
});
|
|
1103
|
-
});
|
|
1104
|
-
return () => {
|
|
1105
|
-
if (escapeKey) {
|
|
1106
|
-
doc.removeEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
|
|
1107
|
-
doc.removeEventListener('compositionstart', handleCompositionStart);
|
|
1108
|
-
doc.removeEventListener('compositionend', handleCompositionEnd);
|
|
1109
|
-
}
|
|
1110
|
-
outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
|
|
1111
|
-
ancestors.forEach(ancestor => {
|
|
1112
|
-
ancestor.removeEventListener('scroll', onScroll);
|
|
1113
|
-
});
|
|
1114
|
-
window.clearTimeout(compositionTimeout);
|
|
1115
|
-
};
|
|
1116
|
-
}, [dataRef, elements, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]);
|
|
1117
|
-
React.useEffect(() => {
|
|
1118
|
-
dataRef.current.insideReactTree = false;
|
|
1119
|
-
}, [dataRef, outsidePress, outsidePressEvent]);
|
|
1120
|
-
const reference = React.useMemo(() => ({
|
|
1121
|
-
onKeyDown: closeOnEscapeKeyDown,
|
|
1122
|
-
...(referencePress && {
|
|
1123
|
-
[bubbleHandlerKeys[referencePressEvent]]: event => {
|
|
1124
|
-
onOpenChange(false, event.nativeEvent, 'reference-press');
|
|
1125
|
-
},
|
|
1126
|
-
...(referencePressEvent !== 'click' && {
|
|
1127
|
-
onClick(event) {
|
|
1128
|
-
onOpenChange(false, event.nativeEvent, 'reference-press');
|
|
1129
|
-
}
|
|
1130
|
-
})
|
|
1131
|
-
})
|
|
1132
|
-
}), [closeOnEscapeKeyDown, onOpenChange, referencePress, referencePressEvent]);
|
|
1133
|
-
const floating = React.useMemo(() => ({
|
|
1134
|
-
onKeyDown: closeOnEscapeKeyDown,
|
|
1135
|
-
onMouseDown() {
|
|
1136
|
-
endedOrStartedInsideRef.current = true;
|
|
1137
|
-
},
|
|
1138
|
-
onMouseUp() {
|
|
1139
|
-
endedOrStartedInsideRef.current = true;
|
|
1140
|
-
},
|
|
1141
|
-
[captureHandlerKeys[outsidePressEvent]]: () => {
|
|
1142
|
-
dataRef.current.insideReactTree = true;
|
|
1143
|
-
}
|
|
1144
|
-
}), [closeOnEscapeKeyDown, outsidePressEvent, dataRef]);
|
|
1145
|
-
return React.useMemo(() => enabled ? {
|
|
1146
|
-
reference,
|
|
1147
|
-
floating
|
|
1148
|
-
} : {}, [enabled, reference, floating]);
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
function useFloatingRootContext(options) {
|
|
1152
|
-
const {
|
|
1153
|
-
open = false,
|
|
1154
|
-
onOpenChange: onOpenChangeProp,
|
|
1155
|
-
elements: elementsProp
|
|
1156
|
-
} = options;
|
|
1157
|
-
const floatingId = useId();
|
|
1158
|
-
const dataRef = React.useRef({});
|
|
1159
|
-
const [events] = React.useState(() => createEventEmitter());
|
|
1160
|
-
const nested = useFloatingParentNodeId() != null;
|
|
1161
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1162
|
-
const optionDomReference = elementsProp.reference;
|
|
1163
|
-
if (optionDomReference && !isElement(optionDomReference)) {
|
|
1164
|
-
error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
const [positionReference, setPositionReference] = React.useState(elementsProp.reference);
|
|
1168
|
-
const onOpenChange = useEffectEvent((open, event, reason) => {
|
|
1169
|
-
dataRef.current.openEvent = open ? event : undefined;
|
|
1170
|
-
events.emit('openchange', {
|
|
1171
|
-
open,
|
|
1172
|
-
event,
|
|
1173
|
-
reason,
|
|
1174
|
-
nested
|
|
1175
|
-
});
|
|
1176
|
-
onOpenChangeProp == null || onOpenChangeProp(open, event, reason);
|
|
1177
|
-
});
|
|
1178
|
-
const refs = React.useMemo(() => ({
|
|
1179
|
-
setPositionReference
|
|
1180
|
-
}), []);
|
|
1181
|
-
const elements = React.useMemo(() => ({
|
|
1182
|
-
reference: positionReference || elementsProp.reference || null,
|
|
1183
|
-
floating: elementsProp.floating || null,
|
|
1184
|
-
domReference: elementsProp.reference
|
|
1185
|
-
}), [positionReference, elementsProp.reference, elementsProp.floating]);
|
|
1186
|
-
return React.useMemo(() => ({
|
|
1187
|
-
dataRef,
|
|
1188
|
-
open,
|
|
1189
|
-
onOpenChange,
|
|
1190
|
-
elements,
|
|
1191
|
-
events,
|
|
1192
|
-
floatingId,
|
|
1193
|
-
refs
|
|
1194
|
-
}), [open, onOpenChange, elements, events, floatingId, refs]);
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
/**
|
|
1198
|
-
* Provides data to position a floating element and context to add interactions.
|
|
1199
|
-
* @see https://floating-ui.com/docs/useFloating
|
|
1200
|
-
*/
|
|
1201
|
-
function useFloating(options) {
|
|
1202
|
-
if (options === void 0) {
|
|
1203
|
-
options = {};
|
|
1204
|
-
}
|
|
1205
|
-
const {
|
|
1206
|
-
nodeId
|
|
1207
|
-
} = options;
|
|
1208
|
-
const internalRootContext = useFloatingRootContext({
|
|
1209
|
-
...options,
|
|
1210
|
-
elements: {
|
|
1211
|
-
reference: null,
|
|
1212
|
-
floating: null,
|
|
1213
|
-
...options.elements
|
|
1214
|
-
}
|
|
1215
|
-
});
|
|
1216
|
-
const rootContext = options.rootContext || internalRootContext;
|
|
1217
|
-
const computedElements = rootContext.elements;
|
|
1218
|
-
const [_domReference, setDomReference] = React.useState(null);
|
|
1219
|
-
const [positionReference, _setPositionReference] = React.useState(null);
|
|
1220
|
-
const optionDomReference = computedElements == null ? void 0 : computedElements.domReference;
|
|
1221
|
-
const domReference = optionDomReference || _domReference;
|
|
1222
|
-
const domReferenceRef = React.useRef(null);
|
|
1223
|
-
const tree = useFloatingTree();
|
|
1224
|
-
index(() => {
|
|
1225
|
-
if (domReference) {
|
|
1226
|
-
domReferenceRef.current = domReference;
|
|
1227
|
-
}
|
|
1228
|
-
}, [domReference]);
|
|
1229
|
-
const position = useFloating$1({
|
|
1230
|
-
...options,
|
|
1231
|
-
elements: {
|
|
1232
|
-
...computedElements,
|
|
1233
|
-
...(positionReference && {
|
|
1234
|
-
reference: positionReference
|
|
1235
|
-
})
|
|
1236
|
-
}
|
|
1237
|
-
});
|
|
1238
|
-
const setPositionReference = React.useCallback(node => {
|
|
1239
|
-
const computedPositionReference = isElement(node) ? {
|
|
1240
|
-
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
1241
|
-
getClientRects: () => node.getClientRects(),
|
|
1242
|
-
contextElement: node
|
|
1243
|
-
} : node;
|
|
1244
|
-
// Store the positionReference in state if the DOM reference is specified externally via the
|
|
1245
|
-
// `elements.reference` option. This ensures that it won't be overridden on future renders.
|
|
1246
|
-
_setPositionReference(computedPositionReference);
|
|
1247
|
-
position.refs.setReference(computedPositionReference);
|
|
1248
|
-
}, [position.refs]);
|
|
1249
|
-
const setReference = React.useCallback(node => {
|
|
1250
|
-
if (isElement(node) || node === null) {
|
|
1251
|
-
domReferenceRef.current = node;
|
|
1252
|
-
setDomReference(node);
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
// Backwards-compatibility for passing a virtual element to `reference`
|
|
1256
|
-
// after it has set the DOM reference.
|
|
1257
|
-
if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||
|
|
1258
|
-
// Don't allow setting virtual elements using the old technique back to
|
|
1259
|
-
// `null` to support `positionReference` + an unstable `reference`
|
|
1260
|
-
// callback ref.
|
|
1261
|
-
node !== null && !isElement(node)) {
|
|
1262
|
-
position.refs.setReference(node);
|
|
1263
|
-
}
|
|
1264
|
-
}, [position.refs]);
|
|
1265
|
-
const refs = React.useMemo(() => ({
|
|
1266
|
-
...position.refs,
|
|
1267
|
-
setReference,
|
|
1268
|
-
setPositionReference,
|
|
1269
|
-
domReference: domReferenceRef
|
|
1270
|
-
}), [position.refs, setReference, setPositionReference]);
|
|
1271
|
-
const elements = React.useMemo(() => ({
|
|
1272
|
-
...position.elements,
|
|
1273
|
-
domReference: domReference
|
|
1274
|
-
}), [position.elements, domReference]);
|
|
1275
|
-
const context = React.useMemo(() => ({
|
|
1276
|
-
...position,
|
|
1277
|
-
...rootContext,
|
|
1278
|
-
refs,
|
|
1279
|
-
elements,
|
|
1280
|
-
nodeId
|
|
1281
|
-
}), [position, refs, elements, nodeId, rootContext]);
|
|
1282
|
-
index(() => {
|
|
1283
|
-
rootContext.dataRef.current.floatingContext = context;
|
|
1284
|
-
const node = tree == null ? void 0 : tree.nodesRef.current.find(node => node.id === nodeId);
|
|
1285
|
-
if (node) {
|
|
1286
|
-
node.context = context;
|
|
1287
|
-
}
|
|
1288
|
-
});
|
|
1289
|
-
return React.useMemo(() => ({
|
|
1290
|
-
...position,
|
|
1291
|
-
context,
|
|
1292
|
-
refs,
|
|
1293
|
-
elements
|
|
1294
|
-
}), [position, refs, elements, context]);
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
function isMacSafari() {
|
|
1298
|
-
return isMac() && isSafari();
|
|
1299
|
-
}
|
|
1300
|
-
/**
|
|
1301
|
-
* Opens the floating element while the reference element has focus, like CSS
|
|
1302
|
-
* `:focus`.
|
|
1303
|
-
* @see https://floating-ui.com/docs/useFocus
|
|
1304
|
-
*/
|
|
1305
|
-
function useFocus(context, props) {
|
|
1306
|
-
if (props === void 0) {
|
|
1307
|
-
props = {};
|
|
1308
|
-
}
|
|
1309
|
-
const {
|
|
1310
|
-
open,
|
|
1311
|
-
onOpenChange,
|
|
1312
|
-
events,
|
|
1313
|
-
dataRef,
|
|
1314
|
-
elements
|
|
1315
|
-
} = context;
|
|
1316
|
-
const {
|
|
1317
|
-
enabled = true,
|
|
1318
|
-
visibleOnly = true
|
|
1319
|
-
} = props;
|
|
1320
|
-
const blockFocusRef = React.useRef(false);
|
|
1321
|
-
const timeoutRef = React.useRef(-1);
|
|
1322
|
-
const keyboardModalityRef = React.useRef(true);
|
|
1323
|
-
React.useEffect(() => {
|
|
1324
|
-
if (!enabled) return;
|
|
1325
|
-
const win = getWindow(elements.domReference);
|
|
1326
|
-
|
|
1327
|
-
// If the reference was focused and the user left the tab/window, and the
|
|
1328
|
-
// floating element was not open, the focus should be blocked when they
|
|
1329
|
-
// return to the tab/window.
|
|
1330
|
-
function onBlur() {
|
|
1331
|
-
if (!open && isHTMLElement(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference))) {
|
|
1332
|
-
blockFocusRef.current = true;
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
function onKeyDown() {
|
|
1336
|
-
keyboardModalityRef.current = true;
|
|
1337
|
-
}
|
|
1338
|
-
function onPointerDown() {
|
|
1339
|
-
keyboardModalityRef.current = false;
|
|
1340
|
-
}
|
|
1341
|
-
win.addEventListener('blur', onBlur);
|
|
1342
|
-
if (isMacSafari()) {
|
|
1343
|
-
win.addEventListener('keydown', onKeyDown, true);
|
|
1344
|
-
win.addEventListener('pointerdown', onPointerDown, true);
|
|
1345
|
-
}
|
|
1346
|
-
return () => {
|
|
1347
|
-
win.removeEventListener('blur', onBlur);
|
|
1348
|
-
if (isMacSafari()) {
|
|
1349
|
-
win.removeEventListener('keydown', onKeyDown, true);
|
|
1350
|
-
win.removeEventListener('pointerdown', onPointerDown, true);
|
|
1351
|
-
}
|
|
1352
|
-
};
|
|
1353
|
-
}, [elements.domReference, open, enabled]);
|
|
1354
|
-
React.useEffect(() => {
|
|
1355
|
-
if (!enabled) return;
|
|
1356
|
-
function onOpenChange(_ref) {
|
|
1357
|
-
let {
|
|
1358
|
-
reason
|
|
1359
|
-
} = _ref;
|
|
1360
|
-
if (reason === 'reference-press' || reason === 'escape-key') {
|
|
1361
|
-
blockFocusRef.current = true;
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
events.on('openchange', onOpenChange);
|
|
1365
|
-
return () => {
|
|
1366
|
-
events.off('openchange', onOpenChange);
|
|
1367
|
-
};
|
|
1368
|
-
}, [events, enabled]);
|
|
1369
|
-
React.useEffect(() => {
|
|
1370
|
-
return () => {
|
|
1371
|
-
clearTimeoutIfSet(timeoutRef);
|
|
1372
|
-
};
|
|
1373
|
-
}, []);
|
|
1374
|
-
const reference = React.useMemo(() => ({
|
|
1375
|
-
onMouseLeave() {
|
|
1376
|
-
blockFocusRef.current = false;
|
|
1377
|
-
},
|
|
1378
|
-
onFocus(event) {
|
|
1379
|
-
if (blockFocusRef.current) return;
|
|
1380
|
-
const target = getTarget(event.nativeEvent);
|
|
1381
|
-
if (visibleOnly && isElement(target)) {
|
|
1382
|
-
// Safari fails to match `:focus-visible` if focus was initially
|
|
1383
|
-
// outside the document.
|
|
1384
|
-
if (isMacSafari() && !event.relatedTarget) {
|
|
1385
|
-
if (!keyboardModalityRef.current && !isTypeableElement(target)) {
|
|
1386
|
-
return;
|
|
1387
|
-
}
|
|
1388
|
-
} else if (!matchesFocusVisible(target)) {
|
|
1389
|
-
return;
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
onOpenChange(true, event.nativeEvent, 'focus');
|
|
1393
|
-
},
|
|
1394
|
-
onBlur(event) {
|
|
1395
|
-
blockFocusRef.current = false;
|
|
1396
|
-
const relatedTarget = event.relatedTarget;
|
|
1397
|
-
const nativeEvent = event.nativeEvent;
|
|
1398
|
-
|
|
1399
|
-
// Hit the non-modal focus management portal guard. Focus will be
|
|
1400
|
-
// moved into the floating element immediately after.
|
|
1401
|
-
const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside';
|
|
1402
|
-
|
|
1403
|
-
// Wait for the window blur listener to fire.
|
|
1404
|
-
timeoutRef.current = window.setTimeout(() => {
|
|
1405
|
-
var _dataRef$current$floa;
|
|
1406
|
-
const activeEl = activeElement(elements.domReference ? elements.domReference.ownerDocument : document);
|
|
1407
|
-
|
|
1408
|
-
// Focus left the page, keep it open.
|
|
1409
|
-
if (!relatedTarget && activeEl === elements.domReference) return;
|
|
1410
|
-
|
|
1411
|
-
// When focusing the reference element (e.g. regular click), then
|
|
1412
|
-
// clicking into the floating element, prevent it from hiding.
|
|
1413
|
-
// Note: it must be focusable, e.g. `tabindex="-1"`.
|
|
1414
|
-
// We can not rely on relatedTarget to point to the correct element
|
|
1415
|
-
// as it will only point to the shadow host of the newly focused element
|
|
1416
|
-
// and not the element that actually has received focus if it is located
|
|
1417
|
-
// inside a shadow root.
|
|
1418
|
-
if (contains((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || contains(elements.domReference, activeEl) || movedToFocusGuard) {
|
|
1419
|
-
return;
|
|
1420
|
-
}
|
|
1421
|
-
onOpenChange(false, nativeEvent, 'focus');
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
}), [dataRef, elements.domReference, onOpenChange, visibleOnly]);
|
|
1425
|
-
return React.useMemo(() => enabled ? {
|
|
1426
|
-
reference
|
|
1427
|
-
} : {}, [enabled, reference]);
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
function mergeProps(userProps, propsList, elementKey) {
|
|
1431
|
-
const map = new Map();
|
|
1432
|
-
const isItem = elementKey === 'item';
|
|
1433
|
-
let domUserProps = userProps;
|
|
1434
|
-
if (isItem && userProps) {
|
|
1435
|
-
const {
|
|
1436
|
-
[ACTIVE_KEY]: _,
|
|
1437
|
-
[SELECTED_KEY]: __,
|
|
1438
|
-
...validProps
|
|
1439
|
-
} = userProps;
|
|
1440
|
-
domUserProps = validProps;
|
|
1441
|
-
}
|
|
1442
|
-
return {
|
|
1443
|
-
...(elementKey === 'floating' && {
|
|
1444
|
-
tabIndex: -1,
|
|
1445
|
-
[FOCUSABLE_ATTRIBUTE]: ''
|
|
1446
|
-
}),
|
|
1447
|
-
...domUserProps,
|
|
1448
|
-
...propsList.map(value => {
|
|
1449
|
-
const propsOrGetProps = value ? value[elementKey] : null;
|
|
1450
|
-
if (typeof propsOrGetProps === 'function') {
|
|
1451
|
-
return userProps ? propsOrGetProps(userProps) : null;
|
|
1452
|
-
}
|
|
1453
|
-
return propsOrGetProps;
|
|
1454
|
-
}).concat(userProps).reduce((acc, props) => {
|
|
1455
|
-
if (!props) {
|
|
1456
|
-
return acc;
|
|
1457
|
-
}
|
|
1458
|
-
Object.entries(props).forEach(_ref => {
|
|
1459
|
-
let [key, value] = _ref;
|
|
1460
|
-
if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {
|
|
1461
|
-
return;
|
|
1462
|
-
}
|
|
1463
|
-
if (key.indexOf('on') === 0) {
|
|
1464
|
-
if (!map.has(key)) {
|
|
1465
|
-
map.set(key, []);
|
|
1466
|
-
}
|
|
1467
|
-
if (typeof value === 'function') {
|
|
1468
|
-
var _map$get;
|
|
1469
|
-
(_map$get = map.get(key)) == null || _map$get.push(value);
|
|
1470
|
-
acc[key] = function () {
|
|
1471
|
-
var _map$get2;
|
|
1472
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1473
|
-
args[_key] = arguments[_key];
|
|
1474
|
-
}
|
|
1475
|
-
return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map(fn => fn(...args)).find(val => val !== undefined);
|
|
1476
|
-
};
|
|
1477
|
-
}
|
|
1478
|
-
} else {
|
|
1479
|
-
acc[key] = value;
|
|
1480
|
-
}
|
|
1481
|
-
});
|
|
1482
|
-
return acc;
|
|
1483
|
-
}, {})
|
|
1484
|
-
};
|
|
1485
|
-
}
|
|
1486
|
-
/**
|
|
1487
|
-
* Merges an array of interaction hooks' props into prop getters, allowing
|
|
1488
|
-
* event handler functions to be composed together without overwriting one
|
|
1489
|
-
* another.
|
|
1490
|
-
* @see https://floating-ui.com/docs/useInteractions
|
|
1491
|
-
*/
|
|
1492
|
-
function useInteractions(propsList) {
|
|
1493
|
-
if (propsList === void 0) {
|
|
1494
|
-
propsList = [];
|
|
1495
|
-
}
|
|
1496
|
-
const referenceDeps = propsList.map(key => key == null ? void 0 : key.reference);
|
|
1497
|
-
const floatingDeps = propsList.map(key => key == null ? void 0 : key.floating);
|
|
1498
|
-
const itemDeps = propsList.map(key => key == null ? void 0 : key.item);
|
|
1499
|
-
const getReferenceProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'reference'),
|
|
1500
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1501
|
-
referenceDeps);
|
|
1502
|
-
const getFloatingProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'floating'),
|
|
1503
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1504
|
-
floatingDeps);
|
|
1505
|
-
const getItemProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'item'),
|
|
1506
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1507
|
-
itemDeps);
|
|
1508
|
-
return React.useMemo(() => ({
|
|
1509
|
-
getReferenceProps,
|
|
1510
|
-
getFloatingProps,
|
|
1511
|
-
getItemProps
|
|
1512
|
-
}), [getReferenceProps, getFloatingProps, getItemProps]);
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
const componentRoleToAriaRoleMap = /*#__PURE__*/new Map([['select', 'listbox'], ['combobox', 'listbox'], ['label', false]]);
|
|
1516
|
-
|
|
1517
|
-
/**
|
|
1518
|
-
* Adds base screen reader props to the reference and floating elements for a
|
|
1519
|
-
* given floating element `role`.
|
|
1520
|
-
* @see https://floating-ui.com/docs/useRole
|
|
1521
|
-
*/
|
|
1522
|
-
function useRole(context, props) {
|
|
1523
|
-
var _elements$domReferenc, _componentRoleToAriaR;
|
|
1524
|
-
if (props === void 0) {
|
|
1525
|
-
props = {};
|
|
1526
|
-
}
|
|
1527
|
-
const {
|
|
1528
|
-
open,
|
|
1529
|
-
elements,
|
|
1530
|
-
floatingId: defaultFloatingId
|
|
1531
|
-
} = context;
|
|
1532
|
-
const {
|
|
1533
|
-
enabled = true,
|
|
1534
|
-
role = 'dialog'
|
|
1535
|
-
} = props;
|
|
1536
|
-
const defaultReferenceId = useId();
|
|
1537
|
-
const referenceId = ((_elements$domReferenc = elements.domReference) == null ? void 0 : _elements$domReferenc.id) || defaultReferenceId;
|
|
1538
|
-
const floatingId = React.useMemo(() => {
|
|
1539
|
-
var _getFloatingFocusElem;
|
|
1540
|
-
return ((_getFloatingFocusElem = getFloatingFocusElement(elements.floating)) == null ? void 0 : _getFloatingFocusElem.id) || defaultFloatingId;
|
|
1541
|
-
}, [elements.floating, defaultFloatingId]);
|
|
1542
|
-
const ariaRole = (_componentRoleToAriaR = componentRoleToAriaRoleMap.get(role)) != null ? _componentRoleToAriaR : role;
|
|
1543
|
-
const parentId = useFloatingParentNodeId();
|
|
1544
|
-
const isNested = parentId != null;
|
|
1545
|
-
const reference = React.useMemo(() => {
|
|
1546
|
-
if (ariaRole === 'tooltip' || role === 'label') {
|
|
1547
|
-
return {
|
|
1548
|
-
["aria-" + (role === 'label' ? 'labelledby' : 'describedby')]: open ? floatingId : undefined
|
|
1549
|
-
};
|
|
1550
|
-
}
|
|
1551
|
-
return {
|
|
1552
|
-
'aria-expanded': open ? 'true' : 'false',
|
|
1553
|
-
'aria-haspopup': ariaRole === 'alertdialog' ? 'dialog' : ariaRole,
|
|
1554
|
-
'aria-controls': open ? floatingId : undefined,
|
|
1555
|
-
...(ariaRole === 'listbox' && {
|
|
1556
|
-
role: 'combobox'
|
|
1557
|
-
}),
|
|
1558
|
-
...(ariaRole === 'menu' && {
|
|
1559
|
-
id: referenceId
|
|
1560
|
-
}),
|
|
1561
|
-
...(ariaRole === 'menu' && isNested && {
|
|
1562
|
-
role: 'menuitem'
|
|
1563
|
-
}),
|
|
1564
|
-
...(role === 'select' && {
|
|
1565
|
-
'aria-autocomplete': 'none'
|
|
1566
|
-
}),
|
|
1567
|
-
...(role === 'combobox' && {
|
|
1568
|
-
'aria-autocomplete': 'list'
|
|
1569
|
-
})
|
|
1570
|
-
};
|
|
1571
|
-
}, [ariaRole, floatingId, isNested, open, referenceId, role]);
|
|
1572
|
-
const floating = React.useMemo(() => {
|
|
1573
|
-
const floatingProps = {
|
|
1574
|
-
id: floatingId,
|
|
1575
|
-
...(ariaRole && {
|
|
1576
|
-
role: ariaRole
|
|
1577
|
-
})
|
|
1578
|
-
};
|
|
1579
|
-
if (ariaRole === 'tooltip' || role === 'label') {
|
|
1580
|
-
return floatingProps;
|
|
1581
|
-
}
|
|
1582
|
-
return {
|
|
1583
|
-
...floatingProps,
|
|
1584
|
-
...(ariaRole === 'menu' && {
|
|
1585
|
-
'aria-labelledby': referenceId
|
|
1586
|
-
})
|
|
1587
|
-
};
|
|
1588
|
-
}, [ariaRole, floatingId, referenceId, role]);
|
|
1589
|
-
const item = React.useCallback(_ref => {
|
|
1590
|
-
let {
|
|
1591
|
-
active,
|
|
1592
|
-
selected
|
|
1593
|
-
} = _ref;
|
|
1594
|
-
const commonProps = {
|
|
1595
|
-
role: 'option',
|
|
1596
|
-
...(active && {
|
|
1597
|
-
id: floatingId + "-fui-option"
|
|
1598
|
-
})
|
|
1599
|
-
};
|
|
1600
|
-
|
|
1601
|
-
// For `menu`, we are unable to tell if the item is a `menuitemradio`
|
|
1602
|
-
// or `menuitemcheckbox`. For backwards-compatibility reasons, also
|
|
1603
|
-
// avoid defaulting to `menuitem` as it may overwrite custom role props.
|
|
1604
|
-
switch (role) {
|
|
1605
|
-
case 'select':
|
|
1606
|
-
case 'combobox':
|
|
1607
|
-
return {
|
|
1608
|
-
...commonProps,
|
|
1609
|
-
'aria-selected': selected
|
|
1610
|
-
};
|
|
1611
|
-
}
|
|
1612
|
-
return {};
|
|
1613
|
-
}, [floatingId, role]);
|
|
1614
|
-
return React.useMemo(() => enabled ? {
|
|
1615
|
-
reference,
|
|
1616
|
-
floating,
|
|
1617
|
-
item
|
|
1618
|
-
} : {}, [enabled, reference, floating, item]);
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
export { FloatingArrow, FloatingPortal, getOverflowAncestors, useDismiss, useFloating, useFloatingParentNodeId, useFloatingPortalNode, useFloatingRootContext, useFloatingTree, useFocus, useHover, useId, useInteractions, useMergeRefs, useRole };
|