@chayns-components/core 5.3.12-alpha.0 → 5.4.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 +0 -12
- package/lib/cjs/components/accordion/Accordion.js +12 -107
- package/lib/cjs/components/accordion/Accordion.js.map +1 -1
- package/lib/cjs/components/accordion/Accordion.styles.js +3 -23
- package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js +1 -3
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js +19 -36
- package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.js +3 -6
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js +0 -14
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/cjs/components/amount-control/AmountControl.js +17 -31
- package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
- package/lib/cjs/components/amount-control/AmountControl.styles.js +2 -18
- package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
- package/lib/cjs/components/button/Button.js +1 -5
- package/lib/cjs/components/button/Button.js.map +1 -1
- package/lib/cjs/components/button/Button.styles.js +0 -17
- 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 +1 -5
- package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
- package/lib/cjs/components/checkbox/Checkbox.styles.js +2 -29
- package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +2 -7
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +2 -8
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.js +5 -52
- package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.styles.js +0 -11
- 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 +6 -100
- package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.styles.js +0 -38
- 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/file-input/FileInput.js +2 -4
- package/lib/cjs/components/file-input/FileInput.js.map +1 -1
- package/lib/cjs/components/file-list/file-item/FileItem.js +2 -23
- package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
- package/lib/cjs/components/file-list/file-item/FileItem.styles.js +1 -19
- package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.js +4 -27
- package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.styles.js +0 -10
- package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/cjs/components/filter/Filter.js +16 -51
- package/lib/cjs/components/filter/Filter.js.map +1 -1
- package/lib/cjs/components/filter/Filter.styles.js +0 -9
- package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.js +5 -14
- 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 +4 -69
- package/lib/cjs/components/filter-buttons/FilterButtons.js.map +1 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +2 -40
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +0 -11
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
- package/lib/cjs/components/grid-image/GridImage.js +2 -20
- package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
- package/lib/cjs/components/grid-image/GridImage.styles.js +2 -11
- package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.js +4 -23
- package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js +0 -9
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/cjs/components/highlight-slider/HighlightSlider.js +3 -10
- package/lib/cjs/components/highlight-slider/HighlightSlider.js.map +1 -1
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +4 -21
- 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 +2 -11
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
- package/lib/cjs/components/icon/Icon.js +5 -24
- package/lib/cjs/components/icon/Icon.js.map +1 -1
- package/lib/cjs/components/icon/Icon.styles.js +0 -23
- package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
- package/lib/cjs/components/input/Input.js +8 -29
- package/lib/cjs/components/input/Input.js.map +1 -1
- package/lib/cjs/components/input/Input.styles.js +3 -33
- package/lib/cjs/components/input/Input.styles.js.map +1 -1
- package/lib/cjs/components/list/List.js +37 -124
- package/lib/cjs/components/list/List.js.map +1 -1
- package/lib/cjs/components/list/List.utils.js +1 -119
- package/lib/cjs/components/list/List.utils.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.js +3 -82
- package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.styles.js +0 -9
- 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 -40
- 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 +1 -5
- 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 -32
- 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 +1 -32
- 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 -30
- package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
- package/lib/cjs/components/mention-finder/MentionFinder.js +2 -31
- 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 +3 -36
- package/lib/cjs/components/multi-action-button/MultiActionButton.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 +1 -7
- 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 +0 -12
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/cjs/components/number-input/NumberInput.js +10 -13
- package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
- package/lib/cjs/components/page-provider/PageProvider.js +2 -4
- package/lib/cjs/components/page-provider/PageProvider.js.map +1 -1
- package/lib/cjs/components/popup/Popup.js +1 -8
- package/lib/cjs/components/popup/Popup.js.map +1 -1
- package/lib/cjs/components/radio-button/RadioButton.js +15 -29
- package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
- package/lib/cjs/components/radio-button/RadioButton.styles.js +8 -19
- package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js +4 -7
- package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
- package/lib/cjs/components/search-box/SearchBox.js +2 -5
- package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.js +41 -40
- package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.styles.js +2 -25
- package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/cjs/components/select-button/SelectButton.js +2 -4
- package/lib/cjs/components/select-button/SelectButton.js.map +1 -1
- package/lib/cjs/components/setup-wizard/SetupWizard.js +4 -7
- package/lib/cjs/components/setup-wizard/SetupWizard.js.map +1 -1
- package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +3 -5
- package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
- package/lib/cjs/components/sharing-bar/SharingBar.js +7 -32
- package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/cjs/components/sharing-bar/SharingBar.styles.js +3 -7
- package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
- package/lib/cjs/components/sharing-button/SharingButton.js +2 -4
- package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +1 -3
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/cjs/components/signature/Signature.js +3 -6
- package/lib/cjs/components/signature/Signature.js.map +1 -1
- package/lib/cjs/components/skeleton/base-skeleton/BaseSkeleton.styles.js +2 -0
- package/lib/cjs/components/skeleton/base-skeleton/BaseSkeleton.styles.js.map +1 -1
- package/lib/cjs/components/slider/Slider.js +7 -30
- package/lib/cjs/components/slider/Slider.js.map +1 -1
- package/lib/cjs/components/slider/Slider.styles.js +2 -9
- package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.js +6 -63
- package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.styles.js +2 -19
- package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
- package/lib/cjs/components/tag-input/TagInput.js +36 -91
- package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
- package/lib/cjs/components/tag-input/TagInput.styles.js +3 -31
- package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.js +8 -17
- package/lib/cjs/components/text-area/TextArea.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.styles.js +1 -15
- package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.js +3 -17
- package/lib/cjs/components/truncation/Truncation.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.styles.js +1 -19
- package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/cjs/index.js +6 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/file.js.map +1 -1
- package/lib/esm/components/accordion/Accordion.js +12 -105
- package/lib/esm/components/accordion/Accordion.js.map +1 -1
- package/lib/esm/components/accordion/Accordion.styles.js +3 -23
- package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +1 -3
- package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/esm/components/accordion/accordion-group/AccordionGroup.js +19 -33
- package/lib/esm/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
- package/lib/esm/components/accordion/accordion-head/AccordionHead.js +3 -6
- package/lib/esm/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js +0 -14
- package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/esm/components/amount-control/AmountControl.js +16 -30
- package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
- package/lib/esm/components/amount-control/AmountControl.styles.js +2 -18
- package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
- package/lib/esm/components/button/Button.js +1 -5
- package/lib/esm/components/button/Button.js.map +1 -1
- package/lib/esm/components/button/Button.styles.js +0 -17
- 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 +1 -5
- package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
- package/lib/esm/components/checkbox/Checkbox.styles.js +2 -29
- package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +2 -7
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +2 -8
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.js +5 -50
- package/lib/esm/components/combobox/ComboBox.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.styles.js +0 -11
- 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 +5 -99
- package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.styles.js +0 -38
- 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/file-input/FileInput.js +2 -4
- package/lib/esm/components/file-input/FileInput.js.map +1 -1
- package/lib/esm/components/file-list/file-item/FileItem.js +3 -24
- package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
- package/lib/esm/components/file-list/file-item/FileItem.styles.js +0 -18
- package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.js +4 -27
- package/lib/esm/components/file-select/FileSelect.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.styles.js +0 -10
- package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/esm/components/filter/Filter.js +16 -52
- package/lib/esm/components/filter/Filter.js.map +1 -1
- package/lib/esm/components/filter/Filter.styles.js +0 -9
- package/lib/esm/components/filter/Filter.styles.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FilterContent.js +5 -15
- 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 +5 -69
- package/lib/esm/components/filter-buttons/FilterButtons.js.map +1 -1
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +2 -40
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +0 -11
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
- package/lib/esm/components/grid-image/GridImage.js +2 -20
- package/lib/esm/components/grid-image/GridImage.js.map +1 -1
- package/lib/esm/components/grid-image/GridImage.styles.js +1 -10
- package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.js +4 -22
- package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.styles.js +0 -9
- package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/esm/components/highlight-slider/HighlightSlider.js +3 -10
- package/lib/esm/components/highlight-slider/HighlightSlider.js.map +1 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +3 -20
- 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 +1 -10
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
- package/lib/esm/components/icon/Icon.js +7 -26
- package/lib/esm/components/icon/Icon.js.map +1 -1
- package/lib/esm/components/icon/Icon.styles.js +0 -23
- package/lib/esm/components/icon/Icon.styles.js.map +1 -1
- package/lib/esm/components/input/Input.js +4 -24
- package/lib/esm/components/input/Input.js.map +1 -1
- package/lib/esm/components/input/Input.styles.js +3 -33
- package/lib/esm/components/input/Input.styles.js.map +1 -1
- package/lib/esm/components/list/List.js +37 -123
- package/lib/esm/components/list/List.js.map +1 -1
- package/lib/esm/components/list/List.utils.js +0 -111
- package/lib/esm/components/list/List.utils.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.js +4 -83
- package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.styles.js +0 -9
- 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 -41
- 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 +0 -4
- 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 +2 -33
- 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 +2 -33
- 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 -30
- package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
- package/lib/esm/components/mention-finder/MentionFinder.js +2 -30
- 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 +3 -36
- package/lib/esm/components/multi-action-button/MultiActionButton.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 +1 -7
- 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 +0 -12
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/esm/components/number-input/NumberInput.js +10 -13
- package/lib/esm/components/number-input/NumberInput.js.map +1 -1
- package/lib/esm/components/page-provider/PageProvider.js +2 -4
- package/lib/esm/components/page-provider/PageProvider.js.map +1 -1
- package/lib/esm/components/popup/Popup.js +1 -8
- package/lib/esm/components/popup/Popup.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.js +15 -29
- package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.styles.js +8 -19
- package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js +4 -7
- package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
- package/lib/esm/components/search-box/SearchBox.js +2 -5
- package/lib/esm/components/search-box/SearchBox.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.js +42 -41
- package/lib/esm/components/search-input/SearchInput.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.styles.js +1 -24
- package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/esm/components/select-button/SelectButton.js +2 -4
- package/lib/esm/components/select-button/SelectButton.js.map +1 -1
- package/lib/esm/components/setup-wizard/SetupWizard.js +4 -7
- package/lib/esm/components/setup-wizard/SetupWizard.js.map +1 -1
- package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +3 -5
- package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
- package/lib/esm/components/sharing-bar/SharingBar.js +6 -31
- package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/esm/components/sharing-bar/SharingBar.styles.js +3 -7
- package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
- package/lib/esm/components/sharing-button/SharingButton.js +2 -4
- package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +1 -3
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/esm/components/signature/Signature.js +3 -6
- package/lib/esm/components/signature/Signature.js.map +1 -1
- package/lib/esm/components/skeleton/base-skeleton/BaseSkeleton.styles.js +2 -0
- package/lib/esm/components/skeleton/base-skeleton/BaseSkeleton.styles.js.map +1 -1
- package/lib/esm/components/slider/Slider.js +7 -30
- package/lib/esm/components/slider/Slider.js.map +1 -1
- package/lib/esm/components/slider/Slider.styles.js +1 -8
- package/lib/esm/components/slider/Slider.styles.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.js +6 -62
- package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.styles.js +1 -18
- package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
- package/lib/esm/components/tag-input/TagInput.js +35 -85
- package/lib/esm/components/tag-input/TagInput.js.map +1 -1
- package/lib/esm/components/tag-input/TagInput.styles.js +1 -29
- package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.js +9 -18
- package/lib/esm/components/text-area/TextArea.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.styles.js +0 -14
- package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.js +4 -18
- package/lib/esm/components/truncation/Truncation.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.styles.js +0 -18
- package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/file.js.map +1 -1
- package/lib/types/components/accordion/Accordion.d.ts +0 -5
- package/lib/types/components/accordion/Accordion.styles.d.ts +4 -8
- package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +2 -2
- package/lib/types/components/accordion/accordion-group/AccordionGroup.d.ts +2 -7
- package/lib/types/components/accordion/accordion-head/AccordionHead.d.ts +0 -1
- package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +18 -18
- package/lib/types/components/amount-control/AmountControl.d.ts +0 -5
- package/lib/types/components/amount-control/AmountControl.styles.d.ts +4 -8
- package/lib/types/components/button/Button.styles.d.ts +6 -8
- package/lib/types/components/button/Button.types.d.ts +0 -8
- package/lib/types/components/checkbox/Checkbox.d.ts +0 -4
- package/lib/types/components/checkbox/Checkbox.styles.d.ts +1 -5
- package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +0 -5
- package/lib/types/components/combobox/ComboBox.styles.d.ts +2 -4
- package/lib/types/components/combobox/ComboBox.types.d.ts +0 -5
- package/lib/types/components/context-menu/ContextMenu.styles.d.ts +2 -4
- package/lib/types/components/context-menu/ContextMenu.types.d.ts +0 -6
- package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +2 -2
- 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 +0 -4
- package/lib/types/components/file-input/FileInput.styles.d.ts +2 -2
- package/lib/types/components/file-list/file-item/FileItem.styles.d.ts +0 -3
- package/lib/types/components/file-select/FileSelect.d.ts +0 -4
- package/lib/types/components/file-select/FileSelect.styles.d.ts +4 -6
- package/lib/types/components/filter/Filter.d.ts +0 -1
- package/lib/types/components/filter/Filter.styles.d.ts +4 -6
- package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +0 -4
- package/lib/types/components/filter-buttons/FilterButtons.d.ts +0 -4
- package/lib/types/components/filter-buttons/filter-button/FilterButton.d.ts +0 -5
- package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +8 -12
- package/lib/types/components/grid-image/GridImage.d.ts +0 -4
- package/lib/types/components/grid-image/GridImage.styles.d.ts +2 -4
- package/lib/types/components/grouped-image/GroupedImage.d.ts +0 -4
- package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +6 -8
- package/lib/types/components/highlight-slider/HighlightSlider.d.ts +0 -4
- package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.d.ts +0 -3
- package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +5 -9
- package/lib/types/components/icon/Icon.d.ts +0 -4
- package/lib/types/components/icon/Icon.styles.d.ts +0 -1
- package/lib/types/components/input/Input.d.ts +0 -4
- package/lib/types/components/input/Input.styles.d.ts +9 -17
- package/lib/types/components/list/List.d.ts +0 -11
- package/lib/types/components/list/List.utils.d.ts +1 -16
- 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.d.ts +0 -1
- package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +194 -195
- package/lib/types/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.d.ts +0 -1
- package/lib/types/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.d.ts +0 -1
- package/lib/types/components/list/list-item/list-item-head/list-item-title/ListItemTitle.d.ts +0 -1
- 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 +0 -7
- package/lib/types/components/multi-action-button/action-button/ActionButton.d.ts +1 -4
- package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +2 -4
- package/lib/types/components/number-input/NumberInput.d.ts +0 -4
- 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 +0 -4
- package/lib/types/components/radio-button/RadioButton.styles.d.ts +9 -15
- package/lib/types/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +0 -5
- package/lib/types/components/search-box/SearchBox.d.ts +0 -4
- package/lib/types/components/search-box/SearchBox.styles.d.ts +2 -2
- package/lib/types/components/search-input/SearchInput.d.ts +0 -4
- package/lib/types/components/search-input/SearchInput.styles.d.ts +9 -17
- package/lib/types/components/select-button/SelectButton.d.ts +0 -4
- package/lib/types/components/setup-wizard/SetupWizard.d.ts +0 -5
- package/lib/types/components/sharing-bar/SharingBar.d.ts +0 -4
- package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
- package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +2 -10
- package/lib/types/components/signature/Signature.d.ts +0 -4
- package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +4 -4
- package/lib/types/components/slider/Slider.d.ts +0 -8
- package/lib/types/components/slider/Slider.styles.d.ts +14 -18
- package/lib/types/components/slider-button/SliderButton.d.ts +28 -1
- package/lib/types/components/slider-button/SliderButton.styles.d.ts +4 -6
- package/lib/types/components/tag-input/TagInput.d.ts +0 -4
- package/lib/types/components/tag-input/TagInput.styles.d.ts +2 -12
- package/lib/types/components/text-area/TextArea.d.ts +0 -4
- package/lib/types/components/text-area/TextArea.styles.d.ts +0 -1
- package/lib/types/components/truncation/Truncation.d.ts +0 -4
- package/lib/types/components/truncation/Truncation.styles.d.ts +2 -7
- package/lib/types/index.d.ts +1 -1
- package/lib/types/utils/file.d.ts +1 -1
- package/package.json +3 -3
- package/lib/cjs/components/list/list-item/useListItemFocus.js +0 -47
- package/lib/cjs/components/list/list-item/useListItemFocus.js.map +0 -1
- package/lib/cjs/components/slider-button/SliderButton.types.js +0 -6
- package/lib/cjs/components/slider-button/SliderButton.types.js.map +0 -1
- package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js +0 -66
- package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js.map +0 -1
- package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js +0 -47
- package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js.map +0 -1
- package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +0 -68
- package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +0 -1
- package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +0 -30
- package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +0 -1
- package/lib/esm/components/list/list-item/useListItemFocus.js +0 -40
- package/lib/esm/components/list/list-item/useListItemFocus.js.map +0 -1
- package/lib/esm/components/slider-button/SliderButton.types.js +0 -2
- package/lib/esm/components/slider-button/SliderButton.types.js.map +0 -1
- package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js +0 -56
- package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js.map +0 -1
- package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js +0 -38
- package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js.map +0 -1
- package/lib/esm/hooks/useKeyboardFocusHighlighting.js +0 -61
- package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +0 -1
- package/lib/esm/utils/keyboardFocusHighlighting.styles.js +0 -25
- package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +0 -1
- package/lib/types/components/list/list-item/useListItemFocus.d.ts +0 -13
- package/lib/types/components/slider-button/SliderButton.types.d.ts +0 -32
- package/lib/types/components/slider-button/useSliderButtonPopupKeyboard.d.ts +0 -17
- package/lib/types/components/slider-button/useSliderButtonThumbKeyboard.d.ts +0 -13
- package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +0 -5
- package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +0 -9
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useElementSize, useMeasuredClone } from '../../hooks/element';
|
|
4
|
-
import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
|
|
5
4
|
import { useIsTouch } from '../../utils/environment';
|
|
6
5
|
import ContextMenu from '../context-menu/ContextMenu';
|
|
7
6
|
import ActionButton from './action-button/ActionButton';
|
|
@@ -65,13 +64,11 @@ const MultiActionButton = ({
|
|
|
65
64
|
secondaryContextMenu,
|
|
66
65
|
shouldAutoCollapse = false,
|
|
67
66
|
shouldUseFullWidth,
|
|
68
|
-
shouldEnableKeyboardHighlighting,
|
|
69
67
|
width
|
|
70
68
|
}) => {
|
|
71
69
|
const [isExtendedByClick, setIsExtendedByClick] = useState(false);
|
|
72
70
|
const [isSecondaryExpanded, setIsSecondaryExpanded] = useState(false);
|
|
73
71
|
const [isSecondaryHovered, setIsSecondaryHovered] = useState(false);
|
|
74
|
-
const [isSecondaryFocused, setIsSecondaryFocused] = useState(false);
|
|
75
72
|
const autoCollapseTimeoutRef = useRef(null);
|
|
76
73
|
const multiActionButtonRef = useRef(null);
|
|
77
74
|
const secondaryContextMenuRef = useRef(null);
|
|
@@ -85,7 +82,6 @@ const MultiActionButton = ({
|
|
|
85
82
|
const hasExpandableSecondaryAction = Boolean(secondaryAction) && !hasSecondaryContextMenu;
|
|
86
83
|
const hasSecondaryAction = Boolean(secondaryTriggerAction);
|
|
87
84
|
const shouldUseContentWidth = !width && !shouldUseFullWidth;
|
|
88
|
-
const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
|
|
89
85
|
const expandedMeasuredContent = useMemo(() => createMeasuredMultiActionButtonContent({
|
|
90
86
|
backgroundColor,
|
|
91
87
|
gapColor,
|
|
@@ -136,15 +132,7 @@ const MultiActionButton = ({
|
|
|
136
132
|
height
|
|
137
133
|
});
|
|
138
134
|
const shouldHidePrimaryLabelForMinimumWidth = shouldKeepPrimaryLabelVisible && typeof availableWidth === 'number' && availableWidth <= minimumPrimaryLabelVisibleWidth;
|
|
139
|
-
const resolvedWidth =
|
|
140
|
-
if (shouldKeepFullWidth) {
|
|
141
|
-
return '100%';
|
|
142
|
-
}
|
|
143
|
-
if (effectiveIsCollapsed) {
|
|
144
|
-
return height;
|
|
145
|
-
}
|
|
146
|
-
return width ?? 'fit-content';
|
|
147
|
-
}, [effectiveIsCollapsed, height, shouldKeepFullWidth, width]);
|
|
135
|
+
const resolvedWidth = shouldKeepFullWidth ? '100%' : effectiveIsCollapsed ? height : width ?? 'fit-content';
|
|
148
136
|
const secondaryContextMenuTriggerStyle = getSecondaryContextMenuTriggerStyle({
|
|
149
137
|
height,
|
|
150
138
|
isCollapsed: isSecondaryHidden,
|
|
@@ -201,7 +189,6 @@ const MultiActionButton = ({
|
|
|
201
189
|
setIsSecondaryExpanded(false);
|
|
202
190
|
setIsExtendedByClick(false);
|
|
203
191
|
setIsSecondaryHovered(false);
|
|
204
|
-
setIsSecondaryFocused(false);
|
|
205
192
|
}
|
|
206
193
|
}, [clearAutoCollapseTimeout, effectiveIsCollapsed, shouldPreventSecondaryExpansion]);
|
|
207
194
|
|
|
@@ -265,26 +252,11 @@ const MultiActionButton = ({
|
|
|
265
252
|
setIsSecondaryExpanded(false);
|
|
266
253
|
}
|
|
267
254
|
}, [effectiveIsCollapsed, isExtendedByClick, isTouch]);
|
|
268
|
-
const handleSecondaryFocus = useCallback(() => {
|
|
269
|
-
if (!secondaryAction || isSecondaryHidden || isDisabled || shouldPreventSecondaryExpansion || secondaryAction.isDisabled) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
setIsSecondaryFocused(true);
|
|
273
|
-
if (!isExtendedByClick) {
|
|
274
|
-
setIsSecondaryExpanded(true);
|
|
275
|
-
}
|
|
276
|
-
}, [isDisabled, isExtendedByClick, isSecondaryHidden, secondaryAction, shouldPreventSecondaryExpansion]);
|
|
277
|
-
const handleSecondaryBlur = useCallback(() => {
|
|
278
|
-
setIsSecondaryFocused(false);
|
|
279
|
-
if (!isExtendedByClick && !effectiveIsCollapsed) {
|
|
280
|
-
setIsSecondaryExpanded(false);
|
|
281
|
-
}
|
|
282
|
-
}, [effectiveIsCollapsed, isExtendedByClick]);
|
|
283
255
|
|
|
284
256
|
/**
|
|
285
|
-
* Secondary label is visible when expanded or when hovered
|
|
257
|
+
* Secondary label is visible when expanded or when hovered (desktop only).
|
|
286
258
|
*/
|
|
287
|
-
const isSecondaryLabelVisible = isSecondaryExpanded || !isTouch && isSecondaryHovered
|
|
259
|
+
const isSecondaryLabelVisible = isSecondaryExpanded || !isTouch && isSecondaryHovered;
|
|
288
260
|
return /*#__PURE__*/React.createElement(React.Fragment, null, measuredElement, /*#__PURE__*/React.createElement(StyledMultiActionButton, {
|
|
289
261
|
className: clsx('beta-chayns-multi-action', className),
|
|
290
262
|
ref: multiActionButtonRef,
|
|
@@ -302,7 +274,6 @@ const MultiActionButton = ({
|
|
|
302
274
|
isSolo: !hasSecondaryAction || isSecondaryHidden || effectiveIsCollapsed,
|
|
303
275
|
onClick: handlePrimaryClick,
|
|
304
276
|
showLabel: !effectiveIsCollapsed && !shouldHidePrimaryLabelForMinimumWidth && (shouldKeepPrimaryLabelVisible || !isAutoIconsOnly) && (shouldKeepPrimaryLabelVisible || !shouldHideSecondaryForAutoCollapse) && (!hasExpandableSecondaryAction || !isSecondaryExpanded),
|
|
305
|
-
shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
|
|
306
277
|
shouldUseContentWidth: shouldUseContentWidth,
|
|
307
278
|
height: height
|
|
308
279
|
}), hasSecondaryAction && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledSeparator, {
|
|
@@ -327,7 +298,6 @@ const MultiActionButton = ({
|
|
|
327
298
|
key: "multi-action-secondary-context-menu",
|
|
328
299
|
onClick: handleSecondaryClick,
|
|
329
300
|
showLabel: false,
|
|
330
|
-
shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
|
|
331
301
|
shouldUseContentWidth: shouldUseContentWidth,
|
|
332
302
|
height: height
|
|
333
303
|
})) : /*#__PURE__*/React.createElement(ActionButton, {
|
|
@@ -342,10 +312,7 @@ const MultiActionButton = ({
|
|
|
342
312
|
onClick: handleSecondaryClick,
|
|
343
313
|
onMouseEnter: handleSecondaryMouseEnter,
|
|
344
314
|
onMouseLeave: handleSecondaryMouseLeave,
|
|
345
|
-
onFocus: handleSecondaryFocus,
|
|
346
|
-
onBlur: handleSecondaryBlur,
|
|
347
315
|
showLabel: !isSecondaryHidden && !isAutoIconsOnly && isSecondaryLabelVisible,
|
|
348
|
-
shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
|
|
349
316
|
shouldUseContentWidth: shouldUseContentWidth,
|
|
350
317
|
height: height
|
|
351
318
|
}))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiActionButton.js","names":["clsx","React","useCallback","useEffect","useMemo","useRef","useState","useElementSize","useMeasuredClone","useKeyboardFocusHighlighting","useIsTouch","ContextMenu","ActionButton","StyledMultiActionButton","StyledSeparator","getMinimumPrimaryLabelVisibleWidth","getMultiActionButtonAutoCollapseMode","getSecondaryContextMenuTriggerStyle","MultiActionButtonAutoCollapseMode","MultiActionButtonHeight","SECONDARY_CONTEXT_MENU_ACTION","icon","label","undefined","createMeasuredMultiActionButtonContent","backgroundColor","gapColor","height","primaryAction","secondaryAction","createElement","style","width","action","actionType","isCollapsed","isDisabled","isShrunk","isSolo","showLabel","shouldUseContentWidth","Fragment","$gapColor","$isHidden","isExpanded","isHidden","MultiActionButton","className","extendedTimeoutMs","Medium","secondaryContextMenu","shouldAutoCollapse","shouldUseFullWidth","shouldEnableKeyboardHighlighting","isExtendedByClick","setIsExtendedByClick","isSecondaryExpanded","setIsSecondaryExpanded","isSecondaryHovered","setIsSecondaryHovered","isSecondaryFocused","setIsSecondaryFocused","autoCollapseTimeoutRef","multiActionButtonRef","secondaryContextMenuRef","autoCollapseMode","setAutoCollapseMode","Expanded","isTouch","parentSize","shouldUseParentElement","hasSecondaryContextMenu","Boolean","length","secondaryTriggerAction","hasExpandableSecondaryAction","hasSecondaryAction","shouldShowKeyboardHighlighting","expandedMeasuredContent","measuredElement","expandedMeasuredWidth","content","availableWidth","parentWidth","Math","min","previousMode","expandedWidth","isAutoIconsOnly","IconsOnly","isAutoPrimaryOnly","PrimaryOnly","shouldKeepFullWidth","shouldHideSecondaryForAutoCollapse","effectiveIsCollapsed","resolvedSecondaryAction","isSecondaryHidden","shouldPreventSecondaryExpansion","shouldKeepPrimaryLabelVisible","minimumPrimaryLabelVisibleWidth","hasVisibleSecondaryAction","shouldHidePrimaryLabelForMinimumWidth","resolvedWidth","secondaryContextMenuTriggerStyle","clearAutoCollapseTimeout","current","window","clearTimeout","resetAutoCollapseTimeout","setTimeout","expandSecondaryByClick","handlePrimaryClick","event","payload","isExtended","onClick","handleSecondaryClick","show","handleSecondaryMouseEnter","handleSecondaryMouseLeave","handleSecondaryFocus","handleSecondaryBlur","isSecondaryLabelVisible","ref","maxWidth","items","shouldDisableClick","shouldUseDefaultTriggerStyles","shouldHidePopupArrow","yOffset","key","onMouseEnter","onMouseLeave","onFocus","onBlur","displayName"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React, {\n FC,\n MouseEvent,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useElementSize, useMeasuredClone } from '../../hooks/element';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport { useIsTouch } from '../../utils/environment';\nimport ContextMenu from '../context-menu/ContextMenu';\nimport type { ContextMenuRef } from '../context-menu/ContextMenu.types';\nimport ActionButton from './action-button/ActionButton';\nimport { StyledMultiActionButton, StyledSeparator } from './MultiActionButton.styles';\nimport {\n getMinimumPrimaryLabelVisibleWidth,\n getMultiActionButtonAutoCollapseMode,\n getSecondaryContextMenuTriggerStyle,\n MultiActionButtonAutoCollapseMode,\n} from './MultiActionButton.utils';\nimport { MultiActionButtonHeight } from './MultiActionButton.types';\nimport type {\n MultiActionButtonAction,\n MultiActionButtonActionEvent,\n MultiActionButtonProps,\n} from './MultiActionButton.types';\n\nconst SECONDARY_CONTEXT_MENU_ACTION: MultiActionButtonAction = {\n icon: 'fa fa-chevron-down',\n label: undefined,\n};\n\ninterface CreateMeasuredMultiActionButtonContentOptions {\n backgroundColor?: string;\n gapColor?: string;\n height: number;\n primaryAction: MultiActionButtonAction;\n secondaryAction?: MultiActionButtonAction;\n}\n\nconst createMeasuredMultiActionButtonContent = ({\n backgroundColor,\n gapColor,\n height,\n primaryAction,\n secondaryAction,\n}: CreateMeasuredMultiActionButtonContentOptions): ReactNode => (\n <StyledMultiActionButton style={{ width: 'fit-content' }}>\n <ActionButton\n action={primaryAction}\n actionType=\"primary\"\n backgroundColor={primaryAction.backgroundColor ?? backgroundColor}\n isCollapsed={false}\n isDisabled={false}\n isShrunk={false}\n isSolo={!secondaryAction}\n showLabel\n shouldUseContentWidth\n height={height}\n />\n {secondaryAction && (\n <>\n <StyledSeparator $gapColor={gapColor} $isHidden={false} />\n <ActionButton\n action={secondaryAction}\n actionType=\"secondary\"\n backgroundColor={secondaryAction.backgroundColor ?? backgroundColor}\n isCollapsed={false}\n isDisabled={false}\n isExpanded={false}\n isHidden={false}\n showLabel={false}\n shouldUseContentWidth\n height={height}\n />\n </>\n )}\n </StyledMultiActionButton>\n);\n\n/**\n * Multi-action button with optional secondary action that can expand on hover/click.\n */\nconst MultiActionButton: FC<MultiActionButtonProps> = ({\n backgroundColor,\n className,\n extendedTimeoutMs = 3000,\n gapColor,\n height = MultiActionButtonHeight.Medium,\n isCollapsed = false,\n isDisabled = false,\n primaryAction,\n secondaryAction,\n secondaryContextMenu,\n shouldAutoCollapse = false,\n shouldUseFullWidth,\n shouldEnableKeyboardHighlighting,\n width,\n}) => {\n const [isExtendedByClick, setIsExtendedByClick] = useState(false);\n const [isSecondaryExpanded, setIsSecondaryExpanded] = useState(false);\n const [isSecondaryHovered, setIsSecondaryHovered] = useState(false);\n const [isSecondaryFocused, setIsSecondaryFocused] = useState(false);\n\n const autoCollapseTimeoutRef = useRef<number | null>(null);\n const multiActionButtonRef = useRef<HTMLDivElement | null>(null);\n const secondaryContextMenuRef = useRef<ContextMenuRef>(null);\n const [autoCollapseMode, setAutoCollapseMode] = useState<MultiActionButtonAutoCollapseMode>(\n MultiActionButtonAutoCollapseMode.Expanded,\n );\n\n const isTouch = useIsTouch();\n const parentSize = useElementSize(multiActionButtonRef, { shouldUseParentElement: true });\n\n const hasSecondaryContextMenu = Boolean(secondaryContextMenu?.length);\n const secondaryTriggerAction = hasSecondaryContextMenu\n ? SECONDARY_CONTEXT_MENU_ACTION\n : secondaryAction;\n const hasExpandableSecondaryAction = Boolean(secondaryAction) && !hasSecondaryContextMenu;\n const hasSecondaryAction = Boolean(secondaryTriggerAction);\n const shouldUseContentWidth = !width && !shouldUseFullWidth;\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n const expandedMeasuredContent = useMemo(\n () =>\n createMeasuredMultiActionButtonContent({\n backgroundColor,\n gapColor,\n height,\n primaryAction,\n secondaryAction: secondaryTriggerAction,\n }),\n [backgroundColor, gapColor, height, primaryAction, secondaryTriggerAction],\n );\n\n const { measuredElement, width: expandedMeasuredWidth } = useMeasuredClone({\n content: expandedMeasuredContent,\n });\n\n const availableWidth = useMemo(() => {\n const parentWidth = parentSize?.width;\n\n if (typeof width === 'number') {\n return typeof parentWidth === 'number' ? Math.min(parentWidth, width) : width;\n }\n\n return parentWidth;\n }, [parentSize?.width, width]);\n\n useEffect(() => {\n if (!shouldAutoCollapse || isCollapsed) {\n setAutoCollapseMode(MultiActionButtonAutoCollapseMode.Expanded);\n return;\n }\n\n if (expandedMeasuredWidth <= 0) {\n return;\n }\n\n setAutoCollapseMode((previousMode) =>\n getMultiActionButtonAutoCollapseMode({\n availableWidth,\n expandedWidth: expandedMeasuredWidth,\n hasSecondaryAction,\n height,\n previousMode,\n }),\n );\n }, [\n availableWidth,\n expandedMeasuredWidth,\n hasSecondaryAction,\n height,\n isCollapsed,\n shouldAutoCollapse,\n ]);\n\n const isAutoIconsOnly =\n shouldAutoCollapse && autoCollapseMode === MultiActionButtonAutoCollapseMode.IconsOnly;\n const isAutoPrimaryOnly =\n shouldAutoCollapse && autoCollapseMode === MultiActionButtonAutoCollapseMode.PrimaryOnly;\n const shouldKeepFullWidth = Boolean(shouldUseFullWidth);\n const shouldHideSecondaryForAutoCollapse = hasSecondaryAction && isAutoPrimaryOnly;\n const effectiveIsCollapsed = isCollapsed || (!shouldKeepFullWidth && isAutoPrimaryOnly);\n const resolvedSecondaryAction = hasSecondaryAction ? secondaryTriggerAction : undefined;\n const isSecondaryHidden = effectiveIsCollapsed || shouldHideSecondaryForAutoCollapse;\n const shouldPreventSecondaryExpansion = isAutoIconsOnly || isSecondaryHidden;\n const shouldKeepPrimaryLabelVisible = shouldKeepFullWidth && shouldAutoCollapse;\n const minimumPrimaryLabelVisibleWidth = getMinimumPrimaryLabelVisibleWidth({\n hasVisibleSecondaryAction: hasSecondaryAction,\n height,\n });\n const shouldHidePrimaryLabelForMinimumWidth =\n shouldKeepPrimaryLabelVisible &&\n typeof availableWidth === 'number' &&\n availableWidth <= minimumPrimaryLabelVisibleWidth;\n\n const resolvedWidth = useMemo(() => {\n if (shouldKeepFullWidth) {\n return '100%';\n }\n\n if (effectiveIsCollapsed) {\n return height;\n }\n\n return width ?? 'fit-content';\n }, [effectiveIsCollapsed, height, shouldKeepFullWidth, width]);\n\n const secondaryContextMenuTriggerStyle = getSecondaryContextMenuTriggerStyle({\n height,\n isCollapsed: isSecondaryHidden,\n isExpanded: false,\n shouldUseContentWidth,\n });\n\n /**\n * Clears the current auto-collapse timer without changing visual state.\n */\n const clearAutoCollapseTimeout = useCallback(() => {\n if (autoCollapseTimeoutRef.current) {\n window.clearTimeout(autoCollapseTimeoutRef.current);\n autoCollapseTimeoutRef.current = null;\n }\n }, []);\n\n /**\n * Clears and restarts the auto-collapse timer used after click-triggered expansion.\n */\n const resetAutoCollapseTimeout = useCallback(() => {\n clearAutoCollapseTimeout();\n\n if (extendedTimeoutMs <= 0) {\n return;\n }\n\n autoCollapseTimeoutRef.current = window.setTimeout(() => {\n setIsSecondaryExpanded(false);\n setIsExtendedByClick(false);\n }, extendedTimeoutMs);\n }, [clearAutoCollapseTimeout, extendedTimeoutMs]);\n\n /**\n * Expands the secondary action and remembers that it originated from a click.\n */\n const expandSecondaryByClick = useCallback(() => {\n setIsSecondaryExpanded(true);\n setIsExtendedByClick(true);\n resetAutoCollapseTimeout();\n }, [resetAutoCollapseTimeout]);\n\n /**\n * Cleanup timers on unmount.\n */\n useEffect(\n () => () => {\n clearAutoCollapseTimeout();\n },\n [clearAutoCollapseTimeout],\n );\n\n /**\n * Collapsing the control should also reset any temporary expansion state.\n */\n useEffect(() => {\n if (effectiveIsCollapsed || shouldPreventSecondaryExpansion) {\n clearAutoCollapseTimeout();\n setIsSecondaryExpanded(false);\n setIsExtendedByClick(false);\n setIsSecondaryHovered(false);\n setIsSecondaryFocused(false);\n }\n }, [clearAutoCollapseTimeout, effectiveIsCollapsed, shouldPreventSecondaryExpansion]);\n\n /**\n * Handler for the primary action button.\n */\n const handlePrimaryClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (isDisabled || primaryAction.isDisabled) {\n return;\n }\n\n const payload: MultiActionButtonActionEvent = {\n action: 'primary',\n event,\n isExtended: isSecondaryExpanded,\n isTouch,\n };\n\n primaryAction.onClick?.(payload);\n },\n [isDisabled, isSecondaryExpanded, isTouch, primaryAction],\n );\n\n /**\n * Handler for the secondary action button.\n */\n const handleSecondaryClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (\n !resolvedSecondaryAction ||\n isSecondaryHidden ||\n isDisabled ||\n resolvedSecondaryAction.isDisabled\n ) {\n return;\n }\n\n if (hasSecondaryContextMenu) {\n secondaryContextMenuRef.current?.show();\n return;\n }\n\n const payload: MultiActionButtonActionEvent = {\n action: 'secondary',\n event,\n isExtended: isSecondaryExpanded,\n isTouch,\n };\n\n resolvedSecondaryAction.onClick?.(payload);\n if (!shouldPreventSecondaryExpansion) {\n expandSecondaryByClick();\n }\n },\n [\n expandSecondaryByClick,\n hasSecondaryContextMenu,\n isSecondaryHidden,\n isDisabled,\n isSecondaryExpanded,\n isTouch,\n resolvedSecondaryAction,\n shouldPreventSecondaryExpansion,\n ],\n );\n\n /**\n * Desktop hover behavior keeps the secondary action expanded while hovered.\n */\n const handleSecondaryMouseEnter = useCallback(() => {\n if (\n !secondaryAction ||\n isSecondaryHidden ||\n isTouch ||\n isDisabled ||\n shouldPreventSecondaryExpansion ||\n secondaryAction.isDisabled\n ) {\n return;\n }\n\n setIsSecondaryHovered(true);\n if (!isExtendedByClick) {\n setIsSecondaryExpanded(true);\n }\n }, [\n isSecondaryHidden,\n isDisabled,\n isExtendedByClick,\n isTouch,\n secondaryAction,\n shouldPreventSecondaryExpansion,\n ]);\n\n const handleSecondaryMouseLeave = useCallback(() => {\n if (isTouch) {\n return;\n }\n\n setIsSecondaryHovered(false);\n if (!isExtendedByClick && !effectiveIsCollapsed) {\n setIsSecondaryExpanded(false);\n }\n }, [effectiveIsCollapsed, isExtendedByClick, isTouch]);\n\n const handleSecondaryFocus = useCallback(() => {\n if (\n !secondaryAction ||\n isSecondaryHidden ||\n isDisabled ||\n shouldPreventSecondaryExpansion ||\n secondaryAction.isDisabled\n ) {\n return;\n }\n\n setIsSecondaryFocused(true);\n if (!isExtendedByClick) {\n setIsSecondaryExpanded(true);\n }\n }, [\n isDisabled,\n isExtendedByClick,\n isSecondaryHidden,\n secondaryAction,\n shouldPreventSecondaryExpansion,\n ]);\n\n const handleSecondaryBlur = useCallback(() => {\n setIsSecondaryFocused(false);\n if (!isExtendedByClick && !effectiveIsCollapsed) {\n setIsSecondaryExpanded(false);\n }\n }, [effectiveIsCollapsed, isExtendedByClick]);\n\n /**\n * Secondary label is visible when expanded or when hovered/focused.\n */\n const isSecondaryLabelVisible =\n isSecondaryExpanded || (!isTouch && isSecondaryHovered) || isSecondaryFocused;\n\n return (\n <>\n {measuredElement}\n <StyledMultiActionButton\n className={clsx('beta-chayns-multi-action', className)}\n ref={multiActionButtonRef}\n style={{ maxWidth: '100%', width: resolvedWidth }}\n >\n <ActionButton\n action={primaryAction}\n actionType=\"primary\"\n backgroundColor={primaryAction.backgroundColor ?? backgroundColor}\n isCollapsed={effectiveIsCollapsed}\n isDisabled={isDisabled}\n isShrunk={\n hasSecondaryAction &&\n ((!shouldKeepFullWidth && isAutoIconsOnly) || isSecondaryExpanded)\n }\n isSolo={!hasSecondaryAction || isSecondaryHidden || effectiveIsCollapsed}\n onClick={handlePrimaryClick}\n showLabel={\n !effectiveIsCollapsed &&\n !shouldHidePrimaryLabelForMinimumWidth &&\n (shouldKeepPrimaryLabelVisible || !isAutoIconsOnly) &&\n (shouldKeepPrimaryLabelVisible || !shouldHideSecondaryForAutoCollapse) &&\n (!hasExpandableSecondaryAction || !isSecondaryExpanded)\n }\n shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n shouldUseContentWidth={shouldUseContentWidth}\n height={height}\n />\n {hasSecondaryAction && (\n <>\n <StyledSeparator $gapColor={gapColor} $isHidden={isSecondaryHidden} />\n {hasSecondaryContextMenu ? (\n <ContextMenu\n items={secondaryContextMenu ?? []}\n ref={secondaryContextMenuRef}\n shouldDisableClick\n shouldUseDefaultTriggerStyles={false}\n shouldHidePopupArrow\n yOffset={-6}\n style={secondaryContextMenuTriggerStyle}\n >\n <ActionButton\n action={\n resolvedSecondaryAction ?? SECONDARY_CONTEXT_MENU_ACTION\n }\n actionType=\"secondary\"\n backgroundColor={\n resolvedSecondaryAction?.backgroundColor ?? backgroundColor\n }\n isCollapsed={false}\n isDisabled={isDisabled}\n isExpanded={false}\n isHidden={isSecondaryHidden}\n key=\"multi-action-secondary-context-menu\"\n onClick={handleSecondaryClick}\n showLabel={false}\n shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n shouldUseContentWidth={shouldUseContentWidth}\n height={height}\n />\n </ContextMenu>\n ) : (\n <ActionButton\n action={\n resolvedSecondaryAction ??\n secondaryAction ??\n SECONDARY_CONTEXT_MENU_ACTION\n }\n actionType=\"secondary\"\n backgroundColor={\n resolvedSecondaryAction?.backgroundColor ?? backgroundColor\n }\n isCollapsed={false}\n isDisabled={isDisabled}\n isExpanded={!isAutoIconsOnly && isSecondaryExpanded}\n isHidden={isSecondaryHidden}\n key=\"multi-action-secondary-button\"\n onClick={handleSecondaryClick}\n onMouseEnter={handleSecondaryMouseEnter}\n onMouseLeave={handleSecondaryMouseLeave}\n onFocus={handleSecondaryFocus}\n onBlur={handleSecondaryBlur}\n showLabel={\n !isSecondaryHidden &&\n !isAutoIconsOnly &&\n isSecondaryLabelVisible\n }\n shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n shouldUseContentWidth={shouldUseContentWidth}\n height={height}\n />\n )}\n </>\n )}\n </StyledMultiActionButton>\n </>\n );\n};\n\nMultiActionButton.displayName = 'MultiActionButton';\n\nexport default MultiActionButton;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,KAAK,IAIRC,WAAW,EACXC,SAAS,EACTC,OAAO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,qBAAqB,EAAEA,qBAAsB;IAC7Cb,MAAM,EAAEA;EAAO,CAClB,CACQ,CAAC,gBAEd1B,KAAA,CAAA6B,aAAA,CAAClB,YAAY;IACTqB,MAAM,EACF8D,uBAAuB,IACvBlE,eAAe,IACfT,6BACH;IACDc,UAAU,EAAC,WAAW;IACtBT,eAAe,EACXsE,uBAAuB,EAAEtE,eAAe,IAAIA,eAC/C;IACDU,WAAW,EAAE,KAAM;IACnBC,UAAU,EAAEA,UAAW;IACvBQ,UAAU,EAAE,CAAC4C,eAAe,IAAIhC,mBAAoB;IACpDX,QAAQ,EAAEmD,iBAAkB;IAC5BkC,GAAG,EAAC,+BAA+B;IACnCf,OAAO,EAAEC,oBAAqB;IAC9Be,YAAY,EAAEb,yBAA0B;IACxCc,YAAY,EAAEb,yBAA0B;IACxCc,OAAO,EAAEb,oBAAqB;IAC9Bc,MAAM,EAAEb,mBAAoB;IAC5BlF,SAAS,EACL,CAACyD,iBAAiB,IAClB,CAACR,eAAe,IAChBkC,uBACH;IACD7C,8BAA8B,EAAEA,8BAA+B;IAC/DrC,qBAAqB,EAAEA,qBAAsB;IAC7Cb,MAAM,EAAEA;EAAO,CAClB,CAEP,CAEe,CAC3B,CAAC;AAEX,CAAC;AAEDmB,iBAAiB,CAACyF,WAAW,GAAG,mBAAmB;AAEnD,eAAezF,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MultiActionButton.js","names":["clsx","React","useCallback","useEffect","useMemo","useRef","useState","useElementSize","useMeasuredClone","useIsTouch","ContextMenu","ActionButton","StyledMultiActionButton","StyledSeparator","getMinimumPrimaryLabelVisibleWidth","getMultiActionButtonAutoCollapseMode","getSecondaryContextMenuTriggerStyle","MultiActionButtonAutoCollapseMode","MultiActionButtonHeight","SECONDARY_CONTEXT_MENU_ACTION","icon","label","undefined","createMeasuredMultiActionButtonContent","backgroundColor","gapColor","height","primaryAction","secondaryAction","createElement","style","width","action","actionType","isCollapsed","isDisabled","isShrunk","isSolo","showLabel","shouldUseContentWidth","Fragment","$gapColor","$isHidden","isExpanded","isHidden","MultiActionButton","className","extendedTimeoutMs","Medium","secondaryContextMenu","shouldAutoCollapse","shouldUseFullWidth","isExtendedByClick","setIsExtendedByClick","isSecondaryExpanded","setIsSecondaryExpanded","isSecondaryHovered","setIsSecondaryHovered","autoCollapseTimeoutRef","multiActionButtonRef","secondaryContextMenuRef","autoCollapseMode","setAutoCollapseMode","Expanded","isTouch","parentSize","shouldUseParentElement","hasSecondaryContextMenu","Boolean","length","secondaryTriggerAction","hasExpandableSecondaryAction","hasSecondaryAction","expandedMeasuredContent","measuredElement","expandedMeasuredWidth","content","availableWidth","parentWidth","Math","min","previousMode","expandedWidth","isAutoIconsOnly","IconsOnly","isAutoPrimaryOnly","PrimaryOnly","shouldKeepFullWidth","shouldHideSecondaryForAutoCollapse","effectiveIsCollapsed","resolvedSecondaryAction","isSecondaryHidden","shouldPreventSecondaryExpansion","shouldKeepPrimaryLabelVisible","minimumPrimaryLabelVisibleWidth","hasVisibleSecondaryAction","shouldHidePrimaryLabelForMinimumWidth","resolvedWidth","secondaryContextMenuTriggerStyle","clearAutoCollapseTimeout","current","window","clearTimeout","resetAutoCollapseTimeout","setTimeout","expandSecondaryByClick","handlePrimaryClick","event","payload","isExtended","onClick","handleSecondaryClick","show","handleSecondaryMouseEnter","handleSecondaryMouseLeave","isSecondaryLabelVisible","ref","maxWidth","items","shouldDisableClick","shouldUseDefaultTriggerStyles","shouldHidePopupArrow","yOffset","key","onMouseEnter","onMouseLeave","displayName"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React, {\n FC,\n MouseEvent,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useElementSize, useMeasuredClone } from '../../hooks/element';\nimport { useIsTouch } from '../../utils/environment';\nimport ContextMenu from '../context-menu/ContextMenu';\nimport type { ContextMenuRef } from '../context-menu/ContextMenu.types';\nimport ActionButton from './action-button/ActionButton';\nimport { StyledMultiActionButton, StyledSeparator } from './MultiActionButton.styles';\nimport {\n getMinimumPrimaryLabelVisibleWidth,\n getMultiActionButtonAutoCollapseMode,\n getSecondaryContextMenuTriggerStyle,\n MultiActionButtonAutoCollapseMode,\n} from './MultiActionButton.utils';\nimport { MultiActionButtonHeight } from './MultiActionButton.types';\nimport type {\n MultiActionButtonAction,\n MultiActionButtonActionEvent,\n MultiActionButtonProps,\n} from './MultiActionButton.types';\n\nconst SECONDARY_CONTEXT_MENU_ACTION: MultiActionButtonAction = {\n icon: 'fa fa-chevron-down',\n label: undefined,\n};\n\ninterface CreateMeasuredMultiActionButtonContentOptions {\n backgroundColor?: string;\n gapColor?: string;\n height: number;\n primaryAction: MultiActionButtonAction;\n secondaryAction?: MultiActionButtonAction;\n}\n\nconst createMeasuredMultiActionButtonContent = ({\n backgroundColor,\n gapColor,\n height,\n primaryAction,\n secondaryAction,\n}: CreateMeasuredMultiActionButtonContentOptions): ReactNode => (\n <StyledMultiActionButton style={{ width: 'fit-content' }}>\n <ActionButton\n action={primaryAction}\n actionType=\"primary\"\n backgroundColor={primaryAction.backgroundColor ?? backgroundColor}\n isCollapsed={false}\n isDisabled={false}\n isShrunk={false}\n isSolo={!secondaryAction}\n showLabel\n shouldUseContentWidth\n height={height}\n />\n {secondaryAction && (\n <>\n <StyledSeparator $gapColor={gapColor} $isHidden={false} />\n <ActionButton\n action={secondaryAction}\n actionType=\"secondary\"\n backgroundColor={secondaryAction.backgroundColor ?? backgroundColor}\n isCollapsed={false}\n isDisabled={false}\n isExpanded={false}\n isHidden={false}\n showLabel={false}\n shouldUseContentWidth\n height={height}\n />\n </>\n )}\n </StyledMultiActionButton>\n);\n\n/**\n * Multi-action button with optional secondary action that can expand on hover/click.\n */\nconst MultiActionButton: FC<MultiActionButtonProps> = ({\n backgroundColor,\n className,\n extendedTimeoutMs = 3000,\n gapColor,\n height = MultiActionButtonHeight.Medium,\n isCollapsed = false,\n isDisabled = false,\n primaryAction,\n secondaryAction,\n secondaryContextMenu,\n shouldAutoCollapse = false,\n shouldUseFullWidth,\n width,\n}) => {\n const [isExtendedByClick, setIsExtendedByClick] = useState(false);\n const [isSecondaryExpanded, setIsSecondaryExpanded] = useState(false);\n const [isSecondaryHovered, setIsSecondaryHovered] = useState(false);\n\n const autoCollapseTimeoutRef = useRef<number | null>(null);\n const multiActionButtonRef = useRef<HTMLDivElement | null>(null);\n const secondaryContextMenuRef = useRef<ContextMenuRef>(null);\n const [autoCollapseMode, setAutoCollapseMode] = useState<MultiActionButtonAutoCollapseMode>(\n MultiActionButtonAutoCollapseMode.Expanded,\n );\n\n const isTouch = useIsTouch();\n const parentSize = useElementSize(multiActionButtonRef, { shouldUseParentElement: true });\n\n const hasSecondaryContextMenu = Boolean(secondaryContextMenu?.length);\n const secondaryTriggerAction = hasSecondaryContextMenu\n ? SECONDARY_CONTEXT_MENU_ACTION\n : secondaryAction;\n const hasExpandableSecondaryAction = Boolean(secondaryAction) && !hasSecondaryContextMenu;\n const hasSecondaryAction = Boolean(secondaryTriggerAction);\n const shouldUseContentWidth = !width && !shouldUseFullWidth;\n\n const expandedMeasuredContent = useMemo(\n () =>\n createMeasuredMultiActionButtonContent({\n backgroundColor,\n gapColor,\n height,\n primaryAction,\n secondaryAction: secondaryTriggerAction,\n }),\n [backgroundColor, gapColor, height, primaryAction, secondaryTriggerAction],\n );\n\n const { measuredElement, width: expandedMeasuredWidth } = useMeasuredClone({\n content: expandedMeasuredContent,\n });\n\n const availableWidth = useMemo(() => {\n const parentWidth = parentSize?.width;\n\n if (typeof width === 'number') {\n return typeof parentWidth === 'number' ? Math.min(parentWidth, width) : width;\n }\n\n return parentWidth;\n }, [parentSize?.width, width]);\n\n useEffect(() => {\n if (!shouldAutoCollapse || isCollapsed) {\n setAutoCollapseMode(MultiActionButtonAutoCollapseMode.Expanded);\n return;\n }\n\n if (expandedMeasuredWidth <= 0) {\n return;\n }\n\n setAutoCollapseMode((previousMode) =>\n getMultiActionButtonAutoCollapseMode({\n availableWidth,\n expandedWidth: expandedMeasuredWidth,\n hasSecondaryAction,\n height,\n previousMode,\n }),\n );\n }, [\n availableWidth,\n expandedMeasuredWidth,\n hasSecondaryAction,\n height,\n isCollapsed,\n shouldAutoCollapse,\n ]);\n\n const isAutoIconsOnly =\n shouldAutoCollapse && autoCollapseMode === MultiActionButtonAutoCollapseMode.IconsOnly;\n const isAutoPrimaryOnly =\n shouldAutoCollapse && autoCollapseMode === MultiActionButtonAutoCollapseMode.PrimaryOnly;\n const shouldKeepFullWidth = Boolean(shouldUseFullWidth);\n const shouldHideSecondaryForAutoCollapse = hasSecondaryAction && isAutoPrimaryOnly;\n const effectiveIsCollapsed = isCollapsed || (!shouldKeepFullWidth && isAutoPrimaryOnly);\n const resolvedSecondaryAction = hasSecondaryAction ? secondaryTriggerAction : undefined;\n const isSecondaryHidden = effectiveIsCollapsed || shouldHideSecondaryForAutoCollapse;\n const shouldPreventSecondaryExpansion = isAutoIconsOnly || isSecondaryHidden;\n const shouldKeepPrimaryLabelVisible = shouldKeepFullWidth && shouldAutoCollapse;\n const minimumPrimaryLabelVisibleWidth = getMinimumPrimaryLabelVisibleWidth({\n hasVisibleSecondaryAction: hasSecondaryAction,\n height,\n });\n const shouldHidePrimaryLabelForMinimumWidth =\n shouldKeepPrimaryLabelVisible &&\n typeof availableWidth === 'number' &&\n availableWidth <= minimumPrimaryLabelVisibleWidth;\n\n const resolvedWidth = shouldKeepFullWidth\n ? '100%'\n : effectiveIsCollapsed\n ? height\n : (width ?? 'fit-content');\n\n const secondaryContextMenuTriggerStyle = getSecondaryContextMenuTriggerStyle({\n height,\n isCollapsed: isSecondaryHidden,\n isExpanded: false,\n shouldUseContentWidth,\n });\n\n /**\n * Clears the current auto-collapse timer without changing visual state.\n */\n const clearAutoCollapseTimeout = useCallback(() => {\n if (autoCollapseTimeoutRef.current) {\n window.clearTimeout(autoCollapseTimeoutRef.current);\n autoCollapseTimeoutRef.current = null;\n }\n }, []);\n\n /**\n * Clears and restarts the auto-collapse timer used after click-triggered expansion.\n */\n const resetAutoCollapseTimeout = useCallback(() => {\n clearAutoCollapseTimeout();\n\n if (extendedTimeoutMs <= 0) {\n return;\n }\n\n autoCollapseTimeoutRef.current = window.setTimeout(() => {\n setIsSecondaryExpanded(false);\n setIsExtendedByClick(false);\n }, extendedTimeoutMs);\n }, [clearAutoCollapseTimeout, extendedTimeoutMs]);\n\n /**\n * Expands the secondary action and remembers that it originated from a click.\n */\n const expandSecondaryByClick = useCallback(() => {\n setIsSecondaryExpanded(true);\n setIsExtendedByClick(true);\n resetAutoCollapseTimeout();\n }, [resetAutoCollapseTimeout]);\n\n /**\n * Cleanup timers on unmount.\n */\n useEffect(\n () => () => {\n clearAutoCollapseTimeout();\n },\n [clearAutoCollapseTimeout],\n );\n\n /**\n * Collapsing the control should also reset any temporary expansion state.\n */\n useEffect(() => {\n if (effectiveIsCollapsed || shouldPreventSecondaryExpansion) {\n clearAutoCollapseTimeout();\n setIsSecondaryExpanded(false);\n setIsExtendedByClick(false);\n setIsSecondaryHovered(false);\n }\n }, [clearAutoCollapseTimeout, effectiveIsCollapsed, shouldPreventSecondaryExpansion]);\n\n /**\n * Handler for the primary action button.\n */\n const handlePrimaryClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (isDisabled || primaryAction.isDisabled) {\n return;\n }\n\n const payload: MultiActionButtonActionEvent = {\n action: 'primary',\n event,\n isExtended: isSecondaryExpanded,\n isTouch,\n };\n\n primaryAction.onClick?.(payload);\n },\n [isDisabled, isSecondaryExpanded, isTouch, primaryAction],\n );\n\n /**\n * Handler for the secondary action button.\n */\n const handleSecondaryClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (\n !resolvedSecondaryAction ||\n isSecondaryHidden ||\n isDisabled ||\n resolvedSecondaryAction.isDisabled\n ) {\n return;\n }\n\n if (hasSecondaryContextMenu) {\n secondaryContextMenuRef.current?.show();\n return;\n }\n\n const payload: MultiActionButtonActionEvent = {\n action: 'secondary',\n event,\n isExtended: isSecondaryExpanded,\n isTouch,\n };\n\n resolvedSecondaryAction.onClick?.(payload);\n if (!shouldPreventSecondaryExpansion) {\n expandSecondaryByClick();\n }\n },\n [\n expandSecondaryByClick,\n hasSecondaryContextMenu,\n isSecondaryHidden,\n isDisabled,\n isSecondaryExpanded,\n isTouch,\n resolvedSecondaryAction,\n shouldPreventSecondaryExpansion,\n ],\n );\n\n /**\n * Desktop hover behavior keeps the secondary action expanded while hovered.\n */\n const handleSecondaryMouseEnter = useCallback(() => {\n if (\n !secondaryAction ||\n isSecondaryHidden ||\n isTouch ||\n isDisabled ||\n shouldPreventSecondaryExpansion ||\n secondaryAction.isDisabled\n ) {\n return;\n }\n\n setIsSecondaryHovered(true);\n if (!isExtendedByClick) {\n setIsSecondaryExpanded(true);\n }\n }, [\n isSecondaryHidden,\n isDisabled,\n isExtendedByClick,\n isTouch,\n secondaryAction,\n shouldPreventSecondaryExpansion,\n ]);\n\n const handleSecondaryMouseLeave = useCallback(() => {\n if (isTouch) {\n return;\n }\n\n setIsSecondaryHovered(false);\n if (!isExtendedByClick && !effectiveIsCollapsed) {\n setIsSecondaryExpanded(false);\n }\n }, [effectiveIsCollapsed, isExtendedByClick, isTouch]);\n\n /**\n * Secondary label is visible when expanded or when hovered (desktop only).\n */\n const isSecondaryLabelVisible = isSecondaryExpanded || (!isTouch && isSecondaryHovered);\n\n return (\n <>\n {measuredElement}\n <StyledMultiActionButton\n className={clsx('beta-chayns-multi-action', className)}\n ref={multiActionButtonRef}\n style={{ maxWidth: '100%', width: resolvedWidth }}\n >\n <ActionButton\n action={primaryAction}\n actionType=\"primary\"\n backgroundColor={primaryAction.backgroundColor ?? backgroundColor}\n isCollapsed={effectiveIsCollapsed}\n isDisabled={isDisabled}\n isShrunk={\n hasSecondaryAction &&\n ((!shouldKeepFullWidth && isAutoIconsOnly) || isSecondaryExpanded)\n }\n isSolo={!hasSecondaryAction || isSecondaryHidden || effectiveIsCollapsed}\n onClick={handlePrimaryClick}\n showLabel={\n !effectiveIsCollapsed &&\n !shouldHidePrimaryLabelForMinimumWidth &&\n (shouldKeepPrimaryLabelVisible || !isAutoIconsOnly) &&\n (shouldKeepPrimaryLabelVisible || !shouldHideSecondaryForAutoCollapse) &&\n (!hasExpandableSecondaryAction || !isSecondaryExpanded)\n }\n shouldUseContentWidth={shouldUseContentWidth}\n height={height}\n />\n {hasSecondaryAction && (\n <>\n <StyledSeparator $gapColor={gapColor} $isHidden={isSecondaryHidden} />\n {hasSecondaryContextMenu ? (\n <ContextMenu\n items={secondaryContextMenu ?? []}\n ref={secondaryContextMenuRef}\n shouldDisableClick\n shouldUseDefaultTriggerStyles={false}\n shouldHidePopupArrow\n yOffset={-6}\n style={secondaryContextMenuTriggerStyle}\n >\n <ActionButton\n action={\n resolvedSecondaryAction ?? SECONDARY_CONTEXT_MENU_ACTION\n }\n actionType=\"secondary\"\n backgroundColor={\n resolvedSecondaryAction?.backgroundColor ?? backgroundColor\n }\n isCollapsed={false}\n isDisabled={isDisabled}\n isExpanded={false}\n isHidden={isSecondaryHidden}\n key=\"multi-action-secondary-context-menu\"\n onClick={handleSecondaryClick}\n showLabel={false}\n shouldUseContentWidth={shouldUseContentWidth}\n height={height}\n />\n </ContextMenu>\n ) : (\n <ActionButton\n action={\n resolvedSecondaryAction ??\n secondaryAction ??\n SECONDARY_CONTEXT_MENU_ACTION\n }\n actionType=\"secondary\"\n backgroundColor={\n resolvedSecondaryAction?.backgroundColor ?? backgroundColor\n }\n isCollapsed={false}\n isDisabled={isDisabled}\n isExpanded={!isAutoIconsOnly && isSecondaryExpanded}\n isHidden={isSecondaryHidden}\n key=\"multi-action-secondary-button\"\n onClick={handleSecondaryClick}\n onMouseEnter={handleSecondaryMouseEnter}\n onMouseLeave={handleSecondaryMouseLeave}\n showLabel={\n !isSecondaryHidden &&\n !isAutoIconsOnly &&\n isSecondaryLabelVisible\n }\n shouldUseContentWidth={shouldUseContentWidth}\n height={height}\n />\n )}\n </>\n )}\n </StyledMultiActionButton>\n </>\n );\n};\n\nMultiActionButton.displayName = 'MultiActionButton';\n\nexport default MultiActionButton;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,KAAK,IAIRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AACtE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,OAAOC,WAAW,MAAM,6BAA6B;AAErD,OAAOC,YAAY,MAAM,8BAA8B;AACvD,SAASC,uBAAuB,EAAEC,eAAe,QAAQ,4BAA4B;AACrF,SACIC,kCAAkC,EAClCC,oCAAoC,EACpCC,mCAAmC,EACnCC,iCAAiC,QAC9B,2BAA2B;AAClC,SAASC,uBAAuB,QAAQ,2BAA2B;AAOnE,MAAMC,6BAAsD,GAAG;EAC3DC,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAEC;AACX,CAAC;AAUD,MAAMC,sCAAsC,GAAGA,CAAC;EAC5CC,eAAe;EACfC,QAAQ;EACRC,MAAM;EACNC,aAAa;EACbC;AAC2C,CAAC,kBAC5C3B,KAAA,CAAA4B,aAAA,CAACjB,uBAAuB;EAACkB,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAc;AAAE,gBACrD9B,KAAA,CAAA4B,aAAA,CAAClB,YAAY;EACTqB,MAAM,EAAEL,aAAc;EACtBM,UAAU,EAAC,SAAS;EACpBT,eAAe,EAAEG,aAAa,CAACH,eAAe,IAAIA,eAAgB;EAClEU,WAAW,EAAE,KAAM;EACnBC,UAAU,EAAE,KAAM;EAClBC,QAAQ,EAAE,KAAM;EAChBC,MAAM,EAAE,CAACT,eAAgB;EACzBU,SAAS;EACTC,qBAAqB;EACrBb,MAAM,EAAEA;AAAO,CAClB,CAAC,EACDE,eAAe,iBACZ3B,KAAA,CAAA4B,aAAA,CAAA5B,KAAA,CAAAuC,Q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c,UAAU,EAAC,WAAW;IACtBT,eAAe,EACXkE,uBAAuB,EAAElE,eAAe,IAAIA,eAC/C;IACDU,WAAW,EAAE,KAAM;IACnBC,UAAU,EAAEA,UAAW;IACvBQ,UAAU,EAAE,KAAM;IAClBC,QAAQ,EAAE+C,iBAAkB;IAC5BgC,GAAG,EAAC,qCAAqC;IACzCb,OAAO,EAAEC,oBAAqB;IAC9BzE,SAAS,EAAE,KAAM;IACjBC,qBAAqB,EAAEA,qBAAsB;IAC7Cb,MAAM,EAAEA;EAAO,CAClB,CACQ,CAAC,gBAEdzB,KAAA,CAAA4B,aAAA,CAAClB,YAAY;IACTqB,MAAM,EACF0D,uBAAuB,IACvB9D,eAAe,IACfT,6BACH;IACDc,UAAU,EAAC,WAAW;IACtBT,eAAe,EACXkE,uBAAuB,EAAElE,eAAe,IAAIA,eAC/C;IACDU,WAAW,EAAE,KAAM;IACnBC,UAAU,EAAEA,UAAW;IACvBQ,UAAU,EAAE,CAACwC,eAAe,IAAI7B,mBAAoB;IACpDV,QAAQ,EAAE+C,iBAAkB;IAC5BgC,GAAG,EAAC,+BAA+B;IACnCb,OAAO,EAAEC,oBAAqB;IAC9Ba,YAAY,EAAEX,yBAA0B;IACxCY,YAAY,EAAEX,yBAA0B;IACxC5E,SAAS,EACL,CAACqD,iBAAiB,IAClB,CAACR,eAAe,IAChBgC,uBACH;IACD5E,qBAAqB,EAAEA,qBAAsB;IAC7Cb,MAAM,EAAEA;EAAO,CAClB,CAEP,CAEe,CAC3B,CAAC;AAEX,CAAC;AAEDmB,iBAAiB,CAACiF,WAAW,GAAG,mBAAmB;AAEnD,eAAejF,iBAAiB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiActionButton.types.js","names":["MultiActionButtonStatusType","MultiActionButtonHeight"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.types.ts"],"sourcesContent":["import type { MouseEvent, ReactElement, ReactNode } from 'react';\nimport type { MotionValue } from 'motion/react';\nimport type { ContextMenuItem } from '../context-menu/ContextMenu.types';\n\n/**\n * Supported status types for the multi action button.\n */\nexport enum MultiActionButtonStatusType {\n /**\n * Pulsing background effect.\n * @description Applies a subtle animated overlay on the action background to draw attention.\n * This is intended for temporary states like recording or live activity indicators.\n */\n Pulse = 'pulse',\n}\n\n/**\n * Supported heights for the multi action button.\n */\nexport enum MultiActionButtonHeight {\n /**\n * Medium height (42px).\n */\n Medium = 42,\n /**\n * Large height (48px).\n */\n Large = 48,\n}\n\n/**\n * Minimal status configuration for an action.\n */\nexport type MultiActionButtonActionStatus = {\n /**\n * Optional pulse colors for the animation.\n * @description Defines the two colors for the pulsing background animation. If not provided, defaults to ['#A50000', '#630000'].\n * @optional\n */\n pulseColors?: [string, string];\n /**\n * Status type to apply.\n * @description Selects the visual emphasis type applied to the action. The component currently\n * supports a pulsing overlay, and additional types may be added later.\n * @optional\n */\n type?: MultiActionButtonStatusType;\n};\n\n/**\n * Event payload emitted on action click.\n */\nexport type MultiActionButtonActionEvent = {\n /**\n * Which action was clicked.\n * @description Indicates whether the primary or secondary action fired. This is helpful when\n * sharing a handler between both actions.\n */\n action: 'primary' | 'secondary';\n /**\n * Original click event.\n * @description Useful to access modifier keys, prevent default, or stop propagation.\n */\n event: MouseEvent<HTMLButtonElement>;\n /**\n * Whether the secondary action is currently extended.\n * @description Useful for flows that need to distinguish between a collapsed and expanded\n * secondary action, especially on touch devices.\n */\n isExtended: boolean;\n /**\n * Whether the device is considered touch.\n * @description Derived from pointer capabilities and used to decide between hover and click behavior.\n */\n isTouch: boolean;\n};\n\n/**\n * Configuration for a single action.\n */\nexport type MultiActionButtonAction = {\n /**\n * Optional background color for this action.\n * @description Overrides the component-level background color for this specific action.\n * If omitted, `MultiActionButton.backgroundColor` is used as fallback.\n * @optional\n */\n backgroundColor?: string;\n /**\n * Optional color for the icon and label.\n * @description Overrides the default text/icon color. If omitted, the current theme text color is used.\n * @optional\n */\n color?: string;\n /**\n * The icon for the action.\n * @description Can be a FontAwesome class string (e.g., 'fa fa-microphone') or a custom React element.\n * The icon is always rendered inside a fixed-size slot to keep alignment stable.\n */\n icon: string | ReactElement;\n /**\n * Whether the action is disabled.\n * @description Disabled actions do not respond to hover or click and are visually dimmed.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Optional reason shown in a tooltip when the action is disabled.\n * @description Use this to explain why the action is currently unavailable.\n * @optional\n */\n disabledReason?: string;\n /**\n * The optional label for the action.\n * @description The label is shown next to the icon and will be truncated with ellipsis when\n * there is not enough horizontal space.\n * @optional\n */\n label: ReactNode;\n /**\n * Click handler for the action.\n * @description Receives a payload that includes the action type, extension state, and device info.\n * This allows external logic to decide whether the click should trigger an action immediately.\n * @optional\n */\n onClick?: (info: MultiActionButtonActionEvent) => void;\n /**\n * Status effect configuration for the action.\n * @description Controls optional visual emphasis like pulsing, without changing layout or sizing.\n * @optional\n */\n status?: MultiActionButtonActionStatus;\n};\n\nexport type MultiActionButtonSecondaryContextMenu = ContextMenuItem[];\n\n/**\n * Props for the MultiActionButton component.\n */\nexport type MultiActionButtonProps = {\n /**\n * Optional background color for both actions.\n * @description Overrides the default background color for the action buttons. This is useful\n * when the button is used on different backgrounds or when a specific brand color is needed.\n * If omitted, the primary color from the theme is used.\n * @default theme.primary\n * @optional\n */\n backgroundColor?: string;\n /**\n * Additional class name for the wrapper element.\n * @description Useful for custom styling or testing hooks.\n * @optional\n */\n className?: string;\n /**\n * Timeout in ms before the secondary action collapses after a click.\n * @description Set to 0 to keep the secondary action extended until the user collapses it.\n * @example\n * <MultiActionButton\n * primaryAction={primaryAction}\n * secondaryAction={secondaryAction}\n * extendedTimeoutMs={0}\n * />\n * @default 3000\n * @optional\n */\n extendedTimeoutMs?: number;\n /**\n * Height of the button.\n * @description Controls the height of the button. Use values from MultiActionButtonHeight enum or custom number.\n * @default MultiActionButtonHeight.Medium\n * @optional\n */\n height?: number;\n /**\n * Optional color for the 1px separator line between actions.\n * @description Defaults to theme.cw-body-background and falls back to #fff if not available.\n * @optional\n */\n gapColor?: string;\n /**\n * Whether the button is collapsed to a single icon.\n * @description When collapsed, only the primary icon is shown and the overall width shrinks to a circle.\n * Use this to provide compact states or toolbar modes.\n * @default false\n * @optional\n */\n isCollapsed?: boolean;\n /**\n * Whether the whole control is disabled.\n * @description Disables interactions for both actions, including hover expansion and clicks.\n * @default false\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Primary action configuration.\n * @description Required action shown on the left side (or as the only action when no secondary is provided).\n */\n primaryAction: MultiActionButtonAction;\n /**\n * Secondary action configuration.\n * @description Optional action shown on the right side. When present, it can expand on hover or click.\n * @optional\n */\n secondaryAction?: MultiActionButtonAction;\n /**\n * Context menu rendered as the secondary action.\n * @description When the list contains entries, the secondary slot renders a fixed down-arrow\n * trigger that opens a ContextMenu. If the list is empty or undefined, no context menu trigger\n * is shown and `secondaryAction` can be used as usual.\n * @optional\n */\n secondaryContextMenu?: MultiActionButtonSecondaryContextMenu;\n /**\n * Whether the button should collapse automatically based on the available width.\n * @description When enabled, the control switches from the default layout to an icon-only\n * layout and finally to a primary-only icon layout as space becomes tighter.\n * @default false\n * @optional\n */\n shouldAutoCollapse?: boolean;\n /**\n * Whether the button should take the full width of its parent.\n * @description When true, the control stretches to 100% width unless `width` is provided.\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n *
|
|
1
|
+
{"version":3,"file":"MultiActionButton.types.js","names":["MultiActionButtonStatusType","MultiActionButtonHeight"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.types.ts"],"sourcesContent":["import type { MouseEvent, ReactElement, ReactNode } from 'react';\nimport type { MotionValue } from 'motion/react';\nimport type { ContextMenuItem } from '../context-menu/ContextMenu.types';\n\n/**\n * Supported status types for the multi action button.\n */\nexport enum MultiActionButtonStatusType {\n /**\n * Pulsing background effect.\n * @description Applies a subtle animated overlay on the action background to draw attention.\n * This is intended for temporary states like recording or live activity indicators.\n */\n Pulse = 'pulse',\n}\n\n/**\n * Supported heights for the multi action button.\n */\nexport enum MultiActionButtonHeight {\n /**\n * Medium height (42px).\n */\n Medium = 42,\n /**\n * Large height (48px).\n */\n Large = 48,\n}\n\n/**\n * Minimal status configuration for an action.\n */\nexport type MultiActionButtonActionStatus = {\n /**\n * Optional pulse colors for the animation.\n * @description Defines the two colors for the pulsing background animation. If not provided, defaults to ['#A50000', '#630000'].\n * @optional\n */\n pulseColors?: [string, string];\n /**\n * Status type to apply.\n * @description Selects the visual emphasis type applied to the action. The component currently\n * supports a pulsing overlay, and additional types may be added later.\n * @optional\n */\n type?: MultiActionButtonStatusType;\n};\n\n/**\n * Event payload emitted on action click.\n */\nexport type MultiActionButtonActionEvent = {\n /**\n * Which action was clicked.\n * @description Indicates whether the primary or secondary action fired. This is helpful when\n * sharing a handler between both actions.\n */\n action: 'primary' | 'secondary';\n /**\n * Original click event.\n * @description Useful to access modifier keys, prevent default, or stop propagation.\n */\n event: MouseEvent<HTMLButtonElement>;\n /**\n * Whether the secondary action is currently extended.\n * @description Useful for flows that need to distinguish between a collapsed and expanded\n * secondary action, especially on touch devices.\n */\n isExtended: boolean;\n /**\n * Whether the device is considered touch.\n * @description Derived from pointer capabilities and used to decide between hover and click behavior.\n */\n isTouch: boolean;\n};\n\n/**\n * Configuration for a single action.\n */\nexport type MultiActionButtonAction = {\n /**\n * Optional background color for this action.\n * @description Overrides the component-level background color for this specific action.\n * If omitted, `MultiActionButton.backgroundColor` is used as fallback.\n * @optional\n */\n backgroundColor?: string;\n /**\n * Optional color for the icon and label.\n * @description Overrides the default text/icon color. If omitted, the current theme text color is used.\n * @optional\n */\n color?: string;\n /**\n * The icon for the action.\n * @description Can be a FontAwesome class string (e.g., 'fa fa-microphone') or a custom React element.\n * The icon is always rendered inside a fixed-size slot to keep alignment stable.\n */\n icon: string | ReactElement;\n /**\n * Whether the action is disabled.\n * @description Disabled actions do not respond to hover or click and are visually dimmed.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Optional reason shown in a tooltip when the action is disabled.\n * @description Use this to explain why the action is currently unavailable.\n * @optional\n */\n disabledReason?: string;\n /**\n * The optional label for the action.\n * @description The label is shown next to the icon and will be truncated with ellipsis when\n * there is not enough horizontal space.\n * @optional\n */\n label: ReactNode;\n /**\n * Click handler for the action.\n * @description Receives a payload that includes the action type, extension state, and device info.\n * This allows external logic to decide whether the click should trigger an action immediately.\n * @optional\n */\n onClick?: (info: MultiActionButtonActionEvent) => void;\n /**\n * Status effect configuration for the action.\n * @description Controls optional visual emphasis like pulsing, without changing layout or sizing.\n * @optional\n */\n status?: MultiActionButtonActionStatus;\n};\n\nexport type MultiActionButtonSecondaryContextMenu = ContextMenuItem[];\n\n/**\n * Props for the MultiActionButton component.\n */\nexport type MultiActionButtonProps = {\n /**\n * Optional background color for both actions.\n * @description Overrides the default background color for the action buttons. This is useful\n * when the button is used on different backgrounds or when a specific brand color is needed.\n * If omitted, the primary color from the theme is used.\n * @default theme.primary\n * @optional\n */\n backgroundColor?: string;\n /**\n * Additional class name for the wrapper element.\n * @description Useful for custom styling or testing hooks.\n * @optional\n */\n className?: string;\n /**\n * Timeout in ms before the secondary action collapses after a click.\n * @description Set to 0 to keep the secondary action extended until the user collapses it.\n * @example\n * <MultiActionButton\n * primaryAction={primaryAction}\n * secondaryAction={secondaryAction}\n * extendedTimeoutMs={0}\n * />\n * @default 3000\n * @optional\n */\n extendedTimeoutMs?: number;\n /**\n * Height of the button.\n * @description Controls the height of the button. Use values from MultiActionButtonHeight enum or custom number.\n * @default MultiActionButtonHeight.Medium\n * @optional\n */\n height?: number;\n /**\n * Optional color for the 1px separator line between actions.\n * @description Defaults to theme.cw-body-background and falls back to #fff if not available.\n * @optional\n */\n gapColor?: string;\n /**\n * Whether the button is collapsed to a single icon.\n * @description When collapsed, only the primary icon is shown and the overall width shrinks to a circle.\n * Use this to provide compact states or toolbar modes.\n * @default false\n * @optional\n */\n isCollapsed?: boolean;\n /**\n * Whether the whole control is disabled.\n * @description Disables interactions for both actions, including hover expansion and clicks.\n * @default false\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Primary action configuration.\n * @description Required action shown on the left side (or as the only action when no secondary is provided).\n */\n primaryAction: MultiActionButtonAction;\n /**\n * Secondary action configuration.\n * @description Optional action shown on the right side. When present, it can expand on hover or click.\n * @optional\n */\n secondaryAction?: MultiActionButtonAction;\n /**\n * Context menu rendered as the secondary action.\n * @description When the list contains entries, the secondary slot renders a fixed down-arrow\n * trigger that opens a ContextMenu. If the list is empty or undefined, no context menu trigger\n * is shown and `secondaryAction` can be used as usual.\n * @optional\n */\n secondaryContextMenu?: MultiActionButtonSecondaryContextMenu;\n /**\n * Whether the button should collapse automatically based on the available width.\n * @description When enabled, the control switches from the default layout to an icon-only\n * layout and finally to a primary-only icon layout as space becomes tighter.\n * @default false\n * @optional\n */\n shouldAutoCollapse?: boolean;\n /**\n * Whether the button should take the full width of its parent.\n * @description When true, the control stretches to 100% width unless `width` is provided.\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Optional width override for the whole button.\n * @description Can be a fixed number or a MotionValue for external animations. When omitted,\n * the width is driven by the content unless `shouldUseFullWidth` is true.\n * @optional\n */\n width?: number | MotionValue<number>;\n};\n"],"mappings":"AAIA;AACA;AACA;AACA,WAAYA,2BAA2B,0BAA3BA,2BAA2B;EACnC;AACJ;AACA;AACA;AACA;EALYA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;;AASvC;AACA;AACA;AACA,WAAYC,uBAAuB,0BAAvBA,uBAAuB;EAC/B;AACJ;AACA;EAHYA,uBAAuB,CAAvBA,uBAAuB;EAK/B;AACJ;AACA;EAPYA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;;AAWnC;AACA;AACA;;AAiBA;AACA;AACA;;AA0BA;AACA;AACA;;AAyDA;AACA;AACA","ignoreList":[]}
|
|
@@ -25,12 +25,9 @@ const ActionButton = ({
|
|
|
25
25
|
onClick,
|
|
26
26
|
onMouseEnter,
|
|
27
27
|
onMouseLeave,
|
|
28
|
-
onFocus,
|
|
29
|
-
onBlur,
|
|
30
28
|
showLabel,
|
|
31
29
|
shouldUseContentWidth,
|
|
32
|
-
height
|
|
33
|
-
shouldShowKeyboardHighlighting = false
|
|
30
|
+
height
|
|
34
31
|
}) => {
|
|
35
32
|
const isPrimary = actionType === 'primary';
|
|
36
33
|
const isSecondary = actionType === 'secondary';
|
|
@@ -86,12 +83,9 @@ const ActionButton = ({
|
|
|
86
83
|
$height: height,
|
|
87
84
|
$statusType: action.status?.type,
|
|
88
85
|
$shouldUseContentWidth: shouldUseContentWidth,
|
|
89
|
-
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
|
|
90
86
|
onClick: onClick,
|
|
91
87
|
onMouseEnter: onMouseEnter,
|
|
92
88
|
onMouseLeave: onMouseLeave,
|
|
93
|
-
onFocus: onFocus,
|
|
94
|
-
onBlur: onBlur,
|
|
95
89
|
type: "button"
|
|
96
90
|
}, shouldShowDisabledReason && disabledReason ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
97
91
|
alignment: PopupAlignment.BottomRight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.js","names":["AnimatePresence","React","Icon","Tooltip","StyledActionButton","StyledActionContent","StyledIconSlot","StyledLabelWrapper","StyledSecondaryLabel","PopupAlignment","LABEL_GAP","LABEL_TRANSITION","duration","ActionButton","action","actionType","backgroundColor","isCollapsed","isDisabled","isExpanded","isHidden","isShrunk","isSolo","onClick","onMouseEnter","onMouseLeave","
|
|
1
|
+
{"version":3,"file":"ActionButton.js","names":["AnimatePresence","React","Icon","Tooltip","StyledActionButton","StyledActionContent","StyledIconSlot","StyledLabelWrapper","StyledSecondaryLabel","PopupAlignment","LABEL_GAP","LABEL_TRANSITION","duration","ActionButton","action","actionType","backgroundColor","isCollapsed","isDisabled","isExpanded","isHidden","isShrunk","isSolo","onClick","onMouseEnter","onMouseLeave","showLabel","shouldUseContentWidth","height","isPrimary","isSecondary","actionColor","color","isActionDisabled","Boolean","disabledReason","trim","shouldShowDisabledReason","iconSize","actionContent","createElement","$height","$isDisabled","icon","icons","size","initial","animate","opacity","width","marginLeft","exit","transition","style","label","disabled","$backgroundColor","$isCollapsed","$isExpanded","undefined","$isInteractionDisabled","$isHidden","$isPrimary","$isSecondary","$isShrunk","$isSolo","$pulseColors","status","pulseColors","$statusType","type","$shouldUseContentWidth","alignment","BottomRight","item","text","maxItemWidth","displayName"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { FC, MouseEvent } from 'react';\nimport Icon from '../../icon/Icon';\nimport Tooltip from '../../tooltip/Tooltip';\nimport {\n StyledActionButton,\n StyledActionContent,\n StyledIconSlot,\n StyledLabelWrapper,\n StyledSecondaryLabel,\n} from './ActionButton.styles';\nimport type { MultiActionButtonAction } from '../MultiActionButton.types';\nimport { PopupAlignment } from '../../../types/popup';\n\nconst LABEL_GAP = 6;\nconst LABEL_TRANSITION = { duration: 0.3 };\n\nexport type ActionButtonProps = {\n action: MultiActionButtonAction;\n actionType: 'primary' | 'secondary';\n backgroundColor?: string;\n isCollapsed: boolean;\n isDisabled: boolean;\n isExpanded?: boolean;\n isHidden?: boolean;\n isShrunk?: boolean;\n isSolo?: boolean;\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n showLabel: boolean;\n shouldUseContentWidth: boolean;\n height: number;\n};\n\n/**\n * Shared action button UI used by both primary and secondary actions.\n * Keeps layout and animations consistent while isolating styling details.\n */\nconst ActionButton: FC<ActionButtonProps> = ({\n action,\n actionType,\n backgroundColor,\n isCollapsed,\n isDisabled,\n isExpanded,\n isHidden,\n isShrunk,\n isSolo,\n onClick,\n onMouseEnter,\n onMouseLeave,\n showLabel,\n shouldUseContentWidth,\n height,\n}) => {\n const isPrimary = actionType === 'primary';\n const isSecondary = actionType === 'secondary';\n const actionColor = action.color ?? '#FFFFFF';\n const isActionDisabled = isDisabled || Boolean(action.isDisabled);\n const disabledReason = action.disabledReason?.trim();\n const shouldShowDisabledReason = Boolean(disabledReason) && isActionDisabled;\n const iconSize = height - 24;\n\n const actionContent = (\n <StyledActionContent>\n <StyledIconSlot $height={height} $isDisabled={isActionDisabled}>\n {typeof action.icon === 'string' ? (\n <Icon icons={[action.icon]} color={actionColor} size={iconSize} />\n ) : (\n action.icon\n )}\n </StyledIconSlot>\n <AnimatePresence initial={false}>\n {/* Animate width and margin to avoid layout jumps when labels mount/unmount. */}\n {showLabel && (\n <StyledLabelWrapper\n animate={{ opacity: 1, width: 'auto', marginLeft: LABEL_GAP }}\n exit={{ opacity: 0, width: 0, marginLeft: 0 }}\n initial={{ opacity: 0, width: 0, marginLeft: 0 }}\n transition={LABEL_TRANSITION}\n >\n <StyledSecondaryLabel style={{ color: actionColor }}>\n {action.label}\n </StyledSecondaryLabel>\n </StyledLabelWrapper>\n )}\n </AnimatePresence>\n </StyledActionContent>\n );\n\n return (\n <StyledActionButton\n aria-disabled={isActionDisabled}\n disabled={isActionDisabled && !shouldShowDisabledReason}\n $backgroundColor={backgroundColor}\n $isCollapsed={isCollapsed}\n $isExpanded={isSecondary ? isExpanded : undefined}\n $isInteractionDisabled={isActionDisabled}\n $isHidden={isSecondary ? isHidden : undefined}\n $isPrimary={isPrimary}\n $isSecondary={isSecondary}\n $isShrunk={isPrimary ? isShrunk : undefined}\n $isSolo={isPrimary ? isSolo : undefined}\n $pulseColors={action.status?.pulseColors}\n $height={height}\n $statusType={action.status?.type}\n $shouldUseContentWidth={shouldUseContentWidth}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n type=\"button\"\n >\n {shouldShowDisabledReason && disabledReason ? (\n <Tooltip\n alignment={PopupAlignment.BottomRight}\n item={{ text: disabledReason }}\n maxItemWidth={400}\n >\n {actionContent}\n </Tooltip>\n ) : (\n actionContent\n )}\n </StyledActionButton>\n );\n};\n\nActionButton.displayName = 'ActionButton';\n\nex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BkC,SAAS,EAAEnC,SAAS,GAAGR,QAAQ,GAAGsC,SAAU;IAC5CM,OAAO,EAAEpC,SAAS,GAAGP,MAAM,GAAGqC,SAAU;IACxCO,YAAY,EAAEpD,MAAM,CAACqD,MAAM,EAAEC,WAAY;IACzC3B,OAAO,EAAEb,MAAO;IAChByC,WAAW,EAAEvD,MAAM,CAACqD,MAAM,EAAEG,IAAK;IACjCC,sBAAsB,EAAE5C,qBAAsB;IAC9CJ,OAAO,EAAEA,OAAQ;IACjBC,YAAY,EAAEA,YAAa;IAC3BC,YAAY,EAAEA,YAAa;IAC3B6C,IAAI,EAAC;EAAQ,GAEZjC,wBAAwB,IAAIF,cAAc,gBACvClC,KAAA,CAAAuC,aAAA,CAACrC,OAAO;IACJqE,SAAS,EAAE/D,cAAc,CAACgE,WAAY;IACtCC,IAAI,EAAE;MAAEC,IAAI,EAAExC;IAAe,CAAE;IAC/ByC,YAAY,EAAE;EAAI,GAEjBrC,aACI,CAAC,GAEVA,aAEY,CAAC;AAE7B,CAAC;AAED1B,YAAY,CAACgE,WAAW,GAAG,cAAc;AAEzC,eAAehE,YAAY","ignoreList":[]}
|
|
@@ -169,18 +169,6 @@ export const StyledActionButton = styled.button`
|
|
|
169
169
|
background-color: ${`color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};
|
|
170
170
|
}
|
|
171
171
|
`}
|
|
172
|
-
|
|
173
|
-
${({
|
|
174
|
-
$shouldShowKeyboardHighlighting
|
|
175
|
-
}) => $shouldShowKeyboardHighlighting && css`
|
|
176
|
-
&:focus-visible {
|
|
177
|
-
transition: none;
|
|
178
|
-
outline: solid 2px color-mix(in srgb, currentColor 70%, transparent);
|
|
179
|
-
box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);
|
|
180
|
-
outline-offset: 1px;
|
|
181
|
-
color: white;
|
|
182
|
-
}
|
|
183
|
-
`}
|
|
184
172
|
`;
|
|
185
173
|
export const StyledActionContent = styled.span`
|
|
186
174
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.styles.js","names":["motion","styled","css","keyframes","MultiActionButtonStatusType","pulse","color1","color2","StyledActionButton","button","$height","$backgroundColor","theme","primary","$shouldUseContentWidth","$isExpanded","props","$isCollapsed","$isPrimary","$isShrunk","$isSecondary","$isHidden","$isSolo","$isInteractionDisabled","$statusType","$pulseColors","Pulse","$shouldShowKeyboardHighlighting","StyledActionContent","span","StyledIconSlot","$isDisabled","StyledLabelWrapper","StyledSecondaryLabel"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { MultiActionButtonStatusType } from '../MultiActionButton.types';\n\ntype StyledActionButtonProps = WithTheme<{\n $backgroundColor?: string;\n $isCollapsed?: boolean;\n $isExpanded?: boolean;\n $isHidden?: boolean;\n $isPrimary?: boolean;\n $isSecondary?: boolean;\n $isShrunk?: boolean;\n $isSolo?: boolean;\n $pulseColors?: [string, string];\n $isInteractionDisabled?: boolean;\n $height: number;\n $statusType?: MultiActionButtonStatusType;\n $shouldUseContentWidth?: boolean;\n $shouldShowKeyboardHighlighting?: boolean;\n}>;\n\nconst pulse = (color1: string, color2: string) => keyframes`\n 0% {\n background: ${color1};\n }\n 50% {\n background: ${color2};\n }\n 100% {\n background: ${color1};\n }\n`;\n\nexport const StyledActionButton = styled.button<StyledActionButtonProps>`\n align-items: center;\n border: none;\n border-radius: ${({ $height }) => $height / 2}px;\n cursor: pointer;\n display: inline-flex;\n flex: 1 1 auto;\n height: ${({ $height }) => $height}px;\n line-height: 22px;\n min-height: ${({ $height }) => $height}px;\n overflow: hidden;\n padding: 0;\n position: relative;\n transition:\n background-color 0.2s ease,\n border-radius 0.2s ease,\n color 0.2s ease,\n flex-grow 0.2s ease,\n opacity 0.2s ease,\n padding 0.2s ease,\n width 0.2s ease;\n user-select: none;\n white-space: nowrap;\n\n background-color: ${({ $backgroundColor, theme }) =>\n $backgroundColor || theme?.primary || '#000'};\n color: #fff;\n\n /* When width is content-driven, avoid flex stretching. */\n ${({ $shouldUseContentWidth }) =>\n $shouldUseContentWidth &&\n css`\n flex: 0 1 auto;\n `}\n\n /* Expanded secondary button when width is not content-driven. */\n ${({ $isExpanded, $shouldUseContentWidth }) =>\n $isExpanded &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Collapsed state clamps to a fixed icon size. */\n ${(props) =>\n props.$isCollapsed &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Primary action stretches unless content-driven. */\n ${({ $isPrimary, $isCollapsed, $shouldUseContentWidth }) =>\n $isPrimary &&\n !$isCollapsed &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Shrink the primary action to icon size when secondary is expanded. */\n ${(props) =>\n props.$isShrunk &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Keep secondary icon-only when collapsed and not expanded. */\n ${(props) =>\n props.$isSecondary &&\n !props.$isExpanded &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Fully hide the secondary action when the whole control is collapsed. */\n ${({ $isHidden }) =>\n $isHidden &&\n css`\n opacity: 0;\n pointer-events: none;\n width: 0;\n `}\n\n /* Joining both buttons into a pill shape. */\n ${({ $isPrimary }) =>\n $isPrimary &&\n css`\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n `}\n\n ${(props) =>\n props.$isPrimary &&\n props.$isCollapsed &&\n css`\n border-bottom-right-radius: ${props.$height / 2}px;\n border-top-right-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isSecondary }) =>\n $isSecondary &&\n css`\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n `}\n\n ${(props) =>\n props.$isSolo &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${(props) =>\n props.$isCollapsed &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isInteractionDisabled }) =>\n $isInteractionDisabled &&\n css`\n cursor: default;\n `}\n\n /* Optional pulse overlay used by status. */\n ${({ $statusType, $pulseColors }) =>\n $statusType === MultiActionButtonStatusType.Pulse &&\n css`\n overflow: hidden;\n\n &::before {\n animation: ${pulse($pulseColors?.[0] || '#A50000', $pulseColors?.[1] || '#630000')}\n 1.6s ease-in-out infinite;\n border-radius: 3px;\n content: '';\n inset: 0;\n pointer-events: none;\n position: absolute;\n }\n `}\n\n &:disabled {\n cursor: default;\n }\n\n ${({ $isInteractionDisabled, $backgroundColor, theme }) =>\n !$isInteractionDisabled &&\n css`\n &:hover:not(:disabled) {\n background-color: ${`color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};\n }\n `}\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n transition: none;\n outline: solid 2px color-mix(in srgb, currentColor 70%, transparent);\n box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);\n outline-offset: 1px;\n color: white;\n }\n `}\n`;\n\nexport const StyledActionContent = styled.span`\n align-items: center;\n display: inline-flex;\n flex: 1 1 auto;\n gap: 0;\n min-width: 0;\n position: relative;\n z-index: 1;\n`;\n\nexport const StyledIconSlot = styled.span<{ $height: number; $isDisabled?: boolean }>`\n align-items: center;\n display: inline-flex;\n flex: 0 0 auto;\n height: ${({ $height }) => $height}px;\n justify-content: center;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: opacity 0.2s ease;\n width: ${({ $height }) => $height}px;\n`;\n\nexport const StyledLabelWrapper = styled(motion.span)`\n /* The wrapper animates width/margin to avoid layout jumps. */\n display: inline-flex;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-align: left;\n`;\n\nexport const StyledSecondaryLabel = styled.span`\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n padding-right: 18px;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,EAAEC,SAAS,QAAQ,mBAAmB;AAE1D,SAASC,2BAA2B,QAAQ,4BAA4B;AAmBxE,MAAMC,KAAK,GAAGA,CAACC,MAAc,EAAEC,MAAc,KAAKJ,SAAS;AAC3D;AACA,sBAAsBG,MAAM;AAC5B;AACA;AACA,sBAAsBC,MAAM;AAC5B;AACA;AACA,sBAAsBD,MAAM;AAC5B;AACA,CAAC;AAED,OAAO,MAAME,kBAAkB,GAAGP,MAAM,CAACQ,MAA+B;AACxE;AACA;AACA,qBAAqB,CAAC;EAAEC;AAAQ,CAAC,KAAKA,OAAO,GAAG,CAAC;AACjD;AACA;AACA;AACA,cAAc,CAAC;EAAEA;AAAQ,CAAC,KAAKA,OAAO;AACtC;AACA,kBAAkB,CAAC;EAAEA;AAAQ,CAAC,KAAKA,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEC,gBAAgB;EAAEC;AAAM,CAAC,KAC5CD,gBAAgB,IAAIC,KAAK,EAAEC,OAAO,IAAI,MAAM;AACpD;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAuB,CAAC,KACzBA,sBAAsB,IACtBZ,GAAG;AACX;AACA,SAAS;AACT;AACA;AACA,MAAM,CAAC;EAAEa,WAAW;EAAED;AAAuB,CAAC,KACtCC,WAAW,IACX,CAACD,sBAAsB,IACvBZ,GAAG;AACX;AACA;AACA,SAAS;AACT;AACA;AACA,MAAOc,KAAK,IACJA,KAAK,CAACC,YAAY,IAClBf,GAAG;AACX;AACA;AACA,qBAAqBc,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,MAAMI,oBAAoB,GAAGhC,MAAM,CAAC4B,IAAI;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ActionButton.styles.js","names":["motion","styled","css","keyframes","MultiActionButtonStatusType","pulse","color1","color2","StyledActionButton","button","$height","$backgroundColor","theme","primary","$shouldUseContentWidth","$isExpanded","props","$isCollapsed","$isPrimary","$isShrunk","$isSecondary","$isHidden","$isSolo","$isInteractionDisabled","$statusType","$pulseColors","Pulse","StyledActionContent","span","StyledIconSlot","$isDisabled","StyledLabelWrapper","StyledSecondaryLabel"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { MultiActionButtonStatusType } from '../MultiActionButton.types';\n\ntype StyledActionButtonProps = WithTheme<{\n $backgroundColor?: string;\n $isCollapsed?: boolean;\n $isExpanded?: boolean;\n $isHidden?: boolean;\n $isPrimary?: boolean;\n $isSecondary?: boolean;\n $isShrunk?: boolean;\n $isSolo?: boolean;\n $pulseColors?: [string, string];\n $isInteractionDisabled?: boolean;\n $height: number;\n $statusType?: MultiActionButtonStatusType;\n $shouldUseContentWidth?: boolean;\n}>;\n\nconst pulse = (color1: string, color2: string) => keyframes`\n 0% {\n background: ${color1};\n }\n 50% {\n background: ${color2};\n }\n 100% {\n background: ${color1};\n }\n`;\n\nexport const StyledActionButton = styled.button<StyledActionButtonProps>`\n align-items: center;\n border: none;\n border-radius: ${({ $height }) => $height / 2}px;\n cursor: pointer;\n display: inline-flex;\n flex: 1 1 auto;\n height: ${({ $height }) => $height}px;\n line-height: 22px;\n min-height: ${({ $height }) => $height}px;\n overflow: hidden;\n padding: 0;\n position: relative;\n transition:\n background-color 0.2s ease,\n border-radius 0.2s ease,\n color 0.2s ease,\n flex-grow 0.2s ease,\n opacity 0.2s ease,\n padding 0.2s ease,\n width 0.2s ease;\n user-select: none;\n white-space: nowrap;\n\n background-color: ${({ $backgroundColor, theme }) =>\n $backgroundColor || theme?.primary || '#000'};\n color: #fff;\n\n /* When width is content-driven, avoid flex stretching. */\n ${({ $shouldUseContentWidth }) =>\n $shouldUseContentWidth &&\n css`\n flex: 0 1 auto;\n `}\n\n /* Expanded secondary button when width is not content-driven. */\n ${({ $isExpanded, $shouldUseContentWidth }) =>\n $isExpanded &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Collapsed state clamps to a fixed icon size. */\n ${(props) =>\n props.$isCollapsed &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Primary action stretches unless content-driven. */\n ${({ $isPrimary, $isCollapsed, $shouldUseContentWidth }) =>\n $isPrimary &&\n !$isCollapsed &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Shrink the primary action to icon size when secondary is expanded. */\n ${(props) =>\n props.$isShrunk &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Keep secondary icon-only when collapsed and not expanded. */\n ${(props) =>\n props.$isSecondary &&\n !props.$isExpanded &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Fully hide the secondary action when the whole control is collapsed. */\n ${({ $isHidden }) =>\n $isHidden &&\n css`\n opacity: 0;\n pointer-events: none;\n width: 0;\n `}\n\n /* Joining both buttons into a pill shape. */\n ${({ $isPrimary }) =>\n $isPrimary &&\n css`\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n `}\n\n ${(props) =>\n props.$isPrimary &&\n props.$isCollapsed &&\n css`\n border-bottom-right-radius: ${props.$height / 2}px;\n border-top-right-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isSecondary }) =>\n $isSecondary &&\n css`\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n `}\n\n ${(props) =>\n props.$isSolo &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${(props) =>\n props.$isCollapsed &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isInteractionDisabled }) =>\n $isInteractionDisabled &&\n css`\n cursor: default;\n `}\n\n /* Optional pulse overlay used by status. */\n ${({ $statusType, $pulseColors }) =>\n $statusType === MultiActionButtonStatusType.Pulse &&\n css`\n overflow: hidden;\n\n &::before {\n animation: ${pulse($pulseColors?.[0] || '#A50000', $pulseColors?.[1] || '#630000')}\n 1.6s ease-in-out infinite;\n border-radius: 3px;\n content: '';\n inset: 0;\n pointer-events: none;\n position: absolute;\n }\n `}\n\n &:disabled {\n cursor: default;\n }\n\n ${({ $isInteractionDisabled, $backgroundColor, theme }) =>\n !$isInteractionDisabled &&\n css`\n &:hover:not(:disabled) {\n background-color: ${`color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};\n }\n `}\n`;\n\nexport const StyledActionContent = styled.span`\n align-items: center;\n display: inline-flex;\n flex: 1 1 auto;\n gap: 0;\n min-width: 0;\n position: relative;\n z-index: 1;\n`;\n\nexport const StyledIconSlot = styled.span<{ $height: number; $isDisabled?: boolean }>`\n align-items: center;\n display: inline-flex;\n flex: 0 0 auto;\n height: ${({ $height }) => $height}px;\n justify-content: center;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: opacity 0.2s ease;\n width: ${({ $height }) => $height}px;\n`;\n\nexport const StyledLabelWrapper = styled(motion.span)`\n /* The wrapper animates width/margin to avoid layout jumps. */\n display: inline-flex;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-align: left;\n`;\n\nexport const StyledSecondaryLabel = styled.span`\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n padding-right: 18px;\n text-overflow: ellipsis;\n white-space: nowrap;\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KAAKpB,2BAA2B,CAACsB,KAAK,IACjDxB,GAAG;AACX;AACA;AACA;AACA,6BAA6BG,KAAK,CAACoB,YAAY,GAAG,CAAC,CAAC,IAAI,SAAS,EAAEA,YAAY,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEF,sBAAsB;EAAEZ,gBAAgB;EAAEC;AAAM,CAAC,KAClD,CAACW,sBAAsB,IACvBrB,GAAG;AACX;AACA,oCAAoC,sBAAsBS,gBAAgB,IAAIC,KAAK,EAAEC,OAAO,IAAI,MAAM,cAAc;AACpH;AACA,SAAS;AACT,CAAC;AAED,OAAO,MAAMc,mBAAmB,GAAG1B,MAAM,CAAC2B,IAAI;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG5B,MAAM,CAAC2B,IAAgD;AACrF;AACA;AACA;AACA,cAAc,CAAC;EAAElB;AAAQ,CAAC,KAAKA,OAAO;AACtC;AACA,eAAe,CAAC;EAAEoB;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA,aAAa,CAAC;EAAEpB;AAAQ,CAAC,KAAKA,OAAO;AACrC,CAAC;AAED,OAAO,MAAMqB,kBAAkB,GAAG9B,MAAM,CAACD,MAAM,CAAC4B,IAAI,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMI,oBAAoB,GAAG/B,MAAM,CAAC2B,IAAI;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ import Input from '../input/Input';
|
|
|
6
6
|
const NumberInput = t0 => {
|
|
7
7
|
"use memo";
|
|
8
8
|
|
|
9
|
-
const $ = _c(
|
|
9
|
+
const $ = _c(41);
|
|
10
10
|
const {
|
|
11
11
|
isDecimalInput,
|
|
12
12
|
isMoneyInput,
|
|
@@ -20,8 +20,7 @@ const NumberInput = t0 => {
|
|
|
20
20
|
isDisabled,
|
|
21
21
|
onChange,
|
|
22
22
|
shouldShowOnlyBottomBorder,
|
|
23
|
-
minNumber: t3
|
|
24
|
-
shouldEnableKeyboardHighlighting
|
|
23
|
+
minNumber: t3
|
|
25
24
|
} = t0;
|
|
26
25
|
const maxNumber = t1 === undefined ? Infinity : t1;
|
|
27
26
|
const shouldTriggerChangeOnFormat = t2 === undefined ? true : t2;
|
|
@@ -199,7 +198,7 @@ const NumberInput = t0 => {
|
|
|
199
198
|
const t11 = hasFocus ? plainText : formattedValue;
|
|
200
199
|
const t12 = typeof isInvalid === "boolean" ? isInvalid : isValueInvalid;
|
|
201
200
|
let t13;
|
|
202
|
-
if ($[31] !== isDisabled || $[32] !== localPlaceholder || $[33] !== onLocalBlur || $[34] !== onLocalChange || $[35] !== onLocalFocus || $[36] !==
|
|
201
|
+
if ($[31] !== isDisabled || $[32] !== localPlaceholder || $[33] !== onLocalBlur || $[34] !== onLocalChange || $[35] !== onLocalFocus || $[36] !== shouldRemainPlaceholder || $[37] !== shouldShowOnlyBottomBorder || $[38] !== t11 || $[39] !== t12) {
|
|
203
202
|
t13 = /*#__PURE__*/React.createElement(Input, {
|
|
204
203
|
shouldRemainPlaceholder: shouldRemainPlaceholder,
|
|
205
204
|
shouldShowOnlyBottomBorder: shouldShowOnlyBottomBorder,
|
|
@@ -211,22 +210,20 @@ const NumberInput = t0 => {
|
|
|
211
210
|
onFocus: onLocalFocus,
|
|
212
211
|
isDisabled: isDisabled,
|
|
213
212
|
isInvalid: t12,
|
|
214
|
-
shouldShowCenteredContent: shouldShowOnlyBottomBorder
|
|
215
|
-
shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlighting
|
|
213
|
+
shouldShowCenteredContent: shouldShowOnlyBottomBorder
|
|
216
214
|
});
|
|
217
215
|
$[31] = isDisabled;
|
|
218
216
|
$[32] = localPlaceholder;
|
|
219
217
|
$[33] = onLocalBlur;
|
|
220
218
|
$[34] = onLocalChange;
|
|
221
219
|
$[35] = onLocalFocus;
|
|
222
|
-
$[36] =
|
|
223
|
-
$[37] =
|
|
224
|
-
$[38] =
|
|
225
|
-
$[39] =
|
|
226
|
-
$[40] =
|
|
227
|
-
$[41] = t13;
|
|
220
|
+
$[36] = shouldRemainPlaceholder;
|
|
221
|
+
$[37] = shouldShowOnlyBottomBorder;
|
|
222
|
+
$[38] = t11;
|
|
223
|
+
$[39] = t12;
|
|
224
|
+
$[40] = t13;
|
|
228
225
|
} else {
|
|
229
|
-
t13 = $[
|
|
226
|
+
t13 = $[40];
|
|
230
227
|
}
|
|
231
228
|
return t13;
|
|
232
229
|
};
|