@lumx/react 3.20.1-alpha.24 → 3.20.1-alpha.26
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/_internal/Button-85482487.js +98 -0
- package/_internal/Button-85482487.js.map +1 -0
- package/_internal/ButtonRoot-823f3e9c.js +117 -0
- package/_internal/ButtonRoot-823f3e9c.js.map +1 -0
- package/_internal/Chip-a34f6905.js +146 -0
- package/_internal/Chip-a34f6905.js.map +1 -0
- package/_internal/ClickAwayProvider-7093ba23.js +95 -0
- package/_internal/ClickAwayProvider-7093ba23.js.map +1 -0
- package/_internal/DisabledStateContext-ea04260d.js +29 -0
- package/_internal/DisabledStateContext-ea04260d.js.map +1 -0
- package/_internal/HeadingLevelProvider-ebdcb0c7.js +61 -0
- package/_internal/HeadingLevelProvider-ebdcb0c7.js.map +1 -0
- package/_internal/IconButton-1a22c4c8.js +77 -0
- package/_internal/IconButton-1a22c4c8.js.map +1 -0
- package/_internal/ImageCaption-a0a6de5c.js +75 -0
- package/_internal/ImageCaption-a0a6de5c.js.map +1 -0
- package/_internal/List-54237e0e.js +793 -0
- package/_internal/List-54237e0e.js.map +1 -0
- package/_internal/PopoverDialog-4ebe79f2.js +655 -0
- package/_internal/PopoverDialog-4ebe79f2.js.map +1 -0
- package/_internal/Portal-3f86608e.js +45 -0
- package/_internal/Portal-3f86608e.js.map +1 -0
- package/_internal/RawClickable-2c2b6a89.js +52 -0
- package/_internal/RawClickable-2c2b6a89.js.map +1 -0
- package/_internal/Slides-ae91d12c.js +682 -0
- package/_internal/Slides-ae91d12c.js.map +1 -0
- package/_internal/ThemeContext-3181f000.js +14 -0
- package/_internal/ThemeContext-3181f000.js.map +1 -0
- package/_internal/Thumbnail-0872250e.js +314 -0
- package/_internal/Thumbnail-0872250e.js.map +1 -0
- package/_internal/check-circle-de24f857.js +4 -0
- package/_internal/check-circle-de24f857.js.map +1 -0
- package/_internal/chevron-right-827b804a.js +6 -0
- package/_internal/chevron-right-827b804a.js.map +1 -0
- package/_internal/chevron-up-0b9c76cb.js +6 -0
- package/_internal/chevron-up-0b9c76cb.js.map +1 -0
- package/_internal/close-circle-ef5d1aac.js +4 -0
- package/_internal/close-circle-ef5d1aac.js.map +1 -0
- package/_internal/close-eaf6c45a.js +4 -0
- package/_internal/close-eaf6c45a.js.map +1 -0
- package/_internal/components/alert-dialog-0eeb06ce.js +163 -0
- package/_internal/components/alert-dialog-0eeb06ce.js.map +1 -0
- package/_internal/components/autocomplete-32170542.js +261 -0
- package/_internal/components/autocomplete-32170542.js.map +1 -0
- package/_internal/components/avatar-d2214a61.js +83 -0
- package/_internal/components/avatar-d2214a61.js.map +1 -0
- package/_internal/components/badge-8390e590.js +81 -0
- package/_internal/components/badge-8390e590.js.map +1 -0
- package/_internal/components/button-b5818c5a.js +47 -0
- package/_internal/components/button-b5818c5a.js.map +1 -0
- package/_internal/components/checkbox-346834f8.js +143 -0
- package/_internal/components/checkbox-346834f8.js.map +1 -0
- package/_internal/components/chip-e40c5521.js +102 -0
- package/_internal/components/chip-e40c5521.js.map +1 -0
- package/_internal/components/comment-block-a4997791.js +138 -0
- package/_internal/components/comment-block-a4997791.js.map +1 -0
- package/_internal/components/date-picker-48a39549.js +2 -0
- package/_internal/components/date-picker-48a39549.js.map +1 -0
- package/_internal/components/dialog-ebdb9500.js +238 -0
- package/_internal/components/dialog-ebdb9500.js.map +1 -0
- package/_internal/components/divider-116af6b9.js +50 -0
- package/_internal/components/divider-116af6b9.js.map +1 -0
- package/_internal/components/drag-handle-6b073866.js +52 -0
- package/_internal/components/drag-handle-6b073866.js.map +1 -0
- package/_internal/components/dropdown-0baed51b.js +147 -0
- package/_internal/components/dropdown-0baed51b.js.map +1 -0
- package/_internal/components/expansion-panel-80edf6c9.js +167 -0
- package/_internal/components/expansion-panel-80edf6c9.js.map +1 -0
- package/_internal/components/flag-7c9d3abf.js +59 -0
- package/_internal/components/flag-7c9d3abf.js.map +1 -0
- package/_internal/components/flex-box-55144e5f.js +56 -0
- package/_internal/components/flex-box-55144e5f.js.map +1 -0
- package/_internal/components/generic-block-ff0509ee.js +124 -0
- package/_internal/components/generic-block-ff0509ee.js.map +1 -0
- package/_internal/components/grid-6f1b5a41.js +104 -0
- package/_internal/components/grid-6f1b5a41.js.map +1 -0
- package/_internal/components/grid-column-f01df853.js +59 -0
- package/_internal/components/grid-column-f01df853.js.map +1 -0
- package/_internal/components/heading-d4c66a34.js +53 -0
- package/_internal/components/heading-d4c66a34.js.map +1 -0
- package/_internal/components/icon-7c79ab42.js +2 -0
- package/_internal/components/icon-7c79ab42.js.map +1 -0
- package/_internal/components/image-block-755d8b96.js +110 -0
- package/_internal/components/image-block-755d8b96.js.map +1 -0
- package/_internal/components/image-lightbox-d31dcd8a.js +759 -0
- package/_internal/components/image-lightbox-d31dcd8a.js.map +1 -0
- package/_internal/components/inline-list-e6f19a98.js +74 -0
- package/_internal/components/inline-list-e6f19a98.js.map +1 -0
- package/_internal/components/input-helper-64153099.js +71 -0
- package/_internal/components/input-helper-64153099.js.map +1 -0
- package/_internal/components/input-label-2feb0bb0.js +59 -0
- package/_internal/components/input-label-2feb0bb0.js.map +1 -0
- package/_internal/components/lightbox-9dbd7c15.js +155 -0
- package/_internal/components/lightbox-9dbd7c15.js.map +1 -0
- package/_internal/components/link-f9421eab.js +72 -0
- package/_internal/components/link-f9421eab.js.map +1 -0
- package/_internal/components/link-preview-5c7e3878.js +117 -0
- package/_internal/components/link-preview-5c7e3878.js.map +1 -0
- package/_internal/components/list-b08d8423.js +71 -0
- package/_internal/components/list-b08d8423.js.map +1 -0
- package/_internal/components/message-b3957df0.js +98 -0
- package/_internal/components/message-b3957df0.js.map +1 -0
- package/_internal/components/mosaic-742a9109.js +95 -0
- package/_internal/components/mosaic-742a9109.js.map +1 -0
- package/_internal/components/navigation-b1cd43c3.js +225 -0
- package/_internal/components/navigation-b1cd43c3.js.map +1 -0
- package/_internal/components/notification-94679f51.js +146 -0
- package/_internal/components/notification-94679f51.js.map +1 -0
- package/_internal/components/popover-65bfbc57.js +3 -0
- package/_internal/components/popover-65bfbc57.js.map +1 -0
- package/_internal/components/post-block-3ac52237.js +109 -0
- package/_internal/components/post-block-3ac52237.js.map +1 -0
- package/_internal/components/progress-f39c3fa2.js +182 -0
- package/_internal/components/progress-f39c3fa2.js.map +1 -0
- package/_internal/components/progress-tracker-997931ac.js +309 -0
- package/_internal/components/progress-tracker-997931ac.js.map +1 -0
- package/_internal/components/radio-button-559a4863.js +149 -0
- package/_internal/components/radio-button-559a4863.js.map +1 -0
- package/_internal/components/select-f3b44cb6.js +458 -0
- package/_internal/components/select-f3b44cb6.js.map +1 -0
- package/_internal/components/side-navigation-414825d8.js +165 -0
- package/_internal/components/side-navigation-414825d8.js.map +1 -0
- package/_internal/components/skeleton-c66516ee.js +166 -0
- package/_internal/components/skeleton-c66516ee.js.map +1 -0
- package/_internal/components/slider-efbfbc45.js +311 -0
- package/_internal/components/slider-efbfbc45.js.map +1 -0
- package/_internal/components/slideshow-dc4b79ae.js +151 -0
- package/_internal/components/slideshow-dc4b79ae.js.map +1 -0
- package/_internal/components/switch-769a2a04.js +122 -0
- package/_internal/components/switch-769a2a04.js.map +1 -0
- package/_internal/components/table-c43ec4a5.js +297 -0
- package/_internal/components/table-c43ec4a5.js.map +1 -0
- package/_internal/components/tabs-4037fe57.js +298 -0
- package/_internal/components/tabs-4037fe57.js.map +1 -0
- package/_internal/components/text-851c62f8.js +2 -0
- package/_internal/components/text-851c62f8.js.map +1 -0
- package/_internal/components/text-field-0a15a15d.js +360 -0
- package/_internal/components/text-field-0a15a15d.js.map +1 -0
- package/_internal/components/thumbnail-f1784929.js +42 -0
- package/_internal/components/thumbnail-f1784929.js.map +1 -0
- package/_internal/components/toolbar-a43533a2.js +61 -0
- package/_internal/components/toolbar-a43533a2.js.map +1 -0
- package/_internal/components/tooltip-2885ab2e.js +327 -0
- package/_internal/components/tooltip-2885ab2e.js.map +1 -0
- package/_internal/components/uploader-7bc3adaa.js +153 -0
- package/_internal/components/uploader-7bc3adaa.js.map +1 -0
- package/_internal/components/user-block-5f7b09af.js +145 -0
- package/_internal/components/user-block-5f7b09af.js.map +1 -0
- package/_internal/constants-b9e57936.js +2155 -0
- package/_internal/constants-b9e57936.js.map +1 -0
- package/_internal/constants-d0e3f49e.js +24 -0
- package/_internal/constants-d0e3f49e.js.map +1 -0
- package/_internal/context-9d1336a1.js +19 -0
- package/_internal/context-9d1336a1.js.map +1 -0
- package/_internal/forwardRef-15f62847.js +70 -0
- package/_internal/forwardRef-15f62847.js.map +1 -0
- package/_internal/getFocusableElements-230173a8.js +13 -0
- package/_internal/getFocusableElements-230173a8.js.map +1 -0
- package/_internal/index-192f8ada.js +103 -0
- package/_internal/index-192f8ada.js.map +1 -0
- package/_internal/index-9df37c0d.js +436 -0
- package/_internal/index-9df37c0d.js.map +1 -0
- package/_internal/index-b06353f2.js +117 -0
- package/_internal/index-b06353f2.js.map +1 -0
- package/_internal/information-49bbeed3.js +6 -0
- package/_internal/information-49bbeed3.js.map +1 -0
- package/_internal/isComponent-78df9309.js +20 -0
- package/_internal/isComponent-78df9309.js.map +1 -0
- package/_internal/isComponentType-e806b848.js +9 -0
- package/_internal/isComponentType-e806b848.js.map +1 -0
- package/_internal/mergeRefs-f0d7d6ea.js +30 -0
- package/_internal/mergeRefs-f0d7d6ea.js.map +1 -0
- package/{src/utils/partitionMulti.ts → _internal/partitionMulti-4daccdd5.js} +5 -9
- package/_internal/partitionMulti-4daccdd5.js.map +1 -0
- package/_internal/state-db358714.js +130 -0
- package/_internal/state-db358714.js.map +1 -0
- package/_internal/useBooleanState-2a3d237c.js +12 -0
- package/_internal/useBooleanState-2a3d237c.js.map +1 -0
- package/_internal/useCallbackOnEscape-ea4d9eb4.js +62 -0
- package/_internal/useCallbackOnEscape-ea4d9eb4.js.map +1 -0
- package/_internal/useDisableBodyScroll-36bd7352.js +219 -0
- package/_internal/useDisableBodyScroll-36bd7352.js.map +1 -0
- package/_internal/useDisableStateProps-69e16b7c.js +36 -0
- package/_internal/useDisableStateProps-69e16b7c.js.map +1 -0
- package/_internal/useFocusTrap-c3c6378b.js +112 -0
- package/_internal/useFocusTrap-c3c6378b.js.map +1 -0
- package/_internal/useId-3a1facc0.js +18 -0
- package/_internal/useId-3a1facc0.js.map +1 -0
- package/_internal/useRovingTabIndex-7daf0f24.js +77 -0
- package/_internal/useRovingTabIndex-7daf0f24.js.map +1 -0
- package/_internal/useTransitionVisibility-321fdbfa.js +50 -0
- package/_internal/useTransitionVisibility-321fdbfa.js.map +1 -0
- package/_internal/wrapChildrenIconWithSpaces-f1e91251.js +20 -0
- package/_internal/wrapChildrenIconWithSpaces-f1e91251.js.map +1 -0
- package/index.d.ts +7 -352
- package/index.js +65 -14486
- package/index.js.map +1 -1
- package/package.json +4 -11
- package/utils/index.d.ts +1 -1
- package/utils/index.js +3 -1
- package/utils/index.js.map +1 -1
- package/_internal/Falsy.d.ts +0 -7
- package/_internal/index.js +0 -236
- package/_internal/index.js.map +0 -1
- package/src/components/alert-dialog/AlertDialog.stories.tsx +0 -127
- package/src/components/alert-dialog/AlertDialog.test.tsx +0 -34
- package/src/components/alert-dialog/AlertDialog.tsx +0 -189
- package/src/components/alert-dialog/index.ts +0 -1
- package/src/components/autocomplete/Autocomplete.stories.tsx +0 -75
- package/src/components/autocomplete/Autocomplete.test.tsx +0 -99
- package/src/components/autocomplete/Autocomplete.tsx +0 -294
- package/src/components/autocomplete/AutocompleteMultiple.stories.tsx +0 -167
- package/src/components/autocomplete/AutocompleteMultiple.test.tsx +0 -61
- package/src/components/autocomplete/AutocompleteMultiple.tsx +0 -156
- package/src/components/autocomplete/__mockData__/index.ts +0 -39
- package/src/components/autocomplete/index.ts +0 -2
- package/src/components/avatar/Avatar.stories.tsx +0 -119
- package/src/components/avatar/Avatar.test.tsx +0 -32
- package/src/components/avatar/Avatar.tsx +0 -114
- package/src/components/avatar/index.ts +0 -1
- package/src/components/badge/Badge.stories.tsx +0 -69
- package/src/components/badge/Badge.test.tsx +0 -45
- package/src/components/badge/Badge.tsx +0 -58
- package/src/components/badge/BadgeWrapper.stories.tsx +0 -75
- package/src/components/badge/BadgeWrapper.test.tsx +0 -47
- package/src/components/badge/BadgeWrapper.tsx +0 -37
- package/src/components/badge/index.ts +0 -2
- package/src/components/button/Button.stories.tsx +0 -355
- package/src/components/button/Button.test.tsx +0 -125
- package/src/components/button/Button.tsx +0 -101
- package/src/components/button/ButtonGroup.stories.tsx +0 -52
- package/src/components/button/ButtonGroup.test.tsx +0 -41
- package/src/components/button/ButtonGroup.tsx +0 -50
- package/src/components/button/ButtonRoot.tsx +0 -163
- package/src/components/button/IconButton.stories.tsx +0 -52
- package/src/components/button/IconButton.test.tsx +0 -66
- package/src/components/button/IconButton.tsx +0 -91
- package/src/components/button/index.ts +0 -4
- package/src/components/checkbox/Checkbox.stories.tsx +0 -64
- package/src/components/checkbox/Checkbox.test.tsx +0 -154
- package/src/components/checkbox/Checkbox.tsx +0 -164
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/chip/Chip.stories.tsx +0 -164
- package/src/components/chip/Chip.test.tsx +0 -243
- package/src/components/chip/Chip.tsx +0 -168
- package/src/components/chip/ChipGroup.stories.tsx +0 -47
- package/src/components/chip/ChipGroup.test.tsx +0 -37
- package/src/components/chip/ChipGroup.tsx +0 -60
- package/src/components/chip/index.ts +0 -2
- package/src/components/comment-block/CommentBlock.stories.tsx +0 -91
- package/src/components/comment-block/CommentBlock.test.tsx +0 -28
- package/src/components/comment-block/CommentBlock.tsx +0 -172
- package/src/components/comment-block/index.ts +0 -1
- package/src/components/date-picker/DatePicker.stories.tsx +0 -118
- package/src/components/date-picker/DatePicker.test.tsx +0 -34
- package/src/components/date-picker/DatePicker.tsx +0 -52
- package/src/components/date-picker/DatePickerControlled.test.tsx +0 -91
- package/src/components/date-picker/DatePickerControlled.tsx +0 -259
- package/src/components/date-picker/DatePickerField.stories.tsx +0 -100
- package/src/components/date-picker/DatePickerField.test.tsx +0 -70
- package/src/components/date-picker/DatePickerField.tsx +0 -135
- package/src/components/date-picker/constants.ts +0 -11
- package/src/components/date-picker/index.ts +0 -4
- package/src/components/date-picker/types.ts +0 -28
- package/src/components/dialog/Dialog.stories.tsx +0 -318
- package/src/components/dialog/Dialog.test.tsx +0 -97
- package/src/components/dialog/Dialog.tsx +0 -288
- package/src/components/dialog/index.ts +0 -1
- package/src/components/divider/Divider.test.tsx +0 -51
- package/src/components/divider/Divider.tsx +0 -50
- package/src/components/divider/index.ts +0 -1
- package/src/components/drag-handle/DragHandle.test.tsx +0 -36
- package/src/components/drag-handle/DragHandle.tsx +0 -51
- package/src/components/drag-handle/index.ts +0 -1
- package/src/components/dropdown/Dropdown.stories.tsx +0 -31
- package/src/components/dropdown/Dropdown.test.tsx +0 -66
- package/src/components/dropdown/Dropdown.tsx +0 -186
- package/src/components/dropdown/index.ts +0 -1
- package/src/components/expansion-panel/ExpansionPanel.stories.tsx +0 -91
- package/src/components/expansion-panel/ExpansionPanel.test.tsx +0 -185
- package/src/components/expansion-panel/ExpansionPanel.tsx +0 -195
- package/src/components/expansion-panel/index.ts +0 -1
- package/src/components/flag/Flag.stories.tsx +0 -48
- package/src/components/flag/Flag.test.tsx +0 -62
- package/src/components/flag/Flag.tsx +0 -52
- package/src/components/flag/index.ts +0 -1
- package/src/components/flex-box/FlexBox.stories.tsx +0 -156
- package/src/components/flex-box/FlexBox.test.tsx +0 -24
- package/src/components/flex-box/FlexBox.tsx +0 -100
- package/src/components/flex-box/index.ts +0 -1
- package/src/components/generic-block/GenericBlock.stories.jsx +0 -128
- package/src/components/generic-block/GenericBlock.test.tsx +0 -156
- package/src/components/generic-block/GenericBlock.tsx +0 -225
- package/src/components/generic-block/constants.ts +0 -9
- package/src/components/generic-block/index.ts +0 -2
- package/src/components/grid/Grid.tsx +0 -83
- package/src/components/grid/GridItem.tsx +0 -55
- package/src/components/grid/index.ts +0 -2
- package/src/components/grid-column/GridColumn.stories.tsx +0 -45
- package/src/components/grid-column/GridColumn.test.jsx +0 -56
- package/src/components/grid-column/GridColumn.tsx +0 -83
- package/src/components/grid-column/index.ts +0 -1
- package/src/components/heading/Heading.stories.tsx +0 -69
- package/src/components/heading/Heading.test.tsx +0 -82
- package/src/components/heading/Heading.tsx +0 -65
- package/src/components/heading/HeadingLevelProvider.tsx +0 -30
- package/src/components/heading/constants.ts +0 -16
- package/src/components/heading/context.tsx +0 -13
- package/src/components/heading/index.ts +0 -3
- package/src/components/heading/useHeadingLevel.tsx +0 -8
- package/src/components/icon/Icon.stories.tsx +0 -73
- package/src/components/icon/Icon.test.tsx +0 -125
- package/src/components/icon/Icon.tsx +0 -133
- package/src/components/icon/index.ts +0 -1
- package/src/components/image-block/ImageBlock.stories.tsx +0 -117
- package/src/components/image-block/ImageBlock.test.tsx +0 -58
- package/src/components/image-block/ImageBlock.tsx +0 -142
- package/src/components/image-block/ImageCaption.tsx +0 -115
- package/src/components/image-block/index.ts +0 -1
- package/src/components/image-lightbox/ImageLightbox.stories.tsx +0 -160
- package/src/components/image-lightbox/ImageLightbox.test.tsx +0 -254
- package/src/components/image-lightbox/ImageLightbox.tsx +0 -90
- package/src/components/image-lightbox/constants.ts +0 -11
- package/src/components/image-lightbox/index.ts +0 -2
- package/src/components/image-lightbox/internal/ImageSlide.tsx +0 -107
- package/src/components/image-lightbox/internal/ImageSlideshow.tsx +0 -164
- package/src/components/image-lightbox/internal/useAnimateScroll.ts +0 -55
- package/src/components/image-lightbox/internal/usePointerZoom.ts +0 -148
- package/src/components/image-lightbox/types.ts +0 -48
- package/src/components/image-lightbox/useImageLightbox.tsx +0 -141
- package/src/components/inline-list/InlineList.stories.tsx +0 -77
- package/src/components/inline-list/InlineList.test.tsx +0 -52
- package/src/components/inline-list/InlineList.tsx +0 -96
- package/src/components/inline-list/index.ts +0 -1
- package/src/components/input-helper/InputHelper.stories.tsx +0 -35
- package/src/components/input-helper/InputHelper.test.tsx +0 -55
- package/src/components/input-helper/InputHelper.tsx +0 -65
- package/src/components/input-helper/constants.ts +0 -11
- package/src/components/input-helper/index.ts +0 -1
- package/src/components/input-label/InputLabel.stories.tsx +0 -45
- package/src/components/input-label/InputLabel.test.tsx +0 -59
- package/src/components/input-label/InputLabel.tsx +0 -69
- package/src/components/input-label/index.ts +0 -1
- package/src/components/lightbox/Lightbox.stories.tsx +0 -101
- package/src/components/lightbox/Lightbox.test.tsx +0 -53
- package/src/components/lightbox/Lightbox.tsx +0 -180
- package/src/components/lightbox/index.ts +0 -1
- package/src/components/link/Link.stories.tsx +0 -195
- package/src/components/link/Link.test.tsx +0 -127
- package/src/components/link/Link.tsx +0 -106
- package/src/components/link/index.ts +0 -1
- package/src/components/link-preview/LinkPreview.stories.tsx +0 -61
- package/src/components/link-preview/LinkPreview.test.tsx +0 -105
- package/src/components/link-preview/LinkPreview.tsx +0 -158
- package/src/components/link-preview/index.ts +0 -1
- package/src/components/list/List.stories.tsx +0 -116
- package/src/components/list/List.test.tsx +0 -18
- package/src/components/list/List.tsx +0 -104
- package/src/components/list/ListDivider.stories.tsx +0 -12
- package/src/components/list/ListDivider.test.tsx +0 -22
- package/src/components/list/ListDivider.tsx +0 -35
- package/src/components/list/ListItem.stories.tsx +0 -66
- package/src/components/list/ListItem.test.tsx +0 -93
- package/src/components/list/ListItem.tsx +0 -157
- package/src/components/list/ListSubheader.stories.tsx +0 -11
- package/src/components/list/ListSubheader.test.tsx +0 -21
- package/src/components/list/ListSubheader.tsx +0 -44
- package/src/components/list/index.ts +0 -4
- package/src/components/list/useInteractiveList.tsx +0 -202
- package/src/components/message/Message.stories.tsx +0 -72
- package/src/components/message/Message.test.tsx +0 -76
- package/src/components/message/Message.tsx +0 -100
- package/src/components/message/index.ts +0 -1
- package/src/components/mosaic/Mosaic.stories.tsx +0 -89
- package/src/components/mosaic/Mosaic.test.tsx +0 -77
- package/src/components/mosaic/Mosaic.tsx +0 -98
- package/src/components/mosaic/index.ts +0 -1
- package/src/components/navigation/Navigation.stories.tsx +0 -234
- package/src/components/navigation/Navigation.test.tsx +0 -65
- package/src/components/navigation/Navigation.tsx +0 -79
- package/src/components/navigation/NavigationItem.test.tsx +0 -35
- package/src/components/navigation/NavigationItem.tsx +0 -82
- package/src/components/navigation/NavigationSection.test.tsx +0 -137
- package/src/components/navigation/NavigationSection.tsx +0 -108
- package/src/components/navigation/context.tsx +0 -7
- package/src/components/navigation/index.ts +0 -1
- package/src/components/notification/Notification.test.tsx +0 -94
- package/src/components/notification/Notification.tsx +0 -138
- package/src/components/notification/Notifications.stories.tsx +0 -92
- package/src/components/notification/constants.ts +0 -28
- package/src/components/notification/index.ts +0 -1
- package/src/components/popover/Popover.stories.tsx +0 -264
- package/src/components/popover/Popover.test.tsx +0 -62
- package/src/components/popover/Popover.tsx +0 -201
- package/src/components/popover/constants.ts +0 -62
- package/src/components/popover/index.ts +0 -3
- package/src/components/popover/usePopoverStyle.tsx +0 -184
- package/src/components/popover/useRestoreFocusOnClose.tsx +0 -47
- package/src/components/popover-dialog/PopoverDialog.stories.tsx +0 -64
- package/src/components/popover-dialog/PopoverDialog.test.tsx +0 -139
- package/src/components/popover-dialog/PopoverDialog.tsx +0 -74
- package/src/components/popover-dialog/index.tsx +0 -1
- package/src/components/post-block/PostBlock.test.tsx +0 -27
- package/src/components/post-block/PostBlock.tsx +0 -122
- package/src/components/post-block/index.ts +0 -1
- package/src/components/progress/Progress.tsx +0 -68
- package/src/components/progress/ProgressCircular.stories.tsx +0 -43
- package/src/components/progress/ProgressCircular.test.tsx +0 -46
- package/src/components/progress/ProgressCircular.tsx +0 -82
- package/src/components/progress/ProgressLinear.stories.tsx +0 -12
- package/src/components/progress/ProgressLinear.test.tsx +0 -30
- package/src/components/progress/ProgressLinear.tsx +0 -50
- package/src/components/progress/index.ts +0 -3
- package/src/components/progress-tracker/ProgressTracker.stories.tsx +0 -145
- package/src/components/progress-tracker/ProgressTracker.test.tsx +0 -42
- package/src/components/progress-tracker/ProgressTracker.tsx +0 -87
- package/src/components/progress-tracker/ProgressTrackerProvider.test.tsx +0 -65
- package/src/components/progress-tracker/ProgressTrackerProvider.tsx +0 -67
- package/src/components/progress-tracker/ProgressTrackerStep.test.tsx +0 -36
- package/src/components/progress-tracker/ProgressTrackerStep.tsx +0 -159
- package/src/components/progress-tracker/ProgressTrackerStepPanel.test.tsx +0 -34
- package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +0 -67
- package/src/components/progress-tracker/index.ts +0 -4
- package/src/components/radio-button/RadioButton.stories.tsx +0 -71
- package/src/components/radio-button/RadioButton.test.tsx +0 -143
- package/src/components/radio-button/RadioButton.tsx +0 -143
- package/src/components/radio-button/RadioGroup.stories.tsx +0 -39
- package/src/components/radio-button/RadioGroup.test.tsx +0 -29
- package/src/components/radio-button/RadioGroup.tsx +0 -44
- package/src/components/radio-button/index.ts +0 -2
- package/src/components/select/Select.stories.tsx +0 -385
- package/src/components/select/Select.test.tsx +0 -199
- package/src/components/select/Select.tsx +0 -199
- package/src/components/select/SelectMultiple.stories.tsx +0 -315
- package/src/components/select/SelectMultiple.test.tsx +0 -213
- package/src/components/select/SelectMultiple.tsx +0 -206
- package/src/components/select/WithSelectContext.tsx +0 -147
- package/src/components/select/constants.ts +0 -55
- package/src/components/select/index.ts +0 -2
- package/src/components/side-navigation/SideNavigation.stories.tsx +0 -191
- package/src/components/side-navigation/SideNavigation.test.tsx +0 -37
- package/src/components/side-navigation/SideNavigation.tsx +0 -52
- package/src/components/side-navigation/SideNavigationItem.stories.tsx +0 -133
- package/src/components/side-navigation/SideNavigationItem.test.tsx +0 -136
- package/src/components/side-navigation/SideNavigationItem.tsx +0 -165
- package/src/components/side-navigation/index.ts +0 -2
- package/src/components/skeleton/SkeletonCircle.stories.tsx +0 -41
- package/src/components/skeleton/SkeletonCircle.test.tsx +0 -27
- package/src/components/skeleton/SkeletonCircle.tsx +0 -52
- package/src/components/skeleton/SkeletonRectangle.stories.tsx +0 -82
- package/src/components/skeleton/SkeletonRectangle.test.tsx +0 -27
- package/src/components/skeleton/SkeletonRectangle.tsx +0 -88
- package/src/components/skeleton/SkeletonTypography.stories.tsx +0 -19
- package/src/components/skeleton/SkeletonTypography.test.tsx +0 -27
- package/src/components/skeleton/SkeletonTypography.tsx +0 -59
- package/src/components/skeleton/index.ts +0 -3
- package/src/components/slider/Slider.stories.tsx +0 -45
- package/src/components/slider/Slider.test.tsx +0 -29
- package/src/components/slider/Slider.tsx +0 -299
- package/src/components/slider/index.ts +0 -2
- package/src/components/slideshow/Slides.tsx +0 -130
- package/src/components/slideshow/Slideshow.stories.tsx +0 -179
- package/src/components/slideshow/Slideshow.test.tsx +0 -35
- package/src/components/slideshow/Slideshow.tsx +0 -173
- package/src/components/slideshow/SlideshowControls.stories.tsx +0 -100
- package/src/components/slideshow/SlideshowControls.tsx +0 -243
- package/src/components/slideshow/SlideshowItem.tsx +0 -44
- package/src/components/slideshow/SlideshowItemGroup.tsx +0 -60
- package/src/components/slideshow/constants.ts +0 -24
- package/src/components/slideshow/index.ts +0 -4
- package/src/components/slideshow/useKeyNavigate.ts +0 -28
- package/src/components/slideshow/usePaginationVisibleRange.ts +0 -37
- package/src/components/slideshow/useSlideFocusManagement.tsx +0 -92
- package/src/components/slideshow/useSwipeNavigate.ts +0 -18
- package/src/components/switch/Switch.stories.tsx +0 -49
- package/src/components/switch/Switch.test.tsx +0 -144
- package/src/components/switch/Switch.tsx +0 -145
- package/src/components/switch/index.ts +0 -1
- package/src/components/table/Table.test.tsx +0 -29
- package/src/components/table/Table.tsx +0 -59
- package/src/components/table/TableBody.test.tsx +0 -30
- package/src/components/table/TableBody.tsx +0 -42
- package/src/components/table/TableCell.test.tsx +0 -72
- package/src/components/table/TableCell.tsx +0 -130
- package/src/components/table/TableHeader.test.tsx +0 -30
- package/src/components/table/TableHeader.tsx +0 -48
- package/src/components/table/TableRow.test.tsx +0 -40
- package/src/components/table/TableRow.tsx +0 -71
- package/src/components/table/index.ts +0 -5
- package/src/components/tabs/Tab.test.tsx +0 -50
- package/src/components/tabs/Tab.tsx +0 -133
- package/src/components/tabs/TabList.test.tsx +0 -49
- package/src/components/tabs/TabList.tsx +0 -94
- package/src/components/tabs/TabPanel.test.tsx +0 -37
- package/src/components/tabs/TabPanel.tsx +0 -67
- package/src/components/tabs/TabProvider.test.tsx +0 -161
- package/src/components/tabs/TabProvider.tsx +0 -67
- package/src/components/tabs/Tabs.stories.tsx +0 -170
- package/src/components/tabs/index.ts +0 -4
- package/src/components/tabs/state.ts +0 -114
- package/src/components/tabs/test-utils.ts +0 -39
- package/src/components/text/Text.stories.tsx +0 -177
- package/src/components/text/Text.test.tsx +0 -92
- package/src/components/text/Text.tsx +0 -139
- package/src/components/text/index.ts +0 -1
- package/src/components/text-field/TextField.stories.tsx +0 -180
- package/src/components/text-field/TextField.test.tsx +0 -298
- package/src/components/text-field/TextField.tsx +0 -493
- package/src/components/text-field/index.ts +0 -1
- package/src/components/thumbnail/Thumbnail.stories.tsx +0 -448
- package/src/components/thumbnail/Thumbnail.test.tsx +0 -88
- package/src/components/thumbnail/Thumbnail.tsx +0 -248
- package/src/components/thumbnail/index.ts +0 -3
- package/src/components/thumbnail/types.ts +0 -48
- package/src/components/thumbnail/useFocusPointStyle.test.ts +0 -92
- package/src/components/thumbnail/useFocusPointStyle.tsx +0 -107
- package/src/components/thumbnail/useImageLoad.ts +0 -40
- package/src/components/toolbar/Toolbar.tsx +0 -68
- package/src/components/toolbar/index.ts +0 -1
- package/src/components/tooltip/Tooltip.stories.tsx +0 -118
- package/src/components/tooltip/Tooltip.test.tsx +0 -417
- package/src/components/tooltip/Tooltip.tsx +0 -165
- package/src/components/tooltip/constants.ts +0 -8
- package/src/components/tooltip/context.tsx +0 -17
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/tooltip/useInjectTooltipRef.tsx +0 -55
- package/src/components/tooltip/useTooltipOpen.tsx +0 -143
- package/src/components/uploader/Uploader.stories.tsx +0 -109
- package/src/components/uploader/Uploader.test.tsx +0 -146
- package/src/components/uploader/Uploader.tsx +0 -177
- package/src/components/uploader/index.ts +0 -1
- package/src/components/user-block/UserBlock.stories.tsx +0 -133
- package/src/components/user-block/UserBlock.test.tsx +0 -106
- package/src/components/user-block/UserBlock.tsx +0 -193
- package/src/components/user-block/index.ts +0 -1
- package/src/constants.ts +0 -27
- package/src/hooks/useBooleanState.tsx +0 -13
- package/src/hooks/useCallbackOnEscape.ts +0 -34
- package/src/hooks/useChipGroupNavigation.tsx +0 -75
- package/src/hooks/useClickAway.tsx +0 -48
- package/src/hooks/useDisableBodyScroll.ts +0 -28
- package/src/hooks/useEventCallback.tsx +0 -17
- package/src/hooks/useFocus.tsx +0 -21
- package/src/hooks/useFocusTrap.ts +0 -93
- package/src/hooks/useFocusWithin.ts +0 -33
- package/src/hooks/useId.test.tsx +0 -22
- package/src/hooks/useId.ts +0 -15
- package/src/hooks/useImageSize.ts +0 -17
- package/src/hooks/useInfiniteScroll.tsx +0 -60
- package/src/hooks/useIntersectionObserver.tsx +0 -43
- package/src/hooks/useInterval.tsx +0 -31
- package/src/hooks/useKeyboardListNavigation.tsx +0 -204
- package/src/hooks/useListenFocus.tsx +0 -26
- package/src/hooks/useOverflowTooltipLabel.tsx +0 -32
- package/src/hooks/usePopper.ts +0 -12
- package/src/hooks/usePreviousValue.ts +0 -12
- package/src/hooks/useRovingTabIndex.tsx +0 -90
- package/src/hooks/useSizeOnWindowResize.ts +0 -30
- package/src/hooks/useSlideshowControls.ts +0 -246
- package/src/hooks/useStopPropagation.ts +0 -21
- package/src/hooks/useTransitionVisibility.ts +0 -48
- package/src/index.ts +0 -63
- package/src/stories/controls/color.ts +0 -7
- package/src/stories/controls/element.ts +0 -6
- package/src/stories/controls/focusPoint.ts +0 -1
- package/src/stories/controls/icons.ts +0 -126
- package/src/stories/controls/image.ts +0 -84
- package/src/stories/controls/selectArgType.ts +0 -8
- package/src/stories/controls/theme.ts +0 -3
- package/src/stories/controls/typography.ts +0 -5
- package/src/stories/controls/withUndefined.ts +0 -1
- package/src/stories/decorators/withChromaticForceScreenSize.tsx +0 -7
- package/src/stories/decorators/withCombinations.tsx +0 -132
- package/src/stories/decorators/withNestedProps.tsx +0 -22
- package/src/stories/decorators/withResizableBox.tsx +0 -21
- package/src/stories/decorators/withThemedBackground.tsx +0 -16
- package/src/stories/decorators/withValueOnChange.tsx +0 -18
- package/src/stories/decorators/withWrapper.tsx +0 -19
- package/src/stories/generated/Autocomplete/Demos.stories.tsx +0 -7
- package/src/stories/generated/Avatar/Demos.stories.tsx +0 -7
- package/src/stories/generated/Badge/Demos.stories.tsx +0 -9
- package/src/stories/generated/Button/Demos.stories.tsx +0 -11
- package/src/stories/generated/Checkbox/Demos.stories.tsx +0 -6
- package/src/stories/generated/Chip/Demos.stories.tsx +0 -11
- package/src/stories/generated/CommentBlock/Demos.stories.tsx +0 -8
- package/src/stories/generated/DatePicker/Demos.stories.tsx +0 -8
- package/src/stories/generated/Dialog/Demos.stories.tsx +0 -10
- package/src/stories/generated/Divider/Demos.stories.tsx +0 -6
- package/src/stories/generated/Dropdown/Demos.stories.tsx +0 -8
- package/src/stories/generated/ExpansionPanel/Demos.stories.tsx +0 -9
- package/src/stories/generated/Flag/Demos.stories.tsx +0 -6
- package/src/stories/generated/GenericBlock/Demos.stories.tsx +0 -8
- package/src/stories/generated/Heading/Demos.stories.tsx +0 -6
- package/src/stories/generated/Icon/Demos.stories.tsx +0 -8
- package/src/stories/generated/ImageBlock/Demos.stories.tsx +0 -9
- package/src/stories/generated/ImageLightbox/Demos.stories.tsx +0 -6
- package/src/stories/generated/Lightbox/Demos.stories.tsx +0 -6
- package/src/stories/generated/LinkPreview/Demos.stories.tsx +0 -7
- package/src/stories/generated/List/Demos.stories.tsx +0 -11
- package/src/stories/generated/Message/Demos.stories.tsx +0 -11
- package/src/stories/generated/Mosaic/Demos.stories.tsx +0 -10
- package/src/stories/generated/Notification/Demos.stories.tsx +0 -6
- package/src/stories/generated/Popover/Demos.stories.tsx +0 -11
- package/src/stories/generated/PopoverDialog/Demos.stories.tsx +0 -6
- package/src/stories/generated/PostBlock/Demos.stories.tsx +0 -6
- package/src/stories/generated/Progress/Demos.stories.tsx +0 -7
- package/src/stories/generated/ProgressTracker/Demos.stories.tsx +0 -9
- package/src/stories/generated/RadioButton/Demos.stories.tsx +0 -6
- package/src/stories/generated/Select/Demos.stories.tsx +0 -14
- package/src/stories/generated/SideNavigation/Demos.stories.tsx +0 -10
- package/src/stories/generated/Skeleton/Demos.stories.tsx +0 -9
- package/src/stories/generated/Slider/Demos.stories.tsx +0 -9
- package/src/stories/generated/Slideshow/Demos.stories.tsx +0 -8
- package/src/stories/generated/Switch/Demos.stories.tsx +0 -6
- package/src/stories/generated/Table/Demos.stories.tsx +0 -7
- package/src/stories/generated/Tabs/Demos.stories.tsx +0 -8
- package/src/stories/generated/TextField/Demos.stories.tsx +0 -20
- package/src/stories/generated/Thumbnail/Demos.stories.tsx +0 -12
- package/src/stories/generated/Toolbar/Demos.stories.tsx +0 -10
- package/src/stories/generated/Tooltip/Demos.stories.tsx +0 -8
- package/src/stories/generated/Uploader/Demos.stories.tsx +0 -8
- package/src/stories/generated/UserBlock/Demos.stories.tsx +0 -11
- package/src/stories/utils/CustomLink.tsx +0 -12
- package/src/stories/utils/concatPath.tsx +0 -17
- package/src/stories/utils/disableArgTypes.ts +0 -3
- package/src/stories/utils/initDemoShadowDOMPortal.ts +0 -10
- package/src/stories/utils/lorem.ts +0 -59
- package/src/stories/utils/theming.tsx +0 -166
- package/src/stories/utils/toFlattenProps.ts +0 -28
- package/src/stories/utils/withCategory.ts +0 -12
- package/src/testing/utils/ThemeSentinel.tsx +0 -10
- package/src/testing/utils/commonTestsSuiteRTL.tsx +0 -193
- package/src/testing/utils/index.ts +0 -1
- package/src/testing/utils/queries.ts +0 -19
- package/src/untypped-modules.d.ts +0 -9
- package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +0 -70
- package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +0 -69
- package/src/utils/ClickAwayProvider/index.ts +0 -1
- package/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +0 -54
- package/src/utils/MaterialThemeSwitcher/index.ts +0 -1
- package/src/utils/Portal/Portal.test.tsx +0 -31
- package/src/utils/Portal/Portal.tsx +0 -33
- package/src/utils/Portal/PortalProvider.stories.jsx +0 -22
- package/src/utils/Portal/PortalProvider.test.tsx +0 -72
- package/src/utils/Portal/PortalProvider.tsx +0 -24
- package/src/utils/Portal/index.tsx +0 -2
- package/src/utils/browser/DOM/findImage.tsx +0 -3
- package/src/utils/browser/DOM/startViewTransition.ts +0 -68
- package/src/utils/browser/focus/constants.ts +0 -7
- package/src/utils/browser/focus/getFirstAndLastFocusable.test.ts +0 -134
- package/src/utils/browser/focus/getFirstAndLastFocusable.ts +0 -21
- package/src/utils/browser/focus/getFocusableElements.test.ts +0 -151
- package/src/utils/browser/focus/getFocusableElements.ts +0 -7
- package/src/utils/browser/isFocusVisible.ts +0 -9
- package/src/utils/browser/isHoverNotSupported.test.js +0 -24
- package/src/utils/browser/isHoverNotSupported.ts +0 -2
- package/src/utils/browser/isReducedMotion.ts +0 -6
- package/src/utils/date/addMonthResetDay.test.ts +0 -13
- package/src/utils/date/addMonthResetDay.ts +0 -9
- package/src/utils/date/formatDayNumber.test.ts +0 -12
- package/src/utils/date/formatDayNumber.ts +0 -5
- package/src/utils/date/getFirstDayOfWeek.test.ts +0 -20
- package/src/utils/date/getFirstDayOfWeek.ts +0 -59
- package/src/utils/date/getMonthCalendar.test.ts +0 -127
- package/src/utils/date/getMonthCalendar.ts +0 -69
- package/src/utils/date/getWeekDays.test.ts +0 -48
- package/src/utils/date/getWeekDays.ts +0 -34
- package/src/utils/date/getYearDisplayName.test.ts +0 -20
- package/src/utils/date/getYearDisplayName.ts +0 -12
- package/src/utils/date/isDateValid.test.ts +0 -15
- package/src/utils/date/isDateValid.ts +0 -4
- package/src/utils/date/isSameDay.test.ts +0 -37
- package/src/utils/date/isSameDay.ts +0 -11
- package/src/utils/disabled/DisabledStateContext.tsx +0 -29
- package/src/utils/disabled/DisabledStateProvider.stories.tsx +0 -92
- package/src/utils/disabled/index.ts +0 -2
- package/src/utils/disabled/useDisableStateProps.test.tsx +0 -74
- package/src/utils/disabled/useDisableStateProps.tsx +0 -37
- package/src/utils/function/makeListenerTowerContext.ts +0 -32
- package/src/utils/index.ts +0 -7
- package/src/utils/locale/getCurrentLocale.ts +0 -4
- package/src/utils/locale/parseLocale.test.ts +0 -17
- package/src/utils/locale/parseLocale.ts +0 -23
- package/src/utils/locale/types.ts +0 -8
- package/src/utils/number/clamp.ts +0 -17
- package/src/utils/object/isEqual.test.ts +0 -25
- package/src/utils/object/isEqual.ts +0 -11
- package/src/utils/partitionMulti.test.ts +0 -27
- package/src/utils/react/OnBeforeUnmount.tsx +0 -20
- package/src/utils/react/RawClickable.test.tsx +0 -153
- package/src/utils/react/RawClickable.tsx +0 -65
- package/src/utils/react/flattenChildren.ts +0 -32
- package/src/utils/react/forwardRef.ts +0 -11
- package/src/utils/react/forwardRefPolymorphic.ts +0 -9
- package/src/utils/react/mergeRefs.ts +0 -33
- package/src/utils/react/renderLink.tsx +0 -17
- package/src/utils/react/skipRender.tsx +0 -18
- package/src/utils/react/unref.ts +0 -7
- package/src/utils/react/wrapChildrenIconWithSpaces.test.tsx +0 -37
- package/src/utils/react/wrapChildrenIconWithSpaces.tsx +0 -22
- package/src/utils/theme/ThemeContext.ts +0 -16
- package/src/utils/theme/invertTheme.ts +0 -4
- package/src/utils/type/Comp.ts +0 -14
- package/src/utils/type/ComponentRef.ts +0 -16
- package/src/utils/type/HasAriaDisabled.ts +0 -6
- package/src/utils/type/HasPolymorphicAs.ts +0 -6
- package/src/utils/type/HasRequiredLinkHref.ts +0 -1
- package/src/utils/type/MaybeElementOrRef.ts +0 -6
- package/src/utils/type/index.ts +0 -9
- package/src/utils/type/isComponent.ts +0 -33
- package/src/utils/type/isComponentType.ts +0 -9
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React__default, { Children, useRef } from 'react';
|
|
2
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
3
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
|
+
import { i as isComponent } from '../isComponent-78df9309.js';
|
|
5
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
6
|
+
import { p as partitionMulti } from '../partitionMulti-4daccdd5.js';
|
|
7
|
+
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
8
|
+
import { I as IS_BROWSER } from '../constants-d0e3f49e.js';
|
|
9
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
import { m as mdiChevronUp, a as mdiChevronDown } from '../chevron-up-0b9c76cb.js';
|
|
11
|
+
import { DragHandle } from './drag-handle-6b073866.js';
|
|
12
|
+
import { Theme, ColorPalette, Emphasis } from '@lumx/core/js/constants';
|
|
13
|
+
import { I as IconButton } from '../IconButton-1a22c4c8.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Component display name.
|
|
17
|
+
*/
|
|
18
|
+
const COMPONENT_NAME = 'ExpansionPanel';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Component default class name and class prefix.
|
|
22
|
+
*/
|
|
23
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Component default props.
|
|
27
|
+
*/
|
|
28
|
+
const DEFAULT_PROPS = {
|
|
29
|
+
closeMode: 'unmount'
|
|
30
|
+
};
|
|
31
|
+
const isDragHandle = isComponent(DragHandle);
|
|
32
|
+
const isHeader = isComponent('header');
|
|
33
|
+
const isFooter = isComponent('footer');
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* ExpansionPanel component.
|
|
37
|
+
*
|
|
38
|
+
* @param props Component props.
|
|
39
|
+
* @param ref Component ref.
|
|
40
|
+
* @return React element.
|
|
41
|
+
*/
|
|
42
|
+
const ExpansionPanel = forwardRef((props, ref) => {
|
|
43
|
+
const defaultTheme = useTheme() || Theme.light;
|
|
44
|
+
const {
|
|
45
|
+
className,
|
|
46
|
+
closeMode = DEFAULT_PROPS.closeMode,
|
|
47
|
+
children: anyChildren,
|
|
48
|
+
hasBackground,
|
|
49
|
+
hasHeaderDivider,
|
|
50
|
+
isOpen,
|
|
51
|
+
label,
|
|
52
|
+
onClose,
|
|
53
|
+
onOpen,
|
|
54
|
+
onToggleOpen,
|
|
55
|
+
theme = defaultTheme,
|
|
56
|
+
toggleButtonProps,
|
|
57
|
+
...forwardedProps
|
|
58
|
+
} = props;
|
|
59
|
+
const children = Children.toArray(anyChildren);
|
|
60
|
+
|
|
61
|
+
// Partition children by types.
|
|
62
|
+
const [[dragHandle], [header], [footer], content] = partitionMulti(children, [isDragHandle, isHeader, isFooter]);
|
|
63
|
+
|
|
64
|
+
// Either take the header in children or create one with the label.
|
|
65
|
+
const headerProps = /*#__PURE__*/React__default.isValidElement(header) ? header.props : {};
|
|
66
|
+
const headerContent = !isEmpty(headerProps.children) ? headerProps.children : /*#__PURE__*/jsx("span", {
|
|
67
|
+
className: `${CLASSNAME}__label`,
|
|
68
|
+
children: label
|
|
69
|
+
});
|
|
70
|
+
const toggleOpen = event => {
|
|
71
|
+
const shouldOpen = !isOpen;
|
|
72
|
+
if (onOpen && shouldOpen) {
|
|
73
|
+
onOpen(event);
|
|
74
|
+
}
|
|
75
|
+
if (onClose && !shouldOpen) {
|
|
76
|
+
onClose(event);
|
|
77
|
+
}
|
|
78
|
+
if (onToggleOpen) {
|
|
79
|
+
onToggleOpen(shouldOpen, event);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const color = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;
|
|
83
|
+
const rootClassName = classNames(className, handleBasicClasses({
|
|
84
|
+
hasBackground,
|
|
85
|
+
hasHeader: Boolean(!isEmpty(headerProps.children)),
|
|
86
|
+
hasHeaderDivider,
|
|
87
|
+
isClose: !isOpen,
|
|
88
|
+
isDraggable: Boolean(dragHandle),
|
|
89
|
+
isOpen,
|
|
90
|
+
prefix: CLASSNAME,
|
|
91
|
+
theme
|
|
92
|
+
}));
|
|
93
|
+
const wrapperRef = useRef(null);
|
|
94
|
+
|
|
95
|
+
// Children stay visible while the open/close transition is running
|
|
96
|
+
const [isChildrenVisible, setChildrenVisible] = React__default.useState(isOpen);
|
|
97
|
+
const isOpenRef = React__default.useRef(isOpen);
|
|
98
|
+
React__default.useEffect(() => {
|
|
99
|
+
if (isOpen || closeMode === 'hide') {
|
|
100
|
+
setChildrenVisible(true);
|
|
101
|
+
} else if (!IS_BROWSER) {
|
|
102
|
+
// Outside a browser we can't wait for the transition
|
|
103
|
+
setChildrenVisible(false);
|
|
104
|
+
}
|
|
105
|
+
isOpenRef.current = isOpen;
|
|
106
|
+
}, [closeMode, isOpen]);
|
|
107
|
+
|
|
108
|
+
// Change children's visibility on the transition end
|
|
109
|
+
React__default.useEffect(() => {
|
|
110
|
+
const {
|
|
111
|
+
current: wrapper
|
|
112
|
+
} = wrapperRef;
|
|
113
|
+
if (!IS_BROWSER || !wrapper) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
const onTransitionEnd = () => {
|
|
117
|
+
setChildrenVisible(isOpenRef.current || closeMode === 'hide');
|
|
118
|
+
};
|
|
119
|
+
wrapper.addEventListener('transitionend', onTransitionEnd);
|
|
120
|
+
return () => wrapper.removeEventListener('transitionend', onTransitionEnd);
|
|
121
|
+
}, [closeMode]);
|
|
122
|
+
return /*#__PURE__*/jsxs("section", {
|
|
123
|
+
ref: ref,
|
|
124
|
+
...forwardedProps,
|
|
125
|
+
className: rootClassName,
|
|
126
|
+
children: [/*#__PURE__*/jsxs("header", {
|
|
127
|
+
className: `${CLASSNAME}__header`,
|
|
128
|
+
onClick: toggleOpen,
|
|
129
|
+
children: [dragHandle && /*#__PURE__*/jsx("div", {
|
|
130
|
+
className: `${CLASSNAME}__header-drag`,
|
|
131
|
+
children: dragHandle
|
|
132
|
+
}), /*#__PURE__*/jsx("div", {
|
|
133
|
+
...headerProps,
|
|
134
|
+
className: `${CLASSNAME}__header-content`,
|
|
135
|
+
children: headerContent
|
|
136
|
+
}), /*#__PURE__*/jsx("div", {
|
|
137
|
+
className: `${CLASSNAME}__header-toggle`,
|
|
138
|
+
children: /*#__PURE__*/jsx(IconButton, {
|
|
139
|
+
...toggleButtonProps,
|
|
140
|
+
color: color,
|
|
141
|
+
emphasis: Emphasis.low,
|
|
142
|
+
icon: isOpen ? mdiChevronUp : mdiChevronDown,
|
|
143
|
+
"aria-expanded": isOpen || 'false'
|
|
144
|
+
})
|
|
145
|
+
})]
|
|
146
|
+
}), /*#__PURE__*/jsx("div", {
|
|
147
|
+
className: `${CLASSNAME}__wrapper`,
|
|
148
|
+
ref: wrapperRef,
|
|
149
|
+
children: (isOpen || isChildrenVisible) && /*#__PURE__*/jsxs("div", {
|
|
150
|
+
className: `${CLASSNAME}__container`,
|
|
151
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
152
|
+
className: `${CLASSNAME}__content`,
|
|
153
|
+
children: content
|
|
154
|
+
}), footer && /*#__PURE__*/jsx("div", {
|
|
155
|
+
className: `${CLASSNAME}__footer`,
|
|
156
|
+
children: footer
|
|
157
|
+
})]
|
|
158
|
+
})
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
ExpansionPanel.displayName = COMPONENT_NAME;
|
|
163
|
+
ExpansionPanel.className = CLASSNAME;
|
|
164
|
+
ExpansionPanel.defaultProps = DEFAULT_PROPS;
|
|
165
|
+
|
|
166
|
+
export { ExpansionPanel };
|
|
167
|
+
//# sourceMappingURL=expansion-panel-80edf6c9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expansion-panel-80edf6c9.js","sources":["../../../src/components/expansion-panel/ExpansionPanel.tsx"],"sourcesContent":["import React, { Children, PropsWithChildren, ReactNode, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { mdiChevronDown, mdiChevronUp } from '@lumx/icons';\n\nimport isEmpty from 'lodash/isEmpty';\n\nimport { ColorPalette, DragHandle, Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';\nimport { GenericProps, HasCloseMode, HasTheme, isComponent } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { partitionMulti } from '@lumx/react/utils/partitionMulti';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { IS_BROWSER } from '@lumx/react/constants';\n\n/**\n * Defines the props of the component.\n */\nexport interface ExpansionPanelProps extends GenericProps, HasCloseMode, HasTheme {\n /** Whether the expansion panel has a background. */\n hasBackground?: boolean;\n /** Whether the header has a divider. */\n hasHeaderDivider?: boolean;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Label text (overwritten if a `<header>` is provided in the children). */\n label?: string;\n /** On open callback. */\n onOpen?: (event: React.MouseEvent) => void;\n /** On close callback. */\n onClose?: (event: React.MouseEvent) => void;\n /** Props to pass to the toggle button (minus those already set by the ExpansionPanel props). */\n toggleButtonProps: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;\n /** On toggle open or close callback. */\n onToggleOpen?(shouldOpen: boolean, event: React.MouseEvent): void;\n /** Children */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ExpansionPanel';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ExpansionPanelProps> = {\n closeMode: 'unmount',\n};\n\nconst isDragHandle = isComponent(DragHandle);\nconst isHeader = isComponent('header');\nconst isFooter = isComponent('footer');\n\n/**\n * ExpansionPanel component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ExpansionPanel = forwardRef<ExpansionPanelProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const {\n className,\n closeMode = DEFAULT_PROPS.closeMode,\n children: anyChildren,\n hasBackground,\n hasHeaderDivider,\n isOpen,\n label,\n onClose,\n onOpen,\n onToggleOpen,\n theme = defaultTheme,\n toggleButtonProps,\n ...forwardedProps\n } = props;\n\n const children: ReactNode[] = Children.toArray(anyChildren);\n\n // Partition children by types.\n const [[dragHandle], [header], [footer], content] = partitionMulti(children, [isDragHandle, isHeader, isFooter]);\n\n // Either take the header in children or create one with the label.\n const headerProps: PropsWithChildren<any> = React.isValidElement(header) ? header.props : {};\n const headerContent = !isEmpty(headerProps.children) ? (\n headerProps.children\n ) : (\n <span className={`${CLASSNAME}__label`}>{label}</span>\n );\n\n const toggleOpen = (event: React.MouseEvent) => {\n const shouldOpen = !isOpen;\n\n if (onOpen && shouldOpen) {\n onOpen(event);\n }\n if (onClose && !shouldOpen) {\n onClose(event);\n }\n if (onToggleOpen) {\n onToggleOpen(shouldOpen, event);\n }\n };\n\n const color = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;\n\n const rootClassName = classNames(\n className,\n handleBasicClasses({\n hasBackground,\n hasHeader: Boolean(!isEmpty(headerProps.children)),\n hasHeaderDivider,\n isClose: !isOpen,\n isDraggable: Boolean(dragHandle),\n isOpen,\n prefix: CLASSNAME,\n theme,\n }),\n );\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n // Children stay visible while the open/close transition is running\n const [isChildrenVisible, setChildrenVisible] = React.useState(isOpen);\n\n const isOpenRef = React.useRef(isOpen);\n React.useEffect(() => {\n if (isOpen || closeMode === 'hide') {\n setChildrenVisible(true);\n } else if (!IS_BROWSER) {\n // Outside a browser we can't wait for the transition\n setChildrenVisible(false);\n }\n isOpenRef.current = isOpen;\n }, [closeMode, isOpen]);\n\n // Change children's visibility on the transition end\n React.useEffect(() => {\n const { current: wrapper } = wrapperRef;\n if (!IS_BROWSER || !wrapper) {\n return undefined;\n }\n const onTransitionEnd = () => {\n setChildrenVisible(isOpenRef.current || closeMode === 'hide');\n };\n wrapper.addEventListener('transitionend', onTransitionEnd);\n return () => wrapper.removeEventListener('transitionend', onTransitionEnd);\n }, [closeMode]);\n\n return (\n <section ref={ref} {...forwardedProps} className={rootClassName}>\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}\n <header className={`${CLASSNAME}__header`} onClick={toggleOpen}>\n {dragHandle && <div className={`${CLASSNAME}__header-drag`}>{dragHandle}</div>}\n\n <div {...headerProps} className={`${CLASSNAME}__header-content`}>\n {headerContent}\n </div>\n\n <div className={`${CLASSNAME}__header-toggle`}>\n <IconButton\n {...toggleButtonProps}\n color={color}\n emphasis={Emphasis.low}\n icon={isOpen ? mdiChevronUp : mdiChevronDown}\n aria-expanded={isOpen || 'false'}\n />\n </div>\n </header>\n\n <div className={`${CLASSNAME}__wrapper`} ref={wrapperRef}>\n {(isOpen || isChildrenVisible) && (\n <div className={`${CLASSNAME}__container`}>\n <div className={`${CLASSNAME}__content`}>{content}</div>\n\n {footer && <div className={`${CLASSNAME}__footer`}>{footer}</div>}\n </div>\n )}\n </div>\n </section>\n );\n});\nExpansionPanel.displayName = COMPONENT_NAME;\nExpansionPanel.className = CLASSNAME;\nExpansionPanel.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","closeMode","isDragHandle","isComponent","DragHandle","isHeader","isFooter","ExpansionPanel","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","className","children","anyChildren","hasBackground","hasHeaderDivider","isOpen","label","onClose","onOpen","onToggleOpen","theme","toggleButtonProps","forwardedProps","Children","toArray","dragHandle","header","footer","content","partitionMulti","headerProps","React","isValidElement","headerContent","isEmpty","_jsx","toggleOpen","event","shouldOpen","color","dark","ColorPalette","rootClassName","classNames","handleBasicClasses","hasHeader","Boolean","isClose","isDraggable","prefix","wrapperRef","useRef","isChildrenVisible","setChildrenVisible","useState","isOpenRef","useEffect","IS_BROWSER","current","wrapper","undefined","onTransitionEnd","addEventListener","removeEventListener","_jsxs","onClick","IconButton","emphasis","Emphasis","low","icon","mdiChevronUp","mdiChevronDown","displayName","defaultProps"],"mappings":";;;;;;;;;;;;;;AAyCA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,gBAAgB,CAAA;;AAEvC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAA2C,GAAG;AAChDC,EAAAA,SAAS,EAAE,SAAA;AACf,CAAC,CAAA;AAED,MAAMC,YAAY,GAAGC,WAAW,CAACC,UAAU,CAAC,CAAA;AAC5C,MAAMC,QAAQ,GAAGF,WAAW,CAAC,QAAQ,CAAC,CAAA;AACtC,MAAMG,QAAQ,GAAGH,WAAW,CAAC,QAAQ,CAAC,CAAA;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,cAAc,GAAGC,UAAU,CAAsC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC1F,MAAMC,YAAY,GAAGC,QAAQ,EAAE,IAAIC,KAAK,CAACC,KAAK,CAAA;EAC9C,MAAM;IACFC,SAAS;IACTd,SAAS,GAAGD,aAAa,CAACC,SAAS;AACnCe,IAAAA,QAAQ,EAAEC,WAAW;IACrBC,aAAa;IACbC,gBAAgB;IAChBC,MAAM;IACNC,KAAK;IACLC,OAAO;IACPC,MAAM;IACNC,YAAY;AACZC,IAAAA,KAAK,GAAGd,YAAY;IACpBe,iBAAiB;IACjB,GAAGC,cAAAA;AACP,GAAC,GAAGlB,KAAK,CAAA;AAET,EAAA,MAAMO,QAAqB,GAAGY,QAAQ,CAACC,OAAO,CAACZ,WAAW,CAAC,CAAA;;AAE3D;EACA,MAAM,CAAC,CAACa,UAAU,CAAC,EAAE,CAACC,MAAM,CAAC,EAAE,CAACC,MAAM,CAAC,EAAEC,OAAO,CAAC,GAAGC,cAAc,CAAClB,QAAQ,EAAE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AAIqC,iBAAiB,kBACzBY,IAAA,CAAA,KAAA,EAAA;QAAKtD,SAAS,EAAE,CAAGjB,EAAAA,SAAS,CAAc,WAAA,CAAA;AAAAkB,QAAAA,QAAA,gBACtCwB,GAAA,CAAA,KAAA,EAAA;UAAKzB,SAAS,EAAE,CAAGjB,EAAAA,SAAS,CAAY,SAAA,CAAA;AAAAkB,UAAAA,QAAA,EAAEiB,OAAAA;AAAO,SAAM,CAAC,EAEvDD,MAAM,iBAAIQ,GAAA,CAAA,KAAA,EAAA;UAAKzB,SAAS,EAAE,CAAGjB,EAAAA,SAAS,CAAW,QAAA,CAAA;AAAAkB,UAAAA,QAAA,EAAEgB,MAAAA;AAAM,SAAM,CAAC,CAAA;OAChE,CAAA;AACR,KACA,CAAC,CAAA;AAAA,GACD,CAAC,CAAA;AAElB,CAAC,EAAC;AACFzB,cAAc,CAACuE,WAAW,GAAGjF,cAAc,CAAA;AAC3CU,cAAc,CAACQ,SAAS,GAAGjB,SAAS,CAAA;AACpCS,cAAc,CAACwE,YAAY,GAAG/E,aAAa;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
2
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
3
|
+
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { Theme, ColorPalette, Size } from '@lumx/core/js/constants';
|
|
6
|
+
import { I as Icon } from '../index-192f8ada.js';
|
|
7
|
+
import { T as Text } from '../index-b06353f2.js';
|
|
8
|
+
|
|
9
|
+
const COMPONENT_NAME = 'Flag';
|
|
10
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
11
|
+
const DEFAULT_PROPS = {};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Flag component.
|
|
15
|
+
*
|
|
16
|
+
* @param props Component props.
|
|
17
|
+
* @param ref Component ref.
|
|
18
|
+
* @return React element.
|
|
19
|
+
*/
|
|
20
|
+
const Flag = forwardRef((props, ref) => {
|
|
21
|
+
const defaultTheme = useTheme() || Theme.light;
|
|
22
|
+
const {
|
|
23
|
+
label,
|
|
24
|
+
icon,
|
|
25
|
+
color,
|
|
26
|
+
className,
|
|
27
|
+
theme = defaultTheme,
|
|
28
|
+
truncate,
|
|
29
|
+
...forwardedProps
|
|
30
|
+
} = props;
|
|
31
|
+
const flagColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
|
|
32
|
+
const isTruncated = !!truncate;
|
|
33
|
+
return /*#__PURE__*/jsxs("div", {
|
|
34
|
+
...forwardedProps,
|
|
35
|
+
className: classNames(className, handleBasicClasses({
|
|
36
|
+
prefix: CLASSNAME,
|
|
37
|
+
color: flagColor,
|
|
38
|
+
isTruncated
|
|
39
|
+
})),
|
|
40
|
+
ref: ref,
|
|
41
|
+
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
42
|
+
icon: icon,
|
|
43
|
+
size: Size.xxs,
|
|
44
|
+
className: `${CLASSNAME}__icon`
|
|
45
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
46
|
+
as: "span",
|
|
47
|
+
truncate: isTruncated,
|
|
48
|
+
typography: "overline",
|
|
49
|
+
className: `${CLASSNAME}__label`,
|
|
50
|
+
children: label
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
Flag.displayName = COMPONENT_NAME;
|
|
55
|
+
Flag.className = CLASSNAME;
|
|
56
|
+
Flag.defaultProps = DEFAULT_PROPS;
|
|
57
|
+
|
|
58
|
+
export { Flag };
|
|
59
|
+
//# sourceMappingURL=flag-7c9d3abf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flag-7c9d3abf.js","sources":["../../../src/components/flag/Flag.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { ColorPalette, Icon, Size, Theme, Text } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nexport interface FlagProps extends GenericProps, HasTheme {\n /** Color of the component. */\n color?: ColorPalette;\n /** Icon to use before the label. */\n icon?: string;\n /** Text label of the flag. */\n label: React.ReactNode;\n /** Enable text truncate on overflow */\n truncate?: boolean;\n}\n\nconst COMPONENT_NAME = 'Flag';\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\nconst DEFAULT_PROPS: Partial<FlagProps> = {};\n\n/**\n * Flag component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Flag = forwardRef<FlagProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const { label, icon, color, className, theme = defaultTheme, truncate, ...forwardedProps } = props;\n const flagColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);\n const isTruncated = !!truncate;\n\n return (\n <div\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color: flagColor, isTruncated }))}\n ref={ref}\n >\n {icon && <Icon icon={icon} size={Size.xxs} className={`${CLASSNAME}__icon`} />}\n <Text as=\"span\" truncate={isTruncated} typography=\"overline\" className={`${CLASSNAME}__label`}>\n {label}\n </Text>\n </div>\n );\n});\nFlag.displayName = COMPONENT_NAME;\nFlag.className = CLASSNAME;\nFlag.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Flag","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","label","icon","color","className","theme","truncate","forwardedProps","flagColor","ColorPalette","dark","isTruncated","_jsxs","classNames","handleBasicClasses","prefix","children","_jsx","Icon","size","Size","xxs","Text","as","typography","displayName","defaultProps"],"mappings":";;;;;;;;AAmBA,MAAMA,cAAc,GAAG,MAAM,CAAA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K,WAAY;AAACa,MAAAA,UAAU,EAAC,UAAU;MAACpB,SAAS,EAAE,CAAGd,EAAAA,SAAS,CAAU,OAAA,CAAA;AAAA0B,MAAAA,QAAA,EACzFf,KAAAA;AAAK,KACJ,CAAC,CAAA;AAAA,GACN,CAAC,CAAA;AAEd,CAAC,EAAC;AACFR,IAAI,CAACgC,WAAW,GAAGpC,cAAc,CAAA;AACjCI,IAAI,CAACW,SAAS,GAAGd,SAAS,CAAA;AAC1BG,IAAI,CAACiC,YAAY,GAAGlC,aAAa;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
2
|
+
import castArray from 'lodash/castArray';
|
|
3
|
+
import { Orientation } from '@lumx/core/js/constants';
|
|
4
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Component display name.
|
|
9
|
+
*/
|
|
10
|
+
const COMPONENT_NAME = 'FlexBox';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component default class name and class prefix.
|
|
14
|
+
*/
|
|
15
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* FlexBox component.
|
|
19
|
+
*
|
|
20
|
+
* @param props Component props.
|
|
21
|
+
* @param ref Component ref.
|
|
22
|
+
* @return React element.
|
|
23
|
+
*/
|
|
24
|
+
const FlexBox = forwardRef((props, ref) => {
|
|
25
|
+
const {
|
|
26
|
+
as: Component = 'div',
|
|
27
|
+
children,
|
|
28
|
+
className,
|
|
29
|
+
fillSpace,
|
|
30
|
+
gap,
|
|
31
|
+
hAlign,
|
|
32
|
+
marginAuto,
|
|
33
|
+
noShrink,
|
|
34
|
+
orientation,
|
|
35
|
+
vAlign,
|
|
36
|
+
wrap,
|
|
37
|
+
...forwardedProps
|
|
38
|
+
} = props;
|
|
39
|
+
return /*#__PURE__*/jsx(Component, {
|
|
40
|
+
ref: ref,
|
|
41
|
+
...forwardedProps,
|
|
42
|
+
className: classNames(className, handleBasicClasses({
|
|
43
|
+
prefix: CLASSNAME,
|
|
44
|
+
orientation: orientation ?? (wrap || hAlign || vAlign ? Orientation.horizontal : null),
|
|
45
|
+
vAlign,
|
|
46
|
+
hAlign,
|
|
47
|
+
gap
|
|
48
|
+
}), wrap && `${CLASSNAME}--wrap`, fillSpace && `${CLASSNAME}--fill-space`, noShrink && `${CLASSNAME}--no-shrink`, marginAuto && castArray(marginAuto).map(align => `${CLASSNAME}--margin-auto-${align}`)),
|
|
49
|
+
children: children
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
FlexBox.displayName = COMPONENT_NAME;
|
|
53
|
+
FlexBox.className = CLASSNAME;
|
|
54
|
+
|
|
55
|
+
export { FlexBox };
|
|
56
|
+
//# sourceMappingURL=flex-box-55144e5f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex-box-55144e5f.js","sources":["../../../src/components/flex-box/FlexBox.tsx"],"sourcesContent":["import { ReactNode } from 'react';\n\nimport classNames from 'classnames';\nimport castArray from 'lodash/castArray';\n\nimport { Alignment, Orientation, HorizontalAlignment, Size, VerticalAlignment } from '@lumx/core/js/constants';\nimport { GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nexport type MarginAutoAlignment = Extract<Alignment, 'top' | 'bottom' | 'right' | 'left'>;\nexport type GapSize = Extract<Size, 'tiny' | 'regular' | 'medium' | 'big' | 'huge'>;\ntype SpaceAlignment = Extract<Alignment, 'space-between' | 'space-evenly' | 'space-around'>;\nexport type FlexVerticalAlignment = VerticalAlignment | SpaceAlignment;\nexport type FlexHorizontalAlignment = HorizontalAlignment | SpaceAlignment;\n\n/**\n * Defines the props of the component.\n */\nexport interface FlexBoxProps extends GenericProps {\n /** Customize the root element. */\n as?: React.ElementType;\n /** Children elements. */\n children?: ReactNode;\n /** Whether the \"content filling space\" is enabled or not. */\n fillSpace?: boolean;\n /** Gap space between flexbox items. */\n gap?: GapSize;\n /** Flex horizontal alignment. */\n hAlign?: FlexVerticalAlignment;\n /** Whether the \"auto margin\" is enabled all around or not. */\n marginAuto?: MarginAutoAlignment | MarginAutoAlignment[];\n /** Whether the \"content shrink\" is disabled or not. */\n noShrink?: boolean;\n /** Flex direction. */\n orientation?: Orientation;\n /** Flex vertical alignment. */\n vAlign?: FlexHorizontalAlignment;\n /** Whether the \"flex wrap\" is enabled or not. */\n wrap?: boolean;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'FlexBox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * FlexBox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const FlexBox = forwardRef<FlexBoxProps, HTMLDivElement>((props, ref) => {\n const {\n as: Component = 'div',\n children,\n className,\n fillSpace,\n gap,\n hAlign,\n marginAuto,\n noShrink,\n orientation,\n vAlign,\n wrap,\n ...forwardedProps\n } = props;\n\n return (\n <Component\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n orientation: orientation ?? (wrap || hAlign || vAlign ? Orientation.horizontal : null),\n vAlign,\n hAlign,\n gap,\n }),\n wrap && `${CLASSNAME}--wrap`,\n fillSpace && `${CLASSNAME}--fill-space`,\n noShrink && `${CLASSNAME}--no-shrink`,\n marginAuto && castArray(marginAuto).map((align) => `${CLASSNAME}--margin-auto-${align}`),\n )}\n >\n {children}\n </Component>\n );\n});\nFlexBox.displayName = COMPONENT_NAME;\nFlexBox.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","FlexBox","forwardRef","props","ref","as","Component","children","className","fillSpace","gap","hAlign","marginAuto","noShrink","orientation","vAlign","wrap","forwardedProps","_jsx","classNames","handleBasicClasses","prefix","Orientation","horizontal","castArray","map","align","displayName"],"mappings":";;;;;;AA0CA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,SAAS,CAAA;;AAEhC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,OAAO,GAAGC,UAAU,CAA+B,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5E,MAAM;IACFC,EAAE,EAAEC,SAAS,GAAG,KAAK;IACrBC,QAAQ;IACRC,SAAS;IACTC,SAAS;IACTC,GAAG;IACHC,MAAM;IACNC,UAAU;IACVC,QAAQ;IACRC,WAAW;IACXC,MAAM;IACNC,IAAI;IACJ,GAAGC,cAAAA;AACP,GAAC,GAAGd,KAAK,CAAA;EAET,oBACIe,GAAA,CAACZ,SAAS,EAAA;AACNF,IAAAA,GAAG,EAAEA,GAAI;AAAA,IAAA,GACLa,cAAc;AAClBT,IAAAA,SAAS,EAAEW,UAAU,CACjBX,SAAS,EACTY,kBAAkB,CAAC;AACfC,MAAAA,MAAM,EAAEtB,SAAS;AACjBe,MAAAA,WAAW,EAAEA,WAAW,KAAKE,IAAI,IAAIL,MAAM,IAAII,MAAM,GAAGO,WAAW,CAACC,UAAU,GAAG,IAAI,CAAC;MACtFR,MAAM;MACNJ,MAAM;AACND,MAAAA,GAAAA;AACJ,KAAC,CAAC,EACFM,IAAI,IAAI,CAAA,EAAGjB,SAAS,CAAQ,MAAA,CAAA,EAC5BU,SAAS,IAAI,GAAGV,SAAS,CAAA,YAAA,CAAc,EACvCc,QAAQ,IAAI,CAAGd,EAAAA,SAAS,CAAa,WAAA,CAAA,EACrCa,UAAU,IAAIY,SAAS,CAACZ,UAAU,CAAC,CAACa,GAAG,CAAEC,KAAK,IAAK,CAAG3B,EAAAA,SAAS,iBAAiB2B,KAAK,CAAA,CAAE,CAC3F,CAAE;AAAAnB,IAAAA,QAAA,EAEDA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEpB,CAAC,EAAC;AACFN,OAAO,CAAC0B,WAAW,GAAG7B,cAAc,CAAA;AACpCG,OAAO,CAACO,SAAS,GAAGT,SAAS;;;;"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React__default, { Children } from 'react';
|
|
2
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
3
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
|
+
import noop from 'lodash/noop';
|
|
5
|
+
import { i as isComponentType } from '../isComponentType-e806b848.js';
|
|
6
|
+
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
7
|
+
import { p as partitionMulti } from '../partitionMulti-4daccdd5.js';
|
|
8
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
9
|
+
import { Size, Orientation } from '@lumx/core/js/constants';
|
|
10
|
+
import { FlexBox } from './flex-box-55144e5f.js';
|
|
11
|
+
import pick from 'lodash/pick';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Component display name.
|
|
15
|
+
*/
|
|
16
|
+
const COMPONENT_NAME = 'GenericBlock';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Component default class name and class prefix.
|
|
20
|
+
*/
|
|
21
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Component default props.
|
|
25
|
+
*/
|
|
26
|
+
const DEFAULT_PROPS = {
|
|
27
|
+
gap: Size.big,
|
|
28
|
+
orientation: Orientation.horizontal
|
|
29
|
+
};
|
|
30
|
+
const Figure = noop.bind({});
|
|
31
|
+
const isFigure = isComponentType(Figure);
|
|
32
|
+
const Content = noop.bind({});
|
|
33
|
+
const isContent = isComponentType(Content);
|
|
34
|
+
const Actions = noop.bind({});
|
|
35
|
+
const isActions = isComponentType(Actions);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The GenericBlock is a layout component made of 3 sections that can be
|
|
39
|
+
* displayed either horizontally of vertically with the same gap between each section.
|
|
40
|
+
*
|
|
41
|
+
* The sections are:
|
|
42
|
+
* - `Figure` => A visual element to display before the main content.
|
|
43
|
+
* - `Content` => The main content displayed
|
|
44
|
+
* - `Actions` => One or more actions to set after the element.
|
|
45
|
+
*
|
|
46
|
+
* @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076
|
|
47
|
+
*/
|
|
48
|
+
const BaseGenericBlock = forwardRef((props, ref) => {
|
|
49
|
+
const {
|
|
50
|
+
className,
|
|
51
|
+
figure,
|
|
52
|
+
figureProps,
|
|
53
|
+
children,
|
|
54
|
+
actions,
|
|
55
|
+
actionsProps,
|
|
56
|
+
gap = DEFAULT_PROPS.gap,
|
|
57
|
+
orientation = DEFAULT_PROPS.orientation,
|
|
58
|
+
contentProps,
|
|
59
|
+
...forwardedProps
|
|
60
|
+
} = props;
|
|
61
|
+
const sections = React__default.useMemo(() => {
|
|
62
|
+
// Split children by section type
|
|
63
|
+
const [[figureChild], [contentChild], [actionsChild], ...otherChildren] = partitionMulti(Children.toArray(children), [isFigure, isContent, isActions]);
|
|
64
|
+
return {
|
|
65
|
+
figureChild,
|
|
66
|
+
figureChildProps: figureChild?.props,
|
|
67
|
+
contentChild,
|
|
68
|
+
contentChildProps: contentChild?.props,
|
|
69
|
+
actionsChild,
|
|
70
|
+
actionsChildProps: actionsChild?.props,
|
|
71
|
+
otherChildren: otherChildren.filter(child => !isEmpty(child))
|
|
72
|
+
};
|
|
73
|
+
}, [children]);
|
|
74
|
+
return /*#__PURE__*/jsxs(FlexBox, {
|
|
75
|
+
ref: ref,
|
|
76
|
+
className: classNames(className, CLASSNAME),
|
|
77
|
+
gap: gap,
|
|
78
|
+
orientation: orientation,
|
|
79
|
+
...forwardedProps,
|
|
80
|
+
children: [(figure || sections.figureChildProps?.children) && /*#__PURE__*/jsxs(FlexBox, {
|
|
81
|
+
ref: sections.figureChild?.ref,
|
|
82
|
+
vAlign: forwardedProps.vAlign,
|
|
83
|
+
hAlign: forwardedProps.hAlign,
|
|
84
|
+
...figureProps,
|
|
85
|
+
...sections.figureChildProps,
|
|
86
|
+
className: classNames(figureProps?.className, sections.figureChildProps?.className, `${CLASSNAME}__figure`),
|
|
87
|
+
children: [figure, sections.figureChildProps?.children]
|
|
88
|
+
}), (sections.contentChildProps?.children || sections.otherChildren.length > 0) && /*#__PURE__*/jsxs(FlexBox, {
|
|
89
|
+
ref: sections.contentChild?.ref,
|
|
90
|
+
orientation: Orientation.vertical,
|
|
91
|
+
fillSpace: true,
|
|
92
|
+
vAlign: forwardedProps.vAlign,
|
|
93
|
+
hAlign: forwardedProps.hAlign,
|
|
94
|
+
...contentProps,
|
|
95
|
+
...sections.contentChildProps,
|
|
96
|
+
className: classNames(contentProps?.className, sections.contentChildProps?.className, `${CLASSNAME}__content`),
|
|
97
|
+
children: [sections.contentChildProps?.children, sections.otherChildren]
|
|
98
|
+
}), (actions || sections.actionsChildProps?.children) && /*#__PURE__*/jsxs(FlexBox, {
|
|
99
|
+
ref: sections.actionsChild?.ref,
|
|
100
|
+
vAlign: forwardedProps.vAlign,
|
|
101
|
+
hAlign: forwardedProps.hAlign,
|
|
102
|
+
...actionsProps,
|
|
103
|
+
...sections.actionsChildProps,
|
|
104
|
+
className: classNames(actionsProps?.className, sections.actionsChildProps?.className, `${CLASSNAME}__actions`),
|
|
105
|
+
children: [actions, sections.actionsChildProps?.children]
|
|
106
|
+
})]
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
BaseGenericBlock.displayName = COMPONENT_NAME;
|
|
110
|
+
BaseGenericBlock.className = CLASSNAME;
|
|
111
|
+
BaseGenericBlock.defaultProps = DEFAULT_PROPS;
|
|
112
|
+
const GenericBlock = Object.assign(BaseGenericBlock, {
|
|
113
|
+
Figure,
|
|
114
|
+
Content,
|
|
115
|
+
Actions
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Accepted gap sizes for the generic block.
|
|
120
|
+
*/
|
|
121
|
+
const GenericBlockGapSize = pick(Size, ['tiny', 'regular', 'medium', 'big', 'huge']);
|
|
122
|
+
|
|
123
|
+
export { GenericBlock, GenericBlockGapSize };
|
|
124
|
+
//# sourceMappingURL=generic-block-ff0509ee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-block-ff0509ee.js","sources":["../../../src/components/generic-block/GenericBlock.tsx","../../../src/components/generic-block/constants.ts"],"sourcesContent":["import React, { Children, ReactElement, ReactNode } from 'react';\n\nimport classNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\nimport noop from 'lodash/noop';\n\nimport { Comp, isComponentType } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { partitionMulti } from '@lumx/react/utils/partitionMulti';\nimport { Orientation, Size, FlexBox, FlexBoxProps } from '@lumx/react';\nimport { GenericBlockGapSize } from '@lumx/react/components/generic-block/constants';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nexport interface GenericBlockProps extends FlexBoxProps {\n /**\n * Component to use as visual element.\n */\n figure?: ReactNode;\n /**\n * Actions to set after the main content.\n */\n actions?: ReactNode;\n /**\n * Main content to display or sections components\n * ({@see GenericBlock.Figure}, {@see GenericBlock.Content} & {@see GenericBlock.Actions})\n */\n children: ReactNode;\n /**\n * Orientation of the 3 sections\n */\n orientation?: FlexBoxProps['orientation'];\n /**\n * Horizontal alignment.\n */\n hAlign?: FlexBoxProps['hAlign'];\n /**\n * Vertical alignment.\n */\n vAlign?: FlexBoxProps['vAlign'];\n /**\n * The props to forward to the content.\n * By default, the content will have the same alignment as wrapper.\n */\n contentProps?: Omit<FlexBoxProps, 'children'>;\n /**\n * props to forward to the actions element.\n */\n actionsProps?: Omit<FlexBoxProps, 'children'>;\n /**\n * props to forward to the figure element.\n */\n figureProps?: Omit<FlexBoxProps, 'children'>;\n /**\n * Gap space between sections.\n */\n gap?: GenericBlockGapSize;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'GenericBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<GenericBlockProps> = {\n gap: Size.big,\n orientation: Orientation.horizontal,\n};\n\ntype BaseGenericBlock = Comp<GenericBlockProps, HTMLDivElement>;\n\ninterface GenericBlockSectionProps extends FlexBoxProps {\n /**\n * Gap space between items.\n */\n gap?: GenericBlockGapSize;\n}\n\ninterface GenericBlock extends BaseGenericBlock {\n /**\n * Use `GenericBlock.Figure` component as children of the `GenericBlock` component as an alternative way to inject\n * the \"figure\" section of the block (instead of using `figure` and `figureProps` props).\n */\n Figure: Comp<GenericBlockSectionProps>;\n /**\n * Use `GenericBlock.Content` component as children of the `GenericBlock` component as an alternative way to inject\n * the \"content\" section of the block (instead of using `content` and `contentProps` props).\n */\n Content: Comp<GenericBlockSectionProps>;\n /**\n * Use `GenericBlock.Actions` component as children of the `GenericBlock` component as an alternative way to inject\n * the \"actions\" section of the block (instead of using `actions` and `actionsProps` props).\n */\n Actions: Comp<GenericBlockSectionProps>;\n}\n\nconst Figure = noop.bind({}) as Comp<FlexBoxProps>;\nconst isFigure = isComponentType(Figure);\n\nconst Content = noop.bind({}) as Comp<FlexBoxProps>;\nconst isContent = isComponentType(Content);\n\nconst Actions = noop.bind({}) as Comp<FlexBoxProps>;\nconst isActions = isComponentType(Actions);\n\n/**\n * The GenericBlock is a layout component made of 3 sections that can be\n * displayed either horizontally of vertically with the same gap between each section.\n *\n * The sections are:\n * - `Figure` => A visual element to display before the main content.\n * - `Content` => The main content displayed\n * - `Actions` => One or more actions to set after the element.\n *\n * @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076\n */\nconst BaseGenericBlock: BaseGenericBlock = forwardRef((props, ref) => {\n const {\n className,\n figure,\n figureProps,\n children,\n actions,\n actionsProps,\n gap = DEFAULT_PROPS.gap,\n orientation = DEFAULT_PROPS.orientation,\n contentProps,\n ...forwardedProps\n } = props;\n\n const sections = React.useMemo(() => {\n // Split children by section type\n const [[figureChild], [contentChild], [actionsChild], ...otherChildren] = partitionMulti(\n Children.toArray(children),\n [isFigure, isContent, isActions],\n );\n return {\n figureChild,\n figureChildProps: (figureChild as ReactElement)?.props,\n contentChild,\n contentChildProps: (contentChild as ReactElement)?.props,\n actionsChild,\n actionsChildProps: (actionsChild as ReactElement)?.props,\n otherChildren: otherChildren.filter((child) => !isEmpty(child)),\n };\n }, [children]);\n\n return (\n <FlexBox\n ref={ref}\n className={classNames(className, CLASSNAME)}\n gap={gap}\n orientation={orientation}\n {...forwardedProps}\n >\n {(figure || sections.figureChildProps?.children) && (\n <FlexBox\n ref={(sections.figureChild as any)?.ref}\n vAlign={forwardedProps.vAlign}\n hAlign={forwardedProps.hAlign}\n {...figureProps}\n {...sections.figureChildProps}\n className={classNames(\n figureProps?.className,\n sections.figureChildProps?.className,\n `${CLASSNAME}__figure`,\n )}\n >\n {figure}\n {sections.figureChildProps?.children}\n </FlexBox>\n )}\n\n {(sections.contentChildProps?.children || sections.otherChildren.length > 0) && (\n <FlexBox\n ref={(sections.contentChild as any)?.ref}\n orientation={Orientation.vertical}\n fillSpace\n vAlign={forwardedProps.vAlign}\n hAlign={forwardedProps.hAlign}\n {...contentProps}\n {...sections.contentChildProps}\n className={classNames(\n contentProps?.className,\n sections.contentChildProps?.className,\n `${CLASSNAME}__content`,\n )}\n >\n {sections.contentChildProps?.children}\n {sections.otherChildren}\n </FlexBox>\n )}\n\n {(actions || sections.actionsChildProps?.children) && (\n <FlexBox\n ref={(sections.actionsChild as any)?.ref}\n vAlign={forwardedProps.vAlign}\n hAlign={forwardedProps.hAlign}\n {...actionsProps}\n {...sections.actionsChildProps}\n className={classNames(\n actionsProps?.className,\n sections.actionsChildProps?.className,\n `${CLASSNAME}__actions`,\n )}\n >\n {actions}\n {sections.actionsChildProps?.children}\n </FlexBox>\n )}\n </FlexBox>\n );\n});\nBaseGenericBlock.displayName = COMPONENT_NAME;\nBaseGenericBlock.className = CLASSNAME;\nBaseGenericBlock.defaultProps = DEFAULT_PROPS;\n\nexport const GenericBlock: GenericBlock = Object.assign(BaseGenericBlock, { Figure, Content, Actions });\n","import pick from 'lodash/pick';\nimport { Size } from '@lumx/react';\nimport { ValueOf } from '@lumx/react/utils/type';\n\n/**\n * Accepted gap sizes for the generic block.\n */\nexport const GenericBlockGapSize = pick(Size, ['tiny', 'regular', 'medium', 'big', 'huge']);\nexport type GenericBlockGapSize = ValueOf<typeof GenericBlockGapSize>;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","gap","Size","big","orientation","Orientation","horizontal","Figure","noop","bind","isFigure","isComponentType","Content","isContent","Actions","isActions","BaseGenericBlock","forwardRef","props","ref","className","figure","figureProps","children","actions","actionsProps","contentProps","forwardedProps","sections","React","useMemo","figureChild","contentChild","actionsChild","otherChildren","partitionMulti","Children","toArray","figureChildProps","contentChildProps","actionsChildProps","filter","child","isEmpty","_jsxs","FlexBox","classNames","vAlign","hAlign","length","vertical","fillSpace","displayName","defaultProps","GenericBlock","Object","assign","GenericBlockGapSize","pick"],"mappings":";;;;;;;;;;;;AA0DA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,cAAc,CAAA;;AAErC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAyC,GAAG;EAC9CC,GAAG,EAAEC,IAAI,CAACC,GAAG;EACbC,WAAW,EAAEC,WAAW,CAACC,UAAAA;AAC7B,CAAC,CAAA;AA6BD,MAAMC,MAAM,GAAGC,IAAI,CAACC,IAAI,CAAC,EAAE,CAAuB,CAAA;AAClD,MAAMC,QAAQ,GAAGC,eAAe,CAACJ,MAAM,CAAC,CAAA;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AAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC;;;;"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
2
|
+
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { Orientation } from '@lumx/core/js/constants';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Component display name.
|
|
8
|
+
*/
|
|
9
|
+
const COMPONENT_NAME$1 = 'Grid';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Component default class name and class prefix.
|
|
13
|
+
*/
|
|
14
|
+
const CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Component default props.
|
|
18
|
+
*/
|
|
19
|
+
const DEFAULT_PROPS = {
|
|
20
|
+
orientation: Orientation.horizontal,
|
|
21
|
+
wrap: 'nowrap'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Grid component.
|
|
26
|
+
*
|
|
27
|
+
* @param props Component props.
|
|
28
|
+
* @param ref Component ref.
|
|
29
|
+
* @return React element.
|
|
30
|
+
*/
|
|
31
|
+
const Grid = forwardRef((props, ref) => {
|
|
32
|
+
const {
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
35
|
+
gutter,
|
|
36
|
+
hAlign,
|
|
37
|
+
orientation = DEFAULT_PROPS.orientation,
|
|
38
|
+
vAlign,
|
|
39
|
+
wrap = DEFAULT_PROPS.wrap,
|
|
40
|
+
...forwardedProps
|
|
41
|
+
} = props;
|
|
42
|
+
return /*#__PURE__*/jsx("div", {
|
|
43
|
+
ref: ref,
|
|
44
|
+
...forwardedProps,
|
|
45
|
+
className: classNames(className, `${CLASSNAME$1}-container`, {
|
|
46
|
+
[`${CLASSNAME$1}--h-align-${hAlign}`]: hAlign
|
|
47
|
+
}, {
|
|
48
|
+
[`${CLASSNAME$1}--v-align-${vAlign}`]: vAlign
|
|
49
|
+
}, handleBasicClasses({
|
|
50
|
+
prefix: CLASSNAME$1,
|
|
51
|
+
orientation,
|
|
52
|
+
wrap,
|
|
53
|
+
gutter
|
|
54
|
+
})),
|
|
55
|
+
children: children
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
Grid.displayName = COMPONENT_NAME$1;
|
|
59
|
+
Grid.className = CLASSNAME$1;
|
|
60
|
+
Grid.defaultProps = DEFAULT_PROPS;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Component display name.
|
|
64
|
+
*/
|
|
65
|
+
const COMPONENT_NAME = 'GridItem';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Component default class name and class prefix.
|
|
69
|
+
*/
|
|
70
|
+
const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* GridItem component.
|
|
74
|
+
*
|
|
75
|
+
* @param props Component props.
|
|
76
|
+
* @param ref Component ref.
|
|
77
|
+
* @return React element.
|
|
78
|
+
*/
|
|
79
|
+
const GridItem = forwardRef((props, ref) => {
|
|
80
|
+
const {
|
|
81
|
+
children,
|
|
82
|
+
className,
|
|
83
|
+
width,
|
|
84
|
+
align,
|
|
85
|
+
order,
|
|
86
|
+
...forwardedProps
|
|
87
|
+
} = props;
|
|
88
|
+
return /*#__PURE__*/jsx("div", {
|
|
89
|
+
ref: ref,
|
|
90
|
+
...forwardedProps,
|
|
91
|
+
className: classNames(className, handleBasicClasses({
|
|
92
|
+
prefix: CLASSNAME,
|
|
93
|
+
width,
|
|
94
|
+
order,
|
|
95
|
+
align
|
|
96
|
+
})),
|
|
97
|
+
children: children
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
GridItem.displayName = COMPONENT_NAME;
|
|
101
|
+
GridItem.className = CLASSNAME;
|
|
102
|
+
|
|
103
|
+
export { Grid, GridItem };
|
|
104
|
+
//# sourceMappingURL=grid-6f1b5a41.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-6f1b5a41.js","sources":["../../../src/components/grid/Grid.tsx","../../../src/components/grid/GridItem.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { Alignment, Orientation, Size } from '@lumx/react';\nimport { GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\ntype GridGutterSize = Extract<Size, 'regular' | 'big' | 'huge'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface GridProps extends GenericProps {\n /** Orientation. */\n orientation?: Orientation;\n /** Whether the children are wrapped or not. */\n wrap?: string;\n /** Vertical alignment. */\n vAlign?: Alignment;\n /** Horizontal alignment. */\n hAlign?: Alignment;\n /** Gutter size. */\n gutter?: GridGutterSize;\n /** Children */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Grid';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<GridProps> = {\n orientation: Orientation.horizontal,\n wrap: 'nowrap',\n};\n\n/**\n * Grid component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Grid = forwardRef<GridProps, HTMLDivElement>((props, ref) => {\n const {\n children,\n className,\n gutter,\n hAlign,\n orientation = DEFAULT_PROPS.orientation,\n vAlign,\n wrap = DEFAULT_PROPS.wrap,\n ...forwardedProps\n } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n `${CLASSNAME}-container`,\n { [`${CLASSNAME}--h-align-${hAlign}`]: hAlign },\n { [`${CLASSNAME}--v-align-${vAlign}`]: vAlign },\n handleBasicClasses({ prefix: CLASSNAME, orientation, wrap, gutter }),\n )}\n >\n {children}\n </div>\n );\n});\nGrid.displayName = COMPONENT_NAME;\nGrid.className = CLASSNAME;\nGrid.defaultProps = DEFAULT_PROPS;\n","import classNames from 'classnames';\n\nimport { Alignment } from '@lumx/react';\nimport { GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\ntype Columns = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12';\n\n/**\n * Defines the props of the component.\n */\nexport interface GridItemProps extends GenericProps {\n /** Alignment. */\n align?: Alignment;\n /** Order. */\n order?: Columns;\n /** Width. */\n width?: Columns;\n /** Children */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'GridItem';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * GridItem component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const GridItem = forwardRef<GridItemProps, HTMLDivElement>((props, ref) => {\n const { children, className, width, align, order, ...forwardedProps } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, width, order, align }))}\n >\n {children}\n </div>\n );\n});\nGridItem.displayName = COMPONENT_NAME;\nGridItem.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","orientation","Orientation","horizontal","wrap","Grid","forwardRef","props","ref","children","className","gutter","hAlign","vAlign","forwardedProps","_jsx","classNames","handleBasicClasses","prefix","displayName","defaultProps","GridItem","width","align","order"],"mappings":";;;;;AA2BA;AACA;AACA;AACA,MAAMA,gBAAc,GAAG,MAAM,CAAA;;AAE7B;AACA;AACA;AACA,MAAMC,WAAS,GAAGC,gBAAgB,CAACF,gBAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAiC,GAAG;EACtCC,WA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