@salutejs/plasma-new-hope 0.192.1-canary.1525.11803660289.0 → 0.193.0-canary.1550.11804452240.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Autocomplete/Autocomplete.css +21 -22
- package/cjs/components/Cell/Cell.js +3 -1
- package/cjs/components/Cell/Cell.js.map +1 -1
- package/cjs/components/Cell/ui/CellTextbox/CellTextbox.js +7 -1
- package/cjs/components/Cell/ui/CellTextbox/CellTextbox.js.map +1 -1
- package/cjs/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.js +4 -1
- package/cjs/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.js.map +1 -1
- package/cjs/components/Chip/Chip.js +3 -1
- package/cjs/components/Chip/Chip.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.css +21 -22
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +0 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/FloatingPopover.js +18 -4
- package/cjs/components/Combobox/ComboboxNew/FloatingPopover.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/hooks/getPathMaps.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +1 -50
- package/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/Inner.css +21 -22
- package/cjs/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +21 -22
- package/cjs/components/DatePicker/RangeDate/RangeDate.css +21 -22
- package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +21 -22
- package/cjs/components/DatePicker/SingleDate/SingleDate.css +21 -22
- package/cjs/components/Dropdown/FloatingPopover.js.map +1 -1
- package/cjs/components/Pagination/Pagination.css +86 -37
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +86 -37
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles_10zfeps.css +3 -0
- package/cjs/components/Range/Range.css +21 -22
- package/cjs/components/Select/FloatingPopover.js +87 -0
- package/cjs/components/Select/FloatingPopover.js.map +1 -0
- package/cjs/components/Select/Select.css +83 -34
- package/cjs/components/Select/Select.js +179 -139
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/Select.styles.js +17 -50
- package/cjs/components/Select/Select.styles.js.map +1 -1
- package/cjs/components/Select/Select.styles_1p5c9p3.css +2 -0
- package/cjs/components/Select/Select.tokens.js +122 -78
- package/cjs/components/Select/Select.tokens.js.map +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js +19 -72
- package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Select/hooks/usePathMaps.js +4 -1
- package/cjs/components/Select/hooks/usePathMaps.js.map +1 -1
- package/cjs/components/Select/ui/Inner/Inner.css +83 -34
- package/cjs/components/Select/ui/Inner/Inner.js +9 -9
- package/cjs/components/Select/ui/Inner/Inner.js.map +1 -1
- package/cjs/components/Select/ui/Inner/ui/Item/Item.css +83 -34
- package/cjs/components/Select/ui/Inner/ui/Item/Item.js +20 -12
- package/cjs/components/Select/ui/Inner/ui/Item/Item.js.map +1 -1
- package/cjs/components/Select/ui/Inner/ui/Item/Item.styles.js +34 -51
- package/cjs/components/Select/ui/Inner/ui/Item/Item.styles.js.map +1 -1
- package/cjs/components/Select/ui/Inner/ui/Item/Item.styles_1x4bzlm.css +9 -0
- package/cjs/components/Select/ui/Target/Target.css +58 -17
- package/cjs/components/Select/ui/Target/Target.js +34 -16
- package/cjs/components/Select/ui/Target/Target.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Button/Button.css +5 -5
- package/cjs/components/Select/ui/Target/ui/Button/Button.js +10 -14
- package/cjs/components/Select/ui/Target/ui/Button/Button.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Button/Button.styles.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Button/Button.styles.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Button/Button.styles_10g64me.css +5 -0
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.css +53 -38
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +84 -97
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +38 -103
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles_q4kc1p.css +3 -0
- package/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
- package/cjs/components/Select/utils/getFallbackPlacements.js +15 -0
- package/cjs/components/Select/utils/getFallbackPlacements.js.map +1 -0
- package/cjs/components/Select/utils/getItemId.js +10 -0
- package/cjs/components/Select/utils/getItemId.js.map +1 -0
- package/cjs/components/Select/utils/getPlacement.js +13 -0
- package/cjs/components/Select/utils/getPlacement.js.map +1 -0
- package/cjs/components/Select/utils/getView.js +2 -2
- package/cjs/components/Select/utils/getView.js.map +1 -1
- package/cjs/components/Slider/Slider.css +21 -22
- package/cjs/components/Slider/components/Double/Double.css +21 -22
- package/cjs/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +21 -22
- package/cjs/components/TextField/TextField.js +11 -2
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/components/TextField/TextField.styles.js +14 -22
- package/cjs/components/TextField/TextField.styles.js.map +1 -1
- package/{es/components/TextField/TextField.styles_grgg7q.css → cjs/components/TextField/TextField.styles_j7dqpn.css} +6 -7
- package/cjs/components/TextField/TextField.tokens.js +2 -1
- package/cjs/components/TextField/TextField.tokens.js.map +1 -1
- package/cjs/components/TextField/ui/Hint/Hint.css +20 -21
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +7 -1
- package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/cjs/components/TextField/variations/_clear/base.js +1 -1
- package/cjs/components/TextField/variations/_clear/{base_1i91sjp.css → base_1396md2.css} +1 -1
- package/cjs/components/TextField/variations/_label-placement/base.js +1 -1
- package/cjs/components/TextField/variations/_label-placement/base_gttvto.css +1 -0
- package/cjs/components/TextField/variations/_read-only/base.js +1 -1
- package/cjs/components/TextField/variations/_read-only/{base_17ypmu7.css → base_1jvcf9a.css} +1 -1
- package/cjs/components/TextField/variations/_size/base.js +1 -1
- package/cjs/components/TextField/variations/_size/{base_1xdmaqh.css → base_1tei47x.css} +1 -1
- package/cjs/components/TextField/variations/_view/base.js +1 -1
- package/cjs/components/TextField/variations/_view/{base_qhyte8.css → base_8ogww5.css} +1 -1
- package/cjs/index.css +46 -61
- package/cjs/index.js +2 -0
- package/cjs/index.js.map +1 -1
- package/cjs/utils/fixedForwardRef.js +12 -0
- package/cjs/utils/fixedForwardRef.js.map +1 -0
- package/cjs/utils/index.js.map +1 -1
- package/emotion/cjs/components/Cell/Cell.js +3 -1
- package/emotion/cjs/components/Cell/ui/CellTextbox/CellTextbox.js +7 -1
- package/emotion/cjs/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.js +4 -1
- package/emotion/cjs/components/Chip/Chip.js +3 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +0 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/FloatingPopover.js +19 -5
- package/emotion/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +1 -50
- package/emotion/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +3 -3
- package/emotion/cjs/components/Select/FloatingPopover.js +91 -0
- package/emotion/cjs/components/Select/Select.js +177 -136
- package/emotion/cjs/components/Select/Select.styles.js +13 -31
- package/emotion/cjs/components/Select/Select.tokens.js +125 -60
- package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +19 -73
- package/emotion/cjs/components/Select/hooks/usePathMaps.js +4 -1
- package/emotion/cjs/components/Select/reducers/index.js +0 -11
- package/emotion/cjs/components/Select/ui/Inner/Inner.js +9 -9
- package/emotion/cjs/components/Select/ui/Inner/ui/Item/Item.js +19 -12
- package/emotion/cjs/components/Select/ui/Inner/ui/Item/Item.styles.js +27 -50
- package/emotion/cjs/components/Select/ui/Target/Target.js +38 -18
- package/emotion/cjs/components/Select/ui/Target/ui/Button/Button.js +13 -16
- package/emotion/cjs/components/Select/ui/Target/ui/Button/Button.styles.js +6 -6
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +88 -99
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +27 -74
- package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/cjs/components/Select/utils/getFallbackPlacements.js +14 -0
- package/emotion/cjs/components/Select/utils/getItemId.js +9 -0
- package/emotion/cjs/components/Select/utils/getPlacement.js +12 -0
- package/emotion/cjs/components/Select/utils/getView.js +2 -2
- package/emotion/cjs/components/Select/utils/index.js +22 -1
- package/emotion/cjs/components/TextField/TextField.js +12 -3
- package/emotion/cjs/components/TextField/TextField.styles.js +36 -40
- package/emotion/cjs/components/TextField/TextField.tokens.js +2 -1
- package/emotion/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +7 -1
- package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.config.js +12 -12
- package/emotion/cjs/examples/plasma_b2c/components/Select/Select.config.js +28 -20
- package/emotion/cjs/examples/plasma_b2c/components/Select/Select.stories.tsx +47 -40
- package/emotion/cjs/examples/plasma_web/components/Select/Select.config.js +28 -20
- package/emotion/cjs/examples/plasma_web/components/Select/Select.stories.tsx +47 -40
- package/emotion/cjs/index.js +11 -0
- package/emotion/cjs/types/DistributiveOmit.js +5 -0
- package/emotion/cjs/types/DistributivePick.js +5 -0
- package/emotion/cjs/utils/fixedForwardRef.js +11 -0
- package/emotion/cjs/utils/index.js +9 -1
- package/emotion/es/components/Cell/Cell.js +3 -1
- package/emotion/es/components/Cell/ui/CellTextbox/CellTextbox.js +7 -1
- package/emotion/es/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.js +4 -1
- package/emotion/es/components/Chip/Chip.js +3 -1
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +0 -1
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/emotion/es/components/Combobox/ComboboxNew/FloatingPopover.js +18 -4
- package/emotion/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +1 -50
- package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +3 -3
- package/emotion/es/components/Select/FloatingPopover.js +84 -0
- package/emotion/es/components/Select/Select.js +182 -141
- package/emotion/es/components/Select/Select.styles.js +12 -30
- package/emotion/es/components/Select/Select.tokens.js +125 -60
- package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +18 -72
- package/emotion/es/components/Select/hooks/usePathMaps.js +4 -1
- package/emotion/es/components/Select/reducers/index.js +1 -2
- package/emotion/es/components/Select/ui/Inner/Inner.js +10 -10
- package/emotion/es/components/Select/ui/Inner/ui/Item/Item.js +22 -15
- package/emotion/es/components/Select/ui/Inner/ui/Item/Item.styles.js +26 -49
- package/emotion/es/components/Select/ui/Target/Target.js +35 -17
- package/emotion/es/components/Select/ui/Target/ui/Button/Button.js +11 -16
- package/emotion/es/components/Select/ui/Target/ui/Button/Button.styles.js +6 -6
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +86 -99
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +27 -74
- package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/es/components/Select/utils/getFallbackPlacements.js +8 -0
- package/emotion/es/components/Select/utils/getItemId.js +3 -0
- package/emotion/es/components/Select/utils/getPlacement.js +6 -0
- package/emotion/es/components/Select/utils/getView.js +2 -2
- package/emotion/es/components/Select/utils/index.js +4 -1
- package/emotion/es/components/TextField/TextField.js +12 -3
- package/emotion/es/components/TextField/TextField.styles.js +36 -40
- package/emotion/es/components/TextField/TextField.tokens.js +2 -1
- package/emotion/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +7 -1
- package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.config.js +12 -12
- package/emotion/es/examples/plasma_b2c/components/Select/Select.config.js +29 -21
- package/emotion/es/examples/plasma_b2c/components/Select/Select.stories.tsx +47 -40
- package/emotion/es/examples/plasma_web/components/Select/Select.config.js +29 -21
- package/emotion/es/examples/plasma_web/components/Select/Select.stories.tsx +47 -40
- package/emotion/es/index.js +1 -0
- package/emotion/es/types/DistributiveOmit.js +1 -0
- package/emotion/es/types/DistributivePick.js +1 -0
- package/emotion/es/utils/fixedForwardRef.js +4 -0
- package/emotion/es/utils/index.js +2 -1
- package/es/components/Autocomplete/Autocomplete.css +21 -22
- package/es/components/Cell/Cell.js +3 -1
- package/es/components/Cell/Cell.js.map +1 -1
- package/es/components/Cell/ui/CellTextbox/CellTextbox.js +7 -1
- package/es/components/Cell/ui/CellTextbox/CellTextbox.js.map +1 -1
- package/es/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.js +4 -1
- package/es/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.js.map +1 -1
- package/es/components/Chip/Chip.js +3 -1
- package/es/components/Chip/Chip.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.css +21 -22
- package/es/components/Combobox/ComboboxNew/Combobox.js +0 -1
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/es/components/Combobox/ComboboxNew/Combobox.tokens.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/FloatingPopover.js +18 -4
- package/es/components/Combobox/ComboboxNew/FloatingPopover.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/hooks/getPathMaps.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +1 -50
- package/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/ui/Inner/Inner.css +21 -22
- package/es/components/Combobox/ComboboxNew/ui/Inner/ui/Item/Item.css +21 -22
- package/es/components/DatePicker/RangeDate/RangeDate.css +21 -22
- package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +21 -22
- package/es/components/DatePicker/SingleDate/SingleDate.css +21 -22
- package/es/components/Dropdown/FloatingPopover.js.map +1 -1
- package/es/components/Pagination/Pagination.css +86 -37
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +86 -37
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js.map +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles_10zfeps.css +3 -0
- package/es/components/Range/Range.css +21 -22
- package/es/components/Select/FloatingPopover.js +83 -0
- package/es/components/Select/FloatingPopover.js.map +1 -0
- package/es/components/Select/Select.css +83 -34
- package/es/components/Select/Select.js +182 -142
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/Select.styles.js +18 -48
- package/es/components/Select/Select.styles.js.map +1 -1
- package/es/components/Select/Select.styles_1p5c9p3.css +2 -0
- package/es/components/Select/Select.tokens.js +123 -78
- package/es/components/Select/Select.tokens.js.map +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js +19 -73
- package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Select/hooks/usePathMaps.js +4 -1
- package/es/components/Select/hooks/usePathMaps.js.map +1 -1
- package/es/components/Select/ui/Inner/Inner.css +83 -34
- package/es/components/Select/ui/Inner/Inner.js +10 -10
- package/es/components/Select/ui/Inner/Inner.js.map +1 -1
- package/es/components/Select/ui/Inner/ui/Item/Item.css +83 -34
- package/es/components/Select/ui/Inner/ui/Item/Item.js +22 -14
- package/es/components/Select/ui/Inner/ui/Item/Item.js.map +1 -1
- package/es/components/Select/ui/Inner/ui/Item/Item.styles.js +33 -50
- package/es/components/Select/ui/Inner/ui/Item/Item.styles.js.map +1 -1
- package/es/components/Select/ui/Inner/ui/Item/Item.styles_1x4bzlm.css +9 -0
- package/es/components/Select/ui/Target/Target.css +58 -17
- package/es/components/Select/ui/Target/Target.js +35 -17
- package/es/components/Select/ui/Target/Target.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Button/Button.css +5 -5
- package/es/components/Select/ui/Target/ui/Button/Button.js +11 -15
- package/es/components/Select/ui/Target/ui/Button/Button.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Button/Button.styles.js +1 -1
- package/es/components/Select/ui/Target/ui/Button/Button.styles.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Button/Button.styles_10g64me.css +5 -0
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.css +53 -38
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +86 -99
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +39 -95
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles_q4kc1p.css +3 -0
- package/es/components/Select/utils/getButtonLabel.js +1 -1
- package/es/components/Select/utils/getButtonLabel.js.map +1 -1
- package/es/components/Select/utils/getFallbackPlacements.js +11 -0
- package/es/components/Select/utils/getFallbackPlacements.js.map +1 -0
- package/es/components/Select/utils/getItemId.js +6 -0
- package/es/components/Select/utils/getItemId.js.map +1 -0
- package/es/components/Select/utils/getPlacement.js +9 -0
- package/es/components/Select/utils/getPlacement.js.map +1 -0
- package/es/components/Select/utils/getView.js +2 -2
- package/es/components/Select/utils/getView.js.map +1 -1
- package/es/components/Slider/Slider.css +21 -22
- package/es/components/Slider/components/Double/Double.css +21 -22
- package/es/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +21 -22
- package/es/components/TextField/TextField.js +11 -2
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/components/TextField/TextField.styles.js +14 -22
- package/es/components/TextField/TextField.styles.js.map +1 -1
- package/{cjs/components/TextField/TextField.styles_grgg7q.css → es/components/TextField/TextField.styles_j7dqpn.css} +6 -7
- package/es/components/TextField/TextField.tokens.js +2 -1
- package/es/components/TextField/TextField.tokens.js.map +1 -1
- package/es/components/TextField/ui/Hint/Hint.css +20 -21
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +7 -1
- package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
- package/es/components/TextField/variations/_clear/base.js +1 -1
- package/es/components/TextField/variations/_clear/{base_1i91sjp.css → base_1396md2.css} +1 -1
- package/es/components/TextField/variations/_label-placement/base.js +1 -1
- package/es/components/TextField/variations/_label-placement/base_gttvto.css +1 -0
- package/es/components/TextField/variations/_read-only/base.js +1 -1
- package/es/components/TextField/variations/_read-only/{base_17ypmu7.css → base_1jvcf9a.css} +1 -1
- package/es/components/TextField/variations/_size/base.js +1 -1
- package/es/components/TextField/variations/_size/{base_1xdmaqh.css → base_1tei47x.css} +1 -1
- package/es/components/TextField/variations/_view/base.js +1 -1
- package/es/components/TextField/variations/_view/{base_qhyte8.css → base_8ogww5.css} +1 -1
- package/es/index.css +46 -61
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/utils/fixedForwardRef.js +8 -0
- package/es/utils/fixedForwardRef.js.map +1 -0
- package/es/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Cell/Cell.js +3 -1
- package/styled-components/cjs/components/Cell/ui/CellTextbox/CellTextbox.js +7 -1
- package/styled-components/cjs/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.js +4 -1
- package/styled-components/cjs/components/Chip/Chip.js +3 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +0 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/FloatingPopover.js +19 -5
- package/styled-components/cjs/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +1 -50
- package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
- package/styled-components/cjs/components/Select/FloatingPopover.js +91 -0
- package/styled-components/cjs/components/Select/Select.js +177 -136
- package/styled-components/cjs/components/Select/Select.styles.js +12 -27
- package/styled-components/cjs/components/Select/Select.tokens.js +125 -60
- package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +19 -73
- package/styled-components/cjs/components/Select/hooks/usePathMaps.js +4 -1
- package/styled-components/cjs/components/Select/reducers/index.js +0 -11
- package/styled-components/cjs/components/Select/ui/Inner/Inner.js +9 -9
- package/styled-components/cjs/components/Select/ui/Inner/ui/Item/Item.js +19 -12
- package/styled-components/cjs/components/Select/ui/Inner/ui/Item/Item.styles.js +20 -26
- package/styled-components/cjs/components/Select/ui/Target/Target.js +38 -18
- package/styled-components/cjs/components/Select/ui/Target/ui/Button/Button.js +13 -16
- package/styled-components/cjs/components/Select/ui/Target/ui/Button/Button.styles.js +3 -3
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +88 -99
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +23 -61
- package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/cjs/components/Select/utils/getFallbackPlacements.js +14 -0
- package/styled-components/cjs/components/Select/utils/getItemId.js +9 -0
- package/styled-components/cjs/components/Select/utils/getPlacement.js +12 -0
- package/styled-components/cjs/components/Select/utils/getView.js +2 -2
- package/styled-components/cjs/components/Select/utils/index.js +22 -1
- package/styled-components/cjs/components/TextField/TextField.js +11 -2
- package/styled-components/cjs/components/TextField/TextField.styles.js +12 -15
- package/styled-components/cjs/components/TextField/TextField.tokens.js +2 -1
- package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +7 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Select/Select.config.js +28 -20
- package/styled-components/cjs/examples/plasma_b2c/components/Select/Select.stories.tsx +47 -40
- package/styled-components/cjs/examples/plasma_web/components/Select/Select.config.js +28 -20
- package/styled-components/cjs/examples/plasma_web/components/Select/Select.stories.tsx +47 -40
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/cjs/types/DistributiveOmit.js +5 -0
- package/styled-components/cjs/types/DistributivePick.js +5 -0
- package/styled-components/cjs/utils/fixedForwardRef.js +11 -0
- package/styled-components/cjs/utils/index.js +9 -1
- package/styled-components/es/components/Cell/Cell.js +3 -1
- package/styled-components/es/components/Cell/ui/CellTextbox/CellTextbox.js +7 -1
- package/styled-components/es/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.js +4 -1
- package/styled-components/es/components/Chip/Chip.js +3 -1
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +0 -1
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.tokens.js +0 -1
- package/styled-components/es/components/Combobox/ComboboxNew/FloatingPopover.js +18 -4
- package/styled-components/es/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.js +1 -50
- package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
- package/styled-components/es/components/Select/FloatingPopover.js +84 -0
- package/styled-components/es/components/Select/Select.js +182 -141
- package/styled-components/es/components/Select/Select.styles.js +11 -26
- package/styled-components/es/components/Select/Select.tokens.js +125 -60
- package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +18 -72
- package/styled-components/es/components/Select/hooks/usePathMaps.js +4 -1
- package/styled-components/es/components/Select/reducers/index.js +1 -2
- package/styled-components/es/components/Select/ui/Inner/Inner.js +10 -10
- package/styled-components/es/components/Select/ui/Inner/ui/Item/Item.js +22 -15
- package/styled-components/es/components/Select/ui/Inner/ui/Item/Item.styles.js +19 -25
- package/styled-components/es/components/Select/ui/Target/Target.js +35 -17
- package/styled-components/es/components/Select/ui/Target/ui/Button/Button.js +11 -16
- package/styled-components/es/components/Select/ui/Target/ui/Button/Button.styles.js +3 -3
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +86 -99
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +23 -61
- package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/es/components/Select/utils/getFallbackPlacements.js +8 -0
- package/styled-components/es/components/Select/utils/getItemId.js +3 -0
- package/styled-components/es/components/Select/utils/getPlacement.js +6 -0
- package/styled-components/es/components/Select/utils/getView.js +2 -2
- package/styled-components/es/components/Select/utils/index.js +4 -1
- package/styled-components/es/components/TextField/TextField.js +11 -2
- package/styled-components/es/components/TextField/TextField.styles.js +12 -15
- package/styled-components/es/components/TextField/TextField.tokens.js +2 -1
- package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +7 -1
- package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Select/Select.config.js +29 -21
- package/styled-components/es/examples/plasma_b2c/components/Select/Select.stories.tsx +47 -40
- package/styled-components/es/examples/plasma_web/components/Select/Select.config.js +29 -21
- package/styled-components/es/examples/plasma_web/components/Select/Select.stories.tsx +47 -40
- package/styled-components/es/index.js +1 -0
- package/styled-components/es/types/DistributiveOmit.js +1 -0
- package/styled-components/es/types/DistributivePick.js +1 -0
- package/styled-components/es/utils/fixedForwardRef.js +4 -0
- package/styled-components/es/utils/index.js +2 -1
- package/types/components/Attach/ui/Button/Button.styles.d.ts +2 -2
- package/types/components/Attach/ui/IconButton/IconButton.styles.d.ts +4 -4
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts +16 -16
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarHeader/CalendarHeader.styles.d.ts +2 -2
- package/types/components/Cell/Cell.d.ts.map +1 -1
- package/types/components/Cell/ui/CellTextbox/CellTextbox.d.ts.map +1 -1
- package/types/components/Cell/ui/CellTextboxTitle/CellTextboxTitle.d.ts.map +1 -1
- package/types/components/Chip/Chip.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.tokens.d.ts +0 -1
- package/types/components/Combobox/ComboboxNew/Combobox.tokens.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +4 -3
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/FloatingPopover.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.d.ts +1 -3
- package/types/components/Combobox/ComboboxNew/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts +16 -16
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts +16 -16
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts.map +1 -1
- package/types/components/EmptyState/EmptyState.styles.d.ts +2 -2
- package/types/components/Notification/Notification.styles.d.ts +2 -2
- package/types/components/NumberInput/ui/ActionButton/ActionButton.styles.d.ts +2 -2
- package/types/components/Pagination/Pagination.styles.d.ts +4 -4
- package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +40 -40
- package/types/components/Panel/ui/PanelHeader/PanelHeader.styles.d.ts +2 -2
- package/types/components/Range/Range.styles.d.ts +16 -16
- package/types/components/Range/Range.styles.d.ts.map +1 -1
- package/types/components/Select/FloatingPopover.d.ts +5 -0
- package/types/components/Select/FloatingPopover.d.ts.map +1 -0
- package/types/components/Select/Select.d.ts +5 -11
- package/types/components/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.styles.d.ts +0 -9
- package/types/components/Select/Select.styles.d.ts.map +1 -1
- package/types/components/Select/Select.tokens.d.ts +121 -58
- package/types/components/Select/Select.tokens.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +41 -20
- package/types/components/Select/Select.types.d.ts.map +1 -1
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts +5 -11
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/Select/hooks/usePathMaps.d.ts +2 -1
- package/types/components/Select/hooks/usePathMaps.d.ts.map +1 -1
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Select/index.d.ts.map +1 -1
- package/types/components/Select/reducers/index.d.ts +0 -1
- package/types/components/Select/reducers/index.d.ts.map +1 -1
- package/types/components/Select/ui/Inner/Inner.d.ts.map +1 -1
- package/types/components/Select/ui/Inner/ui/Item/Item.d.ts.map +1 -1
- package/types/components/Select/ui/Inner/ui/Item/Item.styles.d.ts +32 -2
- package/types/components/Select/ui/Inner/ui/Item/Item.styles.d.ts.map +1 -1
- package/types/components/Select/ui/Inner/ui/Item/Item.types.d.ts +9 -0
- package/types/components/Select/ui/Inner/ui/Item/Item.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/Target.d.ts +14 -2
- package/types/components/Select/ui/Target/Target.d.ts.map +1 -1
- package/types/components/Select/ui/Target/Target.types.d.ts +10 -9
- package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Button/Button.d.ts +1 -1
- package/types/components/Select/ui/Target/ui/Button/Button.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Button/Button.styles.d.ts +2 -2
- package/types/components/Select/ui/Target/ui/Button/Button.types.d.ts +1 -1
- package/types/components/Select/ui/Target/ui/Button/Button.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.d.ts +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +628 -60
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.types.d.ts +1 -4
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.types.d.ts.map +1 -1
- package/types/components/Select/utils/getFallbackPlacements.d.ts +4 -0
- package/types/components/Select/utils/getFallbackPlacements.d.ts.map +1 -0
- package/types/components/Select/utils/getItemId.d.ts +2 -0
- package/types/components/Select/utils/getItemId.d.ts.map +1 -0
- package/types/components/Select/utils/getPlacement.d.ts +4 -0
- package/types/components/Select/utils/getPlacement.d.ts.map +1 -0
- package/types/components/Select/utils/getView.d.ts +1 -1
- package/types/components/Select/utils/getView.d.ts.map +1 -1
- package/types/components/Select/utils/index.d.ts +3 -0
- package/types/components/Select/utils/index.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.styles.d.ts +16 -16
- package/types/components/Slider/components/Double/Double.styles.d.ts.map +1 -1
- package/types/components/TextField/TextField.d.ts.map +1 -1
- package/types/components/TextField/TextField.styles.d.ts +1 -3
- package/types/components/TextField/TextField.styles.d.ts.map +1 -1
- package/types/components/TextField/TextField.tokens.d.ts +1 -0
- package/types/components/TextField/TextField.tokens.d.ts.map +1 -1
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts +3 -1
- package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts.map +1 -1
- package/types/components/Toast/Toast.styles.d.ts +2 -2
- package/types/components/Toast/utils.d.ts +2 -2
- package/types/examples/plasma_b2c/components/Attach/Attach.d.ts +8 -8
- package/types/examples/plasma_b2c/components/Button/Button.d.ts +2 -2
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +24 -24
- package/types/examples/plasma_b2c/components/IconButton/IconButton.d.ts +2 -2
- package/types/examples/plasma_b2c/components/Mask/Mask.d.ts +16 -16
- package/types/examples/plasma_b2c/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Radiobox/Radiobox.d.ts +1 -1
- package/types/examples/plasma_b2c/components/Radiobox/Radiobox.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Select/Select.config.d.ts +15 -7
- package/types/examples/plasma_b2c/components/Select/Select.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Select/Select.d.ts +53 -46
- package/types/examples/plasma_b2c/components/Select/Select.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/TextArea/TextArea.d.ts +16 -16
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +16 -16
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Attach/Attach.d.ts +8 -8
- package/types/examples/plasma_web/components/Button/Button.d.ts +2 -2
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +24 -24
- package/types/examples/plasma_web/components/IconButton/IconButton.d.ts +2 -2
- package/types/examples/plasma_web/components/Mask/Mask.d.ts +16 -16
- package/types/examples/plasma_web/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Radiobox/Radiobox.d.ts +1 -1
- package/types/examples/plasma_web/components/Radiobox/Radiobox.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Select/Select.config.d.ts +15 -7
- package/types/examples/plasma_web/components/Select/Select.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Select/Select.d.ts +53 -46
- package/types/examples/plasma_web/components/Select/Select.d.ts.map +1 -1
- package/types/examples/plasma_web/components/TextArea/TextArea.d.ts +16 -16
- package/types/examples/plasma_web/components/TextField/TextField.d.ts +16 -16
- package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/types/DistributiveOmit.d.ts +2 -0
- package/types/types/DistributiveOmit.d.ts.map +1 -0
- package/types/types/DistributivePick.d.ts +2 -0
- package/types/types/DistributivePick.d.ts.map +1 -0
- package/types/types/index.d.ts +2 -0
- package/types/types/index.d.ts.map +1 -1
- package/types/utils/fixedForwardRef.d.ts +3 -0
- package/types/utils/fixedForwardRef.d.ts.map +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/index.d.ts.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles_1fesyfv.css +0 -3
- package/cjs/components/Select/Select.styles_768h42.css +0 -5
- package/cjs/components/Select/reducers/focusedChipIndexReducer.js +0 -39
- package/cjs/components/Select/reducers/focusedChipIndexReducer.js.map +0 -1
- package/cjs/components/Select/ui/Inner/ui/Item/Item.styles_8oe5oy.css +0 -9
- package/cjs/components/Select/ui/Target/ui/Button/Button.styles_lxxm4p.css +0 -5
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles_1damf5p.css +0 -12
- package/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.css +0 -21
- package/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.js +0 -36
- package/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.js.map +0 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.js +0 -22
- package/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.js.map +0 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles_1a752pa.css +0 -1
- package/cjs/components/Select/variations/_size/base.js +0 -9
- package/cjs/components/Select/variations/_size/base.js.map +0 -1
- package/cjs/components/Select/variations/_size/base_x642ct.css +0 -1
- package/cjs/components/Select/variations/_view/base.js +0 -9
- package/cjs/components/Select/variations/_view/base.js.map +0 -1
- package/cjs/components/Select/variations/_view/base_x642ct.css +0 -1
- package/cjs/components/TextField/variations/_label-placement/base_3domm.css +0 -1
- package/emotion/cjs/components/Select/reducers/focusedChipIndexReducer.js +0 -38
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.js +0 -37
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.js +0 -22
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/ui/index.js +0 -16
- package/emotion/cjs/components/Select/variations/_size/base.js +0 -8
- package/emotion/cjs/components/Select/variations/_size/tokens.json +0 -9
- package/emotion/cjs/components/Select/variations/_view/base.js +0 -8
- package/emotion/cjs/components/Select/variations/_view/tokens.json +0 -1
- package/emotion/es/components/Select/reducers/focusedChipIndexReducer.js +0 -32
- package/emotion/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.js +0 -28
- package/emotion/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.js +0 -15
- package/emotion/es/components/Select/ui/Target/ui/Textfield/ui/index.js +0 -1
- package/emotion/es/components/Select/variations/_size/base.js +0 -2
- package/emotion/es/components/Select/variations/_size/tokens.json +0 -9
- package/emotion/es/components/Select/variations/_view/base.js +0 -2
- package/emotion/es/components/Select/variations/_view/tokens.json +0 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles_1fesyfv.css +0 -3
- package/es/components/Select/Select.styles_768h42.css +0 -5
- package/es/components/Select/reducers/focusedChipIndexReducer.js +0 -35
- package/es/components/Select/reducers/focusedChipIndexReducer.js.map +0 -1
- package/es/components/Select/ui/Inner/ui/Item/Item.styles_8oe5oy.css +0 -9
- package/es/components/Select/ui/Target/ui/Button/Button.styles_lxxm4p.css +0 -5
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles_1damf5p.css +0 -12
- package/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.css +0 -21
- package/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.js +0 -32
- package/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.js.map +0 -1
- package/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.js +0 -18
- package/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.js.map +0 -1
- package/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles_1a752pa.css +0 -1
- package/es/components/Select/variations/_size/base.js +0 -5
- package/es/components/Select/variations/_size/base.js.map +0 -1
- package/es/components/Select/variations/_size/base_x642ct.css +0 -1
- package/es/components/Select/variations/_view/base.js +0 -5
- package/es/components/Select/variations/_view/base.js.map +0 -1
- package/es/components/Select/variations/_view/base_x642ct.css +0 -1
- package/es/components/TextField/variations/_label-placement/base_3domm.css +0 -1
- package/styled-components/cjs/components/Select/reducers/focusedChipIndexReducer.js +0 -38
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.js +0 -37
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.js +0 -21
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/ui/index.js +0 -16
- package/styled-components/cjs/components/Select/variations/_size/base.js +0 -8
- package/styled-components/cjs/components/Select/variations/_size/tokens.json +0 -9
- package/styled-components/cjs/components/Select/variations/_view/base.js +0 -8
- package/styled-components/cjs/components/Select/variations/_view/tokens.json +0 -1
- package/styled-components/es/components/Select/reducers/focusedChipIndexReducer.js +0 -32
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.js +0 -28
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.js +0 -14
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/ui/index.js +0 -1
- package/styled-components/es/components/Select/variations/_size/base.js +0 -2
- package/styled-components/es/components/Select/variations/_size/tokens.json +0 -9
- package/styled-components/es/components/Select/variations/_view/base.js +0 -2
- package/styled-components/es/components/Select/variations/_view/tokens.json +0 -1
- package/types/components/Select/reducers/focusedChipIndexReducer.d.ts +0 -11
- package/types/components/Select/reducers/focusedChipIndexReducer.d.ts.map +0 -1
- package/types/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.d.ts +0 -9
- package/types/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.d.ts.map +0 -1
- package/types/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.d.ts +0 -3
- package/types/components/Select/ui/Target/ui/Textfield/ui/Chip/Chip.styles.d.ts.map +0 -1
- package/types/components/Select/ui/Target/ui/Textfield/ui/index.d.ts +0 -2
- package/types/components/Select/ui/Target/ui/Textfield/ui/index.d.ts.map +0 -1
- package/types/components/Select/variations/_size/base.d.ts +0 -2
- package/types/components/Select/variations/_size/base.d.ts.map +0 -1
- package/types/components/Select/variations/_view/base.d.ts +0 -2
- package/types/components/Select/variations/_view/base.d.ts.map +0 -1
@@ -18,7 +18,7 @@ var keys = {
|
|
18
18
|
PageUp: 'PageUp',
|
19
19
|
PageDown: 'PageDown'
|
20
20
|
};
|
21
|
-
var
|
21
|
+
var getItemByFocused = function getItemByFocused(focusedPath, focusedToValueMap) {
|
22
22
|
var focusedPathAsString = focusedPath.reduce(function (acc, n) {
|
23
23
|
return "".concat(acc, "/").concat(n);
|
24
24
|
}, '').replace(/^(\/)/, '');
|
@@ -31,14 +31,8 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
31
31
|
dispatchPath = _ref.dispatchPath,
|
32
32
|
pathMap = _ref.pathMap,
|
33
33
|
focusedToValueMap = _ref.focusedToValueMap,
|
34
|
-
|
35
|
-
handlePressDown = _ref.handlePressDown
|
36
|
-
focusedChipIndex = _ref.focusedChipIndex,
|
37
|
-
dispatchFocusedChipIndex = _ref.dispatchFocusedChipIndex,
|
38
|
-
value = _ref.value,
|
39
|
-
valueToItemMap = _ref.valueToItemMap,
|
40
|
-
multiselect = _ref.multiselect,
|
41
|
-
isTargetAmount = _ref.isTargetAmount;
|
34
|
+
handleListToggle = _ref.handleListToggle,
|
35
|
+
handlePressDown = _ref.handlePressDown;
|
42
36
|
var currentIndex = (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[focusedPath.length - 1]) || 0;
|
43
37
|
var currentLength = pathMap.get(path === null || path === void 0 ? void 0 : path[focusedPath.length - 1]) || 0;
|
44
38
|
var onKeyDown = function onKeyDown(event) {
|
@@ -64,12 +58,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
64
58
|
dispatchFocusedPath({
|
65
59
|
type: 'set_initial_focus'
|
66
60
|
});
|
67
|
-
|
68
|
-
}
|
69
|
-
if (Array.isArray(value)) {
|
70
|
-
dispatchFocusedChipIndex({
|
71
|
-
type: 'reset'
|
72
|
-
});
|
61
|
+
handleListToggle(true);
|
73
62
|
}
|
74
63
|
break;
|
75
64
|
}
|
@@ -94,12 +83,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
94
83
|
dispatchFocusedPath({
|
95
84
|
type: 'set_initial_focus'
|
96
85
|
});
|
97
|
-
|
98
|
-
}
|
99
|
-
if (Array.isArray(value)) {
|
100
|
-
dispatchFocusedChipIndex({
|
101
|
-
type: 'reset'
|
102
|
-
});
|
86
|
+
handleListToggle(true);
|
103
87
|
}
|
104
88
|
break;
|
105
89
|
}
|
@@ -118,12 +102,8 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
118
102
|
}
|
119
103
|
}
|
120
104
|
if (path.length === 1) {
|
121
|
-
|
105
|
+
handleListToggle(false);
|
122
106
|
}
|
123
|
-
} else if (Array.isArray(value) && !isTargetAmount) {
|
124
|
-
dispatchFocusedChipIndex({
|
125
|
-
type: 'moveLeft'
|
126
|
-
});
|
127
107
|
}
|
128
108
|
break;
|
129
109
|
}
|
@@ -133,7 +113,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
133
113
|
if (!focusedPath.length) {
|
134
114
|
break;
|
135
115
|
}
|
136
|
-
var currentItem =
|
116
|
+
var currentItem = getItemByFocused(focusedPath, focusedToValueMap);
|
137
117
|
if (currentItem !== null && currentItem !== void 0 && currentItem.items) {
|
138
118
|
if (path.length > focusedPath.length) {
|
139
119
|
dispatchFocusedPath({
|
@@ -147,39 +127,13 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
147
127
|
});
|
148
128
|
}
|
149
129
|
}
|
150
|
-
} else if (Array.isArray(value) && !isTargetAmount) {
|
151
|
-
dispatchFocusedChipIndex({
|
152
|
-
type: 'moveRight',
|
153
|
-
total: value.length
|
154
|
-
});
|
155
|
-
}
|
156
|
-
break;
|
157
|
-
}
|
158
|
-
case keys.Backspace:
|
159
|
-
{
|
160
|
-
if (!multiselect || !Array.isArray(value)) break;
|
161
|
-
if (focusedChipIndex !== null) {
|
162
|
-
var _currentItem = valueToItemMap.get(value[focusedChipIndex]);
|
163
|
-
handlePressDown(_currentItem);
|
164
|
-
if (value.length === 1) {
|
165
|
-
dispatchFocusedChipIndex({
|
166
|
-
type: 'reset'
|
167
|
-
});
|
168
|
-
break;
|
169
|
-
}
|
170
|
-
if (focusedChipIndex === value.length - 1) {
|
171
|
-
dispatchFocusedChipIndex({
|
172
|
-
type: 'moveLeft'
|
173
|
-
});
|
174
|
-
break;
|
175
|
-
}
|
176
130
|
}
|
177
131
|
break;
|
178
132
|
}
|
179
133
|
case keys.Space:
|
180
134
|
{
|
181
135
|
event.preventDefault();
|
182
|
-
var
|
136
|
+
var _currentItem = getItemByFocused(focusedPath, focusedToValueMap);
|
183
137
|
if (!path[0]) {
|
184
138
|
dispatchPath({
|
185
139
|
type: 'opened_first_level'
|
@@ -189,22 +143,17 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
189
143
|
});
|
190
144
|
break;
|
191
145
|
}
|
192
|
-
if (!
|
146
|
+
if (!_currentItem || _currentItem !== null && _currentItem !== void 0 && _currentItem.disabled) {
|
193
147
|
break;
|
194
148
|
}
|
195
|
-
handlePressDown(
|
149
|
+
handlePressDown(_currentItem);
|
196
150
|
break;
|
197
151
|
}
|
198
152
|
case keys.Enter:
|
199
153
|
{
|
200
154
|
event.preventDefault();
|
201
|
-
|
202
|
-
|
203
|
-
type: 'reset'
|
204
|
-
});
|
205
|
-
}
|
206
|
-
var _currentItem3 = getFurtherPath(focusedPath, focusedToValueMap);
|
207
|
-
if (_currentItem3 !== null && _currentItem3 !== void 0 && _currentItem3.disabled) {
|
155
|
+
var _currentItem2 = getItemByFocused(focusedPath, focusedToValueMap);
|
156
|
+
if (_currentItem2 !== null && _currentItem2 !== void 0 && _currentItem2.disabled) {
|
208
157
|
break;
|
209
158
|
}
|
210
159
|
if (!path[0]) {
|
@@ -216,7 +165,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
216
165
|
});
|
217
166
|
break;
|
218
167
|
}
|
219
|
-
if (
|
168
|
+
if (_currentItem2 !== null && _currentItem2 !== void 0 && _currentItem2.items) {
|
220
169
|
if (path.length > focusedPath.length) {
|
221
170
|
dispatchFocusedPath({
|
222
171
|
type: 'add_focus',
|
@@ -225,12 +174,12 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
225
174
|
} else {
|
226
175
|
dispatchPath({
|
227
176
|
type: 'added_next_level',
|
228
|
-
value:
|
177
|
+
value: _currentItem2.value.toString()
|
229
178
|
});
|
230
179
|
}
|
231
180
|
break;
|
232
181
|
}
|
233
|
-
handlePressDown(
|
182
|
+
handlePressDown(_currentItem2);
|
234
183
|
break;
|
235
184
|
}
|
236
185
|
case keys.Tab:
|
@@ -242,10 +191,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
242
191
|
dispatchPath({
|
243
192
|
type: 'reset'
|
244
193
|
});
|
245
|
-
|
246
|
-
type: 'reset'
|
247
|
-
});
|
248
|
-
handleToggle(false);
|
194
|
+
handleListToggle(false);
|
249
195
|
break;
|
250
196
|
}
|
251
197
|
case keys.Home:
|
@@ -267,7 +213,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
267
213
|
dispatchFocusedPath({
|
268
214
|
type: 'set_initial_focus'
|
269
215
|
});
|
270
|
-
|
216
|
+
handleListToggle(true);
|
271
217
|
}
|
272
218
|
break;
|
273
219
|
}
|
@@ -291,7 +237,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
291
237
|
type: 'change_last_focus',
|
292
238
|
value: (pathMap.get('root') || 0) - 1
|
293
239
|
});
|
294
|
-
|
240
|
+
handleListToggle(true);
|
295
241
|
}
|
296
242
|
break;
|
297
243
|
}
|
@@ -348,6 +294,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
348
294
|
};
|
349
295
|
};
|
350
296
|
|
297
|
+
exports.getItemByFocused = getItemByFocused;
|
351
298
|
exports.keys = keys;
|
352
299
|
exports.useKeyNavigation = useKeyNavigation;
|
353
300
|
//# sourceMappingURL=useKeyboardNavigation.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useKeyboardNavigation.js","sources":["../../../../src/components/Select/hooks/useKeyboardNavigation.ts"],"sourcesContent":["import type { KeyboardEvent, Dispatch } from 'react';\nimport React from 'react';\n\nimport {\n PathAction,\n PathState,\n FocusedPathAction,\n FocusedPathState,\n FocusedChipIndexState,\n FocusedChipIndexAction,\n} from '../reducers';\nimport { SelectProps, DefaultValueType } from '../Select.types';\nimport type { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\nimport { PathMapType, FocusedToValueMapType, ValueToItemMapType } from './usePathMaps';\n\nconst JUMP_SIZE = 10;\n\nexport const keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n Backspace: 'Backspace',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Home: 'Home',\n End: 'End',\n PageUp: 'PageUp',\n PageDown: 'PageDown',\n};\n\nconst getFurtherPath = (focusedPath: FocusedPathState, focusedToValueMap: FocusedToValueMapType) => {\n const focusedPathAsString = focusedPath.reduce((acc, n) => `${acc}/${n}`, '').replace(/^(\\/)/, '');\n\n return focusedToValueMap.get(focusedPathAsString);\n};\n\ntype Props = {\n focusedPath: FocusedPathState;\n dispatchFocusedPath: Dispatch<FocusedPathAction>;\n path: PathState;\n dispatchPath: Dispatch<PathAction>;\n pathMap: PathMapType;\n focusedToValueMap: FocusedToValueMapType;\n handleToggle: (opened: boolean) => void;\n handlePressDown: (item: MergedDropdownNodeTransformed, e?: React.MouseEvent<HTMLElement>) => void;\n focusedChipIndex: FocusedChipIndexState;\n dispatchFocusedChipIndex: Dispatch<FocusedChipIndexAction>;\n value: DefaultValueType;\n valueToItemMap: ValueToItemMapType;\n multiselect: SelectProps['multiselect'];\n isTargetAmount: SelectProps['isTargetAmount'];\n};\n\ntype ReturnedProps = {\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n};\n\nexport const useKeyNavigation = ({\n focusedPath,\n dispatchFocusedPath,\n path,\n dispatchPath,\n pathMap,\n focusedToValueMap,\n handleToggle,\n handlePressDown,\n focusedChipIndex,\n dispatchFocusedChipIndex,\n value,\n valueToItemMap,\n multiselect,\n isTargetAmount,\n}: Props): ReturnedProps => {\n const currentIndex: number = focusedPath?.[focusedPath.length - 1] || 0;\n const currentLength: number = pathMap.get(path?.[focusedPath.length - 1]) || 0;\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n switch (event.code) {\n case keys.ArrowUp: {\n if (focusedPath.length) {\n if (currentIndex > 0) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleToggle(true);\n }\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n break;\n }\n\n case keys.ArrowDown: {\n if (focusedPath.length) {\n if (currentIndex + 1 < currentLength) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleToggle(true);\n }\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n break;\n }\n\n case keys.ArrowLeft: {\n if (path[0]) {\n if (focusedPath.length) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n } else {\n dispatchFocusedPath({ type: 'return_prev_focus' });\n }\n }\n\n if (path.length === 1) {\n handleToggle(false);\n }\n } else if (Array.isArray(value) && !isTargetAmount) {\n dispatchFocusedChipIndex({ type: 'moveLeft' });\n }\n\n break;\n }\n\n case keys.ArrowRight: {\n if (path[0]) {\n if (!focusedPath.length) {\n break;\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n }\n } else if (Array.isArray(value) && !isTargetAmount) {\n dispatchFocusedChipIndex({ type: 'moveRight', total: value.length });\n }\n\n break;\n }\n\n case keys.Backspace: {\n if (!multiselect || !Array.isArray(value)) break;\n\n if (focusedChipIndex !== null) {\n const currentItem = valueToItemMap.get(value[focusedChipIndex])!;\n\n handlePressDown(currentItem);\n\n if (value.length === 1) {\n dispatchFocusedChipIndex({ type: 'reset' });\n\n break;\n }\n\n if (focusedChipIndex === value.length - 1) {\n dispatchFocusedChipIndex({ type: 'moveLeft' });\n\n break;\n }\n }\n\n break;\n }\n\n case keys.Space: {\n event.preventDefault();\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n if (!currentItem || currentItem?.disabled) {\n break;\n }\n\n handlePressDown(currentItem);\n\n break;\n }\n\n case keys.Enter: {\n event.preventDefault();\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap)!;\n\n if (currentItem?.disabled) {\n break;\n }\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n\n break;\n }\n\n handlePressDown(currentItem);\n\n break;\n }\n\n case keys.Tab:\n case keys.Escape: {\n dispatchFocusedPath({ type: 'reset' });\n dispatchPath({ type: 'reset' });\n dispatchFocusedChipIndex({ type: 'reset' });\n handleToggle(false);\n\n break;\n }\n\n case keys.Home: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n\n handleToggle(true);\n }\n\n break;\n }\n\n case keys.End: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'change_last_focus', value: (pathMap.get('root') || 0) - 1 });\n\n handleToggle(true);\n }\n\n break;\n }\n\n case keys.PageUp: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - JUMP_SIZE });\n }\n\n break;\n }\n\n case keys.PageDown: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentLength - currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + JUMP_SIZE });\n }\n\n break;\n }\n\n default: {\n break;\n }\n }\n };\n\n return { onKeyDown };\n};\n"],"names":["JUMP_SIZE","keys","Enter","Space","Tab","Escape","Backspace","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","getFurtherPath","focusedPath","focusedToValueMap","focusedPathAsString","reduce","acc","n","concat","replace","get","useKeyNavigation","_ref","dispatchFocusedPath","path","dispatchPath","pathMap","handleToggle","handlePressDown","focusedChipIndex","dispatchFocusedChipIndex","value","valueToItemMap","multiselect","isTargetAmount","currentIndex","length","currentLength","onKeyDown","event","code","type","Array","isArray","currentItem","items","toString","total","preventDefault","disabled"],"mappings":";;;;AAgBA,IAAMA,SAAS,GAAG,EAAE,CAAA;AAEb,IAAMC,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAA;AACd,EAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,WAA6B,EAAEC,iBAAwC,EAAK;EAChG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AAAE,aAAC,CAAC,CAAA;AAChE,WAAC,MAAM;AACHR,YAAAA,mBAAmB,CAAC;AAAEkB,cAAAA,IAAI,EAAE,mBAAmB;cAAEV,KAAK,EAAEI,YAAY,GAAGvC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;MAEA,KAAKC,IAAI,CAACa,QAAQ;AAAE,QAAA;AAChB,UAAA,IAAI,CAACc,IAAI,CAAC,CAAC,CAAC,EAAE;AACV,YAAA,MAAA;AACJ,WAAA;AAEA,UAAA,IAAIA,IAAI,CAACY,MAAM,GAAGxB,WAAW,CAACwB,MAAM,EAAE;AAClCX,YAAAA,YAAY,CAAC;AAAEgB,cAAAA,IAAI,EAAE,oBAAA;AAAqB,aAAC,CAAC,CAAA;AAChD,WAAA;AAEA,UAAA,IAAIJ,aAAa,GAAGF,YAAY,IAAIvC,SAAS,EAAE;AAC3C2B,YAAAA,mBAAmB,CAAC;AAAEkB,cAAAA,IAAI,EAAE,mBAAmB;cAAEV,KAAK,EAAEM,aAAa,GAAG,CAAA;AAAE,aAAC,CAAC,CAAA;AAChF,WAAC,MAAM;AACHd,YAAAA,mBAAmB,CAAC;AAAEkB,cAAAA,IAAI,EAAE,mBAAmB;cAAEV,KAAK,EAAEI,YAAY,GAAGvC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;AAKJ,KAAA;GACH,CAAA;EAED,OAAO;AAAE0C,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACxB;;;;;"}
|
1
|
+
{"version":3,"file":"useKeyboardNavigation.js","sources":["../../../../src/components/Select/hooks/useKeyboardNavigation.ts"],"sourcesContent":["import type { KeyboardEvent, Dispatch } from 'react';\nimport React from 'react';\n\nimport { PathAction, PathState, FocusedPathAction, FocusedPathState } from '../reducers';\nimport type { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\nimport { PathMapType, FocusedToValueMapType } from './usePathMaps';\n\nconst JUMP_SIZE = 10;\n\nexport const keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n Backspace: 'Backspace',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Home: 'Home',\n End: 'End',\n PageUp: 'PageUp',\n PageDown: 'PageDown',\n};\n\nexport const getItemByFocused = (focusedPath: FocusedPathState, focusedToValueMap: FocusedToValueMapType) => {\n const focusedPathAsString = focusedPath.reduce((acc, n) => `${acc}/${n}`, '').replace(/^(\\/)/, '');\n\n return focusedToValueMap.get(focusedPathAsString);\n};\n\ntype Props = {\n focusedPath: FocusedPathState;\n dispatchFocusedPath: Dispatch<FocusedPathAction>;\n path: PathState;\n dispatchPath: Dispatch<PathAction>;\n pathMap: PathMapType;\n focusedToValueMap: FocusedToValueMapType;\n handleListToggle: (opened: boolean) => void;\n handlePressDown: (item: MergedDropdownNodeTransformed, e?: React.MouseEvent<HTMLElement>) => void;\n};\n\ntype ReturnedProps = {\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n};\n\nexport const useKeyNavigation = ({\n focusedPath,\n dispatchFocusedPath,\n path,\n dispatchPath,\n pathMap,\n focusedToValueMap,\n handleListToggle,\n handlePressDown,\n}: Props): ReturnedProps => {\n const currentIndex: number = focusedPath?.[focusedPath.length - 1] || 0;\n const currentLength: number = pathMap.get(path?.[focusedPath.length - 1]) || 0;\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n switch (event.code) {\n case keys.ArrowUp: {\n if (focusedPath.length) {\n if (currentIndex > 0) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleListToggle(true);\n }\n\n break;\n }\n\n case keys.ArrowDown: {\n if (focusedPath.length) {\n if (currentIndex + 1 < currentLength) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleListToggle(true);\n }\n\n break;\n }\n\n case keys.ArrowLeft: {\n if (path[0]) {\n if (focusedPath.length) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n } else {\n dispatchFocusedPath({ type: 'return_prev_focus' });\n }\n }\n\n if (path.length === 1) {\n handleListToggle(false);\n }\n }\n\n break;\n }\n\n case keys.ArrowRight: {\n if (path[0]) {\n if (!focusedPath.length) {\n break;\n }\n\n const currentItem = getItemByFocused(focusedPath, focusedToValueMap);\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n }\n }\n\n break;\n }\n\n case keys.Space: {\n event.preventDefault();\n\n const currentItem = getItemByFocused(focusedPath, focusedToValueMap);\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n if (!currentItem || currentItem?.disabled) {\n break;\n }\n\n handlePressDown(currentItem);\n\n break;\n }\n\n case keys.Enter: {\n event.preventDefault();\n\n const currentItem = getItemByFocused(focusedPath, focusedToValueMap)!;\n\n if (currentItem?.disabled) {\n break;\n }\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n\n break;\n }\n\n handlePressDown(currentItem);\n\n break;\n }\n\n case keys.Tab:\n case keys.Escape: {\n dispatchFocusedPath({ type: 'reset' });\n dispatchPath({ type: 'reset' });\n handleListToggle(false);\n\n break;\n }\n\n case keys.Home: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n\n handleListToggle(true);\n }\n\n break;\n }\n\n case keys.End: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'change_last_focus', value: (pathMap.get('root') || 0) - 1 });\n\n handleListToggle(true);\n }\n\n break;\n }\n\n case keys.PageUp: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - JUMP_SIZE });\n }\n\n break;\n }\n\n case keys.PageDown: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentLength - currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + JUMP_SIZE });\n }\n\n break;\n }\n\n default: {\n break;\n }\n }\n };\n\n return { onKeyDown };\n};\n"],"names":["JUMP_SIZE","keys","Enter","Space","Tab","Escape","Backspace","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","getItemByFocused","focusedPath","focusedToValueMap","focusedPathAsString","reduce","acc","n","concat","replace","get","useKeyNavigation","_ref","dispatchFocusedPath","path","dispatchPath","pathMap","handleListToggle","handlePressDown","currentIndex","length","currentLength","onKeyDown","event","code","type","value","currentItem","items","toString","preventDefault","disabled"],"mappings":";;;;AAQA,IAAMA,SAAS,GAAG,EAAE,CAAA;AAEb,IAAMC,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAA;AACd,EAAC;AAEM,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,WAA6B,EAAEC,iBAAwC,EAAK;EACzG,IAAMC,mBAAmB,GAAGF,WAAW,CAACG,MAAM,CAAC,UAACC,GAAG,EAAEC,CAAC,EAAA;AAAA,IAAA,OAAA,EAAA,CAAAC,MAAA,CAAQF,GAAG,EAAAE,GAAAA,CAAAA,CAAAA,MAAA,CAAID,CAAC,CAAA,CAAA;GAAE,EAAE,EAAE,CAAC,CAACE,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAElG,EAAA,OAAON,iBAAiB,CAACO,GAAG,CAACN,mBAAmB,CAAC,CAAA;AACrD,EAAC;IAiBYO,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EASD;AAAA,EAAA,IARxBV,WAAW,GAAAU,IAAA,CAAXV,WAAW;IACXW,mBAAmB,GAAAD,IAAA,CAAnBC,mBAAmB;IACnBC,IAAI,G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,cAAAA,KAAK,EAAE,CAAA;AAAE,aAAC,CAAC,CAAA;AAChE,WAAC,MAAM;AACHb,YAAAA,mBAAmB,CAAC;AAAEY,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEP,YAAY,GAAGjC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;MAEA,KAAKC,IAAI,CAACa,QAAQ;AAAE,QAAA;AAChB,UAAA,IAAI,CAACc,IAAI,CAAC,CAAC,CAAC,EAAE;AACV,YAAA,MAAA;AACJ,WAAA;AAEA,UAAA,IAAIA,IAAI,CAACM,MAAM,GAAGlB,WAAW,CAACkB,MAAM,EAAE;AAClCL,YAAAA,YAAY,CAAC;AAAEU,cAAAA,IAAI,EAAE,oBAAA;AAAqB,aAAC,CAAC,CAAA;AAChD,WAAA;AAEA,UAAA,IAAIJ,aAAa,GAAGF,YAAY,IAAIjC,SAAS,EAAE;AAC3C2B,YAAAA,mBAAmB,CAAC;AAAEY,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEL,aAAa,GAAG,CAAA;AAAE,aAAC,CAAC,CAAA;AAChF,WAAC,MAAM;AACHR,YAAAA,mBAAmB,CAAC;AAAEY,cAAAA,IAAI,EAAE,mBAAmB;cAAEC,KAAK,EAAEP,YAAY,GAAGjC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;AAKJ,KAAA;GACH,CAAA;EAED,OAAO;AAAEoC,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACxB;;;;;;"}
|
@@ -10,17 +10,20 @@ var usePathMaps = function usePathMaps(items) {
|
|
10
10
|
var focusedToValueMap = new Map();
|
11
11
|
var valueToCheckedMap = new Map();
|
12
12
|
var valueToItemMap = new Map();
|
13
|
+
var labelToItemMap = new Map();
|
13
14
|
pathMap.set('root', (items === null || items === void 0 ? void 0 : items.length) || 0);
|
14
15
|
var rec = function rec(items) {
|
15
16
|
var prevIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
16
17
|
items === null || items === void 0 || items.forEach(function (item, index) {
|
17
18
|
var value = item.value,
|
19
|
+
label = item.label,
|
18
20
|
innerItems = item.items;
|
19
21
|
var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
|
20
22
|
focusedToValueMap.set(currIndex, item);
|
21
23
|
valueToCheckedMap.set(value, false);
|
22
24
|
if (isEmpty.isEmpty(innerItems) || !innerItems) {
|
23
25
|
valueToItemMap.set(value, item);
|
26
|
+
labelToItemMap.set(label, item);
|
24
27
|
} else {
|
25
28
|
pathMap.set(value, innerItems.length);
|
26
29
|
rec(innerItems, currIndex);
|
@@ -28,7 +31,7 @@ var usePathMaps = function usePathMaps(items) {
|
|
28
31
|
});
|
29
32
|
};
|
30
33
|
rec(items);
|
31
|
-
return [pathMap, focusedToValueMap, valueToCheckedMap, valueToItemMap];
|
34
|
+
return [pathMap, focusedToValueMap, valueToCheckedMap, valueToItemMap, labelToItemMap];
|
32
35
|
};
|
33
36
|
|
34
37
|
exports.usePathMaps = usePathMaps;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usePathMaps.js","sources":["../../../../src/components/Select/hooks/usePathMaps.ts"],"sourcesContent":["import { isEmpty } from '../../../utils';\nimport { MergedSelectProps } from '../Select.types';\nimport { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\nexport type PathMapType = Map<string | number, number>;\nexport type FocusedToValueMapType = Map<string, MergedDropdownNodeTransformed>;\nexport type ValueToCheckedMapType = Map<\n MergedDropdownNodeTransformed['value'],\n boolean | 'done' | 'dot' | 'indeterminate'\n>;\nexport type ValueToItemMapType = Map<MergedDropdownNodeTransformed['value'], MergedDropdownNodeTransformed>;\n\n// Рекурсивно проходим по дереву items и создаем 4 мапы: открытых путей, фокусов, выбранных элементов и айтемов.\nexport const usePathMaps = (items: MergedSelectProps['items']) => {\n const pathMap: PathMapType = new Map();\n const focusedToValueMap: FocusedToValueMapType = new Map();\n const valueToCheckedMap: ValueToCheckedMapType = new Map();\n const valueToItemMap: ValueToItemMapType = new Map();\n\n pathMap.set('root', items?.length || 0);\n\n const rec = (items: MergedSelectProps['items'], prevIndex = '') => {\n items?.forEach((item: MergedDropdownNodeTransformed, index: number) => {\n const { value, items: innerItems } = item;\n\n const currIndex = `${prevIndex}/${index}`.replace(/^(\\/)/, '');\n focusedToValueMap.set(currIndex, item);\n\n valueToCheckedMap.set(value, false);\n\n if (isEmpty(innerItems) || !innerItems) {\n valueToItemMap.set(value, item);\n } else {\n pathMap.set(value, innerItems.length);\n rec(innerItems, currIndex);\n }\n });\n };\n rec(items);\n\n return [pathMap, focusedToValueMap, valueToCheckedMap, valueToItemMap] as [\n PathMapType,\n FocusedToValueMapType,\n ValueToCheckedMapType,\n ValueToItemMapType,\n ];\n};\n"],"names":["usePathMaps","items","pathMap","Map","focusedToValueMap","valueToCheckedMap","valueToItemMap","set","length","rec","prevIndex","arguments","undefined","forEach","item","index","value","innerItems","currIndex","concat","replace","isEmpty"],"mappings":";;;;;;
|
1
|
+
{"version":3,"file":"usePathMaps.js","sources":["../../../../src/components/Select/hooks/usePathMaps.ts"],"sourcesContent":["import { isEmpty } from '../../../utils';\nimport { MergedSelectProps } from '../Select.types';\nimport { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\nexport type PathMapType = Map<string | number, number>;\nexport type FocusedToValueMapType = Map<string, MergedDropdownNodeTransformed>;\nexport type ValueToCheckedMapType = Map<\n MergedDropdownNodeTransformed['value'],\n boolean | 'done' | 'dot' | 'indeterminate'\n>;\nexport type ValueToItemMapType = Map<MergedDropdownNodeTransformed['value'], MergedDropdownNodeTransformed>;\nexport type LabelToItemMapType = Map<MergedDropdownNodeTransformed['label'], MergedDropdownNodeTransformed>;\n\n// Рекурсивно проходим по дереву items и создаем 4 мапы: открытых путей, фокусов, выбранных элементов и айтемов.\nexport const usePathMaps = (items: MergedSelectProps['items']) => {\n const pathMap: PathMapType = new Map();\n const focusedToValueMap: FocusedToValueMapType = new Map();\n const valueToCheckedMap: ValueToCheckedMapType = new Map();\n const valueToItemMap: ValueToItemMapType = new Map();\n const labelToItemMap: LabelToItemMapType = new Map();\n\n pathMap.set('root', items?.length || 0);\n\n const rec = (items: MergedSelectProps['items'], prevIndex = '') => {\n items?.forEach((item: MergedDropdownNodeTransformed, index: number) => {\n const { value, label, items: innerItems } = item;\n\n const currIndex = `${prevIndex}/${index}`.replace(/^(\\/)/, '');\n focusedToValueMap.set(currIndex, item);\n\n valueToCheckedMap.set(value, false);\n\n if (isEmpty(innerItems) || !innerItems) {\n valueToItemMap.set(value, item);\n labelToItemMap.set(label, item);\n } else {\n pathMap.set(value, innerItems.length);\n rec(innerItems, currIndex);\n }\n });\n };\n rec(items);\n\n return [pathMap, focusedToValueMap, valueToCheckedMap, valueToItemMap, labelToItemMap] as [\n PathMapType,\n FocusedToValueMapType,\n ValueToCheckedMapType,\n ValueToItemMapType,\n LabelToItemMapType,\n ];\n};\n"],"names":["usePathMaps","items","pathMap","Map","focusedToValueMap","valueToCheckedMap","valueToItemMap","labelToItemMap","set","length","rec","prevIndex","arguments","undefined","forEach","item","index","value","label","innerItems","currIndex","concat","replace","isEmpty"],"mappings":";;;;;;AAaA;IACaA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,KAAiC,EAAK;AAC9D,EAAA,IAAMC,OAAoB,GAAG,IAAIC,GAAG,EAAE,CAAA;AACtC,EAAA,IAAMC,iBAAwC,GAAG,IAAID,GAAG,EAAE,CAAA;AAC1D,EAAA,IAAME,iBAAwC,GAAG,IAAIF,GAAG,EAAE,CAAA;AAC1D,EAAA,IAAMG,cAAkC,GAAG,IAAIH,GAAG,EAAE,CAAA;AACpD,EAAA,IAAMI,cAAkC,GAAG,IAAIJ,GAAG,EAAE,CAAA;AAEpDD,EAAAA,OAAO,CAACM,GAAG,CAAC,MAAM,EAAE,CAAAP,KAAK,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