@chayns-components/core 5.4.5 → 5.4.6-alpha.0
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/AGENTS.md +12 -0
- package/lib/cjs/components/accordion/Accordion.js +107 -12
- package/lib/cjs/components/accordion/Accordion.js.map +1 -1
- package/lib/cjs/components/accordion/Accordion.styles.js +23 -3
- package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js +36 -19
- package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.js +6 -3
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/cjs/components/amount-control/AmountControl.js +31 -17
- package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
- package/lib/cjs/components/amount-control/AmountControl.styles.js +18 -2
- package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
- package/lib/cjs/components/button/Button.js +5 -1
- package/lib/cjs/components/button/Button.js.map +1 -1
- package/lib/cjs/components/button/Button.styles.js +10 -0
- package/lib/cjs/components/button/Button.styles.js.map +1 -1
- package/lib/cjs/components/button/Button.types.js.map +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +5 -1
- package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
- package/lib/cjs/components/checkbox/Checkbox.styles.js +29 -2
- package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.js +70 -26
- package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.styles.js +11 -0
- package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.types.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.js +146 -42
- package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.styles.js +38 -0
- package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.types.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.utils.js +27 -1
- package/lib/cjs/components/context-menu/ContextMenu.utils.js.map +1 -1
- package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js +3 -8
- package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
- package/lib/cjs/components/dropdown-body-wrapper/DropdownBodyWrapper.js +1 -8
- package/lib/cjs/components/dropdown-body-wrapper/DropdownBodyWrapper.js.map +1 -1
- package/lib/cjs/components/file-input/FileInput.js +4 -2
- package/lib/cjs/components/file-input/FileInput.js.map +1 -1
- package/lib/cjs/components/file-list/file-item/FileItem.js +48 -25
- package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
- package/lib/cjs/components/file-list/file-item/FileItem.styles.js +25 -1
- package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.js +27 -4
- package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.styles.js +10 -0
- package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/cjs/components/filter/Filter.js +51 -16
- package/lib/cjs/components/filter/Filter.js.map +1 -1
- package/lib/cjs/components/filter/Filter.styles.js +9 -0
- package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.js +14 -5
- package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -1
- package/lib/cjs/components/filter-buttons/FilterButtons.js +69 -4
- package/lib/cjs/components/filter-buttons/FilterButtons.js.map +1 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +40 -2
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
- package/lib/cjs/components/grid-image/GridImage.js +20 -2
- package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
- package/lib/cjs/components/grid-image/GridImage.styles.js +11 -2
- package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.js +23 -4
- package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js +9 -0
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/cjs/components/highlight-slider/HighlightSlider.js +13 -3
- package/lib/cjs/components/highlight-slider/HighlightSlider.js.map +1 -1
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +21 -4
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +11 -2
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
- package/lib/cjs/components/icon/Icon.js +24 -5
- package/lib/cjs/components/icon/Icon.js.map +1 -1
- package/lib/cjs/components/icon/Icon.styles.js +23 -0
- package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
- package/lib/cjs/components/input/Input.js +29 -8
- package/lib/cjs/components/input/Input.js.map +1 -1
- package/lib/cjs/components/input/Input.styles.js +38 -3
- package/lib/cjs/components/input/Input.styles.js.map +1 -1
- package/lib/cjs/components/list/List.js +124 -37
- package/lib/cjs/components/list/List.js.map +1 -1
- package/lib/cjs/components/list/List.utils.js +213 -1
- package/lib/cjs/components/list/List.utils.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.js +84 -3
- package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.styles.js +7 -0
- package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +5 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js +5 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +1 -0
- package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +3 -0
- package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +1 -0
- package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
- package/lib/cjs/components/list/list-item/useListItemFocus.js +47 -0
- package/lib/cjs/components/list/list-item/useListItemFocus.js.map +1 -0
- package/lib/cjs/components/mention-finder/MentionFinder.js +43 -5
- package/lib/cjs/components/mention-finder/MentionFinder.js.map +1 -1
- package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
- package/lib/cjs/components/multi-action-button/MultiActionButton.js +36 -3
- package/lib/cjs/components/multi-action-button/MultiActionButton.js.map +1 -1
- package/lib/cjs/components/multi-action-button/MultiActionButton.styles.js +6 -0
- package/lib/cjs/components/multi-action-button/MultiActionButton.styles.js.map +1 -1
- package/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +7 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/cjs/components/number-input/NumberInput.js +13 -10
- package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
- package/lib/cjs/components/page-provider/PageProvider.js +4 -2
- package/lib/cjs/components/page-provider/PageProvider.js.map +1 -1
- package/lib/cjs/components/popup/Popup.js +8 -1
- package/lib/cjs/components/popup/Popup.js.map +1 -1
- package/lib/cjs/components/radio-button/RadioButton.js +29 -15
- package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
- package/lib/cjs/components/radio-button/RadioButton.styles.js +19 -8
- package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
- package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
- package/lib/cjs/components/search-box/SearchBox.js +20 -5
- package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.js +56 -43
- package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.styles.js +26 -2
- package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/cjs/components/select-button/SelectButton.js +4 -2
- package/lib/cjs/components/select-button/SelectButton.js.map +1 -1
- package/lib/cjs/components/setup-wizard/SetupWizard.js +10 -4
- package/lib/cjs/components/setup-wizard/SetupWizard.js.map +1 -1
- package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
- package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
- package/lib/cjs/components/sharing-bar/SharingBar.js +31 -6
- package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/cjs/components/sharing-bar/SharingBar.styles.js +5 -0
- package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
- package/lib/cjs/components/sharing-button/SharingButton.js +4 -2
- package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +3 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/cjs/components/signature/Signature.js +6 -3
- package/lib/cjs/components/signature/Signature.js.map +1 -1
- package/lib/cjs/components/slider/Slider.js +30 -7
- package/lib/cjs/components/slider/Slider.js.map +1 -1
- package/lib/cjs/components/slider/Slider.styles.js +9 -2
- package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.js +63 -6
- package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.styles.js +15 -2
- package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.types.js +6 -0
- package/lib/cjs/components/slider-button/SliderButton.types.js.map +1 -0
- package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js +66 -0
- package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
- package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js +47 -0
- package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
- package/lib/cjs/components/tag-input/TagInput.js +92 -36
- package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
- package/lib/cjs/components/tag-input/TagInput.styles.js +29 -3
- package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.js +17 -8
- package/lib/cjs/components/text-area/TextArea.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.styles.js +15 -1
- package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.js +17 -3
- package/lib/cjs/components/truncation/Truncation.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.styles.js +18 -1
- package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/cjs/hooks/dropdown.js +5 -24
- package/lib/cjs/hooks/dropdown.js.map +1 -1
- package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +68 -0
- package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -0
- package/lib/cjs/utils/file.js.map +1 -1
- package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +29 -0
- package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +1 -0
- package/lib/esm/components/accordion/Accordion.js +105 -12
- package/lib/esm/components/accordion/Accordion.js.map +1 -1
- package/lib/esm/components/accordion/Accordion.styles.js +23 -3
- package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
- package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/esm/components/accordion/accordion-group/AccordionGroup.js +33 -19
- package/lib/esm/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
- package/lib/esm/components/accordion/accordion-head/AccordionHead.js +6 -3
- package/lib/esm/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
- package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/esm/components/amount-control/AmountControl.js +30 -16
- package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
- package/lib/esm/components/amount-control/AmountControl.styles.js +18 -2
- package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
- package/lib/esm/components/button/Button.js +5 -1
- package/lib/esm/components/button/Button.js.map +1 -1
- package/lib/esm/components/button/Button.styles.js +10 -0
- package/lib/esm/components/button/Button.styles.js.map +1 -1
- package/lib/esm/components/button/Button.types.js.map +1 -1
- package/lib/esm/components/checkbox/Checkbox.js +5 -1
- package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
- package/lib/esm/components/checkbox/Checkbox.styles.js +29 -2
- package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.js +63 -22
- package/lib/esm/components/combobox/ComboBox.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.styles.js +11 -0
- package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.js +145 -42
- package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.styles.js +38 -0
- package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.utils.js +24 -0
- package/lib/esm/components/context-menu/ContextMenu.utils.js.map +1 -1
- package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js +3 -8
- package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
- package/lib/esm/components/dropdown-body-wrapper/DropdownBodyWrapper.js +1 -8
- package/lib/esm/components/dropdown-body-wrapper/DropdownBodyWrapper.js.map +1 -1
- package/lib/esm/components/file-input/FileInput.js +4 -2
- package/lib/esm/components/file-input/FileInput.js.map +1 -1
- package/lib/esm/components/file-list/file-item/FileItem.js +49 -26
- package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
- package/lib/esm/components/file-list/file-item/FileItem.styles.js +24 -0
- package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.js +27 -4
- package/lib/esm/components/file-select/FileSelect.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.styles.js +10 -0
- package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/esm/components/filter/Filter.js +52 -16
- package/lib/esm/components/filter/Filter.js.map +1 -1
- package/lib/esm/components/filter/Filter.styles.js +9 -0
- package/lib/esm/components/filter/Filter.styles.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FilterContent.js +15 -5
- package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -1
- package/lib/esm/components/filter-buttons/FilterButtons.js +69 -5
- package/lib/esm/components/filter-buttons/FilterButtons.js.map +1 -1
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +40 -2
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
- package/lib/esm/components/grid-image/GridImage.js +20 -2
- package/lib/esm/components/grid-image/GridImage.js.map +1 -1
- package/lib/esm/components/grid-image/GridImage.styles.js +10 -1
- package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.js +22 -4
- package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.styles.js +9 -0
- package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/esm/components/highlight-slider/HighlightSlider.js +13 -3
- package/lib/esm/components/highlight-slider/HighlightSlider.js.map +1 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +20 -3
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +10 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
- package/lib/esm/components/icon/Icon.js +26 -7
- package/lib/esm/components/icon/Icon.js.map +1 -1
- package/lib/esm/components/icon/Icon.styles.js +23 -0
- package/lib/esm/components/icon/Icon.styles.js.map +1 -1
- package/lib/esm/components/input/Input.js +24 -4
- package/lib/esm/components/input/Input.js.map +1 -1
- package/lib/esm/components/input/Input.styles.js +38 -3
- package/lib/esm/components/input/Input.styles.js.map +1 -1
- package/lib/esm/components/list/List.js +123 -37
- package/lib/esm/components/list/List.js.map +1 -1
- package/lib/esm/components/list/List.utils.js +202 -0
- package/lib/esm/components/list/List.utils.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.js +85 -4
- package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.styles.js +7 -0
- package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +6 -2
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js +4 -0
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +1 -0
- package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +4 -1
- package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +1 -0
- package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
- package/lib/esm/components/list/list-item/useListItemFocus.js +40 -0
- package/lib/esm/components/list/list-item/useListItemFocus.js.map +1 -0
- package/lib/esm/components/mention-finder/MentionFinder.js +39 -3
- package/lib/esm/components/mention-finder/MentionFinder.js.map +1 -1
- package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
- package/lib/esm/components/multi-action-button/MultiActionButton.js +36 -3
- package/lib/esm/components/multi-action-button/MultiActionButton.js.map +1 -1
- package/lib/esm/components/multi-action-button/MultiActionButton.styles.js +6 -0
- package/lib/esm/components/multi-action-button/MultiActionButton.styles.js.map +1 -1
- package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/esm/components/number-input/NumberInput.js +13 -10
- package/lib/esm/components/number-input/NumberInput.js.map +1 -1
- package/lib/esm/components/page-provider/PageProvider.js +4 -2
- package/lib/esm/components/page-provider/PageProvider.js.map +1 -1
- package/lib/esm/components/popup/Popup.js +8 -1
- package/lib/esm/components/popup/Popup.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.js +29 -15
- package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.styles.js +19 -8
- package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
- package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
- package/lib/esm/components/search-box/SearchBox.js +17 -3
- package/lib/esm/components/search-box/SearchBox.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.js +56 -44
- package/lib/esm/components/search-input/SearchInput.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.styles.js +25 -1
- package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/esm/components/select-button/SelectButton.js +4 -2
- package/lib/esm/components/select-button/SelectButton.js.map +1 -1
- package/lib/esm/components/setup-wizard/SetupWizard.js +10 -4
- package/lib/esm/components/setup-wizard/SetupWizard.js.map +1 -1
- package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
- package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
- package/lib/esm/components/sharing-bar/SharingBar.js +30 -5
- package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/esm/components/sharing-bar/SharingBar.styles.js +5 -0
- package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
- package/lib/esm/components/sharing-button/SharingButton.js +4 -2
- package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +3 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/esm/components/signature/Signature.js +6 -3
- package/lib/esm/components/signature/Signature.js.map +1 -1
- package/lib/esm/components/slider/Slider.js +30 -7
- package/lib/esm/components/slider/Slider.js.map +1 -1
- package/lib/esm/components/slider/Slider.styles.js +8 -1
- package/lib/esm/components/slider/Slider.styles.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.js +62 -6
- package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.styles.js +14 -1
- package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.types.js +2 -0
- package/lib/esm/components/slider-button/SliderButton.types.js.map +1 -0
- package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js +56 -0
- package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
- package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js +38 -0
- package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
- package/lib/esm/components/tag-input/TagInput.js +86 -35
- package/lib/esm/components/tag-input/TagInput.js.map +1 -1
- package/lib/esm/components/tag-input/TagInput.styles.js +27 -1
- package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.js +18 -9
- package/lib/esm/components/text-area/TextArea.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.styles.js +14 -0
- package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.js +18 -4
- package/lib/esm/components/truncation/Truncation.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.styles.js +17 -0
- package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/esm/hooks/dropdown.js +5 -24
- package/lib/esm/hooks/dropdown.js.map +1 -1
- package/lib/esm/hooks/useKeyboardFocusHighlighting.js +61 -0
- package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -0
- package/lib/esm/utils/file.js.map +1 -1
- package/lib/esm/utils/keyboardFocusHighlighting.styles.js +24 -0
- package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +1 -0
- package/lib/types/components/accordion/Accordion.d.ts +5 -0
- package/lib/types/components/accordion/Accordion.styles.d.ts +8 -4
- package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +2 -2
- package/lib/types/components/accordion/accordion-group/AccordionGroup.d.ts +7 -2
- package/lib/types/components/accordion/accordion-head/AccordionHead.d.ts +1 -0
- package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +18 -18
- package/lib/types/components/amount-control/AmountControl.d.ts +5 -0
- package/lib/types/components/amount-control/AmountControl.styles.d.ts +8 -4
- package/lib/types/components/button/Button.styles.d.ts +8 -6
- package/lib/types/components/button/Button.types.d.ts +8 -0
- package/lib/types/components/checkbox/Checkbox.d.ts +4 -0
- package/lib/types/components/checkbox/Checkbox.styles.d.ts +5 -1
- package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +5 -0
- package/lib/types/components/combobox/ComboBox.styles.d.ts +4 -2
- package/lib/types/components/combobox/ComboBox.types.d.ts +5 -0
- package/lib/types/components/context-menu/ContextMenu.styles.d.ts +4 -2
- package/lib/types/components/context-menu/ContextMenu.types.d.ts +6 -0
- package/lib/types/components/context-menu/ContextMenu.utils.d.ts +10 -0
- package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.d.ts +1 -1
- package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +2 -2
- package/lib/types/components/dropdown-body-wrapper/DropdownBodyWrapper.d.ts +0 -7
- package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.d.ts +2 -2
- package/lib/types/components/expandable-content/ExpandableContent.styles.d.ts +2 -2
- package/lib/types/components/file-input/FileInput.d.ts +4 -0
- package/lib/types/components/file-input/FileInput.styles.d.ts +2 -2
- package/lib/types/components/file-list/file-item/FileItem.styles.d.ts +3 -0
- package/lib/types/components/file-select/FileSelect.d.ts +4 -0
- package/lib/types/components/file-select/FileSelect.styles.d.ts +6 -4
- package/lib/types/components/filter/Filter.d.ts +1 -0
- package/lib/types/components/filter/Filter.styles.d.ts +6 -4
- package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +4 -0
- package/lib/types/components/filter-buttons/FilterButtons.d.ts +4 -0
- package/lib/types/components/filter-buttons/filter-button/FilterButton.d.ts +5 -0
- package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +12 -8
- package/lib/types/components/grid-image/GridImage.d.ts +4 -0
- package/lib/types/components/grid-image/GridImage.styles.d.ts +4 -2
- package/lib/types/components/grouped-image/GroupedImage.d.ts +4 -0
- package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +8 -6
- package/lib/types/components/highlight-slider/HighlightSlider.d.ts +4 -0
- package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.d.ts +3 -0
- package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +9 -5
- package/lib/types/components/icon/Icon.d.ts +4 -0
- package/lib/types/components/icon/Icon.styles.d.ts +1 -0
- package/lib/types/components/input/Input.d.ts +4 -0
- package/lib/types/components/input/Input.styles.d.ts +17 -9
- package/lib/types/components/list/List.d.ts +11 -0
- package/lib/types/components/list/List.utils.d.ts +32 -1
- package/lib/types/components/list/list-item/ListItem.d.ts +4 -0
- package/lib/types/components/list/list-item/ListItem.styles.d.ts +64 -64
- package/lib/types/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +2 -2
- package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +195 -194
- package/lib/types/components/list/list-item/useListItemFocus.d.ts +13 -0
- package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +2 -2
- package/lib/types/components/mention-finder/MentionFinder.styles.d.ts +4 -4
- package/lib/types/components/multi-action-button/MultiActionButton.styles.d.ts +2 -2
- package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +7 -0
- package/lib/types/components/multi-action-button/action-button/ActionButton.d.ts +4 -1
- package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +4 -2
- package/lib/types/components/number-input/NumberInput.d.ts +4 -0
- package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +2 -2
- package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +6 -6
- package/lib/types/components/radio-button/RadioButton.d.ts +4 -0
- package/lib/types/components/radio-button/RadioButton.styles.d.ts +15 -9
- package/lib/types/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +5 -0
- package/lib/types/components/search-box/SearchBox.d.ts +4 -0
- package/lib/types/components/search-box/SearchBox.styles.d.ts +2 -2
- package/lib/types/components/search-input/SearchInput.d.ts +4 -0
- package/lib/types/components/search-input/SearchInput.styles.d.ts +17 -9
- package/lib/types/components/select-button/SelectButton.d.ts +4 -0
- package/lib/types/components/setup-wizard/SetupWizard.d.ts +5 -0
- package/lib/types/components/sharing-bar/SharingBar.d.ts +4 -0
- package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
- package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +10 -2
- package/lib/types/components/signature/Signature.d.ts +4 -0
- package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +4 -4
- package/lib/types/components/slider/Slider.d.ts +8 -0
- package/lib/types/components/slider/Slider.styles.d.ts +18 -14
- package/lib/types/components/slider-button/SliderButton.d.ts +1 -28
- package/lib/types/components/slider-button/SliderButton.styles.d.ts +6 -4
- package/lib/types/components/slider-button/SliderButton.types.d.ts +32 -0
- package/lib/types/components/slider-button/useSliderButtonPopupKeyboard.d.ts +17 -0
- package/lib/types/components/slider-button/useSliderButtonThumbKeyboard.d.ts +13 -0
- package/lib/types/components/tag-input/TagInput.d.ts +4 -0
- package/lib/types/components/tag-input/TagInput.styles.d.ts +12 -2
- package/lib/types/components/text-area/TextArea.d.ts +4 -0
- package/lib/types/components/text-area/TextArea.styles.d.ts +1 -0
- package/lib/types/components/truncation/Truncation.d.ts +4 -0
- package/lib/types/components/truncation/Truncation.styles.d.ts +7 -2
- package/lib/types/hooks/dropdown.d.ts +0 -2
- package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +5 -0
- package/lib/types/utils/file.d.ts +1 -1
- package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +9 -0
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { DropdownDirection } from '../../types/dropdown';
|
|
3
3
|
import { ComboBoxSize } from './ComboBox.types';
|
|
4
|
+
import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
|
|
4
5
|
export const StyledComboBox = styled.div`
|
|
5
6
|
min-width: 0;
|
|
6
7
|
user-select: none;
|
|
@@ -115,6 +116,16 @@ export const StyledComboBoxHeader = styled.div`
|
|
|
115
116
|
background-color: ${theme['secondary-102']};
|
|
116
117
|
}
|
|
117
118
|
`}
|
|
119
|
+
|
|
120
|
+
${({
|
|
121
|
+
$shouldShowKeyboardHighlighting
|
|
122
|
+
}) => $shouldShowKeyboardHighlighting && css`
|
|
123
|
+
&:focus-visible,
|
|
124
|
+
&:focus-within {
|
|
125
|
+
transition: none;
|
|
126
|
+
${keyboardFocusHighlightingRingCss}
|
|
127
|
+
}
|
|
128
|
+
`}
|
|
118
129
|
`;
|
|
119
130
|
export const StyledComboBoxPlaceholder = styled.div`
|
|
120
131
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.styles.js","names":["styled","css","DropdownDirection","ComboBoxSize","StyledComboBox","div","$shouldUseFullWidth","$minWidth","StyledComboBoxHeader","$isDisabled","$size","SMALL","NORMAL","theme","$shouldShowTransparentBackground","$shouldChangeColor","colorMode","$shouldShowBigImage","$isOpen","$direction","BOTTOM","BOTTOM_LEFT","BOTTOM_RIGHT","includes","$isTouch","StyledComboBoxPlaceholder","text","$shouldReduceOpacity","StyledComboBoxPlaceholderText","StyledComboBoxPrefixAndPlaceholderWrapper","StyledComboBoxPrefix","$prefixMinWidth","StyledComboBoxInput","input","StyledComboBoxPlaceholderImage","img","$shouldShowRoundImage","StyledComboBoxClearIconWrapper","StyledComboBoxIconWrapper","$shouldShowBorderLeft","StyledComboBoxBody","$maxHeight","StyledComboBoxTopic"],"sources":["../../../../src/components/combobox/ComboBox.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { Theme, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { DropdownDirection } from '../../types/dropdown';\nimport { ComboBoxProps, ComboBoxSize } from './ComboBox.types';\n\ntype StyledComboBoxProps = WithTheme<{\n $minWidth?: number;\n $shouldUseFullWidth: ComboBoxProps['shouldUseFullWidth'];\n}>;\n\nexport const StyledComboBox = styled.div<StyledComboBoxProps>`\n min-width: 0;\n user-select: none;\n position: relative;\n\n ${({ $shouldUseFullWidth, $minWidth }) => {\n if ($shouldUseFullWidth) {\n return css`\n width: 100%;\n max-width: 100%;\n min-width: ${typeof $minWidth === 'number' ? `${$minWidth}px` : '0'};\n `;\n }\n\n if (typeof $minWidth === 'number') {\n return css`\n width: fit-content;\n max-width: 100%;\n min-width: ${$minWidth}px;\n `;\n }\n\n return css`\n width: fit-content;\n max-width: 100%;\n `;\n }}\n`;\n\ntype StyledComboBoxHeaderProps = WithTheme<{\n $isTouch: boolean;\n $isOpen: boolean;\n $direction: DropdownDirection;\n $isDisabled?: boolean;\n $shouldChangeColor: boolean;\n $shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n $shouldShowTransparentBackground: boolean;\n $size: ComboBoxSize;\n}>;\n\nexport const StyledComboBoxHeader = styled.div<StyledComboBoxHeaderProps>`\n display: flex;\n min-width: 0;\n border: 1px solid transparent;\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n justify-content: space-between;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: background-color 0.2s ease-in-out;\n\n ${({ $size }) => {\n switch ($size) {\n case ComboBoxSize.SMALL:\n return css`\n height: 34px;\n `;\n case ComboBoxSize.NORMAL:\n default:\n return css`\n min-height: 42px;\n `;\n }\n }}\n\n ${({ theme, $shouldShowTransparentBackground, $shouldChangeColor }) => {\n if ($shouldShowTransparentBackground) {\n if (theme.colorMode === 'dark') {\n return css`\n border-color: rgba(255, 255, 255, 0.5);\n background-color: transparent;\n `;\n }\n\n return css`\n border-color: rgba(0, 0, 0, 0.5);\n background-color: transparent;\n `;\n }\n\n return css`\n border-color: rgba(160, 160, 160, 0.3);\n background-color: ${theme.colorMode === 'classic' || $shouldChangeColor\n ? theme['000']\n : theme['100']};\n `;\n }}\n\n ${({ $shouldShowBigImage }) =>\n $shouldShowBigImage &&\n css`\n height: 42px;\n `}\n\n ${({ $isOpen, $direction }) => {\n if ($isOpen) {\n return [\n DropdownDirection.BOTTOM,\n DropdownDirection.BOTTOM_LEFT,\n DropdownDirection.BOTTOM_RIGHT,\n ].includes($direction)\n ? css`\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n `\n : css`\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n `;\n }\n\n return css`\n border-radius: 3px;\n `;\n }}\n\n ${({ $isTouch, $isDisabled, theme }: StyledComboBoxHeaderProps) =>\n !$isTouch &&\n !$isDisabled &&\n css`\n &:hover {\n background-color: ${theme['secondary-102']};\n }\n `}\n`;\n\ntype StyledComboBoxPlaceholderProps = WithTheme<{ $shouldReduceOpacity: boolean }>;\n\nexport const StyledComboBoxPlaceholder = styled.div<StyledComboBoxPlaceholderProps>`\n align-items: center;\n color: ${({ theme }: StyledComboBoxPlaceholderProps) => theme.text};\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n min-width: 0;\n opacity: ${({ $shouldReduceOpacity }) => ($shouldReduceOpacity ? 0.5 : 1)};\n`;\n\nexport const StyledComboBoxPlaceholderText = styled.div`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nexport const StyledComboBoxPrefixAndPlaceholderWrapper = styled.div`\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n padding: 4px 10px;\n`;\n\ntype StyledComboBoxPrefixProps = {\n $prefixMinWidth?: number;\n};\n\nexport const StyledComboBoxPrefix = styled.div<StyledComboBoxPrefixProps>`\n flex: 0 0 auto;\n min-width: ${({ $prefixMinWidth }) => $prefixMinWidth ?? 0}px;\n padding-right: 5px;\n`;\n\nexport const StyledComboBoxInput = styled.input`\n color: ${({ theme }: { theme: Theme }) => theme.text};\n border: none;\n background-color: transparent;\n width: 100%;\n min-width: 0;\n`;\n\ntype StyledComboBoxPlaceholderImageProps = WithTheme<{\n $shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n $shouldShowRoundImage: ComboBoxProps['shouldShowRoundImage'];\n}>;\n\nexport const StyledComboBoxPlaceholderImage = styled.img<StyledComboBoxPlaceholderImageProps>`\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledComboBoxPlaceholderImageProps) => theme['009-rgb']}, 0.15);\n height: ${({ $shouldShowBigImage }) => ($shouldShowBigImage ? '32px' : '22px')};\n width: ${({ $shouldShowBigImage }) => ($shouldShowBigImage ? '32px' : '22px')};\n\n ${({ $shouldShowRoundImage }) =>\n $shouldShowRoundImage &&\n css`\n border-radius: 50%;\n `}\n`;\n\ntype StyledComboBoxClearIconWrapperProps = { $isDisabled: boolean };\n\nexport const StyledComboBoxClearIconWrapper = styled.div<StyledComboBoxClearIconWrapperProps>`\n align-items: center;\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n height: 40px;\n justify-content: center;\n width: 40px;\n`;\n\ntype StyledComboBoxIconWrapperProps = {\n $shouldShowBorderLeft: boolean;\n $isDisabled: boolean;\n $size: ComboBoxSize;\n};\n\nexport const StyledComboBoxIconWrapper = styled.div<StyledComboBoxIconWrapperProps>`\n align-items: center;\n border-left: ${({ $shouldShowBorderLeft }) =>\n $shouldShowBorderLeft ? '1px solid rgba(160, 160, 160, 0.3)' : 'none'};\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n width: 40px;\n\n ${({ $size }) => {\n switch ($size) {\n case ComboBoxSize.SMALL:\n return css`\n height: 30px;\n `;\n case ComboBoxSize.NORMAL:\n default:\n return css`\n height: 40px;\n `;\n }\n }}\n`;\n\ntype StyledComboBoxBodyProps = WithTheme<{\n $maxHeight: number;\n $minWidth: number;\n}>;\n\nexport const StyledComboBoxBody = styled.div<StyledComboBoxBodyProps>`\n display: flex;\n flex-direction: column;\n cursor: pointer;\n min-width: ${({ $minWidth }) => $minWidth}px;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n max-height: ${({ $maxHeight }) => $maxHeight}px;\n`;\n\ntype StyledComboBoxTopicProps = WithTheme<unknown>;\n\nexport const StyledComboBoxTopic = styled.div`\n align-items: center;\n background-color: ${({ theme }: StyledComboBoxTopicProps) => theme['secondary-102']};\n color: rgba(${({ theme }: StyledComboBoxTopicProps) => theme['text-rgb']}, 0.65);\n cursor: default;\n display: flex;\n flex: 0 0 auto;\n font-weight: bold;\n min-height: 38px;\n line-height: normal;\n padding: 8px 10px;\n position: sticky;\n top: 0;\n z-index: 10;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAAwBC,YAAY,QAAQ,kBAAkB;AAO9D,OAAO,MAAMC,cAAc,GAAGJ,MAAM,CAACK,GAAwB;AAC7D;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC,mBAAmB;EAAEC;AAAU,CAAC,KAAK;EACtC,IAAID,mBAAmB,EAAE;IACrB,OAAOL,GAAG;AACtB;AACA;AACA,6BAA6B,OAAOM,SAAS,KAAK,QAAQ,GAAG,GAAGA,SAAS,IAAI,GAAG,GAAG;AACnF,aAAa;EACL;EAEA,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;IAC/B,OAAON,GAAG;AACtB;AACA;AACA,6BAA6BM,SAAS;AACtC,aAAa;EACL;EAEA,OAAON,GAAG;AAClB;AACA;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAaD,OAAO,MAAMO,oBAAoB,GAAGR,MAAM,CAACK,GAA8B;AACzE;AACA;AACA;AACA,cAAc,CAAC;EAAEI;AAAY,CAAC,KAAM,CAACA,WAAW,GAAG,SAAS,GAAG,SAAU;AACzE;AACA,eAAe,CAAC;EAAEA;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA,MAAM,CAAC;EAAEC;AAAM,CAAC,KAAK;EACb,QAAQA,KAAK;IACT,KAAKP,YAAY,CAACQ,KAAK;MACnB,OAAOV,GAAG;AAC1B;AACA,iBAAiB;IACL,KAAKE,YAAY,CAACS,MAAM;IACxB;MACI,OAAOX,GAAG;AAC1B;AACA,iBAAiB;EACT;A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C,GAAG,MAAM;AAC7E,cAAc,CAAC;EAAE9B;AAAY,CAAC,KAAM,CAACA,WAAW,GAAG,SAAS,GAAG,SAAU;AACzE;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAM,CAAC,KAAK;EACb,QAAQA,KAAK;IACT,KAAKP,YAAY,CAACQ,KAAK;MACnB,OAAOV,GAAG;AAC1B;AACA,iBAAiB;IACL,KAAKE,YAAY,CAACS,MAAM;IACxB;MACI,OAAOX,GAAG;AAC1B;AACA,iBAAiB;EACT;AACJ,CAAC;AACL,CAAC;AAOD,OAAO,MAAMuC,kBAAkB,GAAGxC,MAAM,CAACK,GAA4B;AACrE;AACA;AACA;AACA,iBAAiB,CAAC;EAAEE;AAAU,CAAC,KAAKA,SAAS;AAC7C;AACA;AACA;AACA;AACA,kBAAkB,CAAC;EAAEkC;AAAW,CAAC,KAAKA,UAAU;AAChD,CAAC;AAID,OAAO,MAAMC,mBAAmB,GAAG1C,MAAM,CAACK,GAAG;AAC7C;AACA,wBAAwB,CAAC;EAAEQ;AAAgC,CAAC,KAAKA,KAAK,CAAC,eAAe,CAAC;AACvF,kBAAkB,CAAC;EAAEA;AAAgC,CAAC,KAAKA,KAAK,CAAC,UAAU,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ComboBox.styles.js","names":["styled","css","DropdownDirection","ComboBoxSize","keyboardFocusHighlightingRingCss","StyledComboBox","div","$shouldUseFullWidth","$minWidth","StyledComboBoxHeader","$isDisabled","$size","SMALL","NORMAL","theme","$shouldShowTransparentBackground","$shouldChangeColor","colorMode","$shouldShowBigImage","$isOpen","$direction","BOTTOM","BOTTOM_LEFT","BOTTOM_RIGHT","includes","$isTouch","$shouldShowKeyboardHighlighting","StyledComboBoxPlaceholder","text","$shouldReduceOpacity","StyledComboBoxPlaceholderText","StyledComboBoxPrefixAndPlaceholderWrapper","StyledComboBoxPrefix","$prefixMinWidth","StyledComboBoxInput","input","StyledComboBoxPlaceholderImage","img","$shouldShowRoundImage","StyledComboBoxClearIconWrapper","StyledComboBoxIconWrapper","$shouldShowBorderLeft","StyledComboBoxBody","$maxHeight","StyledComboBoxTopic"],"sources":["../../../../src/components/combobox/ComboBox.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { Theme, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { DropdownDirection } from '../../types/dropdown';\nimport { ComboBoxProps, ComboBoxSize } from './ComboBox.types';\nimport { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledComboBoxProps = WithTheme<{\n $minWidth?: number;\n $shouldUseFullWidth: ComboBoxProps['shouldUseFullWidth'];\n}>;\n\nexport const StyledComboBox = styled.div<StyledComboBoxProps>`\n min-width: 0;\n user-select: none;\n position: relative;\n\n ${({ $shouldUseFullWidth, $minWidth }) => {\n if ($shouldUseFullWidth) {\n return css`\n width: 100%;\n max-width: 100%;\n min-width: ${typeof $minWidth === 'number' ? `${$minWidth}px` : '0'};\n `;\n }\n\n if (typeof $minWidth === 'number') {\n return css`\n width: fit-content;\n max-width: 100%;\n min-width: ${$minWidth}px;\n `;\n }\n\n return css`\n width: fit-content;\n max-width: 100%;\n `;\n }}\n`;\n\ntype StyledComboBoxHeaderProps = WithTheme<{\n $isTouch: boolean;\n $isOpen: boolean;\n $direction: DropdownDirection;\n $isDisabled?: boolean;\n $shouldChangeColor: boolean;\n $shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n $shouldShowTransparentBackground: boolean;\n $size: ComboBoxSize;\n $shouldShowKeyboardHighlighting: boolean;\n}>;\n\nexport const StyledComboBoxHeader = styled.div<StyledComboBoxHeaderProps>`\n display: flex;\n min-width: 0;\n border: 1px solid transparent;\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n justify-content: space-between;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: background-color 0.2s ease-in-out;\n\n ${({ $size }) => {\n switch ($size) {\n case ComboBoxSize.SMALL:\n return css`\n height: 34px;\n `;\n case ComboBoxSize.NORMAL:\n default:\n return css`\n min-height: 42px;\n `;\n }\n }}\n\n ${({ theme, $shouldShowTransparentBackground, $shouldChangeColor }) => {\n if ($shouldShowTransparentBackground) {\n if (theme.colorMode === 'dark') {\n return css`\n border-color: rgba(255, 255, 255, 0.5);\n background-color: transparent;\n `;\n }\n\n return css`\n border-color: rgba(0, 0, 0, 0.5);\n background-color: transparent;\n `;\n }\n\n return css`\n border-color: rgba(160, 160, 160, 0.3);\n background-color: ${theme.colorMode === 'classic' || $shouldChangeColor\n ? theme['000']\n : theme['100']};\n `;\n }}\n\n ${({ $shouldShowBigImage }) =>\n $shouldShowBigImage &&\n css`\n height: 42px;\n `}\n\n ${({ $isOpen, $direction }) => {\n if ($isOpen) {\n return [\n DropdownDirection.BOTTOM,\n DropdownDirection.BOTTOM_LEFT,\n DropdownDirection.BOTTOM_RIGHT,\n ].includes($direction)\n ? css`\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n `\n : css`\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n `;\n }\n\n return css`\n border-radius: 3px;\n `;\n }}\n\n ${({ $isTouch, $isDisabled, theme }: StyledComboBoxHeaderProps) =>\n !$isTouch &&\n !$isDisabled &&\n css`\n &:hover {\n background-color: ${theme['secondary-102']};\n }\n `}\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible,\n &:focus-within {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\n }\n `}\n`;\n\ntype StyledComboBoxPlaceholderProps = WithTheme<{ $shouldReduceOpacity: boolean }>;\n\nexport const StyledComboBoxPlaceholder = styled.div<StyledComboBoxPlaceholderProps>`\n align-items: center;\n color: ${({ theme }: StyledComboBoxPlaceholderProps) => theme.text};\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n min-width: 0;\n opacity: ${({ $shouldReduceOpacity }) => ($shouldReduceOpacity ? 0.5 : 1)};\n`;\n\nexport const StyledComboBoxPlaceholderText = styled.div`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nexport const StyledComboBoxPrefixAndPlaceholderWrapper = styled.div`\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n padding: 4px 10px;\n`;\n\ntype StyledComboBoxPrefixProps = {\n $prefixMinWidth?: number;\n};\n\nexport const StyledComboBoxPrefix = styled.div<StyledComboBoxPrefixProps>`\n flex: 0 0 auto;\n min-width: ${({ $prefixMinWidth }) => $prefixMinWidth ?? 0}px;\n padding-right: 5px;\n`;\n\nexport const StyledComboBoxInput = styled.input`\n color: ${({ theme }: { theme: Theme }) => theme.text};\n border: none;\n background-color: transparent;\n width: 100%;\n min-width: 0;\n`;\n\ntype StyledComboBoxPlaceholderImageProps = WithTheme<{\n $shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n $shouldShowRoundImage: ComboBoxProps['shouldShowRoundImage'];\n}>;\n\nexport const StyledComboBoxPlaceholderImage = styled.img<StyledComboBoxPlaceholderImageProps>`\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledComboBoxPlaceholderImageProps) => theme['009-rgb']}, 0.15);\n height: ${({ $shouldShowBigImage }) => ($shouldShowBigImage ? '32px' : '22px')};\n width: ${({ $shouldShowBigImage }) => ($shouldShowBigImage ? '32px' : '22px')};\n\n ${({ $shouldShowRoundImage }) =>\n $shouldShowRoundImage &&\n css`\n border-radius: 50%;\n `}\n`;\n\ntype StyledComboBoxClearIconWrapperProps = { $isDisabled: boolean };\n\nexport const StyledComboBoxClearIconWrapper = styled.div<StyledComboBoxClearIconWrapperProps>`\n align-items: center;\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n height: 40px;\n justify-content: center;\n width: 40px;\n`;\n\ntype StyledComboBoxIconWrapperProps = {\n $shouldShowBorderLeft: boolean;\n $isDisabled: boolean;\n $size: ComboBoxSize;\n};\n\nexport const StyledComboBoxIconWrapper = styled.div<StyledComboBoxIconWrapperProps>`\n align-items: center;\n border-left: ${({ $shouldShowBorderLeft }) =>\n $shouldShowBorderLeft ? '1px solid rgba(160, 160, 160, 0.3)' : 'none'};\n cursor: ${({ $isDisabled }) => (!$isDisabled ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n width: 40px;\n\n ${({ $size }) => {\n switch ($size) {\n case ComboBoxSize.SMALL:\n return css`\n height: 30px;\n `;\n case ComboBoxSize.NORMAL:\n default:\n return css`\n height: 40px;\n `;\n }\n }}\n`;\n\ntype StyledComboBoxBodyProps = WithTheme<{\n $maxHeight: number;\n $minWidth: number;\n}>;\n\nexport const StyledComboBoxBody = styled.div<StyledComboBoxBodyProps>`\n display: flex;\n flex-direction: column;\n cursor: pointer;\n min-width: ${({ $minWidth }) => $minWidth}px;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n max-height: ${({ $maxHeight }) => $maxHeight}px;\n`;\n\ntype StyledComboBoxTopicProps = WithTheme<unknown>;\n\nexport const StyledComboBoxTopic = styled.div`\n align-items: center;\n background-color: ${({ theme }: StyledComboBoxTopicProps) => theme['secondary-102']};\n color: rgba(${({ theme }: StyledComboBoxTopicProps) => theme['text-rgb']}, 0.65);\n cursor: default;\n display: flex;\n flex: 0 0 auto;\n font-weight: bold;\n min-height: 38px;\n line-height: normal;\n padding: 8px 10px;\n position: sticky;\n top: 0;\n z-index: 10;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAAwBC,YAAY,QAAQ,kBAAkB;AAC9D,SAASC,gCAAgC,QAAQ,8CAA8C;AAO/F,OAAO,MAAMC,cAAc,GAAGL,MAAM,CAACM,GAAwB;AAC7D;AACA;AACA;AACA;A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CAACU,MAAM;IACxB;MACI,OAAOZ,GAAG;AAC1B;AACA,iBAAiB;EACT;AACJ,CAAC;AACL,CAAC;AAOD,OAAO,MAAMyC,kBAAkB,GAAG1C,MAAM,CAACM,GAA4B;AACrE;AACA;AACA;AACA,iBAAiB,CAAC;EAAEE;AAAU,CAAC,KAAKA,SAAS;AAC7C;AACA;AACA;AACA;AACA,kBAAkB,CAAC;EAAEmC;AAAW,CAAC,KAAKA,UAAU;AAChD,CAAC;AAID,OAAO,MAAMC,mBAAmB,GAAG5C,MAAM,CAACM,GAAG;AAC7C;AACA,wBAAwB,CAAC;EAAEQ;AAAgC,CAAC,KAAKA,KAAK,CAAC,eAAe,CAAC;AACvF,kBAAkB,CAAC;EAAEA;AAAgC,CAAC,KAAKA,KAAK,CAAC,UAAU,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.types.js","names":["ComboBoxSize"],"sources":["../../../../src/components/combobox/ComboBox.types.ts"],"sourcesContent":["import { ChangeEventHandler, CSSProperties, FocusEventHandler, ReactHTML, ReactNode } from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { DropdownDirection } from '../../types/dropdown';\n\n/**\n * Ref interface for the `ComboBox` component.\n */\nexport interface ComboBoxRef {\n /**\n * Hides the dropdown content.\n */\n hide: VoidFunction;\n /**\n * Shows the dropdown content.\n */\n show: VoidFunction;\n}\n\n/**\n * A grouped list definition used by the `ComboBox` component.\n */\nexport interface IComboBoxItems {\n /**\n * Optional group label shown above the list.\n */\n groupName?: string;\n /**\n * The items that should be rendered inside the group.\n */\n list: Array<IComboBoxItem>;\n /**\n * Whether the items in this group should use round images.\n */\n shouldShowRoundImage?: boolean;\n}\n\n/**\n * Optional text styling configuration for a combobox item.\n */\nexport interface ComboBoxTextStyles {\n /**\n * The HTML tag that should be used for the text wrapper.\n */\n tagName?: keyof ReactHTML;\n /**\n * Additional inline styles applied to the text wrapper.\n */\n styles?: CSSPropertiesWithVars;\n /**\n * Additional class name applied to the text wrapper.\n */\n className?: string;\n}\n\n/**\n * Single selectable item configuration for the `ComboBox` component.\n */\nexport interface IComboBoxItem {\n /**\n * Optional icon classes rendered before the text.\n */\n icons?: string[];\n /**\n * Optional background style used for the image placeholder.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * Optional image URL rendered for the item.\n */\n imageUrl?: string;\n /**\n * Whether the item should be disabled.\n */\n isDisabled?: boolean;\n /**\n * Optional element rendered on the right side of the item.\n */\n rightElement?: ReactNode;\n /**\n * Optional secondary text rendered below the main text.\n */\n subtext?: string;\n /**\n * Optional suffix element rendered after the text.\n */\n suffixElement?: ReactNode;\n /**\n * Main label of the item.\n */\n text: string;\n /**\n * Stable item value used for selection and matching.\n */\n value: string | number;\n /**\n * Optional text styling overrides for the item label.\n */\n textStyles?: ComboBoxTextStyles;\n}\n\n/**\n * Available size variants for the `ComboBox` header.\n */\nexport enum ComboBoxSize {\n /**\n * Standard height and spacing.\n */\n NORMAL = 'normal',\n /**\n * Compact height and spacing.\n */\n SMALL = 'small',\n}\n\n/**\n * Props for the `ComboBox` component.\n */\nexport type ComboBoxProps = {\n /**\n * The width of the body.\n * @default undefined\n */\n bodyWidth?: number;\n /**\n * The element where the content of the `ComboBox` should be rendered via React Portal.\n * @default undefined\n */\n container?: Element;\n /**\n * The direction in which the combobox should open.\n * @default DropdownDirection.RIGHT\n */\n direction?: DropdownDirection;\n /**\n * The value of the optional input.\n * @default undefined\n */\n inputValue?: string;\n /**\n * Whether the combobox should be disabled.\n * @default false\n */\n isDisabled?: boolean;\n /**\n * The list of the items that should be displayed.\n */\n lists: IComboBoxItems[];\n /**\n * The maximum height of the combobox content.\n * @default 280\n */\n maxHeight?: number;\n /**\n * Function to be executed when the value of the optional input is changed.\n * @default undefined\n */\n onInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input lost its focus.\n * @default undefined\n */\n onInputBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input gets its focus.\n * @default undefined\n */\n onInputFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function that should be executed when an item is selected. If the function returns false, the item will not be selected.\n * @default undefined\n */\n onSelect?: (comboboxItem?: IComboBoxItem) => Promise<boolean> | boolean | void;\n /**\n * Function to be executed when the content of the `ComboBox` is shown.\n * @default undefined\n */\n onShow?: () => void;\n /**\n * Function to be executed when the content of the `ComboBox` is hidden.\n * @default undefined\n */\n onHide?: () => void;\n /**\n * A text that should be displayed when no item is selected.\n */\n placeholder: string;\n /**\n * A prefix that should be displayed before the placeholder.\n * @default undefined\n */\n prefix?: string;\n /**\n * An item that should be preselected.\n * @default undefined\n */\n selectedItem?: IComboBoxItem;\n /**\n * If true, the images of the items are displayed in a bigger shape. This prop will automatically be set to true if the subtext of an item is given.\n * @default false\n */\n shouldShowBigImage?: boolean;\n /**\n * If true, a clear icon is displayed at the end of the combo box if an item is selected.\n * @default false\n */\n shouldShowClearIcon?: boolean;\n /**\n * Whether the background should be transparent.\n * @default false\n */\n shouldShowTransparentBackground?: boolean;\n /**\n * If true, the images of the items are displayed in a round shape.\n * @default false\n */\n shouldShowRoundImage?: boolean;\n /**\n * Whether the width of the ComboBox should be the width of the current item.\n * @default false\n */\n shouldUseCurrentItemWidth?: boolean;\n /**\n * Whether the width of the 'ComboBox' should be the width of the parent or of the widest item.\n * @default false\n */\n shouldUseFullWidth?: boolean;\n /**\n * If true, the dropdown will use the maximum width of the items.\n * @default false\n */\n shouldDropDownUseMaxItemWidth?: boolean;\n /**\n * Whether the outside events should be captured.\n * @default undefined\n */\n shouldCaptureEvents?: boolean;\n /**\n * The size of the ComboBox.\n * @default ComboBoxSize.NORMAL\n */\n size?: ComboBoxSize;\n /**\n * Optional min width for the prefix element.\n * @default undefined\n */\n prefixMinWidth?: number;\n};\n"],"mappings":"AAIA;AACA;AACA;;AAYA;AACA;AACA;;AAgBA;AACA;AACA;;AAgBA;AACA;AACA;;AA4CA;AACA;AACA;AACA,WAAYA,YAAY,0BAAZA,YAAY;EACpB;AACJ;AACA;EAHYA,YAAY;EAKpB;AACJ;AACA;EAPYA,YAAY;EAAA,OAAZA,YAAY;AAAA;;AAWxB;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ComboBox.types.js","names":["ComboBoxSize"],"sources":["../../../../src/components/combobox/ComboBox.types.ts"],"sourcesContent":["import { ChangeEventHandler, CSSProperties, FocusEventHandler, ReactHTML, ReactNode } from 'react';\nimport { CSSPropertiesWithVars } from 'styled-components/dist/types';\nimport { DropdownDirection } from '../../types/dropdown';\n\n/**\n * Ref interface for the `ComboBox` component.\n */\nexport interface ComboBoxRef {\n /**\n * Hides the dropdown content.\n */\n hide: VoidFunction;\n /**\n * Shows the dropdown content.\n */\n show: VoidFunction;\n}\n\n/**\n * A grouped list definition used by the `ComboBox` component.\n */\nexport interface IComboBoxItems {\n /**\n * Optional group label shown above the list.\n */\n groupName?: string;\n /**\n * The items that should be rendered inside the group.\n */\n list: Array<IComboBoxItem>;\n /**\n * Whether the items in this group should use round images.\n */\n shouldShowRoundImage?: boolean;\n}\n\n/**\n * Optional text styling configuration for a combobox item.\n */\nexport interface ComboBoxTextStyles {\n /**\n * The HTML tag that should be used for the text wrapper.\n */\n tagName?: keyof ReactHTML;\n /**\n * Additional inline styles applied to the text wrapper.\n */\n styles?: CSSPropertiesWithVars;\n /**\n * Additional class name applied to the text wrapper.\n */\n className?: string;\n}\n\n/**\n * Single selectable item configuration for the `ComboBox` component.\n */\nexport interface IComboBoxItem {\n /**\n * Optional icon classes rendered before the text.\n */\n icons?: string[];\n /**\n * Optional background style used for the image placeholder.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * Optional image URL rendered for the item.\n */\n imageUrl?: string;\n /**\n * Whether the item should be disabled.\n */\n isDisabled?: boolean;\n /**\n * Optional element rendered on the right side of the item.\n */\n rightElement?: ReactNode;\n /**\n * Optional secondary text rendered below the main text.\n */\n subtext?: string;\n /**\n * Optional suffix element rendered after the text.\n */\n suffixElement?: ReactNode;\n /**\n * Main label of the item.\n */\n text: string;\n /**\n * Stable item value used for selection and matching.\n */\n value: string | number;\n /**\n * Optional text styling overrides for the item label.\n */\n textStyles?: ComboBoxTextStyles;\n}\n\n/**\n * Available size variants for the `ComboBox` header.\n */\nexport enum ComboBoxSize {\n /**\n * Standard height and spacing.\n */\n NORMAL = 'normal',\n /**\n * Compact height and spacing.\n */\n SMALL = 'small',\n}\n\n/**\n * Props for the `ComboBox` component.\n */\nexport type ComboBoxProps = {\n /**\n * The width of the body.\n * @default undefined\n */\n bodyWidth?: number;\n /**\n * The element where the content of the `ComboBox` should be rendered via React Portal.\n * @default undefined\n */\n container?: Element;\n /**\n * The direction in which the combobox should open.\n * @default DropdownDirection.RIGHT\n */\n direction?: DropdownDirection;\n /**\n * The value of the optional input.\n * @default undefined\n */\n inputValue?: string;\n /**\n * Whether the combobox should be disabled.\n * @default false\n */\n isDisabled?: boolean;\n /**\n * The list of the items that should be displayed.\n */\n lists: IComboBoxItems[];\n /**\n * The maximum height of the combobox content.\n * @default 280\n */\n maxHeight?: number;\n /**\n * Function to be executed when the value of the optional input is changed.\n * @default undefined\n */\n onInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input lost its focus.\n * @default undefined\n */\n onInputBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input gets its focus.\n * @default undefined\n */\n onInputFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function that should be executed when an item is selected. If the function returns false, the item will not be selected.\n * @default undefined\n */\n onSelect?: (comboboxItem?: IComboBoxItem) => Promise<boolean> | boolean | void;\n /**\n * Function to be executed when the content of the `ComboBox` is shown.\n * @default undefined\n */\n onShow?: () => void;\n /**\n * Function to be executed when the content of the `ComboBox` is hidden.\n * @default undefined\n */\n onHide?: () => void;\n /**\n * A text that should be displayed when no item is selected.\n */\n placeholder: string;\n /**\n * A prefix that should be displayed before the placeholder.\n * @default undefined\n */\n prefix?: string;\n /**\n * An item that should be preselected.\n * @default undefined\n */\n selectedItem?: IComboBoxItem;\n /**\n * If true, the images of the items are displayed in a bigger shape. This prop will automatically be set to true if the subtext of an item is given.\n * @default false\n */\n shouldShowBigImage?: boolean;\n /**\n * If true, a clear icon is displayed at the end of the combo box if an item is selected.\n * @default false\n */\n shouldShowClearIcon?: boolean;\n /**\n * Whether the background should be transparent.\n * @default false\n */\n shouldShowTransparentBackground?: boolean;\n /**\n * If true, the images of the items are displayed in a round shape.\n * @default false\n */\n shouldShowRoundImage?: boolean;\n /**\n * Whether the width of the ComboBox should be the width of the current item.\n * @default false\n */\n shouldUseCurrentItemWidth?: boolean;\n /**\n * Whether the width of the 'ComboBox' should be the width of the parent or of the widest item.\n * @default false\n */\n shouldUseFullWidth?: boolean;\n /**\n * If true, the dropdown will use the maximum width of the items.\n * @default false\n */\n shouldDropDownUseMaxItemWidth?: boolean;\n /**\n * Whether the outside events should be captured.\n * @default undefined\n */\n shouldCaptureEvents?: boolean;\n /**\n * The size of the ComboBox.\n * @default ComboBoxSize.NORMAL\n */\n size?: ComboBoxSize;\n /**\n * Enables the shared keyboard-only focus ring for the combobox header.\n * @default false\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Optional min width for the prefix element.\n * @default undefined\n */\n prefixMinWidth?: number;\n};\n"],"mappings":"AAIA;AACA;AACA;;AAYA;AACA;AACA;;AAgBA;AACA;AACA;;AAgBA;AACA;AACA;;AA4CA;AACA;AACA;AACA,WAAYA,YAAY,0BAAZA,YAAY;EACpB;AACJ;AACA;EAHYA,YAAY;EAKpB;AACJ;AACA;EAPYA,YAAY;EAAA,OAAZA,YAAY;AAAA;;AAWxB;AACA;AACA","ignoreList":[]}
|
|
@@ -8,7 +8,8 @@ import Icon from '../icon/Icon';
|
|
|
8
8
|
import ContextMenuContent from './context-menu-content/ContextMenuContent';
|
|
9
9
|
import { StyledContextMenu } from './ContextMenu.styles';
|
|
10
10
|
import { ContextMenuAlignment } from './ContextMenu.types';
|
|
11
|
-
import { getDefaultFocusedIndex } from './ContextMenu.utils';
|
|
11
|
+
import { getActiveItemIndex, getDefaultFocusedIndex, selectItem } from './ContextMenu.utils';
|
|
12
|
+
import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
|
|
12
13
|
const ContextMenu = /*#__PURE__*/forwardRef(({
|
|
13
14
|
alignment,
|
|
14
15
|
className,
|
|
@@ -26,6 +27,7 @@ const ContextMenu = /*#__PURE__*/forwardRef(({
|
|
|
26
27
|
shouldDisableClick = false,
|
|
27
28
|
shouldHidePopupArrow = false,
|
|
28
29
|
shouldShowHoverEffect = false,
|
|
30
|
+
shouldEnableKeyboardHighlighting,
|
|
29
31
|
shouldUseDefaultTriggerStyles = true,
|
|
30
32
|
style,
|
|
31
33
|
yOffset = 0,
|
|
@@ -41,10 +43,16 @@ const ContextMenu = /*#__PURE__*/forwardRef(({
|
|
|
41
43
|
const [isContentShown, setIsContentShown] = useState(false);
|
|
42
44
|
const [portal, setPortal] = useState();
|
|
43
45
|
const [isHovered, setIsHovered] = useState(false);
|
|
46
|
+
const [shouldUseFocusableWrapper, setShouldUseFocusableWrapper] = useState(false);
|
|
44
47
|
const uuid = useUuid();
|
|
45
48
|
const contextMenuContentRef = useRef(null);
|
|
46
49
|
const contextMenuRef = useRef(null);
|
|
50
|
+
const shouldSkipNextContextMenuOpenRef = useRef(false);
|
|
51
|
+
const shouldPreventNextNativeContextMenuRef = useRef(false);
|
|
47
52
|
const isTouch = useIsTouch();
|
|
53
|
+
const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !shouldDisableClick);
|
|
54
|
+
const shouldShowWrapperKeyboardHighlighting = shouldShowKeyboardHighlighting && shouldUseFocusableWrapper;
|
|
55
|
+
const shouldUseKeyboardFocusableWrapper = shouldUseFocusableWrapper && !shouldDisableClick;
|
|
48
56
|
useEffect(() => {
|
|
49
57
|
if (isContentShown) {
|
|
50
58
|
setFocusedIndex(getDefaultFocusedIndex(items));
|
|
@@ -65,35 +73,13 @@ const ContextMenu = /*#__PURE__*/forwardRef(({
|
|
|
65
73
|
const handleHide = useCallback(() => {
|
|
66
74
|
setIsContentShown(false);
|
|
67
75
|
}, []);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
if (e.key === 'ArrowUp') {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
setFocusedIndex(prev => prev <= 0 ? items.length - 1 : prev - 1);
|
|
79
|
-
}
|
|
80
|
-
if (e.key === 'Enter') {
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
const item = items[focusedIndex];
|
|
83
|
-
if (item) {
|
|
84
|
-
void item.onClick();
|
|
85
|
-
if (shouldCloseOnPopupClick) {
|
|
86
|
-
handleHide();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (e.key === 'Escape') {
|
|
91
|
-
handleHide();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
document.addEventListener('keydown', handleKey);
|
|
95
|
-
return () => document.removeEventListener('keydown', handleKey);
|
|
96
|
-
}, [isContentShown, items, focusedIndex, handleHide, shouldCloseOnPopupClick, isHovered]);
|
|
76
|
+
const handleContainerBlur = useCallback(event => {
|
|
77
|
+
const nextFocusedElement = event.relatedTarget;
|
|
78
|
+
const currentContainer = event.currentTarget;
|
|
79
|
+
if (!nextFocusedElement || !currentContainer.contains(nextFocusedElement) && !contextMenuContentRef.current?.contains(nextFocusedElement)) {
|
|
80
|
+
handleHide();
|
|
81
|
+
}
|
|
82
|
+
}, [handleHide]);
|
|
97
83
|
const handleShow = useCallback(async () => {
|
|
98
84
|
if (isTouch) {
|
|
99
85
|
const {
|
|
@@ -161,17 +147,123 @@ const ContextMenu = /*#__PURE__*/forwardRef(({
|
|
|
161
147
|
event.stopPropagation();
|
|
162
148
|
void handleShow();
|
|
163
149
|
}, [handleShow, shouldDisableClick]);
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
150
|
+
const handleKeyDown = useCallback(event => {
|
|
151
|
+
if (shouldDisableClick) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const isActivationKey = event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar';
|
|
155
|
+
if (isContentShown && event.key === 'Escape') {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
handleHide();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (isContentShown && !isHovered && event.key === 'ArrowDown') {
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
event.stopPropagation();
|
|
164
|
+
setFocusedIndex(prev => prev >= items.length - 1 ? 0 : prev + 1);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (isContentShown && !isHovered && event.key === 'ArrowUp') {
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
event.stopPropagation();
|
|
170
|
+
setFocusedIndex(prev => prev <= 0 ? items.length - 1 : prev - 1);
|
|
166
171
|
return;
|
|
167
172
|
}
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
if (isContentShown && isActivationKey) {
|
|
174
|
+
if (selectItem({
|
|
175
|
+
index: getActiveItemIndex({
|
|
176
|
+
contextMenuContentElement: contextMenuContentRef.current,
|
|
177
|
+
focusedIndex
|
|
178
|
+
}),
|
|
179
|
+
items,
|
|
180
|
+
onClose: handleHide,
|
|
181
|
+
shouldCloseOnPopupClick
|
|
182
|
+
})) {
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
event.stopPropagation();
|
|
185
|
+
}
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (event.currentTarget !== event.target) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const isContextMenuShortcut = event.key === 'ContextMenu' || event.key === 'F10' && event.shiftKey;
|
|
192
|
+
if (isContextMenuShortcut) {
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
event.stopPropagation();
|
|
195
|
+
shouldSkipNextContextMenuOpenRef.current = true;
|
|
196
|
+
void handleShow();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (shouldUseFocusableWrapper && isActivationKey) {
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
event.stopPropagation();
|
|
202
|
+
void handleShow();
|
|
203
|
+
}
|
|
204
|
+
}, [focusedIndex, handleHide, handleShow, isHovered, isContentShown, items, items.length, shouldCloseOnPopupClick, shouldDisableClick, shouldUseFocusableWrapper]);
|
|
205
|
+
const handleContextMenu = useCallback(event => {
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
event.stopPropagation();
|
|
208
|
+
if (shouldDisableClick) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (shouldSkipNextContextMenuOpenRef.current) {
|
|
212
|
+
shouldSkipNextContextMenuOpenRef.current = false;
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
void handleShow();
|
|
216
|
+
}, [handleShow, shouldDisableClick]);
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
const handleGlobalKeyDown = event => {
|
|
219
|
+
if (shouldDisableClick || !contextMenuRef.current) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const isContextMenuShortcut = event.key === 'ContextMenu' || event.key === 'F10' && event.shiftKey;
|
|
223
|
+
if (!isContextMenuShortcut) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const {
|
|
227
|
+
activeElement
|
|
228
|
+
} = document;
|
|
229
|
+
if (!(activeElement instanceof HTMLElement) || activeElement === document.body || activeElement === document.documentElement) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const shouldOpenFromFocusedParent = activeElement.contains(contextMenuRef.current) && !contextMenuRef.current.contains(activeElement);
|
|
233
|
+
if (!shouldOpenFromFocusedParent) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
event.preventDefault();
|
|
237
|
+
event.stopPropagation();
|
|
238
|
+
shouldPreventNextNativeContextMenuRef.current = true;
|
|
239
|
+
void handleShow();
|
|
240
|
+
};
|
|
241
|
+
const handleNativeContextMenuCapture = event => {
|
|
242
|
+
if (!shouldPreventNextNativeContextMenuRef.current) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
shouldPreventNextNativeContextMenuRef.current = false;
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
event.stopPropagation();
|
|
248
|
+
};
|
|
249
|
+
document.addEventListener('keydown', handleGlobalKeyDown, true);
|
|
250
|
+
document.addEventListener('contextmenu', handleNativeContextMenuCapture, true);
|
|
251
|
+
return () => {
|
|
252
|
+
document.removeEventListener('keydown', handleGlobalKeyDown, true);
|
|
253
|
+
document.removeEventListener('contextmenu', handleNativeContextMenuCapture, true);
|
|
254
|
+
};
|
|
255
|
+
}, [handleShow, shouldDisableClick]);
|
|
170
256
|
useImperativeHandle(ref, () => ({
|
|
171
257
|
hide: handleHide,
|
|
172
258
|
show: handleShow
|
|
173
259
|
}), [handleHide, handleShow]);
|
|
174
260
|
useEffect(() => {
|
|
261
|
+
const handleDocumentClick = event => {
|
|
262
|
+
if (!shouldCloseOnPopupClick && contextMenuContentRef.current?.contains(event.target)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
handleHide();
|
|
266
|
+
};
|
|
175
267
|
if (isContentShown) {
|
|
176
268
|
document.addEventListener('click', handleDocumentClick, true);
|
|
177
269
|
window.addEventListener('blur', handleHide);
|
|
@@ -185,7 +277,7 @@ const ContextMenu = /*#__PURE__*/forwardRef(({
|
|
|
185
277
|
document.removeEventListener('click', handleDocumentClick, true);
|
|
186
278
|
window.removeEventListener('blur', handleHide);
|
|
187
279
|
};
|
|
188
|
-
}, [
|
|
280
|
+
}, [handleHide, isContentShown, onHide, onShow, shouldCloseOnPopupClick]);
|
|
189
281
|
useEffect(() => {
|
|
190
282
|
if (!newContainer) {
|
|
191
283
|
return;
|
|
@@ -202,13 +294,7 @@ const ContextMenu = /*#__PURE__*/forwardRef(({
|
|
|
202
294
|
alignment: alignment ?? internalAlignment,
|
|
203
295
|
ref: contextMenuContentRef,
|
|
204
296
|
focusedIndex: focusedIndex,
|
|
205
|
-
|
|
206
|
-
const item = items[index];
|
|
207
|
-
if (item) {
|
|
208
|
-
void item.onClick();
|
|
209
|
-
handleHide();
|
|
210
|
-
}
|
|
211
|
-
},
|
|
297
|
+
onItemFocus: setFocusedIndex,
|
|
212
298
|
onMouseEnter: () => {
|
|
213
299
|
setIsHovered(true);
|
|
214
300
|
setFocusedIndex(-1);
|
|
@@ -218,13 +304,30 @@ const ContextMenu = /*#__PURE__*/forwardRef(({
|
|
|
218
304
|
}
|
|
219
305
|
})), newContainer));
|
|
220
306
|
}, [alignment, newContainer, coordinates, internalAlignment, internalCoordinates, isContentShown, items, uuid, zIndex, shouldHidePopupArrow, headline, focusedIndex, handleHide]);
|
|
307
|
+
useEffect(() => {
|
|
308
|
+
if (!contextMenuRef.current) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const focusableChildSelector = 'button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';
|
|
312
|
+
const hasFocusableChild = Boolean(contextMenuRef.current.querySelector(focusableChildSelector));
|
|
313
|
+
setShouldUseFocusableWrapper(!hasFocusableChild);
|
|
314
|
+
}, [children]);
|
|
221
315
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledContextMenu, {
|
|
222
316
|
className: className ? `beta-chayns-context-menu ${className}` : 'beta-chayns-context-menu',
|
|
223
317
|
$isActive: isContentShown && shouldShowHoverEffect,
|
|
224
318
|
$shouldAddHoverEffect: !isTouch && shouldShowHoverEffect,
|
|
319
|
+
$shouldShowWrapperKeyboardHighlighting: shouldShowWrapperKeyboardHighlighting,
|
|
225
320
|
$shouldUseDefaultTriggerStyles: shouldUseDefaultTriggerStyles,
|
|
226
321
|
onClick: handleClick,
|
|
322
|
+
onContextMenuCapture: handleContextMenu,
|
|
323
|
+
onContextMenu: handleContextMenu,
|
|
324
|
+
onKeyDown: handleKeyDown,
|
|
325
|
+
onBlur: handleContainerBlur,
|
|
227
326
|
ref: contextMenuRef,
|
|
327
|
+
tabIndex: shouldUseKeyboardFocusableWrapper ? 0 : undefined,
|
|
328
|
+
role: shouldUseKeyboardFocusableWrapper ? 'button' : undefined,
|
|
329
|
+
"aria-haspopup": shouldUseKeyboardFocusableWrapper ? 'menu' : undefined,
|
|
330
|
+
"aria-expanded": shouldUseKeyboardFocusableWrapper ? isContentShown : undefined,
|
|
228
331
|
style: style
|
|
229
332
|
}, children), portal);
|
|
230
333
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.js","names":["createDialog","DialogType","AnimatePresence","React","forwardRef","isValidElement","useCallback","useEffect","useImperativeHandle","useRef","useState","createPortal","useUuid","useIsTouch","Icon","ContextMenuContent","StyledContextMenu","ContextMenuAlignment","getDefaultFocusedIndex","ContextMenu","alignment","className","children","createElement","icons","size","container","coordinates","headline","items","onHide","onShow","shouldCloseOnPopupClick","shouldDisableClick","shouldHidePopupArrow","shouldShowHoverEffect","shouldUseDefaultTriggerStyles","style","yOffset","zIndex","ref","internalCoordinates","setInternalCoordinates","x","y","internalAlignment","setInternalAlignment","TopLeft","newContainer","setNewContainer","focusedIndex","setFocusedIndex","isContentShown","setIsContentShown","portal","setPortal","isHovered","setIsHovered","uuid","contextMenuContentRef","contextMenuRef","isTouch","current","el","element","closest","Element","handleHide","handleKey","e","length","key","preventDefault","prev","item","onClick","document","addEventListener","removeEventListener","handleShow","result","type","SELECT","buttons","list","map","text","isSelected","index","name","id","icon","undefined","open","height","childrenHeight","left","childrenLeft","top","childrenTop","width","childrenWidth","getBoundingClientRect","zoomX","offsetWidth","zoomY","offsetHeight","scrollLeft","scrollTop","BottomRight","TopRight","BottomLeft","handleClick","event","stopPropagation","handleDocumentClick","contains","target","hide","show","window","initial","onKeySelect","onMouseEnter","onMouseLeave","Fragment","$isActive","$shouldAddHoverEffect","$shouldUseDefaultTriggerStyles","displayName"],"sources":["../../../../src/components/context-menu/ContextMenu.tsx"],"sourcesContent":["import { createDialog, DialogType } from 'chayns-api';\nimport { AnimatePresence } from 'motion/react';\nimport React, {\n forwardRef,\n isValidElement,\n MouseEventHandler,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport { useIsTouch } from '../../utils/environment';\nimport Icon from '../icon/Icon';\nimport ContextMenuContent from './context-menu-content/ContextMenuContent';\nimport { StyledContextMenu } from './ContextMenu.styles';\nimport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './ContextMenu.types';\nimport { SelectDialogResult } from '../../types/general';\nimport { getDefaultFocusedIndex } from './ContextMenu.utils';\n\nconst ContextMenu = forwardRef<ContextMenuRef, ContextMenuProps>(\n (\n {\n alignment,\n className,\n children = <Icon icons={['ts-ellipsis_v']} size={18} />,\n container,\n coordinates,\n headline,\n items,\n onHide,\n onShow,\n shouldCloseOnPopupClick = true,\n shouldDisableClick = false,\n shouldHidePopupArrow = false,\n shouldShowHoverEffect = false,\n shouldUseDefaultTriggerStyles = true,\n style,\n yOffset = 0,\n zIndex = 20,\n },\n ref,\n ) => {\n const [internalCoordinates, setInternalCoordinates] = useState<ContextMenuCoordinates>({\n x: 0,\n y: 0,\n });\n\n const [internalAlignment, setInternalAlignment] = useState<ContextMenuAlignment>(\n ContextMenuAlignment.TopLeft,\n );\n\n const [newContainer, setNewContainer] = useState(container ?? null);\n const [focusedIndex, setFocusedIndex] = useState(getDefaultFocusedIndex(items));\n const [isContentShown, setIsContentShown] = useState(false);\n const [portal, setPortal] = useState<ReactPortal>();\n const [isHovered, setIsHovered] = useState(false);\n\n const uuid = useUuid();\n\n const contextMenuContentRef = useRef<HTMLDivElement>(null);\n const contextMenuRef = useRef<HTMLSpanElement>(null);\n\n const isTouch = useIsTouch();\n\n useEffect(() => {\n if (isContentShown) {\n setFocusedIndex(getDefaultFocusedIndex(items));\n }\n }, [isContentShown, items]);\n\n useEffect(() => {\n if (contextMenuRef.current && !container) {\n const el = contextMenuRef.current as HTMLElement;\n\n const element = el.closest('.dialog-inner, .page-provider, .tapp, body');\n\n setNewContainer(element);\n }\n }, [container]);\n\n useEffect(() => {\n if (container instanceof Element) {\n setNewContainer(container);\n }\n }, [container]);\n\n const handleHide = useCallback(() => {\n setIsContentShown(false);\n }, []);\n\n useEffect(() => {\n if (!isContentShown) return () => {};\n\n const handleKey = (e: KeyboardEvent) => {\n if (items.length === 0 || isHovered) return;\n\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n setFocusedIndex((prev) => (prev >= items.length - 1 ? 0 : prev + 1));\n }\n\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n setFocusedIndex((prev) => (prev <= 0 ? items.length - 1 : prev - 1));\n }\n\n if (e.key === 'Enter') {\n e.preventDefault();\n const item = items[focusedIndex];\n if (item) {\n void item.onClick();\n\n if (shouldCloseOnPopupClick) {\n handleHide();\n }\n }\n }\n\n if (e.key === 'Escape') {\n handleHide();\n }\n };\n\n document.addEventListener('keydown', handleKey);\n\n return () => document.removeEventListener('keydown', handleKey);\n }, [isContentShown, items, focusedIndex, handleHide, shouldCloseOnPopupClick, isHovered]);\n\n const handleShow = useCallback(async () => {\n if (isTouch) {\n const { result } = (await createDialog({\n type: DialogType.SELECT,\n buttons: [],\n list: items.map(({ icons, text, isSelected }, index) => ({\n name: text,\n id: index,\n isSelected,\n icon: isValidElement(icons)\n ? undefined\n : (icons as string[] | undefined)?.[0],\n })),\n }).open()) as SelectDialogResult;\n\n if (result && typeof result[0] === 'number') {\n void items[result[0]]?.onClick();\n }\n } else if (contextMenuRef.current) {\n if (!newContainer) {\n return;\n }\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = contextMenuRef.current.getBoundingClientRect();\n\n const { height, width, top, left } = newContainer.getBoundingClientRect();\n\n const zoomX = width / (newContainer as HTMLElement).offsetWidth;\n const zoomY = height / (newContainer as HTMLElement).offsetHeight;\n\n const x =\n (childrenLeft + childrenWidth / 2 - left) / zoomX + newContainer.scrollLeft;\n const y =\n (childrenTop + childrenHeight / 2 - top) / zoomY +\n newContainer.scrollTop -\n yOffset;\n\n setInternalCoordinates({ x, y });\n\n if (x < width / 2) {\n if (y < height / 2) {\n setInternalAlignment(ContextMenuAlignment.BottomRight);\n } else {\n setInternalAlignment(ContextMenuAlignment.TopRight);\n }\n } else if (y < height / 2) {\n setInternalAlignment(ContextMenuAlignment.BottomLeft);\n } else {\n setInternalAlignment(ContextMenuAlignment.TopLeft);\n }\n\n setIsContentShown(true);\n }\n }, [isTouch, items, newContainer, yOffset]);\n\n const handleClick = useCallback<MouseEventHandler<HTMLSpanElement>>(\n (event) => {\n if (shouldDisableClick) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n void handleShow();\n },\n [handleShow, shouldDisableClick],\n );\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (\n !shouldCloseOnPopupClick &&\n contextMenuContentRef.current?.contains(event.target as Node)\n ) {\n return;\n }\n\n handleHide();\n },\n [handleHide, shouldCloseOnPopupClick],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n if (isContentShown) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n\n if (typeof onShow === 'function') {\n onShow();\n }\n } else if (typeof onHide === 'function') {\n onHide();\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isContentShown, onHide, onShow]);\n\n useEffect(() => {\n if (!newContainer) {\n return;\n }\n\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isContentShown && (\n <ContextMenuContent\n coordinates={coordinates ?? internalCoordinates}\n items={items}\n zIndex={zIndex}\n headline={headline}\n shouldHidePopupArrow={shouldHidePopupArrow}\n key={`contextMenu_${uuid}`}\n alignment={alignment ?? internalAlignment}\n ref={contextMenuContentRef}\n focusedIndex={focusedIndex}\n onKeySelect={(index) => {\n const item = items[index];\n if (item) {\n void item.onClick();\n handleHide();\n }\n }}\n onMouseEnter={() => {\n setIsHovered(true);\n setFocusedIndex(-1);\n }}\n onMouseLeave={() => {\n setIsHovered(false);\n }}\n />\n )}\n </AnimatePresence>,\n newContainer,\n ),\n );\n }, [\n alignment,\n newContainer,\n coordinates,\n internalAlignment,\n internalCoordinates,\n isContentShown,\n items,\n uuid,\n zIndex,\n shouldHidePopupArrow,\n headline,\n focusedIndex,\n handleHide,\n ]);\n\n return (\n <>\n <StyledContextMenu\n className={\n className\n ? `beta-chayns-context-menu ${className}`\n : 'beta-chayns-context-menu'\n }\n $isActive={isContentShown && shouldShowHoverEffect}\n $shouldAddHoverEffect={!isTouch && shouldShowHoverEffect}\n $shouldUseDefaultTriggerStyles={shouldUseDefaultTriggerStyles}\n onClick={handleClick}\n ref={contextMenuRef}\n style={style}\n >\n {children}\n </StyledContextMenu>\n {portal}\n </>\n );\n },\n);\n\nContextMenu.displayName = 'ContextMenu';\n\nexport default ContextMenu;\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,UAAU,QAAQ,YAAY;AACrD,SAASC,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IACRC,UAAU,EACVC,cAAc,EAGdC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,OAAO,QAAQ,kBAAkB;AAC1C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version":3,"file":"ContextMenu.js","names":["createDialog","DialogType","AnimatePresence","React","forwardRef","isValidElement","useCallback","useEffect","useImperativeHandle","useRef","useState","createPortal","useUuid","useIsTouch","Icon","ContextMenuContent","StyledContextMenu","ContextMenuAlignment","getActiveItemIndex","getDefaultFocusedIndex","selectItem","useKeyboardFocusHighlighting","ContextMenu","alignment","className","children","createElement","icons","size","container","coordinates","headline","items","onHide","onShow","shouldCloseOnPopupClick","shouldDisableClick","shouldHidePopupArrow","shouldShowHoverEffect","shouldEnableKeyboardHighlighting","shouldUseDefaultTriggerStyles","style","yOffset","zIndex","ref","internalCoordinates","setInternalCoordinates","x","y","internalAlignment","setInternalAlignment","TopLeft","newContainer","setNewContainer","focusedIndex","setFocusedIndex","isContentShown","setIsContentShown","portal","setPortal","isHovered","setIsHovered","shouldUseFocusableWrapper","setShouldUseFocusableWrapper","uuid","contextMenuContentRef","contextMenuRef","shouldSkipNextContextMenuOpenRef","shouldPreventNextNativeContextMenuRef","isTouch","shouldShowKeyboardHighlighting","shouldShowWrapperKeyboardHighlighting","shouldUseKeyboardFocusableWrapper","current","el","element","closest","Element","handleHide","handleContainerBlur","event","nextFocusedElement","relatedTarget","currentContainer","currentTarget","contains","handleShow","result","type","SELECT","buttons","list","map","text","isSelected","index","name","id","icon","undefined","open","onClick","height","childrenHeight","left","childrenLeft","top","childrenTop","width","childrenWidth","getBoundingClientRect","zoomX","offsetWidth","zoomY","offsetHeight","scrollLeft","scrollTop","BottomRight","TopRight","BottomLeft","handleClick","preventDefault","stopPropagation","handleKeyDown","isActivationKey","key","prev","length","contextMenuContentElement","onClose","target","isContextMenuShortcut","shiftKey","handleContextMenu","handleGlobalKeyDown","activeElement","document","HTMLElement","body","documentElement","shouldOpenFromFocusedParent","handleNativeContextMenuCapture","addEventListener","removeEventListener","hide","show","handleDocumentClick","window","initial","onItemFocus","onMouseEnter","onMouseLeave","focusableChildSelector","hasFocusableChild","Boolean","querySelector","Fragment","$isActive","$shouldAddHoverEffect","$shouldShowWrapperKeyboardHighlighting","$shouldUseDefaultTriggerStyles","onContextMenuCapture","onContextMenu","onKeyDown","onBlur","tabIndex","role","displayName"],"sources":["../../../../src/components/context-menu/ContextMenu.tsx"],"sourcesContent":["import { createDialog, DialogType } from 'chayns-api';\nimport { AnimatePresence } from 'motion/react';\nimport React, {\n forwardRef,\n isValidElement,\n KeyboardEventHandler,\n MouseEvent,\n MouseEventHandler,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport { useIsTouch } from '../../utils/environment';\nimport Icon from '../icon/Icon';\nimport ContextMenuContent from './context-menu-content/ContextMenuContent';\nimport { StyledContextMenu } from './ContextMenu.styles';\nimport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './ContextMenu.types';\nimport { SelectDialogResult } from '../../types/general';\nimport { getActiveItemIndex, getDefaultFocusedIndex, selectItem } from './ContextMenu.utils';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nconst ContextMenu = forwardRef<ContextMenuRef, ContextMenuProps>(\n (\n {\n alignment,\n className,\n children = <Icon icons={['ts-ellipsis_v']} size={18} />,\n container,\n coordinates,\n headline,\n items,\n onHide,\n onShow,\n shouldCloseOnPopupClick = true,\n shouldDisableClick = false,\n shouldHidePopupArrow = false,\n shouldShowHoverEffect = false,\n shouldEnableKeyboardHighlighting,\n shouldUseDefaultTriggerStyles = true,\n style,\n yOffset = 0,\n zIndex = 20,\n },\n ref,\n ) => {\n const [internalCoordinates, setInternalCoordinates] = useState<ContextMenuCoordinates>({\n x: 0,\n y: 0,\n });\n\n const [internalAlignment, setInternalAlignment] = useState<ContextMenuAlignment>(\n ContextMenuAlignment.TopLeft,\n );\n\n const [newContainer, setNewContainer] = useState(container ?? null);\n const [focusedIndex, setFocusedIndex] = useState(getDefaultFocusedIndex(items));\n const [isContentShown, setIsContentShown] = useState(false);\n const [portal, setPortal] = useState<ReactPortal>();\n const [isHovered, setIsHovered] = useState(false);\n const [shouldUseFocusableWrapper, setShouldUseFocusableWrapper] = useState(false);\n\n const uuid = useUuid();\n\n const contextMenuContentRef = useRef<HTMLDivElement>(null);\n const contextMenuRef = useRef<HTMLSpanElement>(null);\n const shouldSkipNextContextMenuOpenRef = useRef(false);\n const shouldPreventNextNativeContextMenuRef = useRef(false);\n\n const isTouch = useIsTouch();\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting && !shouldDisableClick,\n );\n const shouldShowWrapperKeyboardHighlighting =\n shouldShowKeyboardHighlighting && shouldUseFocusableWrapper;\n const shouldUseKeyboardFocusableWrapper = shouldUseFocusableWrapper && !shouldDisableClick;\n\n useEffect(() => {\n if (isContentShown) {\n setFocusedIndex(getDefaultFocusedIndex(items));\n }\n }, [isContentShown, items]);\n\n useEffect(() => {\n if (contextMenuRef.current && !container) {\n const el = contextMenuRef.current as HTMLElement;\n\n const element = el.closest('.dialog-inner, .page-provider, .tapp, body');\n\n setNewContainer(element);\n }\n }, [container]);\n\n useEffect(() => {\n if (container instanceof Element) {\n setNewContainer(container);\n }\n }, [container]);\n\n const handleHide = useCallback(() => {\n setIsContentShown(false);\n }, []);\n\n const handleContainerBlur = useCallback(\n (event: React.FocusEvent<HTMLSpanElement>) => {\n const nextFocusedElement = event.relatedTarget as Node | null;\n const currentContainer = event.currentTarget as HTMLElement;\n\n if (\n !nextFocusedElement ||\n (!currentContainer.contains(nextFocusedElement) &&\n !contextMenuContentRef.current?.contains(nextFocusedElement))\n ) {\n handleHide();\n }\n },\n [handleHide],\n );\n\n const handleShow = useCallback(async () => {\n if (isTouch) {\n const { result } = (await createDialog({\n type: DialogType.SELECT,\n buttons: [],\n list: items.map(({ icons, text, isSelected }, index) => ({\n name: text,\n id: index,\n isSelected,\n icon: isValidElement(icons)\n ? undefined\n : (icons as string[] | undefined)?.[0],\n })),\n }).open()) as SelectDialogResult;\n\n if (result && typeof result[0] === 'number') {\n void items[result[0]]?.onClick();\n }\n } else if (contextMenuRef.current) {\n if (!newContainer) {\n return;\n }\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = contextMenuRef.current.getBoundingClientRect();\n\n const { height, width, top, left } = newContainer.getBoundingClientRect();\n\n const zoomX = width / (newContainer as HTMLElement).offsetWidth;\n const zoomY = height / (newContainer as HTMLElement).offsetHeight;\n\n const x =\n (childrenLeft + childrenWidth / 2 - left) / zoomX + newContainer.scrollLeft;\n const y =\n (childrenTop + childrenHeight / 2 - top) / zoomY +\n newContainer.scrollTop -\n yOffset;\n\n setInternalCoordinates({ x, y });\n\n if (x < width / 2) {\n if (y < height / 2) {\n setInternalAlignment(ContextMenuAlignment.BottomRight);\n } else {\n setInternalAlignment(ContextMenuAlignment.TopRight);\n }\n } else if (y < height / 2) {\n setInternalAlignment(ContextMenuAlignment.BottomLeft);\n } else {\n setInternalAlignment(ContextMenuAlignment.TopLeft);\n }\n\n setIsContentShown(true);\n }\n }, [isTouch, items, newContainer, yOffset]);\n\n const handleClick = useCallback<MouseEventHandler<HTMLSpanElement>>(\n (event) => {\n if (shouldDisableClick) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n void handleShow();\n },\n [handleShow, shouldDisableClick],\n );\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLSpanElement>>(\n (event) => {\n if (shouldDisableClick) {\n return;\n }\n\n const isActivationKey =\n event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar';\n\n if (isContentShown && event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n handleHide();\n return;\n }\n\n if (isContentShown && !isHovered && event.key === 'ArrowDown') {\n event.preventDefault();\n event.stopPropagation();\n setFocusedIndex((prev) => (prev >= items.length - 1 ? 0 : prev + 1));\n return;\n }\n\n if (isContentShown && !isHovered && event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n setFocusedIndex((prev) => (prev <= 0 ? items.length - 1 : prev - 1));\n return;\n }\n\n if (isContentShown && isActivationKey) {\n if (\n selectItem({\n index: getActiveItemIndex({\n contextMenuContentElement: contextMenuContentRef.current,\n focusedIndex,\n }),\n items,\n onClose: handleHide,\n shouldCloseOnPopupClick,\n })\n ) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n return;\n }\n\n if (event.currentTarget !== event.target) {\n return;\n }\n\n const isContextMenuShortcut =\n event.key === 'ContextMenu' || (event.key === 'F10' && event.shiftKey);\n\n if (isContextMenuShortcut) {\n event.preventDefault();\n event.stopPropagation();\n shouldSkipNextContextMenuOpenRef.current = true;\n void handleShow();\n return;\n }\n\n if (shouldUseFocusableWrapper && isActivationKey) {\n event.preventDefault();\n event.stopPropagation();\n void handleShow();\n }\n },\n [\n focusedIndex,\n handleHide,\n handleShow,\n isHovered,\n isContentShown,\n items,\n items.length,\n shouldCloseOnPopupClick,\n shouldDisableClick,\n shouldUseFocusableWrapper,\n ],\n );\n\n const handleContextMenu = useCallback(\n (event: MouseEvent<HTMLSpanElement>) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (shouldDisableClick) {\n return;\n }\n\n if (shouldSkipNextContextMenuOpenRef.current) {\n shouldSkipNextContextMenuOpenRef.current = false;\n return;\n }\n\n void handleShow();\n },\n [handleShow, shouldDisableClick],\n );\n\n useEffect(() => {\n const handleGlobalKeyDown = (event: KeyboardEvent) => {\n if (shouldDisableClick || !contextMenuRef.current) {\n return;\n }\n\n const isContextMenuShortcut =\n event.key === 'ContextMenu' || (event.key === 'F10' && event.shiftKey);\n\n if (!isContextMenuShortcut) {\n return;\n }\n\n const { activeElement } = document;\n\n if (\n !(activeElement instanceof HTMLElement) ||\n activeElement === document.body ||\n activeElement === document.documentElement\n ) {\n return;\n }\n\n const shouldOpenFromFocusedParent =\n activeElement.contains(contextMenuRef.current) &&\n !contextMenuRef.current.contains(activeElement);\n\n if (!shouldOpenFromFocusedParent) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n shouldPreventNextNativeContextMenuRef.current = true;\n void handleShow();\n };\n\n const handleNativeContextMenuCapture = (event: Event) => {\n if (!shouldPreventNextNativeContextMenuRef.current) {\n return;\n }\n\n shouldPreventNextNativeContextMenuRef.current = false;\n event.preventDefault();\n event.stopPropagation();\n };\n\n document.addEventListener('keydown', handleGlobalKeyDown, true);\n document.addEventListener('contextmenu', handleNativeContextMenuCapture, true);\n\n return () => {\n document.removeEventListener('keydown', handleGlobalKeyDown, true);\n document.removeEventListener('contextmenu', handleNativeContextMenuCapture, true);\n };\n }, [handleShow, shouldDisableClick]);\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n const handleDocumentClick = (event: PointerEvent) => {\n if (\n !shouldCloseOnPopupClick &&\n contextMenuContentRef.current?.contains(event.target as Node)\n ) {\n return;\n }\n\n handleHide();\n };\n\n if (isContentShown) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n\n if (typeof onShow === 'function') {\n onShow();\n }\n } else if (typeof onHide === 'function') {\n onHide();\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleHide, isContentShown, onHide, onShow, shouldCloseOnPopupClick]);\n\n useEffect(() => {\n if (!newContainer) {\n return;\n }\n\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isContentShown && (\n <ContextMenuContent\n coordinates={coordinates ?? internalCoordinates}\n items={items}\n zIndex={zIndex}\n headline={headline}\n shouldHidePopupArrow={shouldHidePopupArrow}\n key={`contextMenu_${uuid}`}\n alignment={alignment ?? internalAlignment}\n ref={contextMenuContentRef}\n focusedIndex={focusedIndex}\n onItemFocus={setFocusedIndex}\n onMouseEnter={() => {\n setIsHovered(true);\n setFocusedIndex(-1);\n }}\n onMouseLeave={() => {\n setIsHovered(false);\n }}\n />\n )}\n </AnimatePresence>,\n newContainer,\n ),\n );\n }, [\n alignment,\n newContainer,\n coordinates,\n internalAlignment,\n internalCoordinates,\n isContentShown,\n items,\n uuid,\n zIndex,\n shouldHidePopupArrow,\n headline,\n focusedIndex,\n handleHide,\n ]);\n\n useEffect(() => {\n if (!contextMenuRef.current) {\n return;\n }\n\n const focusableChildSelector =\n 'button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\n const hasFocusableChild = Boolean(\n contextMenuRef.current.querySelector(focusableChildSelector),\n );\n\n setShouldUseFocusableWrapper(!hasFocusableChild);\n }, [children]);\n\n return (\n <>\n <StyledContextMenu\n className={\n className\n ? `beta-chayns-context-menu ${className}`\n : 'beta-chayns-context-menu'\n }\n $isActive={isContentShown && shouldShowHoverEffect}\n $shouldAddHoverEffect={!isTouch && shouldShowHoverEffect}\n $shouldShowWrapperKeyboardHighlighting={shouldShowWrapperKeyboardHighlighting}\n $shouldUseDefaultTriggerStyles={shouldUseDefaultTriggerStyles}\n onClick={handleClick}\n onContextMenuCapture={handleContextMenu}\n onContextMenu={handleContextMenu}\n onKeyDown={handleKeyDown}\n onBlur={handleContainerBlur}\n ref={contextMenuRef}\n tabIndex={shouldUseKeyboardFocusableWrapper ? 0 : undefined}\n role={shouldUseKeyboardFocusableWrapper ? 'button' : undefined}\n aria-haspopup={shouldUseKeyboardFocusableWrapper ? 'menu' : undefined}\n aria-expanded={shouldUseKeyboardFocusableWrapper ? isContentShown : undefined}\n style={style}\n >\n {children}\n </StyledContextMenu>\n {portal}\n </>\n );\n },\n);\n\nContextMenu.displayName = 'ContextMenu';\n\nexport default ContextMenu;\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,UAAU,QAAQ,YAAY;AACrD,SAASC,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IACRC,UAAU,EACVC,cAAc,EAKdC,WAAW,EACXC,SAAS,EACT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EAAExC,aAAc;IACzByC,MAAM,EAAErF,mBAAoB;IAC5BnC,GAAG,EAAEsB,cAAe;IACpBmG,QAAQ,EAAE7F,iCAAiC,GAAG,CAAC,GAAG2B,SAAU;IAC5DmE,IAAI,EAAE9F,iCAAiC,GAAG,QAAQ,GAAG2B,SAAU;IAC/D,iBAAe3B,iCAAiC,GAAG,MAAM,GAAG2B,SAAU;IACtE,iBAAe3B,iCAAiC,GAAGhB,cAAc,GAAG2C,SAAU;IAC9E1D,KAAK,EAAEA;EAAM,GAEZhB,QACc,CAAC,EACnBiC,MACH,CAAC;AAEX,CACJ,CAAC;AAEDpC,WAAW,CAACiJ,WAAW,GAAG,aAAa;AAEvC,eAAejJ,WAAW","ignoreList":[]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
+
import { keyboardFocusHighlightingCircleRingCss, keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
|
|
2
3
|
export const StyledContextMenu = styled.span`
|
|
3
4
|
align-items: center;
|
|
4
5
|
cursor: pointer;
|
|
5
6
|
display: flex;
|
|
7
|
+
position: relative;
|
|
6
8
|
|
|
7
9
|
${({
|
|
8
10
|
$isActive,
|
|
@@ -31,5 +33,41 @@ export const StyledContextMenu = styled.span`
|
|
|
31
33
|
background-color: ${theme['201']};
|
|
32
34
|
}
|
|
33
35
|
`}
|
|
36
|
+
|
|
37
|
+
${({
|
|
38
|
+
$shouldShowWrapperKeyboardHighlighting,
|
|
39
|
+
$shouldUseDefaultTriggerStyles
|
|
40
|
+
}) => $shouldShowWrapperKeyboardHighlighting && ($shouldUseDefaultTriggerStyles ? css`
|
|
41
|
+
&:focus-visible {
|
|
42
|
+
outline: none;
|
|
43
|
+
box-shadow: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:focus-visible > .beta-chayns-icon {
|
|
47
|
+
position: relative;
|
|
48
|
+
color: inherit;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:focus-visible > .beta-chayns-icon::after {
|
|
52
|
+
${keyboardFocusHighlightingCircleRingCss};
|
|
53
|
+
content: '';
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 50%;
|
|
56
|
+
left: 50%;
|
|
57
|
+
width: calc(100% + 8px);
|
|
58
|
+
height: calc(100% + 8px);
|
|
59
|
+
transform: translate(-50%, -50%);
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
` : css`
|
|
63
|
+
&:focus-visible {
|
|
64
|
+
outline: none;
|
|
65
|
+
box-shadow: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:focus-visible > * {
|
|
69
|
+
${keyboardFocusHighlightingRingCss}
|
|
70
|
+
}
|
|
71
|
+
`)}
|
|
34
72
|
`;
|
|
35
73
|
//# sourceMappingURL=ContextMenu.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.styles.js","names":["styled","css","StyledContextMenu","span","$isActive","$shouldUseDefaultTriggerStyles","theme","$shouldAddHoverEffect"],"sources":["../../../../src/components/context-menu/ContextMenu.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledContextMenuProps = WithTheme<{\n $isActive: boolean;\n $shouldAddHoverEffect: boolean;\n $shouldUseDefaultTriggerStyles: boolean;\n}>;\n\nexport const StyledContextMenu = styled.span<StyledContextMenuProps>`\n align-items: center;\n cursor: pointer;\n display: flex;\n\n ${({ $isActive, $shouldUseDefaultTriggerStyles, theme }: StyledContextMenuProps) =>\n $shouldUseDefaultTriggerStyles\n ? css`\n background-color: ${$isActive ? theme['201'] : 'transparent'};\n border-radius: 3px;\n padding: 6px;\n transition: background-color 0.3s ease;\n `\n : css`\n background-color: transparent;\n border-radius: inherit;\n padding: 0;\n\n > * {\n width: 100%;\n }\n `}\n\n ${({ $shouldAddHoverEffect, theme }: StyledContextMenuProps) =>\n $shouldAddHoverEffect &&\n css`\n &:hover {\n background-color: ${theme['201']};\n }\n `}\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;
|
|
1
|
+
{"version":3,"file":"ContextMenu.styles.js","names":["styled","css","keyboardFocusHighlightingCircleRingCss","keyboardFocusHighlightingRingCss","StyledContextMenu","span","$isActive","$shouldUseDefaultTriggerStyles","theme","$shouldAddHoverEffect","$shouldShowWrapperKeyboardHighlighting"],"sources":["../../../../src/components/context-menu/ContextMenu.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport {\n keyboardFocusHighlightingCircleRingCss,\n keyboardFocusHighlightingRingCss,\n} from '../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledContextMenuProps = WithTheme<{\n $isActive: boolean;\n $shouldAddHoverEffect: boolean;\n $shouldShowWrapperKeyboardHighlighting: boolean;\n $shouldUseDefaultTriggerStyles: boolean;\n}>;\n\nexport const StyledContextMenu = styled.span<StyledContextMenuProps>`\n align-items: center;\n cursor: pointer;\n display: flex;\n position: relative;\n\n ${({ $isActive, $shouldUseDefaultTriggerStyles, theme }: StyledContextMenuProps) =>\n $shouldUseDefaultTriggerStyles\n ? css`\n background-color: ${$isActive ? theme['201'] : 'transparent'};\n border-radius: 3px;\n padding: 6px;\n transition: background-color 0.3s ease;\n `\n : css`\n background-color: transparent;\n border-radius: inherit;\n padding: 0;\n\n > * {\n width: 100%;\n }\n `}\n\n ${({ $shouldAddHoverEffect, theme }: StyledContextMenuProps) =>\n $shouldAddHoverEffect &&\n css`\n &:hover {\n background-color: ${theme['201']};\n }\n `}\n\n ${({\n $shouldShowWrapperKeyboardHighlighting,\n $shouldUseDefaultTriggerStyles,\n }: StyledContextMenuProps) =>\n $shouldShowWrapperKeyboardHighlighting &&\n ($shouldUseDefaultTriggerStyles\n ? css`\n &:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n &:focus-visible > .beta-chayns-icon {\n position: relative;\n color: inherit;\n }\n\n &:focus-visible > .beta-chayns-icon::after {\n ${keyboardFocusHighlightingCircleRingCss};\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: calc(100% + 8px);\n height: calc(100% + 8px);\n transform: translate(-50%, -50%);\n pointer-events: none;\n }\n `\n : css`\n &:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n &:focus-visible > * {\n ${keyboardFocusHighlightingRingCss}\n }\n `)}\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SACIC,sCAAsC,EACtCC,gCAAgC,QAC7B,8CAA8C;AASrD,OAAO,MAAMC,iBAAiB,GAAGJ,MAAM,CAACK,IAA4B;AACpE;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC,SAAS;EAAEC,8BAA8B;EAAEC;AAA8B,CAAC,KAC3ED,8BAA8B,GACxBN,GAAG;AACjB,sCAAsCK,SAAS,GAAGE,KAAK,CAAC,KAAK,CAAC,GAAG,aAAa;AAC9E;AACA;AACA;AACA,eAAe,GACDP,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA,MAAM,CAAC;EAAEQ,qBAAqB;EAAED;AAA8B,CAAC,KACvDC,qBAAqB,IACrBR,GAAG;AACX;AACA,oCAAoCO,KAAK,CAAC,KAAK,CAAC;AAChD;AACA,SAAS;AACT;AACA,MAAM,CAAC;EACCE,sCAAsC;EACtCH;AACoB,CAAC,KACrBG,sCAAsC,KACrCH,8BAA8B,GACzBN,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwBC,sCAAsC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,GACDD,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwBE,gCAAgC;AACxD;AACA,eAAe,CAAC;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.types.js","names":["ContextMenuAlignment"],"sources":["../../../../src/components/context-menu/ContextMenu.types.ts"],"sourcesContent":["import type { CSSProperties, MouseEvent, ReactNode } from 'react';\n\n/**\n * Enum representing the possible alignments for the context menu.\n */\nexport enum ContextMenuAlignment {\n TopLeft,\n BottomLeft,\n TopRight,\n BottomRight,\n TopCenter,\n BottomCenter,\n}\n\n/**\n * Type representing the coordinates for positioning the context menu.\n */\nexport type ContextMenuCoordinates = {\n /** The x-coordinate. */\n x: number;\n /** The y-coordinate. */\n y: number;\n};\n\n/**\n * Type representing an item in the context menu.\n */\nexport type ContextMenuItem = {\n /** Optional icons for the item. Can be strings or React nodes. */\n icons?: string[] | ReactNode;\n /** Whether the item is selected. */\n isSelected?: boolean;\n /** Unique key for the item. */\n key: string;\n /** Function called when the item is clicked. */\n onClick: (event?: MouseEvent<HTMLDivElement>) => Promise<void> | void;\n /** Whether to show a spacer after the item. */\n shouldShowSpacer?: boolean;\n /** The text displayed for the item. */\n text: string;\n};\n\n/**\n * Props for the ContextMenu component.\n */\nexport type ContextMenuProps = {\n /**\n * Context menu alignment\n * @description Optional custom alignment used instead of calculating it using the alignment\n * within the page. The available alignments can be taken from the ContextMenuAlignment enum.\n * @example alignment={ContextMenuAlignment.TopLeft}\n * @optional\n */\n alignment?: ContextMenuAlignment;\n /**\n * Additional class name applied to the trigger wrapper.\n * @optional\n */\n className?: string;\n /**\n * Children element\n * @description The element over which the content of the ContextMenu should be displayed.\n * @example children={<Icon icons={['fa fa-paper-clip']} />\n * @default <Icon icons={['ts-ellipsis_v']} size={18} />\n * @optional\n */\n children?: ReactNode;\n /**\n * Container element\n * @description The element where the content of the ContextMenu should be rendered via React Portal.\n * @example container={document.body}\n * @optional\n */\n container?: Element;\n /**\n * Custom coordinates\n * @description Optional own coordinates to be used instead of calculating the alignment based\n * on the alignment of the children.\n * @example coordinates={{ x: 100, y: 200 }}\n * @optional\n */\n coordinates?: ContextMenuCoordinates;\n /**\n * Context menu headline\n * @description The headline of the context menu. If not provided, no headline will be displayed.\n * @example headline=\"Options\"\n * @optional\n */\n headline?: string;\n /**\n * Menu items\n * @description The items that will be displayed in the content of the ContextMenu. Custom icon\n * elements only will be displayed on desktop devices.\n * @example items={[{ key: '1', text: 'Option 1', onClick: () => {} }]}\n */\n items: ContextMenuItem[];\n /**\n * Hide callback function\n * @description Function to be executed when the content of the Context menu has been hidden.\n * @example onHide={() => console.log('Menu hidden')}\n * @optional\n */\n onHide?: VoidFunction;\n /**\n * Show callback function\n * @description Function to be executed when the content of the Context menu has been shown.\n * @example onShow={() => console.log('Menu shown')}\n * @optional\n */\n onShow?: VoidFunction;\n /**\n * Close on popup click flag\n * @description Whether the popup should be closed if it is clicked.\n * @default true\n * @optional\n */\n shouldCloseOnPopupClick?: boolean;\n /**\n * Disable click flag\n * @description Whether the click should be disabled.\n * @default false\n * @optional\n */\n shouldDisableClick?: boolean;\n /**\n * Hide popup arrow flag\n * @description Whether the arrow of the popup should be hidden.\n * @default false\n * @optional\n */\n shouldHidePopupArrow?: boolean;\n /**\n * Whether the default trigger padding/background styles should be applied.\n * @description Disable this when the trigger child already provides its own full visual styling.\n * @default true\n * @optional\n */\n shouldUseDefaultTriggerStyles?: boolean;\n /**\n * Show hover effect flag\n * @description Whether the hover effect should be shown.\n * @default false\n * @optional\n */\n shouldShowHoverEffect?: boolean;\n /**\n * Inline styles applied to the trigger wrapper.\n * @optional\n */\n style?: CSSProperties;\n /**\n * Vertical offset between the trigger element and the context menu.\n * @description Use this prop to fine-tune the context menu position on the Y axis. Positive and\n * negative values can be used depending on the desired spacing.\n * @default 0\n * @example yOffset={8}\n * @optional\n */\n yOffset?: number;\n /**\n * Z-index value\n * @description The z-index of the popup.\n * @example zIndex={100}\n * @default 20\n * @optional\n */\n zIndex?: number;\n};\n\n/**\n * Ref interface for the ContextMenu component.\n */\nexport interface ContextMenuRef {\n /** Hides the context menu. */\n hide: VoidFunction;\n /** Shows the context menu. */\n show: VoidFunction;\n}\n"],"mappings":"AAEA;AACA;AACA;AACA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;;AAShC;AACA;AACA;;AAQA;AACA;AACA;;AAgBA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"ContextMenu.types.js","names":["ContextMenuAlignment"],"sources":["../../../../src/components/context-menu/ContextMenu.types.ts"],"sourcesContent":["import type { CSSProperties, MouseEvent, ReactNode } from 'react';\n\n/**\n * Enum representing the possible alignments for the context menu.\n */\nexport enum ContextMenuAlignment {\n TopLeft,\n BottomLeft,\n TopRight,\n BottomRight,\n TopCenter,\n BottomCenter,\n}\n\n/**\n * Type representing the coordinates for positioning the context menu.\n */\nexport type ContextMenuCoordinates = {\n /** The x-coordinate. */\n x: number;\n /** The y-coordinate. */\n y: number;\n};\n\n/**\n * Type representing an item in the context menu.\n */\nexport type ContextMenuItem = {\n /** Optional icons for the item. Can be strings or React nodes. */\n icons?: string[] | ReactNode;\n /** Whether the item is selected. */\n isSelected?: boolean;\n /** Unique key for the item. */\n key: string;\n /** Function called when the item is clicked. */\n onClick: (event?: MouseEvent<HTMLDivElement>) => Promise<void> | void;\n /** Whether to show a spacer after the item. */\n shouldShowSpacer?: boolean;\n /** The text displayed for the item. */\n text: string;\n};\n\n/**\n * Props for the ContextMenu component.\n */\nexport type ContextMenuProps = {\n /**\n * Context menu alignment\n * @description Optional custom alignment used instead of calculating it using the alignment\n * within the page. The available alignments can be taken from the ContextMenuAlignment enum.\n * @example alignment={ContextMenuAlignment.TopLeft}\n * @optional\n */\n alignment?: ContextMenuAlignment;\n /**\n * Additional class name applied to the trigger wrapper.\n * @optional\n */\n className?: string;\n /**\n * Children element\n * @description The element over which the content of the ContextMenu should be displayed.\n * @example children={<Icon icons={['fa fa-paper-clip']} />\n * @default <Icon icons={['ts-ellipsis_v']} size={18} />\n * @optional\n */\n children?: ReactNode;\n /**\n * Container element\n * @description The element where the content of the ContextMenu should be rendered via React Portal.\n * @example container={document.body}\n * @optional\n */\n container?: Element;\n /**\n * Custom coordinates\n * @description Optional own coordinates to be used instead of calculating the alignment based\n * on the alignment of the children.\n * @example coordinates={{ x: 100, y: 200 }}\n * @optional\n */\n coordinates?: ContextMenuCoordinates;\n /**\n * Context menu headline\n * @description The headline of the context menu. If not provided, no headline will be displayed.\n * @example headline=\"Options\"\n * @optional\n */\n headline?: string;\n /**\n * Menu items\n * @description The items that will be displayed in the content of the ContextMenu. Custom icon\n * elements only will be displayed on desktop devices.\n * @example items={[{ key: '1', text: 'Option 1', onClick: () => {} }]}\n */\n items: ContextMenuItem[];\n /**\n * Hide callback function\n * @description Function to be executed when the content of the Context menu has been hidden.\n * @example onHide={() => console.log('Menu hidden')}\n * @optional\n */\n onHide?: VoidFunction;\n /**\n * Show callback function\n * @description Function to be executed when the content of the Context menu has been shown.\n * @example onShow={() => console.log('Menu shown')}\n * @optional\n */\n onShow?: VoidFunction;\n /**\n * Close on popup click flag\n * @description Whether the popup should be closed if it is clicked.\n * @default true\n * @optional\n */\n shouldCloseOnPopupClick?: boolean;\n /**\n * Disable click flag\n * @description Whether the click should be disabled.\n * @default false\n * @optional\n */\n shouldDisableClick?: boolean;\n /**\n * Hide popup arrow flag\n * @description Whether the arrow of the popup should be hidden.\n * @default false\n * @optional\n */\n shouldHidePopupArrow?: boolean;\n /**\n * Whether the default trigger padding/background styles should be applied.\n * @description Disable this when the trigger child already provides its own full visual styling.\n * @default true\n * @optional\n */\n shouldUseDefaultTriggerStyles?: boolean;\n /**\n * Show hover effect flag\n * @description Whether the hover effect should be shown.\n * @default false\n * @optional\n */\n shouldShowHoverEffect?: boolean;\n /**\n * Enables keyboard-only focus highlighting for the trigger.\n * @default false\n * @optional\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Inline styles applied to the trigger wrapper.\n * @optional\n */\n style?: CSSProperties;\n /**\n * Vertical offset between the trigger element and the context menu.\n * @description Use this prop to fine-tune the context menu position on the Y axis. Positive and\n * negative values can be used depending on the desired spacing.\n * @default 0\n * @example yOffset={8}\n * @optional\n */\n yOffset?: number;\n /**\n * Z-index value\n * @description The z-index of the popup.\n * @example zIndex={100}\n * @default 20\n * @optional\n */\n zIndex?: number;\n};\n\n/**\n * Ref interface for the ContextMenu component.\n */\nexport interface ContextMenuRef {\n /** Hides the context menu. */\n hide: VoidFunction;\n /** Shows the context menu. */\n show: VoidFunction;\n}\n"],"mappings":"AAEA;AACA;AACA;AACA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;;AAShC;AACA;AACA;;AAQA;AACA;AACA;;AAgBA;AACA;AACA;;AAmIA;AACA;AACA","ignoreList":[]}
|