@lumx/react 2.2.20 → 2.2.22

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.
Files changed (108) hide show
  1. package/esm/_internal/AutocompleteMultiple.js.map +1 -1
  2. package/esm/_internal/Avatar2.js.map +1 -1
  3. package/esm/_internal/ButtonRoot.js.map +1 -1
  4. package/esm/_internal/Checkbox2.js.map +1 -1
  5. package/esm/_internal/Chip2.js.map +1 -1
  6. package/esm/_internal/ClickAwayProvider.js +45 -26
  7. package/esm/_internal/ClickAwayProvider.js.map +1 -1
  8. package/esm/_internal/CommentBlock.js.map +1 -1
  9. package/esm/_internal/Dialog2.js +6 -3
  10. package/esm/_internal/Dialog2.js.map +1 -1
  11. package/esm/_internal/Divider2.js.map +1 -1
  12. package/esm/_internal/DragHandle.js.map +1 -1
  13. package/esm/_internal/Dropdown2.js.map +1 -1
  14. package/esm/_internal/ExpansionPanel.js.map +1 -1
  15. package/esm/_internal/Flag2.js.map +1 -1
  16. package/esm/_internal/GenericBlock.js +70 -15
  17. package/esm/_internal/GenericBlock.js.map +1 -1
  18. package/esm/_internal/Icon2.js.map +1 -1
  19. package/esm/_internal/ImageBlock.js.map +1 -1
  20. package/esm/_internal/InputHelper.js.map +1 -1
  21. package/esm/_internal/InputLabel.js.map +1 -1
  22. package/esm/_internal/Lightbox2.js +1 -1
  23. package/esm/_internal/Lightbox2.js.map +1 -1
  24. package/esm/_internal/LinkPreview.js.map +1 -1
  25. package/esm/_internal/Mosaic2.js.map +1 -1
  26. package/esm/_internal/Notification2.js.map +1 -1
  27. package/esm/_internal/Popover2.js +1 -1
  28. package/esm/_internal/Popover2.js.map +1 -1
  29. package/esm/_internal/PostBlock.js.map +1 -1
  30. package/esm/_internal/Progress2.js.map +1 -1
  31. package/esm/_internal/RadioGroup.js.map +1 -1
  32. package/esm/_internal/SelectMultiple.js.map +1 -1
  33. package/esm/_internal/SideNavigationItem.js.map +1 -1
  34. package/esm/_internal/SkeletonTypography.js.map +1 -1
  35. package/esm/_internal/Slider2.js.map +1 -1
  36. package/esm/_internal/Slides.js.map +1 -1
  37. package/esm/_internal/Switch2.js.map +1 -1
  38. package/esm/_internal/TabPanel.js.map +1 -1
  39. package/esm/_internal/TableRow.js.map +1 -1
  40. package/esm/_internal/TextField.js.map +1 -1
  41. package/esm/_internal/Thumbnail2.js.map +1 -1
  42. package/esm/_internal/Uploader2.js.map +1 -1
  43. package/esm/_internal/UserBlock.js.map +1 -1
  44. package/esm/_internal/_rollupPluginBabelHelpers.js +5 -1
  45. package/esm/_internal/_rollupPluginBabelHelpers.js.map +1 -1
  46. package/esm/_internal/generic-block.js +8 -0
  47. package/esm/_internal/generic-block.js.map +1 -1
  48. package/esm/_internal/type.js +11 -1
  49. package/esm/_internal/type.js.map +1 -1
  50. package/package.json +5 -5
  51. package/src/components/autocomplete/Autocomplete.tsx +6 -8
  52. package/src/components/avatar/Avatar.tsx +2 -4
  53. package/src/components/button/Button.test.tsx +1 -1
  54. package/src/components/button/ButtonRoot.tsx +3 -4
  55. package/src/components/button/IconButton.test.tsx +1 -1
  56. package/src/components/checkbox/Checkbox.tsx +2 -4
  57. package/src/components/chip/Chip.tsx +2 -4
  58. package/src/components/comment-block/CommentBlock.tsx +2 -4
  59. package/src/components/dialog/Dialog.stories.tsx +7 -3
  60. package/src/components/dialog/Dialog.tsx +11 -4
  61. package/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +7 -0
  62. package/src/components/divider/Divider.tsx +2 -5
  63. package/src/components/drag-handle/DragHandle.tsx +2 -5
  64. package/src/components/dropdown/Dropdown.tsx +4 -3
  65. package/src/components/expansion-panel/ExpansionPanel.tsx +2 -3
  66. package/src/components/flag/Flag.tsx +2 -4
  67. package/src/components/generic-block/GenericBlock.stories.tsx +65 -124
  68. package/src/components/generic-block/GenericBlock.test.tsx +111 -4
  69. package/src/components/generic-block/GenericBlock.tsx +107 -18
  70. package/src/components/icon/Icon.tsx +2 -4
  71. package/src/components/image-block/ImageBlock.tsx +2 -4
  72. package/src/components/input-helper/InputHelper.tsx +2 -4
  73. package/src/components/input-label/InputLabel.tsx +2 -4
  74. package/src/components/lightbox/Lightbox.tsx +4 -6
  75. package/src/components/lightbox/__snapshots__/Lightbox.test.tsx.snap +1 -1
  76. package/src/components/link-preview/LinkPreview.tsx +2 -4
  77. package/src/components/mosaic/Mosaic.tsx +2 -4
  78. package/src/components/notification/Notification.tsx +2 -4
  79. package/src/components/popover/Popover.tsx +1 -1
  80. package/src/components/popover/__snapshots__/Popover.test.tsx.snap +10 -10
  81. package/src/components/post-block/PostBlock.tsx +2 -4
  82. package/src/components/progress/Progress.tsx +2 -4
  83. package/src/components/radio-button/RadioButton.tsx +2 -4
  84. package/src/components/select/constants.ts +2 -5
  85. package/src/components/side-navigation/SideNavigation.tsx +2 -4
  86. package/src/components/skeleton/SkeletonCircle.tsx +2 -4
  87. package/src/components/skeleton/SkeletonRectangle.tsx +2 -4
  88. package/src/components/skeleton/SkeletonTypography.tsx +2 -4
  89. package/src/components/slider/Slider.tsx +2 -4
  90. package/src/components/slideshow/Slides.tsx +2 -7
  91. package/src/components/slideshow/SlideshowControls.tsx +2 -4
  92. package/src/components/switch/Switch.tsx +2 -4
  93. package/src/components/table/Table.tsx +2 -4
  94. package/src/components/tabs/TabList.tsx +2 -4
  95. package/src/components/text-field/TextField.tsx +6 -8
  96. package/src/components/thumbnail/Thumbnail.tsx +3 -5
  97. package/src/components/uploader/Uploader.tsx +2 -4
  98. package/src/components/user-block/UserBlock.tsx +2 -4
  99. package/src/hooks/useClickAway.tsx +5 -5
  100. package/src/testing/utils/commonTestsSuite.ts +2 -2
  101. package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +58 -0
  102. package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +51 -19
  103. package/src/utils/focus/getFirstAndLastFocusable.test.ts +6 -0
  104. package/src/utils/focus/getFirstAndLastFocusable.ts +2 -2
  105. package/src/utils/type.ts +19 -2
  106. package/types.d.ts +112 -139
  107. package/src/components/generic-block/__snapshots__/GenericBlock.test.tsx.snap +0 -92
  108. package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.tsx +0 -75
@@ -1 +1 @@
1
- {"version":3,"file":"ImageBlock.js","sources":["../../../src/components/image-block/ImageBlock.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport isObject from 'lodash/isObject';\n\nimport { Alignment, HorizontalAlignment, Size, Theme, Thumbnail } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, ValueOf } from '@lumx/react/utils';\nimport { ThumbnailProps } from '../thumbnail/Thumbnail';\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 {\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 /** Caption custom CSS style. */\n captionStyle?: CSSProperties;\n /** Image description. Can be either a string, or sanitized html. */\n description?: string | { __html: string };\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 /** Tag content. */\n tags?: ReactNode;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\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 /** Image title to display in the caption. */\n title?: string;\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 theme: Theme.light,\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: Comp<ImageBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actions,\n align,\n alt,\n captionPosition,\n captionStyle,\n className,\n description,\n fillHeight,\n image,\n size,\n tags,\n theme,\n thumbnailProps,\n title,\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 {(title || description || tags) && (\n <figcaption className={`${CLASSNAME}__wrapper`} style={captionStyle}>\n {(title || description) && (\n <div className={`${CLASSNAME}__caption`}>\n {title && <span className={`${CLASSNAME}__title`}>{title}</span>}\n {/* Add an `&nbsp;` when there is description and title. */}\n {title && description && '\\u00A0'}\n {isObject(description) && description.__html ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={description} className={`${CLASSNAME}__description`} />\n ) : (\n <span className={`${CLASSNAME}__description`}>{description}</span>\n )}\n </div>\n )}\n {tags && <div className={`${CLASSNAME}__tags`}>{tags}</div>}\n </figcaption>\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","theme","Theme","light","align","Alignment","left","ImageBlock","forwardRef","props","ref","actions","alt","captionStyle","className","description","fillHeight","image","size","tags","thumbnailProps","title","forwardedProps","classNames","handleBasicClasses","prefix","isObject","__html","displayName","defaultProps"],"mappings":";;;;;;;AAWA;;;IAGaA,yBAAyB,GAAG;AACrCC,EAAAA,KAAK,EAAE,OAD8B;AAErCC,EAAAA,IAAI,EAAE;AAF+B;;AA2CzC;;;AAGA,IAAMC,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAuC,GAAG;AAC5CC,EAAAA,eAAe,EAAEP,yBAAyB,CAACC,KADC;AAE5CO,EAAAA,KAAK,EAAEC,KAAK,CAACC,KAF+B;AAG5CC,EAAAA,KAAK,EAAEC,SAAS,CAACC;AAH2B,CAAhD;AAMA;;;;;;;;IAOaC,UAAiD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAEpFC,OAFoF,GAiBpFF,KAjBoF,CAEpFE,OAFoF;AAAA,MAGpFP,KAHoF,GAiBpFK,KAjBoF,CAGpFL,KAHoF;AAAA,MAIpFQ,GAJoF,GAiBpFH,KAjBoF,CAIpFG,GAJoF;AAAA,MAKpFZ,eALoF,GAiBpFS,KAjBoF,CAKpFT,eALoF;AAAA,MAMpFa,YANoF,GAiBpFJ,KAjBoF,CAMpFI,YANoF;AAAA,MAOpFC,SAPoF,GAiBpFL,KAjBoF,CAOpFK,SAPoF;AAAA,MAQpFC,WARoF,GAiBpFN,KAjBoF,CAQpFM,WARoF;AAAA,MASpFC,UAToF,GAiBpFP,KAjBoF,CASpFO,UAToF;AAAA,MAUpFC,KAVoF,GAiBpFR,KAjBoF,CAUpFQ,KAVoF;AAAA,MAWpFC,IAXoF,GAiBpFT,KAjBoF,CAWpFS,IAXoF;AAAA,MAYpF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KA,KAAK,IAAIN,WAAT,IAAwB,MAH7B,EAIKW,QAAQ,CAACX,WAAD,CAAR,IAAyBA,WAAW,CAACY,MAArC;AAEG;AAAM,IAAA,uBAAuB,EAAEZ,WAA/B;AAA4C,IAAA,SAAS,YAAKlB,SAAL;AAArD,IAFH,GAIG;AAAM,IAAA,SAAS,YAAKA,SAAL;AAAf,KAA+CkB,WAA/C,CARR,CAFR,EAcKI,IAAI,IAAI;AAAK,IAAA,SAAS,YAAKtB,SAAL;AAAd,KAAuCsB,IAAvC,CAdb,CA1BR,EA2CKR,OAAO,IAAI;AAAK,IAAA,SAAS,YAAKd,SAAL;AAAd,KAA0Cc,OAA1C,CA3ChB,CADJ;AA+CH,CAjE0E;AAkE3EJ,UAAU,CAACqB,WAAX,GAAyBhC,cAAzB;AACAW,UAAU,CAACO,SAAX,GAAuBjB,SAAvB;AACAU,UAAU,CAACsB,YAAX,GAA0B9B,aAA1B;;;;"}
1
+ {"version":3,"file":"ImageBlock.js","sources":["../../../src/components/image-block/ImageBlock.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport isObject from 'lodash/isObject';\n\nimport { Alignment, HorizontalAlignment, Size, Theme, Thumbnail } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme, ValueOf } from '@lumx/react/utils';\nimport { ThumbnailProps } from '../thumbnail/Thumbnail';\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 {\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 /** Caption custom CSS style. */\n captionStyle?: CSSProperties;\n /** Image description. Can be either a string, or sanitized html. */\n description?: string | { __html: string };\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 /** Tag content. */\n tags?: ReactNode;\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 /** Image title to display in the caption. */\n title?: string;\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 theme: Theme.light,\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: Comp<ImageBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actions,\n align,\n alt,\n captionPosition,\n captionStyle,\n className,\n description,\n fillHeight,\n image,\n size,\n tags,\n theme,\n thumbnailProps,\n title,\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 {(title || description || tags) && (\n <figcaption className={`${CLASSNAME}__wrapper`} style={captionStyle}>\n {(title || description) && (\n <div className={`${CLASSNAME}__caption`}>\n {title && <span className={`${CLASSNAME}__title`}>{title}</span>}\n {/* Add an `&nbsp;` when there is description and title. */}\n {title && description && '\\u00A0'}\n {isObject(description) && description.__html ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={description} className={`${CLASSNAME}__description`} />\n ) : (\n <span className={`${CLASSNAME}__description`}>{description}</span>\n )}\n </div>\n )}\n {tags && <div className={`${CLASSNAME}__tags`}>{tags}</div>}\n </figcaption>\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","theme","Theme","light","align","Alignment","left","ImageBlock","forwardRef","props","ref","actions","alt","captionStyle","className","description","fillHeight","image","size","tags","thumbnailProps","title","forwardedProps","classNames","handleBasicClasses","prefix","isObject","__html","displayName","defaultProps"],"mappings":";;;;;;;AAWA;;;IAGaA,yBAAyB,GAAG;AACrCC,EAAAA,KAAK,EAAE,OAD8B;AAErCC,EAAAA,IAAI,EAAE;AAF+B;;AAyCzC;;;AAGA,IAAMC,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAuC,GAAG;AAC5CC,EAAAA,eAAe,EAAEP,yBAAyB,CAACC,KADC;AAE5CO,EAAAA,KAAK,EAAEC,KAAK,CAACC,KAF+B;AAG5CC,EAAAA,KAAK,EAAEC,SAAS,CAACC;AAH2B,CAAhD;AAMA;;;;;;;;IAOaC,UAAiD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAEpFC,OAFoF,GAiBpFF,KAjBoF,CAEpFE,OAFoF;AAAA,MAGpFP,KAHoF,GAiBpFK,KAjBoF,CAGpFL,KAHoF;AAAA,MAIp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,KAJX;AAKI,IAAA,KAAK,EAAEa,KALX;AAMI,IAAA,IAAI,EAAEC,IANV;AAOI,IAAA,KAAK,EAAEjB,KAPX;AAQI,IAAA,GAAG,EAAGW,GAAG,IAAIS;AARjB,KAfJ,EAyBK,CAACA,KAAK,IAAIN,WAAT,IAAwBI,IAAzB,KACG;AAAY,IAAA,SAAS,YAAKtB,SAAL,cAArB;AAAgD,IAAA,KAAK,EAAEgB;AAAvD,KACK,CAACQ,KAAK,IAAIN,WAAV,KACG;AAAK,IAAA,SAAS,YAAKlB,SAAL;AAAd,KACKwB,KAAK,IAAI;AAAM,IAAA,SAAS,YAAKxB,SAAL;AAAf,KAAyCwB,KAAzC,CADd,EAGKA,KAAK,IAAIN,WAAT,IAAwB,MAH7B,EAIKW,QAAQ,CAACX,WAAD,CAAR,IAAyBA,WAAW,CAACY,MAArC;AAEG;AAAM,IAAA,uBAAuB,EAAEZ,WAA/B;AAA4C,IAAA,SAAS,YAAKlB,SAAL;AAArD,IAFH,GAIG;AAAM,IAAA,SAAS,YAAKA,SAAL;AAAf,KAA+CkB,WAA/C,CARR,CAFR,EAcKI,IAAI,IAAI;AAAK,IAAA,SAAS,YAAKtB,SAAL;AAAd,KAAuCsB,IAAvC,CAdb,CA1BR,EA2CKR,OAAO,IAAI;AAAK,IAAA,SAAS,YAAKd,SAAL;AAAd,KAA0Cc,OAA1C,CA3ChB,CADJ;AA+CH,CAjE0E;AAkE3EJ,UAAU,CAACqB,WAAX,GAAyBhC,cAAzB;AACAW,UAAU,CAACO,SAAX,GAAuBjB,SAAvB;AACAU,UAAU,CAACsB,YAAX,GAA0B9B,aAA1B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InputHelper.js","sources":["../../../src/components/input-helper/constants.ts","../../../src/components/input-helper/InputHelper.tsx"],"sourcesContent":["export const INPUT_HELPER_CONFIGURATION: Record<string, { color: string }> = {\n error: {\n color: 'red',\n },\n success: {\n color: 'green',\n },\n warning: {\n color: 'yellow',\n },\n};\n","import { Kind, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\nimport { INPUT_HELPER_CONFIGURATION } from './constants';\n\n/**\n * Defines the props of the component.\n */\nexport interface InputHelperProps extends GenericProps {\n /** Helper content. */\n children: string | ReactNode;\n /** Helper variant. */\n kind?: Kind;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'InputHelper';\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<InputHelperProps> = {\n kind: Kind.info,\n theme: Theme.light,\n};\n\n/**\n * InputHelper component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const InputHelper: Comp<InputHelperProps, HTMLSpanElement> = forwardRef((props, ref) => {\n const { children, className, kind, theme, ...forwardedProps } = props;\n const { color } = INPUT_HELPER_CONFIGURATION[kind as any] || {};\n\n return (\n <span\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color, theme }))}\n >\n {children}\n </span>\n );\n});\n\nInputHelper.displayName = COMPONENT_NAME;\nInputHelper.className = CLASSNAME;\nInputHelper.defaultProps = DEFAULT_PROPS;\n"],"names":["INPUT_HELPER_CONFIGURATION","error","color","success","warning","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","kind","Kind","info","theme","Theme","light","InputHelper","forwardRef","props","ref","children","className","forwardedProps","classNames","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;AAAO,IAAMA,0BAA6D,GAAG;AACzEC,EAAAA,KAAK,EAAE;AACHC,IAAAA,KAAK,EAAE;AADJ,GADkE;AAIzEC,EAAAA,OAAO,EAAE;AACLD,IAAAA,KAAK,EAAE;AADF,GAJgE;AAOzEE,EAAAA,OAAO,EAAE;AACLF,IAAAA,KAAK,EAAE;AADF;AAPgE,CAAtE;;ACOP;;;;AAYA;;;AAGA,IAAMG,cAAc,GAAG,aAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAwC,GAAG;AAC7CC,EAAAA,IAAI,EAAEC,IAAI,CAACC,IADkC;AAE7CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAFgC,CAAjD;AAKA;;;;;;;;IAOaC,WAAoD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MACnFC,QADmF,GAC3BF,KAD2B,CACnFE,QADmF;AAAA,MACzEC,SADyE,GAC3BH,KAD2B,CACzEG,SADyE;AAAA,MAC9DX,IAD8D,GAC3BQ,KAD2B,CAC9DR,IAD8D;AAAA,MACxDG,KADwD,GAC3BK,KAD2B,CACxDL,KADwD;AAAA,MAC9CS,cAD8C,4BAC3BJ,KAD2B;;AAAA,aAEzEjB,0BAA0B,CAACS,IAAD,CAA1B,IAA2C,EAF8B;AAAA,MAEnFP,KAFmF,QAEnFA,KAFmF;;AAI3F,SACI;AACI,IAAA,GAAG,EAAEgB;AADT,KAEQG,cAFR;AAGI,IAAA,SAAS,EAAEC,UAAU,CAACF,SAAD,EAAYG,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAElB,SAAV;AAAqBJ,MAAAA,KAAK,EAALA,KAArB;AAA4BU,MAAAA,KAAK,EAALA;AAA5B,KAAD,CAA9B;AAHzB,MAKKO,QALL,CADJ;AASH,CAb6E;AAe9EJ,WAAW,CAACU,WAAZ,GAA0BpB,cAA1B;AACAU,WAAW,CAACK,SAAZ,GAAwBd,SAAxB;AACAS,WAAW,CAACW,YAAZ,GAA2BlB,aAA3B;;;;"}
1
+ {"version":3,"file":"InputHelper.js","sources":["../../../src/components/input-helper/constants.ts","../../../src/components/input-helper/InputHelper.tsx"],"sourcesContent":["export const INPUT_HELPER_CONFIGURATION: Record<string, { color: string }> = {\n error: {\n color: 'red',\n },\n success: {\n color: 'green',\n },\n warning: {\n color: 'yellow',\n },\n};\n","import { Kind, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\nimport { INPUT_HELPER_CONFIGURATION } from './constants';\n\n/**\n * Defines the props of the component.\n */\nexport interface InputHelperProps extends GenericProps, HasTheme {\n /** Helper content. */\n children: string | ReactNode;\n /** Helper variant. */\n kind?: Kind;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'InputHelper';\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<InputHelperProps> = {\n kind: Kind.info,\n theme: Theme.light,\n};\n\n/**\n * InputHelper component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const InputHelper: Comp<InputHelperProps, HTMLSpanElement> = forwardRef((props, ref) => {\n const { children, className, kind, theme, ...forwardedProps } = props;\n const { color } = INPUT_HELPER_CONFIGURATION[kind as any] || {};\n\n return (\n <span\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color, theme }))}\n >\n {children}\n </span>\n );\n});\n\nInputHelper.displayName = COMPONENT_NAME;\nInputHelper.className = CLASSNAME;\nInputHelper.defaultProps = DEFAULT_PROPS;\n"],"names":["INPUT_HELPER_CONFIGURATION","error","color","success","warning","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","kind","Kind","info","theme","Theme","light","InputHelper","forwardRef","props","ref","children","className","forwardedProps","classNames","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;AAAO,IAAMA,0BAA6D,GAAG;AACzEC,EAAAA,KAAK,EAAE;AACHC,IAAAA,KA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;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InputLabel.js","sources":["../../../src/components/input-label/InputLabel.tsx"],"sourcesContent":["import { Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface InputLabelProps extends GenericProps {\n /** Label content. */\n children: string | ReactNode;\n /** Native htmlFor property. */\n htmlFor: string;\n /** Whether the component is required or not. */\n isRequired?: boolean;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'InputLabel';\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<InputLabelProps> = {\n theme: Theme.light,\n};\n\n/**\n * InputLabel component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const InputLabel: Comp<InputLabelProps, HTMLLabelElement> = forwardRef((props, ref) => {\n const { children, className, htmlFor, isRequired, theme, ...forwardedProps } = props;\n\n return (\n <label\n ref={ref}\n {...forwardedProps}\n htmlFor={htmlFor}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, isRequired, theme }))}\n >\n {children}\n </label>\n );\n});\nInputLabel.displayName = COMPONENT_NAME;\nInputLabel.className = CLASSNAME;\nInputLabel.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","InputLabel","forwardRef","props","ref","children","className","htmlFor","isRequired","forwardedProps","classNames","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;AAKA;;;;AAcA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAuC,GAAG;AAC5CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD+B,CAAhD;AAIA;;;;;;;;IAOaC,UAAmD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAClFC,QADkF,GACXF,KADW,CAClFE,QADkF;AAAA,MACxEC,SADwE,GACXH,KADW,CACxEG,SADwE;AAAA,MAC7DC,OAD6D,GACXJ,KADW,CAC7DI,OAD6D;AAAA,MACpDC,UADoD,GACXL,KADW,CACpDK,UADoD;AAAA,MACxCV,KADwC,GACXK,KADW,CACxCL,KADwC;AAAA,MAC9BW,cAD8B,4BACXN,KADW;;AAG1F,SACI;AACI,IAAA,GAAG,EAAEC;AADT,KAEQK,cAFR;AAGI,IAAA,OAAO,EAAEF,OAHb;AAII,IAAA,SAAS,EAAEG,UAAU,CAACJ,SAAD,EAAYK,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEjB,SAAV;AAAqBa,MAAAA,UAAU,EAAVA,UAArB;AAAiCV,MAAAA,KAAK,EAALA;AAAjC,KAAD,CAA9B;AAJzB,MAMKO,QANL,CADJ;AAUH,CAb4E;AAc7EJ,UAAU,CAACY,WAAX,GAAyBnB,cAAzB;AACAO,UAAU,CAACK,SAAX,GAAuBX,SAAvB;AACAM,UAAU,CAACa,YAAX,GAA0BjB,aAA1B;;;;"}
1
+ {"version":3,"file":"InputLabel.js","sources":["../../../src/components/input-label/InputLabel.tsx"],"sourcesContent":["import { Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface InputLabelProps extends GenericProps, HasTheme {\n /** Label content. */\n children: string | ReactNode;\n /** Native htmlFor property. */\n htmlFor: string;\n /** Whether the component is required or not. */\n isRequired?: boolean;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'InputLabel';\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<InputLabelProps> = {\n theme: Theme.light,\n};\n\n/**\n * InputLabel component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const InputLabel: Comp<InputLabelProps, HTMLLabelElement> = forwardRef((props, ref) => {\n const { children, className, htmlFor, isRequired, theme, ...forwardedProps } = props;\n\n return (\n <label\n ref={ref}\n {...forwardedProps}\n htmlFor={htmlFor}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, isRequired, theme }))}\n >\n {children}\n </label>\n );\n});\nInputLabel.displayName = COMPONENT_NAME;\nInputLabel.className = CLASSNAME;\nInputLabel.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","InputLabel","forwardRef","props","ref","children","className","htmlFor","isRequired","forwardedProps","classNames","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;AAKA;;;;AAYA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAuC,GAAG;AAC5CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD+B,CAAhD;AAIA;;;;;;;;IAOaC,UAAmD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAClFC,QADkF,GACXF,KADW,CAClFE,QADkF;AAAA,MACxEC,SADwE,GACXH,KADW,CACxEG,SADwE;AAAA,MAC7DC,OAD6D,GACXJ,KADW,CAC7DI,OAD6D;AAAA,MACpDC,UADoD,GACXL,KADW,CACpDK,UADoD;AAAA,MACxCV,KADwC,GACXK,KADW,CACxCL,KADwC;AAAA,MAC9BW,cAD8B,4BACXN,KADW;;AAG1F,SACI;AACI,IAAA,GAAG,EAAEC;AADT,KAEQK,cAFR;AAGI,IAAA,OAAO,EAAEF,OAHb;AAII,IAAA,SAAS,EAAEG,UAAU,CAACJ,SAAD,EAAYK,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEjB,SAAV;AAAqBa,MAAAA,UAAU,EAAVA,UAArB;AAAiCV,MAAAA,KAAK,EAALA;AAAjC,KAAD,CAA9B;AAJzB,MAMKO,QANL,CADJ;AAUH,CAb4E;AAc7EJ,UAAU,CAACY,WAAX,GAAyBnB,cAAzB;AACAO,UAAU,CAACK,SAAX,GAAuBX,SAAvB;AACAM,UAAU,CAACa,YAAX,GAA0BjB,aAA1B;;;;"}
@@ -109,7 +109,7 @@ var Lightbox = forwardRef(function (props, ref) {
109
109
  onClick: onClose
110
110
  })), React.createElement(ClickAwayProvider, {
111
111
  callback: !preventAutoClose && onClose,
112
- refs: clickAwayRefs
112
+ childrenRefs: clickAwayRefs
113
113
  }, React.createElement("div", {
114
114
  ref: childrenRef,
115
115
  className: "".concat(CLASSNAME, "__wrapper"),
@@ -1 +1 @@
1
- {"version":3,"file":"Lightbox2.js","sources":["../../../src/components/lightbox/Lightbox.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useRef, useEffect } from 'react';\n\nimport classNames from 'classnames';\nimport { createPortal } from 'react-dom';\n\nimport { mdiClose } from '@lumx/icons';\nimport { ColorPalette, Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';\nimport { DOCUMENT } from '@lumx/react/constants';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';\nimport { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';\nimport { useDisableBodyScroll } from '@lumx/react/hooks/useDisableBodyScroll';\nimport { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';\n\nconst LIGHTBOX_TRANSITION_DURATION = 400;\n\n/**\n * Defines the props of the component.\n */\nexport interface LightboxProps extends GenericProps {\n /** Props to pass to the close button (minus those already set by the Lightbox props). */\n closeButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Reference to the element that triggered modal opening to set focus on. */\n parentElement: RefObject<any>;\n /** Whether to keep the dialog open on clickaway or escape press. */\n preventAutoClose?: boolean;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Z-axis position. */\n zIndex?: number;\n /** On close callback. */\n onClose?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Lightbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Lightbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Lightbox: Comp<LightboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n ariaLabel,\n children,\n className,\n closeButtonProps,\n isOpen,\n onClose,\n parentElement,\n preventAutoClose,\n theme,\n zIndex,\n ...forwardedProps\n } = props;\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const childrenRef = useRef<any>(null);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useDisableBodyScroll(isOpen && wrapperRef.current);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isVisible = useDelayedVisibility(!!isOpen, LIGHTBOX_TRANSITION_DURATION);\n\n // Handle focus trap.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFocusTrap(isOpen && wrapperRef.current, childrenRef.current?.firstChild);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const previousOpen = useRef(isOpen);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (isOpen !== previousOpen.current) {\n previousOpen.current = isOpen;\n\n // Focus the parent element on close.\n if (!isOpen && parentElement && parentElement.current) {\n parentElement.current.focus();\n }\n }\n }, [isOpen, parentElement]);\n\n // Close lightbox on escape key pressed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useCallbackOnEscape(onClose);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const clickAwayRefs = useRef([wrapperRef]);\n\n if (!isOpen && !isVisible) return null;\n\n return createPortal(\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */\n <div\n ref={mergeRefs(ref, wrapperRef)}\n {...forwardedProps}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n isHidden: !isOpen,\n isShown: isOpen || isVisible,\n theme,\n }),\n )}\n style={{ zIndex }}\n >\n {closeButtonProps && (\n <IconButton\n {...closeButtonProps}\n className={`${CLASSNAME}__close`}\n color={ColorPalette.light}\n emphasis={Emphasis.low}\n icon={mdiClose}\n theme={theme}\n type=\"button\"\n onClick={onClose}\n />\n )}\n <ClickAwayProvider callback={!preventAutoClose && onClose} refs={clickAwayRefs}>\n <div ref={childrenRef} className={`${CLASSNAME}__wrapper`} role=\"presentation\">\n {children}\n </div>\n </ClickAwayProvider>\n </div>,\n document.body,\n );\n});\nLightbox.displayName = COMPONENT_NAME;\nLightbox.className = CLASSNAME;\n"],"names":["LIGHTBOX_TRANSITION_DURATION","COMPONENT_NAME","CLASSNAME","getRootClassName","Lightbox","forwardRef","props","ref","ariaLabel","children","className","closeButtonProps","isOpen","onClose","parentElement","preventAutoClose","theme","zIndex","forwardedProps","DOCUMENT","childrenRef","useRef","wrapperRef","useDisableBodyScroll","current","isVisible","useDelayedVisibility","useFocusTrap","firstChild","previousOpen","useEffect","focus","useCallbackOnEscape","clickAwayRefs","createPortal","mergeRefs","classNames","handleBasicClasses","prefix","isHidden","isShown","ColorPalette","light","Emphasis","low","mdiClose","document","body","displayName"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAMA,4BAA4B,GAAG,GAArC;AAEA;;;;AAqBA;;;AAGA,IAAMC,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;IAOaG,QAA6C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA;;AAAA,MAEhFC,SAFgF,GAahFF,KAbgF,CAEhFE,SAFgF;AAAA,MAGhFC,QAHgF,GAahFH,KAbgF,CAGhFG,QAHgF;AAAA,MAIhFC,SAJgF,GAahFJ,KAbgF,CAIhFI,SAJgF;AAAA,MAKhFC,gBALgF,GAahFL,KAbgF,CAKhFK,gBALgF;AAAA,MAMhFC,MANgF,GAahFN,KAbgF,CAMhFM,MANgF;AAAA,MAOhFC,OAPgF,GAahFP,KAbgF,CAOhFO,OAPgF;AAAA,MAQhFC,aARgF,GAahFR,KAbgF,CAQhFQ,aARgF;AAAA,MAShFC,gBATgF,GAahFT,KAbgF,CAShFS,gBATgF;AAAA,MAUhFC,KAVgF,GAahFV,KAbgF,CAUhFU,KAVgF;AAAA,MAWhFC,MAXgF,GAahFX,KAbgF,CAWhFW,MAXgF;AAAA,MAY7EC,cAZ6E,4BAahFZ,KAbgF;;AAcpF,MAAI,CAACa,QAAL,EAAe;AACX;AACA,WAAO,IAAP;AACH,GAjBmF;;;AAoBpF,MAAMC,WAAW,GAAGC,MAAM,CAAM,IAAN,CAA1B,CApBoF;;AAsBpF,MAAMC,UAAU,GAAGD,MAAM,CAAiB,IAAjB,CAAzB,CAtBoF;;AAyBpFE,EAAAA,oBAAoB,CAACX,MAAM,IAAIU,UAAU,CAACE,OAAtB,CAApB,CAzBoF;;AA4BpF,MAAMC,SAAS,GAAGC,oBAAoB,CAAC,CAAC,CAACd,MAAH,EAA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,gBAAgB,IACb,oBAAC,UAAD,eACQA,gBADR;AAEI,IAAA,SAAS,YAAKT,SAAL,YAFb;AAGI,IAAA,KAAK,EAAEuC,YAAY,CAACC,KAHxB;AAII,IAAA,QAAQ,EAAEC,QAAQ,CAACC,GAJvB;AAKI,IAAA,IAAI,EAAEC,QALV;AAMI,IAAA,KAAK,EAAE7B,KANX;AAOI,IAAA,IAAI,EAAC,QAPT;AAQI,IAAA,OAAO,EAAEH;AARb,KAjBR,EA4BI,oBAAC,iBAAD;AAAmB,IAAA,QAAQ,EAAE,CAACE,gBAAD,IAAqBF,OAAlD;AAA2D,IAAA,IAAI,EAAEoB;AAAjE,KACI;AAAK,IAAA,GAAG,EAAEb,WAAV;AAAuB,IAAA,SAAS,YAAKlB,SAAL,cAAhC;AAA2D,IAAA,IAAI,EAAC;AAAhE,KACKO,QADL,CADJ,CA5BJ,CAFe,EAoCfqC,QAAQ,CAACC,IApCM,CAAnB;AAsCH,CAhGsE;AAiGvE3C,QAAQ,CAAC4C,WAAT,GAAuB/C,cAAvB;AACAG,QAAQ,CAACM,SAAT,GAAqBR,SAArB;;;;"}
1
+ {"version":3,"file":"Lightbox2.js","sources":["../../../src/components/lightbox/Lightbox.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useRef, useEffect } from 'react';\n\nimport classNames from 'classnames';\nimport { createPortal } from 'react-dom';\n\nimport { mdiClose } from '@lumx/icons';\nimport { ColorPalette, Emphasis, IconButton, IconButtonProps } from '@lumx/react';\nimport { DOCUMENT } from '@lumx/react/constants';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';\n\nimport { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';\nimport { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';\nimport { useDisableBodyScroll } from '@lumx/react/hooks/useDisableBodyScroll';\nimport { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';\n\nconst LIGHTBOX_TRANSITION_DURATION = 400;\n\n/**\n * Defines the props of the component.\n */\nexport interface LightboxProps extends GenericProps, HasTheme {\n /** Props to pass to the close button (minus those already set by the Lightbox props). */\n closeButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Reference to the element that triggered modal opening to set focus on. */\n parentElement: RefObject<any>;\n /** Whether to keep the dialog open on clickaway or escape press. */\n preventAutoClose?: boolean;\n /** Z-axis position. */\n zIndex?: number;\n /** On close callback. */\n onClose?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Lightbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Lightbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Lightbox: Comp<LightboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n ariaLabel,\n children,\n className,\n closeButtonProps,\n isOpen,\n onClose,\n parentElement,\n preventAutoClose,\n theme,\n zIndex,\n ...forwardedProps\n } = props;\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const childrenRef = useRef<any>(null);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useDisableBodyScroll(isOpen && wrapperRef.current);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isVisible = useDelayedVisibility(!!isOpen, LIGHTBOX_TRANSITION_DURATION);\n\n // Handle focus trap.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFocusTrap(isOpen && wrapperRef.current, childrenRef.current?.firstChild);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const previousOpen = useRef(isOpen);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (isOpen !== previousOpen.current) {\n previousOpen.current = isOpen;\n\n // Focus the parent element on close.\n if (!isOpen && parentElement && parentElement.current) {\n parentElement.current.focus();\n }\n }\n }, [isOpen, parentElement]);\n\n // Close lightbox on escape key pressed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useCallbackOnEscape(onClose);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const clickAwayRefs = useRef([wrapperRef]);\n\n if (!isOpen && !isVisible) return null;\n\n return createPortal(\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */\n <div\n ref={mergeRefs(ref, wrapperRef)}\n {...forwardedProps}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n isHidden: !isOpen,\n isShown: isOpen || isVisible,\n theme,\n }),\n )}\n style={{ zIndex }}\n >\n {closeButtonProps && (\n <IconButton\n {...closeButtonProps}\n className={`${CLASSNAME}__close`}\n color={ColorPalette.light}\n emphasis={Emphasis.low}\n icon={mdiClose}\n theme={theme}\n type=\"button\"\n onClick={onClose}\n />\n )}\n <ClickAwayProvider callback={!preventAutoClose && onClose} childrenRefs={clickAwayRefs}>\n <div ref={childrenRef} className={`${CLASSNAME}__wrapper`} role=\"presentation\">\n {children}\n </div>\n </ClickAwayProvider>\n </div>,\n document.body,\n );\n});\nLightbox.displayName = COMPONENT_NAME;\nLightbox.className = CLASSNAME;\n"],"names":["LIGHTBOX_TRANSITION_DURATION","COMPONENT_NAME","CLASSNAME","getRootClassName","Lightbox","forwardRef","props","ref","ariaLabel","children","className","closeButtonProps","isOpen","onClose","parentElement","preventAutoClose","theme","zIndex","forwardedProps","DOCUMENT","childrenRef","useRef","wrapperRef","useDisableBodyScroll","current","isVisible","useDelayedVisibility","useFocusTrap","firstChild","previousOpen","useEffect","focus","useCallbackOnEscape","clickAwayRefs","createPortal","mergeRefs","classNames","handleBasicClasses","prefix","isHidden","isShown","ColorPalette","light","Emphasis","low","mdiClose","document","body","displayName"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAMA,4BAA4B,GAAG,GAArC;AAEA;;;;AAmBA;;;AAGA,IAAMC,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;IAOaG,QAA6C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA;;AAAA,MAEhFC,SAFgF,GAahFF,KAbgF,CAEhFE,SAFgF;AAAA,MAGhFC,QAHgF,GAahFH,KAbgF,CAGhFG,QAHgF;AAAA,MAIhFC,SAJgF,GAahFJ,KAbgF,CAIhFI,SAJgF;AAAA,MAKhFC,gBALgF,GAahFL,KAbgF,CAKhFK,gBALgF;AAAA,MAMhFC,MANgF,GAahFN,KAbgF,CAMhFM,MANgF;AAAA,MAOhFC,OAPgF,GAahFP,KAbgF,CAOhFO,OAPgF;AAAA,MAQhFC,aARgF,GAahFR,KAbgF,CAQhFQ,aARgF;AAAA,MAShFC,gBATgF,GAahFT,KAbgF,CAShFS,gBATgF;AAAA,MAUhFC,KAVgF,GAahFV,KAbgF,CAUhFU,KAVgF;AAAA,MAWhFC,MAXgF,GAahFX,KAbgF,CAWhFW,MAXgF;AAAA,MAY7EC,cAZ6E,4BAahFZ,KAbgF;;AAcpF,MAAI,CAACa,QAAL,EAAe;AACX;AACA,WAAO,IAAP;AACH,GAjBmF;;;AAoBpF,MAAMC,WAAW,GAAGC,MAAM,CAAM,IAAN,CAA1B,CApBoF;;AAsBpF,MAAMC,UAAU,GAAGD,MAAM,CAAiB,IAAjB,CAAzB,CAtBoF;;AAyBpFE,EAAAA,oBAAoB,CAACX,MAAM,IAAIU,UAAU,CAACE,OAAtB,CAApB,CAzBoF;;AA4BpF,MAAMC,SAAS,GAAGC,oBAAoB,CAAC,CA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AAAF;AAdX,MAgBKN,gBAAgB,IACb,oBAAC,UAAD,eACQA,gBADR;AAEI,IAAA,SAAS,YAAKT,SAAL,YAFb;AAGI,IAAA,KAAK,EAAEuC,YAAY,CAACC,KAHxB;AAII,IAAA,QAAQ,EAAEC,QAAQ,CAACC,GAJvB;AAKI,IAAA,IAAI,EAAEC,QALV;AAMI,IAAA,KAAK,EAAE7B,KANX;AAOI,IAAA,IAAI,EAAC,QAPT;AAQI,IAAA,OAAO,EAAEH;AARb,KAjBR,EA4BI,oBAAC,iBAAD;AAAmB,IAAA,QAAQ,EAAE,CAACE,gBAAD,IAAqBF,OAAlD;AAA2D,IAAA,YAAY,EAAEoB;AAAzE,KACI;AAAK,IAAA,GAAG,EAAEb,WAAV;AAAuB,IAAA,SAAS,YAAKlB,SAAL,cAAhC;AAA2D,IAAA,IAAI,EAAC;AAAhE,KACKO,QADL,CADJ,CA5BJ,CAFe,EAoCfqC,QAAQ,CAACC,IApCM,CAAnB;AAsCH,CAhGsE;AAiGvE3C,QAAQ,CAAC4C,WAAT,GAAuB/C,cAAvB;AACAG,QAAQ,CAACM,SAAT,GAAqBR,SAArB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LinkPreview.js","sources":["../../../src/components/link-preview/LinkPreview.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AspectRatio,\n ColorPalette,\n ColorVariant,\n Link,\n LinkProps,\n Size,\n Theme,\n Thumbnail,\n ThumbnailProps,\n} from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HeadingElement } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface LinkPreviewProps extends GenericProps {\n /** Description. */\n description?: string;\n /** Link URL. */\n link: string;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Props to pass to the link (minus those already set by the LinkPreview props). */\n linkProps?: Omit<LinkProps, 'color' | 'colorVariant' | 'href' | 'target'>;\n /** Size variant. */\n size?: Extract<Size, 'regular' | 'big'>;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Thumbnail for the link preview. */\n thumbnailProps?: ThumbnailProps;\n /** Title. */\n title?: string;\n /** Customize the title heading tag. */\n titleHeading?: HeadingElement;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'LinkPreview';\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 = {\n size: Size.regular,\n theme: Theme.light,\n titleHeading: 'h2',\n} as const;\n\n/**\n * LinkPreview component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const LinkPreview: Comp<LinkPreviewProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n className,\n description,\n link,\n linkAs,\n linkProps,\n size,\n theme,\n thumbnailProps,\n title,\n titleHeading,\n ...forwardedProps\n } = props;\n // Use title heading as title wrapper (see DEFAULT_PROPS for the default value).\n const TitleHeading = titleHeading as HeadingElement;\n\n return (\n <article\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n size: size === Size.big && thumbnailProps ? Size.big : Size.regular,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__wrapper`}>\n {thumbnailProps && (\n <div className={`${CLASSNAME}__thumbnail`}>\n <Thumbnail\n {...thumbnailProps}\n linkAs={linkAs}\n linkProps={{\n ...linkProps,\n href: link,\n target: '_blank',\n // Avoid redundant links in focus order\n tabIndex: -1,\n }}\n aspectRatio={AspectRatio.free}\n fillHeight\n />\n </div>\n )}\n\n <div className={`${CLASSNAME}__container`}>\n {title && (\n <TitleHeading className={`${CLASSNAME}__title`}>\n <Link\n {...linkProps}\n linkAs={linkAs}\n target=\"_blank\"\n href={link}\n color={theme === Theme.light ? ColorPalette.dark : ColorPalette.light}\n colorVariant={ColorVariant.N}\n >\n {title}\n </Link>\n </TitleHeading>\n )}\n\n {description && <p className={`${CLASSNAME}__description`}>{description}</p>}\n\n <div className={`${CLASSNAME}__link`}>\n <Link\n {...linkProps}\n linkAs={linkAs}\n className={classNames(`${CLASSNAME}__link`, linkProps?.className)}\n target=\"_blank\"\n href={link}\n color={theme === Theme.light ? ColorPalette.primary : ColorPalette.light}\n colorVariant={ColorVariant.N}\n // Avoid redundant links in focus order\n tabIndex={title ? '-1' : undefined}\n >\n {link}\n </Link>\n </div>\n </div>\n </div>\n </article>\n );\n});\n\nLinkPreview.displayName = COMPONENT_NAME;\nLinkPreview.className = CLASSNAME;\nLinkPreview.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","regular","theme","Theme","light","titleHeading","LinkPreview","forwardRef","props","ref","className","description","link","linkAs","linkProps","thumbnailProps","title","forwardedProps","TitleHeading","classNames","handleBasicClasses","prefix","big","href","target","tabIndex","AspectRatio","free","ColorPalette","dark","ColorVariant","N","primary","undefined","displayName","defaultProps"],"mappings":";;;;;;;AAkBA;;;;AAwBA;;;AAGA,IAAMA,cAAc,GAAG,aAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAa,GAAG;AAClBC,EAAAA,IAAI,EAAEC,IAAI,CAACC,OADO;AAElBC,EAAAA,KAAK,EAAEC,KAAK,CAACC,KAFK;AAGlBC,EAAAA,YAAY,EAAE;AAHI,CAAtB;AAMA;;;;;;;;IAOaC,WAAmD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAEtFC,SAFsF,GAatFF,KAbsF,CAEtFE,SAFsF;AAAA,MAGtFC,WAHsF,GAatFH,KAbsF,CAGtFG,WAHsF;AAAA,MAItFC,IAJsF,GAatFJ,KAbsF,CAItFI,IAJsF;AAAA,MAKtFC,MALsF,GAatFL,KAbsF,CAKtFK,MALsF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AAD,eACQkB,SADR;AAEI,IAAA,MAAM,EAAED,MAFZ;AAGI,IAAA,MAAM,EAAC,QAHX;AAII,IAAA,IAAI,EAAED,IAJV;AAKI,IAAA,KAAK,EAAEV,KAAK,KAAKC,KAAK,CAACC,KAAhB,GAAwBwB,YAAY,CAACC,IAArC,GAA4CD,YAAY,CAACxB,KALpE;AAMI,IAAA,YAAY,EAAE0B,YAAY,CAACC;AAN/B,MAQKf,KARL,CADJ,CAFR,EAgBKL,WAAW,IAAI;AAAG,IAAA,SAAS,YAAKf,SAAL;AAAZ,KAA4Ce,WAA5C,CAhBpB,EAkBI;AAAK,IAAA,SAAS,YAAKf,SAAL;AAAd,KACI,oBAAC,IAAD,eACQkB,SADR;AAEI,IAAA,MAAM,EAAED,MAFZ;AAGI,IAAA,SAAS,EAAEM,UAAU,WAAIvB,SAAJ,aAAuBkB,SAAvB,aAAuBA,SAAvB,uBAAuBA,SAAS,CAAEJ,SAAlC,CAHzB;AAII,IAAA,MAAM,EAAC,QAJX;AAKI,IAAA,IAAI,EAAEE,IALV;AAMI,IAAA,KAAK,EAAEV,KAAK,KAAKC,KAAK,CAACC,KAAhB,GAAwBwB,YAAY,CAACI,OAArC,GAA+CJ,YAAY,CAACxB,KANvE;AAOI,IAAA,YAAY,EAAE0B,YAAY,CAACC,CAP/B;AAAA;AASI,IAAA,QAAQ,EAAEf,KAAK,GAAG,IAAH,GAAUiB;AAT7B,MAWKrB,IAXL,CADJ,CAlBJ,CAnBJ,CAZJ,CADJ;AAqEH,CAtF4E;AAwF7EN,WAAW,CAAC4B,WAAZ,GAA0BvC,cAA1B;AACAW,WAAW,CAACI,SAAZ,GAAwBd,SAAxB;AACAU,WAAW,CAAC6B,YAAZ,GAA2BrC,aAA3B;;;;"}
1
+ {"version":3,"file":"LinkPreview.js","sources":["../../../src/components/link-preview/LinkPreview.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AspectRatio,\n ColorPalette,\n ColorVariant,\n Link,\n LinkProps,\n Size,\n Theme,\n Thumbnail,\n ThumbnailProps,\n} from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HeadingElement, HasTheme } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface LinkPreviewProps extends GenericProps, HasTheme {\n /** Description. */\n description?: string;\n /** Link URL. */\n link: string;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Props to pass to the link (minus those already set by the LinkPreview props). */\n linkProps?: Omit<LinkProps, 'color' | 'colorVariant' | 'href' | 'target'>;\n /** Size variant. */\n size?: Extract<Size, 'regular' | 'big'>;\n /** Thumbnail for the link preview. */\n thumbnailProps?: ThumbnailProps;\n /** Title. */\n title?: string;\n /** Customize the title heading tag. */\n titleHeading?: HeadingElement;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'LinkPreview';\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 = {\n size: Size.regular,\n theme: Theme.light,\n titleHeading: 'h2',\n} as const;\n\n/**\n * LinkPreview component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const LinkPreview: Comp<LinkPreviewProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n className,\n description,\n link,\n linkAs,\n linkProps,\n size,\n theme,\n thumbnailProps,\n title,\n titleHeading,\n ...forwardedProps\n } = props;\n // Use title heading as title wrapper (see DEFAULT_PROPS for the default value).\n const TitleHeading = titleHeading as HeadingElement;\n\n return (\n <article\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n size: size === Size.big && thumbnailProps ? Size.big : Size.regular,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__wrapper`}>\n {thumbnailProps && (\n <div className={`${CLASSNAME}__thumbnail`}>\n <Thumbnail\n {...thumbnailProps}\n linkAs={linkAs}\n linkProps={{\n ...linkProps,\n href: link,\n target: '_blank',\n // Avoid redundant links in focus order\n tabIndex: -1,\n }}\n aspectRatio={AspectRatio.free}\n fillHeight\n />\n </div>\n )}\n\n <div className={`${CLASSNAME}__container`}>\n {title && (\n <TitleHeading className={`${CLASSNAME}__title`}>\n <Link\n {...linkProps}\n linkAs={linkAs}\n target=\"_blank\"\n href={link}\n color={theme === Theme.light ? ColorPalette.dark : ColorPalette.light}\n colorVariant={ColorVariant.N}\n >\n {title}\n </Link>\n </TitleHeading>\n )}\n\n {description && <p className={`${CLASSNAME}__description`}>{description}</p>}\n\n <div className={`${CLASSNAME}__link`}>\n <Link\n {...linkProps}\n linkAs={linkAs}\n className={classNames(`${CLASSNAME}__link`, linkProps?.className)}\n target=\"_blank\"\n href={link}\n color={theme === Theme.light ? ColorPalette.primary : ColorPalette.light}\n colorVariant={ColorVariant.N}\n // Avoid redundant links in focus order\n tabIndex={title ? '-1' : undefined}\n >\n {link}\n </Link>\n </div>\n </div>\n </div>\n </article>\n );\n});\n\nLinkPreview.displayName = COMPONENT_NAME;\nLinkPreview.className = CLASSNAME;\nLinkPreview.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","regular","theme","Theme","light","titleHeading","LinkPreview","forwardRef","props","ref","className","description","link","linkAs","linkProps","thumbnailProps","title","forwardedProps","TitleHeading","classNames","handleBasicClasses","prefix","big","href","target","tabIndex","AspectRatio","free","ColorPalette","dark","ColorVariant","N","primary","undefined","displayName","defaultProps"],"mappings":";;;;;;;AAkBA;;;;AAsBA;;;AAGA,IAAMA,cAAc,GAAG,aAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAa,GAAG;AAClBC,EAAAA,IAAI,EAAEC,IAAI,CAACC,OADO;AAElBC,EAAAA,KAAK,EAAEC,KAAK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,CADJ,CAlBJ,CAnBJ,CAZJ,CADJ;AAqEH,CAtF4E;AAwF7EN,WAAW,CAAC4B,WAAZ,GAA0BvC,cAA1B;AACAW,WAAW,CAACI,SAAZ,GAAwBd,SAAxB;AACAU,WAAW,CAAC6B,YAAZ,GAA2BrC,aAA3B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Mosaic2.js","sources":["../../../src/components/mosaic/Mosaic.tsx"],"sourcesContent":["import React, { forwardRef, MouseEventHandler, useMemo } from 'react';\n\nimport { Alignment, AspectRatio, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport take from 'lodash/take';\n\n/**\n * Defines the props of the component.\n */\nexport interface MosaicProps extends GenericProps {\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Thumbnails. */\n thumbnails: ThumbnailProps[];\n /** On image click callback. */\n onImageClick?(index: number): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Mosaic';\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<MosaicProps> = {\n theme: Theme.light,\n};\n\n/**\n * Mosaic component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Mosaic: Comp<MosaicProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { className, theme, thumbnails, onImageClick, ...forwardedProps } = props;\n const handleImageClick = useMemo(() => {\n if (!onImageClick) return undefined;\n\n return (index: number, onClick?: MouseEventHandler): MouseEventHandler => (event) => {\n onClick?.(event);\n onImageClick?.(index);\n };\n }, [onImageClick]);\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }), {\n [`${CLASSNAME}--has-1-thumbnail`]: thumbnails?.length === 1,\n [`${CLASSNAME}--has-2-thumbnails`]: thumbnails?.length === 2,\n [`${CLASSNAME}--has-3-thumbnails`]: thumbnails?.length === 3,\n [`${CLASSNAME}--has-4-thumbnails`]: thumbnails?.length >= 4,\n })}\n >\n <div className={`${CLASSNAME}__wrapper`}>\n {take(thumbnails, 4).map((thumbnail: any, index: number) => {\n const { image, onClick, align, ...thumbnailProps } = thumbnail;\n\n return (\n <div key={index} className={`${CLASSNAME}__thumbnail`}>\n <Thumbnail\n {...thumbnailProps}\n align={align || Alignment.left}\n image={image}\n theme={theme}\n aspectRatio={AspectRatio.free}\n fillHeight\n onClick={handleImageClick?.(index, onClick) || onClick}\n />\n\n {thumbnails.length > 4 && index === 3 && (\n <div className={`${CLASSNAME}__overlay`}>\n <span>+{thumbnails.length - 4}</span>\n </div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n});\nMosaic.displayName = COMPONENT_NAME;\nMosaic.className = CLASSNAME;\nMosaic.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","Mosaic","forwardRef","props","ref","className","thumbnails","onImageClick","forwardedProps","handleImageClick","useMemo","undefined","index","onClick","event","classNames","handleBasicClasses","prefix","length","take","map","thumbnail","image","align","thumbnailProps","Alignment","left","AspectRatio","free","displayName","defaultProps"],"mappings":";;;;;;;AAOA;;;;AAYA;;;AAGA,IAAMA,cAAc,GAAG,QAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAmC,GAAG;AACxCC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD2B,CAA5C;AAIA;;;;;;;;IAOaC,MAAyC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA;;AAAA,MACxEC,SADwE,GACNF,KADM,CACxEE,SADwE;AAAA,MAC7DP,KAD6D,GACNK,KADM,CAC7DL,KAD6D;AAAA,MACtDQ,UADsD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C,SAAD,EAAiBT,KAAjB,EAAmC;AAAA,QAChDU,KADgD,GACHD,SADG,CAChDC,KADgD;AAAA,QACzCT,OADyC,GACHQ,SADG,CACzCR,OADyC;AAAA,QAChCU,KADgC,GACHF,SADG,CAChCE,KADgC;AAAA,QACtBC,cADsB,4BACHH,SADG;;AAGxD,WACI;AAAK,MAAA,GAAG,EAAET,KAAV;AAAiB,MAAA,SAAS,YAAKjB,SAAL;AAA1B,OACI,oBAAC,SAAD,eACQ6B,cADR;AAEI,MAAA,KAAK,EAAED,KAAK,IAAIE,SAAS,CAACC,IAF9B;AAGI,MAAA,KAAK,EAAEJ,KAHX;AAII,MAAA,KAAK,EAAExB,KAJX;AAKI,MAAA,WAAW,EAAE6B,WAAW,CAACC,IAL7B;AAMI,MAAA,UAAU,MANd;AAOI,MAAA,OAAO,EAAE,CAAAnB,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAGG,KAAH,EAAUC,OAAV,CAAhB,KAAsCA;AAPnD,OADJ,EAWKP,UAAU,CAACY,MAAX,GAAoB,CAApB,IAAyBN,KAAK,KAAK,CAAnC,IACG;AAAK,MAAA,SAAS,YAAKjB,SAAL;AAAd,OACI,uCAAQW,UAAU,CAACY,MAAX,GAAoB,CAA5B,CADJ,CAZR,CADJ;AAmBH,GAtBA,CADL,CAVJ,CADJ;AAsCH,CAjDkE;AAkDnEjB,MAAM,CAAC4B,WAAP,GAAqBnC,cAArB;AACAO,MAAM,CAACI,SAAP,GAAmBV,SAAnB;AACAM,MAAM,CAAC6B,YAAP,GAAsBjC,aAAtB;;;;"}
1
+ {"version":3,"file":"Mosaic2.js","sources":["../../../src/components/mosaic/Mosaic.tsx"],"sourcesContent":["import React, { forwardRef, MouseEventHandler, useMemo } from 'react';\n\nimport { Alignment, AspectRatio, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport take from 'lodash/take';\n\n/**\n * Defines the props of the component.\n */\nexport interface MosaicProps extends GenericProps, HasTheme {\n /** Thumbnails. */\n thumbnails: ThumbnailProps[];\n /** On image click callback. */\n onImageClick?(index: number): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Mosaic';\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<MosaicProps> = {\n theme: Theme.light,\n};\n\n/**\n * Mosaic component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Mosaic: Comp<MosaicProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { className, theme, thumbnails, onImageClick, ...forwardedProps } = props;\n const handleImageClick = useMemo(() => {\n if (!onImageClick) return undefined;\n\n return (index: number, onClick?: MouseEventHandler): MouseEventHandler => (event) => {\n onClick?.(event);\n onImageClick?.(index);\n };\n }, [onImageClick]);\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme }), {\n [`${CLASSNAME}--has-1-thumbnail`]: thumbnails?.length === 1,\n [`${CLASSNAME}--has-2-thumbnails`]: thumbnails?.length === 2,\n [`${CLASSNAME}--has-3-thumbnails`]: thumbnails?.length === 3,\n [`${CLASSNAME}--has-4-thumbnails`]: thumbnails?.length >= 4,\n })}\n >\n <div className={`${CLASSNAME}__wrapper`}>\n {take(thumbnails, 4).map((thumbnail: any, index: number) => {\n const { image, onClick, align, ...thumbnailProps } = thumbnail;\n\n return (\n <div key={index} className={`${CLASSNAME}__thumbnail`}>\n <Thumbnail\n {...thumbnailProps}\n align={align || Alignment.left}\n image={image}\n theme={theme}\n aspectRatio={AspectRatio.free}\n fillHeight\n onClick={handleImageClick?.(index, onClick) || onClick}\n />\n\n {thumbnails.length > 4 && index === 3 && (\n <div className={`${CLASSNAME}__overlay`}>\n <span>+{thumbnails.length - 4}</span>\n </div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n});\nMosaic.displayName = COMPONENT_NAME;\nMosaic.className = CLASSNAME;\nMosaic.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","Mosaic","forwardRef","props","ref","className","thumbnails","onImageClick","forwardedProps","handleImageClick","useMemo","undefined","index","onClick","event","classNames","handleBasicClasses","prefix","length","take","map","thumbnail","image","align","thumbnailProps","Alignment","left","AspectRatio","free","displayName","defaultProps"],"mappings":";;;;;;;AAOA;;;;AAUA;;;AAGA,IAAMA,cAAc,GAAG,QAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAmC,GAAG;AACxCC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD2B,CAA5C;AAIA;;;;;;;;IAOaC,MAAyC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA;;AAAA,MACxEC,SADwE,GACNF,KADM,CACxEE,SADwE;AAAA,MAC7DP,KAD6D,GACNK,KADM,CAC7DL,KAD6D;AAAA,MACtDQ,UADsD,GACNH,KADM,CACtDG,UADsD;AAAA,MAC1CC,YAD0C,GACNJ,KADM,CAC1CI,YAD0C;AAAA,MACzBC,cADyB,4BACNL,KADM;;AAEhF,MAAMM,gBAAgB,GAAGC,OAAO,CAAC,YAAM;AACnC,QAAI,CAACH,YAAL,EAAmB,OAAOI,SAAP;AAEnB,WAAO,UAACC,KAAD,EAAgBC,OAAhB;AAAA,aAAmE,UAACC,KAAD,EAAW;AACjFD,QAAAA,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGC,KAAH,CAAP;AACAP,QAAAA,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAAGK,KAAH,CAAZ;AACH,OAHM;AAAA,KAAP;AAIH,GAP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ACC,IAL7B;AAMI,MAAA,UAAU,MANd;AAOI,MAAA,OAAO,EAAE,CAAAnB,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAGG,KAAH,EAAUC,OAAV,CAAhB,KAAsCA;AAPnD,OADJ,EAWKP,UAAU,CAACY,MAAX,GAAoB,CAApB,IAAyBN,KAAK,KAAK,CAAnC,IACG;AAAK,MAAA,SAAS,YAAKjB,SAAL;AAAd,OACI,uCAAQW,UAAU,CAACY,MAAX,GAAoB,CAA5B,CADJ,CAZR,CADJ;AAmBH,GAtBA,CADL,CAVJ,CADJ;AAsCH,CAjDkE;AAkDnEjB,MAAM,CAAC4B,WAAP,GAAqBnC,cAArB;AACAO,MAAM,CAACI,SAAP,GAAmBV,SAAnB;AACAM,MAAM,CAAC6B,YAAP,GAAsBjC,aAAtB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Notification2.js","sources":["../../../src/components/notification/constants.ts","../../../src/components/notification/Notification.tsx"],"sourcesContent":["import { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons';\n\n/**\n * Notification delay before hiding.\n */\nexport const HIDE_DELAY = 6000;\n\n/**\n * Notification icon and colors according to their type.\n */\nexport const NOTIFICATION_CONFIGURATION = {\n error: {\n color: 'red',\n icon: mdiAlert,\n },\n info: {\n color: 'dark',\n icon: mdiInformation,\n },\n success: {\n color: 'green',\n icon: mdiCheckCircle,\n },\n warning: {\n color: 'yellow',\n icon: mdiAlertCircle,\n },\n};\n","import React, { forwardRef } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport classNames from 'classnames';\n\nimport isFunction from 'lodash/isFunction';\n\nimport { Button, Emphasis, Icon, Kind, Size, Theme } from '@lumx/react';\n\nimport { DOCUMENT, NOTIFICATION_TRANSITION_DURATION } from '@lumx/react/constants';\nimport { NOTIFICATION_CONFIGURATION } from '@lumx/react/components/notification/constants';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';\n\n/**\n * Defines the props of the component.\n */\nexport interface NotificationProps extends GenericProps {\n /** Action button label. */\n actionLabel?: string;\n /** Content. */\n content?: React.ReactNode;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Notification type. */\n type?: Kind;\n /** Z-axis position. */\n zIndex?: number;\n /** On action button click callback. */\n onActionClick?(): void;\n /** On click callback. */\n onClick?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Notification';\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<NotificationProps> = {\n theme: Theme.light,\n zIndex: 9999,\n};\n\n/* eslint-disable react-hooks/rules-of-hooks, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\n/**\n * Notification component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Notification: Comp<NotificationProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actionLabel,\n className,\n content,\n isOpen,\n onActionClick,\n onClick,\n theme,\n type,\n zIndex,\n ...forwardedProps\n } = props;\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n const { color, icon } = NOTIFICATION_CONFIGURATION[type as Kind] || {};\n const isVisible = useDelayedVisibility(!!isOpen, NOTIFICATION_TRANSITION_DURATION);\n const hasAction: boolean = Boolean(onActionClick) && Boolean(actionLabel);\n\n const handleCallback = (evt: React.MouseEvent) => {\n if (isFunction(onActionClick)) {\n onActionClick();\n }\n evt.stopPropagation();\n };\n\n return type && isVisible\n ? createPortal(\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <div\n ref={ref}\n role=\"alert\"\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n color,\n hasAction,\n isHidden: !isOpen,\n prefix: CLASSNAME,\n }),\n )}\n onClick={onClick}\n style={{ zIndex }}\n >\n <div className={`${CLASSNAME}__icon`}>\n <Icon icon={icon} size={Size.s} />\n </div>\n <div className={`${CLASSNAME}__content`}>{content}</div>\n {hasAction && (\n <div className={`${CLASSNAME}__action`}>\n <Button emphasis={Emphasis.medium} theme={theme} onClick={handleCallback}>\n <span>{actionLabel}</span>\n </Button>\n </div>\n )}\n </div>,\n document.body,\n )\n : null;\n});\nNotification.displayName = COMPONENT_NAME;\nNotification.className = CLASSNAME;\nNotification.defaultProps = DEFAULT_PROPS;\n"],"names":["NOTIFICATION_CONFIGURATION","error","color","icon","mdiAlert","info","mdiInformation","success","mdiCheckCircle","warning","mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","zIndex","Notification","forwardRef","props","ref","actionLabel","className","content","isOpen","onActionClick","onClick","type","forwardedProps","DOCUMENT","isVisible","useDelayedVisibility","NOTIFICATION_TRANSITION_DURATION","hasAction","Boolean","handleCallback","evt","isFunction","stopPropagation","createPortal","classNames","handleBasicClasses","isHidden","prefix","Size","s","Emphasis","medium","document","body","displayName","defaultProps"],"mappings":";;;;;;;;;;;AAOA;;;;AAGO,IAAMA,0BAA0B,GAAG;AACtCC,EAAAA,KAAK,EAAE;AACHC,IAAAA,KAAK,EAAE,KADJ;AAEHC,IAAAA,IAAI,EAAEC;AAFH,GAD+B;AAKtCC,EAAAA,IAAI,EAAE;AACFH,IAAAA,KAAK,EAAE,MADL;AAEFC,IAAAA,IAAI,EAAEG;AAFJ,GALgC;AAStCC,EAAAA,OAAO,EAAE;AACLL,IAAAA,KAAK,EAAE,OADF;AAELC,IAAAA,IAAI,EAAEK;AAFD,GAT6B;AAatCC,EAAAA,OAAO,EAAE;AACLP,IAAAA,KAAK,EAAE,QADF;AAELC,IAAAA,IAAI,EAAEO;AAFD;AAb6B,CAAnC;;ACKP;;;;AAsBA;;;AAGA,IAAMC,cAAc,GAAG,cAAvB;AA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3,"file":"Notification2.js","sources":["../../../src/components/notification/constants.ts","../../../src/components/notification/Notification.tsx"],"sourcesContent":["import { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons';\n\n/**\n * Notification delay before hiding.\n */\nexport const HIDE_DELAY = 6000;\n\n/**\n * Notification icon and colors according to their type.\n */\nexport const NOTIFICATION_CONFIGURATION = {\n error: {\n color: 'red',\n icon: mdiAlert,\n },\n info: {\n color: 'dark',\n icon: mdiInformation,\n },\n success: {\n color: 'green',\n icon: mdiCheckCircle,\n },\n warning: {\n color: 'yellow',\n icon: mdiAlertCircle,\n },\n};\n","import React, { forwardRef } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport classNames from 'classnames';\n\nimport isFunction from 'lodash/isFunction';\n\nimport { Button, Emphasis, Icon, Kind, Size, Theme } from '@lumx/react';\n\nimport { DOCUMENT, NOTIFICATION_TRANSITION_DURATION } from '@lumx/react/constants';\nimport { NOTIFICATION_CONFIGURATION } from '@lumx/react/components/notification/constants';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';\n\nimport { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';\n\n/**\n * Defines the props of the component.\n */\nexport interface NotificationProps extends GenericProps, HasTheme {\n /** Action button label. */\n actionLabel?: string;\n /** Content. */\n content?: React.ReactNode;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Notification type. */\n type?: Kind;\n /** Z-axis position. */\n zIndex?: number;\n /** On action button click callback. */\n onActionClick?(): void;\n /** On click callback. */\n onClick?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Notification';\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<NotificationProps> = {\n theme: Theme.light,\n zIndex: 9999,\n};\n\n/* eslint-disable react-hooks/rules-of-hooks, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\n/**\n * Notification component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Notification: Comp<NotificationProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actionLabel,\n className,\n content,\n isOpen,\n onActionClick,\n onClick,\n theme,\n type,\n zIndex,\n ...forwardedProps\n } = props;\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n const { color, icon } = NOTIFICATION_CONFIGURATION[type as Kind] || {};\n const isVisible = useDelayedVisibility(!!isOpen, NOTIFICATION_TRANSITION_DURATION);\n const hasAction: boolean = Boolean(onActionClick) && Boolean(actionLabel);\n\n const handleCallback = (evt: React.MouseEvent) => {\n if (isFunction(onActionClick)) {\n onActionClick();\n }\n evt.stopPropagation();\n };\n\n return type && isVisible\n ? createPortal(\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <div\n ref={ref}\n role=\"alert\"\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n color,\n hasAction,\n isHidden: !isOpen,\n prefix: CLASSNAME,\n }),\n )}\n onClick={onClick}\n style={{ zIndex }}\n >\n <div className={`${CLASSNAME}__icon`}>\n <Icon icon={icon} size={Size.s} />\n </div>\n <div className={`${CLASSNAME}__content`}>{content}</div>\n {hasAction && (\n <div className={`${CLASSNAME}__action`}>\n <Button emphasis={Emphasis.medium} theme={theme} onClick={handleCallback}>\n <span>{actionLabel}</span>\n </Button>\n </div>\n )}\n </div>,\n document.body,\n )\n : null;\n});\nNotification.displayName = COMPONENT_NAME;\nNotification.className = CLASSNAME;\nNotification.defaultProps = DEFAULT_PROPS;\n"],"names":["NOTIFICATION_CONFIGURATION","error","color","icon","mdiAlert","info","mdiInformation","success","mdiCheckCircle","warning","mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","zIndex","Notification","forwardRef","props","ref","actionLabel","className","content","isOpen","onActionClick","onClick","type","forwardedProps","DOCUMENT","isVisible","useDelayedVisibility","NOTIFICATION_TRANSITION_DURATION","hasAction","Boolean","handleCallback","evt","isFunction","stopPropagation","createPortal","classNames","handleBasicClasses","isHidden","prefix","Size","s","Emphasis","medium","document","body","displayName","defaultProps"],"mappings":";;;;;;;;;;;AAOA;;;;AAGO,IAAMA,0BAA0B,GAAG;AACtCC,EAAAA,KAAK,EAAE;AACHC,IAAAA,KAAK,EAAE,KADJ;AAEHC,IAAAA,IAAI,EAAEC;AAFH,GAD+B;AAKtCC,EAAAA,IAAI,EAAE;AACFH,IAAAA,KAAK,EAAE,MADL;AAEFC,IAAAA,IAAI,EAAEG;AAFJ,GALgC;AAStCC,EAAAA,OAAO,EAAE;AACLL,IAAAA,KAAK,EAAE,OADF;AAELC,IAAAA,IAAI,EAAEK;AAFD,GAT6B;AAatCC,EAAAA,OAAO,EAAE;AACLP,IAAAA,KAAK,EAAE,QADF;AAELC,IAAAA,IAAI,EAAEO;AAFD;AAb6B,CAAnC;;ACKP;;;;AAoBA;;;AAGA,IAAMC,cAAc,GAAG,cAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAyC,GAAG;AAC9CC,EAAAA,KAAK,EAAEC,KAAK,CAACC,KADiC;AAE9CC,EAAAA,MAAM,EAAE;AAFsC,CAAlD;AAKA;;AACA;;;;;;;;IAOaC,YAAqD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAExFC,WAFwF,GAYxFF,KAZwF,CAExFE,WAFwF;AAAA,MAGxFC,SAHwF,GAYxFH,KAZwF,CAGxFG,SAHwF;AAAA,MAIxFC,OAJwF,GAYxFJ,KAZwF,CAIxFI,OAJwF;AAAA,MAKxFC,MALwF,GAYxFL,KAZwF,CAKxFK,MALwF;AAAA,MAMxFC,aANwF,GAYxFN,KAZwF,CAMxFM,aANwF;AAAA,MAOxFC,OAPwF,GAYxFP,KAZwF,CAOxFO,O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,YAAKN,SAAL;AAAd,KACI,oBAAC,IAAD;AAAM,IAAA,IAAI,EAAET,IAAZ;AAAkB,IAAA,IAAI,EAAE2C,IAAI,CAACC;AAA7B,IADJ,CAhBJ,EAmBI;AAAK,IAAA,SAAS,YAAKnC,SAAL;AAAd,KAA0Ca,OAA1C,CAnBJ,EAoBKU,SAAS,IACN;AAAK,IAAA,SAAS,YAAKvB,SAAL;AAAd,KACI,oBAAC,MAAD;AAAQ,IAAA,QAAQ,EAAEoC,QAAQ,CAACC,MAA3B;AAAmC,IAAA,KAAK,EAAElC,KAA1C;AAAiD,IAAA,OAAO,EAAEsB;AAA1D,KACI,kCAAOd,WAAP,CADJ,CADJ,CArBR,CAFQ,EA8BR2B,QAAQ,CAACC,IA9BD,CADX,GAiCD,IAjCN;AAkCH,CA9D8E;AA+D/EhC,YAAY,CAACiC,WAAb,GAA2BzC,cAA3B;AACAQ,YAAY,CAACK,SAAb,GAAyBZ,SAAzB;AACAO,YAAY,CAACkC,YAAb,GAA4BvC,aAA5B;;;;"}
@@ -2458,7 +2458,7 @@ var Popover = forwardRef(function (props, ref) {
2458
2458
  style: popoverStyle
2459
2459
  }, attributes.popper), React.createElement(ClickAwayProvider, {
2460
2460
  callback: closeOnClickAway && handleClose,
2461
- refs: clickAwayRefs
2461
+ childrenRefs: clickAwayRefs
2462
2462
  }, hasArrow && React.createElement("div", {
2463
2463
  ref: setArrowElement,
2464
2464
  className: "".concat(CLASSNAME, "__arrow"),