@lumx/react 3.20.1-alpha.15 → 3.20.1-alpha.17
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-f19e18df.js → Button-1f227024.js} +30 -28
- package/_internal/{Button-f19e18df.js.map → Button-1f227024.js.map} +1 -1
- package/_internal/{ButtonRoot-ab633b1d.js → ButtonRoot-823f3e9c.js} +18 -16
- package/_internal/{ButtonRoot-ab633b1d.js.map → ButtonRoot-823f3e9c.js.map} +1 -1
- package/_internal/{Chip-4c572eec.js → Chip-a34f6905.js} +31 -34
- package/_internal/{Chip-4c572eec.js.map → Chip-a34f6905.js.map} +1 -1
- package/_internal/{ClickAwayProvider-bcce6ceb.js → ClickAwayProvider-7093ba23.js} +6 -4
- package/_internal/{ClickAwayProvider-bcce6ceb.js.map → ClickAwayProvider-7093ba23.js.map} +1 -1
- package/_internal/{DisabledStateContext-077b7bef.js → DisabledStateContext-ea04260d.js} +6 -6
- package/_internal/{DisabledStateContext-077b7bef.js.map → DisabledStateContext-ea04260d.js.map} +1 -1
- package/_internal/{HeadingLevelProvider-e4817816.js → HeadingLevelProvider-ebdcb0c7.js} +6 -4
- package/_internal/{HeadingLevelProvider-e4817816.js.map → HeadingLevelProvider-ebdcb0c7.js.map} +1 -1
- package/_internal/{IconButton-10585058.js → IconButton-f4df224c.js} +29 -24
- package/_internal/{IconButton-10585058.js.map → IconButton-f4df224c.js.map} +1 -1
- package/_internal/ImageCaption-8134a3aa.js +75 -0
- package/_internal/{ImageCaption-4279b2b6.js.map → ImageCaption-8134a3aa.js.map} +1 -1
- package/_internal/{List-d5f5d465.js → List-54237e0e.js} +52 -50
- package/_internal/{List-d5f5d465.js.map → List-54237e0e.js.map} +1 -1
- package/_internal/{PopoverDialog-21e5c9dd.js → PopoverDialog-e0967e5f.js} +166 -158
- package/_internal/{PopoverDialog-21e5c9dd.js.map → PopoverDialog-e0967e5f.js.map} +1 -1
- package/_internal/{Portal-c43d098b.js → Portal-3f86608e.js} +5 -2
- package/_internal/{Portal-c43d098b.js.map → Portal-3f86608e.js.map} +1 -1
- package/_internal/{RawClickable-c76bbc4c.js → RawClickable-2c2b6a89.js} +9 -7
- package/_internal/{RawClickable-c76bbc4c.js.map → RawClickable-2c2b6a89.js.map} +1 -1
- package/_internal/{Slides-01f513ce.js → Slides-b7a67f32.js} +99 -96
- package/_internal/{Slides-01f513ce.js.map → Slides-b7a67f32.js.map} +1 -1
- package/_internal/{Thumbnail-30d2a781.js → Thumbnail-b5dea0af.js} +46 -45
- package/_internal/{Thumbnail-30d2a781.js.map → Thumbnail-b5dea0af.js.map} +1 -1
- package/_internal/components/{alert-dialog-8f1c163c.js → alert-dialog-b284b191.js} +50 -35
- package/_internal/components/{alert-dialog-8f1c163c.js.map → alert-dialog-b284b191.js.map} +1 -1
- package/_internal/components/{autocomplete-bfbdeb3c.js → autocomplete-8d3f37ea.js} +64 -67
- package/_internal/components/{autocomplete-bfbdeb3c.js.map → autocomplete-8d3f37ea.js.map} +1 -1
- package/_internal/components/{avatar-6990e3e9.js → avatar-5fc70e00.js} +28 -32
- package/_internal/components/{avatar-6990e3e9.js.map → avatar-5fc70e00.js.map} +1 -1
- package/_internal/components/{badge-81543bc7.js → badge-8390e590.js} +18 -18
- package/_internal/components/{badge-81543bc7.js.map → badge-8390e590.js.map} +1 -1
- package/_internal/components/{button-927abe71.js → button-e3c7f2eb.js} +11 -13
- package/_internal/components/{button-927abe71.js.map → button-e3c7f2eb.js.map} +1 -1
- package/_internal/components/{checkbox-dc4caec8.js → checkbox-d1ca9748.js} +53 -44
- package/_internal/components/{checkbox-dc4caec8.js.map → checkbox-d1ca9748.js.map} +1 -1
- package/_internal/components/{chip-fb3d0c76.js → chip-e40c5521.js} +10 -12
- package/_internal/components/{chip-fb3d0c76.js.map → chip-e40c5521.js.map} +1 -1
- package/_internal/components/comment-block-a3cf7b9b.js +138 -0
- package/_internal/components/{comment-block-b84c4694.js.map → comment-block-a3cf7b9b.js.map} +1 -1
- package/_internal/components/date-picker-6c1b14e4.js +2 -0
- package/_internal/components/date-picker-6c1b14e4.js.map +1 -0
- package/_internal/components/{dialog-7dbcb485.js → dialog-ebdb9500.js} +70 -58
- package/_internal/components/{dialog-7dbcb485.js.map → dialog-ebdb9500.js.map} +1 -1
- package/_internal/components/{divider-12e9b6a0.js → divider-116af6b9.js} +7 -10
- package/_internal/components/{divider-12e9b6a0.js.map → divider-116af6b9.js.map} +1 -1
- package/_internal/components/{drag-handle-a38ff757.js → drag-handle-5215cd21.js} +14 -16
- package/_internal/components/{drag-handle-a38ff757.js.map → drag-handle-5215cd21.js.map} +1 -1
- package/_internal/components/{dropdown-38b0b6a0.js → dropdown-0baed51b.js} +15 -16
- package/_internal/components/{dropdown-38b0b6a0.js.map → dropdown-0baed51b.js.map} +1 -1
- package/_internal/components/{expansion-panel-c4b93653.js → expansion-panel-5533a680.js} +48 -39
- package/_internal/components/{expansion-panel-c4b93653.js.map → expansion-panel-5533a680.js.map} +1 -1
- package/_internal/components/{flag-c5e2f5f0.js → flag-8d4a7e72.js} +20 -16
- package/_internal/components/{flag-c5e2f5f0.js.map → flag-8d4a7e72.js.map} +1 -1
- package/_internal/components/{flex-box-c8701a85.js → flex-box-55144e5f.js} +9 -11
- package/_internal/components/{flex-box-c8701a85.js.map → flex-box-55144e5f.js.map} +1 -1
- package/_internal/components/{generic-block-0d6ad5a6.js → generic-block-ff0509ee.js} +35 -26
- package/_internal/components/{generic-block-0d6ad5a6.js.map → generic-block-ff0509ee.js.map} +1 -1
- package/_internal/components/{grid-3b194fe8.js → grid-6f1b5a41.js} +15 -20
- package/_internal/components/{grid-3b194fe8.js.map → grid-6f1b5a41.js.map} +1 -1
- package/_internal/components/{grid-column-985b9327.js → grid-column-f01df853.js} +8 -9
- package/_internal/components/{grid-column-985b9327.js.map → grid-column-f01df853.js.map} +1 -1
- package/_internal/components/{heading-5e954dfc.js → heading-89239843.js} +11 -12
- package/_internal/components/{heading-5e954dfc.js.map → heading-89239843.js.map} +1 -1
- package/_internal/components/{icon-2e7345ad.js → icon-b708cca4.js} +24 -25
- package/_internal/components/{icon-2e7345ad.js.map → icon-b708cca4.js.map} +1 -1
- package/_internal/components/{image-block-8d21dd7e.js → image-block-7938422d.js} +35 -34
- package/_internal/components/{image-block-8d21dd7e.js.map → image-block-7938422d.js.map} +1 -1
- package/_internal/components/{image-lightbox-4a5ab962.js → image-lightbox-58331704.js} +113 -100
- package/_internal/components/{image-lightbox-4a5ab962.js.map → image-lightbox-58331704.js.map} +1 -1
- package/_internal/components/{inline-list-4884f004.js → inline-list-e6f19a98.js} +24 -24
- package/_internal/components/{inline-list-4884f004.js.map → inline-list-e6f19a98.js.map} +1 -1
- package/_internal/components/{input-helper-e644e05e.js → input-helper-64153099.js} +9 -11
- package/_internal/components/{input-helper-e644e05e.js.map → input-helper-64153099.js.map} +1 -1
- package/_internal/components/{input-label-5e509a1b.js → input-label-2feb0bb0.js} +9 -11
- package/_internal/components/{input-label-5e509a1b.js.map → input-label-2feb0bb0.js.map} +1 -1
- package/_internal/components/{lightbox-bec1b95f.js → lightbox-570ad9e5.js} +55 -49
- package/_internal/components/{lightbox-bec1b95f.js.map → lightbox-570ad9e5.js.map} +1 -1
- package/_internal/components/{link-9637b9e4.js → link-91f76477.js} +25 -23
- package/_internal/components/{link-9637b9e4.js.map → link-91f76477.js.map} +1 -1
- package/_internal/components/link-preview-fdd8d738.js +117 -0
- package/_internal/components/{link-preview-7a4a6e4b.js.map → link-preview-fdd8d738.js.map} +1 -1
- package/_internal/components/{list-5c8f7122.js → list-b08d8423.js} +14 -20
- package/_internal/components/{list-5c8f7122.js.map → list-b08d8423.js.map} +1 -1
- package/_internal/components/{message-a67067d9.js → message-29cb9181.js} +24 -24
- package/_internal/components/{message-a67067d9.js.map → message-29cb9181.js.map} +1 -1
- package/_internal/components/{mosaic-92b66c80.js → mosaic-cdb9f563.js} +36 -33
- package/_internal/components/{mosaic-92b66c80.js.map → mosaic-cdb9f563.js.map} +1 -1
- package/_internal/components/navigation-8b7d9bd8.js +225 -0
- package/_internal/components/{navigation-4fd3917d.js.map → navigation-8b7d9bd8.js.map} +1 -1
- package/_internal/components/{notification-9063c963.js → notification-a45fda96.js} +45 -40
- package/_internal/components/{notification-9063c963.js.map → notification-a45fda96.js.map} +1 -1
- package/_internal/components/popover-65bfbc57.js +3 -0
- package/_internal/components/popover-65bfbc57.js.map +1 -0
- package/_internal/components/post-block-52e58dd5.js +109 -0
- package/_internal/components/{post-block-0cfc2206.js.map → post-block-52e58dd5.js.map} +1 -1
- package/_internal/components/{progress-eaf5b33d.js → progress-f39c3fa2.js} +44 -50
- package/_internal/components/{progress-eaf5b33d.js.map → progress-f39c3fa2.js.map} +1 -1
- package/_internal/components/{progress-tracker-4a65718d.js → progress-tracker-512d7a08.js} +59 -63
- package/_internal/components/{progress-tracker-4a65718d.js.map → progress-tracker-512d7a08.js.map} +1 -1
- package/_internal/components/{radio-button-3ef8a325.js → radio-button-559a4863.js} +54 -53
- package/_internal/components/{radio-button-3ef8a325.js.map → radio-button-559a4863.js.map} +1 -1
- package/_internal/components/select-48d4fa8c.js +454 -0
- package/_internal/components/{select-d46cfe35.js.map → select-48d4fa8c.js.map} +1 -1
- package/_internal/components/{side-navigation-75b22f19.js → side-navigation-f9bc5b4e.js} +62 -56
- package/_internal/components/{side-navigation-75b22f19.js.map → side-navigation-f9bc5b4e.js.map} +1 -1
- package/_internal/components/{skeleton-361ce335.js → skeleton-c66516ee.js} +23 -31
- package/_internal/components/{skeleton-361ce335.js.map → skeleton-c66516ee.js.map} +1 -1
- package/_internal/components/{slider-8094cb5c.js → slider-efbfbc45.js} +62 -56
- package/_internal/components/{slider-8094cb5c.js.map → slider-efbfbc45.js.map} +1 -1
- package/_internal/components/{slideshow-2e8cd372.js → slideshow-dd312470.js} +39 -38
- package/_internal/components/{slideshow-2e8cd372.js.map → slideshow-dd312470.js.map} +1 -1
- package/_internal/components/{switch-5516949b.js → switch-769a2a04.js} +49 -45
- package/_internal/components/{switch-5516949b.js.map → switch-769a2a04.js.map} +1 -1
- package/_internal/components/{table-fa198ee6.js → table-8617b1ba.js} +68 -73
- package/_internal/components/{table-fa198ee6.js.map → table-8617b1ba.js.map} +1 -1
- package/_internal/components/{tabs-bb9bc2a5.js → tabs-884c57b6.js} +41 -41
- package/_internal/components/{tabs-bb9bc2a5.js.map → tabs-884c57b6.js.map} +1 -1
- package/_internal/components/text-c7b1e079.js +2 -0
- package/_internal/components/text-c7b1e079.js.map +1 -0
- package/_internal/components/{text-field-82733568.js → text-field-478acd86.js} +116 -103
- package/_internal/components/{text-field-82733568.js.map → text-field-478acd86.js.map} +1 -1
- package/_internal/components/{thumbnail-e3acff82.js → thumbnail-310a4c4b.js} +2 -2
- package/_internal/components/{thumbnail-e3acff82.js.map → thumbnail-310a4c4b.js.map} +1 -1
- package/_internal/components/{toolbar-155562be.js → toolbar-a43533a2.js} +18 -17
- package/_internal/components/{toolbar-155562be.js.map → toolbar-a43533a2.js.map} +1 -1
- package/_internal/components/{tooltip-84ffb4f9.js → tooltip-2885ab2e.js} +44 -35
- package/_internal/components/{tooltip-84ffb4f9.js.map → tooltip-2885ab2e.js.map} +1 -1
- package/_internal/components/{uploader-896a1d89.js → uploader-1e7f5bbb.js} +35 -32
- package/_internal/components/{uploader-896a1d89.js.map → uploader-1e7f5bbb.js.map} +1 -1
- package/_internal/components/{user-block-8fd15895.js → user-block-68a51ed0.js} +43 -41
- package/_internal/components/{user-block-8fd15895.js.map → user-block-68a51ed0.js.map} +1 -1
- package/_internal/{context-21aeb1c7.js → context-9d1336a1.js} +6 -6
- package/_internal/{context-21aeb1c7.js.map → context-9d1336a1.js.map} +1 -1
- package/_internal/{forwardRef-49d2bb84.js → forwardRef-15f62847.js} +2 -12
- package/_internal/{forwardRef-49d2bb84.js.map → forwardRef-15f62847.js.map} +1 -1
- package/_internal/{index-f415b08e.js → index-9df37c0d.js} +45 -39
- package/_internal/{index-f415b08e.js.map → index-9df37c0d.js.map} +1 -1
- package/_internal/{index-b4d256e7.js → index-a9c5cd69.js} +10 -11
- package/_internal/{index-b4d256e7.js.map → index-a9c5cd69.js.map} +1 -1
- package/_internal/{useDisableStateProps-fffc365f.js → useDisableStateProps-69e16b7c.js} +2 -2
- package/_internal/{useDisableStateProps-fffc365f.js.map → useDisableStateProps-69e16b7c.js.map} +1 -1
- package/_internal/{wrapChildrenIconWithSpaces-f86106ce.js → wrapChildrenIconWithSpaces-c1faaae4.js} +2 -2
- package/_internal/{wrapChildrenIconWithSpaces-f86106ce.js.map → wrapChildrenIconWithSpaces-c1faaae4.js.map} +1 -1
- package/index.js +61 -61
- package/package.json +4 -3
- package/utils/index.js +3 -3
- package/_internal/ImageCaption-4279b2b6.js +0 -65
- package/_internal/components/comment-block-b84c4694.js +0 -121
- package/_internal/components/date-picker-a425534c.js +0 -2
- package/_internal/components/date-picker-a425534c.js.map +0 -1
- package/_internal/components/link-preview-7a4a6e4b.js +0 -108
- package/_internal/components/navigation-4fd3917d.js +0 -210
- package/_internal/components/popover-3c4c54bd.js +0 -3
- package/_internal/components/popover-3c4c54bd.js.map +0 -1
- package/_internal/components/post-block-0cfc2206.js +0 -99
- package/_internal/components/select-d46cfe35.js +0 -404
- package/_internal/components/text-289c0526.js +0 -2
- package/_internal/components/text-289c0526.js.map +0 -1
package/_internal/components/{generic-block-0d6ad5a6.js.map → generic-block-ff0509ee.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-block-0d6ad5a6.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","createElement","FlexBox","_extends","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;AAExC,MAAMK,OAAO,GAAGJ,IAAI,CAACC,IAAI,CAAC,EAAE,CAAuB,CAAA;AACnD,MAAMI,SAAS,GAAGF,eAAe,CAACC,OAAO,CAAC,CAAA;AAE1C,MAAME,OAAO,GAAGN,IAAI,CAACC,IAAI,CAAC,EAAE,CAAuB,CAAA;AACnD,MAAMM,SAAS,GAAGJ,eAAe,CAACG,OAAO,CAAC,CAAA;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,gBAAkC,GAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAClE,MAAM;IACFC,SAAS;IACTC,MAAM;IACNC,WAAW;IACXC,QAAQ;IACRC,OAAO;IACPC,YAAY;IACZxB,GAAG,GAAGD,aAAa,CAACC,GAAG;IACvBG,WAAW,GAAGJ,aAAa,CAACI,WAAW;IACvCsB,YAAY;IACZ,GAAGC,cAAAA;AACP,GAA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AA,EAC1BxB,YAAY,EACZG,QAAQ,CAACY,iBAAiB,EAAA;AAC9BpB,IAAAA,SAAS,EAAE2B,UAAU,CACjBtB,YAAY,EAAEL,SAAS,EACvBQ,QAAQ,CAACY,iBAAiB,EAAEpB,SAAS,EACrC,CAAA,EAAGtB,SAAS,CAChB,SAAA,CAAA,CAAA;GAEC0B,CAAAA,EAAAA,OAAO,EACPI,QAAQ,CAACY,iBAAiB,EAAEjB,QACxB,CAER,CAAC,CAAA;AAElB,CAAC,CAAC,CAAA;AACFP,gBAAgB,CAACqC,WAAW,GAAGxD,cAAc,CAAA;AAC7CmB,gBAAgB,CAACI,SAAS,GAAGtB,SAAS,CAAA;AACtCkB,gBAAgB,CAACsC,YAAY,GAAGtD,aAAa,CAAA;AAEtC,MAAMuD,YAA0B,GAAGC,MAAM,CAACC,MAAM,CAACzC,gBAAgB,EAAE;EAAET,MAAM;EAAEK,OAAO;AAAEE,EAAAA,OAAAA;AAAQ,CAAC;;AC5NtG;AACA;AACA;MACa4C,mBAAmB,GAAGC,IAAI,CAACzD,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC;;;;"}
|
|
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;AAExC,MAAMK,OAAO,GAAGJ,IAAI,CAACC,IAAI,CAAC,EAAE,CAAuB,CAAA;AACnD,MAAMI,SAAS,GAAGF,eAAe,CAACC,OAAO,CAAC,CAAA;AAE1C,MAAME,OAAO,GAAGN,IAAI,CAACC,IAAI,CAAC,EAAE,CAAuB,CAAA;AACnD,MAAMM,SAAS,GAAGJ,eAAe,CAACG,OAAO,CAAC,CAAA;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,gBAAkC,GAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAClE,MAAM;IACFC,SAAS;IACTC,MAAM;IACNC,WAAW;IACXC,QAAQ;IACRC,OAAO;IACPC,YAAY;IACZxB,GAAG,GAAGD,aAAa,CAACC,GAAG;IACvBG,WAAW,GAAGJ,aAAa,CAACI,WAAW;IACvCsB,YAAY;IACZ,GAAGC,cAAAA;AACP,GAAC,GAAGT,KAAK,CAAA;AAET,EAAA,MAAMU,QAAQ,GAAGC,cAAK,CAACC,OAAO,CAAC,MAAM;AACjC;AACA,IAAA,MAAM,CAAC,CAACC,WAAW,CAAC,EAAE,CAACC,YAAY,CAAC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A,GAEDC,OAAO,EACPI,QAAQ,CAACY,iBAAiB,EAAEjB,QAAQ,CAAA;AAAA,KAChC,CACZ,CAAA;AAAA,GACI,CAAC,CAAA;AAElB,CAAC,CAAC,CAAA;AACFP,gBAAgB,CAACoC,WAAW,GAAGvD,cAAc,CAAA;AAC7CmB,gBAAgB,CAACI,SAAS,GAAGtB,SAAS,CAAA;AACtCkB,gBAAgB,CAACqC,YAAY,GAAGrD,aAAa,CAAA;AAEtC,MAAMsD,YAA0B,GAAGC,MAAM,CAACC,MAAM,CAACxC,gBAAgB,EAAE;EAAET,MAAM;EAAEK,OAAO;AAAEE,EAAAA,OAAAA;AAAQ,CAAC;;AC5NtG;AACA;AACA;MACa2C,mBAAmB,GAAGC,IAAI,CAACxD,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC;;;;"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { f as forwardRef,
|
|
1
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
2
2
|
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
4
|
import { Orientation } from '@lumx/core/js/constants';
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* Defines the props of the component.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
6
|
/**
|
|
10
7
|
* Component display name.
|
|
11
8
|
*/
|
|
@@ -42,9 +39,9 @@ const Grid = forwardRef((props, ref) => {
|
|
|
42
39
|
wrap = DEFAULT_PROPS.wrap,
|
|
43
40
|
...forwardedProps
|
|
44
41
|
} = props;
|
|
45
|
-
return /*#__PURE__*/
|
|
46
|
-
ref: ref
|
|
47
|
-
|
|
42
|
+
return /*#__PURE__*/jsx("div", {
|
|
43
|
+
ref: ref,
|
|
44
|
+
...forwardedProps,
|
|
48
45
|
className: classNames(className, `${CLASSNAME$1}-container`, {
|
|
49
46
|
[`${CLASSNAME$1}--h-align-${hAlign}`]: hAlign
|
|
50
47
|
}, {
|
|
@@ -54,17 +51,14 @@ const Grid = forwardRef((props, ref) => {
|
|
|
54
51
|
orientation,
|
|
55
52
|
wrap,
|
|
56
53
|
gutter
|
|
57
|
-
}))
|
|
58
|
-
|
|
54
|
+
})),
|
|
55
|
+
children: children
|
|
56
|
+
});
|
|
59
57
|
});
|
|
60
58
|
Grid.displayName = COMPONENT_NAME$1;
|
|
61
59
|
Grid.className = CLASSNAME$1;
|
|
62
60
|
Grid.defaultProps = DEFAULT_PROPS;
|
|
63
61
|
|
|
64
|
-
/**
|
|
65
|
-
* Defines the props of the component.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
62
|
/**
|
|
69
63
|
* Component display name.
|
|
70
64
|
*/
|
|
@@ -91,19 +85,20 @@ const GridItem = forwardRef((props, ref) => {
|
|
|
91
85
|
order,
|
|
92
86
|
...forwardedProps
|
|
93
87
|
} = props;
|
|
94
|
-
return /*#__PURE__*/
|
|
95
|
-
ref: ref
|
|
96
|
-
|
|
88
|
+
return /*#__PURE__*/jsx("div", {
|
|
89
|
+
ref: ref,
|
|
90
|
+
...forwardedProps,
|
|
97
91
|
className: classNames(className, handleBasicClasses({
|
|
98
92
|
prefix: CLASSNAME,
|
|
99
93
|
width,
|
|
100
94
|
order,
|
|
101
95
|
align
|
|
102
|
-
}))
|
|
103
|
-
|
|
96
|
+
})),
|
|
97
|
+
children: children
|
|
98
|
+
});
|
|
104
99
|
});
|
|
105
100
|
GridItem.displayName = COMPONENT_NAME;
|
|
106
101
|
GridItem.className = CLASSNAME;
|
|
107
102
|
|
|
108
103
|
export { Grid, GridItem };
|
|
109
|
-
//# sourceMappingURL=grid-
|
|
104
|
+
//# sourceMappingURL=grid-6f1b5a41.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-
|
|
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,WAAW,EAAEC,WAAW,CAACC,UAAU;AACnCC,EAAAA,IAAI,EAAE,QAAA;AACV,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,IAAI,GAAGC,UAA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C,SAAS;IAAEY,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAE,GAAGV,cAAAA;AAAe,GAAC,GAAGP,KAAK,CAAA;AAE7E,EAAA,oBACIQ,GAAA,CAAA,KAAA,EAAA;AACIP,IAAAA,GAAG,EAAEA,GAAI;AAAA,IAAA,GACLM,cAAc;AAClBJ,IAAAA,SAAS,EAAEM,UAAU,CAACN,SAAS,EAAEO,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEpB,SAAS;MAAEwB,KAAK;MAAEE,KAAK;AAAED,MAAAA,KAAAA;AAAM,KAAC,CAAC,CAAE;AAAAd,IAAAA,QAAA,EAEhGA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAEd,CAAC,EAAC;AACFY,QAAQ,CAACF,WAAW,GAAGtB,cAAc,CAAA;AACrCwB,QAAQ,CAACX,SAAS,GAAGZ,SAAS;;;;"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { f as forwardRef, _ as _extends, c as classNames } from '../forwardRef-49d2bb84.js';
|
|
2
1
|
import isInteger from 'lodash/isInteger';
|
|
2
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
3
3
|
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Defines the props of the component.
|
|
7
|
-
*/
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* Component display name.
|
|
@@ -41,7 +38,8 @@ const GridColumn = forwardRef((props, ref) => {
|
|
|
41
38
|
style = {},
|
|
42
39
|
...forwardedProps
|
|
43
40
|
} = props;
|
|
44
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/jsx(Component, {
|
|
42
|
+
...forwardedProps,
|
|
45
43
|
ref: ref,
|
|
46
44
|
className: classNames(className, CLASSNAME),
|
|
47
45
|
style: {
|
|
@@ -49,12 +47,13 @@ const GridColumn = forwardRef((props, ref) => {
|
|
|
49
47
|
['--lumx-grid-column-item-min-width']: isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
50
48
|
['--lumx-grid-column-columns']: maxColumns,
|
|
51
49
|
['--lumx-grid-column-gap']: gap && `var(--lumx-spacing-unit-${gap})`
|
|
52
|
-
}
|
|
53
|
-
|
|
50
|
+
},
|
|
51
|
+
children: children
|
|
52
|
+
});
|
|
54
53
|
});
|
|
55
54
|
GridColumn.displayName = COMPONENT_NAME;
|
|
56
55
|
GridColumn.className = CLASSNAME;
|
|
57
56
|
GridColumn.defaultProps = DEFAULT_PROPS;
|
|
58
57
|
|
|
59
58
|
export { GridColumn };
|
|
60
|
-
//# sourceMappingURL=grid-column-
|
|
59
|
+
//# sourceMappingURL=grid-column-f01df853.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-column-
|
|
1
|
+
{"version":3,"file":"grid-column-f01df853.js","sources":["../../../src/components/grid-column/GridColumn.tsx"],"sourcesContent":["import { ReactElement, ReactNode } from 'react';\n\nimport isInteger from 'lodash/isInteger';\nimport classNames from 'classnames';\n\nimport { Size } from '@lumx/react';\nimport { GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nexport type GridColumnGapSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface GridColumnProps extends GenericProps {\n /** Customize the root element. */\n as?: React.ElementType;\n /** Children elements. */\n children?: ReactNode;\n /** Space between columns and rows. */\n gap?: GridColumnGapSize;\n /** Ideal number of columns. */\n maxColumns?: number;\n /** Minimum width for each item, reduce the number of column if there is not enough space. */\n itemMinWidth?: number;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'GridColumn';\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<GridColumnProps> = {};\n\n/**\n * The GridColumn is a layout component that can display children in a grid\n * with custom display properties. It also comes with a responsive design,\n * with a number of column that reduce when there is not enough space for each item.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const GridColumn = forwardRef<GridColumnProps>((props, ref): ReactElement => {\n const {\n as: Component = 'div',\n gap,\n maxColumns,\n itemMinWidth,\n children,\n className,\n style = {},\n ...forwardedProps\n } = props;\n\n return (\n <Component\n {...forwardedProps}\n ref={ref as React.Ref<any>}\n className={classNames(className, CLASSNAME)}\n style={{\n ...style,\n ['--lumx-grid-column-item-min-width' as any]: isInteger(itemMinWidth) && `${itemMinWidth}px`,\n ['--lumx-grid-column-columns' as any]: maxColumns,\n ['--lumx-grid-column-gap' as any]: gap && `var(--lumx-spacing-unit-${gap})`,\n }}\n >\n {children}\n </Component>\n );\n});\nGridColumn.displayName = COMPONENT_NAME;\nGridColumn.className = CLASSNAME;\nGridColumn.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","GridColumn","forwardRef","props","ref","as","Component","gap","maxColumns","itemMinWidth","children","className","style","forwardedProps","_jsx","classNames","isInteger","displayName","defaultProps"],"mappings":";;;;;AA4BA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,YAAY,CAAA;;AAEnC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAuC,GAAG,EAAE,CAAA;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,UAAU,GAAGC,UAAU,CAAkB,CAACC,KAAK,EAAEC,GAAG,KAAmB;EAChF,MAAM;IACFC,EAAE,EAAEC,SAAS,GAAG,KAAK;IACrBC,GAAG;IACHC,UAAU;IACVC,YAAY;IACZC,QAAQ;IACRC,SAAS;IACTC,KAAK,GAAG,EAAE;IACV,GAAGC,cAAAA;AACP,GAAC,GAAGV,KAAK,CAAA;EAET,oBACIW,GAAA,CAACR,SAAS,EAAA;AAAA,IAAA,GACFO,cAAc;AAClBT,IAAAA,GAAG,EAAEA,GAAsB;AAC3BO,IAAAA,SAAS,EAAEI,UAAU,CAACJ,SAAS,EAAEb,SAAS,CAAE;AAC5Cc,IAAAA,KAAK,EAAE;AACH,MAAA,GAAGA,KAAK;MACR,CAAC,mCAAmC,GAAUI,SAAS,CAACP,YAAY,CAAC,IAAI,CAAGA,EAAAA,YAAY,CAAI,EAAA,CAAA;MAC5F,CAAC,4BAA4B,GAAUD,UAAU;AACjD,MAAA,CAAC,wBAAwB,GAAUD,GAAG,IAAI,2BAA2BA,GAAG,CAAA,CAAA,CAAA;KAC1E;AAAAG,IAAAA,QAAA,EAEDA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEpB,CAAC,EAAC;AACFT,UAAU,CAACgB,WAAW,GAAGpB,cAAc,CAAA;AACvCI,UAAU,CAACU,SAAS,GAAGb,SAAS,CAAA;AAChCG,UAAU,CAACiB,YAAY,GAAGlB,aAAa;;;;"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { f as forwardRef,
|
|
1
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
2
2
|
import { getRootClassName } from '@lumx/core/js/utils/className';
|
|
3
|
-
import { u as useHeadingLevel, D as DEFAULT_TYPOGRAPHY_BY_LEVEL } from '../HeadingLevelProvider-
|
|
4
|
-
export { H as HeadingLevelProvider } from '../HeadingLevelProvider-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Defines the props of the component.
|
|
9
|
-
*/
|
|
3
|
+
import { u as useHeadingLevel, D as DEFAULT_TYPOGRAPHY_BY_LEVEL } from '../HeadingLevelProvider-ebdcb0c7.js';
|
|
4
|
+
export { H as HeadingLevelProvider } from '../HeadingLevelProvider-ebdcb0c7.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { T as Text } from '../index-a9c5cd69.js';
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* Component display name.
|
|
@@ -39,16 +36,18 @@ const Heading = forwardRef((props, ref) => {
|
|
|
39
36
|
headingElement
|
|
40
37
|
} = useHeadingLevel();
|
|
41
38
|
const computedHeadingElement = as || headingElement;
|
|
42
|
-
return /*#__PURE__*/
|
|
39
|
+
return /*#__PURE__*/jsx(Text, {
|
|
43
40
|
ref: ref,
|
|
44
41
|
className: classNames(className, CLASSNAME),
|
|
45
42
|
as: computedHeadingElement,
|
|
46
|
-
typography: DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement]
|
|
47
|
-
|
|
43
|
+
typography: DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement],
|
|
44
|
+
...forwardedProps,
|
|
45
|
+
children: children
|
|
46
|
+
});
|
|
48
47
|
});
|
|
49
48
|
Heading.displayName = COMPONENT_NAME;
|
|
50
49
|
Heading.className = CLASSNAME;
|
|
51
50
|
Heading.defaultProps = DEFAULT_PROPS;
|
|
52
51
|
|
|
53
52
|
export { Heading, useHeadingLevel };
|
|
54
|
-
//# sourceMappingURL=heading-
|
|
53
|
+
//# sourceMappingURL=heading-89239843.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading-
|
|
1
|
+
{"version":3,"file":"heading-89239843.js","sources":["../../../src/components/heading/Heading.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { HeadingElement } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { Text, TextProps } from '../text';\nimport { DEFAULT_TYPOGRAPHY_BY_LEVEL } from './constants';\nimport { useHeadingLevel } from './useHeadingLevel';\n\n/**\n * Defines the props of the component.\n */\nexport interface HeadingProps extends Partial<TextProps> {\n /**\n * Display a specific heading level instead of the one provided by parent context provider.\n */\n as?: HeadingElement;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Heading';\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 = {} as const;\n\n/**\n * Renders a heading component.\n * Extends the `Text` Component with the heading level automatically computed based on\n * the current level provided by the context.\n */\nexport const Heading = forwardRef<HeadingProps>((props, ref) => {\n const { children, as, className, ...forwardedProps } = props;\n const { headingElement } = useHeadingLevel();\n\n const computedHeadingElement = as || headingElement;\n return (\n <Text\n ref={ref}\n className={classNames(className, CLASSNAME)}\n as={computedHeadingElement}\n typography={DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement]}\n {...forwardedProps}\n >\n {children}\n </Text>\n );\n});\n\nHeading.displayName = COMPONENT_NAME;\nHeading.className = CLASSNAME;\nHeading.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Heading","forwardRef","props","ref","children","as","className","forwardedProps","headingElement","useHeadingLevel","computedHeadingElement","_jsx","Text","classNames","typography","DEFAULT_TYPOGRAPHY_BY_LEVEL","displayName","defaultProps"],"mappings":";;;;;;;AAwBA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,SAAS,CAAA;;AAEhC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAa,GAAG,EAAW,CAAA;;AAEjC;AACA;AACA;AACA;AACA;AACO,MAAMC,OAAO,GAAGC,UAAU,CAAe,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5D,MAAM;IAAEC,QAAQ;IAAEC,EAAE;IAAEC,SAAS;IAAE,GAAGC,cAAAA;AAAe,GAAC,GAAGL,KAAK,CAAA;EAC5D,MAAM;AAAEM,IAAAA,cAAAA;GAAgB,GAAGC,eAAe,EAAE,CAAA;AAE5C,EAAA,MAAMC,sBAAsB,GAAGL,EAAE,IAAIG,cAAc,CAAA;EACnD,oBACIG,GAAA,CAACC,IAAI,EAAA;AACDT,IAAAA,GAAG,EAAEA,GAAI;AACTG,IAAAA,SAAS,EAAEO,UAAU,CAACP,SAAS,EAAET,SAAS,CAAE;AAC5CQ,IAAAA,EAAE,EAAEK,sBAAuB;AAC3BI,IAAAA,UAAU,EAAEC,2BAA2B,CAACL,sBAAsB,CAAE;AAAA,IAAA,GAC5DH,cAAc;AAAAH,IAAAA,QAAA,EAEjBA,QAAAA;AAAQ,GACP,CAAC,CAAA;AAEf,CAAC,EAAC;AAEFJ,OAAO,CAACgB,WAAW,GAAGpB,cAAc,CAAA;AACpCI,OAAO,CAACM,SAAS,GAAGT,SAAS,CAAA;AAC7BG,OAAO,CAACiB,YAAY,GAAGlB,aAAa;;;;"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { f as forwardRef,
|
|
1
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
2
2
|
import { mdiAlertCircle } from '@lumx/icons';
|
|
3
3
|
import { getRootClassName, resolveColorWithVariants, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
4
4
|
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
import { Theme, ColorPalette, Size } from '@lumx/core/js/constants';
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
* Defines the props of the component.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
8
|
/**
|
|
12
9
|
* Component display name.
|
|
13
10
|
*/
|
|
@@ -68,9 +65,9 @@ const Icon = forwardRef((props, ref) => {
|
|
|
68
65
|
} else if (hasShape) {
|
|
69
66
|
iconSize = Size.m;
|
|
70
67
|
}
|
|
71
|
-
return /*#__PURE__*/
|
|
72
|
-
ref: ref
|
|
73
|
-
|
|
68
|
+
return /*#__PURE__*/jsx("i", {
|
|
69
|
+
ref: ref,
|
|
70
|
+
...forwardedProps,
|
|
74
71
|
className: classNames(className, handleBasicClasses({
|
|
75
72
|
color: iconColor,
|
|
76
73
|
colorVariant: iconColorVariant,
|
|
@@ -78,26 +75,28 @@ const Icon = forwardRef((props, ref) => {
|
|
|
78
75
|
prefix: CLASSNAME,
|
|
79
76
|
theme,
|
|
80
77
|
size: iconSize
|
|
81
|
-
}), !hasShape && `${CLASSNAME}--no-shape`, !hasShape && iconColor === ColorPalette.yellow && icon === mdiAlertCircle && `${CLASSNAME}--has-dark-layer`, `${CLASSNAME}--path`)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
78
|
+
}), !hasShape && `${CLASSNAME}--no-shape`, !hasShape && iconColor === ColorPalette.yellow && icon === mdiAlertCircle && `${CLASSNAME}--has-dark-layer`, `${CLASSNAME}--path`),
|
|
79
|
+
children: /*#__PURE__*/jsx("svg", {
|
|
80
|
+
"aria-hidden": alt ? undefined : 'true',
|
|
81
|
+
role: alt ? 'img' : undefined,
|
|
82
|
+
"aria-label": alt,
|
|
83
|
+
height: "1em",
|
|
84
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
85
|
+
style: {
|
|
86
|
+
verticalAlign: '-0.125em'
|
|
87
|
+
},
|
|
88
|
+
viewBox: "0 0 24 24",
|
|
89
|
+
width: "1em",
|
|
90
|
+
children: /*#__PURE__*/jsx("path", {
|
|
91
|
+
d: icon,
|
|
92
|
+
fill: "currentColor"
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
});
|
|
97
96
|
});
|
|
98
97
|
Icon.displayName = COMPONENT_NAME;
|
|
99
98
|
Icon.className = CLASSNAME;
|
|
100
99
|
Icon.defaultProps = DEFAULT_PROPS;
|
|
101
100
|
|
|
102
101
|
export { Icon };
|
|
103
|
-
//# sourceMappingURL=icon-
|
|
102
|
+
//# sourceMappingURL=icon-b708cca4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-
|
|
1
|
+
{"version":3,"file":"icon-b708cca4.js","sources":["../../../src/components/icon/Icon.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { mdiAlertCircle } from '@lumx/icons';\nimport { ColorPalette, ColorVariant, ColorWithVariants, Size, Theme } from '@lumx/react';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses, resolveColorWithVariants } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\n\nexport type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface IconProps extends GenericProps, HasTheme {\n /** Color variant. */\n color?: ColorWithVariants;\n /** Lightened or darkened variant of the selected icon color. */\n colorVariant?: ColorVariant;\n /** Whether the icon has a shape. */\n hasShape?: boolean;\n /**\n * Icon (SVG path) draw code (`d` property of the `<path>` SVG element).\n * See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths\n */\n icon: string;\n /** Size variant. */\n size?: IconSizes;\n /** Sets an alternative text on the svg. Will set an `img` role to the svg. */\n alt?: string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Icon';\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<IconProps> = {};\n\n/**\n * Icon component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Icon = forwardRef<IconProps, HTMLElement>((props, ref) => {\n const defaultTheme = useTheme();\n const {\n className,\n color: propColor,\n colorVariant: propColorVariant,\n hasShape,\n icon,\n size,\n theme = defaultTheme,\n alt,\n ...forwardedProps\n } = props;\n const [color, colorVariant] = resolveColorWithVariants(propColor, propColorVariant);\n\n // Color\n let iconColor = color;\n if (!iconColor && (hasShape || theme)) {\n iconColor = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;\n }\n\n // Color variant\n let iconColorVariant = colorVariant;\n if (!iconColorVariant && hasShape && iconColor === ColorPalette.dark) {\n iconColorVariant = 'L2';\n }\n\n // Size\n let iconSize = size;\n if (size && hasShape) {\n if (size === Size.xxs || size === Size.xs) {\n iconSize = Size.s;\n } else if (size === Size.xxl) {\n iconSize = Size.xl;\n }\n } else if (hasShape) {\n iconSize = Size.m;\n }\n\n return (\n <i\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n color: iconColor,\n colorVariant: iconColorVariant,\n hasShape,\n prefix: CLASSNAME,\n theme,\n size: iconSize,\n }),\n !hasShape && `${CLASSNAME}--no-shape`,\n !hasShape &&\n iconColor === ColorPalette.yellow &&\n icon === mdiAlertCircle &&\n `${CLASSNAME}--has-dark-layer`,\n `${CLASSNAME}--path`,\n )}\n >\n <svg\n aria-hidden={alt ? undefined : 'true'}\n role={alt ? 'img' : undefined}\n aria-label={alt}\n height=\"1em\"\n preserveAspectRatio=\"xMidYMid meet\"\n style={{ verticalAlign: '-0.125em' }}\n viewBox=\"0 0 24 24\"\n width=\"1em\"\n >\n <path d={icon} fill=\"currentColor\" />\n </svg>\n </i>\n );\n});\nIcon.displayName = COMPONENT_NAME;\nIcon.className = CLASSNAME;\nIcon.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","Icon","forwardRef","props","ref","defaultTheme","useTheme","className","color","propColor","colorVariant","propColorVariant","hasShape","icon","size","theme","alt","forwardedProps","resolveColorWithVariants","iconColor","Theme","dark","ColorPalette","light","iconColorVariant","iconSize","Size","xxs","xs","s","xxl","xl","m","_jsx","classNames","handleBasicClasses","prefix","yellow","mdiAlertCircle","children","undefined","role","height","preserveAspectRatio","style","verticalAlign","viewBox","width","d","fill","displayName","defaultProps"],"mappings":";;;;;;;AAgCA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,MAAM,CAAA;;AAE7B;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAiC,GAAG,EAAE,CAAA;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,IAAI,GAAGC,UAAU,CAAyB,CAACC,KAAK,EAAEC,GAAG,KAAK;AACnE,EAAA,MAAMC,YAAY,GAAGC,QAAQ,EAAE,CAAA;EAC/B,MAAM;IACFC,SAAS;AACTC,IAAAA,KAAK,EAAEC,SAAS;AAChBC,IAAAA,YAAY,EAAEC,gBAAgB;IAC9BC,QAAQ;IACRC,IAAI;IACJC,IAAI;AACJC,IAAAA,KAAK,GAAGV,YAAY;IACpBW,GAAG;IACH,GAAGC,cAAAA;AACP,GAAC,GAAGd,KAAK,CAAA;EACT,MAAM,CAACK,KAAK,EAAEE,YAAY,CAAC,GAAGQ,wBAAwB,CAACT,SAAS,EAAEE,gBAAgB,CAAC,CAAA;;AAEnF;EACA,IAAIQ,SAAS,GAAGX,KAAK,CAAA;AACrB,EAAA,IAAI,CAACW,SAAS,KAAKP,QAAQ,IAAIG,KAAK,CAAC,EAAE;AACnCI,IAAAA,SAAS,GAAGJ,KAAK,KAAKK,KAAK,CAACC,IAAI,GAAGC,YAAY,CAACC,KAAK,GAAGD,YAAY,CAACD,IAAI,CAAA;AAC7E,GAAA;;AAEA;EACA,IAAIG,gBAAgB,GAAGd,YAAY,CAAA;EACnC,IAAI,CAACc,gBAAgB,IAAIZ,QAAQ,IAAIO,SAAS,KAAKG,YAAY,CAACD,IAAI,EAAE;AAClEG,IAAAA,gBAAgB,GAAG,IAAI,CAAA;AAC3B,GAAA;;AAEA;EACA,IAAIC,QAAQ,GAAGX,IAAI,CAA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BAAmB,EAAC,eAAe;AACnCC,MAAAA,KAAK,EAAE;AAAEC,QAAAA,aAAa,EAAE,UAAA;OAAa;AACrCC,MAAAA,OAAO,EAAC,WAAW;AACnBC,MAAAA,KAAK,EAAC,KAAK;AAAAR,MAAAA,QAAA,eAEXN,GAAA,CAAA,MAAA,EAAA;AAAMe,QAAAA,CAAC,EAAEnC,IAAK;AAACoC,QAAAA,IAAI,EAAC,cAAA;OAAgB,CAAA;KACnC,CAAA;AAAC,GACP,CAAC,CAAA;AAEZ,CAAC,EAAC;AACFhD,IAAI,CAACiD,WAAW,GAAGrD,cAAc,CAAA;AACjCI,IAAI,CAACM,SAAS,GAAGT,SAAS,CAAA;AAC1BG,IAAI,CAACkD,YAAY,GAAGnD,aAAa;;;;"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { f as forwardRef,
|
|
1
|
+
import { f as forwardRef, c as classNames } from '../forwardRef-15f62847.js';
|
|
2
2
|
import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
|
|
3
3
|
import { u as useTheme } from '../ThemeContext-3181f000.js';
|
|
4
|
-
import { I as ImageCaption } from '../ImageCaption-
|
|
4
|
+
import { I as ImageCaption } from '../ImageCaption-8134a3aa.js';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
6
|
import { Alignment, Theme } from '@lumx/core/js/constants';
|
|
6
|
-
import { T as Thumbnail } from '../Thumbnail-
|
|
7
|
+
import { T as Thumbnail } from '../Thumbnail-b5dea0af.js';
|
|
7
8
|
|
|
8
|
-
/**
|
|
9
|
-
* Image block variants.
|
|
10
|
-
*/
|
|
11
9
|
const ImageBlockCaptionPosition = {
|
|
12
10
|
below: 'below',
|
|
13
11
|
over: 'over'
|
|
@@ -67,43 +65,46 @@ const ImageBlock = forwardRef((props, ref) => {
|
|
|
67
65
|
titleProps,
|
|
68
66
|
...forwardedProps
|
|
69
67
|
} = props;
|
|
70
|
-
return /*#__PURE__*/
|
|
71
|
-
ref: ref
|
|
72
|
-
|
|
68
|
+
return /*#__PURE__*/jsxs("figure", {
|
|
69
|
+
ref: ref,
|
|
70
|
+
...forwardedProps,
|
|
73
71
|
className: classNames(className, handleBasicClasses({
|
|
74
72
|
prefix: CLASSNAME,
|
|
75
73
|
captionPosition,
|
|
76
74
|
align,
|
|
77
75
|
size,
|
|
78
76
|
theme
|
|
79
|
-
}), fillHeight && `${CLASSNAME}--fill-height`)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
77
|
+
}), fillHeight && `${CLASSNAME}--fill-height`),
|
|
78
|
+
children: [/*#__PURE__*/jsx(Thumbnail, {
|
|
79
|
+
...thumbnailProps,
|
|
80
|
+
className: classNames(`${CLASSNAME}__image`, thumbnailProps?.className),
|
|
81
|
+
fillHeight: fillHeight,
|
|
82
|
+
align: align,
|
|
83
|
+
image: image,
|
|
84
|
+
size: size,
|
|
85
|
+
theme: theme,
|
|
86
|
+
alt: alt || title
|
|
87
|
+
}), /*#__PURE__*/jsx(ImageCaption, {
|
|
88
|
+
as: "figcaption",
|
|
89
|
+
baseClassName: CLASSNAME,
|
|
90
|
+
theme: theme,
|
|
91
|
+
title: title,
|
|
92
|
+
titleProps: titleProps,
|
|
93
|
+
description: description,
|
|
94
|
+
descriptionProps: descriptionProps,
|
|
95
|
+
tags: tags,
|
|
96
|
+
captionStyle: captionStyle,
|
|
97
|
+
align: align,
|
|
98
|
+
truncate: captionPosition === 'over'
|
|
99
|
+
}), actions && /*#__PURE__*/jsx("div", {
|
|
100
|
+
className: `${CLASSNAME}__actions`,
|
|
101
|
+
children: actions
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
103
104
|
});
|
|
104
105
|
ImageBlock.displayName = COMPONENT_NAME;
|
|
105
106
|
ImageBlock.className = CLASSNAME;
|
|
106
107
|
ImageBlock.defaultProps = DEFAULT_PROPS;
|
|
107
108
|
|
|
108
109
|
export { ImageBlock, ImageBlockCaptionPosition };
|
|
109
|
-
//# sourceMappingURL=image-block-
|
|
110
|
+
//# sourceMappingURL=image-block-7938422d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-block-
|
|
1
|
+
{"version":3,"file":"image-block-7938422d.js","sources":["../../../src/components/image-block/ImageBlock.tsx"],"sourcesContent":["import { ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Alignment, HorizontalAlignment, Size, Theme, Thumbnail } from '@lumx/react';\n\nimport { GenericProps, HasTheme, ValueOf } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { ThumbnailProps } from '../thumbnail/Thumbnail';\nimport { ImageCaption, ImageCaptionMetadata } from './ImageCaption';\n\n/**\n * Image block variants.\n */\nexport const ImageBlockCaptionPosition = {\n below: 'below',\n over: 'over',\n} as const;\nexport type ImageBlockCaptionPosition = ValueOf<typeof ImageBlockCaptionPosition>;\n\n/**\n * Image block sizes.\n */\nexport type ImageBlockSize = Extract<Size, 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ImageBlockProps extends GenericProps, HasTheme, ImageCaptionMetadata {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Alignment. */\n align?: HorizontalAlignment;\n /** Image alternative text. */\n alt: string;\n /** Caption position. */\n captionPosition?: ImageBlockCaptionPosition;\n /** Whether the image has to fill its container height or not. */\n fillHeight?: boolean;\n /** Image URL. */\n image: string;\n /** Size variant. */\n size?: ImageBlockSize;\n /** Props to pass to the thumbnail (minus those already set by the ImageBlock props). */\n thumbnailProps?: Omit<ThumbnailProps, 'image' | 'size' | 'theme' | 'align' | 'fillHeight'>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ImageBlock';\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<ImageBlockProps> = {\n captionPosition: ImageBlockCaptionPosition.below,\n align: Alignment.left,\n};\n\n/**\n * ImageBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ImageBlock = forwardRef<ImageBlockProps, HTMLDivElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const {\n actions,\n align = DEFAULT_PROPS.align,\n alt,\n captionPosition = DEFAULT_PROPS.captionPosition,\n captionStyle,\n className,\n description,\n descriptionProps,\n fillHeight,\n image,\n size,\n tags,\n theme = defaultTheme,\n thumbnailProps,\n title,\n titleProps,\n ...forwardedProps\n } = props;\n return (\n <figure\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n captionPosition,\n align,\n size,\n theme,\n }),\n fillHeight && `${CLASSNAME}--fill-height`,\n )}\n >\n <Thumbnail\n {...thumbnailProps}\n className={classNames(`${CLASSNAME}__image`, thumbnailProps?.className)}\n fillHeight={fillHeight}\n align={align}\n image={image}\n size={size}\n theme={theme}\n alt={(alt || title) as string}\n />\n <ImageCaption\n as=\"figcaption\"\n baseClassName={CLASSNAME}\n theme={theme}\n title={title}\n titleProps={titleProps}\n description={description}\n descriptionProps={descriptionProps}\n tags={tags}\n captionStyle={captionStyle}\n align={align}\n truncate={captionPosition === 'over'}\n />\n {actions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n </figure>\n );\n});\nImageBlock.displayName = COMPONENT_NAME;\nImageBlock.className = CLASSNAME;\nImageBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["ImageBlockCaptionPosition","below","over","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","captionPosition","align","Alignment","left","ImageBlock","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","actions","alt","captionStyle","className","description","descriptionProps","fillHeight","image","size","tags","theme","thumbnailProps","title","titleProps","forwardedProps","_jsxs","classNames","handleBasicClasses","prefix","children","_jsx","Thumbnail","ImageCaption","as","baseClassName","truncate","displayName","defaultProps"],"mappings":";;;;;;;;AAiBO,MAAMA,yBAAyB,GAAG;AACrCC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,IAAI,EAAE,MAAA;AACV,EAAU;;AAGV;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,YAAY,CAAA;;AAEnC;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAuC,GAAG;EAC5CC,eAAe,EAAEP,yBAAyB,CAACC,KAAK;EAChDO,KAAK,EAAEC,SAAS,CAACC,IAAAA;AACrB,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,UAAU,GAAGC,UAAU,CAAkC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAClF,MAAMC,YAAY,GAAGC,QAAQ,EAAE,IAAIC,KAAK,CAACC,KAAK,CAAA;EAC9C,MAAM;IACFC,OAAO;IACPX,KAAK,GAAGF,aAAa,CAACE,KAAK;IAC3BY,GAAG;IACHb,eAAe,GAAGD,aAAa,CAACC,eAAe;IAC/Cc,YAAY;IACZC,SAAS;IACTC,WAAW;IACXC,gBAAgB;IAChBC,UAAU;IACVC,KAAK;IACLC,IAAI;IACJC,IAAI;AACJC,IAAAA,KAAK,GAAGd,YAAY;IACpBe,cAAc;IACdC,KAAK;IACLC,UAAU;IACV,GAAGC,cAAAA;AACP,GAAC,GAAGpB,KAAK,CAAA;AACT,EAAA,oBACI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