@chayns-components/core 5.3.9 → 5.3.11-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +73 -2
- package/lib/cjs/components/accordion/Accordion.js +107 -12
- package/lib/cjs/components/accordion/Accordion.js.map +1 -1
- package/lib/cjs/components/accordion/Accordion.styles.js +23 -3
- package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js +36 -19
- package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.js +6 -3
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/cjs/components/amount-control/AmountControl.js +31 -17
- package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
- package/lib/cjs/components/amount-control/AmountControl.styles.js +18 -2
- package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
- package/lib/cjs/components/button/Button.js +5 -1
- package/lib/cjs/components/button/Button.js.map +1 -1
- package/lib/cjs/components/button/Button.styles.js +17 -0
- package/lib/cjs/components/button/Button.styles.js.map +1 -1
- package/lib/cjs/components/button/Button.types.js.map +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +5 -1
- package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
- package/lib/cjs/components/checkbox/Checkbox.styles.js +29 -2
- package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.js +52 -5
- package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.styles.js +11 -0
- package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.types.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.js +100 -6
- package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.styles.js +38 -0
- package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.types.js.map +1 -1
- package/lib/cjs/components/file-input/FileInput.js +4 -2
- package/lib/cjs/components/file-input/FileInput.js.map +1 -1
- package/lib/cjs/components/file-list/file-item/FileItem.js +23 -2
- package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
- package/lib/cjs/components/file-list/file-item/FileItem.styles.js +19 -1
- package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.js +27 -4
- package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.styles.js +10 -0
- package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/cjs/components/filter/Filter.js +51 -16
- package/lib/cjs/components/filter/Filter.js.map +1 -1
- package/lib/cjs/components/filter/Filter.styles.js +9 -0
- package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.js +14 -5
- package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -1
- package/lib/cjs/components/filter-buttons/FilterButtons.js +69 -4
- package/lib/cjs/components/filter-buttons/FilterButtons.js.map +1 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +40 -2
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
- package/lib/cjs/components/grid-image/GridImage.js +20 -2
- package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
- package/lib/cjs/components/grid-image/GridImage.styles.js +11 -2
- package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.js +23 -4
- package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js +9 -0
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/cjs/components/highlight-slider/HighlightSlider.js +10 -3
- package/lib/cjs/components/highlight-slider/HighlightSlider.js.map +1 -1
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +21 -4
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +11 -2
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
- package/lib/cjs/components/icon/Icon.js +24 -5
- package/lib/cjs/components/icon/Icon.js.map +1 -1
- package/lib/cjs/components/icon/Icon.styles.js +23 -0
- package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
- package/lib/cjs/components/input/Input.js +29 -8
- package/lib/cjs/components/input/Input.js.map +1 -1
- package/lib/cjs/components/input/Input.styles.js +33 -3
- package/lib/cjs/components/input/Input.styles.js.map +1 -1
- package/lib/cjs/components/list/List.js +124 -37
- package/lib/cjs/components/list/List.js.map +1 -1
- package/lib/cjs/components/list/List.utils.js +107 -1
- package/lib/cjs/components/list/List.utils.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.js +82 -3
- package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.styles.js +9 -0
- package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +40 -5
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js +5 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +32 -1
- 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 +32 -1
- 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 +30 -1
- package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
- package/lib/cjs/components/list/list-item/useListItemFocus.js +47 -0
- package/lib/cjs/components/list/list-item/useListItemFocus.js.map +1 -0
- package/lib/cjs/components/masonry/Masonry.context.js +17 -0
- package/lib/cjs/components/masonry/Masonry.context.js.map +1 -0
- package/lib/cjs/components/masonry/Masonry.hooks.js +53 -0
- package/lib/cjs/components/masonry/Masonry.hooks.js.map +1 -0
- package/lib/cjs/components/masonry/Masonry.js +81 -0
- package/lib/cjs/components/masonry/Masonry.js.map +1 -0
- package/lib/cjs/components/masonry/Masonry.styles.js +16 -0
- package/lib/cjs/components/masonry/Masonry.styles.js.map +1 -0
- package/lib/cjs/components/masonry/Masonry.types.js +6 -0
- package/lib/cjs/components/masonry/Masonry.types.js.map +1 -0
- package/lib/cjs/components/masonry/Masonry.utils.js +121 -0
- package/lib/cjs/components/masonry/Masonry.utils.js.map +1 -0
- package/lib/cjs/components/masonry/masonry-item/MasonryItem.js +77 -0
- package/lib/cjs/components/masonry/masonry-item/MasonryItem.js.map +1 -0
- package/lib/cjs/components/masonry/masonry-item/MasonryItem.styles.js +17 -0
- package/lib/cjs/components/masonry/masonry-item/MasonryItem.styles.js.map +1 -0
- package/lib/cjs/components/mention-finder/MentionFinder.js +31 -2
- package/lib/cjs/components/mention-finder/MentionFinder.js.map +1 -1
- package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
- package/lib/cjs/components/multi-action-button/MultiActionButton.js +36 -3
- package/lib/cjs/components/multi-action-button/MultiActionButton.js.map +1 -1
- package/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +7 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/cjs/components/number-input/NumberInput.js +13 -10
- package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
- package/lib/cjs/components/page-provider/PageProvider.js +4 -2
- package/lib/cjs/components/page-provider/PageProvider.js.map +1 -1
- package/lib/cjs/components/popup/Popup.js +8 -1
- package/lib/cjs/components/popup/Popup.js.map +1 -1
- package/lib/cjs/components/radio-button/RadioButton.js +29 -15
- package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
- package/lib/cjs/components/radio-button/RadioButton.styles.js +19 -8
- package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
- package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
- package/lib/cjs/components/search-box/SearchBox.js +5 -2
- package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.js +40 -41
- package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.styles.js +25 -2
- package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/cjs/components/select-button/SelectButton.js +4 -2
- package/lib/cjs/components/select-button/SelectButton.js.map +1 -1
- package/lib/cjs/components/setup-wizard/SetupWizard.js +7 -4
- package/lib/cjs/components/setup-wizard/SetupWizard.js.map +1 -1
- package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
- package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
- package/lib/cjs/components/sharing-bar/SharingBar.js +31 -6
- package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/cjs/components/sharing-bar/SharingBar.styles.js +5 -0
- package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
- package/lib/cjs/components/sharing-button/SharingButton.js +4 -2
- package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +3 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/cjs/components/signature/Signature.js +6 -3
- package/lib/cjs/components/signature/Signature.js.map +1 -1
- package/lib/cjs/components/slider/Slider.js +30 -7
- package/lib/cjs/components/slider/Slider.js.map +1 -1
- package/lib/cjs/components/slider/Slider.styles.js +9 -2
- package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.js +63 -6
- package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.styles.js +19 -2
- package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.types.js +6 -0
- package/lib/cjs/components/slider-button/SliderButton.types.js.map +1 -0
- package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js +66 -0
- package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
- package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js +47 -0
- package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
- package/lib/cjs/components/tag-input/TagInput.js +91 -36
- package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
- package/lib/cjs/components/tag-input/TagInput.styles.js +31 -3
- package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.js +17 -8
- package/lib/cjs/components/text-area/TextArea.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.styles.js +15 -1
- package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.js +17 -3
- package/lib/cjs/components/truncation/Truncation.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.styles.js +19 -1
- package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +68 -0
- package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -0
- package/lib/cjs/index.js +7 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/file.js.map +1 -1
- package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +30 -0
- package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +1 -0
- package/lib/esm/components/accordion/Accordion.js +105 -12
- package/lib/esm/components/accordion/Accordion.js.map +1 -1
- package/lib/esm/components/accordion/Accordion.styles.js +23 -3
- package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
- package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/esm/components/accordion/accordion-group/AccordionGroup.js +33 -19
- package/lib/esm/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
- package/lib/esm/components/accordion/accordion-head/AccordionHead.js +6 -3
- package/lib/esm/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
- package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/esm/components/amount-control/AmountControl.js +30 -16
- package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
- package/lib/esm/components/amount-control/AmountControl.styles.js +18 -2
- package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
- package/lib/esm/components/button/Button.js +5 -1
- package/lib/esm/components/button/Button.js.map +1 -1
- package/lib/esm/components/button/Button.styles.js +17 -0
- package/lib/esm/components/button/Button.styles.js.map +1 -1
- package/lib/esm/components/button/Button.types.js.map +1 -1
- package/lib/esm/components/checkbox/Checkbox.js +5 -1
- package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
- package/lib/esm/components/checkbox/Checkbox.styles.js +29 -2
- package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.js +50 -5
- package/lib/esm/components/combobox/ComboBox.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.styles.js +11 -0
- package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.js +99 -5
- package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.styles.js +38 -0
- package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
- package/lib/esm/components/file-input/FileInput.js +4 -2
- package/lib/esm/components/file-input/FileInput.js.map +1 -1
- package/lib/esm/components/file-list/file-item/FileItem.js +24 -3
- package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
- package/lib/esm/components/file-list/file-item/FileItem.styles.js +18 -0
- package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.js +27 -4
- package/lib/esm/components/file-select/FileSelect.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.styles.js +10 -0
- package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/esm/components/filter/Filter.js +52 -16
- package/lib/esm/components/filter/Filter.js.map +1 -1
- package/lib/esm/components/filter/Filter.styles.js +9 -0
- package/lib/esm/components/filter/Filter.styles.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FilterContent.js +15 -5
- package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -1
- package/lib/esm/components/filter-buttons/FilterButtons.js +69 -5
- package/lib/esm/components/filter-buttons/FilterButtons.js.map +1 -1
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +40 -2
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
- package/lib/esm/components/grid-image/GridImage.js +20 -2
- package/lib/esm/components/grid-image/GridImage.js.map +1 -1
- package/lib/esm/components/grid-image/GridImage.styles.js +10 -1
- package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.js +22 -4
- package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.styles.js +9 -0
- package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/esm/components/highlight-slider/HighlightSlider.js +10 -3
- package/lib/esm/components/highlight-slider/HighlightSlider.js.map +1 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +20 -3
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +10 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
- package/lib/esm/components/icon/Icon.js +26 -7
- package/lib/esm/components/icon/Icon.js.map +1 -1
- package/lib/esm/components/icon/Icon.styles.js +23 -0
- package/lib/esm/components/icon/Icon.styles.js.map +1 -1
- package/lib/esm/components/input/Input.js +24 -4
- package/lib/esm/components/input/Input.js.map +1 -1
- package/lib/esm/components/input/Input.styles.js +33 -3
- package/lib/esm/components/input/Input.styles.js.map +1 -1
- package/lib/esm/components/list/List.js +123 -37
- package/lib/esm/components/list/List.js.map +1 -1
- package/lib/esm/components/list/List.utils.js +99 -0
- package/lib/esm/components/list/List.utils.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.js +83 -4
- package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.styles.js +9 -0
- package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +41 -6
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js +4 -0
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +33 -2
- 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 +33 -2
- 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 +30 -1
- package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
- package/lib/esm/components/list/list-item/useListItemFocus.js +40 -0
- package/lib/esm/components/list/list-item/useListItemFocus.js.map +1 -0
- package/lib/esm/components/masonry/Masonry.context.js +10 -0
- package/lib/esm/components/masonry/Masonry.context.js.map +1 -0
- package/lib/esm/components/masonry/Masonry.hooks.js +44 -0
- package/lib/esm/components/masonry/Masonry.hooks.js.map +1 -0
- package/lib/esm/components/masonry/Masonry.js +74 -0
- package/lib/esm/components/masonry/Masonry.js.map +1 -0
- package/lib/esm/components/masonry/Masonry.styles.js +9 -0
- package/lib/esm/components/masonry/Masonry.styles.js.map +1 -0
- package/lib/esm/components/masonry/Masonry.types.js +2 -0
- package/lib/esm/components/masonry/Masonry.types.js.map +1 -0
- package/lib/esm/components/masonry/Masonry.utils.js +110 -0
- package/lib/esm/components/masonry/Masonry.utils.js.map +1 -0
- package/lib/esm/components/masonry/masonry-item/MasonryItem.js +69 -0
- package/lib/esm/components/masonry/masonry-item/MasonryItem.js.map +1 -0
- package/lib/esm/components/masonry/masonry-item/MasonryItem.styles.js +10 -0
- package/lib/esm/components/masonry/masonry-item/MasonryItem.styles.js.map +1 -0
- package/lib/esm/components/mention-finder/MentionFinder.js +30 -2
- package/lib/esm/components/mention-finder/MentionFinder.js.map +1 -1
- package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
- package/lib/esm/components/multi-action-button/MultiActionButton.js +36 -3
- package/lib/esm/components/multi-action-button/MultiActionButton.js.map +1 -1
- package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/esm/components/number-input/NumberInput.js +13 -10
- package/lib/esm/components/number-input/NumberInput.js.map +1 -1
- package/lib/esm/components/page-provider/PageProvider.js +4 -2
- package/lib/esm/components/page-provider/PageProvider.js.map +1 -1
- package/lib/esm/components/popup/Popup.js +8 -1
- package/lib/esm/components/popup/Popup.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.js +29 -15
- package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.styles.js +19 -8
- package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
- package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
- package/lib/esm/components/search-box/SearchBox.js +5 -2
- package/lib/esm/components/search-box/SearchBox.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.js +41 -42
- package/lib/esm/components/search-input/SearchInput.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.styles.js +24 -1
- package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/esm/components/select-button/SelectButton.js +4 -2
- package/lib/esm/components/select-button/SelectButton.js.map +1 -1
- package/lib/esm/components/setup-wizard/SetupWizard.js +7 -4
- package/lib/esm/components/setup-wizard/SetupWizard.js.map +1 -1
- package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
- package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
- package/lib/esm/components/sharing-bar/SharingBar.js +30 -5
- package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/esm/components/sharing-bar/SharingBar.styles.js +5 -0
- package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
- package/lib/esm/components/sharing-button/SharingButton.js +4 -2
- package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +3 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/esm/components/signature/Signature.js +6 -3
- package/lib/esm/components/signature/Signature.js.map +1 -1
- package/lib/esm/components/slider/Slider.js +30 -7
- package/lib/esm/components/slider/Slider.js.map +1 -1
- package/lib/esm/components/slider/Slider.styles.js +8 -1
- package/lib/esm/components/slider/Slider.styles.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.js +62 -6
- package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.styles.js +18 -1
- package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.types.js +2 -0
- package/lib/esm/components/slider-button/SliderButton.types.js.map +1 -0
- package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js +56 -0
- package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
- package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js +38 -0
- package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
- package/lib/esm/components/tag-input/TagInput.js +85 -35
- package/lib/esm/components/tag-input/TagInput.js.map +1 -1
- package/lib/esm/components/tag-input/TagInput.styles.js +29 -1
- package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.js +18 -9
- package/lib/esm/components/text-area/TextArea.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.styles.js +14 -0
- package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.js +18 -4
- package/lib/esm/components/truncation/Truncation.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.styles.js +18 -0
- package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/esm/hooks/useKeyboardFocusHighlighting.js +61 -0
- package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/file.js.map +1 -1
- package/lib/esm/utils/keyboardFocusHighlighting.styles.js +25 -0
- package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +1 -0
- package/lib/types/components/accordion/Accordion.d.ts +5 -0
- package/lib/types/components/accordion/Accordion.styles.d.ts +8 -4
- package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +2 -2
- package/lib/types/components/accordion/accordion-group/AccordionGroup.d.ts +7 -2
- package/lib/types/components/accordion/accordion-head/AccordionHead.d.ts +1 -0
- package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +18 -18
- package/lib/types/components/amount-control/AmountControl.d.ts +5 -0
- package/lib/types/components/amount-control/AmountControl.styles.d.ts +8 -4
- package/lib/types/components/button/Button.styles.d.ts +8 -6
- package/lib/types/components/button/Button.types.d.ts +8 -0
- package/lib/types/components/checkbox/Checkbox.d.ts +4 -0
- package/lib/types/components/checkbox/Checkbox.styles.d.ts +5 -1
- package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +5 -0
- package/lib/types/components/combobox/ComboBox.styles.d.ts +4 -2
- package/lib/types/components/combobox/ComboBox.types.d.ts +5 -0
- package/lib/types/components/context-menu/ContextMenu.styles.d.ts +4 -2
- package/lib/types/components/context-menu/ContextMenu.types.d.ts +6 -0
- package/lib/types/components/context-menu/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 +4 -0
- package/lib/types/components/file-input/FileInput.styles.d.ts +2 -2
- package/lib/types/components/file-list/file-item/FileItem.styles.d.ts +3 -0
- package/lib/types/components/file-select/FileSelect.d.ts +4 -0
- package/lib/types/components/file-select/FileSelect.styles.d.ts +6 -4
- package/lib/types/components/filter/Filter.d.ts +1 -0
- package/lib/types/components/filter/Filter.styles.d.ts +6 -4
- package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +4 -0
- package/lib/types/components/filter-buttons/FilterButtons.d.ts +4 -0
- package/lib/types/components/filter-buttons/filter-button/FilterButton.d.ts +5 -0
- package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +12 -8
- package/lib/types/components/grid-image/GridImage.d.ts +4 -0
- package/lib/types/components/grid-image/GridImage.styles.d.ts +4 -2
- package/lib/types/components/grouped-image/GroupedImage.d.ts +4 -0
- package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +8 -6
- package/lib/types/components/highlight-slider/HighlightSlider.d.ts +4 -0
- package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.d.ts +3 -0
- package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +9 -5
- package/lib/types/components/icon/Icon.d.ts +4 -0
- package/lib/types/components/icon/Icon.styles.d.ts +1 -0
- package/lib/types/components/input/Input.d.ts +4 -0
- package/lib/types/components/input/Input.styles.d.ts +17 -9
- package/lib/types/components/list/List.d.ts +11 -0
- package/lib/types/components/list/List.utils.d.ts +16 -1
- 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 +1 -0
- package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +195 -194
- package/lib/types/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.d.ts +1 -0
- package/lib/types/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.d.ts +1 -0
- package/lib/types/components/list/list-item/list-item-head/list-item-title/ListItemTitle.d.ts +1 -0
- package/lib/types/components/list/list-item/useListItemFocus.d.ts +13 -0
- package/lib/types/components/masonry/Masonry.context.d.ts +3 -0
- package/lib/types/components/masonry/Masonry.d.ts +3 -0
- package/lib/types/components/masonry/Masonry.hooks.d.ts +22 -0
- package/lib/types/components/masonry/Masonry.styles.d.ts +5 -0
- package/lib/types/components/masonry/Masonry.types.d.ts +40 -0
- package/lib/types/components/masonry/Masonry.utils.d.ts +22 -0
- package/lib/types/components/masonry/masonry-item/MasonryItem.d.ts +5 -0
- package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +5 -0
- package/lib/types/components/mention-finder/MentionFinder.styles.d.ts +4 -4
- package/lib/types/components/multi-action-button/MultiActionButton.styles.d.ts +2 -2
- package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +7 -0
- package/lib/types/components/multi-action-button/action-button/ActionButton.d.ts +4 -1
- package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +4 -2
- package/lib/types/components/number-input/NumberInput.d.ts +4 -0
- package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +2 -2
- package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +6 -6
- package/lib/types/components/radio-button/RadioButton.d.ts +4 -0
- package/lib/types/components/radio-button/RadioButton.styles.d.ts +15 -9
- package/lib/types/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +5 -0
- package/lib/types/components/search-box/SearchBox.d.ts +4 -0
- package/lib/types/components/search-box/SearchBox.styles.d.ts +2 -2
- package/lib/types/components/search-input/SearchInput.d.ts +4 -0
- package/lib/types/components/search-input/SearchInput.styles.d.ts +17 -9
- package/lib/types/components/select-button/SelectButton.d.ts +4 -0
- package/lib/types/components/setup-wizard/SetupWizard.d.ts +5 -0
- package/lib/types/components/sharing-bar/SharingBar.d.ts +4 -0
- package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
- package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +10 -2
- package/lib/types/components/signature/Signature.d.ts +4 -0
- package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +4 -4
- package/lib/types/components/slider/Slider.d.ts +8 -0
- package/lib/types/components/slider/Slider.styles.d.ts +18 -14
- package/lib/types/components/slider-button/SliderButton.d.ts +1 -28
- package/lib/types/components/slider-button/SliderButton.styles.d.ts +6 -4
- package/lib/types/components/slider-button/SliderButton.types.d.ts +32 -0
- package/lib/types/components/slider-button/useSliderButtonPopupKeyboard.d.ts +17 -0
- package/lib/types/components/slider-button/useSliderButtonThumbKeyboard.d.ts +13 -0
- package/lib/types/components/tag-input/TagInput.d.ts +4 -0
- package/lib/types/components/tag-input/TagInput.styles.d.ts +12 -2
- package/lib/types/components/text-area/TextArea.d.ts +4 -0
- package/lib/types/components/text-area/TextArea.styles.d.ts +1 -0
- package/lib/types/components/truncation/Truncation.d.ts +4 -0
- package/lib/types/components/truncation/Truncation.styles.d.ts +7 -2
- package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +5 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/utils/file.d.ts +1 -1
- package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +9 -0
- package/package.json +2 -2
package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemSubtitle.js","names":["_react","_interopRequireWildcard","require","_ListItemSubtitle","_accordion","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ListItemSubtitle","rightElements","subtitle","isOpen","handlePreventClick","event","stopPropagation","preventDefault","bottomElement","useMemo","bottom","undefined","shouldPreventRightElementClick","getElementClickEvent","createElement","StyledListItemSubtitle","StyledListItemHeadSubtitleText","$isOpen","StyledListItemBottomRightElement","onClick","displayName","_default","exports"],"sources":["../../../../../../../src/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.tsx"],"sourcesContent":["import React, { FC, ReactNode, useMemo } from 'react';\nimport type { IListItemRightElement, IListItemRightElements } from '../../../../../types/list';\nimport {\n StyledListItemHeadSubtitleText,\n StyledListItemSubtitle,\n StyledListItemBottomRightElement,\n} from './ListItemSubtitle.styles';\nimport { getElementClickEvent } from '../../../../../utils/accordion';\n\ntype ListItemSubtitleProps = {\n rightElements?: IListItemRightElements;\n subtitle?: ReactNode;\n isOpen: boolean;\n};\n\nconst ListItemSubtitle: FC<ListItemSubtitleProps> = ({
|
|
1
|
+
{"version":3,"file":"ListItemSubtitle.js","names":["_react","_interopRequireWildcard","require","_ListItemSubtitle","_accordion","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ListItemSubtitle","rightElements","subtitle","isOpen","shouldAllowRightElementFocus","bottomElementRef","useRef","handlePreventClick","event","stopPropagation","preventDefault","bottomElement","useMemo","bottom","undefined","shouldPreventRightElementClick","getElementClickEvent","useEffect","bottomElementWrapper","current","focusableElements","Array","from","querySelectorAll","forEach","element","currentElement","datasetKey","originalTabIndex","dataset","removeAttribute","setAttribute","getAttribute","createElement","StyledListItemSubtitle","StyledListItemHeadSubtitleText","$isOpen","StyledListItemBottomRightElement","ref","onClick","displayName","_default","exports"],"sources":["../../../../../../../src/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.tsx"],"sourcesContent":["import React, { FC, ReactNode, useEffect, useMemo, useRef } from 'react';\nimport type { IListItemRightElement, IListItemRightElements } from '../../../../../types/list';\nimport {\n StyledListItemHeadSubtitleText,\n StyledListItemSubtitle,\n StyledListItemBottomRightElement,\n} from './ListItemSubtitle.styles';\nimport { getElementClickEvent } from '../../../../../utils/accordion';\n\ntype ListItemSubtitleProps = {\n rightElements?: IListItemRightElements;\n subtitle?: ReactNode;\n isOpen: boolean;\n shouldAllowRightElementFocus?: boolean;\n};\n\nconst ListItemSubtitle: FC<ListItemSubtitleProps> = ({\n rightElements,\n subtitle,\n isOpen,\n shouldAllowRightElementFocus = true,\n}) => {\n const bottomElementRef = useRef<HTMLDivElement>(null);\n\n const handlePreventClick = (event: React.MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n };\n\n const bottomElement = useMemo(() => {\n if (typeof rightElements === 'object' && rightElements && 'bottom' in rightElements) {\n return (rightElements as unknown as IListItemRightElement).bottom;\n }\n\n return undefined;\n }, [rightElements]);\n\n const shouldPreventRightElementClick = useMemo(() => {\n if (bottomElement) {\n return getElementClickEvent(bottomElement);\n }\n\n return false;\n }, [bottomElement]);\n\n useEffect(() => {\n const bottomElementWrapper = bottomElementRef.current;\n\n if (!bottomElementWrapper) {\n return;\n }\n\n const focusableElements = Array.from(\n bottomElementWrapper.querySelectorAll<HTMLElement>(\n 'a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]',\n ),\n );\n\n focusableElements.forEach((element) => {\n const currentElement = element;\n const datasetKey = 'listItemRightElementOriginalTabIndex';\n\n if (shouldAllowRightElementFocus) {\n const originalTabIndex = currentElement.dataset[datasetKey];\n\n if (typeof originalTabIndex === 'string') {\n if (originalTabIndex === '') {\n currentElement.removeAttribute('tabindex');\n } else {\n currentElement.setAttribute('tabindex', originalTabIndex);\n }\n\n delete currentElement.dataset[datasetKey];\n }\n } else {\n if (typeof currentElement.dataset[datasetKey] !== 'string') {\n currentElement.dataset[datasetKey] =\n currentElement.getAttribute('tabindex') ?? '';\n }\n\n currentElement.setAttribute('tabindex', '-1');\n }\n });\n }, [bottomElement, shouldAllowRightElementFocus]);\n\n return (\n <StyledListItemSubtitle>\n <StyledListItemHeadSubtitleText $isOpen={isOpen}>\n {subtitle}\n </StyledListItemHeadSubtitleText>\n {bottomElement && (\n <StyledListItemBottomRightElement\n data-right-element=\"true\"\n ref={bottomElementRef}\n onClick={shouldPreventRightElementClick ? handlePreventClick : undefined}\n >\n {bottomElement}\n </StyledListItemBottomRightElement>\n )}\n </StyledListItemSubtitle>\n );\n};\n\nListItemSubtitle.displayName = 'ListItemSubtitle';\n\nexport default ListItemSubtitle;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAF,OAAA;AAAsE,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CA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AC,CAAC;EACN,CAAC,EAAE,CAACpB,aAAa,EAAEP,4BAA4B,CAAC,CAAC;EAEjD,oBACI5B,MAAA,CAAAe,OAAA,CAAA0C,aAAA,CAACtD,iBAAA,CAAAuD,sBAAsB,qBACnB1D,MAAA,CAAAe,OAAA,CAAA0C,aAAA,CAACtD,iBAAA,CAAAwD,8BAA8B;IAACC,OAAO,EAAEjC;EAAO,GAC3CD,QAC2B,CAAC,EAChCS,aAAa,iBACVnC,MAAA,CAAAe,OAAA,CAAA0C,aAAA,CAACtD,iBAAA,CAAA0D,gCAAgC;IAC7B,sBAAmB,MAAM;IACzBC,GAAG,EAAEjC,gBAAiB;IACtBkC,OAAO,EAAExB,8BAA8B,GAAGR,kBAAkB,GAAGO;EAAU,GAExEH,aAC6B,CAElB,CAAC;AAEjC,CAAC;AAEDX,gBAAgB,CAACwC,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAEnCS,gBAAgB","ignoreList":[]}
|
|
@@ -15,7 +15,8 @@ const ListItemTitle = ({
|
|
|
15
15
|
shouldShowMultilineTitle,
|
|
16
16
|
isOpen,
|
|
17
17
|
onResize,
|
|
18
|
-
onTitleWidthChange
|
|
18
|
+
onTitleWidthChange,
|
|
19
|
+
shouldAllowRightElementFocus = true
|
|
19
20
|
}) => {
|
|
20
21
|
const titleWrapperRef = (0, _react.useRef)(null);
|
|
21
22
|
const wrapperRef = (0, _react.useRef)(null);
|
|
@@ -60,6 +61,33 @@ const ListItemTitle = ({
|
|
|
60
61
|
}
|
|
61
62
|
return false;
|
|
62
63
|
}, [topElement]);
|
|
64
|
+
(0, _react.useEffect)(() => {
|
|
65
|
+
const topElementWrapper = topElementWrapperRef.current;
|
|
66
|
+
if (!topElementWrapper) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const focusableElements = Array.from(topElementWrapper.querySelectorAll('a[href], button, input, select, textarea, [tabindex], [contenteditable="true"]'));
|
|
70
|
+
focusableElements.forEach(element => {
|
|
71
|
+
const currentElement = element;
|
|
72
|
+
const datasetKey = 'listItemRightElementOriginalTabIndex';
|
|
73
|
+
if (shouldAllowRightElementFocus) {
|
|
74
|
+
const originalTabIndex = currentElement.dataset[datasetKey];
|
|
75
|
+
if (typeof originalTabIndex === 'string') {
|
|
76
|
+
if (originalTabIndex === '') {
|
|
77
|
+
currentElement.removeAttribute('tabindex');
|
|
78
|
+
} else {
|
|
79
|
+
currentElement.setAttribute('tabindex', originalTabIndex);
|
|
80
|
+
}
|
|
81
|
+
delete currentElement.dataset[datasetKey];
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
if (typeof currentElement.dataset[datasetKey] !== 'string') {
|
|
85
|
+
currentElement.dataset[datasetKey] = currentElement.getAttribute('tabindex') ?? '';
|
|
86
|
+
}
|
|
87
|
+
currentElement.setAttribute('tabindex', '-1');
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}, [shouldAllowRightElementFocus, topElement]);
|
|
63
91
|
return /*#__PURE__*/_react.default.createElement(_ListItemTitle.StyledListItemTitle, {
|
|
64
92
|
ref: wrapperRef
|
|
65
93
|
}, /*#__PURE__*/_react.default.createElement(_ListItemTitle.StyledListItemTitleLeftWrapper, null, /*#__PURE__*/_react.default.createElement(_ListItemTitle.StyledListItemHeadTitleText, {
|
|
@@ -69,6 +97,7 @@ const ListItemTitle = ({
|
|
|
69
97
|
}, title), /*#__PURE__*/_react.default.createElement(_ListItemTitle.StyledListItemHeadTitleElement, {
|
|
70
98
|
ref: elementWrapperRef
|
|
71
99
|
}, titleElement)), topElement && /*#__PURE__*/_react.default.createElement(_ListItemTitle.StyledListItemTopRightElement, {
|
|
100
|
+
"data-right-element": "true",
|
|
72
101
|
ref: topElementWrapperRef,
|
|
73
102
|
onClick: shouldPreventRightElementClick ? handlePreventClick : undefined
|
|
74
103
|
}, topElement));
|
package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemTitle.js","names":["_react","_interopRequireWildcard","require","_ListItemTitle","_accordion","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ListItemTitle","rightElements","titleElement","title","shouldShowMultilineTitle","isOpen","onResize","onTitleWidthChange","titleWrapperRef","useRef","wrapperRef","elementWrapperRef","topElementWrapperRef","useEffect","element","current","undefined","resizeObserver","ResizeObserver","observe","disconnect","_topElementWrapperRef","fullWidth","clientWidth","rightElementWidth","topElementWidth","width","handlePreventClick","event","stopPropagation","preventDefault","topElement","useMemo","top","shouldPreventRightElementClick","getElementClickEvent","createElement","StyledListItemTitle","ref","StyledListItemTitleLeftWrapper","StyledListItemHeadTitleText","$isEllipsis","$shouldShowMultilineTitle","StyledListItemHeadTitleElement","StyledListItemTopRightElement","onClick","displayName","_default","exports"],"sources":["../../../../../../../src/components/list/list-item/list-item-head/list-item-title/ListItemTitle.tsx"],"sourcesContent":["import React, { FC, ReactNode, useEffect, useMemo, useRef } from 'react';\nimport type { IListItemRightElement, IListItemRightElements } from '../../../../../types/list';\nimport {\n StyledListItemHeadTitleElement,\n StyledListItemHeadTitleText,\n StyledListItemTitle,\n StyledListItemTitleLeftWrapper,\n StyledListItemTopRightElement,\n} from './ListItemTitle.styles';\nimport { getElementClickEvent } from '../../../../../utils/accordion';\n\ntype ListItemTitleProps = {\n rightElements?: IListItemRightElements;\n title: ReactNode;\n titleElement?: ReactNode;\n shouldShowMultilineTitle: boolean;\n isOpen: boolean;\n onResize?: (entries: ResizeObserverEntry[]) => void;\n onTitleWidthChange: (width: number) => void;\n};\n\nconst ListItemTitle: FC<ListItemTitleProps> = ({\n rightElements,\n titleElement,\n title,\n shouldShowMultilineTitle,\n isOpen,\n onResize,\n onTitleWidthChange,\n}) => {\n const titleWrapperRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const elementWrapperRef = useRef<HTMLDivElement>(null);\n const topElementWrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const element = titleWrapperRef?.current;\n if (!element || typeof onResize !== 'function') return undefined;\n\n const resizeObserver = new ResizeObserver(onResize);\n resizeObserver.observe(element);\n\n return () => resizeObserver.disconnect();\n }, [onResize]);\n\n useEffect(() => {\n if (wrapperRef.current && elementWrapperRef.current) {\n const fullWidth = wrapperRef.current.clientWidth;\n const rightElementWidth = elementWrapperRef.current.clientWidth;\n const topElementWidth = topElementWrapperRef.current?.clientWidth;\n\n let width = fullWidth;\n\n if (rightElementWidth > 0) {\n width -= rightElementWidth + 8;\n }\n\n if (topElementWidth) {\n width -= topElementWidth + 12;\n }\n\n onTitleWidthChange(width);\n }\n }, [onTitleWidthChange]);\n\n const handlePreventClick = (event: React.MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n };\n\n const topElement = useMemo(() => {\n if (typeof rightElements === 'object' && rightElements && 'top' in rightElements) {\n return (rightElements as unknown as IListItemRightElement).top;\n }\n\n return undefined;\n }, [rightElements]);\n\n const shouldPreventRightElementClick = useMemo(() => {\n if (topElement) {\n return getElementClickEvent(topElement);\n }\n\n return false;\n }, [topElement]);\n\n return (\n <StyledListItemTitle ref={wrapperRef}>\n <StyledListItemTitleLeftWrapper>\n <StyledListItemHeadTitleText\n $isEllipsis={!isOpen}\n ref={titleWrapperRef}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n >\n {title}\n </StyledListItemHeadTitleText>\n <StyledListItemHeadTitleElement ref={elementWrapperRef}>\n {titleElement}\n </StyledListItemHeadTitleElement>\n </StyledListItemTitleLeftWrapper>\n {topElement && (\n <StyledListItemTopRightElement\n ref={topElementWrapperRef}\n onClick={shouldPreventRightElementClick ? handlePreventClick : undefined}\n >\n {topElement}\n </StyledListItemTopRightElement>\n )}\n </StyledListItemTitle>\n );\n};\n\nListItemTitle.displayName = 'ListItemTitle';\n\nexport default ListItemTitle;\n"],"mappings":";;;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AC0B,CAElB,CAAC;AAE9B,CAAC;AAED/B,aAAa,CAAC8C,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAE7BS,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ListItemTitle.js","names":["_react","_interopRequireWildcard","require","_ListItemTitle","_accordion","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ListItemTitle","rightElements","titleElement","title","shouldShowMultilineTitle","isOpen","onResize","onTitleWidthChange","shouldAllowRightElementFocus","titleWrapperRef","useRef","wrapperRef","elementWrapperRef","topElementWrapperRef","useEffect","element","current","undefined","resizeObserver","ResizeObserver","observe","disconnect","_topElementWrapperRef","fullWidth","clientWidth","rightElementWidth","topElementWidth","width","handlePreventClick","event","stopPropagation","preventDefault","topElement","useMemo","top","shouldPreventRightElementClick","getElementClickEvent","topElementWrapper","focusableElements","Array","from","querySelectorAll","forEach","currentElement","datasetKey","originalTabIndex","dataset","removeAttribute","setAttribute","getAttribute","createElement","StyledListItemTitle","ref","StyledListItemTitleLeftWrapper","StyledListItemHeadTitleText","$isEllipsis","$shouldShowMultilineTitle","StyledListItemHeadTitleElement","StyledListItemTopRightElement","onClick","displayName","_default","exports"],"sources":["../../../../../../../src/components/list/list-item/list-item-head/list-item-title/ListItemTitle.tsx"],"sourcesContent":["import React, { FC, ReactNode, useEffect, useMemo, useRef } from 'react';\nimport type { IListItemRightElement, IListItemRightElements } from '../../../../../types/list';\nimport {\n StyledListItemHeadTitleElement,\n StyledListItemHeadTitleText,\n StyledListItemTitle,\n StyledListItemTitleLeftWrapper,\n StyledListItemTopRightElement,\n} from './ListItemTitle.styles';\nimport { getElementClickEvent } from '../../../../../utils/accordion';\n\ntype ListItemTitleProps = {\n rightElements?: IListItemRightElements;\n title: ReactNode;\n titleElement?: ReactNode;\n shouldShowMultilineTitle: boolean;\n isOpen: boolean;\n onResize?: (entries: ResizeObserverEntry[]) => void;\n onTitleWidthChange: (width: number) => void;\n shouldAllowRightElementFocus?: boolean;\n};\n\nconst ListItemTitle: FC<ListItemTitleProps> = ({\n rightElements,\n titleElement,\n title,\n shouldShowMultilineTitle,\n isOpen,\n onResize,\n onTitleWidthChange,\n shouldAllowRightElementFocus = true,\n}) => {\n const titleWrapperRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const elementWrapperRef = useRef<HTMLDivElement>(null);\n const topElementWrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const element = titleWrapperRef?.current;\n if (!element || typeof onResize !== 'function') return undefined;\n\n const resizeObserver = new ResizeObserver(onResize);\n resizeObserver.observe(element);\n\n return () => resizeObserver.disconnect();\n }, [onResize]);\n\n useEffect(() => {\n if (wrapperRef.current && elementWrapperRef.current) {\n const fullWidth = wrapperRef.current.clientWidth;\n const rightElementWidth = elementWrapperRef.current.clientWidth;\n const topElementWidth = topElementWrapperRef.current?.clientWidth;\n\n let width = fullWidth;\n\n if (rightElementWidth > 0) {\n width -= rightElementWidth + 8;\n }\n\n if (topElementWidth) {\n width -= topElementWidth + 12;\n }\n\n onTitleWidthChange(width);\n }\n }, [onTitleWidthChange]);\n\n const handlePreventClick = (event: React.MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n };\n\n const topElement = useMemo(() => {\n if (typeof rightElements === 'object' && rightElements && 'top' in rightElements) {\n return (rightElements as unknown as IListItemRightElement).top;\n }\n\n return undefined;\n }, [rightElements]);\n\n const shouldPreventRightElementClick = useMemo(() => {\n if (topElement) {\n return getElementClickEvent(topElement);\n }\n\n return false;\n }, [topElement]);\n\n useEffect(() => {\n const topElementWrapper = topElementWrapperRef.current;\n\n if (!topElementWrapper) {\n return;\n }\n\n const focusableElements = Array.from(\n topElementWrapper.querySelectorAll<HTMLElement>(\n 'a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]',\n ),\n );\n\n focusableElements.forEach((element) => {\n const currentElement = element;\n const datasetKey = 'listItemRightElementOriginalTabIndex';\n\n if (shouldAllowRightElementFocus) {\n const originalTabIndex = currentElement.dataset[datasetKey];\n\n if (typeof originalTabIndex === 'string') {\n if (originalTabIndex === '') {\n currentElement.removeAttribute('tabindex');\n } else {\n currentElement.setAttribute('tabindex', originalTabIndex);\n }\n\n delete currentElement.dataset[datasetKey];\n }\n } else {\n if (typeof currentElement.dataset[datasetKey] !== 'string') {\n currentElement.dataset[datasetKey] =\n currentElement.getAttribute('tabindex') ?? '';\n }\n\n currentElement.setAttribute('tabindex', '-1');\n }\n });\n }, [shouldAllowRightElementFocus, topElement]);\n\n return (\n <StyledListItemTitle ref={wrapperRef}>\n <StyledListItemTitleLeftWrapper>\n <StyledListItemHeadTitleText\n $isEllipsis={!isOpen}\n ref={titleWrapperRef}\n $shouldShowMultilineTitle={shouldShowMultilineTitle}\n >\n {title}\n </StyledListItemHeadTitleText>\n <StyledListItemHeadTitleElement ref={elementWrapperRef}>\n {titleElement}\n </StyledListItemHeadTitleElement>\n </StyledListItemTitleLeftWrapper>\n {topElement && (\n <StyledListItemTopRightElement\n data-right-element=\"true\"\n ref={topElementWrapperRef}\n onClick={shouldPreventRightElementClick ? handlePreventClick : undefined}\n >\n {topElement}\n </StyledListItemTopRightElement>\n )}\n </StyledListItemTitle>\n );\n};\n\nListItemTitle.displayName = 'ListItemTitle';\n\nexport default ListItemTitle;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAOA,IAAAE,UAAA,GAAAF,OAAA;AAAsE,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,M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AAC,CAAC;EACN,CAAC,EAAE,CAACxC,4BAA4B,EAAEwB,UAAU,CAAC,CAAC;EAE9C,oBACIxD,MAAA,CAAAe,OAAA,CAAA2D,aAAA,CAACvE,cAAA,CAAAwE,mBAAmB;IAACC,GAAG,EAAEzC;EAAW,gBACjCnC,MAAA,CAAAe,OAAA,CAAA2D,aAAA,CAACvE,cAAA,CAAA0E,8BAA8B,qBAC3B7E,MAAA,CAAAe,OAAA,CAAA2D,aAAA,CAACvE,cAAA,CAAA2E,2BAA2B;IACxBC,WAAW,EAAE,CAAClD,MAAO;IACrB+C,GAAG,EAAE3C,eAAgB;IACrB+C,yBAAyB,EAAEpD;EAAyB,GAEnDD,KACwB,CAAC,eAC9B3B,MAAA,CAAAe,OAAA,CAAA2D,aAAA,CAACvE,cAAA,CAAA8E,8BAA8B;IAACL,GAAG,EAAExC;EAAkB,GAClDV,YAC2B,CACJ,CAAC,EAChC8B,UAAU,iBACPxD,MAAA,CAAAe,OAAA,CAAA2D,aAAA,CAACvE,cAAA,CAAA+E,6BAA6B;IAC1B,sBAAmB,MAAM;IACzBN,GAAG,EAAEvC,oBAAqB;IAC1B8C,OAAO,EAAExB,8BAA8B,GAAGP,kBAAkB,GAAGX;EAAU,GAExEe,UAC0B,CAElB,CAAC;AAE9B,CAAC;AAEDhC,aAAa,CAAC4D,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvE,OAAA,GAE7BS,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useListItemFocus = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const useListItemFocus = ({
|
|
9
|
+
uuid,
|
|
10
|
+
listGroupUuid,
|
|
11
|
+
isInKeyboardNavigationGroup,
|
|
12
|
+
updateActiveListItemUuid
|
|
13
|
+
}) => {
|
|
14
|
+
const [isFocusWithinListItem, setIsFocusWithinListItem] = (0, _react.useState)(false);
|
|
15
|
+
const handleFocus = (0, _react.useCallback)(event => {
|
|
16
|
+
setIsFocusWithinListItem(true);
|
|
17
|
+
if (event.currentTarget === event.target && isInKeyboardNavigationGroup && typeof updateActiveListItemUuid === 'function') {
|
|
18
|
+
updateActiveListItemUuid(uuid);
|
|
19
|
+
}
|
|
20
|
+
}, [isInKeyboardNavigationGroup, updateActiveListItemUuid, uuid]);
|
|
21
|
+
const handleBlur = (0, _react.useCallback)(event => {
|
|
22
|
+
const nextFocusedElement = event.relatedTarget;
|
|
23
|
+
const currentListItemElement = event.currentTarget;
|
|
24
|
+
if (nextFocusedElement && currentListItemElement.contains(nextFocusedElement)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
setIsFocusWithinListItem(false);
|
|
28
|
+
if (!isInKeyboardNavigationGroup || typeof updateActiveListItemUuid !== 'function' || typeof listGroupUuid !== 'string') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!nextFocusedElement) {
|
|
32
|
+
updateActiveListItemUuid(undefined);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const nextFocusedListItem = nextFocusedElement.closest(`[data-uuid^="${listGroupUuid}---"]`);
|
|
36
|
+
if (!nextFocusedListItem) {
|
|
37
|
+
updateActiveListItemUuid(undefined);
|
|
38
|
+
}
|
|
39
|
+
}, [isInKeyboardNavigationGroup, listGroupUuid, updateActiveListItemUuid]);
|
|
40
|
+
return {
|
|
41
|
+
isFocusWithinListItem,
|
|
42
|
+
handleFocus,
|
|
43
|
+
handleBlur
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.useListItemFocus = useListItemFocus;
|
|
47
|
+
//# sourceMappingURL=useListItemFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListItemFocus.js","names":["_react","require","useListItemFocus","uuid","listGroupUuid","isInKeyboardNavigationGroup","updateActiveListItemUuid","isFocusWithinListItem","setIsFocusWithinListItem","useState","handleFocus","useCallback","event","currentTarget","target","handleBlur","nextFocusedElement","relatedTarget","currentListItemElement","contains","undefined","nextFocusedListItem","closest","exports"],"sources":["../../../../../src/components/list/list-item/useListItemFocus.ts"],"sourcesContent":["import { type FocusEvent, useCallback, useState } from 'react';\n\ntype UseListItemFocusParams = {\n uuid: string;\n listGroupUuid?: string;\n isInKeyboardNavigationGroup: boolean;\n updateActiveListItemUuid?: (uuid?: string) => void;\n};\n\nexport const useListItemFocus = ({\n uuid,\n listGroupUuid,\n isInKeyboardNavigationGroup,\n updateActiveListItemUuid,\n}: UseListItemFocusParams) => {\n const [isFocusWithinListItem, setIsFocusWithinListItem] = useState(false);\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLDivElement>) => {\n setIsFocusWithinListItem(true);\n\n if (\n event.currentTarget === event.target &&\n isInKeyboardNavigationGroup &&\n typeof updateActiveListItemUuid === 'function'\n ) {\n updateActiveListItemUuid(uuid);\n }\n },\n [isInKeyboardNavigationGroup, updateActiveListItemUuid, uuid],\n );\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLDivElement>) => {\n const nextFocusedElement = event.relatedTarget as HTMLElement | null;\n const currentListItemElement = event.currentTarget as HTMLElement;\n\n if (nextFocusedElement && currentListItemElement.contains(nextFocusedElement)) {\n return;\n }\n\n setIsFocusWithinListItem(false);\n\n if (\n !isInKeyboardNavigationGroup ||\n typeof updateActiveListItemUuid !== 'function' ||\n typeof listGroupUuid !== 'string'\n ) {\n return;\n }\n\n if (!nextFocusedElement) {\n updateActiveListItemUuid(undefined);\n return;\n }\n\n const nextFocusedListItem = nextFocusedElement.closest<HTMLElement>(\n `[data-uuid^=\"${listGroupUuid}---\"]`,\n );\n\n if (!nextFocusedListItem) {\n updateActiveListItemUuid(undefined);\n }\n },\n [isInKeyboardNavigationGroup, listGroupUuid, updateActiveListItemUuid],\n );\n\n return {\n isFocusWithinListItem,\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AACf,2BAA2B,EAAED,aAAa,EAAEE,wBAAwB,CACzE,CAAC;EAED,OAAO;IACHC,qBAAqB;IACrBG,WAAW;IACXK;EACJ,CAAC;AACL,CAAC;AAACQ,OAAA,CAAArB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useMasonryContext = exports.MasonryContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const MasonryContext = exports.MasonryContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
9
|
+
const useMasonryContext = () => {
|
|
10
|
+
const context = (0, _react.useContext)(MasonryContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error('Masonry.Item must be used inside Masonry.');
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
};
|
|
16
|
+
exports.useMasonryContext = useMasonryContext;
|
|
17
|
+
//# sourceMappingURL=Masonry.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Masonry.context.js","names":["_react","require","MasonryContext","exports","createContext","undefined","useMasonryContext","context","useContext","Error"],"sources":["../../../../src/components/masonry/Masonry.context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport { MasonryContextValue } from './Masonry.types';\n\nexport const MasonryContext = createContext<MasonryContextValue | undefined>(undefined);\n\nexport const useMasonryContext = () => {\n const context = useContext(MasonryContext);\n\n if (!context) {\n throw new Error('Masonry.Item must be used inside Masonry.');\n }\n\n return context;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGO,MAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,gBAAG,IAAAE,oBAAa,EAAkCC,SAAS,CAAC;AAEhF,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EACnC,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACN,cAAc,CAAC;EAE1C,IAAI,CAACK,OAAO,EAAE;IACV,MAAM,IAAIE,KAAK,CAAC,2CAA2C,CAAC;EAChE;EAEA,OAAOF,OAAO;AAClB,CAAC;AAACJ,OAAA,CAAAG,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useMasonryLayout = exports.useMasonryItems = exports.useMasonryColumnCount = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _Masonry = require("./Masonry.utils");
|
|
9
|
+
const useMasonryItems = ({
|
|
10
|
+
children
|
|
11
|
+
}) => (0, _react.useMemo)(() => _react.Children.toArray(children), [children]);
|
|
12
|
+
exports.useMasonryItems = useMasonryItems;
|
|
13
|
+
const useMasonryLayout = ({
|
|
14
|
+
items,
|
|
15
|
+
itemHeights,
|
|
16
|
+
columnCount,
|
|
17
|
+
columnWidth,
|
|
18
|
+
rowHeight,
|
|
19
|
+
gap
|
|
20
|
+
}) => (0, _react.useMemo)(() => {
|
|
21
|
+
const layoutItems = items.map((item, index) => {
|
|
22
|
+
const key = (0, _Masonry.getMasonryItemKey)(item, index);
|
|
23
|
+
const height = itemHeights[key] ?? rowHeight;
|
|
24
|
+
return {
|
|
25
|
+
key,
|
|
26
|
+
columns: item.props.columns ?? 1,
|
|
27
|
+
rows: (0, _Masonry.calculateRowSpan)({
|
|
28
|
+
height,
|
|
29
|
+
rowHeight,
|
|
30
|
+
gap
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
return (0, _Masonry.packMasonryGrid)({
|
|
35
|
+
items: layoutItems,
|
|
36
|
+
columnCount,
|
|
37
|
+
columnWidth,
|
|
38
|
+
rowHeight,
|
|
39
|
+
gap
|
|
40
|
+
});
|
|
41
|
+
}, [items, itemHeights, columnCount, columnWidth, rowHeight, gap]);
|
|
42
|
+
exports.useMasonryLayout = useMasonryLayout;
|
|
43
|
+
const useMasonryColumnCount = ({
|
|
44
|
+
containerWidth,
|
|
45
|
+
columnWidth,
|
|
46
|
+
gap
|
|
47
|
+
}) => (0, _react.useMemo)(() => (0, _Masonry.calculateColumnCount)({
|
|
48
|
+
containerWidth,
|
|
49
|
+
columnWidth,
|
|
50
|
+
gap
|
|
51
|
+
}), [containerWidth, columnWidth, gap]);
|
|
52
|
+
exports.useMasonryColumnCount = useMasonryColumnCount;
|
|
53
|
+
//# sourceMappingURL=Masonry.hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Masonry.hooks.js","names":["_react","require","_Masonry","useMasonryItems","children","useMemo","Children","toArray","exports","useMasonryLayout","items","itemHeights","columnCount","columnWidth","rowHeight","gap","layoutItems","map","item","index","key","getMasonryItemKey","height","columns","props","rows","calculateRowSpan","packMasonryGrid","useMasonryColumnCount","containerWidth","calculateColumnCount"],"sources":["../../../../src/components/masonry/Masonry.hooks.ts"],"sourcesContent":["import { Children, ReactNode, useMemo } from 'react';\nimport { MasonryChild, MasonryItemProps, MasonryLayoutItem } from './Masonry.types';\nimport {\n calculateColumnCount,\n calculateRowSpan,\n getMasonryItemKey,\n packMasonryGrid,\n} from './Masonry.utils';\n\ninterface UseMasonryItemsParams {\n children: ReactNode;\n}\n\nexport const useMasonryItems = ({ children }: UseMasonryItemsParams) =>\n useMemo(() => Children.toArray(children) as MasonryChild[], [children]);\n\ninterface UseMasonryLayoutParams {\n items: MasonryChild[];\n itemHeights: Record<string, number>;\n columnCount: number;\n columnWidth: number;\n rowHeight: number;\n gap: number;\n}\n\nexport const useMasonryLayout = ({\n items,\n itemHeights,\n columnCount,\n columnWidth,\n rowHeight,\n gap,\n}: UseMasonryLayoutParams) =>\n useMemo(() => {\n const layoutItems: MasonryLayoutItem[] = items.map((item, index) => {\n const key = getMasonryItemKey(item as React.ReactElement<MasonryItemProps>, index);\n\n const height = itemHeights[key] ?? rowHeight;\n\n return {\n key,\n columns: item.props.columns ?? 1,\n rows: calculateRowSpan({\n height,\n rowHeight,\n gap,\n }),\n };\n });\n\n return packMasonryGrid({\n items: layoutItems,\n columnCount,\n columnWidth,\n rowHeight,\n gap,\n });\n }, [items, itemHeights, columnCount, columnWidth, rowHeight, gap]);\n\ninterface UseMasonryColumnCountParams {\n containerWidth: number;\n columnWidth: number;\n gap: number;\n}\n\nexport const useMasonryColumnCount = ({\n containerWidth,\n columnWidth,\n gap,\n}: UseMasonryColumnCountParams) =>\n useMemo(\n () =>\n calculateColumnCount({\n containerWidth,\n columnWidth,\n gap,\n }),\n [containerWidth, columnWidth, gap],\n );\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAWO,MAAME,eAAe,GAAGA,CAAC;EAAEC;AAAgC,CAAC,KAC/D,IAAAC,cAAO,EAAC,MAAMC,eAAQ,CAACC,OAAO,CAACH,QAAQ,CAAmB,EAAE,CAACA,QAAQ,CAAC,CAAC;AAACI,OAAA,CAAAL,eAAA,GAAAA,eAAA;AAWrE,MAAMM,gBAAgB,GAAGA,CAAC;EAC7BC,KAAK;EACLC,WAAW;EACXC,WAAW;EACXC,WAAW;EACXC,SAAS;EACTC;AACoB,CAAC,KACrB,IAAAV,cAAO,EAAC,MAAM;EACV,MAAMW,WAAgC,GAAGN,KAAK,CAACO,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;IAChE,MAAMC,GAAG,GAAG,IAAAC,0BAAiB,EAACH,IAAI,EAA0CC,KAAK,CAAC;IAElF,MAAMG,MAAM,GAAGX,WAAW,CAACS,GAAG,CAAC,IAAIN,SAAS;IAE5C,OAAO;MACHM,GAAG;MACHG,OAAO,EAAEL,IAAI,CAACM,KAAK,CAACD,OAAO,IAAI,CAAC;MAChCE,IAAI,EAAE,IAAAC,yBAAgB,EAAC;QACnBJ,MAAM;QACNR,SAAS;QACTC;MACJ,CAAC;IACL,CAAC;EACL,CAAC,CAAC;EAEF,OAAO,IAAAY,wBAAe,EAAC;IACnBjB,KAAK,EAAEM,WAAW;IAClBJ,WAAW;IACXC,WAAW;IACXC,SAAS;IACTC;EACJ,CAAC,CAAC;AACN,CAAC,EAAE,CAACL,KAAK,EAAEC,WAAW,EAAEC,WAAW,EAAEC,WAAW,EAAEC,SAAS,EAAEC,GAAG,CAAC,CAAC;AAACP,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAQhE,MAAMmB,qBAAqB,GAAGA,CAAC;EAClCC,cAAc;EACdhB,WAAW;EACXE;AACyB,CAAC,KAC1B,IAAAV,cAAO,EACH,MACI,IAAAyB,6BAAoB,EAAC;EACjBD,cAAc;EACdhB,WAAW;EACXE;AACJ,CAAC,CAAC,EACN,CAACc,cAAc,EAAEhB,WAAW,EAAEE,GAAG,CACrC,CAAC;AAACP,OAAA,CAAAoB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _react2 = require("motion/react");
|
|
9
|
+
var _element = require("../../hooks/element");
|
|
10
|
+
var _Masonry = require("./Masonry.context");
|
|
11
|
+
var _Masonry2 = require("./Masonry.styles");
|
|
12
|
+
var _Masonry3 = require("./Masonry.hooks");
|
|
13
|
+
var _Masonry4 = require("./Masonry.utils");
|
|
14
|
+
var _MasonryItem = _interopRequireWildcard(require("./masonry-item/MasonryItem"));
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
const MasonryBase = ({
|
|
17
|
+
children,
|
|
18
|
+
gap = 8,
|
|
19
|
+
columnWidth = 80,
|
|
20
|
+
rowHeight = 80
|
|
21
|
+
}) => {
|
|
22
|
+
const ref = (0, _react.useRef)(null);
|
|
23
|
+
const size = (0, _element.useElementSize)(ref);
|
|
24
|
+
const containerWidth = (size === null || size === void 0 ? void 0 : size.width) ?? 0;
|
|
25
|
+
const [itemHeights, setItemHeights] = (0, _react.useState)({});
|
|
26
|
+
const items = (0, _Masonry3.useMasonryItems)({
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
const columnCount = (0, _Masonry3.useMasonryColumnCount)({
|
|
30
|
+
containerWidth,
|
|
31
|
+
columnWidth,
|
|
32
|
+
gap
|
|
33
|
+
});
|
|
34
|
+
const layout = (0, _Masonry3.useMasonryLayout)({
|
|
35
|
+
items,
|
|
36
|
+
itemHeights,
|
|
37
|
+
columnCount,
|
|
38
|
+
columnWidth,
|
|
39
|
+
rowHeight,
|
|
40
|
+
gap
|
|
41
|
+
});
|
|
42
|
+
const registerItem = (0, _react.useCallback)((key, height) => {
|
|
43
|
+
setItemHeights(currentHeights => {
|
|
44
|
+
if (currentHeights[key] === height) {
|
|
45
|
+
return currentHeights;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
...currentHeights,
|
|
49
|
+
[key]: height
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}, []);
|
|
53
|
+
const contextValue = (0, _react.useMemo)(() => ({
|
|
54
|
+
registerItem
|
|
55
|
+
}), [registerItem]);
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_Masonry.MasonryContext.Provider, {
|
|
57
|
+
value: contextValue
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement(_Masonry2.StyledMasonry, {
|
|
59
|
+
ref: ref,
|
|
60
|
+
$height: layout.height
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_react2.AnimatePresence, null, items.map((item, index) => {
|
|
62
|
+
const key = (0, _Masonry4.getMasonryItemKey)(item, index);
|
|
63
|
+
const packedItem = layout.items[key];
|
|
64
|
+
if (!packedItem) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement(_MasonryItem.InternalMasonryItem, {
|
|
68
|
+
key: key,
|
|
69
|
+
itemKey: key,
|
|
70
|
+
x: packedItem.x,
|
|
71
|
+
y: packedItem.y,
|
|
72
|
+
width: packedItem.width
|
|
73
|
+
}, item.props.children);
|
|
74
|
+
}))));
|
|
75
|
+
};
|
|
76
|
+
MasonryBase.displayName = 'Masonry';
|
|
77
|
+
const Masonry = Object.assign(MasonryBase, {
|
|
78
|
+
Item: _MasonryItem.default
|
|
79
|
+
});
|
|
80
|
+
var _default = exports.default = Masonry;
|
|
81
|
+
//# sourceMappingURL=Masonry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Masonry.js","names":["_react","_interopRequireWildcard","require","_react2","_element","_Masonry","_Masonry2","_Masonry3","_Masonry4","_MasonryItem","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","MasonryBase","children","gap","columnWidth","rowHeight","ref","useRef","size","useElementSize","containerWidth","width","itemHeights","setItemHeights","useState","items","useMasonryItems","columnCount","useMasonryColumnCount","layout","useMasonryLayout","registerItem","useCallback","key","height","currentHeights","contextValue","useMemo","createElement","MasonryContext","Provider","value","StyledMasonry","$height","AnimatePresence","map","item","index","getMasonryItemKey","packedItem","InternalMasonryItem","itemKey","x","y","props","displayName","Masonry","assign","Item","MasonryItem","_default","exports"],"sources":["../../../../src/components/masonry/Masonry.tsx"],"sourcesContent":["import React, { FC, useCallback, useMemo, useRef, useState } from 'react';\nimport { AnimatePresence } from 'motion/react';\nimport { useElementSize } from '../../hooks/element';\nimport { MasonryComponent, MasonryItemProps, MasonryProps } from './Masonry.types';\nimport { MasonryContext } from './Masonry.context';\nimport { StyledMasonry } from './Masonry.styles';\nimport { useMasonryColumnCount, useMasonryItems, useMasonryLayout } from './Masonry.hooks';\nimport { getMasonryItemKey } from './Masonry.utils';\nimport MasonryItem, { InternalMasonryItem } from './masonry-item/MasonryItem';\n\nconst MasonryBase: FC<MasonryProps> = ({ children, gap = 8, columnWidth = 80, rowHeight = 80 }) => {\n const ref = useRef<HTMLDivElement | null>(null);\n const size = useElementSize(ref);\n\n const containerWidth = size?.width ?? 0;\n\n const [itemHeights, setItemHeights] = useState<Record<string, number>>({});\n\n const items = useMasonryItems({ children });\n\n const columnCount = useMasonryColumnCount({\n containerWidth,\n columnWidth,\n gap,\n });\n\n const layout = useMasonryLayout({\n items,\n itemHeights,\n columnCount,\n columnWidth,\n rowHeight,\n gap,\n });\n\n const registerItem = useCallback((key: string, height: number) => {\n setItemHeights((currentHeights) => {\n if (currentHeights[key] === height) {\n return currentHeights;\n }\n\n return {\n ...currentHeights,\n [key]: height,\n };\n });\n }, []);\n\n const contextValue = useMemo(\n () => ({\n registerItem,\n }),\n [registerItem],\n );\n\n return (\n <MasonryContext.Provider value={contextValue}>\n <StyledMasonry ref={ref} $height={layout.height}>\n <AnimatePresence>\n {items.map((item, index) => {\n const key = getMasonryItemKey(\n item as React.ReactElement<MasonryItemProps>,\n index,\n );\n\n const packedItem = layout.items[key];\n\n if (!packedItem) {\n return null;\n }\n\n return (\n <InternalMasonryItem\n key={key}\n itemKey={key}\n x={packedItem.x}\n y={packedItem.y}\n width={packedItem.width}\n >\n {item.props.children}\n </InternalMasonryItem>\n );\n })}\n </AnimatePresence>\n </StyledMasonry>\n </MasonryContext.Provider>\n );\n};\n\nMason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2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledMasonry = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const StyledMasonry = exports.StyledMasonry = _styledComponents.default.div`
|
|
10
|
+
position: relative;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: ${({
|
|
13
|
+
$height
|
|
14
|
+
}) => $height}px;
|
|
15
|
+
`;
|
|
16
|
+
//# sourceMappingURL=Masonry.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Masonry.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledMasonry","exports","styled","div","$height"],"sources":["../../../../src/components/masonry/Masonry.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledMasonry = styled.div<{ $height: number }>`\n position: relative;\n width: 100%;\n height: ${({ $height }) => $height}px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAGE,yBAAM,CAACC,GAAwB;AAC5D;AACA;AACA,cAAc,CAAC;EAAEC;AAAQ,CAAC,KAAKA,OAAO;AACtC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Masonry.types.js","names":[],"sources":["../../../../src/components/masonry/Masonry.types.ts"],"sourcesContent":["import { ReactElement, ReactNode } from 'react';\n\nexport interface MasonryProps {\n children: ReactNode;\n gap?: number;\n columnWidth?: number;\n rowHeight?: number;\n}\n\nexport interface MasonryItemProps {\n children: ReactNode;\n columns?: number;\n}\n\nexport interface MasonryContextValue {\n registerItem: (key: string, height: number) => void;\n}\n\nexport interface MasonryLayoutItem {\n key: string;\n columns: number;\n rows: number;\n}\n\nexport interface PackedMasonryItem {\n key: string;\n x: number;\n y: number;\n width: number;\n}\n\nexport interface PackedMasonryGrid {\n items: Record<string, PackedMasonryItem>;\n height: number;\n}\n\nexport interface InternalMasonryItemProps {\n children: ReactNode;\n itemKey: string;\n x: number;\n y: number;\n width: number;\n}\n\nexport type MasonryChild = ReactElement<MasonryItemProps>;\n\nexport type MasonryComponent = React.FC<MasonryProps> & {\n Item: React.FC<MasonryItemProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.packMasonryGrid = exports.getMasonryItemKey = exports.calculateRowSpan = exports.calculateColumnCount = void 0;
|
|
7
|
+
const getMasonryItemKey = (item, index) => item.key != null ? String(item.key) : String(index);
|
|
8
|
+
exports.getMasonryItemKey = getMasonryItemKey;
|
|
9
|
+
const isAreaFree = ({
|
|
10
|
+
grid,
|
|
11
|
+
startColumn,
|
|
12
|
+
startRow,
|
|
13
|
+
columns,
|
|
14
|
+
rows,
|
|
15
|
+
columnCount
|
|
16
|
+
}) => {
|
|
17
|
+
if (startColumn + columns > columnCount) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
for (let row = startRow; row < startRow + rows; row += 1) {
|
|
21
|
+
for (let column = startColumn; column < startColumn + columns; column += 1) {
|
|
22
|
+
var _grid$row;
|
|
23
|
+
if ((_grid$row = grid[row]) !== null && _grid$row !== void 0 && _grid$row[column]) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
};
|
|
30
|
+
const occupyArea = ({
|
|
31
|
+
grid,
|
|
32
|
+
startColumn,
|
|
33
|
+
startRow,
|
|
34
|
+
columns,
|
|
35
|
+
rows
|
|
36
|
+
}) => {
|
|
37
|
+
for (let row = startRow; row < startRow + rows; row += 1) {
|
|
38
|
+
if (!grid[row]) {
|
|
39
|
+
// eslint-disable-next-line no-param-reassign
|
|
40
|
+
grid[row] = [];
|
|
41
|
+
}
|
|
42
|
+
for (let column = startColumn; column < startColumn + columns; column += 1) {
|
|
43
|
+
// eslint-disable-next-line no-param-reassign
|
|
44
|
+
grid[row][column] = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const packMasonryGrid = ({
|
|
49
|
+
items,
|
|
50
|
+
columnCount,
|
|
51
|
+
columnWidth,
|
|
52
|
+
rowHeight,
|
|
53
|
+
gap
|
|
54
|
+
}) => {
|
|
55
|
+
const grid = [];
|
|
56
|
+
const packedItems = {};
|
|
57
|
+
let maxRow = 0;
|
|
58
|
+
items.forEach(item => {
|
|
59
|
+
const columns = Math.min(Math.max(item.columns, 1), columnCount);
|
|
60
|
+
const rows = Math.max(item.rows, 1);
|
|
61
|
+
let placed = false;
|
|
62
|
+
let row = 0;
|
|
63
|
+
while (!placed) {
|
|
64
|
+
for (let column = 0; column < columnCount; column += 1) {
|
|
65
|
+
const canPlaceItem = isAreaFree({
|
|
66
|
+
grid,
|
|
67
|
+
startColumn: column,
|
|
68
|
+
startRow: row,
|
|
69
|
+
columns,
|
|
70
|
+
rows,
|
|
71
|
+
columnCount
|
|
72
|
+
});
|
|
73
|
+
if (!canPlaceItem) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
occupyArea({
|
|
77
|
+
grid,
|
|
78
|
+
startColumn: column,
|
|
79
|
+
startRow: row,
|
|
80
|
+
columns,
|
|
81
|
+
rows
|
|
82
|
+
});
|
|
83
|
+
packedItems[item.key] = {
|
|
84
|
+
key: item.key,
|
|
85
|
+
x: column * (columnWidth + gap),
|
|
86
|
+
y: row * (rowHeight + gap),
|
|
87
|
+
width: columns * columnWidth + (columns - 1) * gap
|
|
88
|
+
};
|
|
89
|
+
maxRow = Math.max(maxRow, row + rows);
|
|
90
|
+
placed = true;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
if (!placed) {
|
|
94
|
+
row += 1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
items: packedItems,
|
|
100
|
+
height: maxRow * rowHeight + Math.max(0, maxRow - 1) * gap
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
exports.packMasonryGrid = packMasonryGrid;
|
|
104
|
+
const calculateColumnCount = ({
|
|
105
|
+
containerWidth,
|
|
106
|
+
columnWidth,
|
|
107
|
+
gap
|
|
108
|
+
}) => {
|
|
109
|
+
if (!containerWidth) {
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
return Math.max(1, Math.floor((containerWidth + gap) / (columnWidth + gap)));
|
|
113
|
+
};
|
|
114
|
+
exports.calculateColumnCount = calculateColumnCount;
|
|
115
|
+
const calculateRowSpan = ({
|
|
116
|
+
height,
|
|
117
|
+
rowHeight,
|
|
118
|
+
gap
|
|
119
|
+
}) => Math.max(1, Math.ceil((height + gap) / (rowHeight + gap)));
|
|
120
|
+
exports.calculateRowSpan = calculateRowSpan;
|
|
121
|
+
//# sourceMappingURL=Masonry.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Masonry.utils.js","names":["getMasonryItemKey","item","index","key","String","exports","isAreaFree","grid","startColumn","startRow","columns","rows","columnCount","row","column","_grid$row","occupyArea","packMasonryGrid","items","columnWidth","rowHeight","gap","packedItems","maxRow","forEach","Math","min","max","placed","canPlaceItem","x","y","width","height","calculateColumnCount","containerWidth","floor","calculateRowSpan","ceil"],"sources":["../../../../src/components/masonry/Masonry.utils.ts"],"sourcesContent":["import { ReactElement } from 'react';\nimport {\n MasonryItemProps,\n MasonryLayoutItem,\n PackedMasonryGrid,\n PackedMasonryItem,\n} from './Masonry.types';\n\nexport const getMasonryItemKey = (item: ReactElement<MasonryItemProps>, index: number) =>\n item.key != null ? String(item.key) : String(index);\n\ninterface IsAreaFreeParams {\n grid: boolean[][];\n startColumn: number;\n startRow: number;\n columns: number;\n rows: number;\n columnCount: number;\n}\n\nconst isAreaFree = ({\n grid,\n startColumn,\n startRow,\n columns,\n rows,\n columnCount,\n}: IsAreaFreeParams) => {\n if (startColumn + columns > columnCount) {\n return false;\n }\n\n for (let row = startRow; row < startRow + rows; row += 1) {\n for (let column = startColumn; column < startColumn + columns; column += 1) {\n if (grid[row]?.[column]) {\n return false;\n }\n }\n }\n\n return true;\n};\n\ninterface OccupyAreaParams {\n grid: boolean[][];\n startColumn: number;\n startRow: number;\n columns: number;\n rows: number;\n}\n\nconst occupyArea = ({ grid, startColumn, startRow, columns, rows }: OccupyAreaParams) => {\n for (let row = startRow; row < startRow + rows; row += 1) {\n if (!grid[row]) {\n // eslint-disable-next-line no-param-reassign\n grid[row] = [];\n }\n\n for (let column = startColumn; column < startColumn + columns; column += 1) {\n // eslint-disable-next-line no-param-reassign\n (grid[row] as boolean[])[column] = true;\n }\n }\n};\n\ninterface PackMasonryGridParams {\n items: MasonryLayoutItem[];\n columnCount: number;\n columnWidth: number;\n rowHeight: number;\n gap: number;\n}\n\nexport const packMasonryGrid = ({\n items,\n columnCount,\n columnWidth,\n rowHeight,\n gap,\n}: PackMasonryGridParams): PackedMasonryGrid => {\n const grid: boolean[][] = [];\n const packedItems: Record<string, PackedMasonryItem> = {};\n\n let maxRow = 0;\n\n items.forEach((item) => {\n const columns = Math.min(Math.max(item.columns, 1), columnCount);\n const rows = Math.max(item.rows, 1);\n\n let placed = false;\n let row = 0;\n\n while (!placed) {\n for (let column = 0; column < columnCount; column += 1) {\n const canPlaceItem = isAreaFree({\n grid,\n startColumn: column,\n startRow: row,\n columns,\n rows,\n columnCount,\n });\n\n if (!canPlaceItem) {\n continue;\n }\n\n occupyArea({\n grid,\n startColumn: column,\n startRow: row,\n columns,\n rows,\n });\n\n packedItems[item.key] = {\n key: item.key,\n x: column * (columnWidth + gap),\n y: row * (rowHeight + gap),\n width: columns * columnWidth + (columns - 1) * gap,\n };\n\n maxRow = Math.max(maxRow, row + rows);\n placed = true;\n break;\n }\n\n if (!placed) {\n row += 1;\n }\n }\n });\n\n return {\n items: packedItems,\n height: maxRow * rowHeight + Math.max(0, maxRow - 1) * gap,\n };\n};\n\nexport const calculateColumnCount = ({\n containerWidth,\n columnWidth,\n gap,\n}: {\n containerWidth: number;\n columnWidth: number;\n gap: number;\n}) => {\n if (!containerWidth) {\n return 1;\n }\n\n return Math.max(1, Math.floor((containerWidth + gap) / (columnWidth + gap)));\n};\n\nexport const calculateRowSpan = ({\n height,\n rowHeight,\n gap,\n}: {\n height: number;\n rowHeight: number;\n gap: number;\n}) => Math.max(1, Math.ceil((height + gap) / (rowHeight + gap)));\n"],"mappings":";;;;;;AAQO,MAAMA,iBAAiB,GAAGA,CAACC,IAAoC,EAAEC,KAAa,KACjFD,IAAI,CAACE,GAAG,IAAI,IAAI,GAAGC,MAAM,CAACH,IAAI,CAACE,GAAG,CAAC,GAAGC,MAAM,CAACF,KAAK,CAAC;AAACG,OAAA,CAAAL,iBAAA,GAAAA,iBAAA;AAWxD,MAAMM,UAAU,GAAGA,CAAC;EAChBC,IAAI;EACJC,WAAW;EACXC,QAAQ;EACRC,OAAO;EACPC,IAAI;EACJC;AACc,CAAC,KAAK;EACpB,IAAIJ,WAAW,GAAGE,OAAO,GAAGE,WAAW,EAAE;IACrC,OAAO,KAAK;EAChB;EAEA,KAAK,IAAIC,GAAG,GAAGJ,QAAQ,EAAEI,GAAG,GAAGJ,QAAQ,GAAGE,IAAI,EAAEE,GAAG,IAAI,CAAC,EAAE;IACtD,KAAK,IAAIC,MAAM,GAAGN,WAAW,EAAEM,MAAM,GAAGN,WAAW,GAAGE,OAAO,EAAEI,MAAM,IAAI,CAAC,EAAE;MAAA,IAAAC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EACdhB,WAAW;EACXE;AAKJ,CAAC,KAAK;EACF,IAAI,CAACc,cAAc,EAAE;IACjB,OAAO,CAAC;EACZ;EAEA,OAAOV,IAAI,CAACE,GAAG,CAAC,CAAC,EAAEF,IAAI,CAACW,KAAK,CAAC,CAACD,cAAc,GAAGd,GAAG,KAAKF,WAAW,GAAGE,GAAG,CAAC,CAAC,CAAC;AAChF,CAAC;AAAChB,OAAA,CAAA6B,oBAAA,GAAAA,oBAAA;AAEK,MAAMG,gBAAgB,GAAGA,CAAC;EAC7BJ,MAAM;EACNb,SAAS;EACTC;AAKJ,CAAC,KAAKI,IAAI,CAACE,GAAG,CAAC,CAAC,EAAEF,IAAI,CAACa,IAAI,CAAC,CAACL,MAAM,GAAGZ,GAAG,KAAKD,SAAS,GAAGC,GAAG,CAAC,CAAC,CAAC;AAAChB,OAAA,CAAAgC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.InternalMasonryItem = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _Masonry = require("../Masonry.context");
|
|
9
|
+
var _MasonryItem = require("./MasonryItem.styles");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
const MasonryItem = ({
|
|
12
|
+
children
|
|
13
|
+
}) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
14
|
+
const InternalMasonryItem = ({
|
|
15
|
+
children,
|
|
16
|
+
itemKey,
|
|
17
|
+
x,
|
|
18
|
+
y,
|
|
19
|
+
width
|
|
20
|
+
}) => {
|
|
21
|
+
const ref = (0, _react.useRef)(null);
|
|
22
|
+
const {
|
|
23
|
+
registerItem
|
|
24
|
+
} = (0, _Masonry.useMasonryContext)();
|
|
25
|
+
(0, _react.useEffect)(() => {
|
|
26
|
+
const element = ref.current;
|
|
27
|
+
if (!element) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
let frameId;
|
|
31
|
+
const updateHeight = () => {
|
|
32
|
+
if (frameId) {
|
|
33
|
+
window.cancelAnimationFrame(frameId);
|
|
34
|
+
}
|
|
35
|
+
frameId = window.requestAnimationFrame(() => {
|
|
36
|
+
registerItem(itemKey, element.getBoundingClientRect().height);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
updateHeight();
|
|
40
|
+
const observer = new ResizeObserver(updateHeight);
|
|
41
|
+
observer.observe(element);
|
|
42
|
+
return () => {
|
|
43
|
+
if (frameId) {
|
|
44
|
+
window.cancelAnimationFrame(frameId);
|
|
45
|
+
}
|
|
46
|
+
observer.disconnect();
|
|
47
|
+
};
|
|
48
|
+
}, [itemKey, registerItem, width]);
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_MasonryItem.StyledMasonryItem, {
|
|
50
|
+
ref: ref,
|
|
51
|
+
initial: {
|
|
52
|
+
opacity: 0,
|
|
53
|
+
scale: 0.96
|
|
54
|
+
},
|
|
55
|
+
animate: {
|
|
56
|
+
opacity: 1,
|
|
57
|
+
scale: 1,
|
|
58
|
+
x,
|
|
59
|
+
y,
|
|
60
|
+
width
|
|
61
|
+
},
|
|
62
|
+
exit: {
|
|
63
|
+
opacity: 0,
|
|
64
|
+
scale: 0.96
|
|
65
|
+
},
|
|
66
|
+
transition: {
|
|
67
|
+
type: 'spring',
|
|
68
|
+
stiffness: 320,
|
|
69
|
+
damping: 34,
|
|
70
|
+
mass: 0.85
|
|
71
|
+
}
|
|
72
|
+
}, children);
|
|
73
|
+
};
|
|
74
|
+
exports.InternalMasonryItem = InternalMasonryItem;
|
|
75
|
+
MasonryItem.displayName = 'Masonry.Item';
|
|
76
|
+
var _default = exports.default = MasonryItem;
|
|
77
|
+
//# sourceMappingURL=MasonryItem.js.map
|