@basic-ui/core 0.0.39 → 0.0.42
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/build/cjs/index.js +1312 -464
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Accordion/Accordion.d.ts +7 -7
- package/build/esm/Accordion/Accordion.js +4 -4
- package/build/esm/Accordion/Accordion.js.map +1 -1
- package/build/esm/Accordion/AccordionBody.d.ts +5 -5
- package/build/esm/Accordion/AccordionBody.js +4 -4
- package/build/esm/Accordion/AccordionBody.js.map +1 -1
- package/build/esm/Accordion/AccordionHeader.d.ts +6 -6
- package/build/esm/Accordion/AccordionHeader.js +4 -4
- package/build/esm/Accordion/AccordionHeader.js.map +1 -1
- package/build/esm/Accordion/AccordionItem.d.ts +7 -7
- package/build/esm/Accordion/AccordionItem.js +2 -2
- package/build/esm/Accordion/AccordionItem.js.map +1 -1
- package/build/esm/Accordion/context.d.ts +3 -3
- package/build/esm/Accordion/context.js +0 -0
- package/build/esm/Accordion/context.js.map +1 -1
- package/build/esm/Accordion/index.d.ts +0 -0
- package/build/esm/Accordion/index.js +0 -0
- package/build/esm/Accordion/index.js.map +1 -1
- package/build/esm/Accordion/scopeQuery.d.ts +0 -0
- package/build/esm/Accordion/scopeQuery.js +0 -0
- package/build/esm/Accordion/scopeQuery.js.map +1 -1
- package/build/esm/CheckBox/CheckBox.d.ts +6 -6
- package/build/esm/CheckBox/CheckBox.js +2 -2
- package/build/esm/CheckBox/CheckBox.js.map +1 -1
- package/build/esm/CheckBox/index.d.ts +0 -0
- package/build/esm/CheckBox/index.js +0 -0
- package/build/esm/CheckBox/index.js.map +1 -1
- package/build/esm/ComboBox/Combobox.d.ts +10 -10
- package/build/esm/ComboBox/Combobox.js +3 -3
- package/build/esm/ComboBox/Combobox.js.map +1 -1
- package/build/esm/ComboBox/ComboboxButton.d.ts +8 -8
- package/build/esm/ComboBox/ComboboxButton.js +4 -4
- package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
- package/build/esm/ComboBox/ComboboxInput.d.ts +10 -10
- package/build/esm/ComboBox/ComboboxInput.js +3 -3
- package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
- package/build/esm/ComboBox/ComboboxLabel.d.ts +5 -5
- package/build/esm/ComboBox/ComboboxLabel.js +2 -2
- package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
- package/build/esm/ComboBox/ComboboxList.d.ts +6 -6
- package/build/esm/ComboBox/ComboboxList.js +3 -3
- package/build/esm/ComboBox/ComboboxList.js.map +1 -1
- package/build/esm/ComboBox/ComboboxOption.d.ts +7 -7
- package/build/esm/ComboBox/ComboboxOption.js +4 -4
- package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
- package/build/esm/ComboBox/ComboboxPopover.d.ts +8 -8
- package/build/esm/ComboBox/ComboboxPopover.js +5 -5
- package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
- package/build/esm/ComboBox/cities.d.ts +0 -0
- package/build/esm/ComboBox/cities.js +0 -0
- package/build/esm/ComboBox/cities.js.map +1 -1
- package/build/esm/ComboBox/context.d.ts +10 -10
- package/build/esm/ComboBox/context.js +0 -0
- package/build/esm/ComboBox/context.js.map +1 -1
- package/build/esm/ComboBox/hooks.d.ts +3 -3
- package/build/esm/ComboBox/hooks.js +11 -11
- package/build/esm/ComboBox/hooks.js.map +1 -1
- package/build/esm/ComboBox/index.d.ts +0 -0
- package/build/esm/ComboBox/index.js +0 -0
- package/build/esm/ComboBox/index.js.map +1 -1
- package/build/esm/ComboBox/makeHash.d.ts +0 -0
- package/build/esm/ComboBox/makeHash.js +0 -0
- package/build/esm/ComboBox/makeHash.js.map +1 -1
- package/build/esm/ComboBox/scopeQuery.d.ts +0 -0
- package/build/esm/ComboBox/scopeQuery.js +0 -0
- package/build/esm/ComboBox/scopeQuery.js.map +1 -1
- package/build/esm/FocusLock/FocusLock.d.ts +7 -7
- package/build/esm/FocusLock/FocusLock.js +2 -2
- package/build/esm/FocusLock/FocusLock.js.map +1 -1
- package/build/esm/FocusLock/index.d.ts +0 -0
- package/build/esm/FocusLock/index.js +0 -0
- package/build/esm/FocusLock/index.js.map +1 -1
- package/build/esm/FocusLock/tabUtils.d.ts +0 -0
- package/build/esm/FocusLock/tabUtils.js +0 -0
- package/build/esm/FocusLock/tabUtils.js.map +1 -1
- package/build/esm/FocusLock/useFocusLock.d.ts +4 -4
- package/build/esm/FocusLock/useFocusLock.js +0 -0
- package/build/esm/FocusLock/useFocusLock.js.map +1 -1
- package/build/esm/List/List.d.ts +6 -6
- package/build/esm/List/List.js +2 -2
- package/build/esm/List/List.js.map +1 -1
- package/build/esm/List/ListItem.d.ts +6 -6
- package/build/esm/List/ListItem.js +2 -2
- package/build/esm/List/ListItem.js.map +1 -1
- package/build/esm/List/context.d.ts +0 -0
- package/build/esm/List/context.js +0 -0
- package/build/esm/List/context.js.map +1 -1
- package/build/esm/List/index.d.ts +0 -0
- package/build/esm/List/index.js +0 -0
- package/build/esm/List/index.js.map +1 -1
- package/build/esm/Menu/Menu.d.ts +6 -6
- package/build/esm/Menu/Menu.js +2 -2
- package/build/esm/Menu/Menu.js.map +1 -1
- package/build/esm/Menu/MenuButton.d.ts +10 -10
- package/build/esm/Menu/MenuButton.js +3 -3
- package/build/esm/Menu/MenuButton.js.map +1 -1
- package/build/esm/Menu/MenuItem.d.ts +6 -6
- package/build/esm/Menu/MenuItem.js +4 -4
- package/build/esm/Menu/MenuItem.js.map +1 -1
- package/build/esm/Menu/MenuList.d.ts +5 -5
- package/build/esm/Menu/MenuList.js +6 -6
- package/build/esm/Menu/MenuList.js.map +1 -1
- package/build/esm/Menu/MenuPopover.d.ts +5 -5
- package/build/esm/Menu/MenuPopover.js +2 -2
- package/build/esm/Menu/MenuPopover.js.map +1 -1
- package/build/esm/Menu/context.d.ts +2 -2
- package/build/esm/Menu/context.js +0 -0
- package/build/esm/Menu/context.js.map +1 -1
- package/build/esm/Menu/index.d.ts +0 -0
- package/build/esm/Menu/index.js +0 -0
- package/build/esm/Menu/index.js.map +1 -1
- package/build/esm/Menu/scope.d.ts +0 -0
- package/build/esm/Menu/scope.js +0 -0
- package/build/esm/Menu/scope.js.map +1 -1
- package/build/esm/Modal/Modal.d.ts +6 -7
- package/build/esm/Modal/Modal.js +5 -5
- package/build/esm/Modal/Modal.js.map +1 -1
- package/build/esm/Modal/ModalBackdrop.d.ts +6 -6
- package/build/esm/Modal/ModalBackdrop.js +6 -6
- package/build/esm/Modal/ModalBackdrop.js.map +1 -1
- package/build/esm/Modal/index.d.ts +0 -0
- package/build/esm/Modal/index.js +0 -0
- package/build/esm/Modal/index.js.map +1 -1
- package/build/esm/Popper/Popper.d.ts +7 -7
- package/build/esm/Popper/Popper.js +6 -6
- package/build/esm/Popper/Popper.js.map +1 -1
- package/build/esm/Popper/PopperArrow.d.ts +5 -5
- package/build/esm/Popper/PopperArrow.js +5 -6
- package/build/esm/Popper/PopperArrow.js.map +1 -1
- package/build/esm/Popper/context.d.ts +0 -0
- package/build/esm/Popper/context.js +0 -0
- package/build/esm/Popper/context.js.map +1 -1
- package/build/esm/Popper/index.d.ts +0 -0
- package/build/esm/Popper/index.js +0 -0
- package/build/esm/Popper/index.js.map +1 -1
- package/build/esm/Portal/Portal.d.ts +0 -0
- package/build/esm/Portal/Portal.js +0 -0
- package/build/esm/Portal/Portal.js.map +1 -1
- package/build/esm/Portal/index.d.ts +0 -0
- package/build/esm/Portal/index.js +0 -0
- package/build/esm/Portal/index.js.map +1 -1
- package/build/esm/RadioButton/RadioButton.d.ts +6 -6
- package/build/esm/RadioButton/RadioButton.js +5 -3
- package/build/esm/RadioButton/RadioButton.js.map +1 -1
- package/build/esm/RadioButton/RadioGroup.d.ts +7 -7
- package/build/esm/RadioButton/RadioGroup.js +2 -2
- package/build/esm/RadioButton/RadioGroup.js.map +1 -1
- package/build/esm/RadioButton/context.d.ts +2 -2
- package/build/esm/RadioButton/context.js +0 -0
- package/build/esm/RadioButton/context.js.map +1 -1
- package/build/esm/RadioButton/index.d.ts +0 -0
- package/build/esm/RadioButton/index.js +0 -0
- package/build/esm/RadioButton/index.js.map +1 -1
- package/build/esm/SkipNav/SkipNav.d.ts +6 -6
- package/build/esm/SkipNav/SkipNav.js +2 -2
- package/build/esm/SkipNav/SkipNav.js.map +1 -1
- package/build/esm/SkipNav/index.d.ts +0 -0
- package/build/esm/SkipNav/index.js +0 -0
- package/build/esm/SkipNav/index.js.map +1 -1
- package/build/esm/Slider/Slider.d.ts +218 -0
- package/build/esm/Slider/Slider.js +842 -0
- package/build/esm/Slider/Slider.js.map +1 -0
- package/build/esm/Slider/index.d.ts +1 -0
- package/build/esm/Slider/index.js +2 -0
- package/build/esm/Slider/index.js.map +1 -0
- package/build/esm/Spinner/Spinner.d.ts +7 -7
- package/build/esm/Spinner/Spinner.js +2 -2
- package/build/esm/Spinner/Spinner.js.map +1 -1
- package/build/esm/Spinner/SpinnerButton.d.ts +6 -6
- package/build/esm/Spinner/SpinnerButton.js +3 -3
- package/build/esm/Spinner/SpinnerButton.js.map +1 -1
- package/build/esm/Spinner/context.d.ts +2 -2
- package/build/esm/Spinner/context.js +0 -0
- package/build/esm/Spinner/context.js.map +1 -1
- package/build/esm/Spinner/index.d.ts +0 -0
- package/build/esm/Spinner/index.js +0 -0
- package/build/esm/Spinner/index.js.map +1 -1
- package/build/esm/Tabs/Tab.d.ts +6 -6
- package/build/esm/Tabs/Tab.js +3 -3
- package/build/esm/Tabs/Tab.js.map +1 -1
- package/build/esm/Tabs/TabList.d.ts +6 -6
- package/build/esm/Tabs/TabList.js +4 -4
- package/build/esm/Tabs/TabList.js.map +1 -1
- package/build/esm/Tabs/TabPanel.d.ts +6 -6
- package/build/esm/Tabs/TabPanel.js +4 -4
- package/build/esm/Tabs/TabPanel.js.map +1 -1
- package/build/esm/Tabs/TabPanels.d.ts +5 -5
- package/build/esm/Tabs/TabPanels.js +4 -4
- package/build/esm/Tabs/TabPanels.js.map +1 -1
- package/build/esm/Tabs/Tabs.d.ts +6 -6
- package/build/esm/Tabs/Tabs.js +2 -2
- package/build/esm/Tabs/Tabs.js.map +1 -1
- package/build/esm/Tabs/context.d.ts +2 -2
- package/build/esm/Tabs/context.js +0 -0
- package/build/esm/Tabs/context.js.map +1 -1
- package/build/esm/Tabs/index.d.ts +0 -0
- package/build/esm/Tabs/index.js +0 -0
- package/build/esm/Tabs/index.js.map +1 -1
- package/build/esm/Tabs/scopeQuery.d.ts +0 -0
- package/build/esm/Tabs/scopeQuery.js +0 -0
- package/build/esm/Tabs/scopeQuery.js.map +1 -1
- package/build/esm/Tooltip/Tooltip.d.ts +7 -8
- package/build/esm/Tooltip/Tooltip.js +5 -3
- package/build/esm/Tooltip/Tooltip.js.map +1 -1
- package/build/esm/Tooltip/index.d.ts +0 -0
- package/build/esm/Tooltip/index.js +0 -0
- package/build/esm/Tooltip/index.js.map +1 -1
- package/build/esm/Tooltip/stateMachine.d.ts +0 -0
- package/build/esm/Tooltip/stateMachine.js +9 -9
- package/build/esm/Tooltip/stateMachine.js.map +1 -1
- package/build/esm/Tooltip/useTooltip.d.ts +7 -7
- package/build/esm/Tooltip/useTooltip.js +7 -6
- package/build/esm/Tooltip/useTooltip.js.map +1 -1
- package/build/esm/hooks/index.d.ts +0 -0
- package/build/esm/hooks/index.js +0 -0
- package/build/esm/hooks/index.js.map +1 -1
- package/build/esm/hooks/useAutoFocus.d.ts +2 -2
- package/build/esm/hooks/useAutoFocus.js +0 -0
- package/build/esm/hooks/useAutoFocus.js.map +1 -1
- package/build/esm/hooks/useChildrenCounter.d.ts +0 -0
- package/build/esm/hooks/useChildrenCounter.js +0 -0
- package/build/esm/hooks/useChildrenCounter.js.map +1 -1
- package/build/esm/hooks/useControlledState.d.ts +2 -6
- package/build/esm/hooks/useControlledState.js +8 -7
- package/build/esm/hooks/useControlledState.js.map +1 -1
- package/build/esm/hooks/useFocusReturn.d.ts +0 -0
- package/build/esm/hooks/useFocusReturn.js +2 -2
- package/build/esm/hooks/useFocusReturn.js.map +1 -1
- package/build/esm/hooks/useFocusState.d.ts +5 -5
- package/build/esm/hooks/useFocusState.js +1 -1
- package/build/esm/hooks/useFocusState.js.map +1 -1
- package/build/esm/hooks/useGestureHandlers.d.ts +5 -5
- package/build/esm/hooks/useGestureHandlers.js +23 -15
- package/build/esm/hooks/useGestureHandlers.js.map +1 -1
- package/build/esm/hooks/useMeasure.d.ts +2 -2
- package/build/esm/hooks/useMeasure.js +0 -1
- package/build/esm/hooks/useMeasure.js.map +1 -1
- package/build/esm/hooks/useOnClickOutside.d.ts +2 -2
- package/build/esm/hooks/useOnClickOutside.js +0 -0
- package/build/esm/hooks/useOnClickOutside.js.map +1 -1
- package/build/esm/hooks/useOnKeyDown.d.ts +1 -1
- package/build/esm/hooks/useOnKeyDown.js +5 -5
- package/build/esm/hooks/useOnKeyDown.js.map +1 -1
- package/build/esm/hooks/useReducerMachine.d.ts +0 -0
- package/build/esm/hooks/useReducerMachine.js +2 -1
- package/build/esm/hooks/useReducerMachine.js.map +1 -1
- package/build/esm/hooks/useRemoveBodyScroll.d.ts +2 -1
- package/build/esm/hooks/useRemoveBodyScroll.js +12 -8
- package/build/esm/hooks/useRemoveBodyScroll.js.map +1 -1
- package/build/esm/hooks/useScope.d.ts +0 -0
- package/build/esm/hooks/useScope.js +0 -0
- package/build/esm/hooks/useScope.js.map +1 -1
- package/build/esm/hooks/useThrottle.d.ts +0 -0
- package/build/esm/hooks/useThrottle.js +0 -0
- package/build/esm/hooks/useThrottle.js.map +1 -1
- package/build/esm/index.d.ts +1 -0
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/utils/assign-ref.d.ts +3 -0
- package/build/esm/utils/{assignRef.js → assign-ref.js} +1 -1
- package/build/esm/utils/assign-ref.js.map +1 -0
- package/build/esm/utils/can-use-dom.d.ts +1 -0
- package/build/esm/utils/can-use-dom.js +4 -0
- package/build/esm/utils/can-use-dom.js.map +1 -0
- package/build/esm/utils/clamp.d.ts +0 -0
- package/build/esm/utils/clamp.js +0 -0
- package/build/esm/utils/clamp.js.map +1 -1
- package/build/esm/utils/context.d.ts +7 -0
- package/build/esm/utils/context.js +41 -0
- package/build/esm/utils/context.js.map +1 -0
- package/build/esm/utils/{createSubscription.d.ts → create-subscription.d.ts} +0 -0
- package/build/esm/utils/{createSubscription.js → create-subscription.js} +1 -1
- package/build/esm/utils/create-subscription.js.map +1 -0
- package/build/esm/utils/{getCircularIndex.d.ts → get-circular-index.d.ts} +0 -0
- package/build/esm/utils/{getCircularIndex.js → get-circular-index.js} +1 -1
- package/build/esm/utils/get-circular-index.js.map +1 -0
- package/build/esm/utils/index.d.ts +10 -4
- package/build/esm/utils/index.js +10 -4
- package/build/esm/utils/index.js.map +1 -1
- package/build/esm/utils/is-right-click.d.ts +6 -0
- package/build/esm/utils/is-right-click.js +9 -0
- package/build/esm/utils/is-right-click.js.map +1 -0
- package/build/esm/utils/owner-document.d.ts +7 -0
- package/build/esm/utils/owner-document.js +12 -0
- package/build/esm/utils/owner-document.js.map +1 -0
- package/build/esm/utils/polymorphic.d.ts +32 -0
- package/build/esm/utils/polymorphic.js +2 -0
- package/build/esm/utils/polymorphic.js.map +1 -0
- package/build/esm/utils/{rubberBandClamp.d.ts → rubber-band-clamp.d.ts} +0 -0
- package/build/esm/utils/{rubberBandClamp.js → rubber-band-clamp.js} +1 -1
- package/build/esm/utils/rubber-band-clamp.js.map +1 -0
- package/build/esm/utils/use-stable-callback.d.ts +16 -0
- package/build/esm/utils/use-stable-callback.js +43 -0
- package/build/esm/utils/use-stable-callback.js.map +1 -0
- package/build/esm/utils/wrap-event.d.ts +3 -0
- package/build/esm/utils/{wrapEvent.js → wrap-event.js} +1 -1
- package/build/esm/utils/wrap-event.js.map +1 -0
- package/build/tsconfig-build.tsbuildinfo +1 -0
- package/package.json +4 -5
- package/src/Accordion/Accordion.tsx +12 -6
- package/src/Accordion/AccordionBody.tsx +4 -5
- package/src/Accordion/AccordionHeader.tsx +30 -27
- package/src/Accordion/AccordionItem.tsx +12 -6
- package/src/Accordion/context.ts +3 -2
- package/src/CheckBox/CheckBox.tsx +5 -6
- package/src/ComboBox/ComboBox.story.tsx +3 -3
- package/src/ComboBox/Combobox.tsx +5 -8
- package/src/ComboBox/ComboboxButton.tsx +15 -9
- package/src/ComboBox/ComboboxInput.tsx +18 -10
- package/src/ComboBox/ComboboxLabel.tsx +4 -4
- package/src/ComboBox/ComboboxList.tsx +5 -6
- package/src/ComboBox/ComboboxOption.tsx +12 -8
- package/src/ComboBox/ComboboxPopover.tsx +15 -10
- package/src/ComboBox/context.ts +10 -9
- package/src/ComboBox/hooks.tsx +4 -3
- package/src/FocusLock/FocusLock.tsx +13 -7
- package/src/FocusLock/useFocusLock.ts +4 -3
- package/src/List/List.tsx +5 -5
- package/src/List/ListItem.tsx +5 -5
- package/src/Menu/Menu.story.tsx +2 -2
- package/src/Menu/Menu.tsx +13 -7
- package/src/Menu/MenuButton.tsx +13 -10
- package/src/Menu/MenuItem.tsx +15 -11
- package/src/Menu/MenuList.tsx +6 -6
- package/src/Menu/MenuPopover.tsx +4 -4
- package/src/Menu/context.ts +9 -4
- package/src/Modal/Modal.tsx +11 -7
- package/src/Modal/ModalBackdrop.tsx +16 -11
- package/src/Popper/Popper.tsx +7 -7
- package/src/Popper/PopperArrow.tsx +6 -8
- package/src/RadioButton/RadioButton.tsx +11 -6
- package/src/RadioButton/RadioGroup.tsx +11 -9
- package/src/RadioButton/context.ts +2 -4
- package/src/SkipNav/SkipNav.tsx +5 -5
- package/src/Slider/Slider.story.tsx +45 -0
- package/src/Slider/Slider.tsx +1106 -0
- package/src/Slider/index.ts +1 -0
- package/src/Slider/styles.css +131 -0
- package/src/Spinner/Spinner.tsx +13 -9
- package/src/Spinner/SpinnerButton.tsx +11 -6
- package/src/Spinner/context.ts +2 -3
- package/src/Tabs/Tab.tsx +13 -8
- package/src/Tabs/TabList.tsx +5 -5
- package/src/Tabs/TabPanel.tsx +5 -5
- package/src/Tabs/TabPanels.tsx +4 -4
- package/src/Tabs/Tabs.tsx +5 -7
- package/src/Tabs/context.ts +2 -3
- package/src/Tooltip/Tooltip.story.tsx +3 -3
- package/src/Tooltip/Tooltip.tsx +13 -7
- package/src/Tooltip/stateMachine.ts +9 -13
- package/src/Tooltip/useTooltip.ts +19 -12
- package/src/hooks/useAutoFocus.ts +2 -1
- package/src/hooks/useControlledState.ts +14 -14
- package/src/hooks/useFocusState.ts +4 -3
- package/src/hooks/useGestureHandlers.ts +33 -19
- package/src/hooks/useMeasure.ts +2 -2
- package/src/hooks/useOnClickOutside.ts +2 -2
- package/src/hooks/useOnKeyDown.ts +4 -3
- package/src/hooks/useRemoveBodyScroll.ts +18 -8
- package/src/index.ts +1 -0
- package/src/utils/{assignRef.ts → assign-ref.ts} +4 -4
- package/src/utils/can-use-dom.ts +7 -0
- package/src/utils/context.tsx +48 -0
- package/src/utils/{createSubscription.ts → create-subscription.ts} +0 -0
- package/src/utils/{getCircularIndex.ts → get-circular-index.ts} +0 -0
- package/src/utils/index.ts +10 -4
- package/src/utils/is-right-click.ts +14 -0
- package/src/utils/owner-document.ts +13 -0
- package/src/utils/polymorphic.ts +72 -0
- package/src/utils/{rubberBandClamp.ts → rubber-band-clamp.ts} +0 -0
- package/src/utils/use-stable-callback.ts +58 -0
- package/src/utils/wrap-event.ts +22 -0
- package/build/esm/utils/assignRef.d.ts +0 -3
- package/build/esm/utils/assignRef.js.map +0 -1
- package/build/esm/utils/createSubscription.js.map +0 -1
- package/build/esm/utils/getCircularIndex.js.map +0 -1
- package/build/esm/utils/rubberBandClamp.js.map +0 -1
- package/build/esm/utils/wrapEvent.d.ts +0 -3
- package/build/esm/utils/wrapEvent.js.map +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
- package/src/utils/wrapEvent.ts +0 -20
package/build/cjs/index.js
CHANGED
|
@@ -2,19 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
6
|
-
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
7
5
|
var react = require('react');
|
|
8
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
7
|
var core = require('@popperjs/core');
|
|
10
8
|
var reactDom = require('react-dom');
|
|
11
|
-
var ResizeObserver = require('resize-observer-polyfill');
|
|
12
|
-
|
|
13
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
16
|
-
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
17
|
-
var ResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(ResizeObserver);
|
|
18
9
|
|
|
19
10
|
const accordionContext = /*#__PURE__*/react.createContext(null);
|
|
20
11
|
const {
|
|
@@ -84,16 +75,43 @@ function assignMultipleRefs(...refs) {
|
|
|
84
75
|
};
|
|
85
76
|
}
|
|
86
77
|
|
|
87
|
-
function
|
|
88
|
-
return (
|
|
89
|
-
|
|
78
|
+
function canUseDOM() {
|
|
79
|
+
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
80
|
+
}
|
|
90
81
|
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
function createContext(rootName, defaultContext) {
|
|
83
|
+
const Ctx = /*#__PURE__*/react.createContext(defaultContext);
|
|
84
|
+
|
|
85
|
+
function Provider(props) {
|
|
86
|
+
const {
|
|
87
|
+
children,
|
|
88
|
+
...context
|
|
89
|
+
} = props;
|
|
90
|
+
const value = react.useMemo(() => context, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
91
|
+
Object.values(context));
|
|
92
|
+
return /*#__PURE__*/jsxRuntime.jsx(Ctx.Provider, {
|
|
93
|
+
value: value,
|
|
94
|
+
children: children
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function useContext(childName) {
|
|
99
|
+
const context = react.useContext(Ctx);
|
|
100
|
+
|
|
101
|
+
if (context) {
|
|
102
|
+
return context;
|
|
93
103
|
}
|
|
94
104
|
|
|
95
|
-
|
|
96
|
-
|
|
105
|
+
if (defaultContext) {
|
|
106
|
+
return defaultContext;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
throw Error(`${childName} must be rendered inside of a ${rootName} component.`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
Ctx.displayName = `${rootName}Context`;
|
|
113
|
+
Provider.displayName = `${rootName}Provider`;
|
|
114
|
+
return [Provider, useContext];
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
function getCircularIndex(index, maxLength) {
|
|
@@ -104,6 +122,26 @@ function getCircularIndex(index, maxLength) {
|
|
|
104
122
|
return (index % maxLength + maxLength) % maxLength;
|
|
105
123
|
}
|
|
106
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Detects right clicks
|
|
127
|
+
*
|
|
128
|
+
* @param nativeEvent
|
|
129
|
+
*/
|
|
130
|
+
function isRightClick(nativeEvent) {
|
|
131
|
+
return 'which' in nativeEvent ? nativeEvent.which === 3 : 'button' in nativeEvent ? nativeEvent.button === 2 : false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get an element's owner document. Useful when components are used in iframes
|
|
136
|
+
* or other environments like dev tools.
|
|
137
|
+
*
|
|
138
|
+
* @param element
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
function getOwnerDocument(element) {
|
|
142
|
+
return canUseDOM() ? element ? element.ownerDocument : document : null;
|
|
143
|
+
}
|
|
144
|
+
|
|
107
145
|
// https://twitter.com/chpwn/status/285540192096497664
|
|
108
146
|
// iOS constant = 0.55
|
|
109
147
|
function rubberBand(distance, dimension, constant = 0.15) {
|
|
@@ -121,21 +159,76 @@ function rubberBandClamp(min, max, delta, constant = 0.15) {
|
|
|
121
159
|
return delta;
|
|
122
160
|
}
|
|
123
161
|
|
|
162
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
163
|
+
const useEnhancedEffect$2 = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
|
164
|
+
/**
|
|
165
|
+
* Converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
166
|
+
* prop and exposed as a stable function to avoid executing effects when
|
|
167
|
+
* passed as a dependency.
|
|
168
|
+
*/
|
|
169
|
+
|
|
170
|
+
function createStableCallbackHook(useEffectHook, callback) {
|
|
171
|
+
const callbackRef = react.useRef(callback);
|
|
172
|
+
useEffectHook(() => {
|
|
173
|
+
callbackRef.current = callback;
|
|
174
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
175
|
+
|
|
176
|
+
return react.useCallback((...args) => {
|
|
177
|
+
callbackRef.current && callbackRef.current(...args);
|
|
178
|
+
}, []);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
182
|
+
* prop and exposed as a stable function to avoid executing effects when passed
|
|
183
|
+
* as a dependency.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
function useStableCallback(callback) {
|
|
188
|
+
return createStableCallbackHook(react.useEffect, callback);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
192
|
+
* prop and exposed as a stable function to avoid executing effects when passed
|
|
193
|
+
* as a dependency.
|
|
194
|
+
*
|
|
195
|
+
* Use this over `useStableCallback` when you want the callback to be cached in
|
|
196
|
+
* `useLayoutEffect` instead of `useEffect` to deal with timing issues only when
|
|
197
|
+
* needed.
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
function useStableLayoutCallback(callback) {
|
|
201
|
+
return createStableCallbackHook(useEnhancedEffect$2, callback);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function wrapEvent(theirHandler, ourHandler) {
|
|
205
|
+
return (event, ...otherArgs) => {
|
|
206
|
+
const ret = theirHandler && theirHandler(event, ...otherArgs);
|
|
207
|
+
|
|
208
|
+
if (!event.defaultPrevented) {
|
|
209
|
+
return ourHandler(event, ...otherArgs);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return ret;
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
124
216
|
function useControlledState(valueProp, onChangeProp, defaultValue, defaultOnChange) {
|
|
125
|
-
const isControlled =
|
|
217
|
+
const isControlled = valueProp !== undefined;
|
|
218
|
+
const wasControlled = react.useRef(isControlled);
|
|
126
219
|
const [valueState, setValueState] = react.useState(defaultValue);
|
|
127
220
|
|
|
128
|
-
if (isControlled
|
|
129
|
-
if (
|
|
221
|
+
if (isControlled) {
|
|
222
|
+
if (wasControlled.current && process.env.NODE_ENV !== 'production') {
|
|
130
223
|
console.warn('Trying to change from controlled to uncontrolled.');
|
|
131
|
-
}
|
|
132
|
-
|
|
224
|
+
}
|
|
133
225
|
|
|
134
|
-
return [
|
|
226
|
+
return [// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
227
|
+
valueProp, wrapEvent(onChangeProp, defaultOnChange(setValueState))];
|
|
135
228
|
}
|
|
136
229
|
|
|
137
230
|
return [// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
138
|
-
valueState, wrapEvent(onChangeProp, defaultOnChange(setValueState))
|
|
231
|
+
valueState, wrapEvent(onChangeProp, defaultOnChange(setValueState))];
|
|
139
232
|
}
|
|
140
233
|
|
|
141
234
|
function useChildrenCounterParent(itemsRef) {
|
|
@@ -187,11 +280,9 @@ function useFocusReturn(open, rootEl) {
|
|
|
187
280
|
})());
|
|
188
281
|
react.useEffect(() => {
|
|
189
282
|
if (open) {
|
|
190
|
-
var _rootEl$current;
|
|
191
|
-
|
|
192
283
|
// once opened, keep track of the element that triggered
|
|
193
284
|
// the Modal opening
|
|
194
|
-
if (!previousFocusRef.current && document.activeElement instanceof HTMLElement && !
|
|
285
|
+
if (!previousFocusRef.current && document.activeElement instanceof HTMLElement && !rootEl.current?.contains(document.activeElement)) {
|
|
195
286
|
previousFocusRef.current = document.activeElement;
|
|
196
287
|
}
|
|
197
288
|
|
|
@@ -199,7 +290,7 @@ function useFocusReturn(open, rootEl) {
|
|
|
199
290
|
const previousElement = previousFocusRef.current;
|
|
200
291
|
return () => {
|
|
201
292
|
// on unmount, return focus to that element
|
|
202
|
-
if (previousElement && !
|
|
293
|
+
if (previousElement && !rootElement?.contains(document.activeElement)) {
|
|
203
294
|
previousElement.focus({
|
|
204
295
|
preventScroll: true
|
|
205
296
|
});
|
|
@@ -254,28 +345,27 @@ function useOnClickOutside(ref, handler, active = true) {
|
|
|
254
345
|
}, [listener, active]);
|
|
255
346
|
}
|
|
256
347
|
|
|
257
|
-
function useOnKeyDown(handler, active = true) {
|
|
348
|
+
function useOnKeyDown(ownerWindow, handler, active = true) {
|
|
258
349
|
react.useEffect(() => {
|
|
259
350
|
if (active) {
|
|
260
|
-
|
|
351
|
+
ownerWindow.addEventListener('keydown', handler);
|
|
261
352
|
return () => {
|
|
262
|
-
|
|
353
|
+
ownerWindow.removeEventListener('keydown', handler);
|
|
263
354
|
};
|
|
264
355
|
}
|
|
265
356
|
|
|
266
357
|
return;
|
|
267
|
-
}, [active, handler]);
|
|
358
|
+
}, [ownerWindow, active, handler]);
|
|
268
359
|
}
|
|
269
360
|
|
|
270
361
|
// This manages transitions between states with a built in reducer to manage
|
|
271
362
|
// the data that goes with those transitions.
|
|
272
363
|
function useReducerMachine(chart, reducer, initialData) {
|
|
273
364
|
const [reducerState, dispatch] = react.useReducer(reducer, initialData);
|
|
274
|
-
|
|
275
365
|
const {
|
|
276
|
-
state
|
|
277
|
-
|
|
278
|
-
|
|
366
|
+
state,
|
|
367
|
+
...data
|
|
368
|
+
} = reducerState;
|
|
279
369
|
|
|
280
370
|
const transition = (action, payload = {}) => {
|
|
281
371
|
const currentState = chart.states[state];
|
|
@@ -290,43 +380,47 @@ function useReducerMachine(chart, reducer, initialData) {
|
|
|
290
380
|
throw new Error(`Unknown action "${action}" for state "${state}"`);
|
|
291
381
|
}
|
|
292
382
|
|
|
293
|
-
dispatch(
|
|
383
|
+
dispatch({
|
|
294
384
|
type: action,
|
|
295
|
-
nextState
|
|
296
|
-
|
|
385
|
+
nextState,
|
|
386
|
+
...payload
|
|
387
|
+
});
|
|
297
388
|
};
|
|
298
389
|
|
|
299
390
|
return [state, data, transition];
|
|
300
391
|
}
|
|
301
392
|
|
|
302
393
|
let scrollBodyCount = 0;
|
|
303
|
-
function useRemoveBodyScroll(open) {
|
|
394
|
+
function useRemoveBodyScroll(open, elementRef) {
|
|
304
395
|
react.useEffect(() => {
|
|
305
|
-
if (open) {
|
|
396
|
+
if (open && elementRef.current) {
|
|
397
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
398
|
+
const ownerDocument = getOwnerDocument(elementRef.current);
|
|
399
|
+
const ownerWindow = ownerDocument.defaultView || window;
|
|
306
400
|
scrollBodyCount += 1; // calculate scrollbar width if mounting the first scroll lock
|
|
307
401
|
|
|
308
402
|
let scrollBarWidth = 0;
|
|
309
403
|
|
|
310
404
|
if (scrollBodyCount === 1) {
|
|
311
|
-
scrollBarWidth =
|
|
405
|
+
scrollBarWidth = ownerWindow.innerWidth - ownerDocument.body.clientWidth;
|
|
312
406
|
}
|
|
313
407
|
|
|
314
|
-
|
|
408
|
+
ownerDocument.body.style.overflow = 'hidden';
|
|
315
409
|
|
|
316
410
|
if (scrollBarWidth > 0) {
|
|
317
|
-
|
|
411
|
+
ownerDocument.body.style.marginRight = `${scrollBarWidth}px`;
|
|
318
412
|
}
|
|
319
413
|
|
|
320
414
|
return () => {
|
|
321
415
|
scrollBodyCount -= 1;
|
|
322
416
|
|
|
323
417
|
if (scrollBodyCount === 0) {
|
|
324
|
-
|
|
325
|
-
|
|
418
|
+
ownerDocument.body.style.overflow = '';
|
|
419
|
+
ownerDocument.body.style.marginRight = '';
|
|
326
420
|
}
|
|
327
421
|
};
|
|
328
422
|
}
|
|
329
|
-
}, [open]);
|
|
423
|
+
}, [elementRef, open]);
|
|
330
424
|
}
|
|
331
425
|
|
|
332
426
|
function useThrottle(value, limit) {
|
|
@@ -354,7 +448,7 @@ function useMeasure(ref) {
|
|
|
354
448
|
});
|
|
355
449
|
react.useEffect(() => {
|
|
356
450
|
if (ro.current === null) {
|
|
357
|
-
ro.current = new
|
|
451
|
+
ro.current = new ResizeObserver(entries => {
|
|
358
452
|
const entry = entries[0];
|
|
359
453
|
setBounds(entry.contentRect);
|
|
360
454
|
});
|
|
@@ -407,14 +501,12 @@ function gestureHandlers(set, containerRef, options = {}) {
|
|
|
407
501
|
const yDelta = state.y - state.yInitial;
|
|
408
502
|
const xVelocity = calcVelocity(xDelta, deltaTime, state.xVelocity);
|
|
409
503
|
const yVelocity = calcVelocity(yDelta, deltaTime, state.yVelocity);
|
|
410
|
-
|
|
411
|
-
const newState = _extends__default['default']({}, state, {
|
|
504
|
+
const newState = { ...state,
|
|
412
505
|
xVelocity,
|
|
413
506
|
yVelocity,
|
|
414
507
|
target: null,
|
|
415
508
|
down: false
|
|
416
|
-
}
|
|
417
|
-
|
|
509
|
+
};
|
|
418
510
|
return newState;
|
|
419
511
|
});
|
|
420
512
|
};
|
|
@@ -426,7 +518,7 @@ function gestureHandlers(set, containerRef, options = {}) {
|
|
|
426
518
|
pageY
|
|
427
519
|
} = e;
|
|
428
520
|
set(state => {
|
|
429
|
-
const newState =
|
|
521
|
+
const newState = { ...state,
|
|
430
522
|
target,
|
|
431
523
|
x: pageX,
|
|
432
524
|
xDelta: 0,
|
|
@@ -443,8 +535,7 @@ function gestureHandlers(set, containerRef, options = {}) {
|
|
|
443
535
|
startTime: Date.now(),
|
|
444
536
|
down: true,
|
|
445
537
|
scrollLocked: false
|
|
446
|
-
}
|
|
447
|
-
|
|
538
|
+
};
|
|
448
539
|
return newState;
|
|
449
540
|
});
|
|
450
541
|
};
|
|
@@ -490,8 +581,7 @@ function gestureHandlers(set, containerRef, options = {}) {
|
|
|
490
581
|
const yDelta = state.yDelta + getDeltaSum(pageY, state.yInitial, state.y);
|
|
491
582
|
const yDeltaPercent = yDelta * 100 / height;
|
|
492
583
|
const yVelocity = calcVelocity(yDelta, deltaTime, state.yVelocity);
|
|
493
|
-
|
|
494
|
-
const newState = _extends__default['default']({}, state, {
|
|
584
|
+
const newState = { ...state,
|
|
495
585
|
xDelta,
|
|
496
586
|
xDeltaPercent,
|
|
497
587
|
x: pageX,
|
|
@@ -502,8 +592,7 @@ function gestureHandlers(set, containerRef, options = {}) {
|
|
|
502
592
|
y: pageY,
|
|
503
593
|
yPrev: state.y,
|
|
504
594
|
yVelocity
|
|
505
|
-
}
|
|
506
|
-
|
|
595
|
+
};
|
|
507
596
|
return newState;
|
|
508
597
|
});
|
|
509
598
|
} // Touch handlers
|
|
@@ -532,20 +621,23 @@ function gestureHandlers(set, containerRef, options = {}) {
|
|
|
532
621
|
|
|
533
622
|
if (ensureTargetIsContainer && containerRef && e.target !== containerRef.current) {
|
|
534
623
|
return;
|
|
535
|
-
}
|
|
624
|
+
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
536
625
|
|
|
537
|
-
|
|
626
|
+
|
|
627
|
+
const ownerDocument = getOwnerDocument(e.currentTarget);
|
|
628
|
+
const ownerWindow = ownerDocument.defaultView || window;
|
|
629
|
+
ownerWindow.addEventListener('touchmove', handleTouchMove, {
|
|
538
630
|
passive: false
|
|
539
631
|
});
|
|
540
|
-
|
|
541
|
-
|
|
632
|
+
ownerWindow.addEventListener('touchend', handleTouchEnd);
|
|
633
|
+
ownerWindow.addEventListener('touchcancel', handleTouchEnd);
|
|
542
634
|
handleDown(e.touches.item(0));
|
|
543
635
|
}
|
|
544
636
|
|
|
545
637
|
function handleTouchEnd() {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
638
|
+
this.removeEventListener('touchmove', handleTouchMove);
|
|
639
|
+
this.removeEventListener('touchend', handleTouchEnd);
|
|
640
|
+
this.removeEventListener('touchcancel', handleTouchEnd);
|
|
549
641
|
handleUp();
|
|
550
642
|
} // Mouse handlers
|
|
551
643
|
|
|
@@ -553,18 +645,22 @@ function gestureHandlers(set, containerRef, options = {}) {
|
|
|
553
645
|
function handleMouseDown(e) {
|
|
554
646
|
if (ensureTargetIsContainer && containerRef && e.target !== containerRef.current) {
|
|
555
647
|
return;
|
|
556
|
-
}
|
|
648
|
+
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
const ownerDocument = getOwnerDocument(e.currentTarget);
|
|
652
|
+
const ownerWindow = ownerDocument.defaultView || window;
|
|
557
653
|
|
|
558
654
|
if (e.button === 0) {
|
|
559
|
-
|
|
560
|
-
|
|
655
|
+
ownerWindow.addEventListener('mousemove', handleMove);
|
|
656
|
+
ownerWindow.addEventListener('mouseup', handleMouseUp);
|
|
561
657
|
handleDown(e);
|
|
562
658
|
}
|
|
563
659
|
}
|
|
564
660
|
|
|
565
661
|
function handleMouseUp() {
|
|
566
|
-
|
|
567
|
-
|
|
662
|
+
this.removeEventListener('mousemove', handleMove);
|
|
663
|
+
this.removeEventListener('mouseup', handleMouseUp);
|
|
568
664
|
handleUp();
|
|
569
665
|
}
|
|
570
666
|
/* eslint-enable @typescript-eslint/no-use-before-define */
|
|
@@ -576,7 +672,8 @@ function gestureHandlers(set, containerRef, options = {}) {
|
|
|
576
672
|
};
|
|
577
673
|
}
|
|
578
674
|
const useGestureHandlers = (containerRef, onGesture, options = {}) => {
|
|
579
|
-
const state = react.useRef(
|
|
675
|
+
const state = react.useRef({ ...initialGestureHandlersState
|
|
676
|
+
});
|
|
580
677
|
|
|
581
678
|
const set = cb => {
|
|
582
679
|
state.current = cb(state.current);
|
|
@@ -630,10 +727,9 @@ const Accordion = /*#__PURE__*/react.forwardRef(function Accordion(props, forwar
|
|
|
630
727
|
const {
|
|
631
728
|
as: Comp = 'div',
|
|
632
729
|
expandedIndex = -1,
|
|
633
|
-
onChange
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
730
|
+
onChange,
|
|
731
|
+
...otherProps
|
|
732
|
+
} = props;
|
|
637
733
|
const [childrenHeaderHasFocus, setChildrenHeaderHasFocus] = react.useState(false);
|
|
638
734
|
const ref = react.useRef();
|
|
639
735
|
const scope = useScope(ref);
|
|
@@ -646,12 +742,12 @@ const Accordion = /*#__PURE__*/react.forwardRef(function Accordion(props, forwar
|
|
|
646
742
|
};
|
|
647
743
|
return /*#__PURE__*/jsxRuntime.jsx(AccordionProvider, {
|
|
648
744
|
value: contextValue,
|
|
649
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
650
|
-
ref: assignMultipleRefs(forwardedRef, ref)
|
|
651
|
-
|
|
745
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
746
|
+
ref: assignMultipleRefs(forwardedRef, ref),
|
|
747
|
+
...otherProps,
|
|
652
748
|
"data-accordion-root": "",
|
|
653
749
|
"data-children-has-focus": childrenHeaderHasFocus
|
|
654
|
-
})
|
|
750
|
+
})
|
|
655
751
|
});
|
|
656
752
|
});
|
|
657
753
|
|
|
@@ -659,10 +755,9 @@ const AccordionItem = /*#__PURE__*/react.forwardRef(function AccordionItem(props
|
|
|
659
755
|
const {
|
|
660
756
|
as: Comp = react.Fragment,
|
|
661
757
|
expanded = false,
|
|
662
|
-
onChange
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
758
|
+
onChange,
|
|
759
|
+
...otherProps
|
|
760
|
+
} = props;
|
|
666
761
|
const id = react.useId();
|
|
667
762
|
const headerId = id ? `accordion-header-${id}` : undefined;
|
|
668
763
|
const bodyId = id ? `accordion-body-${id}` : undefined;
|
|
@@ -674,9 +769,10 @@ const AccordionItem = /*#__PURE__*/react.forwardRef(function AccordionItem(props
|
|
|
674
769
|
};
|
|
675
770
|
return /*#__PURE__*/jsxRuntime.jsx(AccordionItemProvider, {
|
|
676
771
|
value: contextValue,
|
|
677
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
678
|
-
ref: forwardedRef
|
|
679
|
-
|
|
772
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
773
|
+
ref: forwardedRef,
|
|
774
|
+
...otherProps
|
|
775
|
+
})
|
|
680
776
|
});
|
|
681
777
|
});
|
|
682
778
|
|
|
@@ -693,10 +789,9 @@ const AccordionHeader = /*#__PURE__*/react.forwardRef(function AccordionHeader(p
|
|
|
693
789
|
onKeyDown,
|
|
694
790
|
onClick: onClickProp,
|
|
695
791
|
onFocus,
|
|
696
|
-
onBlur
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
792
|
+
onBlur,
|
|
793
|
+
...otherProps
|
|
794
|
+
} = props;
|
|
700
795
|
const accordionContext = useAccordionContext();
|
|
701
796
|
const accordionItemContext = useAccordionItemContext();
|
|
702
797
|
const ref = react.useRef();
|
|
@@ -813,9 +908,9 @@ const AccordionHeader = /*#__PURE__*/react.forwardRef(function AccordionHeader(p
|
|
|
813
908
|
};
|
|
814
909
|
|
|
815
910
|
const expanded = Boolean(accordionItemContext.expanded || accordionContext && accordionContext.expandedIndex === index);
|
|
816
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
817
|
-
ref: assignMultipleRefs(ref, forwardedRef)
|
|
818
|
-
|
|
911
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
912
|
+
ref: assignMultipleRefs(ref, forwardedRef),
|
|
913
|
+
...otherProps,
|
|
819
914
|
id: accordionItemContext.headerId,
|
|
820
915
|
"aria-controls": accordionItemContext.bodyId,
|
|
821
916
|
role: "button",
|
|
@@ -826,15 +921,14 @@ const AccordionHeader = /*#__PURE__*/react.forwardRef(function AccordionHeader(p
|
|
|
826
921
|
onBlur: wrapEvent(onBlur, handleBlur),
|
|
827
922
|
onClick: onClick,
|
|
828
923
|
"aria-expanded": String(expanded)
|
|
829
|
-
})
|
|
924
|
+
});
|
|
830
925
|
});
|
|
831
926
|
|
|
832
927
|
const AccordionBody = /*#__PURE__*/react.forwardRef(function AccordionBody(props, forwardedRef) {
|
|
833
928
|
const {
|
|
834
|
-
as: Comp = 'div'
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
929
|
+
as: Comp = 'div',
|
|
930
|
+
...otherProps
|
|
931
|
+
} = props;
|
|
838
932
|
const accordionItemContext = useAccordionItemContext();
|
|
839
933
|
const accordionContext = useAccordionContext();
|
|
840
934
|
const ref = react.useRef();
|
|
@@ -852,15 +946,15 @@ const AccordionBody = /*#__PURE__*/react.forwardRef(function AccordionBody(props
|
|
|
852
946
|
}
|
|
853
947
|
}, [accordionContext]);
|
|
854
948
|
const expanded = Boolean(accordionItemContext.expanded || accordionContext && accordionContext.expandedIndex === index);
|
|
855
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
856
|
-
ref: assignMultipleRefs(forwardedRef, ref)
|
|
857
|
-
|
|
949
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
950
|
+
ref: assignMultipleRefs(forwardedRef, ref),
|
|
951
|
+
...otherProps,
|
|
858
952
|
"aria-labelledby": accordionItemContext.headerId,
|
|
859
953
|
id: accordionItemContext.bodyId,
|
|
860
954
|
role: "region",
|
|
861
955
|
"data-accordion-body": "",
|
|
862
956
|
hidden: expanded ? undefined : 'hidden'
|
|
863
|
-
})
|
|
957
|
+
});
|
|
864
958
|
});
|
|
865
959
|
|
|
866
960
|
const CheckBox = /*#__PURE__*/react.forwardRef(function CheckBox(props, forwardedRef) {
|
|
@@ -868,20 +962,20 @@ const CheckBox = /*#__PURE__*/react.forwardRef(function CheckBox(props, forwarde
|
|
|
868
962
|
as: Comp = 'input',
|
|
869
963
|
checked: checkedProp,
|
|
870
964
|
defaultChecked = false,
|
|
871
|
-
onChange: onChangeProp
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
965
|
+
onChange: onChangeProp,
|
|
966
|
+
...otherProps
|
|
967
|
+
} = props;
|
|
875
968
|
const [checked, onChange] = useControlledState(checkedProp, onChangeProp, defaultChecked, setValue => e => {
|
|
876
969
|
setValue(e.target.checked);
|
|
877
970
|
});
|
|
878
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
971
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
879
972
|
ref: forwardedRef,
|
|
880
973
|
type: "checkbox",
|
|
881
974
|
checked: checked,
|
|
882
975
|
"aria-checked": checked,
|
|
883
|
-
onChange: onChange
|
|
884
|
-
|
|
976
|
+
onChange: onChange,
|
|
977
|
+
...otherProps
|
|
978
|
+
});
|
|
885
979
|
});
|
|
886
980
|
|
|
887
981
|
const comboboxContext = /*#__PURE__*/react.createContext(null);
|
|
@@ -894,6 +988,7 @@ function scopeQuery$1(nodeType, props) {
|
|
|
894
988
|
return props['data-reach-combobox-option'] === '';
|
|
895
989
|
}
|
|
896
990
|
|
|
991
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
897
992
|
// States
|
|
898
993
|
// Nothing going on, waiting for the user to type or use the arrow keys
|
|
899
994
|
|
|
@@ -972,70 +1067,70 @@ const stateChart = {
|
|
|
972
1067
|
}
|
|
973
1068
|
};
|
|
974
1069
|
function comboboxReducer(data, action) {
|
|
975
|
-
const nextState =
|
|
1070
|
+
const nextState = { ...data,
|
|
976
1071
|
state: action.nextState,
|
|
977
1072
|
lastActionType: action.type
|
|
978
|
-
}
|
|
1073
|
+
};
|
|
979
1074
|
|
|
980
1075
|
switch (action.type) {
|
|
981
1076
|
case INIT:
|
|
982
1077
|
case CHANGE:
|
|
983
|
-
return
|
|
1078
|
+
return { ...nextState,
|
|
984
1079
|
text: action.text,
|
|
985
1080
|
navigationItem: '',
|
|
986
1081
|
item: ''
|
|
987
|
-
}
|
|
1082
|
+
};
|
|
988
1083
|
|
|
989
1084
|
case NAVIGATE:
|
|
990
1085
|
case OPEN_WITH_BUTTON:
|
|
991
1086
|
if (action.persistSelection) {
|
|
992
|
-
return
|
|
1087
|
+
return { ...nextState,
|
|
993
1088
|
navigationItem: data.item
|
|
994
|
-
}
|
|
1089
|
+
};
|
|
995
1090
|
}
|
|
996
1091
|
|
|
997
|
-
return
|
|
1092
|
+
return { ...nextState,
|
|
998
1093
|
navigationItem: action.item
|
|
999
|
-
}
|
|
1094
|
+
};
|
|
1000
1095
|
|
|
1001
1096
|
case CLEAR_SELECTION:
|
|
1002
|
-
return
|
|
1097
|
+
return { ...nextState,
|
|
1003
1098
|
navigationItem: ''
|
|
1004
|
-
}
|
|
1099
|
+
};
|
|
1005
1100
|
|
|
1006
1101
|
case CLEAR:
|
|
1007
|
-
return
|
|
1102
|
+
return { ...nextState,
|
|
1008
1103
|
text: '',
|
|
1009
1104
|
navigationItem: '',
|
|
1010
1105
|
item: ''
|
|
1011
|
-
}
|
|
1106
|
+
};
|
|
1012
1107
|
|
|
1013
1108
|
case BLUR:
|
|
1014
|
-
return
|
|
1109
|
+
return { ...nextState,
|
|
1015
1110
|
text: action.text,
|
|
1016
1111
|
navigationItem: '',
|
|
1017
1112
|
item: action.item
|
|
1018
|
-
}
|
|
1113
|
+
};
|
|
1019
1114
|
|
|
1020
1115
|
case CLOSE_WITH_BUTTON:
|
|
1021
1116
|
case ESCAPE:
|
|
1022
|
-
return
|
|
1117
|
+
return { ...nextState,
|
|
1023
1118
|
navigationItem: '',
|
|
1024
1119
|
item: ''
|
|
1025
|
-
}
|
|
1120
|
+
};
|
|
1026
1121
|
|
|
1027
1122
|
case SELECT_WITH_CLICK:
|
|
1028
1123
|
case SELECT_WITH_KEYBOARD:
|
|
1029
|
-
return
|
|
1124
|
+
return { ...nextState,
|
|
1030
1125
|
text: action.text,
|
|
1031
1126
|
item: action.item,
|
|
1032
1127
|
navigationItem: ''
|
|
1033
|
-
}
|
|
1128
|
+
};
|
|
1034
1129
|
|
|
1035
1130
|
case FOCUS:
|
|
1036
|
-
return
|
|
1131
|
+
return { ...nextState,
|
|
1037
1132
|
navigationItem: action.item
|
|
1038
|
-
}
|
|
1133
|
+
};
|
|
1039
1134
|
|
|
1040
1135
|
default:
|
|
1041
1136
|
throw new Error(`Unknown action ${action.type}`);
|
|
@@ -1234,21 +1329,19 @@ function useBlur() {
|
|
|
1234
1329
|
};
|
|
1235
1330
|
}
|
|
1236
1331
|
|
|
1237
|
-
const Combobox = /*#__PURE__*/react.forwardRef(function Combobox(
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref, ["onSelect", "openOnFocus", "selectOnBlur", "children", "as", "innerAs"]);
|
|
1251
|
-
|
|
1332
|
+
const Combobox = /*#__PURE__*/react.forwardRef(function Combobox({
|
|
1333
|
+
// Called whenever the user selects an item from the list
|
|
1334
|
+
onSelect,
|
|
1335
|
+
// opens the list when the input receives focused (but only if there are
|
|
1336
|
+
// items in the list)
|
|
1337
|
+
openOnFocus = false,
|
|
1338
|
+
// if set to true, it will select an item after blurring
|
|
1339
|
+
selectOnBlur = false,
|
|
1340
|
+
children,
|
|
1341
|
+
as: Comp = 'div',
|
|
1342
|
+
innerAs,
|
|
1343
|
+
...rest
|
|
1344
|
+
}, ref) {
|
|
1252
1345
|
// We store the values of all the ComboboxOptions on this ref. This makes it
|
|
1253
1346
|
// possible to perform the keyboard navigation from the input on the list. We
|
|
1254
1347
|
// manipulate this array through context so that we don't have to enforce a
|
|
@@ -1310,7 +1403,7 @@ const Combobox = /*#__PURE__*/react.forwardRef(function Combobox(_ref, ref) {
|
|
|
1310
1403
|
}), [data, onSelect, listScope, state, transition, openOnFocus, selectOnBlur]);
|
|
1311
1404
|
return /*#__PURE__*/jsxRuntime.jsx(ComboBoxProvider, {
|
|
1312
1405
|
value: context,
|
|
1313
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1406
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, { ...rest,
|
|
1314
1407
|
as: innerAs,
|
|
1315
1408
|
"data-reach-combobox": "",
|
|
1316
1409
|
ref: ref,
|
|
@@ -1319,19 +1412,17 @@ const Combobox = /*#__PURE__*/react.forwardRef(function Combobox(_ref, ref) {
|
|
|
1319
1412
|
"aria-owns": listboxIdRef.current,
|
|
1320
1413
|
"aria-expanded": context.isVisible,
|
|
1321
1414
|
children: children
|
|
1322
|
-
})
|
|
1415
|
+
})
|
|
1323
1416
|
});
|
|
1324
1417
|
});
|
|
1325
1418
|
|
|
1326
|
-
const ComboboxButton = /*#__PURE__*/react.forwardRef(function ComboboxButton(
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref, ["as", "innerAs", "onClick", "onKeyDown"]);
|
|
1334
|
-
|
|
1419
|
+
const ComboboxButton = /*#__PURE__*/react.forwardRef(function ComboboxButton({
|
|
1420
|
+
as: Comp = 'button',
|
|
1421
|
+
innerAs,
|
|
1422
|
+
onClick,
|
|
1423
|
+
onKeyDown,
|
|
1424
|
+
...props
|
|
1425
|
+
}, ref) {
|
|
1335
1426
|
const {
|
|
1336
1427
|
transition,
|
|
1337
1428
|
data,
|
|
@@ -1354,7 +1445,7 @@ const ComboboxButton = /*#__PURE__*/react.forwardRef(function ComboboxButton(_re
|
|
|
1354
1445
|
}
|
|
1355
1446
|
};
|
|
1356
1447
|
|
|
1357
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1448
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
1358
1449
|
as: innerAs,
|
|
1359
1450
|
"data-reach-combobox-button": "",
|
|
1360
1451
|
"aria-controls": listboxIdRef.current,
|
|
@@ -1362,30 +1453,29 @@ const ComboboxButton = /*#__PURE__*/react.forwardRef(function ComboboxButton(_re
|
|
|
1362
1453
|
"aria-expanded": isVisible,
|
|
1363
1454
|
ref: assignMultipleRefs(ref, buttonRef),
|
|
1364
1455
|
onClick: wrapEvent(onClick, handleClick),
|
|
1365
|
-
onKeyDown: wrapEvent(onKeyDown, handleKeyDown)
|
|
1366
|
-
|
|
1456
|
+
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
1457
|
+
...props
|
|
1458
|
+
});
|
|
1367
1459
|
});
|
|
1368
1460
|
|
|
1369
|
-
const ComboboxInput = /*#__PURE__*/react.forwardRef(function ComboboxInput(
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref, ["as", "innerAs", "selectOnClick", "autocomplete", "clearOnEscape", "onClick", "onChange", "onKeyDown", "onBlur", "onFocus", "id", "defaultValue", "value"]);
|
|
1388
|
-
|
|
1461
|
+
const ComboboxInput = /*#__PURE__*/react.forwardRef(function ComboboxInput({
|
|
1462
|
+
as: Comp = 'input',
|
|
1463
|
+
innerAs,
|
|
1464
|
+
selectOnClick = false,
|
|
1465
|
+
autocomplete = true,
|
|
1466
|
+
clearOnEscape = false,
|
|
1467
|
+
// wrapped events
|
|
1468
|
+
onClick,
|
|
1469
|
+
onChange,
|
|
1470
|
+
onKeyDown,
|
|
1471
|
+
onBlur,
|
|
1472
|
+
onFocus,
|
|
1473
|
+
id: preferredId,
|
|
1474
|
+
defaultValue = '',
|
|
1475
|
+
// might be controlled
|
|
1476
|
+
value: controlledValue,
|
|
1477
|
+
...props
|
|
1478
|
+
}, forwardedRef) {
|
|
1389
1479
|
const {
|
|
1390
1480
|
data: {
|
|
1391
1481
|
navigationItem,
|
|
@@ -1469,7 +1559,7 @@ const ComboboxInput = /*#__PURE__*/react.forwardRef(function ComboboxInput(_ref,
|
|
|
1469
1559
|
item: ''
|
|
1470
1560
|
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1471
1561
|
}, []);
|
|
1472
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1562
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, { ...props,
|
|
1473
1563
|
as: innerAs,
|
|
1474
1564
|
"data-reach-combobox-input": "",
|
|
1475
1565
|
ref: assignMultipleRefs(inputRef, forwardedRef),
|
|
@@ -1484,41 +1574,38 @@ const ComboboxInput = /*#__PURE__*/react.forwardRef(function ComboboxInput(_ref,
|
|
|
1484
1574
|
"aria-autocomplete": "both",
|
|
1485
1575
|
"aria-activedescendant": navigationItem !== '' ? navigationItem : undefined,
|
|
1486
1576
|
autoComplete: "off"
|
|
1487
|
-
})
|
|
1577
|
+
});
|
|
1488
1578
|
});
|
|
1489
1579
|
|
|
1490
|
-
const ComboboxLabel = /*#__PURE__*/react.forwardRef(function ComboboxButton(
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref, ["as", "innerAs", "id"]);
|
|
1497
|
-
|
|
1580
|
+
const ComboboxLabel = /*#__PURE__*/react.forwardRef(function ComboboxButton({
|
|
1581
|
+
as: Comp = 'label',
|
|
1582
|
+
innerAs,
|
|
1583
|
+
id: preferredId,
|
|
1584
|
+
...props
|
|
1585
|
+
}, ref) {
|
|
1498
1586
|
const {
|
|
1499
1587
|
listboxIdRef,
|
|
1500
1588
|
labelIdRef
|
|
1501
1589
|
} = useComboBoxContext();
|
|
1502
1590
|
labelIdRef.current = preferredId || labelIdRef.current;
|
|
1503
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1591
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
1504
1592
|
as: innerAs,
|
|
1505
1593
|
"data-reach-combobox-label": "",
|
|
1506
1594
|
htmlFor: listboxIdRef.current,
|
|
1507
1595
|
id: labelIdRef.current,
|
|
1508
|
-
ref: ref
|
|
1509
|
-
|
|
1596
|
+
ref: ref,
|
|
1597
|
+
...props
|
|
1598
|
+
});
|
|
1510
1599
|
});
|
|
1511
1600
|
|
|
1512
|
-
const ComboboxList = /*#__PURE__*/react.forwardRef(function ComboboxList(
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref, ["persistSelection", "as", "innerAs"]);
|
|
1521
|
-
|
|
1601
|
+
const ComboboxList = /*#__PURE__*/react.forwardRef(function ComboboxList({
|
|
1602
|
+
// when true, and the list opens again, the option with a matching value will be
|
|
1603
|
+
// automatically highleted.
|
|
1604
|
+
persistSelection = false,
|
|
1605
|
+
as: Comp = 'ul',
|
|
1606
|
+
innerAs,
|
|
1607
|
+
...props
|
|
1608
|
+
}, ref) {
|
|
1522
1609
|
const {
|
|
1523
1610
|
persistSelectionRef,
|
|
1524
1611
|
labelIdRef,
|
|
@@ -1529,13 +1616,13 @@ const ComboboxList = /*#__PURE__*/react.forwardRef(function ComboboxList(_ref, r
|
|
|
1529
1616
|
listScope.current = getScope(listRef);
|
|
1530
1617
|
}, [listScope]);
|
|
1531
1618
|
persistSelectionRef.current = persistSelection;
|
|
1532
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1619
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, { ...props,
|
|
1533
1620
|
as: innerAs,
|
|
1534
1621
|
ref: assignMultipleRefs(ref, listRef),
|
|
1535
1622
|
"data-reach-combobox-list": "",
|
|
1536
1623
|
role: "listbox",
|
|
1537
1624
|
"aria-labelledby": labelIdRef.current
|
|
1538
|
-
})
|
|
1625
|
+
});
|
|
1539
1626
|
});
|
|
1540
1627
|
|
|
1541
1628
|
// We don't want to track the active descendant with indexes because nothing is
|
|
@@ -1561,18 +1648,17 @@ function makeHash(str) {
|
|
|
1561
1648
|
return hash;
|
|
1562
1649
|
}
|
|
1563
1650
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1651
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
1652
|
+
const ComboboxOption = /*#__PURE__*/react.forwardRef(function ComboboxOption({
|
|
1653
|
+
children,
|
|
1654
|
+
id: idProp,
|
|
1655
|
+
value: valueProp,
|
|
1656
|
+
text: textProp,
|
|
1657
|
+
onClick,
|
|
1658
|
+
as: Comp = 'li',
|
|
1659
|
+
innerAs,
|
|
1660
|
+
...props
|
|
1661
|
+
}, ref) {
|
|
1576
1662
|
const {
|
|
1577
1663
|
onSelect,
|
|
1578
1664
|
data: {
|
|
@@ -1628,7 +1714,7 @@ const ComboboxOption = /*#__PURE__*/react.forwardRef(function ComboboxOption(_re
|
|
|
1628
1714
|
});
|
|
1629
1715
|
};
|
|
1630
1716
|
|
|
1631
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1717
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, { ...props,
|
|
1632
1718
|
as: innerAs,
|
|
1633
1719
|
"data-reach-combobox-option": "",
|
|
1634
1720
|
ref: ref,
|
|
@@ -1642,19 +1728,17 @@ const ComboboxOption = /*#__PURE__*/react.forwardRef(function ComboboxOption(_re
|
|
|
1642
1728
|
tabIndex: "-1",
|
|
1643
1729
|
onClick: wrapEvent(onClick, handleClick),
|
|
1644
1730
|
children: children || text
|
|
1645
|
-
})
|
|
1731
|
+
});
|
|
1646
1732
|
});
|
|
1647
1733
|
|
|
1648
|
-
const ComboboxPopover = /*#__PURE__*/react.forwardRef(function ComboboxPopover(
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref, ["onKeyDown", "onBlur", "as", "innerAs"]);
|
|
1657
|
-
|
|
1734
|
+
const ComboboxPopover = /*#__PURE__*/react.forwardRef(function ComboboxPopover({
|
|
1735
|
+
// wrapped events
|
|
1736
|
+
onKeyDown,
|
|
1737
|
+
onBlur,
|
|
1738
|
+
as: Comp = 'div',
|
|
1739
|
+
innerAs,
|
|
1740
|
+
...props
|
|
1741
|
+
}, forwardedRef) {
|
|
1658
1742
|
const {
|
|
1659
1743
|
popoverRef,
|
|
1660
1744
|
isVisible
|
|
@@ -1669,7 +1753,7 @@ const ComboboxPopover = /*#__PURE__*/react.forwardRef(function ComboboxPopover(_
|
|
|
1669
1753
|
// whatever).
|
|
1670
1754
|
|
|
1671
1755
|
const hidden = !isVisible;
|
|
1672
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1756
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, { ...props,
|
|
1673
1757
|
as: innerAs,
|
|
1674
1758
|
"data-reach-combobox-popover": "",
|
|
1675
1759
|
ref: assignMultipleRefs(popoverRef, forwardedRef),
|
|
@@ -1679,7 +1763,7 @@ const ComboboxPopover = /*#__PURE__*/react.forwardRef(function ComboboxPopover(_
|
|
|
1679
1763
|
// to close from useBlur
|
|
1680
1764
|
,
|
|
1681
1765
|
tabIndex: "-1"
|
|
1682
|
-
})
|
|
1766
|
+
});
|
|
1683
1767
|
});
|
|
1684
1768
|
|
|
1685
1769
|
const focusLockStack = [];
|
|
@@ -1730,10 +1814,9 @@ const FocusLock = function FocusLock(props) {
|
|
|
1730
1814
|
childRef,
|
|
1731
1815
|
enabled = false,
|
|
1732
1816
|
style = {},
|
|
1733
|
-
children
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1817
|
+
children,
|
|
1818
|
+
...otherProps
|
|
1819
|
+
} = props;
|
|
1737
1820
|
const lockStartRef = react.useRef(null);
|
|
1738
1821
|
const lockEndRef = react.useRef(null);
|
|
1739
1822
|
useFocusLock(childRef, {
|
|
@@ -1741,31 +1824,32 @@ const FocusLock = function FocusLock(props) {
|
|
|
1741
1824
|
lockStartRef,
|
|
1742
1825
|
lockEndRef
|
|
1743
1826
|
});
|
|
1744
|
-
|
|
1745
|
-
const lockStyle = _extends__default['default']({
|
|
1827
|
+
const lockStyle = {
|
|
1746
1828
|
width: 1,
|
|
1747
1829
|
height: 0,
|
|
1748
1830
|
padding: 0,
|
|
1749
1831
|
overflow: 'hidden',
|
|
1750
1832
|
position: 'fixed',
|
|
1751
1833
|
top: 1,
|
|
1752
|
-
left: 1
|
|
1753
|
-
|
|
1754
|
-
|
|
1834
|
+
left: 1,
|
|
1835
|
+
...style
|
|
1836
|
+
};
|
|
1755
1837
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1756
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1838
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
1757
1839
|
ref: lockStartRef,
|
|
1758
1840
|
"data-focus-lock-start": "",
|
|
1759
1841
|
"aria-hidden": true,
|
|
1760
1842
|
tabIndex: 0,
|
|
1761
|
-
style: lockStyle
|
|
1762
|
-
|
|
1843
|
+
style: lockStyle,
|
|
1844
|
+
...otherProps
|
|
1845
|
+
}), children, /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
1763
1846
|
ref: lockEndRef,
|
|
1764
1847
|
"data-focus-lock-end": "",
|
|
1765
1848
|
"aria-hidden": true,
|
|
1766
1849
|
tabIndex: 0,
|
|
1767
|
-
style: lockStyle
|
|
1768
|
-
|
|
1850
|
+
style: lockStyle,
|
|
1851
|
+
...otherProps
|
|
1852
|
+
})]
|
|
1769
1853
|
});
|
|
1770
1854
|
};
|
|
1771
1855
|
|
|
@@ -1784,10 +1868,9 @@ const Menu = /*#__PURE__*/react.forwardRef(function Menu(props, forwardedRef) {
|
|
|
1784
1868
|
as: Comp = react.Fragment,
|
|
1785
1869
|
open: openProp,
|
|
1786
1870
|
defaultOpen = false,
|
|
1787
|
-
onChange: onChangeProp
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1871
|
+
onChange: onChangeProp,
|
|
1872
|
+
...otherProps
|
|
1873
|
+
} = props;
|
|
1791
1874
|
const menuListIdRef = react.useRef();
|
|
1792
1875
|
const openWithArrowKeyRef = react.useRef(null);
|
|
1793
1876
|
const buttonRef = react.useRef(null);
|
|
@@ -1804,9 +1887,10 @@ const Menu = /*#__PURE__*/react.forwardRef(function Menu(props, forwardedRef) {
|
|
|
1804
1887
|
};
|
|
1805
1888
|
return /*#__PURE__*/jsxRuntime.jsx(MenuProvider, {
|
|
1806
1889
|
value: value,
|
|
1807
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1808
|
-
ref: forwardedRef
|
|
1809
|
-
|
|
1890
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
1891
|
+
ref: forwardedRef,
|
|
1892
|
+
...otherProps
|
|
1893
|
+
})
|
|
1810
1894
|
});
|
|
1811
1895
|
});
|
|
1812
1896
|
|
|
@@ -1816,10 +1900,9 @@ const MenuButton = /*#__PURE__*/react.forwardRef(function MenuButton(props, forw
|
|
|
1816
1900
|
id: preferredId,
|
|
1817
1901
|
onClick,
|
|
1818
1902
|
onKeyDown,
|
|
1819
|
-
disabled
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1903
|
+
disabled,
|
|
1904
|
+
...otherProps
|
|
1905
|
+
} = props;
|
|
1823
1906
|
const {
|
|
1824
1907
|
menuListIdRef,
|
|
1825
1908
|
openWithArrowKeyRef,
|
|
@@ -1863,7 +1946,7 @@ const MenuButton = /*#__PURE__*/react.forwardRef(function MenuButton(props, forw
|
|
|
1863
1946
|
onChange && onChange(e, !open);
|
|
1864
1947
|
};
|
|
1865
1948
|
|
|
1866
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
1949
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
1867
1950
|
ref: forwardedRef,
|
|
1868
1951
|
id: buttonId,
|
|
1869
1952
|
role: "button",
|
|
@@ -1874,8 +1957,9 @@ const MenuButton = /*#__PURE__*/react.forwardRef(function MenuButton(props, forw
|
|
|
1874
1957
|
"data-menu-button": "",
|
|
1875
1958
|
onClick: wrapEvent(onClick, handleClick),
|
|
1876
1959
|
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
1877
|
-
disabled: disabled
|
|
1878
|
-
|
|
1960
|
+
disabled: disabled,
|
|
1961
|
+
...otherProps
|
|
1962
|
+
});
|
|
1879
1963
|
});
|
|
1880
1964
|
|
|
1881
1965
|
const MenuItem = /*#__PURE__*/react.forwardRef(function MenuItem(props, forwardedRef) {
|
|
@@ -1884,10 +1968,9 @@ const MenuItem = /*#__PURE__*/react.forwardRef(function MenuItem(props, forwarde
|
|
|
1884
1968
|
disabled,
|
|
1885
1969
|
onSelect,
|
|
1886
1970
|
onClick,
|
|
1887
|
-
onKeyDown
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1971
|
+
onKeyDown,
|
|
1972
|
+
...otherProps
|
|
1973
|
+
} = props;
|
|
1891
1974
|
const {
|
|
1892
1975
|
onChange,
|
|
1893
1976
|
buttonRef
|
|
@@ -1900,10 +1983,8 @@ const MenuItem = /*#__PURE__*/react.forwardRef(function MenuItem(props, forwarde
|
|
|
1900
1983
|
const itemId = react.useId();
|
|
1901
1984
|
const isActive = ref.current && ref.current === navigationItem;
|
|
1902
1985
|
const handleSelect = wrapEvent(onSelect, e => {
|
|
1903
|
-
var _buttonRef$current;
|
|
1904
|
-
|
|
1905
1986
|
onChange && onChange(e, false);
|
|
1906
|
-
|
|
1987
|
+
buttonRef.current?.focus();
|
|
1907
1988
|
e.preventDefault();
|
|
1908
1989
|
});
|
|
1909
1990
|
|
|
@@ -1927,7 +2008,7 @@ const MenuItem = /*#__PURE__*/react.forwardRef(function MenuItem(props, forwarde
|
|
|
1927
2008
|
}
|
|
1928
2009
|
};
|
|
1929
2010
|
|
|
1930
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2011
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
1931
2012
|
ref: assignMultipleRefs(ref, forwardedRef),
|
|
1932
2013
|
id: disabled ? undefined : itemId,
|
|
1933
2014
|
"data-menu-item": "",
|
|
@@ -1938,8 +2019,9 @@ const MenuItem = /*#__PURE__*/react.forwardRef(function MenuItem(props, forwarde
|
|
|
1938
2019
|
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
1939
2020
|
"data-disabled": disabled ? '' : undefined,
|
|
1940
2021
|
"aria-disabled": disabled ? '' : undefined,
|
|
1941
|
-
disabled: disabled
|
|
1942
|
-
|
|
2022
|
+
disabled: disabled,
|
|
2023
|
+
...otherProps
|
|
2024
|
+
});
|
|
1943
2025
|
});
|
|
1944
2026
|
|
|
1945
2027
|
function queryScope(type, props) {
|
|
@@ -1948,16 +2030,13 @@ function queryScope(type, props) {
|
|
|
1948
2030
|
|
|
1949
2031
|
const useEnhancedEffect$1 = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
|
1950
2032
|
const MenuList = /*#__PURE__*/react.forwardRef(function MenuList(props, forwardedRef) {
|
|
1951
|
-
var _buttonRef$current3;
|
|
1952
|
-
|
|
1953
2033
|
const {
|
|
1954
2034
|
as: Comp = 'ul',
|
|
1955
2035
|
onKeyDown,
|
|
1956
2036
|
id: preferredId,
|
|
1957
|
-
defaultActiveItemValue
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
2037
|
+
defaultActiveItemValue,
|
|
2038
|
+
...otherProps
|
|
2039
|
+
} = props;
|
|
1961
2040
|
const {
|
|
1962
2041
|
menuListIdRef,
|
|
1963
2042
|
buttonRef,
|
|
@@ -1999,9 +2078,7 @@ const MenuList = /*#__PURE__*/react.forwardRef(function MenuList(props, forwarde
|
|
|
1999
2078
|
setMounted(true);
|
|
2000
2079
|
}, [mounted, navigationItem, onNavigate, openWithArrowKeyRef, scope, defaultActiveItemValue]);
|
|
2001
2080
|
useOnClickOutside(menuListRef, e => {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
if (e.target instanceof HTMLElement && e.target !== buttonRef.current && !((_buttonRef$current = buttonRef.current) != null && _buttonRef$current.contains(e.target))) {
|
|
2081
|
+
if (e.target instanceof HTMLElement && e.target !== buttonRef.current && !buttonRef.current?.contains(e.target)) {
|
|
2005
2082
|
onChange && onChange(e, false);
|
|
2006
2083
|
}
|
|
2007
2084
|
|
|
@@ -2013,12 +2090,10 @@ const MenuList = /*#__PURE__*/react.forwardRef(function MenuList(props, forwarde
|
|
|
2013
2090
|
case 'Escape':
|
|
2014
2091
|
case 'Tab':
|
|
2015
2092
|
{
|
|
2016
|
-
var _buttonRef$current2;
|
|
2017
|
-
|
|
2018
2093
|
onChange && onChange(e, false);
|
|
2019
2094
|
e.preventDefault(); // prevents focusing on next element, because we will be handling it
|
|
2020
2095
|
|
|
2021
|
-
|
|
2096
|
+
buttonRef.current?.focus();
|
|
2022
2097
|
break;
|
|
2023
2098
|
}
|
|
2024
2099
|
|
|
@@ -2099,15 +2174,16 @@ const MenuList = /*#__PURE__*/react.forwardRef(function MenuList(props, forwarde
|
|
|
2099
2174
|
navigationItem,
|
|
2100
2175
|
onNavigate
|
|
2101
2176
|
},
|
|
2102
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2177
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2103
2178
|
ref: assignMultipleRefs(forwardedRef, menuListRef),
|
|
2104
2179
|
id: menuListIdRef.current,
|
|
2105
2180
|
role: "menu",
|
|
2106
|
-
"aria-labelledby":
|
|
2181
|
+
"aria-labelledby": buttonRef.current?.id,
|
|
2107
2182
|
"data-menu-list": "",
|
|
2108
2183
|
tabIndex: "-1",
|
|
2109
|
-
onKeyDown: wrapEvent(onKeyDown, handleKeyDown)
|
|
2110
|
-
|
|
2184
|
+
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
2185
|
+
...otherProps
|
|
2186
|
+
})
|
|
2111
2187
|
});
|
|
2112
2188
|
});
|
|
2113
2189
|
|
|
@@ -2137,25 +2213,23 @@ const Portal = ({
|
|
|
2137
2213
|
|
|
2138
2214
|
const useEnhancedEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
|
2139
2215
|
const emptyModifiers = [];
|
|
2140
|
-
const Popper = /*#__PURE__*/react.memo( /*#__PURE__*/react.forwardRef(function Popper(
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref, ["placement", "strategy", "as", "innerAs", "anchorEl", "children", "modifiers", "usePortal", "style", "portalSelector", "distance", "skidding", "arrowPadding", "offsetFn"]);
|
|
2158
|
-
|
|
2216
|
+
const Popper = /*#__PURE__*/react.memo( /*#__PURE__*/react.forwardRef(function Popper({
|
|
2217
|
+
placement = 'bottom',
|
|
2218
|
+
strategy = 'absolute',
|
|
2219
|
+
as: Comp = 'div',
|
|
2220
|
+
innerAs,
|
|
2221
|
+
anchorEl,
|
|
2222
|
+
children,
|
|
2223
|
+
modifiers = emptyModifiers,
|
|
2224
|
+
usePortal = false,
|
|
2225
|
+
style = {},
|
|
2226
|
+
portalSelector = 'body',
|
|
2227
|
+
distance = 0,
|
|
2228
|
+
skidding = 0,
|
|
2229
|
+
arrowPadding = 5,
|
|
2230
|
+
offsetFn,
|
|
2231
|
+
...props
|
|
2232
|
+
}, forwardedRef) {
|
|
2159
2233
|
const arrowRef = react.useRef(null);
|
|
2160
2234
|
const popperRef = react.useRef(null);
|
|
2161
2235
|
const popperEngineInstance = react.useRef(null);
|
|
@@ -2170,7 +2244,7 @@ const Popper = /*#__PURE__*/react.memo( /*#__PURE__*/react.forwardRef(function P
|
|
|
2170
2244
|
const offsetModifier = {
|
|
2171
2245
|
name: 'offset',
|
|
2172
2246
|
options: {
|
|
2173
|
-
offset: offsetFn
|
|
2247
|
+
offset: offsetFn ?? [skidding, distance]
|
|
2174
2248
|
}
|
|
2175
2249
|
};
|
|
2176
2250
|
return [arrowModifier, offsetModifier];
|
|
@@ -2190,9 +2264,7 @@ const Popper = /*#__PURE__*/react.memo( /*#__PURE__*/react.forwardRef(function P
|
|
|
2190
2264
|
};
|
|
2191
2265
|
}, [anchorEl, modifiers, placement, strategy, defaultModifiers]);
|
|
2192
2266
|
useEnhancedEffect(() => {
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
(_popperEngineInstance = popperEngineInstance.current) == null ? void 0 : _popperEngineInstance.forceUpdate();
|
|
2267
|
+
popperEngineInstance.current?.forceUpdate();
|
|
2196
2268
|
}, [props.hidden || props['aria-hidden']]);
|
|
2197
2269
|
const contextValue = {
|
|
2198
2270
|
arrowRef
|
|
@@ -2200,16 +2272,17 @@ const Popper = /*#__PURE__*/react.memo( /*#__PURE__*/react.forwardRef(function P
|
|
|
2200
2272
|
|
|
2201
2273
|
const ret = /*#__PURE__*/jsxRuntime.jsx(PopperProvider, {
|
|
2202
2274
|
value: contextValue,
|
|
2203
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2275
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, { ...props,
|
|
2204
2276
|
as: innerAs,
|
|
2205
2277
|
ref: assignMultipleRefs(popperRef, forwardedRef),
|
|
2206
|
-
style:
|
|
2278
|
+
style: {
|
|
2207
2279
|
position: 'fixed',
|
|
2208
2280
|
left: -5000,
|
|
2209
|
-
top: -5000
|
|
2210
|
-
|
|
2281
|
+
top: -5000,
|
|
2282
|
+
...style
|
|
2283
|
+
},
|
|
2211
2284
|
children: children
|
|
2212
|
-
})
|
|
2285
|
+
})
|
|
2213
2286
|
});
|
|
2214
2287
|
|
|
2215
2288
|
if (usePortal) {
|
|
@@ -2222,37 +2295,33 @@ const Popper = /*#__PURE__*/react.memo( /*#__PURE__*/react.forwardRef(function P
|
|
|
2222
2295
|
return ret;
|
|
2223
2296
|
}));
|
|
2224
2297
|
|
|
2225
|
-
const PopperArrow = /*#__PURE__*/react.forwardRef(function PopperArrow(
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref, ["as"]);
|
|
2230
|
-
|
|
2298
|
+
const PopperArrow = /*#__PURE__*/react.forwardRef(function PopperArrow({
|
|
2299
|
+
as: Comp = 'div',
|
|
2300
|
+
...props
|
|
2301
|
+
}, ref) {
|
|
2231
2302
|
const ctx = usePopperContext();
|
|
2232
2303
|
|
|
2233
2304
|
if (ctx === null) {
|
|
2234
2305
|
return null;
|
|
2235
2306
|
}
|
|
2236
2307
|
|
|
2237
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2308
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, { ...props,
|
|
2238
2309
|
ref: node => {
|
|
2239
2310
|
if (node && ctx.arrowRef.current && ctx.arrowRef.current !== node) {
|
|
2240
2311
|
throw new Error('You can only render one <PopperArrow /> per <Popper> component');
|
|
2241
2312
|
}
|
|
2242
2313
|
|
|
2243
|
-
|
|
2244
|
-
assignRef(ctx.arrowRef, node);
|
|
2314
|
+
assignMultipleRefs(ref, ctx.arrowRef)(node);
|
|
2245
2315
|
},
|
|
2246
2316
|
"data-popper-arrow": ""
|
|
2247
|
-
})
|
|
2317
|
+
});
|
|
2248
2318
|
});
|
|
2249
2319
|
|
|
2250
2320
|
const MenuPopover = /*#__PURE__*/react.forwardRef(function MenuPopover(props, forwardedRef) {
|
|
2251
2321
|
const {
|
|
2252
|
-
as = 'div'
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2322
|
+
as = 'div',
|
|
2323
|
+
...otherProps
|
|
2324
|
+
} = props;
|
|
2256
2325
|
const {
|
|
2257
2326
|
buttonRef,
|
|
2258
2327
|
open
|
|
@@ -2262,54 +2331,51 @@ const MenuPopover = /*#__PURE__*/react.forwardRef(function MenuPopover(props, fo
|
|
|
2262
2331
|
return null;
|
|
2263
2332
|
}
|
|
2264
2333
|
|
|
2265
|
-
return /*#__PURE__*/jsxRuntime.jsx(Popper,
|
|
2334
|
+
return /*#__PURE__*/jsxRuntime.jsx(Popper, {
|
|
2266
2335
|
as: as,
|
|
2267
2336
|
ref: forwardedRef,
|
|
2268
|
-
anchorEl: buttonRef
|
|
2269
|
-
|
|
2337
|
+
anchorEl: buttonRef,
|
|
2338
|
+
...otherProps
|
|
2339
|
+
});
|
|
2270
2340
|
});
|
|
2271
2341
|
|
|
2272
|
-
const Modal = /*#__PURE__*/react.forwardRef((
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
otherProps = _objectWithoutPropertiesLoose__default['default'](_ref, ["as", "children", "trapFocus", "style"]);
|
|
2280
|
-
|
|
2342
|
+
const Modal = /*#__PURE__*/react.forwardRef(({
|
|
2343
|
+
as: Comp = 'div',
|
|
2344
|
+
children,
|
|
2345
|
+
trapFocus = true,
|
|
2346
|
+
style = {},
|
|
2347
|
+
...otherProps
|
|
2348
|
+
}, ref) => {
|
|
2281
2349
|
const modalRef = react.useRef(null);
|
|
2282
2350
|
useFocusReturn(trapFocus, modalRef);
|
|
2283
|
-
useRemoveBodyScroll(trapFocus);
|
|
2351
|
+
useRemoveBodyScroll(trapFocus, modalRef);
|
|
2284
2352
|
useAutoFocus(trapFocus, modalRef);
|
|
2285
2353
|
return /*#__PURE__*/jsxRuntime.jsx(FocusLock, {
|
|
2286
2354
|
childRef: modalRef,
|
|
2287
2355
|
enabled: trapFocus,
|
|
2288
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2356
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2289
2357
|
ref: assignMultipleRefs(ref, modalRef),
|
|
2290
2358
|
"data-modal-container": "",
|
|
2291
2359
|
role: "dialog",
|
|
2292
2360
|
"aria-modal": "true",
|
|
2293
2361
|
style: style,
|
|
2294
|
-
tabIndex: -1
|
|
2295
|
-
|
|
2362
|
+
tabIndex: -1,
|
|
2363
|
+
...otherProps,
|
|
2296
2364
|
children: children
|
|
2297
|
-
})
|
|
2365
|
+
})
|
|
2298
2366
|
});
|
|
2299
2367
|
});
|
|
2300
2368
|
|
|
2301
|
-
const ModalBackdrop = /*#__PURE__*/react.forwardRef((
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
otherProps = _objectWithoutPropertiesLoose__default['default'](_ref, ["as", "onClose", "onClick", "onMouseDown", "onKeyDown", "disableCloseOnClick", "disableEscapeKeyDown"]);
|
|
2312
|
-
|
|
2369
|
+
const ModalBackdrop = /*#__PURE__*/react.forwardRef(({
|
|
2370
|
+
as: Comp = 'div',
|
|
2371
|
+
onClose,
|
|
2372
|
+
onClick,
|
|
2373
|
+
onMouseDown,
|
|
2374
|
+
onKeyDown,
|
|
2375
|
+
disableCloseOnClick = false,
|
|
2376
|
+
disableEscapeKeyDown = false,
|
|
2377
|
+
...otherProps
|
|
2378
|
+
}, forwardedRef) => {
|
|
2313
2379
|
const ref = react.useRef();
|
|
2314
2380
|
const mouseDownTargetRef = react.useRef(null);
|
|
2315
2381
|
|
|
@@ -2326,7 +2392,7 @@ const ModalBackdrop = /*#__PURE__*/react.forwardRef((_ref, forwardedRef) => {
|
|
|
2326
2392
|
}
|
|
2327
2393
|
|
|
2328
2394
|
mouseDownTargetRef.current = null;
|
|
2329
|
-
!disableCloseOnClick &&
|
|
2395
|
+
!disableCloseOnClick && onClose?.();
|
|
2330
2396
|
e.stopPropagation();
|
|
2331
2397
|
};
|
|
2332
2398
|
|
|
@@ -2336,18 +2402,19 @@ const ModalBackdrop = /*#__PURE__*/react.forwardRef((_ref, forwardedRef) => {
|
|
|
2336
2402
|
|
|
2337
2403
|
const handleKeyDown = e => {
|
|
2338
2404
|
if (e.key === 'Escape') {
|
|
2339
|
-
!disableEscapeKeyDown &&
|
|
2405
|
+
!disableEscapeKeyDown && onClose?.();
|
|
2340
2406
|
e.stopPropagation();
|
|
2341
2407
|
}
|
|
2342
2408
|
};
|
|
2343
2409
|
|
|
2344
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2410
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2345
2411
|
ref: assignMultipleRefs(ref, forwardedRef),
|
|
2346
2412
|
"data-modal-root": "",
|
|
2347
2413
|
onClick: wrapEvent(onClick, handleClick),
|
|
2348
2414
|
onMouseDown: wrapEvent(onMouseDown, handleMouseDown),
|
|
2349
|
-
onKeyDown: wrapEvent(onKeyDown, handleKeyDown)
|
|
2350
|
-
|
|
2415
|
+
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
2416
|
+
...otherProps
|
|
2417
|
+
});
|
|
2351
2418
|
});
|
|
2352
2419
|
|
|
2353
2420
|
const RadioGroupContext = /*#__PURE__*/react.createContext(undefined);
|
|
@@ -2362,26 +2429,26 @@ const RadioButton = /*#__PURE__*/react.forwardRef(function RadioButton(props, fo
|
|
|
2362
2429
|
value: valueProp,
|
|
2363
2430
|
onChange: onChangeProp,
|
|
2364
2431
|
checked: checkedProp,
|
|
2365
|
-
name: nameProp
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2432
|
+
name: nameProp,
|
|
2433
|
+
...otherProps
|
|
2434
|
+
} = props;
|
|
2369
2435
|
const radioGroupContext = useRadioGroupContext();
|
|
2370
2436
|
|
|
2371
2437
|
const handleChange = e => {
|
|
2372
|
-
radioGroupContext
|
|
2438
|
+
radioGroupContext?.onChange?.(e, valueProp);
|
|
2373
2439
|
};
|
|
2374
2440
|
|
|
2375
2441
|
const checked = radioGroupContext ? radioGroupContext.value === valueProp : checkedProp;
|
|
2376
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2442
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2377
2443
|
ref: forwardedRef,
|
|
2378
2444
|
type: "radio",
|
|
2379
2445
|
checked: checked,
|
|
2380
2446
|
"aria-checked": String(checked),
|
|
2381
2447
|
name: radioGroupContext ? radioGroupContext.name : nameProp,
|
|
2382
2448
|
onChange: wrapEvent(onChangeProp, handleChange),
|
|
2383
|
-
value: valueProp
|
|
2384
|
-
|
|
2449
|
+
value: valueProp,
|
|
2450
|
+
...otherProps
|
|
2451
|
+
});
|
|
2385
2452
|
});
|
|
2386
2453
|
|
|
2387
2454
|
const RadioGroup = /*#__PURE__*/react.forwardRef(function RadioGroup(props, forwardedRef) {
|
|
@@ -2390,10 +2457,9 @@ const RadioGroup = /*#__PURE__*/react.forwardRef(function RadioGroup(props, forw
|
|
|
2390
2457
|
onChange: onChangeProp,
|
|
2391
2458
|
value: valueProp,
|
|
2392
2459
|
name: nameProp,
|
|
2393
|
-
defaultValue
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2460
|
+
defaultValue,
|
|
2461
|
+
...otherProps
|
|
2462
|
+
} = props;
|
|
2397
2463
|
const [value, onChange] = useControlledState(valueProp, onChangeProp, defaultValue, setValue => (e, value) => {
|
|
2398
2464
|
setValue(value);
|
|
2399
2465
|
});
|
|
@@ -2404,12 +2470,792 @@ const RadioGroup = /*#__PURE__*/react.forwardRef(function RadioGroup(props, forw
|
|
|
2404
2470
|
onChange,
|
|
2405
2471
|
name: nameProp || fallbackId
|
|
2406
2472
|
},
|
|
2407
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2473
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2408
2474
|
ref: forwardedRef,
|
|
2409
|
-
role: "radiogroup"
|
|
2410
|
-
|
|
2475
|
+
role: "radiogroup",
|
|
2476
|
+
...otherProps
|
|
2477
|
+
})
|
|
2478
|
+
});
|
|
2479
|
+
});
|
|
2480
|
+
|
|
2481
|
+
/**
|
|
2482
|
+
* Welcome to @reach/slider!
|
|
2483
|
+
*
|
|
2484
|
+
* A UI input component where the user selects a value from within a given
|
|
2485
|
+
* range. A Slider has a handle that can be moved along a track to change its
|
|
2486
|
+
* value. When the user's mouse or focus is on the Slider's handle, the value
|
|
2487
|
+
* can be incremented with keyboard controls.
|
|
2488
|
+
*
|
|
2489
|
+
* Random thoughts/notes:
|
|
2490
|
+
* - Currently testing this against the behavior of the native input range
|
|
2491
|
+
* element to get our slider on par. We'll explore animated and multi-handle
|
|
2492
|
+
* sliders next.
|
|
2493
|
+
* - We may want to research some use cases for reversed sliders in RTL
|
|
2494
|
+
* languages if that's a thing
|
|
2495
|
+
*
|
|
2496
|
+
* @see Docs https://reach.tech/slider
|
|
2497
|
+
* @see Source https://github.com/reach/reach-ui/tree/main/packages/slider
|
|
2498
|
+
* @see WAI-ARIA https://www.w3.org/TR/wai-aria-practices-1.2/#slider
|
|
2499
|
+
* @see Example https://github.com/Stanko/aria-progress-range-slider
|
|
2500
|
+
* @see Example http://www.oaa-accessibility.org/examplep/slider1/
|
|
2501
|
+
*/
|
|
2502
|
+
|
|
2503
|
+
const noop = () => {
|
|
2504
|
+
/* noop */
|
|
2505
|
+
};
|
|
2506
|
+
|
|
2507
|
+
const [SliderProvider, useSliderContext] = createContext('Slider'); ////////////////////////////////////////////////////////////////////////////////
|
|
2508
|
+
|
|
2509
|
+
/**
|
|
2510
|
+
* Slider
|
|
2511
|
+
*
|
|
2512
|
+
* @see Docs https://reach.tech/slider#slider
|
|
2513
|
+
*/
|
|
2514
|
+
|
|
2515
|
+
const Slider = /*#__PURE__*/react.forwardRef(function Slider({
|
|
2516
|
+
children,
|
|
2517
|
+
...props
|
|
2518
|
+
}, forwardedRef) {
|
|
2519
|
+
return /*#__PURE__*/jsxRuntime.jsx(SliderInput, { ...props,
|
|
2520
|
+
ref: forwardedRef,
|
|
2521
|
+
"data-reach-slider": "",
|
|
2522
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(SliderTrack, {
|
|
2523
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(SliderRange, {}), /*#__PURE__*/jsxRuntime.jsx(SliderHandle, {}), children]
|
|
2524
|
+
})
|
|
2525
|
+
});
|
|
2526
|
+
});
|
|
2527
|
+
/**
|
|
2528
|
+
* @see Docs https://reach.tech/slider#slider-props
|
|
2529
|
+
*/
|
|
2530
|
+
|
|
2531
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2532
|
+
|
|
2533
|
+
/**
|
|
2534
|
+
* SliderInput
|
|
2535
|
+
*
|
|
2536
|
+
* The parent component of the slider interface. This is a lower level component
|
|
2537
|
+
* if you need more control over styles or rendering the slider's inner
|
|
2538
|
+
* components.
|
|
2539
|
+
*
|
|
2540
|
+
* @see Docs https://reach.tech/slider#sliderinput
|
|
2541
|
+
*/
|
|
2542
|
+
const SliderInput = /*#__PURE__*/react.forwardRef(function SliderInput({
|
|
2543
|
+
'aria-label': ariaLabel,
|
|
2544
|
+
'aria-labelledby': ariaLabelledBy,
|
|
2545
|
+
'aria-valuetext': ariaValueTextProp,
|
|
2546
|
+
as: Comp = 'div',
|
|
2547
|
+
defaultValue,
|
|
2548
|
+
disabled = false,
|
|
2549
|
+
value: controlledValue,
|
|
2550
|
+
getAriaLabel,
|
|
2551
|
+
getAriaValueText,
|
|
2552
|
+
handleAlignment = 'center',
|
|
2553
|
+
max = 100,
|
|
2554
|
+
min = 0,
|
|
2555
|
+
name,
|
|
2556
|
+
onChange: onChangeProp,
|
|
2557
|
+
onKeyDown,
|
|
2558
|
+
onMouseDown,
|
|
2559
|
+
onMouseMove,
|
|
2560
|
+
onMouseUp,
|
|
2561
|
+
onPointerDown,
|
|
2562
|
+
onPointerUp,
|
|
2563
|
+
onTouchEnd,
|
|
2564
|
+
onTouchMove,
|
|
2565
|
+
onTouchStart,
|
|
2566
|
+
orientation = 'horizontal',
|
|
2567
|
+
step = 1,
|
|
2568
|
+
children,
|
|
2569
|
+
...rest
|
|
2570
|
+
}, forwardedRef) {
|
|
2571
|
+
const touchId = react.useRef();
|
|
2572
|
+
const fallbackId = react.useId();
|
|
2573
|
+
const id = rest.id || fallbackId; // Track whether or not the pointer is down without updating the component
|
|
2574
|
+
|
|
2575
|
+
const pointerDownRef = react.useRef(false);
|
|
2576
|
+
const trackRef = react.useRef(null);
|
|
2577
|
+
const handleRef = react.useRef(null);
|
|
2578
|
+
const sliderRef = react.useRef(null);
|
|
2579
|
+
const [hasFocus, setHasFocus] = react.useState(false);
|
|
2580
|
+
const {
|
|
2581
|
+
ref: x,
|
|
2582
|
+
...handleDimensions
|
|
2583
|
+
} = useDimensions(handleRef);
|
|
2584
|
+
const [_value, onChange] = useControlledState(controlledValue, onChangeProp, defaultValue || min, setValue => (e, v) => setValue(v));
|
|
2585
|
+
const value = clamp$1(_value, min, max);
|
|
2586
|
+
const trackPercent = valueToPercent(value, min, max);
|
|
2587
|
+
const isVertical = orientation === 'vertical';
|
|
2588
|
+
const handleSize = isVertical ? handleDimensions.height : handleDimensions.width; // TODO: Consider removing the `handleAlignment` prop
|
|
2589
|
+
// We may want to use accept a `handlePosition` prop instead and let apps
|
|
2590
|
+
// define their own positioning logic, similar to how we do for popovers.
|
|
2591
|
+
|
|
2592
|
+
const handlePosition = `calc(${trackPercent}% - ${handleAlignment === 'center' ? `${handleSize}px / 2` : `${handleSize}px * ${trackPercent * 0.01}`})`;
|
|
2593
|
+
const handlePositionRef = react.useRef(handlePosition);
|
|
2594
|
+
react.useLayoutEffect(() => {
|
|
2595
|
+
handlePositionRef.current = handlePosition;
|
|
2596
|
+
}, [handlePosition]);
|
|
2597
|
+
const getNewValueFromEvent = react.useCallback(event => {
|
|
2598
|
+
return getNewValue(getPointerPosition(event, touchId), trackRef.current, {
|
|
2599
|
+
step,
|
|
2600
|
+
orientation,
|
|
2601
|
+
min,
|
|
2602
|
+
max
|
|
2603
|
+
});
|
|
2604
|
+
}, [max, min, orientation, step]); // https://www.w3.org/TR/wai-aria-practices-1.2/#slider_kbd_interaction
|
|
2605
|
+
|
|
2606
|
+
const handleKeyDown = useStableLayoutCallback(event => {
|
|
2607
|
+
if (disabled) {
|
|
2608
|
+
return;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
let newValue;
|
|
2612
|
+
const tenSteps = (max - min) / 10;
|
|
2613
|
+
const keyStep = step || (max - min) / 100;
|
|
2614
|
+
|
|
2615
|
+
switch (event.key) {
|
|
2616
|
+
// Decrease the value of the slider by one step.
|
|
2617
|
+
case 'ArrowLeft':
|
|
2618
|
+
case 'ArrowDown':
|
|
2619
|
+
newValue = value - keyStep;
|
|
2620
|
+
break;
|
|
2621
|
+
// Increase the value of the slider by one step
|
|
2622
|
+
|
|
2623
|
+
case 'ArrowRight':
|
|
2624
|
+
case 'ArrowUp':
|
|
2625
|
+
newValue = value + keyStep;
|
|
2626
|
+
break;
|
|
2627
|
+
// Decrement the slider by an amount larger than the step change made by
|
|
2628
|
+
// `ArrowDown`.
|
|
2629
|
+
|
|
2630
|
+
case 'PageDown':
|
|
2631
|
+
newValue = value - tenSteps;
|
|
2632
|
+
break;
|
|
2633
|
+
// Increment the slider by an amount larger than the step change made by
|
|
2634
|
+
// `ArrowUp`.
|
|
2635
|
+
|
|
2636
|
+
case 'PageUp':
|
|
2637
|
+
newValue = value + tenSteps;
|
|
2638
|
+
break;
|
|
2639
|
+
// Set the slider to the first allowed value in its range.
|
|
2640
|
+
|
|
2641
|
+
case 'Home':
|
|
2642
|
+
newValue = min;
|
|
2643
|
+
break;
|
|
2644
|
+
// Set the slider to the last allowed value in its range.
|
|
2645
|
+
|
|
2646
|
+
case 'End':
|
|
2647
|
+
newValue = max;
|
|
2648
|
+
break;
|
|
2649
|
+
|
|
2650
|
+
default:
|
|
2651
|
+
return;
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
newValue = clamp$1(step ? roundValueToStep(newValue, step, min) : newValue, min, max);
|
|
2655
|
+
onChange(event, newValue);
|
|
2656
|
+
});
|
|
2657
|
+
const ariaValueText = getAriaValueText ? getAriaValueText(value) : ariaValueTextProp;
|
|
2658
|
+
const rangeStyle = {
|
|
2659
|
+
[isVertical ? 'height' : 'width']: `${trackPercent}%`
|
|
2660
|
+
}; // Slide events!
|
|
2661
|
+
// We will try to use pointer events if they are supported to leverage
|
|
2662
|
+
// setPointerCapture and releasePointerCapture. We'll fall back to separate
|
|
2663
|
+
// mouse and touch events.
|
|
2664
|
+
// TODO: This could be more concise
|
|
2665
|
+
|
|
2666
|
+
const removeMoveEvents = react.useRef(noop);
|
|
2667
|
+
const removeStartEvents = react.useRef(noop);
|
|
2668
|
+
const removeEndEvents = react.useRef(noop); // Store our event handlers in refs so we aren't attaching/detaching events
|
|
2669
|
+
// on every render if the user doesn't useCallback
|
|
2670
|
+
|
|
2671
|
+
const appEvents = react.useRef({
|
|
2672
|
+
onMouseMove,
|
|
2673
|
+
onMouseDown,
|
|
2674
|
+
onMouseUp,
|
|
2675
|
+
onTouchStart,
|
|
2676
|
+
onTouchEnd,
|
|
2677
|
+
onTouchMove,
|
|
2678
|
+
onPointerDown,
|
|
2679
|
+
onPointerUp
|
|
2680
|
+
});
|
|
2681
|
+
react.useLayoutEffect(() => {
|
|
2682
|
+
appEvents.current.onMouseMove = onMouseMove;
|
|
2683
|
+
appEvents.current.onMouseDown = onMouseDown;
|
|
2684
|
+
appEvents.current.onMouseUp = onMouseUp;
|
|
2685
|
+
appEvents.current.onTouchStart = onTouchStart;
|
|
2686
|
+
appEvents.current.onTouchEnd = onTouchEnd;
|
|
2687
|
+
appEvents.current.onTouchMove = onTouchMove;
|
|
2688
|
+
appEvents.current.onPointerDown = onPointerDown;
|
|
2689
|
+
appEvents.current.onPointerUp = onPointerUp;
|
|
2690
|
+
}, [onMouseMove, onMouseDown, onMouseUp, onTouchStart, onTouchEnd, onTouchMove, onPointerDown, onPointerUp]);
|
|
2691
|
+
const handleSlideStart = useStableLayoutCallback(event => {
|
|
2692
|
+
if (isRightClick(event)) return;
|
|
2693
|
+
|
|
2694
|
+
if (disabled) {
|
|
2695
|
+
pointerDownRef.current = false;
|
|
2696
|
+
return;
|
|
2697
|
+
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
const ownerDocument = getOwnerDocument(sliderRef.current);
|
|
2701
|
+
const ownerWindow = ownerDocument.defaultView || window;
|
|
2702
|
+
pointerDownRef.current = true;
|
|
2703
|
+
|
|
2704
|
+
if (event.changedTouches) {
|
|
2705
|
+
// Prevent scrolling for touch events
|
|
2706
|
+
event.preventDefault();
|
|
2707
|
+
const touch = event.changedTouches?.[0];
|
|
2708
|
+
|
|
2709
|
+
if (touch != null) {
|
|
2710
|
+
touchId.current = touch.identifier;
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
const newValue = getNewValueFromEvent(event);
|
|
2715
|
+
|
|
2716
|
+
if (newValue == null) {
|
|
2717
|
+
return;
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
ownerWindow.requestAnimationFrame(() => handleRef.current?.focus());
|
|
2721
|
+
onChange(event, newValue);
|
|
2722
|
+
removeMoveEvents.current = addMoveListener();
|
|
2723
|
+
removeEndEvents.current = addEndListener();
|
|
2724
|
+
});
|
|
2725
|
+
const setPointerCapture = useStableLayoutCallback(event => {
|
|
2726
|
+
if (isRightClick(event)) return;
|
|
2727
|
+
|
|
2728
|
+
if (disabled) {
|
|
2729
|
+
pointerDownRef.current = false;
|
|
2730
|
+
return;
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
pointerDownRef.current = true;
|
|
2734
|
+
sliderRef.current?.setPointerCapture(event.pointerId);
|
|
2735
|
+
});
|
|
2736
|
+
const releasePointerCapture = useStableLayoutCallback(event => {
|
|
2737
|
+
if (isRightClick(event)) return;
|
|
2738
|
+
sliderRef.current?.releasePointerCapture(event.pointerId);
|
|
2739
|
+
pointerDownRef.current = false;
|
|
2740
|
+
});
|
|
2741
|
+
const handlePointerMove = useStableLayoutCallback(event => {
|
|
2742
|
+
if (disabled || !pointerDownRef.current) {
|
|
2743
|
+
pointerDownRef.current = false;
|
|
2744
|
+
return;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
const newValue = getNewValueFromEvent(event);
|
|
2748
|
+
|
|
2749
|
+
if (newValue == null) {
|
|
2750
|
+
return;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
onChange?.(event, newValue);
|
|
2754
|
+
});
|
|
2755
|
+
const handleSlideStop = useStableLayoutCallback(event => {
|
|
2756
|
+
if (isRightClick(event)) return;
|
|
2757
|
+
pointerDownRef.current = false;
|
|
2758
|
+
const newValue = getNewValueFromEvent(event);
|
|
2759
|
+
|
|
2760
|
+
if (newValue == null) {
|
|
2761
|
+
return;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
touchId.current = undefined;
|
|
2765
|
+
removeMoveEvents.current();
|
|
2766
|
+
removeEndEvents.current();
|
|
2767
|
+
});
|
|
2768
|
+
const addMoveListener = react.useCallback(() => {
|
|
2769
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2770
|
+
const ownerDocument = getOwnerDocument(sliderRef.current);
|
|
2771
|
+
const touchListener = wrapEvent(appEvents.current.onTouchMove, handlePointerMove);
|
|
2772
|
+
const mouseListener = wrapEvent(appEvents.current.onMouseMove, handlePointerMove);
|
|
2773
|
+
ownerDocument.addEventListener('touchmove', touchListener);
|
|
2774
|
+
ownerDocument.addEventListener('mousemove', mouseListener);
|
|
2775
|
+
return () => {
|
|
2776
|
+
ownerDocument.removeEventListener('touchmove', touchListener);
|
|
2777
|
+
ownerDocument.removeEventListener('mousemove', mouseListener);
|
|
2778
|
+
};
|
|
2779
|
+
}, [handlePointerMove]);
|
|
2780
|
+
const addEndListener = react.useCallback(() => {
|
|
2781
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2782
|
+
const ownerDocument = getOwnerDocument(sliderRef.current);
|
|
2783
|
+
const ownerWindow = ownerDocument.defaultView || window;
|
|
2784
|
+
const pointerListener = wrapEvent(appEvents.current.onPointerUp, releasePointerCapture);
|
|
2785
|
+
const touchListener = wrapEvent(appEvents.current.onTouchEnd, handleSlideStop);
|
|
2786
|
+
const mouseListener = wrapEvent(appEvents.current.onMouseUp, handleSlideStop);
|
|
2787
|
+
|
|
2788
|
+
if ('PointerEvent' in ownerWindow) {
|
|
2789
|
+
ownerDocument.addEventListener('pointerup', pointerListener);
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
ownerDocument.addEventListener('touchend', touchListener);
|
|
2793
|
+
ownerDocument.addEventListener('mouseup', mouseListener);
|
|
2794
|
+
return () => {
|
|
2795
|
+
if ('PointerEvent' in ownerWindow) {
|
|
2796
|
+
ownerDocument.removeEventListener('pointerup', pointerListener);
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
ownerDocument.removeEventListener('touchend', touchListener);
|
|
2800
|
+
ownerDocument.removeEventListener('mouseup', mouseListener);
|
|
2801
|
+
};
|
|
2802
|
+
}, [handleSlideStop, releasePointerCapture]);
|
|
2803
|
+
const addStartListener = react.useCallback(() => {
|
|
2804
|
+
// e.preventDefault is ignored by React's synthetic touchStart event, so
|
|
2805
|
+
// we attach the listener directly to the DOM node
|
|
2806
|
+
// https://github.com/facebook/react/issues/9809#issuecomment-413978405
|
|
2807
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2808
|
+
const sliderElement = sliderRef.current;
|
|
2809
|
+
|
|
2810
|
+
if (!sliderElement) {
|
|
2811
|
+
return noop;
|
|
2812
|
+
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2813
|
+
|
|
2814
|
+
|
|
2815
|
+
const ownerDocument = getOwnerDocument(sliderElement);
|
|
2816
|
+
const ownerWindow = ownerDocument.defaultView || window;
|
|
2817
|
+
const touchListener = wrapEvent(appEvents.current.onTouchStart, handleSlideStart);
|
|
2818
|
+
const mouseListener = wrapEvent(appEvents.current.onMouseDown, handleSlideStart);
|
|
2819
|
+
const pointerListener = wrapEvent(appEvents.current.onPointerDown, setPointerCapture);
|
|
2820
|
+
sliderElement.addEventListener('touchstart', touchListener);
|
|
2821
|
+
sliderElement.addEventListener('mousedown', mouseListener);
|
|
2822
|
+
|
|
2823
|
+
if ('PointerEvent' in ownerWindow) {
|
|
2824
|
+
sliderElement.addEventListener('pointerdown', pointerListener);
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
return () => {
|
|
2828
|
+
sliderElement.removeEventListener('touchstart', touchListener);
|
|
2829
|
+
sliderElement.removeEventListener('mousedown', mouseListener);
|
|
2830
|
+
|
|
2831
|
+
if ('PointerEvent' in ownerWindow) {
|
|
2832
|
+
sliderElement.removeEventListener('pointerdown', pointerListener);
|
|
2833
|
+
}
|
|
2834
|
+
};
|
|
2835
|
+
}, [setPointerCapture, handleSlideStart]);
|
|
2836
|
+
react.useEffect(() => {
|
|
2837
|
+
removeStartEvents.current = addStartListener();
|
|
2838
|
+
return () => {
|
|
2839
|
+
removeStartEvents.current();
|
|
2840
|
+
removeEndEvents.current();
|
|
2841
|
+
removeMoveEvents.current();
|
|
2842
|
+
};
|
|
2843
|
+
}, [addStartListener]);
|
|
2844
|
+
const inputFallbackId = react.useId();
|
|
2845
|
+
const inputId = id || inputFallbackId;
|
|
2846
|
+
return /*#__PURE__*/jsxRuntime.jsx(SliderProvider, {
|
|
2847
|
+
ariaLabel: getAriaLabel ? getAriaLabel(value) : ariaLabel,
|
|
2848
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
2849
|
+
ariaValueText: ariaValueText,
|
|
2850
|
+
handleDimensions: handleDimensions,
|
|
2851
|
+
handleKeyDown: handleKeyDown,
|
|
2852
|
+
handlePosition: handlePosition,
|
|
2853
|
+
handleRef: handleRef,
|
|
2854
|
+
hasFocus: hasFocus,
|
|
2855
|
+
onKeyDown: onKeyDown,
|
|
2856
|
+
setHasFocus: setHasFocus,
|
|
2857
|
+
sliderId: id,
|
|
2858
|
+
sliderMax: max,
|
|
2859
|
+
sliderMin: min,
|
|
2860
|
+
value: value,
|
|
2861
|
+
disabled: !!disabled,
|
|
2862
|
+
isVertical: isVertical,
|
|
2863
|
+
orientation: orientation,
|
|
2864
|
+
trackPercent: trackPercent,
|
|
2865
|
+
trackRef: trackRef,
|
|
2866
|
+
rangeStyle: rangeStyle,
|
|
2867
|
+
updateValue: onChange,
|
|
2868
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(Comp, { ...rest,
|
|
2869
|
+
ref: assignMultipleRefs(sliderRef, forwardedRef),
|
|
2870
|
+
"data-reach-slider-input": "",
|
|
2871
|
+
"data-disabled": disabled ? '' : undefined,
|
|
2872
|
+
"data-orientation": orientation,
|
|
2873
|
+
tabIndex: -1,
|
|
2874
|
+
children: [typeof children === 'function' ? children({
|
|
2875
|
+
hasFocus,
|
|
2876
|
+
id,
|
|
2877
|
+
max,
|
|
2878
|
+
min,
|
|
2879
|
+
value,
|
|
2880
|
+
ariaValueText
|
|
2881
|
+
}) : children, name &&
|
|
2882
|
+
/*#__PURE__*/
|
|
2883
|
+
// If the slider is used in a form we'll need an input field to
|
|
2884
|
+
// capture the value. We'll assume this when the component is given a
|
|
2885
|
+
// form field name (A `name` prop doesn't really make sense in any
|
|
2886
|
+
// other context).
|
|
2887
|
+
jsxRuntime.jsx("input", {
|
|
2888
|
+
type: "hidden",
|
|
2889
|
+
value: value,
|
|
2890
|
+
name: name,
|
|
2891
|
+
id: inputId
|
|
2892
|
+
})]
|
|
2893
|
+
})
|
|
2894
|
+
});
|
|
2895
|
+
});
|
|
2896
|
+
/**
|
|
2897
|
+
* @see Docs https://reach.tech/slider#sliderinput-props
|
|
2898
|
+
*/
|
|
2899
|
+
|
|
2900
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2901
|
+
|
|
2902
|
+
/**
|
|
2903
|
+
* SliderTrack
|
|
2904
|
+
*
|
|
2905
|
+
* @see Docs https://reach.tech/slider#slidertrack
|
|
2906
|
+
*/
|
|
2907
|
+
const SliderTrackImpl = /*#__PURE__*/react.forwardRef(function SliderTrack({
|
|
2908
|
+
as: Comp = 'div',
|
|
2909
|
+
children,
|
|
2910
|
+
style = {},
|
|
2911
|
+
...props
|
|
2912
|
+
}, forwardedRef) {
|
|
2913
|
+
const {
|
|
2914
|
+
disabled,
|
|
2915
|
+
orientation,
|
|
2916
|
+
trackRef
|
|
2917
|
+
} = useSliderContext('SliderTrack');
|
|
2918
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2919
|
+
ref: assignMultipleRefs(trackRef, forwardedRef),
|
|
2920
|
+
style: { ...style,
|
|
2921
|
+
position: 'relative'
|
|
2922
|
+
},
|
|
2923
|
+
...props,
|
|
2924
|
+
"data-reach-slider-track": "",
|
|
2925
|
+
"data-disabled": disabled ? '' : undefined,
|
|
2926
|
+
"data-orientation": orientation,
|
|
2927
|
+
children: children
|
|
2928
|
+
});
|
|
2929
|
+
});
|
|
2930
|
+
const SliderTrack = /*#__PURE__*/react.memo(SliderTrackImpl);
|
|
2931
|
+
/**
|
|
2932
|
+
* @see Docs https://reach.tech/slider#slidertrack-props
|
|
2933
|
+
*/
|
|
2934
|
+
|
|
2935
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* SliderRange
|
|
2939
|
+
*
|
|
2940
|
+
* The (typically) highlighted portion of the track that represents the space
|
|
2941
|
+
* between the slider's `min` value and its current value.
|
|
2942
|
+
*
|
|
2943
|
+
* @see Docs https://reach.tech/slider#sliderrange
|
|
2944
|
+
*/
|
|
2945
|
+
const SliderRangeImpl = /*#__PURE__*/react.forwardRef(function SliderRange({
|
|
2946
|
+
as: Comp = 'div',
|
|
2947
|
+
children,
|
|
2948
|
+
style = {},
|
|
2949
|
+
...props
|
|
2950
|
+
}, forwardedRef) {
|
|
2951
|
+
const {
|
|
2952
|
+
disabled,
|
|
2953
|
+
orientation,
|
|
2954
|
+
rangeStyle
|
|
2955
|
+
} = useSliderContext('SliderRange');
|
|
2956
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2957
|
+
ref: forwardedRef,
|
|
2958
|
+
style: {
|
|
2959
|
+
position: 'absolute',
|
|
2960
|
+
...rangeStyle,
|
|
2961
|
+
...style
|
|
2962
|
+
},
|
|
2963
|
+
...props,
|
|
2964
|
+
"data-reach-slider-range": "",
|
|
2965
|
+
"data-disabled": disabled ? '' : undefined,
|
|
2966
|
+
"data-orientation": orientation
|
|
2411
2967
|
});
|
|
2412
2968
|
});
|
|
2969
|
+
const SliderRange = /*#__PURE__*/react.memo(SliderRangeImpl);
|
|
2970
|
+
/**
|
|
2971
|
+
* `SliderRange` accepts any props that a HTML div component accepts.
|
|
2972
|
+
* `SliderRange` will not accept or render any children.
|
|
2973
|
+
*
|
|
2974
|
+
* @see Docs https://reach.tech/slider#sliderrange-props
|
|
2975
|
+
*/
|
|
2976
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
2977
|
+
|
|
2978
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2979
|
+
|
|
2980
|
+
/**
|
|
2981
|
+
* SliderHandle
|
|
2982
|
+
*
|
|
2983
|
+
* The handle that the user drags along the track to set the slider value.
|
|
2984
|
+
*
|
|
2985
|
+
* @see Docs https://reach.tech/slider#sliderhandle
|
|
2986
|
+
*/
|
|
2987
|
+
const SliderHandleImpl = /*#__PURE__*/react.forwardRef(function SliderHandle({
|
|
2988
|
+
// min,
|
|
2989
|
+
// max,
|
|
2990
|
+
as: Comp = 'div',
|
|
2991
|
+
onBlur,
|
|
2992
|
+
onFocus,
|
|
2993
|
+
style = {},
|
|
2994
|
+
onKeyDown,
|
|
2995
|
+
...props
|
|
2996
|
+
}, forwardedRef) {
|
|
2997
|
+
const {
|
|
2998
|
+
ariaLabel,
|
|
2999
|
+
ariaLabelledBy,
|
|
3000
|
+
ariaValueText,
|
|
3001
|
+
disabled,
|
|
3002
|
+
handlePosition,
|
|
3003
|
+
handleRef,
|
|
3004
|
+
isVertical,
|
|
3005
|
+
handleKeyDown,
|
|
3006
|
+
orientation,
|
|
3007
|
+
setHasFocus,
|
|
3008
|
+
sliderMin,
|
|
3009
|
+
sliderMax,
|
|
3010
|
+
value
|
|
3011
|
+
} = useSliderContext('SliderHandle');
|
|
3012
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
3013
|
+
"aria-disabled": disabled || undefined // If the slider has a visible label, it is referenced by
|
|
3014
|
+
// `aria-labelledby` on the slider element. Otherwise, the slider
|
|
3015
|
+
// element has a label provided by `aria-label`.
|
|
3016
|
+
// https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props
|
|
3017
|
+
,
|
|
3018
|
+
"aria-label": ariaLabel,
|
|
3019
|
+
"aria-labelledby": ariaLabel ? undefined : ariaLabelledBy // If the slider is vertically oriented, it has `aria-orientation` set
|
|
3020
|
+
// to vertical. The default value of `aria-orientation` for a slider is
|
|
3021
|
+
// horizontal.
|
|
3022
|
+
// https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props
|
|
3023
|
+
,
|
|
3024
|
+
"aria-orientation": orientation // The slider element has the `aria-valuemax` property set to a decimal
|
|
3025
|
+
// value representing the maximum allowed value of the slider.
|
|
3026
|
+
// https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props
|
|
3027
|
+
,
|
|
3028
|
+
"aria-valuemax": sliderMax // The slider element has the `aria-valuemin` property set to a decimal
|
|
3029
|
+
// value representing the minimum allowed value of the slider.
|
|
3030
|
+
// https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props
|
|
3031
|
+
,
|
|
3032
|
+
"aria-valuemin": sliderMin // The slider element has the `aria-valuenow` property set to a decimal
|
|
3033
|
+
// value representing the current value of the slider.
|
|
3034
|
+
// https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props
|
|
3035
|
+
,
|
|
3036
|
+
"aria-valuenow": value // If the value of `aria-valuenow` is not user-friendly, e.g., the day
|
|
3037
|
+
// of the week is represented by a number, the `aria-valuetext` property
|
|
3038
|
+
// is set to a string that makes the slider value understandable, e.g.,
|
|
3039
|
+
// "Monday".
|
|
3040
|
+
// https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props
|
|
3041
|
+
,
|
|
3042
|
+
"aria-valuetext": ariaValueText // The element serving as the focusable slider control has role
|
|
3043
|
+
// `slider`.
|
|
3044
|
+
// https://www.w3.org/TR/wai-aria-practices-1.2/#slider_roles_states_props
|
|
3045
|
+
,
|
|
3046
|
+
role: "slider",
|
|
3047
|
+
tabIndex: disabled ? -1 : 0,
|
|
3048
|
+
...props,
|
|
3049
|
+
"data-reach-slider-handle": "",
|
|
3050
|
+
ref: assignMultipleRefs(handleRef, forwardedRef),
|
|
3051
|
+
onBlur: wrapEvent(onBlur, () => {
|
|
3052
|
+
setHasFocus(false);
|
|
3053
|
+
}),
|
|
3054
|
+
onFocus: wrapEvent(onFocus, () => {
|
|
3055
|
+
setHasFocus(true);
|
|
3056
|
+
}),
|
|
3057
|
+
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
3058
|
+
style: {
|
|
3059
|
+
position: 'absolute',
|
|
3060
|
+
...(isVertical ? {
|
|
3061
|
+
bottom: handlePosition
|
|
3062
|
+
} : {
|
|
3063
|
+
left: handlePosition
|
|
3064
|
+
}),
|
|
3065
|
+
...style
|
|
3066
|
+
}
|
|
3067
|
+
});
|
|
3068
|
+
});
|
|
3069
|
+
const SliderHandle = /*#__PURE__*/react.memo(SliderHandleImpl);
|
|
3070
|
+
/**
|
|
3071
|
+
* `SliderRange` accepts any props that a HTML div component accepts.
|
|
3072
|
+
*
|
|
3073
|
+
* @see Docs https://reach.tech/slider#sliderhandle-props
|
|
3074
|
+
*/
|
|
3075
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
3076
|
+
|
|
3077
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
3078
|
+
|
|
3079
|
+
/**
|
|
3080
|
+
* SliderMarker
|
|
3081
|
+
*
|
|
3082
|
+
* A fixed value marker. These can be used to illustrate a range of steps or
|
|
3083
|
+
* highlight important points along the slider track.
|
|
3084
|
+
*
|
|
3085
|
+
* @see Docs https://reach.tech/slider#slidermarker
|
|
3086
|
+
*/
|
|
3087
|
+
const SliderMarkerImpl = /*#__PURE__*/react.forwardRef(function SliderMarker({
|
|
3088
|
+
as: Comp = 'div',
|
|
3089
|
+
children,
|
|
3090
|
+
style = {},
|
|
3091
|
+
value,
|
|
3092
|
+
...props
|
|
3093
|
+
}, forwardedRef) {
|
|
3094
|
+
const {
|
|
3095
|
+
disabled,
|
|
3096
|
+
isVertical,
|
|
3097
|
+
orientation,
|
|
3098
|
+
sliderMin,
|
|
3099
|
+
sliderMax,
|
|
3100
|
+
value: sliderValue
|
|
3101
|
+
} = useSliderContext('SliderMarker');
|
|
3102
|
+
const inRange = !(value < sliderMin || value > sliderMax);
|
|
3103
|
+
const absoluteStartPosition = `${valueToPercent(value, sliderMin, sliderMax)}%`;
|
|
3104
|
+
const state = value < sliderValue ? 'under-value' : value === sliderValue ? 'at-value' : 'over-value';
|
|
3105
|
+
return inRange ? /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
3106
|
+
ref: forwardedRef,
|
|
3107
|
+
style: {
|
|
3108
|
+
position: 'absolute',
|
|
3109
|
+
...(isVertical ? {
|
|
3110
|
+
bottom: absoluteStartPosition
|
|
3111
|
+
} : {
|
|
3112
|
+
left: absoluteStartPosition
|
|
3113
|
+
}),
|
|
3114
|
+
...style
|
|
3115
|
+
},
|
|
3116
|
+
...props,
|
|
3117
|
+
"data-reach-slider-marker": "",
|
|
3118
|
+
"data-disabled": disabled ? '' : undefined,
|
|
3119
|
+
"data-orientation": orientation,
|
|
3120
|
+
"data-state": state,
|
|
3121
|
+
"data-value": value,
|
|
3122
|
+
children: children
|
|
3123
|
+
}) : null;
|
|
3124
|
+
});
|
|
3125
|
+
const SliderMarker = /*#__PURE__*/react.memo(SliderMarkerImpl);
|
|
3126
|
+
/**
|
|
3127
|
+
* @see Docs https://reach.tech/slider#slidermarker-props
|
|
3128
|
+
*/
|
|
3129
|
+
|
|
3130
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
3131
|
+
function clamp$1(val, min, max) {
|
|
3132
|
+
return val > max ? max : val < min ? min : val;
|
|
3133
|
+
}
|
|
3134
|
+
/**
|
|
3135
|
+
* This handles the case when num is very small (0.00000001), js will turn
|
|
3136
|
+
* this into 1e-8. When num is bigger than 1 or less than -1 it won't get
|
|
3137
|
+
* converted to this notation so it's fine.
|
|
3138
|
+
*
|
|
3139
|
+
* @param num
|
|
3140
|
+
* @see https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Slider/Slider.js#L69
|
|
3141
|
+
*/
|
|
3142
|
+
|
|
3143
|
+
|
|
3144
|
+
function getDecimalPrecision(num) {
|
|
3145
|
+
if (Math.abs(num) < 1) {
|
|
3146
|
+
const parts = num.toExponential().split('e-');
|
|
3147
|
+
const matissaDecimalPart = parts[0].split('.')[1];
|
|
3148
|
+
return (matissaDecimalPart ? matissaDecimalPart.length : 0) + parseInt(parts[1], 10);
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
const decimalPart = num.toString().split('.')[1];
|
|
3152
|
+
return decimalPart ? decimalPart.length : 0;
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
function percentToValue(percent, min, max) {
|
|
3156
|
+
return (max - min) * percent + min;
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
function roundValueToStep(value, step, min) {
|
|
3160
|
+
const nearest = Math.round((value - min) / step) * step + min;
|
|
3161
|
+
return Number(nearest.toFixed(getDecimalPrecision(step)));
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
function getPointerPosition(event, touchId) {
|
|
3165
|
+
if (touchId.current !== undefined && event.changedTouches) {
|
|
3166
|
+
for (let i = 0; i < event.changedTouches.length; i += 1) {
|
|
3167
|
+
const touch = event.changedTouches[i];
|
|
3168
|
+
|
|
3169
|
+
if (touch.identifier === touchId.current) {
|
|
3170
|
+
return {
|
|
3171
|
+
x: touch.clientX,
|
|
3172
|
+
y: touch.clientY
|
|
3173
|
+
};
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3177
|
+
return false;
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3180
|
+
return {
|
|
3181
|
+
x: event.clientX,
|
|
3182
|
+
y: event.clientY
|
|
3183
|
+
};
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
function getNewValue(handlePosition, track, props) {
|
|
3187
|
+
const {
|
|
3188
|
+
orientation,
|
|
3189
|
+
min,
|
|
3190
|
+
max,
|
|
3191
|
+
step
|
|
3192
|
+
} = props;
|
|
3193
|
+
|
|
3194
|
+
if (!track || !handlePosition) {
|
|
3195
|
+
return null;
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
const {
|
|
3199
|
+
left,
|
|
3200
|
+
width,
|
|
3201
|
+
bottom,
|
|
3202
|
+
height
|
|
3203
|
+
} = track.getBoundingClientRect();
|
|
3204
|
+
const isVertical = orientation === 'vertical';
|
|
3205
|
+
const diff = isVertical ? bottom - handlePosition.y : handlePosition.x - left;
|
|
3206
|
+
const percent = diff / (isVertical ? height : width);
|
|
3207
|
+
const newValue = percentToValue(percent, min, max);
|
|
3208
|
+
return clamp$1(step ? roundValueToStep(newValue, step, min) : newValue, min, max);
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
function useDimensions(ref) {
|
|
3212
|
+
const [{
|
|
3213
|
+
width,
|
|
3214
|
+
height
|
|
3215
|
+
}, setDimensions] = react.useState({
|
|
3216
|
+
width: 0,
|
|
3217
|
+
height: 0
|
|
3218
|
+
}); // Many existing `useDimensions` type hooks will use `getBoundingClientRect`
|
|
3219
|
+
// getBoundingClientRect does not work here when borders are applied.
|
|
3220
|
+
// getComputedStyle is not as performant so we may want to create a utility to
|
|
3221
|
+
// check for any conflicts with box sizing first and only use
|
|
3222
|
+
// `getComputedStyle` if neccessary.
|
|
3223
|
+
|
|
3224
|
+
/* const { width, height } = ref.current
|
|
3225
|
+
? ref.current.getBoundingClientRect()
|
|
3226
|
+
: 0; */
|
|
3227
|
+
|
|
3228
|
+
react.useLayoutEffect(() => {
|
|
3229
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3230
|
+
const ownerDocument = getOwnerDocument(ref.current);
|
|
3231
|
+
const ownerWindow = ownerDocument.defaultView || window;
|
|
3232
|
+
|
|
3233
|
+
if (ref.current) {
|
|
3234
|
+
const {
|
|
3235
|
+
height: _newHeight,
|
|
3236
|
+
width: _newWidth
|
|
3237
|
+
} = ownerWindow.getComputedStyle(ref.current);
|
|
3238
|
+
const newHeight = parseFloat(_newHeight);
|
|
3239
|
+
const newWidth = parseFloat(_newWidth);
|
|
3240
|
+
|
|
3241
|
+
if (newHeight !== height || newWidth !== width) {
|
|
3242
|
+
setDimensions({
|
|
3243
|
+
height: newHeight,
|
|
3244
|
+
width: newWidth
|
|
3245
|
+
});
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
}, [ref, width, height]);
|
|
3249
|
+
return {
|
|
3250
|
+
ref,
|
|
3251
|
+
width,
|
|
3252
|
+
height
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
function valueToPercent(value, min, max) {
|
|
3257
|
+
return (value - min) * 100 / (max - min);
|
|
3258
|
+
} ////////////////////////////////////////////////////////////////////////////////
|
|
2413
3259
|
|
|
2414
3260
|
const spinbuttonContext = /*#__PURE__*/react.createContext(null);
|
|
2415
3261
|
const {
|
|
@@ -2431,10 +3277,9 @@ const Spinner = /*#__PURE__*/react.forwardRef(function Spinner(props, forwardedR
|
|
|
2431
3277
|
onChange,
|
|
2432
3278
|
onKeyDown,
|
|
2433
3279
|
onBlur,
|
|
2434
|
-
onFocus
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
3280
|
+
onFocus,
|
|
3281
|
+
...otherProps
|
|
3282
|
+
} = props;
|
|
2438
3283
|
const [spinnerHasFocus, setSpinnerHasFocus] = react.useState(false);
|
|
2439
3284
|
const ref = react.useRef();
|
|
2440
3285
|
|
|
@@ -2500,7 +3345,7 @@ const Spinner = /*#__PURE__*/react.forwardRef(function Spinner(props, forwardedR
|
|
|
2500
3345
|
clamp: clamp$1,
|
|
2501
3346
|
spinnerHasFocus
|
|
2502
3347
|
},
|
|
2503
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
3348
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2504
3349
|
ref: assignMultipleRefs(forwardedRef, ref),
|
|
2505
3350
|
"data-spinner-root": "",
|
|
2506
3351
|
role: "spinbutton",
|
|
@@ -2510,8 +3355,9 @@ const Spinner = /*#__PURE__*/react.forwardRef(function Spinner(props, forwardedR
|
|
|
2510
3355
|
tabIndex: 0,
|
|
2511
3356
|
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
2512
3357
|
onFocus: wrapEvent(onFocus, handleFocus),
|
|
2513
|
-
onBlur: wrapEvent(onBlur, handleBlur)
|
|
2514
|
-
|
|
3358
|
+
onBlur: wrapEvent(onBlur, handleBlur),
|
|
3359
|
+
...otherProps
|
|
3360
|
+
})
|
|
2515
3361
|
});
|
|
2516
3362
|
});
|
|
2517
3363
|
|
|
@@ -2519,10 +3365,9 @@ const SpinnerButton = /*#__PURE__*/react.forwardRef(function SpinnerButton(props
|
|
|
2519
3365
|
const {
|
|
2520
3366
|
as: Comp = 'button',
|
|
2521
3367
|
type,
|
|
2522
|
-
onClick
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
3368
|
+
onClick,
|
|
3369
|
+
...otherProps
|
|
3370
|
+
} = props;
|
|
2526
3371
|
const spinnerContext = useSpinnerContext();
|
|
2527
3372
|
|
|
2528
3373
|
if (!spinnerContext) {
|
|
@@ -2535,7 +3380,7 @@ const SpinnerButton = /*#__PURE__*/react.forwardRef(function SpinnerButton(props
|
|
|
2535
3380
|
};
|
|
2536
3381
|
|
|
2537
3382
|
const disabled = type === 'next' ? spinnerContext.value + 1 > spinnerContext.maxValue : spinnerContext.value - 1 < spinnerContext.minValue;
|
|
2538
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
3383
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, { ...otherProps,
|
|
2539
3384
|
type: "button",
|
|
2540
3385
|
ref: forwardedRef,
|
|
2541
3386
|
tabIndex: -1,
|
|
@@ -2543,7 +3388,7 @@ const SpinnerButton = /*#__PURE__*/react.forwardRef(function SpinnerButton(props
|
|
|
2543
3388
|
"data-spinner-has-focus": spinnerContext.spinnerHasFocus ? '' : undefined,
|
|
2544
3389
|
disabled: disabled,
|
|
2545
3390
|
onClick: wrapEvent(onClick, handleClick)
|
|
2546
|
-
})
|
|
3391
|
+
});
|
|
2547
3392
|
});
|
|
2548
3393
|
|
|
2549
3394
|
const tabsContext = /*#__PURE__*/react.createContext(null);
|
|
@@ -2563,10 +3408,9 @@ const Tabs = /*#__PURE__*/react.forwardRef(function Tabs(props, forwardedRef) {
|
|
|
2563
3408
|
as: Comp = react.Fragment,
|
|
2564
3409
|
index: indexProp,
|
|
2565
3410
|
onChange: onChangeProp,
|
|
2566
|
-
defaultIndex = 0
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
3411
|
+
defaultIndex = 0,
|
|
3412
|
+
...otherProps
|
|
3413
|
+
} = props;
|
|
2570
3414
|
const [index, onChange] = useControlledState(indexProp, onChangeProp, defaultIndex, setState => (e, idx) => setState(idx));
|
|
2571
3415
|
const [tabListId, setTabListId] = react.useState(null);
|
|
2572
3416
|
return /*#__PURE__*/jsxRuntime.jsx(TabsProvider, {
|
|
@@ -2576,9 +3420,10 @@ const Tabs = /*#__PURE__*/react.forwardRef(function Tabs(props, forwardedRef) {
|
|
|
2576
3420
|
tabListId,
|
|
2577
3421
|
setTabListId
|
|
2578
3422
|
},
|
|
2579
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2580
|
-
ref: forwardedRef
|
|
2581
|
-
|
|
3423
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
3424
|
+
ref: forwardedRef,
|
|
3425
|
+
...otherProps
|
|
3426
|
+
})
|
|
2582
3427
|
});
|
|
2583
3428
|
});
|
|
2584
3429
|
|
|
@@ -2599,15 +3444,13 @@ function getNextIndex(desiredIndex, delta, allTabs) {
|
|
|
2599
3444
|
}
|
|
2600
3445
|
|
|
2601
3446
|
const Tab = /*#__PURE__*/react.forwardRef(function Tab(props, forwardedRef) {
|
|
2602
|
-
const
|
|
2603
|
-
{
|
|
3447
|
+
const {
|
|
2604
3448
|
as: Comp = 'button',
|
|
2605
3449
|
onKeyDown,
|
|
2606
3450
|
onClick,
|
|
2607
|
-
index: tabIndex = -1
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
3451
|
+
index: tabIndex = -1,
|
|
3452
|
+
...otherProps
|
|
3453
|
+
} = props;
|
|
2611
3454
|
const tabContext = useTabsContext();
|
|
2612
3455
|
const tabListContext = useTabListContext();
|
|
2613
3456
|
const ref = react.useRef(undefined);
|
|
@@ -2662,7 +3505,7 @@ const Tab = /*#__PURE__*/react.forwardRef(function Tab(props, forwardedRef) {
|
|
|
2662
3505
|
};
|
|
2663
3506
|
|
|
2664
3507
|
const isSelected = tabIndex === tabContext.currentIndex;
|
|
2665
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
3508
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, { ...otherProps,
|
|
2666
3509
|
ref: assignMultipleRefs(ref, forwardedRef),
|
|
2667
3510
|
"data-tab": "",
|
|
2668
3511
|
id: tabContext.tabListId !== null && tabIndex >= 0 ? `tab-${tabContext.tabListId}-${tabIndex}` : undefined,
|
|
@@ -2673,7 +3516,7 @@ const Tab = /*#__PURE__*/react.forwardRef(function Tab(props, forwardedRef) {
|
|
|
2673
3516
|
selected: isSelected,
|
|
2674
3517
|
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
2675
3518
|
onClick: wrapEvent(onClick, handleClick)
|
|
2676
|
-
})
|
|
3519
|
+
});
|
|
2677
3520
|
});
|
|
2678
3521
|
|
|
2679
3522
|
const TabList = /*#__PURE__*/react.forwardRef(function TabList(props, forwardedRef) {
|
|
@@ -2681,10 +3524,9 @@ const TabList = /*#__PURE__*/react.forwardRef(function TabList(props, forwardedR
|
|
|
2681
3524
|
as: Comp = 'div',
|
|
2682
3525
|
manualActivation = false,
|
|
2683
3526
|
vertical = false,
|
|
2684
|
-
children: childrenProps
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
3527
|
+
children: childrenProps,
|
|
3528
|
+
...otherProps
|
|
3529
|
+
} = props;
|
|
2688
3530
|
const ref = react.useRef();
|
|
2689
3531
|
const tabsScope = useScope(ref);
|
|
2690
3532
|
const tabsContext = useTabsContext();
|
|
@@ -2713,13 +3555,13 @@ const TabList = /*#__PURE__*/react.forwardRef(function TabList(props, forwardedR
|
|
|
2713
3555
|
manualActivation,
|
|
2714
3556
|
vertical
|
|
2715
3557
|
},
|
|
2716
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
3558
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2717
3559
|
ref: assignMultipleRefs(forwardedRef, ref),
|
|
2718
3560
|
"data-tab-list": "",
|
|
2719
|
-
role: "tablist"
|
|
2720
|
-
|
|
3561
|
+
role: "tablist",
|
|
3562
|
+
...otherProps,
|
|
2721
3563
|
children: children
|
|
2722
|
-
})
|
|
3564
|
+
})
|
|
2723
3565
|
});
|
|
2724
3566
|
});
|
|
2725
3567
|
|
|
@@ -2727,31 +3569,28 @@ const TabPanels = /*#__PURE__*/react.forwardRef(function TabPanels(props, forwar
|
|
|
2727
3569
|
const {
|
|
2728
3570
|
as: Comp = react.Fragment,
|
|
2729
3571
|
children: childrenProps,
|
|
2730
|
-
lazy
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
3572
|
+
lazy,
|
|
3573
|
+
...otherProps
|
|
3574
|
+
} = props;
|
|
2734
3575
|
const children = react.Children.map(childrenProps, (node, index) => /*#__PURE__*/react.cloneElement(node, {
|
|
2735
3576
|
index,
|
|
2736
3577
|
lazy
|
|
2737
3578
|
}));
|
|
2738
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
2739
|
-
ref: forwardedRef
|
|
2740
|
-
|
|
3579
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
3580
|
+
ref: forwardedRef,
|
|
3581
|
+
...otherProps,
|
|
2741
3582
|
children: children
|
|
2742
|
-
})
|
|
3583
|
+
});
|
|
2743
3584
|
});
|
|
2744
3585
|
|
|
2745
3586
|
const TabPanel = /*#__PURE__*/react.forwardRef(function TabPanel(props, forwardedRef) {
|
|
2746
|
-
const
|
|
2747
|
-
{
|
|
3587
|
+
const {
|
|
2748
3588
|
as: Comp = 'div',
|
|
2749
3589
|
index,
|
|
2750
3590
|
lazy = false,
|
|
2751
|
-
children
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
3591
|
+
children,
|
|
3592
|
+
...otherProps
|
|
3593
|
+
} = props;
|
|
2755
3594
|
const tabsContext = useTabsContext();
|
|
2756
3595
|
|
|
2757
3596
|
if (!tabsContext) {
|
|
@@ -2759,17 +3598,17 @@ const TabPanel = /*#__PURE__*/react.forwardRef(function TabPanel(props, forwarde
|
|
|
2759
3598
|
}
|
|
2760
3599
|
|
|
2761
3600
|
const isSelected = tabsContext.currentIndex === index;
|
|
2762
|
-
return /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
3601
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
2763
3602
|
ref: forwardedRef,
|
|
2764
3603
|
"data-tab-panel": "",
|
|
2765
3604
|
role: "tabpanel",
|
|
2766
3605
|
id: tabsContext.tabListId !== null ? `tabpanel-${tabsContext.tabListId}-${index}` : undefined,
|
|
2767
3606
|
"aria-labelledby": tabsContext.tabListId !== null ? `tab-${tabsContext.tabListId}-${index}` : undefined,
|
|
2768
3607
|
hidden: isSelected ? undefined : 'hidden',
|
|
2769
|
-
tabIndex: 0
|
|
2770
|
-
|
|
3608
|
+
tabIndex: 0,
|
|
3609
|
+
...otherProps,
|
|
2771
3610
|
children: (isSelected || !lazy) && children
|
|
2772
|
-
})
|
|
3611
|
+
});
|
|
2773
3612
|
});
|
|
2774
3613
|
|
|
2775
3614
|
function createSubscription() {
|
|
@@ -2799,26 +3638,26 @@ function createSubscription() {
|
|
|
2799
3638
|
let restTimeout;
|
|
2800
3639
|
|
|
2801
3640
|
function startRestTimer() {
|
|
2802
|
-
|
|
2803
|
-
restTimeout =
|
|
3641
|
+
clearTimeout(restTimeout);
|
|
3642
|
+
restTimeout = setTimeout(() => {
|
|
2804
3643
|
send(Rest, undefined);
|
|
2805
3644
|
}, 200);
|
|
2806
3645
|
}
|
|
2807
3646
|
|
|
2808
3647
|
function clearRestTimer() {
|
|
2809
|
-
|
|
3648
|
+
clearTimeout(restTimeout);
|
|
2810
3649
|
} // Manages the delay to hide the tooltip after rest leaves.
|
|
2811
3650
|
|
|
2812
3651
|
|
|
2813
3652
|
let leavingVisibleTimer;
|
|
2814
3653
|
|
|
2815
3654
|
function startLeavingVisibleTimer() {
|
|
2816
|
-
|
|
2817
|
-
leavingVisibleTimer =
|
|
3655
|
+
clearTimeout(leavingVisibleTimer);
|
|
3656
|
+
leavingVisibleTimer = setTimeout(() => send(TimeComplete, undefined), 100);
|
|
2818
3657
|
}
|
|
2819
3658
|
|
|
2820
3659
|
function clearLeavingVisibleTimer() {
|
|
2821
|
-
|
|
3660
|
+
clearTimeout(leavingVisibleTimer);
|
|
2822
3661
|
} ////////////////////////////////////////////////////////////////////////////////
|
|
2823
3662
|
// State machine
|
|
2824
3663
|
|
|
@@ -2917,11 +3756,9 @@ const chart = {
|
|
|
2917
3756
|
};
|
|
2918
3757
|
|
|
2919
3758
|
function transition(currentState, event, payload) {
|
|
2920
|
-
var _stateDef$on;
|
|
2921
|
-
|
|
2922
3759
|
const currentStateValue = currentState.state;
|
|
2923
3760
|
const stateDef = chart.states[currentState.state];
|
|
2924
|
-
const nextState = stateDef
|
|
3761
|
+
const nextState = stateDef?.on?.[event]; // Really useful for debugging
|
|
2925
3762
|
// console.log({
|
|
2926
3763
|
// event,
|
|
2927
3764
|
// state: state.current.state,
|
|
@@ -2944,9 +3781,10 @@ function transition(currentState, event, payload) {
|
|
|
2944
3781
|
nextDef.enter(nextStateValue, payload);
|
|
2945
3782
|
}
|
|
2946
3783
|
|
|
2947
|
-
return
|
|
3784
|
+
return { ...currentState,
|
|
3785
|
+
...payload,
|
|
2948
3786
|
state: nextStateValue
|
|
2949
|
-
}
|
|
3787
|
+
};
|
|
2950
3788
|
}
|
|
2951
3789
|
|
|
2952
3790
|
function send(event, payload) {
|
|
@@ -3023,16 +3861,15 @@ function useTooltip(childProps, childRef, tooltipProps) {
|
|
|
3023
3861
|
label: children,
|
|
3024
3862
|
onMouseEnter: tooltipOnMouseEnter,
|
|
3025
3863
|
onMouseLeave: tooltipOnMouseLeave,
|
|
3026
|
-
onMouseMove: tooltipOnMouseMove
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3864
|
+
onMouseMove: tooltipOnMouseMove,
|
|
3865
|
+
...otherTooltipProps
|
|
3866
|
+
} = tooltipProps;
|
|
3030
3867
|
const tooltipId = `tooltip-${id}`;
|
|
3031
|
-
return [
|
|
3032
|
-
ref: assignMultipleRefs(childRef, anchorEl)
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3868
|
+
return [{ ...childProps,
|
|
3869
|
+
ref: assignMultipleRefs(childRef, anchorEl),
|
|
3870
|
+
...(visible && !childProps['aria-label'] && {
|
|
3871
|
+
'aria-describedby': tooltipId
|
|
3872
|
+
}),
|
|
3036
3873
|
onMouseEnter: wrapEvent(onMouseEnter, handleMouseEnter),
|
|
3037
3874
|
onMouseLeave: wrapEvent(onMouseLeave, handleMouseLeave),
|
|
3038
3875
|
onMouseMove: wrapEvent(onMouseMove, handleMouseMove),
|
|
@@ -3040,7 +3877,7 @@ function useTooltip(childProps, childRef, tooltipProps) {
|
|
|
3040
3877
|
onFocus: wrapEvent(onFocus, handleFocus),
|
|
3041
3878
|
onBlur: wrapEvent(onBlur, handleBlur),
|
|
3042
3879
|
onKeyDown: wrapEvent(onKeyDown, handleKeyDown)
|
|
3043
|
-
}
|
|
3880
|
+
}, {
|
|
3044
3881
|
id: tooltipId,
|
|
3045
3882
|
anchorEl,
|
|
3046
3883
|
visible,
|
|
@@ -3048,8 +3885,9 @@ function useTooltip(childProps, childRef, tooltipProps) {
|
|
|
3048
3885
|
onMouseEnter: wrapEvent(tooltipOnMouseEnter, handleMouseEnter),
|
|
3049
3886
|
onMouseLeave: wrapEvent(tooltipOnMouseLeave, handleMouseLeave),
|
|
3050
3887
|
onMouseMove: wrapEvent(tooltipOnMouseMove, handleMouseMove),
|
|
3051
|
-
role: 'tooltip'
|
|
3052
|
-
|
|
3888
|
+
role: 'tooltip',
|
|
3889
|
+
...otherTooltipProps
|
|
3890
|
+
}];
|
|
3053
3891
|
}
|
|
3054
3892
|
|
|
3055
3893
|
const Tooltip = /*#__PURE__*/react.forwardRef(function Tooltip(props, forwardedRef) {
|
|
@@ -3057,17 +3895,14 @@ const Tooltip = /*#__PURE__*/react.forwardRef(function Tooltip(props, forwardedR
|
|
|
3057
3895
|
as: Comp = 'div',
|
|
3058
3896
|
innerAs,
|
|
3059
3897
|
children,
|
|
3060
|
-
disabled = false
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3898
|
+
disabled = false,
|
|
3899
|
+
...otherProps
|
|
3900
|
+
} = props;
|
|
3064
3901
|
const child = react.Children.only(children);
|
|
3065
|
-
const [childProps,
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
} = _ref,
|
|
3070
|
-
tooltipProps = _objectWithoutPropertiesLoose__default['default'](_ref, ["visible"]);
|
|
3902
|
+
const [childProps, {
|
|
3903
|
+
visible,
|
|
3904
|
+
...tooltipProps
|
|
3905
|
+
}] = useTooltip(child.props, child.ref, otherProps);
|
|
3071
3906
|
|
|
3072
3907
|
if (disabled) {
|
|
3073
3908
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
@@ -3076,10 +3911,11 @@ const Tooltip = /*#__PURE__*/react.forwardRef(function Tooltip(props, forwardedR
|
|
|
3076
3911
|
}
|
|
3077
3912
|
|
|
3078
3913
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3079
|
-
children: [/*#__PURE__*/react.cloneElement(child, childProps), visible && /*#__PURE__*/jsxRuntime.jsx(Comp,
|
|
3914
|
+
children: [/*#__PURE__*/react.cloneElement(child, childProps), visible && /*#__PURE__*/jsxRuntime.jsx(Comp, {
|
|
3080
3915
|
as: innerAs,
|
|
3081
|
-
ref: forwardedRef
|
|
3082
|
-
|
|
3916
|
+
ref: forwardedRef,
|
|
3917
|
+
...tooltipProps
|
|
3918
|
+
})]
|
|
3083
3919
|
});
|
|
3084
3920
|
});
|
|
3085
3921
|
|
|
@@ -3110,6 +3946,12 @@ exports.PopperProvider = PopperProvider;
|
|
|
3110
3946
|
exports.Portal = Portal;
|
|
3111
3947
|
exports.RadioButton = RadioButton;
|
|
3112
3948
|
exports.RadioGroup = RadioGroup;
|
|
3949
|
+
exports.Slider = Slider;
|
|
3950
|
+
exports.SliderHandle = SliderHandle;
|
|
3951
|
+
exports.SliderInput = SliderInput;
|
|
3952
|
+
exports.SliderMarker = SliderMarker;
|
|
3953
|
+
exports.SliderRange = SliderRange;
|
|
3954
|
+
exports.SliderTrack = SliderTrack;
|
|
3113
3955
|
exports.Spinner = Spinner;
|
|
3114
3956
|
exports.SpinnerButton = SpinnerButton;
|
|
3115
3957
|
exports.Tab = Tab;
|
|
@@ -3120,10 +3962,14 @@ exports.Tabs = Tabs;
|
|
|
3120
3962
|
exports.Tooltip = Tooltip;
|
|
3121
3963
|
exports.assignMultipleRefs = assignMultipleRefs;
|
|
3122
3964
|
exports.assignRef = assignRef;
|
|
3965
|
+
exports.canUseDOM = canUseDOM;
|
|
3966
|
+
exports.createContext = createContext;
|
|
3123
3967
|
exports.gestureHandlers = gestureHandlers;
|
|
3124
3968
|
exports.getCircularIndex = getCircularIndex;
|
|
3969
|
+
exports.getOwnerDocument = getOwnerDocument;
|
|
3125
3970
|
exports.getScope = getScope;
|
|
3126
3971
|
exports.initialGestureHandlersState = initialGestureHandlersState;
|
|
3972
|
+
exports.isRightClick = isRightClick;
|
|
3127
3973
|
exports.rubberBand = rubberBand;
|
|
3128
3974
|
exports.rubberBandClamp = rubberBandClamp;
|
|
3129
3975
|
exports.useAutoFocus = useAutoFocus;
|
|
@@ -3141,6 +3987,8 @@ exports.usePopperContext = usePopperContext;
|
|
|
3141
3987
|
exports.useReducerMachine = useReducerMachine;
|
|
3142
3988
|
exports.useRemoveBodyScroll = useRemoveBodyScroll;
|
|
3143
3989
|
exports.useScope = useScope;
|
|
3990
|
+
exports.useStableCallback = useStableCallback;
|
|
3991
|
+
exports.useStableLayoutCallback = useStableLayoutCallback;
|
|
3144
3992
|
exports.useThrottle = useThrottle;
|
|
3145
3993
|
exports.wrapEvent = wrapEvent;
|
|
3146
3994
|
//# sourceMappingURL=index.js.map
|