@basic-ui/core 0.0.53 → 0.0.54
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/README.md +3 -3
- package/build/cjs/index.js +88 -88
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Accordion/Accordion.d.ts +9 -9
- package/build/esm/Accordion/Accordion.js.map +1 -1
- package/build/esm/Accordion/AccordionBody.d.ts +6 -6
- package/build/esm/Accordion/AccordionBody.js.map +1 -1
- package/build/esm/Accordion/AccordionHeader.d.ts +7 -7
- package/build/esm/Accordion/AccordionHeader.js.map +1 -1
- package/build/esm/Accordion/AccordionItem.d.ts +9 -9
- package/build/esm/Accordion/AccordionItem.js.map +1 -1
- package/build/esm/Accordion/context.d.ts +19 -19
- package/build/esm/Accordion/context.js.map +1 -1
- package/build/esm/Accordion/index.d.ts +4 -4
- package/build/esm/Accordion/index.js.map +1 -1
- package/build/esm/Accordion/scopeQuery.d.ts +2 -2
- package/build/esm/Accordion/scopeQuery.js.map +1 -1
- package/build/esm/CheckBox/CheckBox.d.ts +7 -7
- package/build/esm/CheckBox/CheckBox.js.map +1 -1
- package/build/esm/CheckBox/index.d.ts +1 -1
- package/build/esm/CheckBox/index.js.map +1 -1
- package/build/esm/ComboBox/Combobox.d.ts +18 -18
- package/build/esm/ComboBox/Combobox.js.map +1 -1
- package/build/esm/ComboBox/ComboboxButton.d.ts +9 -9
- package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
- package/build/esm/ComboBox/ComboboxInput.d.ts +17 -17
- package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
- package/build/esm/ComboBox/ComboboxLabel.d.ts +7 -7
- package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
- package/build/esm/ComboBox/ComboboxList.d.ts +8 -8
- package/build/esm/ComboBox/ComboboxList.js.map +1 -1
- package/build/esm/ComboBox/ComboboxOption.d.ts +11 -11
- package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
- package/build/esm/ComboBox/ComboboxPopover.d.ts +9 -9
- package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
- package/build/esm/ComboBox/cities.d.ts +5 -5
- package/build/esm/ComboBox/cities.js.map +1 -1
- package/build/esm/ComboBox/context.d.ts +30 -30
- package/build/esm/ComboBox/context.js.map +1 -1
- package/build/esm/ComboBox/hooks.d.ts +37 -37
- package/build/esm/ComboBox/hooks.js.map +1 -1
- package/build/esm/ComboBox/index.d.ts +8 -8
- package/build/esm/ComboBox/index.js.map +1 -1
- package/build/esm/ComboBox/makeHash.d.ts +1 -1
- package/build/esm/ComboBox/makeHash.js.map +1 -1
- package/build/esm/ComboBox/scopeQuery.d.ts +1 -1
- package/build/esm/ComboBox/scopeQuery.js.map +1 -1
- package/build/esm/FocusLock/FocusLock.d.ts +9 -9
- package/build/esm/FocusLock/FocusLock.js.map +1 -1
- package/build/esm/FocusLock/index.d.ts +1 -1
- package/build/esm/FocusLock/index.js.map +1 -1
- package/build/esm/FocusLock/tabUtils.d.ts +3 -3
- package/build/esm/FocusLock/tabUtils.js.map +1 -1
- package/build/esm/FocusLock/useFocusLock.d.ts +7 -7
- package/build/esm/FocusLock/useFocusLock.js.map +1 -1
- package/build/esm/List/List.d.ts +7 -7
- package/build/esm/List/List.js.map +1 -1
- package/build/esm/List/ListItem.d.ts +7 -7
- package/build/esm/List/ListItem.js.map +1 -1
- package/build/esm/List/context.d.ts +4 -4
- package/build/esm/List/context.js.map +1 -1
- package/build/esm/List/index.d.ts +2 -2
- package/build/esm/List/index.js.map +1 -1
- package/build/esm/Menu/ContextMenuTrigger.d.ts +11 -11
- package/build/esm/Menu/ContextMenuTrigger.js.map +1 -1
- package/build/esm/Menu/Menu.d.ts +10 -10
- package/build/esm/Menu/Menu.js.map +1 -1
- package/build/esm/Menu/MenuButton.d.ts +11 -11
- package/build/esm/Menu/MenuButton.js.map +1 -1
- package/build/esm/Menu/MenuItem.d.ts +8 -8
- package/build/esm/Menu/MenuItem.js.map +1 -1
- package/build/esm/Menu/MenuList.d.ts +7 -7
- package/build/esm/Menu/MenuList.js.map +1 -1
- package/build/esm/Menu/MenuPopover.d.ts +8 -8
- package/build/esm/Menu/MenuPopover.js.map +1 -1
- package/build/esm/Menu/context.d.ts +25 -25
- package/build/esm/Menu/context.js.map +1 -1
- package/build/esm/Menu/fixtures/countryList.d.ts +1 -1
- package/build/esm/Menu/fixtures/countryList.js.map +1 -1
- package/build/esm/Menu/index.d.ts +6 -6
- package/build/esm/Menu/index.js.map +1 -1
- package/build/esm/Menu/scope.d.ts +1 -1
- package/build/esm/Menu/scope.js.map +1 -1
- package/build/esm/Modal/Modal.d.ts +9 -9
- package/build/esm/Modal/Modal.js.map +1 -1
- package/build/esm/Modal/ModalBackdrop.d.ts +10 -10
- package/build/esm/Modal/ModalBackdrop.js.map +1 -1
- package/build/esm/Modal/index.d.ts +2 -2
- package/build/esm/Modal/index.js.map +1 -1
- package/build/esm/Popper/Popper.d.ts +35 -35
- package/build/esm/Popper/Popper.js +1 -2
- package/build/esm/Popper/Popper.js.map +1 -1
- package/build/esm/Popper/PopperArrow.d.ts +6 -6
- package/build/esm/Popper/PopperArrow.js.map +1 -1
- package/build/esm/Popper/context.d.ts +6 -6
- package/build/esm/Popper/context.js.map +1 -1
- package/build/esm/Popper/index.d.ts +3 -3
- package/build/esm/Popper/index.js.map +1 -1
- package/build/esm/Portal/Portal.d.ts +7 -7
- package/build/esm/Portal/PortalSelectorProvider.d.ts +8 -8
- package/build/esm/Portal/index.d.ts +2 -2
- package/build/esm/RadioButton/RadioButton.d.ts +10 -10
- package/build/esm/RadioButton/RadioButton.js.map +1 -1
- package/build/esm/RadioButton/RadioGroup.d.ts +12 -12
- package/build/esm/RadioButton/RadioGroup.js.map +1 -1
- package/build/esm/RadioButton/context.d.ts +9 -9
- package/build/esm/RadioButton/context.js.map +1 -1
- package/build/esm/RadioButton/index.d.ts +2 -2
- package/build/esm/RadioButton/index.js.map +1 -1
- package/build/esm/SkipNav/SkipNav.d.ts +7 -7
- package/build/esm/SkipNav/SkipNav.js.map +1 -1
- package/build/esm/SkipNav/index.d.ts +1 -1
- package/build/esm/SkipNav/index.js.map +1 -1
- package/build/esm/Slider/Slider.d.ts +197 -197
- package/build/esm/Slider/Slider.js +82 -82
- package/build/esm/Slider/Slider.js.map +1 -1
- package/build/esm/Slider/index.d.ts +1 -1
- package/build/esm/Slider/index.js.map +1 -1
- package/build/esm/Spinner/Spinner.d.ts +12 -12
- package/build/esm/Spinner/Spinner.js.map +1 -1
- package/build/esm/Spinner/SpinnerButton.d.ts +8 -8
- package/build/esm/Spinner/SpinnerButton.js.map +1 -1
- package/build/esm/Spinner/context.d.ts +12 -12
- package/build/esm/Spinner/context.js.map +1 -1
- package/build/esm/Spinner/index.d.ts +2 -2
- package/build/esm/Spinner/index.js.map +1 -1
- package/build/esm/Tabs/Tab.d.ts +7 -7
- package/build/esm/Tabs/Tab.js.map +1 -1
- package/build/esm/Tabs/TabList.d.ts +9 -9
- package/build/esm/Tabs/TabList.js.map +1 -1
- package/build/esm/Tabs/TabPanel.d.ts +8 -8
- package/build/esm/Tabs/TabPanel.js.map +1 -1
- package/build/esm/Tabs/TabPanels.d.ts +8 -8
- package/build/esm/Tabs/TabPanels.js.map +1 -1
- package/build/esm/Tabs/Tabs.d.ts +10 -10
- package/build/esm/Tabs/Tabs.js.map +1 -1
- package/build/esm/Tabs/context.d.ts +17 -17
- package/build/esm/Tabs/context.js.map +1 -1
- package/build/esm/Tabs/index.d.ts +5 -5
- package/build/esm/Tabs/index.js.map +1 -1
- package/build/esm/Tabs/scopeQuery.d.ts +1 -1
- package/build/esm/Tabs/scopeQuery.js.map +1 -1
- package/build/esm/Tooltip/Tooltip.d.ts +10 -10
- package/build/esm/Tooltip/Tooltip.js.map +1 -1
- package/build/esm/Tooltip/index.d.ts +1 -1
- package/build/esm/Tooltip/index.js.map +1 -1
- package/build/esm/Tooltip/stateMachine.d.ts +28 -28
- package/build/esm/Tooltip/stateMachine.js.map +1 -1
- package/build/esm/Tooltip/useTooltip.d.ts +10 -10
- package/build/esm/Tooltip/useTooltip.js.map +1 -1
- package/build/esm/hooks/index.d.ts +13 -13
- package/build/esm/hooks/index.js.map +1 -1
- package/build/esm/hooks/useAutoFocus.d.ts +2 -2
- package/build/esm/hooks/useAutoFocus.js.map +1 -1
- package/build/esm/hooks/useChildrenCounter.d.ts +7 -7
- package/build/esm/hooks/useChildrenCounter.js.map +1 -1
- package/build/esm/hooks/useControlledState.d.ts +3 -3
- package/build/esm/hooks/useFocusReturn.d.ts +2 -2
- package/build/esm/hooks/useFocusReturn.js.map +1 -1
- package/build/esm/hooks/useFocusState.d.ts +11 -11
- package/build/esm/hooks/useFocusState.js.map +1 -1
- package/build/esm/hooks/useGestureHandlers.d.ts +52 -52
- package/build/esm/hooks/useGestureHandlers.js.map +1 -1
- package/build/esm/hooks/useMeasure.d.ts +7 -7
- package/build/esm/hooks/useMeasure.js.map +1 -1
- package/build/esm/hooks/useOnClickOutside.d.ts +2 -2
- package/build/esm/hooks/useOnClickOutside.js.map +1 -1
- package/build/esm/hooks/useOnKeyDown.d.ts +1 -1
- package/build/esm/hooks/useOnKeyDown.js.map +1 -1
- package/build/esm/hooks/useReducerMachine.d.ts +24 -24
- package/build/esm/hooks/useReducerMachine.js.map +1 -1
- package/build/esm/hooks/useRemoveBodyScroll.d.ts +2 -2
- package/build/esm/hooks/useRemoveBodyScroll.js.map +1 -1
- package/build/esm/hooks/useScope.d.ts +11 -11
- package/build/esm/hooks/useScope.js.map +1 -1
- package/build/esm/hooks/useThrottle.d.ts +1 -1
- package/build/esm/hooks/useThrottle.js.map +1 -1
- package/build/esm/index.d.ts +15 -15
- package/build/esm/index.js.map +1 -1
- package/build/esm/utils/assign-ref.d.ts +3 -3
- package/build/esm/utils/assign-ref.js.map +1 -1
- package/build/esm/utils/can-use-dom.d.ts +1 -1
- package/build/esm/utils/can-use-dom.js.map +1 -1
- package/build/esm/utils/clamp.d.ts +1 -1
- package/build/esm/utils/clamp.js.map +1 -1
- package/build/esm/utils/context.d.ts +7 -7
- package/build/esm/utils/context.js.map +1 -1
- package/build/esm/utils/create-subscription.d.ts +4 -4
- package/build/esm/utils/create-subscription.js.map +1 -1
- package/build/esm/utils/get-circular-index.d.ts +1 -1
- package/build/esm/utils/get-circular-index.js.map +1 -1
- package/build/esm/utils/index.d.ts +10 -10
- package/build/esm/utils/index.js.map +1 -1
- package/build/esm/utils/is-right-click.d.ts +6 -6
- package/build/esm/utils/is-right-click.js +4 -4
- package/build/esm/utils/is-right-click.js.map +1 -1
- package/build/esm/utils/owner-document.d.ts +7 -7
- package/build/esm/utils/owner-document.js +5 -5
- package/build/esm/utils/owner-document.js.map +1 -1
- package/build/esm/utils/polymorphic.d.ts +39 -39
- package/build/esm/utils/polymorphic.js.map +1 -1
- package/build/esm/utils/rubber-band-clamp.d.ts +2 -2
- package/build/esm/utils/rubber-band-clamp.js.map +1 -1
- package/build/esm/utils/use-stable-callback.d.ts +16 -16
- package/build/esm/utils/use-stable-callback.js +16 -16
- package/build/esm/utils/use-stable-callback.js.map +1 -1
- package/build/esm/utils/wrap-event.d.ts +3 -3
- package/build/esm/utils/wrap-event.js.map +1 -1
- package/build/tsconfig-build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Accordion/Accordion.story.tsx +74 -74
- package/src/Accordion/Accordion.tsx +59 -59
- package/src/Accordion/AccordionBody.tsx +52 -52
- package/src/Accordion/AccordionHeader.tsx +167 -167
- package/src/Accordion/AccordionItem.tsx +50 -50
- package/src/Accordion/context.ts +37 -37
- package/src/Accordion/index.ts +4 -4
- package/src/Accordion/scopeQuery.ts +7 -7
- package/src/Accordion/styles.css +21 -21
- package/src/CheckBox/CheckBox.tsx +41 -41
- package/src/CheckBox/index.ts +1 -1
- package/src/ComboBox/ComboBox.story.tsx +120 -120
- package/src/ComboBox/Combobox.tsx +148 -148
- package/src/ComboBox/ComboboxButton.tsx +61 -61
- package/src/ComboBox/ComboboxInput.tsx +187 -187
- package/src/ComboBox/ComboboxLabel.tsx +33 -33
- package/src/ComboBox/ComboboxList.tsx +47 -47
- package/src/ComboBox/ComboboxOption.tsx +111 -111
- package/src/ComboBox/ComboboxPopover.tsx +64 -64
- package/src/ComboBox/cities.ts +23194 -23194
- package/src/ComboBox/context.ts +35 -35
- package/src/ComboBox/hooks.tsx +451 -451
- package/src/ComboBox/index.ts +8 -8
- package/src/ComboBox/makeHash.ts +19 -19
- package/src/ComboBox/scopeQuery.ts +6 -6
- package/src/ComboBox/styles.css +32 -32
- package/src/FocusLock/FocusLock.tsx +66 -66
- package/src/FocusLock/index.ts +1 -1
- package/src/FocusLock/tabUtils.ts +40 -40
- package/src/FocusLock/useFocusLock.ts +56 -56
- package/src/List/List.story.tsx +18 -18
- package/src/List/List.tsx +17 -17
- package/src/List/ListItem.tsx +23 -23
- package/src/List/context.ts +19 -19
- package/src/List/index.ts +2 -2
- package/src/Menu/ContextMenu.story.tsx +73 -73
- package/src/Menu/ContextMenuTrigger.tsx +76 -76
- package/src/Menu/Menu.story.tsx +160 -160
- package/src/Menu/Menu.tsx +83 -83
- package/src/Menu/MenuButton.tsx +83 -83
- package/src/Menu/MenuComplex.story.tsx +58 -58
- package/src/Menu/MenuItem.tsx +88 -88
- package/src/Menu/MenuList.tsx +254 -254
- package/src/Menu/MenuPopover.tsx +35 -35
- package/src/Menu/context.ts +44 -44
- package/src/Menu/fixtures/countryList.ts +198 -198
- package/src/Menu/index.ts +6 -6
- package/src/Menu/scope.ts +7 -7
- package/src/Menu/styles.css +42 -42
- package/src/Modal/Modal.story.tsx +258 -258
- package/src/Modal/Modal.tsx +48 -48
- package/src/Modal/ModalBackdrop.tsx +78 -78
- package/src/Modal/NavDrawer.story.tsx +158 -158
- package/src/Modal/index.ts +2 -2
- package/src/Modal/styles.css +46 -46
- package/src/Popper/Popper.story.tsx +263 -263
- package/src/Popper/Popper.tsx +1 -1
- package/src/Popper/PopperArrow.tsx +35 -35
- package/src/Popper/context.ts +10 -10
- package/src/Popper/index.ts +3 -3
- package/src/Popper/styles.css +60 -60
- package/src/RadioButton/RadioButton.story.tsx +77 -77
- package/src/RadioButton/RadioButton.tsx +55 -55
- package/src/RadioButton/RadioGroup.tsx +60 -60
- package/src/RadioButton/context.ts +17 -17
- package/src/RadioButton/index.ts +2 -2
- package/src/SkipNav/SkipNav.tsx +16 -16
- package/src/SkipNav/index.tsx +1 -1
- package/src/Slider/Slider.story.tsx +45 -45
- package/src/Slider/Slider.tsx +1120 -1120
- package/src/Slider/index.ts +1 -1
- package/src/Slider/styles.css +131 -131
- package/src/Spinner/Spinner.story.tsx +31 -31
- package/src/Spinner/Spinner.tsx +117 -117
- package/src/Spinner/SpinnerButton.tsx +54 -54
- package/src/Spinner/context.ts +20 -20
- package/src/Spinner/index.ts +2 -2
- package/src/Spinner/styles.css +23 -23
- package/src/Tabs/Tab.story.tsx +80 -80
- package/src/Tabs/Tab.tsx +136 -136
- package/src/Tabs/TabList.tsx +71 -71
- package/src/Tabs/TabPanel.tsx +53 -53
- package/src/Tabs/TabPanels.tsx +30 -30
- package/src/Tabs/Tabs.tsx +46 -46
- package/src/Tabs/context.ts +30 -30
- package/src/Tabs/index.tsx +5 -5
- package/src/Tabs/scopeQuery.ts +6 -6
- package/src/Tooltip/Tooltip.story.tsx +61 -61
- package/src/Tooltip/Tooltip.tsx +50 -50
- package/src/Tooltip/index.ts +1 -1
- package/src/Tooltip/stateMachine.ts +192 -192
- package/src/Tooltip/styles.css +17 -17
- package/src/Tooltip/useTooltip.ts +136 -136
- package/src/hooks/index.ts +13 -13
- package/src/hooks/useAutoFocus.ts +22 -22
- package/src/hooks/useChildrenCounter.ts +51 -51
- package/src/hooks/useFocusReturn.ts +43 -43
- package/src/hooks/useFocusState.ts +30 -30
- package/src/hooks/useGestureHandlers.ts +286 -286
- package/src/hooks/useMeasure.ts +33 -33
- package/src/hooks/useOnClickOutside.ts +32 -32
- package/src/hooks/useOnKeyDown.ts +19 -19
- package/src/hooks/useReducerMachine.ts +60 -60
- package/src/hooks/useRemoveBodyScroll.ts +39 -39
- package/src/hooks/useScope.ts +52 -52
- package/src/hooks/useThrottle.ts +19 -19
- package/src/index.ts +20 -20
- package/src/utils/assign-ref.ts +27 -27
- package/src/utils/can-use-dom.ts +7 -7
- package/src/utils/clamp.ts +3 -3
- package/src/utils/context.tsx +48 -48
- package/src/utils/create-subscription.ts +16 -16
- package/src/utils/get-circular-index.ts +7 -7
- package/src/utils/index.ts +10 -10
- package/src/utils/is-right-click.ts +14 -14
- package/src/utils/owner-document.ts +13 -13
- package/src/utils/polymorphic.ts +78 -78
- package/src/utils/rubber-band-clamp.ts +25 -25
- package/src/utils/use-stable-callback.ts +58 -58
- package/src/utils/wrap-event.ts +22 -22
- package/build/esm/Carousel/Carousel.d.ts +0 -9
- package/build/esm/Carousel/Carousel.js +0 -38
- package/build/esm/Carousel/Carousel.js.map +0 -1
- package/build/esm/Carousel/Fader.d.ts +0 -14
- package/build/esm/Carousel/Fader.js +0 -76
- package/build/esm/Carousel/Fader.js.map +0 -1
- package/build/esm/Carousel/FaderItem.d.ts +0 -5
- package/build/esm/Carousel/FaderItem.js +0 -16
- package/build/esm/Carousel/FaderItem.js.map +0 -1
- package/build/esm/Carousel/Preloader.d.ts +0 -7
- package/build/esm/Carousel/Preloader.js +0 -70
- package/build/esm/Carousel/Preloader.js.map +0 -1
- package/build/esm/Carousel/Slider.d.ts +0 -14
- package/build/esm/Carousel/Slider.js +0 -212
- package/build/esm/Carousel/Slider.js.map +0 -1
- package/build/esm/Carousel/SliderItem.d.ts +0 -12
- package/build/esm/Carousel/SliderItem.js +0 -41
- package/build/esm/Carousel/SliderItem.js.map +0 -1
- package/build/esm/Carousel/context.d.ts +0 -10
- package/build/esm/Carousel/context.js +0 -8
- package/build/esm/Carousel/context.js.map +0 -1
- package/build/esm/Carousel/getSliderParams.d.ts +0 -9
- package/build/esm/Carousel/getSliderParams.js +0 -85
- package/build/esm/Carousel/getSliderParams.js.map +0 -1
- package/build/esm/Carousel/index.d.ts +0 -7
- package/build/esm/Carousel/index.js +0 -8
- package/build/esm/Carousel/index.js.map +0 -1
- package/build/esm/Carousel/useCarouselGestures.d.ts +0 -30
- package/build/esm/Carousel/useCarouselGestures.js +0 -33
- package/build/esm/Carousel/useCarouselGestures.js.map +0 -1
- package/build/esm/DatePicker/DatePicker.d.ts +0 -24
- package/build/esm/DatePicker/DatePicker.js +0 -101
- package/build/esm/DatePicker/DatePicker.js.map +0 -1
- package/build/esm/DatePicker/DatePickerSelect.d.ts +0 -8
- package/build/esm/DatePicker/DatePickerSelect.js +0 -201
- package/build/esm/DatePicker/DatePickerSelect.js.map +0 -1
- package/build/esm/DatePicker/RangeDatePicker.d.ts +0 -28
- package/build/esm/DatePicker/RangeDatePicker.js +0 -94
- package/build/esm/DatePicker/RangeDatePicker.js.map +0 -1
- package/build/esm/DatePicker/adjustDates.d.ts +0 -4
- package/build/esm/DatePicker/adjustDates.js +0 -18
- package/build/esm/DatePicker/adjustDates.js.map +0 -1
- package/build/esm/DatePicker/contexts.d.ts +0 -31
- package/build/esm/DatePicker/contexts.js +0 -15
- package/build/esm/DatePicker/contexts.js.map +0 -1
- package/build/esm/DatePicker/dateTypes.d.ts +0 -2
- package/build/esm/DatePicker/dateTypes.js +0 -2
- package/build/esm/DatePicker/dateTypes.js.map +0 -1
- package/build/esm/DatePicker/hooks.d.ts +0 -36
- package/build/esm/DatePicker/hooks.js +0 -98
- package/build/esm/DatePicker/hooks.js.map +0 -1
- package/build/esm/DatePicker/index.d.ts +0 -5
- package/build/esm/DatePicker/index.js +0 -6
- package/build/esm/DatePicker/index.js.map +0 -1
- package/build/esm/hooks/useId.d.ts +0 -1
- package/build/esm/hooks/useId.js +0 -25
- package/build/esm/hooks/useId.js.map +0 -1
- package/build/esm/utils/assignRef.d.ts +0 -3
- package/build/esm/utils/assignRef.js +0 -25
- package/build/esm/utils/assignRef.js.map +0 -1
- package/build/esm/utils/getCircularIndex.d.ts +0 -1
- package/build/esm/utils/getCircularIndex.js +0 -8
- package/build/esm/utils/getCircularIndex.js.map +0 -1
- package/build/esm/utils/rubberBandClamp.d.ts +0 -2
- package/build/esm/utils/rubberBandClamp.js +0 -20
- package/build/esm/utils/rubberBandClamp.js.map +0 -1
- package/build/esm/utils/wrapEvent.d.ts +0 -3
- package/build/esm/utils/wrapEvent.js +0 -16
- package/build/esm/utils/wrapEvent.js.map +0 -1
- package/build/tsconfig.tsbuildinfo +0 -7270
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import type { MutableRefObject } from 'react';
|
|
2
|
-
import type { ActionTypes, StateTypes, ReducerState } from './hooks';
|
|
3
|
-
import type { SelectEventHandler } from './Combobox';
|
|
4
|
-
import type { Scope } from '../hooks';
|
|
5
|
-
export interface ComboBoxContextProps {
|
|
6
|
-
data: Omit<ReducerState, 'state'>;
|
|
7
|
-
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
8
|
-
popoverRef: MutableRefObject<HTMLDivElement | null>;
|
|
9
|
-
buttonRef: MutableRefObject<HTMLButtonElement | null>;
|
|
10
|
-
onSelect?: SelectEventHandler;
|
|
11
|
-
optionsRef: MutableRefObject<{
|
|
12
|
-
[itemId: string]: {
|
|
13
|
-
value: string | unknown;
|
|
14
|
-
text: string;
|
|
15
|
-
};
|
|
16
|
-
}>;
|
|
17
|
-
listScope: Scope<HTMLElement>;
|
|
18
|
-
state: StateTypes;
|
|
19
|
-
transition: (action: ActionTypes, payload?: any) => void;
|
|
20
|
-
listboxIdRef: MutableRefObject<string | undefined>;
|
|
21
|
-
labelIdRef: MutableRefObject<string | undefined>;
|
|
22
|
-
autocompletePropRef: MutableRefObject<boolean>;
|
|
23
|
-
persistSelectionRef: MutableRefObject<boolean>;
|
|
24
|
-
clearOnEscapeRef: MutableRefObject<boolean>;
|
|
25
|
-
isVisible: boolean;
|
|
26
|
-
openOnFocus: boolean;
|
|
27
|
-
selectOnBlur: boolean;
|
|
28
|
-
}
|
|
29
|
-
export declare const ComboBoxProvider: import("react").Provider<ComboBoxContextProps>;
|
|
30
|
-
export declare const useComboBoxContext: () => ComboBoxContextProps;
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { ActionTypes, StateTypes, ReducerState } from './hooks';
|
|
3
|
+
import type { SelectEventHandler } from './Combobox';
|
|
4
|
+
import type { Scope } from '../hooks';
|
|
5
|
+
export interface ComboBoxContextProps {
|
|
6
|
+
data: Omit<ReducerState, 'state'>;
|
|
7
|
+
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
8
|
+
popoverRef: MutableRefObject<HTMLDivElement | null>;
|
|
9
|
+
buttonRef: MutableRefObject<HTMLButtonElement | null>;
|
|
10
|
+
onSelect?: SelectEventHandler;
|
|
11
|
+
optionsRef: MutableRefObject<{
|
|
12
|
+
[itemId: string]: {
|
|
13
|
+
value: string | unknown;
|
|
14
|
+
text: string;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
listScope: Scope<HTMLElement>;
|
|
18
|
+
state: StateTypes;
|
|
19
|
+
transition: (action: ActionTypes, payload?: any) => void;
|
|
20
|
+
listboxIdRef: MutableRefObject<string | undefined>;
|
|
21
|
+
labelIdRef: MutableRefObject<string | undefined>;
|
|
22
|
+
autocompletePropRef: MutableRefObject<boolean>;
|
|
23
|
+
persistSelectionRef: MutableRefObject<boolean>;
|
|
24
|
+
clearOnEscapeRef: MutableRefObject<boolean>;
|
|
25
|
+
isVisible: boolean;
|
|
26
|
+
openOnFocus: boolean;
|
|
27
|
+
selectOnBlur: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare const ComboBoxProvider: import("react").Provider<ComboBoxContextProps>;
|
|
30
|
+
export declare const useComboBoxContext: () => ComboBoxContextProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":["createContext","useContext","comboboxContext","ComboBoxProvider","Provider","useComboBoxContext"],"sources":["../../../src/ComboBox/context.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { createContext, useContext } from 'react';\n\nimport type { ActionTypes, StateTypes, ReducerState } from './hooks';\nimport type { SelectEventHandler } from './Combobox';\nimport type { Scope } from '../hooks';\n\nexport interface ComboBoxContextProps {\n data: Omit<ReducerState, 'state'>;\n inputRef: MutableRefObject<HTMLInputElement | null>;\n popoverRef: MutableRefObject<HTMLDivElement | null>;\n buttonRef: MutableRefObject<HTMLButtonElement | null>;\n onSelect?: SelectEventHandler;\n optionsRef: MutableRefObject<{\n [itemId: string]: {\n value: string | unknown;\n text: string;\n };\n }>;\n listScope: Scope<HTMLElement>;\n state: StateTypes;\n transition: (action: ActionTypes, payload?: any) => void;\n listboxIdRef: MutableRefObject<string | undefined>;\n labelIdRef: MutableRefObject<string | undefined>;\n autocompletePropRef: MutableRefObject<boolean>;\n persistSelectionRef: MutableRefObject<boolean>;\n clearOnEscapeRef: MutableRefObject<boolean>;\n isVisible: boolean;\n openOnFocus: boolean;\n selectOnBlur: boolean;\n}\n\nconst comboboxContext = createContext<ComboBoxContextProps>(null as any);\nexport const { Provider: ComboBoxProvider } = comboboxContext;\nexport const useComboBoxContext = () => useContext(comboboxContext);\n"],"mappings":"AACA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AA+BA,IAAMC,eAAe,gBAAGF,aAAa,CAAuB,IAAvB,CAArC;AACO,IAAkBG,gBAAlB,GAAuCD,eAAvC,CAAQE,QAAR;;AACP,OAAO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB;EAAA,OAAMJ,UAAU,CAACC,eAAD,CAAhB;AAAA,CAA3B"}
|
|
1
|
+
{"version":3,"file":"context.js","names":["createContext","useContext","comboboxContext","ComboBoxProvider","Provider","useComboBoxContext"],"sources":["../../../src/ComboBox/context.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\r\nimport { createContext, useContext } from 'react';\r\n\r\nimport type { ActionTypes, StateTypes, ReducerState } from './hooks';\r\nimport type { SelectEventHandler } from './Combobox';\r\nimport type { Scope } from '../hooks';\r\n\r\nexport interface ComboBoxContextProps {\r\n data: Omit<ReducerState, 'state'>;\r\n inputRef: MutableRefObject<HTMLInputElement | null>;\r\n popoverRef: MutableRefObject<HTMLDivElement | null>;\r\n buttonRef: MutableRefObject<HTMLButtonElement | null>;\r\n onSelect?: SelectEventHandler;\r\n optionsRef: MutableRefObject<{\r\n [itemId: string]: {\r\n value: string | unknown;\r\n text: string;\r\n };\r\n }>;\r\n listScope: Scope<HTMLElement>;\r\n state: StateTypes;\r\n transition: (action: ActionTypes, payload?: any) => void;\r\n listboxIdRef: MutableRefObject<string | undefined>;\r\n labelIdRef: MutableRefObject<string | undefined>;\r\n autocompletePropRef: MutableRefObject<boolean>;\r\n persistSelectionRef: MutableRefObject<boolean>;\r\n clearOnEscapeRef: MutableRefObject<boolean>;\r\n isVisible: boolean;\r\n openOnFocus: boolean;\r\n selectOnBlur: boolean;\r\n}\r\n\r\nconst comboboxContext = createContext<ComboBoxContextProps>(null as any);\r\nexport const { Provider: ComboBoxProvider } = comboboxContext;\r\nexport const useComboBoxContext = () => useContext(comboboxContext);\r\n"],"mappings":"AACA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AA+BA,IAAMC,eAAe,gBAAGF,aAAa,CAAuB,IAAvB,CAArC;AACO,IAAkBG,gBAAlB,GAAuCD,eAAvC,CAAQE,QAAR;;AACP,OAAO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB;EAAA,OAAMJ,UAAU,CAACC,eAAD,CAAhB;AAAA,CAA3B"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { KeyboardEvent, MutableRefObject } from 'react';
|
|
2
|
-
import type { StateChart as GenericStateChart, StateMachineState } from '../hooks/useReducerMachine';
|
|
3
|
-
export declare const IDLE = "IDLE";
|
|
4
|
-
declare const SUGGESTING = "SUGGESTING";
|
|
5
|
-
export declare const NAVIGATING = "NAVIGATING";
|
|
6
|
-
export declare type StateTypes = typeof IDLE | typeof SUGGESTING | typeof NAVIGATING;
|
|
7
|
-
export declare const INIT = "INIT";
|
|
8
|
-
export declare const CLEAR = "CLEAR";
|
|
9
|
-
export declare const CLEAR_SELECTION = "CLEAR_SELECTION";
|
|
10
|
-
export declare const CHANGE = "CHANGE";
|
|
11
|
-
export declare const NAVIGATE = "NAVIGATE";
|
|
12
|
-
declare const SELECT_WITH_KEYBOARD = "SELECT_WITH_KEYBOARD";
|
|
13
|
-
export declare const SELECT_WITH_CLICK = "SELECT_WITH_CLICK";
|
|
14
|
-
declare const ESCAPE = "ESCAPE";
|
|
15
|
-
declare const BLUR = "BLUR";
|
|
16
|
-
export declare const FOCUS = "FOCUS";
|
|
17
|
-
export declare const OPEN_WITH_BUTTON = "OPEN_WITH_BUTTON";
|
|
18
|
-
export declare const CLOSE_WITH_BUTTON = "CLOSE_WITH_BUTTON";
|
|
19
|
-
export declare type ActionTypes = typeof CLEAR | typeof CLEAR_SELECTION | typeof CHANGE | typeof INIT | typeof NAVIGATE | typeof SELECT_WITH_KEYBOARD | typeof SELECT_WITH_CLICK | typeof ESCAPE | typeof BLUR | typeof FOCUS | typeof OPEN_WITH_BUTTON | typeof CLOSE_WITH_BUTTON;
|
|
20
|
-
export declare const stateChart: GenericStateChart<StateTypes, ActionTypes>;
|
|
21
|
-
export interface ReducerState extends StateMachineState<StateTypes, ActionTypes> {
|
|
22
|
-
item: string;
|
|
23
|
-
navigationItem: string;
|
|
24
|
-
text: string;
|
|
25
|
-
}
|
|
26
|
-
interface ActionObject {
|
|
27
|
-
type: ActionTypes;
|
|
28
|
-
state: StateTypes;
|
|
29
|
-
nextState: StateTypes;
|
|
30
|
-
[rest: string]: any;
|
|
31
|
-
}
|
|
32
|
-
export declare function comboboxReducer(data: Readonly<ReducerState>, action: ActionObject): ReducerState;
|
|
33
|
-
export declare const isVisible: (state: any) => boolean;
|
|
34
|
-
export declare function useFocusManagement(lastActionType: ActionTypes, inputRef: MutableRefObject<HTMLInputElement | null>): void;
|
|
35
|
-
export declare function useKeyDown(): (event: KeyboardEvent<any>) => void;
|
|
36
|
-
export declare function useBlur(): () => void;
|
|
37
|
-
export {};
|
|
1
|
+
import type { KeyboardEvent, MutableRefObject } from 'react';
|
|
2
|
+
import type { StateChart as GenericStateChart, StateMachineState } from '../hooks/useReducerMachine';
|
|
3
|
+
export declare const IDLE = "IDLE";
|
|
4
|
+
declare const SUGGESTING = "SUGGESTING";
|
|
5
|
+
export declare const NAVIGATING = "NAVIGATING";
|
|
6
|
+
export declare type StateTypes = typeof IDLE | typeof SUGGESTING | typeof NAVIGATING;
|
|
7
|
+
export declare const INIT = "INIT";
|
|
8
|
+
export declare const CLEAR = "CLEAR";
|
|
9
|
+
export declare const CLEAR_SELECTION = "CLEAR_SELECTION";
|
|
10
|
+
export declare const CHANGE = "CHANGE";
|
|
11
|
+
export declare const NAVIGATE = "NAVIGATE";
|
|
12
|
+
declare const SELECT_WITH_KEYBOARD = "SELECT_WITH_KEYBOARD";
|
|
13
|
+
export declare const SELECT_WITH_CLICK = "SELECT_WITH_CLICK";
|
|
14
|
+
declare const ESCAPE = "ESCAPE";
|
|
15
|
+
declare const BLUR = "BLUR";
|
|
16
|
+
export declare const FOCUS = "FOCUS";
|
|
17
|
+
export declare const OPEN_WITH_BUTTON = "OPEN_WITH_BUTTON";
|
|
18
|
+
export declare const CLOSE_WITH_BUTTON = "CLOSE_WITH_BUTTON";
|
|
19
|
+
export declare type ActionTypes = typeof CLEAR | typeof CLEAR_SELECTION | typeof CHANGE | typeof INIT | typeof NAVIGATE | typeof SELECT_WITH_KEYBOARD | typeof SELECT_WITH_CLICK | typeof ESCAPE | typeof BLUR | typeof FOCUS | typeof OPEN_WITH_BUTTON | typeof CLOSE_WITH_BUTTON;
|
|
20
|
+
export declare const stateChart: GenericStateChart<StateTypes, ActionTypes>;
|
|
21
|
+
export interface ReducerState extends StateMachineState<StateTypes, ActionTypes> {
|
|
22
|
+
item: string;
|
|
23
|
+
navigationItem: string;
|
|
24
|
+
text: string;
|
|
25
|
+
}
|
|
26
|
+
interface ActionObject {
|
|
27
|
+
type: ActionTypes;
|
|
28
|
+
state: StateTypes;
|
|
29
|
+
nextState: StateTypes;
|
|
30
|
+
[rest: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export declare function comboboxReducer(data: Readonly<ReducerState>, action: ActionObject): ReducerState;
|
|
33
|
+
export declare const isVisible: (state: any) => boolean;
|
|
34
|
+
export declare function useFocusManagement(lastActionType: ActionTypes, inputRef: MutableRefObject<HTMLInputElement | null>): void;
|
|
35
|
+
export declare function useKeyDown(): (event: KeyboardEvent<any>) => void;
|
|
36
|
+
export declare function useBlur(): () => void;
|
|
37
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","names":["useEffect","getCircularIndex","useComboBoxContext","scopeQuery","IDLE","SUGGESTING","NAVIGATING","INIT","CLEAR","CLEAR_SELECTION","CHANGE","NAVIGATE","SELECT_WITH_KEYBOARD","SELECT_WITH_CLICK","ESCAPE","BLUR","FOCUS","OPEN_WITH_BUTTON","CLOSE_WITH_BUTTON","stateChart","initial","states","on","comboboxReducer","data","action","nextState","state","lastActionType","type","text","navigationItem","item","persistSelection","Error","visibleStates","isVisible","indexOf","useFocusManagement","inputRef","current","focus","getNextItem","currentItem","key","optionsItems","autocomplete","jumpToStartOrEnd","incr","index","findIndex","n","String","id","optionsLen","length","nextIndex","useKeyDown","onSelect","optionsRef","transition","autocompletePropRef","clearOnEscapeRef","persistSelectionRef","listScope","handleKeyDown","event","optionNodes","queryAllNodes","preventDefault","nextItem","scrollIntoView","behavior","block","value","lastValue","tracker","_valueTracker","setValue","Event","bubbles","dispatchEvent","navigationValue","navigationText","useBlur","stateText","popoverRef","buttonRef","selectOnBlur","handleBlur","requestAnimationFrame","document","activeElement","contains"],"sources":["../../../src/ComboBox/hooks.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable default-case */\nimport type { KeyboardEvent, MutableRefObject } from 'react';\nimport { useEffect } from 'react';\n\nimport type {\n StateChart as GenericStateChart,\n StateMachineState,\n} from '../hooks/useReducerMachine';\nimport { getCircularIndex } from '../utils/get-circular-index';\nimport { useComboBoxContext } from './context';\nimport { scopeQuery } from './scopeQuery';\n\n////////////////////////////////////////////////////////////////////////////////\n// States\n\n// Nothing going on, waiting for the user to type or use the arrow keys\nexport const IDLE = 'IDLE';\n\n// The component is suggesting options as the user types\nconst SUGGESTING = 'SUGGESTING';\n\n// The user is using the keyboard to navigate the list, not typing\nexport const NAVIGATING = 'NAVIGATING';\n\nexport type StateTypes = typeof IDLE | typeof SUGGESTING | typeof NAVIGATING;\n\n////////////////////////////////////////////////////////////////////////////////\n// Actions:\n\n// Used to sync the state with controlled state, right after mounting\nexport const INIT = 'INIT';\n\n// User cleared the value w/ backspace, but input still has focus\nexport const CLEAR = 'CLEAR';\n\n// User cleared the value w/ backspace, but input still has focus\nexport const CLEAR_SELECTION = 'CLEAR_SELECTION';\n\n// User is typing\nexport const CHANGE = 'CHANGE';\n\n// User is navigating w/ the keyboard\nexport const NAVIGATE = 'NAVIGATE';\n\n// User can be navigating with keyboard and then click instead, we want the\n// value from the click, not the current nav item\nconst SELECT_WITH_KEYBOARD = 'SELECT_WITH_KEYBOARD';\nexport const SELECT_WITH_CLICK = 'SELECT_WITH_CLICK';\n\n// Pretty self-explanatory, user can hit escape or blur to close the popover\nconst ESCAPE = 'ESCAPE';\nconst BLUR = 'BLUR';\n\nexport const FOCUS = 'FOCUS';\n\nexport const OPEN_WITH_BUTTON = 'OPEN_WITH_BUTTON';\n\nexport const CLOSE_WITH_BUTTON = 'CLOSE_WITH_BUTTON';\n\nexport type ActionTypes =\n | typeof CLEAR\n | typeof CLEAR_SELECTION\n | typeof CHANGE\n | typeof INIT\n | typeof NAVIGATE\n | typeof SELECT_WITH_KEYBOARD\n | typeof SELECT_WITH_CLICK\n | typeof ESCAPE\n | typeof BLUR\n | typeof FOCUS\n | typeof OPEN_WITH_BUTTON\n | typeof CLOSE_WITH_BUTTON;\n\n////////////////////////////////////////////////////////////////////////////////\nexport const stateChart: GenericStateChart<StateTypes, ActionTypes> = {\n initial: IDLE,\n states: {\n [IDLE]: {\n on: {\n [BLUR]: IDLE,\n [CLEAR]: IDLE,\n [INIT]: IDLE,\n [CLEAR_SELECTION]: IDLE,\n [CHANGE]: SUGGESTING,\n [FOCUS]: SUGGESTING,\n [NAVIGATE]: NAVIGATING,\n [OPEN_WITH_BUTTON]: SUGGESTING,\n },\n },\n [SUGGESTING]: {\n on: {\n [CHANGE]: SUGGESTING,\n [FOCUS]: SUGGESTING,\n [INIT]: SUGGESTING,\n [NAVIGATE]: NAVIGATING,\n [CLEAR]: IDLE,\n [CLEAR_SELECTION]: SUGGESTING,\n [ESCAPE]: IDLE,\n [BLUR]: IDLE,\n [SELECT_WITH_CLICK]: IDLE,\n [CLOSE_WITH_BUTTON]: IDLE,\n },\n },\n [NAVIGATING]: {\n on: {\n [CHANGE]: SUGGESTING,\n [FOCUS]: SUGGESTING,\n [INIT]: NAVIGATING,\n [CLEAR]: IDLE,\n [CLEAR_SELECTION]: NAVIGATING,\n [BLUR]: IDLE,\n [ESCAPE]: IDLE,\n [NAVIGATE]: NAVIGATING,\n [SELECT_WITH_KEYBOARD]: IDLE,\n [SELECT_WITH_CLICK]: IDLE,\n [CLOSE_WITH_BUTTON]: IDLE,\n },\n },\n },\n};\n\nexport interface ReducerState\n extends StateMachineState<StateTypes, ActionTypes> {\n item: string;\n navigationItem: string;\n text: string;\n}\n\ninterface ActionObject {\n type: ActionTypes;\n state: StateTypes;\n nextState: StateTypes;\n [rest: string]: any;\n}\n\nexport function comboboxReducer(\n data: Readonly<ReducerState>,\n action: ActionObject\n): ReducerState {\n const nextState = {\n ...data,\n state: action.nextState,\n lastActionType: action.type,\n };\n\n switch (action.type) {\n case INIT:\n case CHANGE:\n return {\n ...nextState,\n text: action.text,\n navigationItem: '',\n item: '',\n };\n case NAVIGATE:\n case OPEN_WITH_BUTTON:\n if (action.persistSelection) {\n return {\n ...nextState,\n navigationItem: data.item,\n };\n }\n\n return {\n ...nextState,\n navigationItem: action.item,\n };\n case CLEAR_SELECTION:\n return {\n ...nextState,\n navigationItem: '',\n };\n case CLEAR:\n return {\n ...nextState,\n text: '',\n navigationItem: '',\n item: '',\n };\n case BLUR:\n return {\n ...nextState,\n text: action.text,\n navigationItem: '',\n item: action.item,\n };\n case CLOSE_WITH_BUTTON:\n case ESCAPE:\n return {\n ...nextState,\n navigationItem: '',\n item: '',\n };\n case SELECT_WITH_CLICK:\n case SELECT_WITH_KEYBOARD:\n return {\n ...nextState,\n text: action.text,\n item: action.item,\n navigationItem: '',\n };\n case FOCUS:\n return {\n ...nextState,\n navigationItem: action.item,\n };\n\n default:\n throw new Error(`Unknown action ${action.type}`);\n }\n}\n\nconst visibleStates = [SUGGESTING, NAVIGATING];\nexport const isVisible = (state: any) => visibleStates.indexOf(state) >= 0;\n\n////////////////////////////////////////////////////////////////////////////////\n// The rest is all implementation details\n\n// Move focus back to the input if we start navigating w/ the\n// keyboard after focus has moved to any focusable content in\n// the popup.\nexport function useFocusManagement(\n lastActionType: ActionTypes,\n inputRef: MutableRefObject<HTMLInputElement | null>\n) {\n // useEffect so that the cursor goes to the end of the input instead\n // of awkwardly at the beginning, unclear to me why ...\n useEffect(() => {\n if (\n lastActionType === NAVIGATE ||\n lastActionType === ESCAPE ||\n lastActionType === SELECT_WITH_CLICK ||\n lastActionType === OPEN_WITH_BUTTON\n ) {\n inputRef.current && inputRef.current.focus();\n }\n });\n}\n\nfunction getNextItem(\n currentItem: string,\n key: 'ArrowDown' | 'ArrowUp' | 'PageDown' | 'PageUp' | 'Home' | 'End',\n optionsItems: HTMLElement[],\n autocomplete: boolean\n): HTMLElement | null {\n const jumpToStartOrEnd = key === 'Home' || key === 'End';\n let incr = 1;\n switch (key) {\n case 'PageUp':\n incr = -10;\n break;\n case 'PageDown':\n incr = 10;\n break;\n case 'End':\n case 'ArrowUp':\n incr = -1;\n break;\n case 'Home':\n case 'ArrowDown':\n incr = 1;\n break;\n }\n\n const index =\n currentItem === ''\n ? -1\n : optionsItems.findIndex((n) => String(n.id) === currentItem);\n\n const optionsLen = optionsItems.length;\n\n // Nothing selected, either go to start, or end\n if (index < 0 || jumpToStartOrEnd) {\n if (incr > 0) {\n // Go to start\n return optionsItems[0];\n } else {\n // Go to end\n return optionsItems[optionsLen - 1];\n }\n } else if (autocomplete) {\n const nextIndex = index + incr;\n\n if (nextIndex < 0 || nextIndex >= optionsLen) {\n // Next is outside the bounds of list, return nothing selected\n return null;\n }\n }\n\n // I'm sure it won't be null, we already check optionsLen above\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return optionsItems[getCircularIndex(index + incr, optionsLen)!];\n}\n\n// We want the same events when the input or the popup have focus (HOW COOL ARE\n// HOOKS BTW?) This is probably the hairiest piece but it's not bad.\nexport function useKeyDown() {\n const {\n data: { text, navigationItem },\n onSelect,\n optionsRef,\n inputRef,\n state,\n transition,\n autocompletePropRef,\n clearOnEscapeRef,\n persistSelectionRef,\n listScope,\n } = useComboBoxContext();\n\n return function handleKeyDown(event: KeyboardEvent<any>) {\n const optionNodes = listScope.current.queryAllNodes(scopeQuery);\n\n switch (event.key) {\n case 'Home':\n case 'End':\n case 'PageUp':\n case 'PageDown':\n case 'ArrowUp':\n case 'ArrowDown': {\n // Don't scroll the page\n event.preventDefault();\n\n const optionsLen = optionNodes.length;\n\n // If the developer didn't render any options, there's no point in\n // trying to navigate--but seriously what the heck? Give us some\n // options fam.\n if (optionsLen === 0) {\n return;\n }\n\n if (state === IDLE) {\n // Opening a closed list\n transition(NAVIGATE, {\n persistSelection: persistSelectionRef.current,\n });\n } else {\n // When autocompletting, we'll not cycle through the list directly\n const autocomplete = autocompletePropRef.current;\n\n // Get next selected item\n const nextItem = getNextItem(\n navigationItem,\n event.key,\n optionNodes,\n autocomplete\n );\n\n if (nextItem !== null) {\n nextItem.scrollIntoView({ behavior: 'auto', block: 'nearest' });\n transition(NAVIGATE, {\n value: optionsRef.current[nextItem.id].text,\n item: nextItem.id,\n });\n } else {\n transition(NAVIGATE, { value: null, item: '' });\n }\n }\n break;\n }\n case 'Escape': {\n if (state !== IDLE) {\n transition(ESCAPE);\n } else if (state === IDLE && text !== '') {\n if (!inputRef.current || !clearOnEscapeRef.current) {\n break;\n }\n\n // emulate a inputRef change event, might not work in future versions of React\n const lastValue = inputRef.current.value;\n inputRef.current.value = '';\n\n const tracker = (inputRef.current as any)._valueTracker;\n if (tracker) {\n tracker.setValue(lastValue);\n }\n\n const event = new Event('change', { bubbles: true });\n inputRef.current.dispatchEvent(event);\n }\n break;\n }\n case 'Enter': {\n if (state === NAVIGATING && navigationItem !== '') {\n const { value: navigationValue, text: navigationText } =\n optionsRef.current[navigationItem];\n\n // don't want to submit forms\n event.preventDefault();\n onSelect && onSelect(navigationText, navigationItem, navigationValue);\n transition(SELECT_WITH_KEYBOARD, {\n text: navigationText,\n item: navigationItem,\n });\n }\n break;\n }\n }\n };\n}\n\nexport function useBlur() {\n const {\n data: { navigationItem, text: stateText },\n transition,\n optionsRef,\n popoverRef,\n inputRef,\n buttonRef,\n onSelect,\n selectOnBlur, // not implemented yet\n } = useComboBoxContext();\n\n return function handleBlur() {\n requestAnimationFrame(() => {\n // we on want to close only if focus rests outside the combobox\n if (\n document.activeElement !== inputRef.current &&\n document.activeElement !== buttonRef.current &&\n popoverRef.current\n ) {\n if (popoverRef.current.contains(document.activeElement)) {\n // focus landed inside the combobox, keep it open\n // in the future, we can make it not close, select, or anything\n // this way we can have like... checkboxes available in the\n // menu item, etc.\n } else {\n // focus landed outside the combobox, close it.\n if (!selectOnBlur || navigationItem === '') {\n // we don't wanna select on blur, or navigationIndex is invalid\n transition(BLUR, { text: stateText, item: '' });\n } else {\n // select the currently selected item\n const { value: navigationValue, text: navigationText } =\n optionsRef.current[navigationItem];\n\n onSelect &&\n onSelect(navigationText, navigationItem, navigationValue);\n\n transition(BLUR, {\n text: navigationText,\n item: navigationItem,\n });\n }\n }\n }\n });\n };\n}\n"],"mappings":";;;;;AAAA;;AACA;A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AR;cAAmBrD,IAAI,EAAE;YAAzB,CAAP,CAAV;UACD,CAHD,MAGO;YACL;YACA,6BACE2B,UAAU,CAACnB,OAAX,CAAmBT,cAAnB,CADF;YAAA,IAAemD,eAAf,0BAAQR,KAAR;YAAA,IAAsCS,cAAtC,0BAAgCrD,IAAhC;YAGA4B,QAAQ,IACNA,QAAQ,CAACyB,cAAD,EAAiBpD,cAAjB,EAAiCmD,eAAjC,CADV;YAGAtB,UAAU,CAAC7C,IAAD,EAAO;cACfe,IAAI,EAAEqD,cADS;cAEfnD,IAAI,EAAED;YAFS,CAAP,CAAV;UAID;QACF;MACF;IACF,CAhCoB,CAArB;EAiCD,CAlCD;AAmCD"}
|
|
1
|
+
{"version":3,"file":"hooks.js","names":["useEffect","getCircularIndex","useComboBoxContext","scopeQuery","IDLE","SUGGESTING","NAVIGATING","INIT","CLEAR","CLEAR_SELECTION","CHANGE","NAVIGATE","SELECT_WITH_KEYBOARD","SELECT_WITH_CLICK","ESCAPE","BLUR","FOCUS","OPEN_WITH_BUTTON","CLOSE_WITH_BUTTON","stateChart","initial","states","on","comboboxReducer","data","action","nextState","state","lastActionType","type","text","navigationItem","item","persistSelection","Error","visibleStates","isVisible","indexOf","useFocusManagement","inputRef","current","focus","getNextItem","currentItem","key","optionsItems","autocomplete","jumpToStartOrEnd","incr","index","findIndex","n","String","id","optionsLen","length","nextIndex","useKeyDown","onSelect","optionsRef","transition","autocompletePropRef","clearOnEscapeRef","persistSelectionRef","listScope","handleKeyDown","event","optionNodes","queryAllNodes","preventDefault","nextItem","scrollIntoView","behavior","block","value","lastValue","tracker","_valueTracker","setValue","Event","bubbles","dispatchEvent","navigationValue","navigationText","useBlur","stateText","popoverRef","buttonRef","selectOnBlur","handleBlur","requestAnimationFrame","document","activeElement","contains"],"sources":["../../../src/ComboBox/hooks.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\n/* eslint-disable default-case */\r\nimport type { KeyboardEvent, MutableRefObject } from 'react';\r\nimport { useEffect } from 'react';\r\n\r\nimport type {\r\n StateChart as GenericStateChart,\r\n StateMachineState,\r\n} from '../hooks/useReducerMachine';\r\nimport { getCircularIndex } from '../utils/get-circular-index';\r\nimport { useComboBoxContext } from './context';\r\nimport { scopeQuery } from './scopeQuery';\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n// States\r\n\r\n// Nothing going on, waiting for the user to type or use the arrow keys\r\nexport const IDLE = 'IDLE';\r\n\r\n// The component is suggesting options as the user types\r\nconst SUGGESTING = 'SUGGESTING';\r\n\r\n// The user is using the keyboard to navigate the list, not typing\r\nexport const NAVIGATING = 'NAVIGATING';\r\n\r\nexport type StateTypes = typeof IDLE | typeof SUGGESTING | typeof NAVIGATING;\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n// Actions:\r\n\r\n// Used to sync the state with controlled state, right after mounting\r\nexport const INIT = 'INIT';\r\n\r\n// User cleared the value w/ backspace, but input still has focus\r\nexport const CLEAR = 'CLEAR';\r\n\r\n// User cleared the value w/ backspace, but input still has focus\r\nexport const CLEAR_SELECTION = 'CLEAR_SELECTION';\r\n\r\n// User is typing\r\nexport const CHANGE = 'CHANGE';\r\n\r\n// User is navigating w/ the keyboard\r\nexport const NAVIGATE = 'NAVIGATE';\r\n\r\n// User can be navigating with keyboard and then click instead, we want the\r\n// value from the click, not the current nav item\r\nconst SELECT_WITH_KEYBOARD = 'SELECT_WITH_KEYBOARD';\r\nexport const SELECT_WITH_CLICK = 'SELECT_WITH_CLICK';\r\n\r\n// Pretty self-explanatory, user can hit escape or blur to close the popover\r\nconst ESCAPE = 'ESCAPE';\r\nconst BLUR = 'BLUR';\r\n\r\nexport const FOCUS = 'FOCUS';\r\n\r\nexport const OPEN_WITH_BUTTON = 'OPEN_WITH_BUTTON';\r\n\r\nexport const CLOSE_WITH_BUTTON = 'CLOSE_WITH_BUTTON';\r\n\r\nexport type ActionTypes =\r\n | typeof CLEAR\r\n | typeof CLEAR_SELECTION\r\n | typeof CHANGE\r\n | typeof INIT\r\n | typeof NAVIGATE\r\n | typeof SELECT_WITH_KEYBOARD\r\n | typeof SELECT_WITH_CLICK\r\n | typeof ESCAPE\r\n | typeof BLUR\r\n | typeof FOCUS\r\n | typeof OPEN_WITH_BUTTON\r\n | typeof CLOSE_WITH_BUTTON;\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\nexport const stateChart: GenericStateChart<StateTypes, ActionTypes> = {\r\n initial: IDLE,\r\n states: {\r\n [IDLE]: {\r\n on: {\r\n [BLUR]: IDLE,\r\n [CLEAR]: IDLE,\r\n [INIT]: IDLE,\r\n [CLEAR_SELECTION]: IDLE,\r\n [CHANGE]: SUGGESTING,\r\n [FOCUS]: SUGGESTING,\r\n [NAVIGATE]: NAVIGATING,\r\n [OPEN_WITH_BUTTON]: SUGGESTING,\r\n },\r\n },\r\n [SUGGESTING]: {\r\n on: {\r\n [CHANGE]: SUGGESTING,\r\n [FOCUS]: SUGGESTING,\r\n [INIT]: SUGGESTING,\r\n [NAVIGATE]: NAVIGATING,\r\n [CLEAR]: IDLE,\r\n [CLEAR_SELECTION]: SUGGESTING,\r\n [ESCAPE]: IDLE,\r\n [BLUR]: IDLE,\r\n [SELECT_WITH_CLICK]: IDLE,\r\n [CLOSE_WITH_BUTTON]: IDLE,\r\n },\r\n },\r\n [NAVIGATING]: {\r\n on: {\r\n [CHANGE]: SUGGESTING,\r\n [FOCUS]: SUGGESTING,\r\n [INIT]: NAVIGATING,\r\n [CLEAR]: IDLE,\r\n [CLEAR_SELECTION]: NAVIGATING,\r\n [BLUR]: IDLE,\r\n [ESCAPE]: IDLE,\r\n [NAVIGATE]: NAVIGATING,\r\n [SELECT_WITH_KEYBOARD]: IDLE,\r\n [SELECT_WITH_CLICK]: IDLE,\r\n [CLOSE_WITH_BUTTON]: IDLE,\r\n },\r\n },\r\n },\r\n};\r\n\r\nexport interface ReducerState\r\n extends StateMachineState<StateTypes, ActionTypes> {\r\n item: string;\r\n navigationItem: string;\r\n text: string;\r\n}\r\n\r\ninterface ActionObject {\r\n type: ActionTypes;\r\n state: StateTypes;\r\n nextState: StateTypes;\r\n [rest: string]: any;\r\n}\r\n\r\nexport function comboboxReducer(\r\n data: Readonly<ReducerState>,\r\n action: ActionObject\r\n): ReducerState {\r\n const nextState = {\r\n ...data,\r\n state: action.nextState,\r\n lastActionType: action.type,\r\n };\r\n\r\n switch (action.type) {\r\n case INIT:\r\n case CHANGE:\r\n return {\r\n ...nextState,\r\n text: action.text,\r\n navigationItem: '',\r\n item: '',\r\n };\r\n case NAVIGATE:\r\n case OPEN_WITH_BUTTON:\r\n if (action.persistSelection) {\r\n return {\r\n ...nextState,\r\n navigationItem: data.item,\r\n };\r\n }\r\n\r\n return {\r\n ...nextState,\r\n navigationItem: action.item,\r\n };\r\n case CLEAR_SELECTION:\r\n return {\r\n ...nextState,\r\n navigationItem: '',\r\n };\r\n case CLEAR:\r\n return {\r\n ...nextState,\r\n text: '',\r\n navigationItem: '',\r\n item: '',\r\n };\r\n case BLUR:\r\n return {\r\n ...nextState,\r\n text: action.text,\r\n navigationItem: '',\r\n item: action.item,\r\n };\r\n case CLOSE_WITH_BUTTON:\r\n case ESCAPE:\r\n return {\r\n ...nextState,\r\n navigationItem: '',\r\n item: '',\r\n };\r\n case SELECT_WITH_CLICK:\r\n case SELECT_WITH_KEYBOARD:\r\n return {\r\n ...nextState,\r\n text: action.text,\r\n item: action.item,\r\n navigationItem: '',\r\n };\r\n case FOCUS:\r\n return {\r\n ...nextState,\r\n navigationItem: action.item,\r\n };\r\n\r\n default:\r\n throw new Error(`Unknown action ${action.type}`);\r\n }\r\n}\r\n\r\nconst visibleStates = [SUGGESTING, NAVIGATING];\r\nexport const isVisible = (state: any) => visibleStates.indexOf(state) >= 0;\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n// The rest is all implementation details\r\n\r\n// Move focus back to the input if we start navigating w/ the\r\n// keyboard after focus has moved to any focusable content in\r\n// the popup.\r\nexport function useFocusManagement(\r\n lastActionType: ActionTypes,\r\n inputRef: MutableRefObject<HTMLInputElement | null>\r\n) {\r\n // useEffect so that the cursor goes to the end of the input instead\r\n // of awkwardly at the beginning, unclear to me why ...\r\n useEffect(() => {\r\n if (\r\n lastActionType === NAVIGATE ||\r\n lastActionType === ESCAPE ||\r\n lastActionType === SELECT_WITH_CLICK ||\r\n lastActionType === OPEN_WITH_BUTTON\r\n ) {\r\n inputRef.current && inputRef.current.focus();\r\n }\r\n });\r\n}\r\n\r\nfunction getNextItem(\r\n currentItem: string,\r\n key: 'ArrowDown' | 'ArrowUp' | 'PageDown' | 'PageUp' | 'Home' | 'End',\r\n optionsItems: HTMLElement[],\r\n autocomplete: boolean\r\n): HTMLElement | null {\r\n const jumpToStartOrEnd = key === 'Home' || key === 'End';\r\n let incr = 1;\r\n switch (key) {\r\n case 'PageUp':\r\n incr = -10;\r\n break;\r\n case 'PageDown':\r\n incr = 10;\r\n break;\r\n case 'End':\r\n case 'ArrowUp':\r\n incr = -1;\r\n break;\r\n case 'Home':\r\n case 'ArrowDown':\r\n incr = 1;\r\n break;\r\n }\r\n\r\n const index =\r\n currentItem === ''\r\n ? -1\r\n : optionsItems.findIndex((n) => String(n.id) === currentItem);\r\n\r\n const optionsLen = optionsItems.length;\r\n\r\n // Nothing selected, either go to start, or end\r\n if (index < 0 || jumpToStartOrEnd) {\r\n if (incr > 0) {\r\n // Go to start\r\n return optionsItems[0];\r\n } else {\r\n // Go to end\r\n return optionsItems[optionsLen - 1];\r\n }\r\n } else if (autocomplete) {\r\n const nextIndex = index + incr;\r\n\r\n if (nextIndex < 0 || nextIndex >= optionsLen) {\r\n // Next is outside the bounds of list, return nothing selected\r\n return null;\r\n }\r\n }\r\n\r\n // I'm sure it won't be null, we already check optionsLen above\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n return optionsItems[getCircularIndex(index + incr, optionsLen)!];\r\n}\r\n\r\n// We want the same events when the input or the popup have focus (HOW COOL ARE\r\n// HOOKS BTW?) This is probably the hairiest piece but it's not bad.\r\nexport function useKeyDown() {\r\n const {\r\n data: { text, navigationItem },\r\n onSelect,\r\n optionsRef,\r\n inputRef,\r\n state,\r\n transition,\r\n autocompletePropRef,\r\n clearOnEscapeRef,\r\n persistSelectionRef,\r\n listScope,\r\n } = useComboBoxContext();\r\n\r\n return function handleKeyDown(event: KeyboardEvent<any>) {\r\n const optionNodes = listScope.current.queryAllNodes(scopeQuery);\r\n\r\n switch (event.key) {\r\n case 'Home':\r\n case 'End':\r\n case 'PageUp':\r\n case 'PageDown':\r\n case 'ArrowUp':\r\n case 'ArrowDown': {\r\n // Don't scroll the page\r\n event.preventDefault();\r\n\r\n const optionsLen = optionNodes.length;\r\n\r\n // If the developer didn't render any options, there's no point in\r\n // trying to navigate--but seriously what the heck? Give us some\r\n // options fam.\r\n if (optionsLen === 0) {\r\n return;\r\n }\r\n\r\n if (state === IDLE) {\r\n // Opening a closed list\r\n transition(NAVIGATE, {\r\n persistSelection: persistSelectionRef.current,\r\n });\r\n } else {\r\n // When autocompletting, we'll not cycle through the list directly\r\n const autocomplete = autocompletePropRef.current;\r\n\r\n // Get next selected item\r\n const nextItem = getNextItem(\r\n navigationItem,\r\n event.key,\r\n optionNodes,\r\n autocomplete\r\n );\r\n\r\n if (nextItem !== null) {\r\n nextItem.scrollIntoView({ behavior: 'auto', block: 'nearest' });\r\n transition(NAVIGATE, {\r\n value: optionsRef.current[nextItem.id].text,\r\n item: nextItem.id,\r\n });\r\n } else {\r\n transition(NAVIGATE, { value: null, item: '' });\r\n }\r\n }\r\n break;\r\n }\r\n case 'Escape': {\r\n if (state !== IDLE) {\r\n transition(ESCAPE);\r\n } else if (state === IDLE && text !== '') {\r\n if (!inputRef.current || !clearOnEscapeRef.current) {\r\n break;\r\n }\r\n\r\n // emulate a inputRef change event, might not work in future versions of React\r\n const lastValue = inputRef.current.value;\r\n inputRef.current.value = '';\r\n\r\n const tracker = (inputRef.current as any)._valueTracker;\r\n if (tracker) {\r\n tracker.setValue(lastValue);\r\n }\r\n\r\n const event = new Event('change', { bubbles: true });\r\n inputRef.current.dispatchEvent(event);\r\n }\r\n break;\r\n }\r\n case 'Enter': {\r\n if (state === NAVIGATING && navigationItem !== '') {\r\n const { value: navigationValue, text: navigationText } =\r\n optionsRef.current[navigationItem];\r\n\r\n // don't want to submit forms\r\n event.preventDefault();\r\n onSelect && onSelect(navigationText, navigationItem, navigationValue);\r\n transition(SELECT_WITH_KEYBOARD, {\r\n text: navigationText,\r\n item: navigationItem,\r\n });\r\n }\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n\r\nexport function useBlur() {\r\n const {\r\n data: { navigationItem, text: stateText },\r\n transition,\r\n optionsRef,\r\n popoverRef,\r\n inputRef,\r\n buttonRef,\r\n onSelect,\r\n selectOnBlur, // not implemented yet\r\n } = useComboBoxContext();\r\n\r\n return function handleBlur() {\r\n requestAnimationFrame(() => {\r\n // we on want to close only if focus rests outside the combobox\r\n if (\r\n document.activeElement !== inputRef.current &&\r\n document.activeElement !== buttonRef.current &&\r\n popoverRef.current\r\n ) {\r\n if (popoverRef.current.contains(document.activeElement)) {\r\n // focus landed inside the combobox, keep it open\r\n // in the future, we can make it not close, select, or anything\r\n // this way we can have like... checkboxes available in the\r\n // menu item, etc.\r\n } else {\r\n // focus landed outside the combobox, close it.\r\n if (!selectOnBlur || navigationItem === '') {\r\n // we don't wanna select on blur, or navigationIndex is invalid\r\n transition(BLUR, { text: stateText, item: '' });\r\n } else {\r\n // select the currently selected item\r\n const { value: navigationValue, text: navigationText } =\r\n optionsRef.current[navigationItem];\r\n\r\n onSelect &&\r\n onSelect(navigationText, navigationItem, navigationValue);\r\n\r\n transition(BLUR, {\r\n text: navigationText,\r\n item: navigationItem,\r\n });\r\n }\r\n }\r\n }\r\n });\r\n };\r\n}\r\n"],"mappings":";;;;;AAAA;;AACA;AAEA,SAASA,SAAT,QAA0B,OAA1B;AAMA,SAASC,gBAAT,QAAiC,6BAAjC;AACA,SAASC,kBAAT,QAAmC,WAAnC;AAC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AmBT,cAAnB,CADF;YAAA,IAAemD,eAAf,0BAAQR,KAAR;YAAA,IAAsCS,cAAtC,0BAAgCrD,IAAhC;YAGA4B,QAAQ,IACNA,QAAQ,CAACyB,cAAD,EAAiBpD,cAAjB,EAAiCmD,eAAjC,CADV;YAGAtB,UAAU,CAAC7C,IAAD,EAAO;cACfe,IAAI,EAAEqD,cADS;cAEfnD,IAAI,EAAED;YAFS,CAAP,CAAV;UAID;QACF;MACF;IACF,CAhCoB,CAArB;EAiCD,CAlCD;AAmCD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './Combobox';
|
|
2
|
-
export * from './ComboboxButton';
|
|
3
|
-
export * from './ComboboxInput';
|
|
4
|
-
export * from './ComboboxLabel';
|
|
5
|
-
export * from './ComboboxList';
|
|
6
|
-
export * from './ComboboxOption';
|
|
7
|
-
export * from './ComboboxPopover';
|
|
8
|
-
export * from './context';
|
|
1
|
+
export * from './Combobox';
|
|
2
|
+
export * from './ComboboxButton';
|
|
3
|
+
export * from './ComboboxInput';
|
|
4
|
+
export * from './ComboboxLabel';
|
|
5
|
+
export * from './ComboboxList';
|
|
6
|
+
export * from './ComboboxOption';
|
|
7
|
+
export * from './ComboboxPopover';
|
|
8
|
+
export * from './context';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/ComboBox/index.ts"],"sourcesContent":["export * from './Combobox';\nexport * from './ComboboxButton';\nexport * from './ComboboxInput';\nexport * from './ComboboxLabel';\nexport * from './ComboboxList';\nexport * from './ComboboxOption';\nexport * from './ComboboxPopover';\nexport * from './context';\n"],"mappings":"AAAA,cAAc,YAAd;AACA,cAAc,kBAAd;AACA,cAAc,iBAAd;AACA,cAAc,iBAAd;AACA,cAAc,gBAAd;AACA,cAAc,kBAAd;AACA,cAAc,mBAAd;AACA,cAAc,WAAd"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/ComboBox/index.ts"],"sourcesContent":["export * from './Combobox';\r\nexport * from './ComboboxButton';\r\nexport * from './ComboboxInput';\r\nexport * from './ComboboxLabel';\r\nexport * from './ComboboxList';\r\nexport * from './ComboboxOption';\r\nexport * from './ComboboxPopover';\r\nexport * from './context';\r\n"],"mappings":"AAAA,cAAc,YAAd;AACA,cAAc,kBAAd;AACA,cAAc,iBAAd;AACA,cAAc,iBAAd;AACA,cAAc,gBAAd;AACA,cAAc,kBAAd;AACA,cAAc,mBAAd;AACA,cAAc,WAAd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function makeHash(str: string): number;
|
|
1
|
+
export declare function makeHash(str: string): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeHash.js","names":["makeHash","str","hash","length","i","char","charCodeAt"],"sources":["../../../src/ComboBox/makeHash.ts"],"sourcesContent":["// We don't want to track the active descendant with indexes because nothing is\n// more annoying in a combobox than having it change values RIGHT AS YOU HIT\n// ENTER. That only happens if you use the index as your data, rather than\n// *your data as your data*. We use this to generate a unique ID based on the\n// value of each item. This function is short, sweet, and good enough™ (I also\n// don't know how it works, tbqh)\n// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript\nexport function makeHash(str: string) {\n let hash = 0;\n if (str.length === 0) {\n return hash;\n }\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash;\n }\n return hash;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,QAAT,CAAkBC,GAAlB,EAA+B;EACpC,IAAIC,IAAI,GAAG,CAAX;;EACA,IAAID,GAAG,CAACE,MAAJ,KAAe,CAAnB,EAAsB;IACpB,OAAOD,IAAP;EACD;;EACD,KAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,GAAG,CAACE,MAAxB,EAAgCC,CAAC,EAAjC,EAAqC;IACnC,IAAMC,IAAI,GAAGJ,GAAG,CAACK,UAAJ,CAAeF,CAAf,CAAb;IACAF,IAAI,GAAG,CAACA,IAAI,IAAI,CAAT,IAAcA,IAAd,GAAqBG,IAA5B;IACAH,IAAI,GAAGA,IAAI,GAAGA,IAAd;EACD;;EACD,OAAOA,IAAP;AACD"}
|
|
1
|
+
{"version":3,"file":"makeHash.js","names":["makeHash","str","hash","length","i","char","charCodeAt"],"sources":["../../../src/ComboBox/makeHash.ts"],"sourcesContent":["// We don't want to track the active descendant with indexes because nothing is\r\n// more annoying in a combobox than having it change values RIGHT AS YOU HIT\r\n// ENTER. That only happens if you use the index as your data, rather than\r\n// *your data as your data*. We use this to generate a unique ID based on the\r\n// value of each item. This function is short, sweet, and good enough™ (I also\r\n// don't know how it works, tbqh)\r\n// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript\r\nexport function makeHash(str: string) {\r\n let hash = 0;\r\n if (str.length === 0) {\r\n return hash;\r\n }\r\n for (let i = 0; i < str.length; i++) {\r\n const char = str.charCodeAt(i);\r\n hash = (hash << 5) - hash + char;\r\n hash = hash & hash;\r\n }\r\n return hash;\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,QAAT,CAAkBC,GAAlB,EAA+B;EACpC,IAAIC,IAAI,GAAG,CAAX;;EACA,IAAID,GAAG,CAACE,MAAJ,KAAe,CAAnB,EAAsB;IACpB,OAAOD,IAAP;EACD;;EACD,KAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,GAAG,CAACE,MAAxB,EAAgCC,CAAC,EAAjC,EAAqC;IACnC,IAAMC,IAAI,GAAGJ,GAAG,CAACK,UAAJ,CAAeF,CAAf,CAAb;IACAF,IAAI,GAAG,CAACA,IAAI,IAAI,CAAT,IAAcA,IAAd,GAAqBG,IAA5B;IACAH,IAAI,GAAGA,IAAI,GAAGA,IAAd;EACD;;EACD,OAAOA,IAAP;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function scopeQuery(nodeType: string, props: Record<string, unknown>): boolean;
|
|
1
|
+
export declare function scopeQuery(nodeType: string, props: Record<string, unknown>): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopeQuery.js","names":["scopeQuery","nodeType","props"],"sources":["../../../src/ComboBox/scopeQuery.ts"],"sourcesContent":["export function scopeQuery(\n nodeType: string,\n props: Record<string, unknown>\n): boolean {\n return props['data-reach-combobox-option'] === '';\n}\n"],"mappings":"AAAA,OAAO,SAASA,UAAT,CACLC,QADK,EAELC,KAFK,EAGI;EACT,OAAOA,KAAK,CAAC,4BAAD,CAAL,KAAwC,EAA/C;AACD"}
|
|
1
|
+
{"version":3,"file":"scopeQuery.js","names":["scopeQuery","nodeType","props"],"sources":["../../../src/ComboBox/scopeQuery.ts"],"sourcesContent":["export function scopeQuery(\r\n nodeType: string,\r\n props: Record<string, unknown>\r\n): boolean {\r\n return props['data-reach-combobox-option'] === '';\r\n}\r\n"],"mappings":"AAAA,OAAO,SAASA,UAAT,CACLC,QADK,EAELC,KAFK,EAGI;EACT,OAAOA,KAAK,CAAC,4BAAD,CAAL,KAAwC,EAA/C;AACD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ElementType, FC, HTMLAttributes, MutableRefObject, ReactNode } from 'react';
|
|
2
|
-
export interface FocusLockProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
as?: ElementType<any>;
|
|
4
|
-
innerAs?: ElementType<any>;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
childRef: MutableRefObject<HTMLElement | null>;
|
|
7
|
-
enabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare const FocusLock: FC<FocusLockProps>;
|
|
1
|
+
import type { ElementType, FC, HTMLAttributes, MutableRefObject, ReactNode } from 'react';
|
|
2
|
+
export interface FocusLockProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
as?: ElementType<any>;
|
|
4
|
+
innerAs?: ElementType<any>;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
childRef: MutableRefObject<HTMLElement | null>;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const FocusLock: FC<FocusLockProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusLock.js","names":["useRef","useFocusLock","FocusLock","props","as","Comp","childRef","enabled","style","children","otherProps","lockStartRef","lockEndRef","lockStyle","width","height","padding","overflow","position","top","left"],"sources":["../../../src/FocusLock/FocusLock.tsx"],"sourcesContent":["import type {\n ElementType,\n FC,\n HTMLAttributes,\n MutableRefObject,\n ReactNode,\n} from 'react';\nimport { useRef } from 'react';\n\nimport { useFocusLock } from './useFocusLock';\n\nexport interface FocusLockProps extends HTMLAttributes<HTMLDivElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n childRef: MutableRefObject<HTMLElement | null>;\n enabled?: boolean;\n}\n\nexport const FocusLock: FC<FocusLockProps> = function FocusLock(props) {\n const {\n as: Comp = 'div',\n childRef,\n enabled = false,\n style = {},\n children,\n ...otherProps\n } = props;\n const lockStartRef = useRef<HTMLElement>(null);\n const lockEndRef = useRef<HTMLElement>(null);\n\n useFocusLock(childRef, { enabled, lockStartRef, lockEndRef });\n\n const lockStyle = {\n width: 1,\n height: 0,\n padding: 0,\n overflow: 'hidden',\n position: 'fixed',\n top: 1,\n left: 1,\n ...style,\n };\n\n return (\n <>\n <Comp\n ref={lockStartRef}\n data-focus-lock-start=\"\"\n aria-hidden={true}\n tabIndex={0}\n style={lockStyle}\n {...otherProps}\n />\n {children}\n <Comp\n ref={lockEndRef}\n data-focus-lock-end=\"\"\n aria-hidden={true}\n tabIndex={0}\n style={lockStyle}\n {...otherProps}\n />\n </>\n );\n};\n"],"mappings":";;;AAOA,SAASA,MAAT,QAAuB,OAAvB;AAEA,SAASC,YAAT,QAA6B,gBAA7B;;;;AAUA,OAAO,IAAMC,SAA6B,GAAG,SAASA,SAAT,CAAmBC,KAAnB,EAA0B;EACrE,gBAOIA,KAPJ,CACEC,EADF;EAAA,IACMC,IADN,0BACa,KADb;EAAA,IAEEC,QAFF,GAOIH,KAPJ,CAEEG,QAFF;EAAA,qBAOIH,KAPJ,CAGEI,OAHF;EAAA,IAGEA,OAHF,+BAGY,KAHZ;EAAA,mBAOIJ,KAPJ,CAIEK,KAJF;EAAA,IAIEA,KAJF,6BAIU,EAJV;EAAA,IAKEC,QALF,GAOIN,KAPJ,CAKEM,QALF;EAAA,IAMKC,UANL,4BAOIP,KAPJ;;EAQA,IAAMQ,YAAY,GAAGX,MAAM,CAAc,IAAd,CAA3B;EACA,IAAMY,UAAU,GAAGZ,MAAM,CAAc,IAAd,CAAzB;EAEAC,YAAY,CAACK,QAAD,EAAW;IAAEC,OAAO,EAAPA,OAAF;IAAWI,YAAY,EAAZA,YAAX;IAAyBC,UAAU,EAAVA;EAAzB,CAAX,CAAZ;;EAEA,IAAMC,SAAS;IACbC,KAAK,EAAE,CADM;IAEbC,MAAM,EAAE,CAFK;IAGbC,OAAO,EAAE,CAHI;IAIbC,QAAQ,EAAE,QAJG;IAKbC,QAAQ,EAAE,OALG;IAMbC,GAAG,EAAE,CANQ;IAObC,IAAI,EAAE;EAPO,GAQVZ,KARU,CAAf;;EAWA,oBACE;IAAA,wBACE,KAAC,IAAD;MACE,GAAG,EAAEG,YADP;MAEE,yBAAsB,EAFxB;MAGE,eAAa,IAHf;MAIE,QAAQ,EAAE,CAJZ;MAKE,KAAK,EAAEE;IALT,GAMMH,UANN,EADF,EASGD,QATH,eAUE,KAAC,IAAD;MACE,GAAG,EAAEG,UADP;MAEE,uBAAoB,EAFtB;MAGE,eAAa,IAHf;MAIE,QAAQ,EAAE,CAJZ;MAKE,KAAK,EAAEC;IALT,GAMMH,UANN,EAVF;EAAA,EADF;AAqBD,CA9CM"}
|
|
1
|
+
{"version":3,"file":"FocusLock.js","names":["useRef","useFocusLock","FocusLock","props","as","Comp","childRef","enabled","style","children","otherProps","lockStartRef","lockEndRef","lockStyle","width","height","padding","overflow","position","top","left"],"sources":["../../../src/FocusLock/FocusLock.tsx"],"sourcesContent":["import type {\r\n ElementType,\r\n FC,\r\n HTMLAttributes,\r\n MutableRefObject,\r\n ReactNode,\r\n} from 'react';\r\nimport { useRef } from 'react';\r\n\r\nimport { useFocusLock } from './useFocusLock';\r\n\r\nexport interface FocusLockProps extends HTMLAttributes<HTMLDivElement> {\r\n as?: ElementType<any>;\r\n innerAs?: ElementType<any>;\r\n children?: ReactNode;\r\n childRef: MutableRefObject<HTMLElement | null>;\r\n enabled?: boolean;\r\n}\r\n\r\nexport const FocusLock: FC<FocusLockProps> = function FocusLock(props) {\r\n const {\r\n as: Comp = 'div',\r\n childRef,\r\n enabled = false,\r\n style = {},\r\n children,\r\n ...otherProps\r\n } = props;\r\n const lockStartRef = useRef<HTMLElement>(null);\r\n const lockEndRef = useRef<HTMLElement>(null);\r\n\r\n useFocusLock(childRef, { enabled, lockStartRef, lockEndRef });\r\n\r\n const lockStyle = {\r\n width: 1,\r\n height: 0,\r\n padding: 0,\r\n overflow: 'hidden',\r\n position: 'fixed',\r\n top: 1,\r\n left: 1,\r\n ...style,\r\n };\r\n\r\n return (\r\n <>\r\n <Comp\r\n ref={lockStartRef}\r\n data-focus-lock-start=\"\"\r\n aria-hidden={true}\r\n tabIndex={0}\r\n style={lockStyle}\r\n {...otherProps}\r\n />\r\n {children}\r\n <Comp\r\n ref={lockEndRef}\r\n data-focus-lock-end=\"\"\r\n aria-hidden={true}\r\n tabIndex={0}\r\n style={lockStyle}\r\n {...otherProps}\r\n />\r\n </>\r\n );\r\n};\r\n"],"mappings":";;;AAOA,SAASA,MAAT,QAAuB,OAAvB;AAEA,SAASC,YAAT,QAA6B,gBAA7B;;;;AAUA,OAAO,IAAMC,SAA6B,GAAG,SAASA,SAAT,CAAmBC,KAAnB,EAA0B;EACrE,gBAOIA,KAPJ,CACEC,EADF;EAAA,IACMC,IADN,0BACa,KADb;EAAA,IAEEC,QAFF,GAOIH,KAPJ,CAEEG,QAFF;EAAA,qBAOIH,KAPJ,CAGEI,OAHF;EAAA,IAGEA,OAHF,+BAGY,KAHZ;EAAA,mBAOIJ,KAPJ,CAIEK,KAJF;EAAA,IAIEA,KAJF,6BAIU,EAJV;EAAA,IAKEC,QALF,GAOIN,KAPJ,CAKEM,QALF;EAAA,IAMKC,UANL,4BAOIP,KAPJ;;EAQA,IAAMQ,YAAY,GAAGX,MAAM,CAAc,IAAd,CAA3B;EACA,IAAMY,UAAU,GAAGZ,MAAM,CAAc,IAAd,CAAzB;EAEAC,YAAY,CAACK,QAAD,EAAW;IAAEC,OAAO,EAAPA,OAAF;IAAWI,YAAY,EAAZA,YAAX;IAAyBC,UAAU,EAAVA;EAAzB,CAAX,CAAZ;;EAEA,IAAMC,SAAS;IACbC,KAAK,EAAE,CADM;IAEbC,MAAM,EAAE,CAFK;IAGbC,OAAO,EAAE,CAHI;IAIbC,QAAQ,EAAE,QAJG;IAKbC,QAAQ,EAAE,OALG;IAMbC,GAAG,EAAE,CANQ;IAObC,IAAI,EAAE;EAPO,GAQVZ,KARU,CAAf;;EAWA,oBACE;IAAA,wBACE,KAAC,IAAD;MACE,GAAG,EAAEG,YADP;MAEE,yBAAsB,EAFxB;MAGE,eAAa,IAHf;MAIE,QAAQ,EAAE,CAJZ;MAKE,KAAK,EAAEE;IALT,GAMMH,UANN,EADF,EASGD,QATH,eAUE,KAAC,IAAD;MACE,GAAG,EAAEG,UADP;MAEE,uBAAoB,EAFtB;MAGE,eAAa,IAHf;MAIE,QAAQ,EAAE,CAJZ;MAKE,KAAK,EAAEC;IALT,GAMMH,UANN,EAVF;EAAA,EADF;AAqBD,CA9CM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './FocusLock';
|
|
1
|
+
export * from './FocusLock';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/FocusLock/index.ts"],"sourcesContent":["export * from './FocusLock';\n"],"mappings":"AAAA,cAAc,aAAd"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/FocusLock/index.ts"],"sourcesContent":["export * from './FocusLock';\r\n"],"mappings":"AAAA,cAAc,aAAd"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const tabblable: string;
|
|
2
|
-
export declare const getTabblableNodes: (parentNode: HTMLElement | null) => HTMLElement[];
|
|
3
|
-
export declare function focusOnChildNode(parentNode: HTMLElement, itemIndex: 0 | -1): void;
|
|
1
|
+
export declare const tabblable: string;
|
|
2
|
+
export declare const getTabblableNodes: (parentNode: HTMLElement | null) => HTMLElement[];
|
|
3
|
+
export declare function focusOnChildNode(parentNode: HTMLElement, itemIndex: 0 | -1): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabUtils.js","names":["tabblable","join","getTabblableNodes","parentNode","Array","from","querySelectorAll","focusOnChildNode","itemIndex","elements","length","focus","currentTabIndex","tabIndex"],"sources":["../../../src/FocusLock/tabUtils.ts"],"sourcesContent":["export const tabblable = [\n 'button:enabled:not([readonly])',\n 'select:enabled:not([readonly])',\n 'textarea:enabled:not([readonly])',\n 'input:enabled:not([readonly])',\n\n 'a[href]',\n 'area[href]',\n\n 'iframe',\n 'object',\n 'embed',\n\n '[tabindex]',\n '[contenteditable]',\n '[autofocus]',\n].join(',');\n\n/* This is naive and will not consider tabIndex */\nexport const getTabblableNodes = (\n parentNode: HTMLElement | null\n): HTMLElement[] => {\n if (!parentNode) {\n return [];\n }\n\n return Array.from(parentNode.querySelectorAll(tabblable));\n};\n\nexport function focusOnChildNode(parentNode: HTMLElement, itemIndex: 0 | -1) {\n const elements = getTabblableNodes(parentNode);\n if (elements.length > 0) {\n elements[itemIndex === -1 ? elements.length - 1 : 0].focus();\n } else {\n const currentTabIndex = parentNode.tabIndex;\n parentNode.tabIndex = 0;\n parentNode.focus();\n parentNode.tabIndex = currentTabIndex;\n }\n}\n"],"mappings":"AAAA,OAAO,IAAMA,SAAS,GAAG,CACvB,gCADuB,EAEvB,gCAFuB,EAGvB,kCAHuB,EAIvB,+BAJuB,EAMvB,SANuB,EAOvB,YAPuB,EASvB,QATuB,EAUvB,QAVuB,EAWvB,OAXuB,EAavB,YAbuB,EAcvB,mBAduB,EAevB,aAfuB,EAgBvBC,IAhBuB,CAgBlB,GAhBkB,CAAlB;AAkBP;;AACA,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAC/BC,UAD+B,EAEb;EAClB,IAAI,CAACA,UAAL,EAAiB;IACf,OAAO,EAAP;EACD;;EAED,OAAOC,KAAK,CAACC,IAAN,CAAWF,UAAU,CAACG,gBAAX,CAA4BN,SAA5B,CAAX,CAAP;AACD,CARM;AAUP,OAAO,SAASO,gBAAT,CAA0BJ,UAA1B,EAAmDK,SAAnD,EAAsE;EAC3E,IAAMC,QAAQ,GAAGP,iBAAiB,CAACC,UAAD,CAAlC;;EACA,IAAIM,QAAQ,CAACC,MAAT,GAAkB,CAAtB,EAAyB;IACvBD,QAAQ,CAACD,SAAS,KAAK,CAAC,CAAf,GAAmBC,QAAQ,CAACC,MAAT,GAAkB,CAArC,GAAyC,CAA1C,CAAR,CAAqDC,KAArD;EACD,CAFD,MAEO;IACL,IAAMC,eAAe,GAAGT,UAAU,CAACU,QAAnC;IACAV,UAAU,CAACU,QAAX,GAAsB,CAAtB;IACAV,UAAU,CAACQ,KAAX;IACAR,UAAU,CAACU,QAAX,GAAsBD,eAAtB;EACD;AACF"}
|
|
1
|
+
{"version":3,"file":"tabUtils.js","names":["tabblable","join","getTabblableNodes","parentNode","Array","from","querySelectorAll","focusOnChildNode","itemIndex","elements","length","focus","currentTabIndex","tabIndex"],"sources":["../../../src/FocusLock/tabUtils.ts"],"sourcesContent":["export const tabblable = [\r\n 'button:enabled:not([readonly])',\r\n 'select:enabled:not([readonly])',\r\n 'textarea:enabled:not([readonly])',\r\n 'input:enabled:not([readonly])',\r\n\r\n 'a[href]',\r\n 'area[href]',\r\n\r\n 'iframe',\r\n 'object',\r\n 'embed',\r\n\r\n '[tabindex]',\r\n '[contenteditable]',\r\n '[autofocus]',\r\n].join(',');\r\n\r\n/* This is naive and will not consider tabIndex */\r\nexport const getTabblableNodes = (\r\n parentNode: HTMLElement | null\r\n): HTMLElement[] => {\r\n if (!parentNode) {\r\n return [];\r\n }\r\n\r\n return Array.from(parentNode.querySelectorAll(tabblable));\r\n};\r\n\r\nexport function focusOnChildNode(parentNode: HTMLElement, itemIndex: 0 | -1) {\r\n const elements = getTabblableNodes(parentNode);\r\n if (elements.length > 0) {\r\n elements[itemIndex === -1 ? elements.length - 1 : 0].focus();\r\n } else {\r\n const currentTabIndex = parentNode.tabIndex;\r\n parentNode.tabIndex = 0;\r\n parentNode.focus();\r\n parentNode.tabIndex = currentTabIndex;\r\n }\r\n}\r\n"],"mappings":"AAAA,OAAO,IAAMA,SAAS,GAAG,CACvB,gCADuB,EAEvB,gCAFuB,EAGvB,kCAHuB,EAIvB,+BAJuB,EAMvB,SANuB,EAOvB,YAPuB,EASvB,QATuB,EAUvB,QAVuB,EAWvB,OAXuB,EAavB,YAbuB,EAcvB,mBAduB,EAevB,aAfuB,EAgBvBC,IAhBuB,CAgBlB,GAhBkB,CAAlB;AAkBP;;AACA,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAC/BC,UAD+B,EAEb;EAClB,IAAI,CAACA,UAAL,EAAiB;IACf,OAAO,EAAP;EACD;;EAED,OAAOC,KAAK,CAACC,IAAN,CAAWF,UAAU,CAACG,gBAAX,CAA4BN,SAA5B,CAAX,CAAP;AACD,CARM;AAUP,OAAO,SAASO,gBAAT,CAA0BJ,UAA1B,EAAmDK,SAAnD,EAAsE;EAC3E,IAAMC,QAAQ,GAAGP,iBAAiB,CAACC,UAAD,CAAlC;;EACA,IAAIM,QAAQ,CAACC,MAAT,GAAkB,CAAtB,EAAyB;IACvBD,QAAQ,CAACD,SAAS,KAAK,CAAC,CAAf,GAAmBC,QAAQ,CAACC,MAAT,GAAkB,CAArC,GAAyC,CAA1C,CAAR,CAAqDC,KAArD;EACD,CAFD,MAEO;IACL,IAAMC,eAAe,GAAGT,UAAU,CAACU,QAAnC;IACAV,UAAU,CAACU,QAAX,GAAsB,CAAtB;IACAV,UAAU,CAACQ,KAAX;IACAR,UAAU,CAACU,QAAX,GAAsBD,eAAtB;EACD;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { MutableRefObject } from 'react';
|
|
2
|
-
export interface FocusLockOptions {
|
|
3
|
-
enabled: boolean;
|
|
4
|
-
lockStartRef: MutableRefObject<HTMLElement | null>;
|
|
5
|
-
lockEndRef: MutableRefObject<HTMLElement | null>;
|
|
6
|
-
}
|
|
7
|
-
export declare function useFocusLock(ref: MutableRefObject<HTMLElement | null>, opts: FocusLockOptions): void;
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
export interface FocusLockOptions {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
lockStartRef: MutableRefObject<HTMLElement | null>;
|
|
5
|
+
lockEndRef: MutableRefObject<HTMLElement | null>;
|
|
6
|
+
}
|
|
7
|
+
export declare function useFocusLock(ref: MutableRefObject<HTMLElement | null>, opts: FocusLockOptions): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusLock.js","names":["useEffect","focusOnChildNode","focusLockStack","useFocusLock","ref","opts","enabled","lockStartRef","lockEndRef","rootEl","current","push","listener","event","isActiveFocusLock","length","target","document","contains","preventDefault","addEventListener","removeEventListener","pop"],"sources":["../../../src/FocusLock/useFocusLock.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { useEffect } from 'react';\n\nimport { focusOnChildNode } from './tabUtils';\n\nexport interface FocusLockOptions {\n enabled: boolean;\n lockStartRef: MutableRefObject<HTMLElement | null>;\n lockEndRef: MutableRefObject<HTMLElement | null>;\n}\n\nconst focusLockStack: HTMLElement[] = [];\nexport function useFocusLock(\n ref: MutableRefObject<HTMLElement | null>,\n opts: FocusLockOptions\n) {\n const { enabled = true, lockStartRef, lockEndRef } = opts;\n\n useEffect(() => {\n const rootEl = ref.current;\n if (enabled && rootEl) {\n focusLockStack.push(rootEl);\n\n const listener = (event: FocusEvent) => {\n const isActiveFocusLock =\n focusLockStack[focusLockStack.length - 1] === rootEl;\n if (!isActiveFocusLock) {\n // Not the currently focused lock. Forget about it.\n return;\n }\n\n if (event.target === lockEndRef.current) {\n focusOnChildNode(rootEl, 0);\n } else if (event.target === lockStartRef.current) {\n focusOnChildNode(rootEl, -1);\n } else if (\n document !== event.target &&\n rootEl !== event.target &&\n !rootEl.contains(event.target as any)\n ) {\n event.preventDefault();\n focusOnChildNode(rootEl, 0);\n }\n };\n\n document.addEventListener('focusin', listener);\n return () => {\n document.removeEventListener('focusin', listener);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n focusLockStack.pop();\n };\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled]);\n}\n"],"mappings":"AACA,SAASA,SAAT,QAA0B,OAA1B;AAEA,SAASC,gBAAT,QAAiC,YAAjC;AAQA,IAAMC,cAA6B,GAAG,EAAtC;AACA,OAAO,SAASC,YAAT,CACLC,GADK,EAELC,IAFK,EAGL;EACA,oBAAqDA,IAArD,CAAQC,OAAR;EAAA,IAAQA,OAAR,8BAAkB,IAAlB;EAAA,IAAwBC,YAAxB,GAAqDF,IAArD,CAAwBE,YAAxB;EAAA,IAAsCC,UAAtC,GAAqDH,IAArD,CAAsCG,UAAtC;EAEAR,SAAS,CAAC,YAAM;IACd,IAAMS,MAAM,GAAGL,GAAG,CAACM,OAAnB;;IACA,IAAIJ,OAAO,IAAIG,MAAf,EAAuB;MACrBP,cAAc,CAACS,IAAf,CAAoBF,MAApB;;MAEA,IAAMG,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAuB;QACtC,IAAMC,iBAAiB,GACrBZ,cAAc,CAACA,cAAc,CAACa,MAAf,GAAwB,CAAzB,CAAd,KAA8CN,MADhD;;QAEA,IAAI,CAACK,iBAAL,EAAwB;UACtB;UACA;QACD;;QAED,IAAID,KAAK,CAACG,MAAN,KAAiBR,UAAU,CAACE,OAAhC,EAAyC;UACvCT,gBAAgB,CAACQ,MAAD,EAAS,CAAT,CAAhB;QACD,CAFD,MAEO,IAAII,KAAK,CAACG,MAAN,KAAiBT,YAAY,CAACG,OAAlC,EAA2C;UAChDT,gBAAgB,CAACQ,MAAD,EAAS,CAAC,CAAV,CAAhB;QACD,CAFM,MAEA,IACLQ,QAAQ,KAAKJ,KAAK,CAACG,MAAnB,IACAP,MAAM,KAAKI,KAAK,CAACG,MADjB,IAEA,CAACP,MAAM,CAACS,QAAP,CAAgBL,KAAK,CAACG,MAAtB,CAHI,EAIL;UACAH,KAAK,CAACM,cAAN;UACAlB,gBAAgB,CAACQ,MAAD,EAAS,CAAT,CAAhB;QACD;MACF,CApBD;;MAsBAQ,QAAQ,CAACG,gBAAT,CAA0B,SAA1B,EAAqCR,QAArC;MACA,OAAO,YAAM;QACXK,QAAQ,CAACI,mBAAT,CAA6B,SAA7B,EAAwCT,QAAxC,EADW,CAGX;;QACAV,cAAc,CAACoB,GAAf;MACD,CALD;IAMD,CAlCa,CAmCd;;EACD,CApCQ,EAoCN,CAAChB,OAAD,CApCM,CAAT;AAqCD"}
|
|
1
|
+
{"version":3,"file":"useFocusLock.js","names":["useEffect","focusOnChildNode","focusLockStack","useFocusLock","ref","opts","enabled","lockStartRef","lockEndRef","rootEl","current","push","listener","event","isActiveFocusLock","length","target","document","contains","preventDefault","addEventListener","removeEventListener","pop"],"sources":["../../../src/FocusLock/useFocusLock.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\r\nimport { useEffect } from 'react';\r\n\r\nimport { focusOnChildNode } from './tabUtils';\r\n\r\nexport interface FocusLockOptions {\r\n enabled: boolean;\r\n lockStartRef: MutableRefObject<HTMLElement | null>;\r\n lockEndRef: MutableRefObject<HTMLElement | null>;\r\n}\r\n\r\nconst focusLockStack: HTMLElement[] = [];\r\nexport function useFocusLock(\r\n ref: MutableRefObject<HTMLElement | null>,\r\n opts: FocusLockOptions\r\n) {\r\n const { enabled = true, lockStartRef, lockEndRef } = opts;\r\n\r\n useEffect(() => {\r\n const rootEl = ref.current;\r\n if (enabled && rootEl) {\r\n focusLockStack.push(rootEl);\r\n\r\n const listener = (event: FocusEvent) => {\r\n const isActiveFocusLock =\r\n focusLockStack[focusLockStack.length - 1] === rootEl;\r\n if (!isActiveFocusLock) {\r\n // Not the currently focused lock. Forget about it.\r\n return;\r\n }\r\n\r\n if (event.target === lockEndRef.current) {\r\n focusOnChildNode(rootEl, 0);\r\n } else if (event.target === lockStartRef.current) {\r\n focusOnChildNode(rootEl, -1);\r\n } else if (\r\n document !== event.target &&\r\n rootEl !== event.target &&\r\n !rootEl.contains(event.target as any)\r\n ) {\r\n event.preventDefault();\r\n focusOnChildNode(rootEl, 0);\r\n }\r\n };\r\n\r\n document.addEventListener('focusin', listener);\r\n return () => {\r\n document.removeEventListener('focusin', listener);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n focusLockStack.pop();\r\n };\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [enabled]);\r\n}\r\n"],"mappings":"AACA,SAASA,SAAT,QAA0B,OAA1B;AAEA,SAASC,gBAAT,QAAiC,YAAjC;AAQA,IAAMC,cAA6B,GAAG,EAAtC;AACA,OAAO,SAASC,YAAT,CACLC,GADK,EAELC,IAFK,EAGL;EACA,oBAAqDA,IAArD,CAAQC,OAAR;EAAA,IAAQA,OAAR,8BAAkB,IAAlB;EAAA,IAAwBC,YAAxB,GAAqDF,IAArD,CAAwBE,YAAxB;EAAA,IAAsCC,UAAtC,GAAqDH,IAArD,CAAsCG,UAAtC;EAEAR,SAAS,CAAC,YAAM;IACd,IAAMS,MAAM,GAAGL,GAAG,CAACM,OAAnB;;IACA,IAAIJ,OAAO,IAAIG,MAAf,EAAuB;MACrBP,cAAc,CAACS,IAAf,CAAoBF,MAApB;;MAEA,IAAMG,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAuB;QACtC,IAAMC,iBAAiB,GACrBZ,cAAc,CAACA,cAAc,CAACa,MAAf,GAAwB,CAAzB,CAAd,KAA8CN,MADhD;;QAEA,IAAI,CAACK,iBAAL,EAAwB;UACtB;UACA;QACD;;QAED,IAAID,KAAK,CAACG,MAAN,KAAiBR,UAAU,CAACE,OAAhC,EAAyC;UACvCT,gBAAgB,CAACQ,MAAD,EAAS,CAAT,CAAhB;QACD,CAFD,MAEO,IAAII,KAAK,CAACG,MAAN,KAAiBT,YAAY,CAACG,OAAlC,EAA2C;UAChDT,gBAAgB,CAACQ,MAAD,EAAS,CAAC,CAAV,CAAhB;QACD,CAFM,MAEA,IACLQ,QAAQ,KAAKJ,KAAK,CAACG,MAAnB,IACAP,MAAM,KAAKI,KAAK,CAACG,MADjB,IAEA,CAACP,MAAM,CAACS,QAAP,CAAgBL,KAAK,CAACG,MAAtB,CAHI,EAIL;UACAH,KAAK,CAACM,cAAN;UACAlB,gBAAgB,CAACQ,MAAD,EAAS,CAAT,CAAhB;QACD;MACF,CApBD;;MAsBAQ,QAAQ,CAACG,gBAAT,CAA0B,SAA1B,EAAqCR,QAArC;MACA,OAAO,YAAM;QACXK,QAAQ,CAACI,mBAAT,CAA6B,SAA7B,EAAwCT,QAAxC,EADW,CAGX;;QACAV,cAAc,CAACoB,GAAf;MACD,CALD;IAMD,CAlCa,CAmCd;;EACD,CApCQ,EAoCN,CAAChB,OAAD,CApCM,CAAT;AAqCD"}
|
package/build/esm/List/List.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
export interface ListProps extends HTMLAttributes<HTMLUListElement> {
|
|
3
|
-
as?: ElementType<any>;
|
|
4
|
-
innerAs?: ElementType<any>;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare const List: import("react").ForwardRefExoticComponent<ListProps & import("react").RefAttributes<HTMLUListElement>>;
|
|
1
|
+
import type { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface ListProps extends HTMLAttributes<HTMLUListElement> {
|
|
3
|
+
as?: ElementType<any>;
|
|
4
|
+
innerAs?: ElementType<any>;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const List: import("react").ForwardRefExoticComponent<ListProps & import("react").RefAttributes<HTMLUListElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","names":["forwardRef","List","props","forwardedRef","as","Comp","otherProps"],"sources":["../../../src/List/List.tsx"],"sourcesContent":["import type { ElementType, HTMLAttributes, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nexport interface ListProps extends HTMLAttributes<HTMLUListElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n}\n\nexport const List = forwardRef<HTMLUListElement, ListProps>(function List(\n props,\n forwardedRef\n) {\n const { as: Comp = 'ul', ...otherProps } = props;\n\n return <Comp ref={forwardedRef} {...otherProps} />;\n});\n"],"mappings":";;;AACA,SAASA,UAAT,QAA2B,OAA3B;;AAQA,OAAO,IAAMC,IAAI,gBAAGD,UAAU,CAA8B,SAASC,IAAT,CAC1DC,KAD0D,EAE1DC,YAF0D,EAG1D;EACA,gBAA2CD,KAA3C,CAAQE,EAAR;EAAA,IAAYC,IAAZ,0BAAmB,IAAnB;EAAA,IAA4BC,UAA5B,4BAA2CJ,KAA3C;;EAEA,oBAAO,KAAC,IAAD;IAAM,GAAG,EAAEC;EAAX,GAA6BG,UAA7B,EAAP;AACD,CAP6B,CAAvB"}
|
|
1
|
+
{"version":3,"file":"List.js","names":["forwardRef","List","props","forwardedRef","as","Comp","otherProps"],"sources":["../../../src/List/List.tsx"],"sourcesContent":["import type { ElementType, HTMLAttributes, ReactNode } from 'react';\r\nimport { forwardRef } from 'react';\r\n\r\nexport interface ListProps extends HTMLAttributes<HTMLUListElement> {\r\n as?: ElementType<any>;\r\n innerAs?: ElementType<any>;\r\n children?: ReactNode;\r\n}\r\n\r\nexport const List = forwardRef<HTMLUListElement, ListProps>(function List(\r\n props,\r\n forwardedRef\r\n) {\r\n const { as: Comp = 'ul', ...otherProps } = props;\r\n\r\n return <Comp ref={forwardedRef} {...otherProps} />;\r\n});\r\n"],"mappings":";;;AACA,SAASA,UAAT,QAA2B,OAA3B;;AAQA,OAAO,IAAMC,IAAI,gBAAGD,UAAU,CAA8B,SAASC,IAAT,CAC1DC,KAD0D,EAE1DC,YAF0D,EAG1D;EACA,gBAA2CD,KAA3C,CAAQE,EAAR;EAAA,IAAYC,IAAZ,0BAAmB,IAAnB;EAAA,IAA4BC,UAA5B,4BAA2CJ,KAA3C;;EAEA,oBAAO,KAAC,IAAD;IAAM,GAAG,EAAEC;EAAX,GAA6BG,UAA7B,EAAP;AACD,CAP6B,CAAvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
export interface ListItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
3
|
-
as?: ElementType<any>;
|
|
4
|
-
innerAs?: ElementType<any>;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare const ListItem: import("react").ForwardRefExoticComponent<ListItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
1
|
+
import type { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface ListItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
3
|
+
as?: ElementType<any>;
|
|
4
|
+
innerAs?: ElementType<any>;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const ListItem: import("react").ForwardRefExoticComponent<ListItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","names":["forwardRef","ListItem","props","forwardedRef","as","Comp","otherProps"],"sources":["../../../src/List/ListItem.tsx"],"sourcesContent":["import type { ElementType, HTMLAttributes, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nexport interface ListItemProps extends HTMLAttributes<HTMLLIElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n}\n\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(\n function ListItem(props, forwardedRef) {\n const { as: Comp = 'li', ...otherProps } = props;\n\n return (\n <Comp\n tabIndex={-1}\n data-list-item=\"\"\n ref={forwardedRef}\n {...otherProps}\n />\n );\n }\n);\n"],"mappings":";;;AACA,SAASA,UAAT,QAA2B,OAA3B;;AAQA,OAAO,IAAMC,QAAQ,gBAAGD,UAAU,CAChC,SAASC,QAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAuC;EACrC,gBAA2CD,KAA3C,CAAQE,EAAR;EAAA,IAAYC,IAAZ,0BAAmB,IAAnB;EAAA,IAA4BC,UAA5B,4BAA2CJ,KAA3C;;EAEA,oBACE,KAAC,IAAD;IACE,QAAQ,EAAE,CAAC,CADb;IAEE,kBAAe,EAFjB;IAGE,GAAG,EAAEC;EAHP,GAIMG,UAJN,EADF;AAQD,CAZ+B,CAA3B"}
|
|
1
|
+
{"version":3,"file":"ListItem.js","names":["forwardRef","ListItem","props","forwardedRef","as","Comp","otherProps"],"sources":["../../../src/List/ListItem.tsx"],"sourcesContent":["import type { ElementType, HTMLAttributes, ReactNode } from 'react';\r\nimport { forwardRef } from 'react';\r\n\r\nexport interface ListItemProps extends HTMLAttributes<HTMLLIElement> {\r\n as?: ElementType<any>;\r\n innerAs?: ElementType<any>;\r\n children?: ReactNode;\r\n}\r\n\r\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(\r\n function ListItem(props, forwardedRef) {\r\n const { as: Comp = 'li', ...otherProps } = props;\r\n\r\n return (\r\n <Comp\r\n tabIndex={-1}\r\n data-list-item=\"\"\r\n ref={forwardedRef}\r\n {...otherProps}\r\n />\r\n );\r\n }\r\n);\r\n"],"mappings":";;;AACA,SAASA,UAAT,QAA2B,OAA3B;;AAQA,OAAO,IAAMC,QAAQ,gBAAGD,UAAU,CAChC,SAASC,QAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAuC;EACrC,gBAA2CD,KAA3C,CAAQE,EAAR;EAAA,IAAYC,IAAZ,0BAAmB,IAAnB;EAAA,IAA4BC,UAA5B,4BAA2CJ,KAA3C;;EAEA,oBACE,KAAC,IAAD;IACE,QAAQ,EAAE,CAAC,CADb;IAEE,kBAAe,EAFjB;IAGE,GAAG,EAAEC;EAHP,GAIMG,UAJN,EADF;AAQD,CAZ+B,CAA3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface ListContextProps {
|
|
2
|
-
id: string | undefined;
|
|
3
|
-
}
|
|
4
|
-
export declare const useListContext: () => ListContextProps;
|
|
1
|
+
export interface ListContextProps {
|
|
2
|
+
id: string | undefined;
|
|
3
|
+
}
|
|
4
|
+
export declare const useListContext: () => ListContextProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":["createContext","useContext","ListContext","displayName","useListContext","ctx","Error"],"sources":["../../../src/List/context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\n// List Component\nexport interface ListContextProps {\n id: string | undefined;\n}\n\nconst ListContext = createContext<ListContextProps | null>(null);\nListContext.displayName = 'ListContext';\n\nexport const useListContext = (): ListContextProps => {\n const ctx = useContext(ListContext);\n if (!ctx) {\n throw new Error(\n 'useListContext must be used within a ListContext.Provider'\n );\n }\n return ctx;\n};\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C,C,CAEA;;AAKA,IAAMC,WAAW,gBAAGF,aAAa,CAA0B,IAA1B,CAAjC;AACAE,WAAW,CAACC,WAAZ,GAA0B,aAA1B;AAEA,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,GAAwB;EACpD,IAAMC,GAAG,GAAGJ,UAAU,CAACC,WAAD,CAAtB;;EACA,IAAI,CAACG,GAAL,EAAU;IACR,MAAM,IAAIC,KAAJ,CACJ,2DADI,CAAN;EAGD;;EACD,OAAOD,GAAP;AACD,CARM"}
|
|
1
|
+
{"version":3,"file":"context.js","names":["createContext","useContext","ListContext","displayName","useListContext","ctx","Error"],"sources":["../../../src/List/context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\r\n\r\n// List Component\r\nexport interface ListContextProps {\r\n id: string | undefined;\r\n}\r\n\r\nconst ListContext = createContext<ListContextProps | null>(null);\r\nListContext.displayName = 'ListContext';\r\n\r\nexport const useListContext = (): ListContextProps => {\r\n const ctx = useContext(ListContext);\r\n if (!ctx) {\r\n throw new Error(\r\n 'useListContext must be used within a ListContext.Provider'\r\n );\r\n }\r\n return ctx;\r\n};\r\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C,C,CAEA;;AAKA,IAAMC,WAAW,gBAAGF,aAAa,CAA0B,IAA1B,CAAjC;AACAE,WAAW,CAACC,WAAZ,GAA0B,aAA1B;AAEA,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,GAAwB;EACpD,IAAMC,GAAG,GAAGJ,UAAU,CAACC,WAAD,CAAtB;;EACA,IAAI,CAACG,GAAL,EAAU;IACR,MAAM,IAAIC,KAAJ,CACJ,2DADI,CAAN;EAGD;;EACD,OAAOD,GAAP;AACD,CARM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './List';
|
|
2
|
-
export * from './ListItem';
|
|
1
|
+
export * from './List';
|
|
2
|
+
export * from './ListItem';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/List/index.ts"],"sourcesContent":["export * from './List';\nexport * from './ListItem';\n"],"mappings":"AAAA,cAAc,QAAd;AACA,cAAc,YAAd"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/List/index.ts"],"sourcesContent":["export * from './List';\r\nexport * from './ListItem';\r\n"],"mappings":"AAAA,cAAc,QAAd;AACA,cAAc,YAAd"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ElementType, HTMLAttributes } from 'react';
|
|
2
|
-
export declare type ContextMenuTriggerProps = HTMLAttributes<HTMLElement> & {
|
|
3
|
-
as?: ElementType<any>;
|
|
4
|
-
innerAs?: ElementType<any>;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
};
|
|
7
|
-
export declare const ContextMenuTrigger: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
8
|
-
as?: ElementType<any> | undefined;
|
|
9
|
-
innerAs?: ElementType<any> | undefined;
|
|
10
|
-
disabled?: boolean | undefined;
|
|
11
|
-
} & import("react").RefAttributes<HTMLElement>>;
|
|
1
|
+
import type { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
export declare type ContextMenuTriggerProps = HTMLAttributes<HTMLElement> & {
|
|
3
|
+
as?: ElementType<any>;
|
|
4
|
+
innerAs?: ElementType<any>;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const ContextMenuTrigger: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
8
|
+
as?: ElementType<any> | undefined;
|
|
9
|
+
innerAs?: ElementType<any> | undefined;
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuTrigger.js","names":["forwardRef","useId","useMenuContext","wrapEvent","ContextMenuTrigger","props","forwardedRef","as","Comp","innerAs","preferredId","id","onContextMenu","disabled","otherProps","menuListIdRef","open","buttonRef","onChange","setOffsetFn","isContextMenu","idGenerated","handleContextMenu","e","rect","currentTarget","getBoundingClientRect","current","mouseX","nativeEvent","x","mouseY","y","reference","height","preventDefault","undefined"],"sources":["../../../src/Menu/ContextMenuTrigger.tsx"],"sourcesContent":["import type {\n ElementType,\n HTMLAttributes,\n MouseEvent as ReactMouseEvent,\n} from 'react';\nimport { forwardRef, useId } from 'react';\n\nimport { useMenuContext } from './context';\nimport { wrapEvent } from '../utils/wrap-event';\nimport type { OffsetsFunction } from '../Popper';\n\nexport type ContextMenuTriggerProps = HTMLAttributes<HTMLElement> & {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n disabled?: boolean;\n};\n\nexport const ContextMenuTrigger = forwardRef<\n HTMLElement,\n ContextMenuTriggerProps\n>(function ContextMenuTrigger(props, forwardedRef) {\n const {\n as: Comp = 'div',\n innerAs,\n id: preferredId,\n onContextMenu,\n disabled,\n ...otherProps\n } = props;\n const {\n menuListIdRef,\n open,\n buttonRef,\n onChange,\n setOffsetFn,\n isContextMenu,\n } = useMenuContext();\n\n const idGenerated = useId();\n const id = preferredId || idGenerated;\n\n const handleContextMenu = (e: ReactMouseEvent<HTMLElement>) => {\n if (disabled) {\n return;\n }\n const rect = e.currentTarget.getBoundingClientRect();\n isContextMenu.current = true;\n\n buttonRef.current = e.currentTarget;\n onChange(e, true);\n\n const mouseX = e.nativeEvent.x;\n const mouseY = e.nativeEvent.y;\n setOffsetFn(\n (): OffsetsFunction =>\n ({ reference }) =>\n [mouseX - rect.x, mouseY - rect.y - reference.height]\n );\n e.preventDefault();\n };\n\n return (\n <Comp\n ref={forwardedRef}\n as={innerAs}\n id={id}\n aria-haspopup={true}\n aria-controls={menuListIdRef.current}\n aria-expanded={open ? true : undefined}\n data-menu-trigger=\"\"\n onContextMenu={wrapEvent(onContextMenu, handleContextMenu)}\n disabled={disabled}\n {...otherProps}\n />\n );\n});\n"],"mappings":";;;AAKA,SAASA,UAAT,EAAqBC,KAArB,QAAkC,OAAlC;AAEA,SAASC,cAAT,QAA+B,WAA/B;AACA,SAASC,SAAT,QAA0B,qBAA1B;;AASA,OAAO,IAAMC,kBAAkB,gBAAGJ,UAAU,CAG1C,SAASI,kBAAT,CAA4BC,K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F;IAAA,CADS,CAAX;IAKAX,CAAC,CAACY,cAAF;EACD,CAlBD;;EAoBA,oBACE,KAAC,IAAD;IACE,GAAG,EAAE7B,YADP;IAEE,EAAE,EAAEG,OAFN;IAGE,EAAE,EAAEE,EAHN;IAIE,iBAAe,IAJjB;IAKE,iBAAeI,aAAa,CAACY,OAL/B;IAME,iBAAeX,IAAI,GAAG,IAAH,GAAUoB,SAN/B;IAOE,qBAAkB,EAPpB;IAQE,aAAa,EAAEjC,SAAS,CAACS,aAAD,EAAgBU,iBAAhB,CAR1B;IASE,QAAQ,EAAET;EATZ,GAUMC,UAVN,EADF;AAcD,CA1D2C,CAArC"}
|
|
1
|
+
{"version":3,"file":"ContextMenuTrigger.js","names":["forwardRef","useId","useMenuContext","wrapEvent","ContextMenuTrigger","props","forwardedRef","as","Comp","innerAs","preferredId","id","onContextMenu","disabled","otherProps","menuListIdRef","open","buttonRef","onChange","setOffsetFn","isContextMenu","idGenerated","handleContextMenu","e","rect","currentTarget","getBoundingClientRect","current","mouseX","nativeEvent","x","mouseY","y","reference","height","preventDefault","undefined"],"sources":["../../../src/Menu/ContextMenuTrigger.tsx"],"sourcesContent":["import type {\r\n ElementType,\r\n HTMLAttributes,\r\n MouseEvent as ReactMouseEvent,\r\n} from 'react';\r\nimport { forwardRef, useId } from 'react';\r\n\r\nimport { useMenuContext } from './context';\r\nimport { wrapEvent } from '../utils/wrap-event';\r\nimport type { OffsetsFunction } from '../Popper';\r\n\r\nexport type ContextMenuTriggerProps = HTMLAttributes<HTMLElement> & {\r\n as?: ElementType<any>;\r\n innerAs?: ElementType<any>;\r\n disabled?: boolean;\r\n};\r\n\r\nexport const ContextMenuTrigger = forwardRef<\r\n HTMLElement,\r\n ContextMenuTriggerProps\r\n>(function ContextMenuTrigger(props, forwardedRef) {\r\n const {\r\n as: Comp = 'div',\r\n innerAs,\r\n id: preferredId,\r\n onContextMenu,\r\n disabled,\r\n ...otherProps\r\n } = props;\r\n const {\r\n menuListIdRef,\r\n open,\r\n buttonRef,\r\n onChange,\r\n setOffsetFn,\r\n isContextMenu,\r\n } = useMenuContext();\r\n\r\n const idGenerated = useId();\r\n const id = preferredId || idGenerated;\r\n\r\n const handleContextMenu = (e: ReactMouseEvent<HTMLElement>) => {\r\n if (disabled) {\r\n return;\r\n }\r\n const rect = e.currentTarget.getBoundingClientRect();\r\n isContextMenu.current = true;\r\n\r\n buttonRef.current = e.currentTarget;\r\n onChange(e, true);\r\n\r\n const mouseX = e.nativeEvent.x;\r\n const mouseY = e.nativeEvent.y;\r\n setOffsetFn(\r\n (): OffsetsFunction =>\r\n ({ reference }) =>\r\n [mouseX - rect.x, mouseY - rect.y - reference.height]\r\n );\r\n e.preventDefault();\r\n };\r\n\r\n return (\r\n <Comp\r\n ref={forwardedRef}\r\n as={innerAs}\r\n id={id}\r\n aria-haspopup={true}\r\n aria-controls={menuListIdRef.current}\r\n aria-expanded={open ? true : undefined}\r\n data-menu-trigger=\"\"\r\n onContextMenu={wrapEvent(onContextMenu, handleContextMenu)}\r\n disabled={disabled}\r\n {...otherProps}\r\n />\r\n );\r\n});\r\n"],"mappings":";;;AAKA,SAASA,UAAT,EAAqBC,KAArB,QAAkC,OAAlC;AAEA,SAASC,cAAT,QAA+B,WAA/B;AACA,SAASC,SAAT,QAA0B,qBAA1B;;AASA,OAAO,IAAMC,kBAAkB,gBAAGJ,UAAU,CAG1C,SAASI,kBAAT,CAA4BC,KAA5B,EAAmCC,YAAnC,EAAiD;EACjD,gBAOID,KAPJ,CACEE,EADF;EAAA,IACMC,IADN,0BACa,KADb;EAAA,IAEEC,OAFF,GAOIJ,KAPJ,CAEEI,OAFF;EAAA,IAGMC,WAHN,GAOIL,KAPJ,CAGEM,EAHF;EAAA,IAIEC,aAJF,GAOIP,KAPJ,CAIEO,aAJF;EAAA,IAKEC,QALF,GAOIR,KAPJ,CAKEQ,QALF;EAAA,IAMKC,UANL,4BAOIT,KAPJ;;EAQA,sBAOIH,cAAc,EAPlB;EAAA,IACEa,a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Q,EAAET;EATZ,GAUMC,UAVN,EADF;AAcD,CA1D2C,CAArC"}
|
package/build/esm/Menu/Menu.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { KeyboardEvent, MouseEvent, PointerEvent, ReactNode, ElementType } from 'react';
|
|
2
|
-
export interface MenuProps {
|
|
3
|
-
as?: ElementType<any>;
|
|
4
|
-
innerAs?: ElementType<any>;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
onChange?: (e: KeyboardEvent<HTMLElement> | MouseEvent<HTMLElement> | PointerEvent<HTMLElement>, isOpen: boolean) => void;
|
|
7
|
-
open?: boolean;
|
|
8
|
-
defaultOpen?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const Menu: import("react").ForwardRefExoticComponent<MenuProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
1
|
+
import type { KeyboardEvent, MouseEvent, PointerEvent, ReactNode, ElementType } from 'react';
|
|
2
|
+
export interface MenuProps {
|
|
3
|
+
as?: ElementType<any>;
|
|
4
|
+
innerAs?: ElementType<any>;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
onChange?: (e: KeyboardEvent<HTMLElement> | MouseEvent<HTMLElement> | PointerEvent<HTMLElement>, isOpen: boolean) => void;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const Menu: import("react").ForwardRefExoticComponent<MenuProps & import("react").RefAttributes<HTMLDivElement>>;
|