@helsenorge/designsystem-react 13.3.0 → 13.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/lib/AnchorLink.js +2 -2
  2. package/lib/AnchorLink.js.map +1 -1
  3. package/lib/Avatar.js +2 -2
  4. package/lib/Avatar.js.map +1 -1
  5. package/lib/Badge.js +2 -2
  6. package/lib/Badge.js.map +1 -1
  7. package/lib/Button.js +6 -6
  8. package/lib/Button.js.map +1 -1
  9. package/lib/CHANGELOG.md +34 -1
  10. package/lib/Checkbox.js +6 -6
  11. package/lib/Checkbox.js.map +1 -1
  12. package/lib/Close.js +3 -3
  13. package/lib/Close.js.map +1 -1
  14. package/lib/DictionaryTrigger.js +2 -2
  15. package/lib/DictionaryTrigger.js.map +1 -1
  16. package/lib/Drawer.js +5 -5
  17. package/lib/Drawer.js.map +1 -1
  18. package/lib/Duolist.js +5 -5
  19. package/lib/Duolist.js.map +1 -1
  20. package/lib/ElementHeader.js +9 -9
  21. package/lib/ElementHeader.js.map +1 -1
  22. package/lib/ElementHeaderText.js +4 -4
  23. package/lib/ElementHeaderText.js.map +1 -1
  24. package/lib/ErrorWrapper.js +2 -2
  25. package/lib/ErrorWrapper.js.map +1 -1
  26. package/lib/Expander.js +7 -7
  27. package/lib/Expander.js.map +1 -1
  28. package/lib/FormFieldTag.js +2 -2
  29. package/lib/FormFieldTag.js.map +1 -1
  30. package/lib/FormGroup.js +5 -5
  31. package/lib/FormGroup.js.map +1 -1
  32. package/lib/FormLayout.js +3 -3
  33. package/lib/FormLayout.js.map +1 -1
  34. package/lib/HelpDetails.js +3 -3
  35. package/lib/HelpDetails.js.map +1 -1
  36. package/lib/HelpTriggerIcon.js +2 -2
  37. package/lib/HelpTriggerIcon.js.map +1 -1
  38. package/lib/HelpTriggerStandalone.js +2 -2
  39. package/lib/HelpTriggerStandalone.js.map +1 -1
  40. package/lib/HighlightPanel.js +3 -3
  41. package/lib/HighlightPanel.js.map +1 -1
  42. package/lib/HorizontalScroll.js +4 -4
  43. package/lib/HorizontalScroll.js.map +1 -1
  44. package/lib/Icon.js +2 -2
  45. package/lib/Icon.js.map +1 -1
  46. package/lib/InfoTeaser.js +3 -3
  47. package/lib/InfoTeaser.js.map +1 -1
  48. package/lib/Input.js +28 -9
  49. package/lib/Input.js.map +1 -1
  50. package/lib/Label.js +5 -5
  51. package/lib/Label.js.map +1 -1
  52. package/lib/LinkList.js +13 -9
  53. package/lib/LinkList.js.map +1 -1
  54. package/lib/List.js +2 -2
  55. package/lib/List.js.map +1 -1
  56. package/lib/ListEditMode.js +4 -4
  57. package/lib/ListEditMode.js.map +1 -1
  58. package/lib/MaxCharacters.js +3 -3
  59. package/lib/MaxCharacters.js.map +1 -1
  60. package/lib/Panel.js +12 -12
  61. package/lib/Panel.js.map +1 -1
  62. package/lib/PanelOld.js +14 -14
  63. package/lib/PanelOld.js.map +1 -1
  64. package/lib/PanelTitle.js +2 -2
  65. package/lib/PanelTitle.js.map +1 -1
  66. package/lib/PopOver.js +2 -2
  67. package/lib/PopOver.js.map +1 -1
  68. package/lib/RadioButton.js +5 -5
  69. package/lib/RadioButton.js.map +1 -1
  70. package/lib/Select.js +4 -4
  71. package/lib/Select.js.map +1 -1
  72. package/lib/SingleSelectItem.js +3 -3
  73. package/lib/SingleSelectItem.js.map +1 -1
  74. package/lib/Slider.js +5 -5
  75. package/lib/Slider.js.map +1 -1
  76. package/lib/Spacer.js +2 -2
  77. package/lib/Spacer.js.map +1 -1
  78. package/lib/StatusDot.js +4 -4
  79. package/lib/StatusDot.js.map +1 -1
  80. package/lib/StatusDotList.js +2 -2
  81. package/lib/StatusDotList.js.map +1 -1
  82. package/lib/StepButtons.js +5 -5
  83. package/lib/StepButtons.js.map +1 -1
  84. package/lib/TabList.js +8 -8
  85. package/lib/TabList.js.map +1 -1
  86. package/lib/TabPanel.js +2 -2
  87. package/lib/TabPanel.js.map +1 -1
  88. package/lib/Table.js +2 -2
  89. package/lib/Table.js.map +1 -1
  90. package/lib/TableBody.js +2 -2
  91. package/lib/TableBody.js.map +1 -1
  92. package/lib/TableCell.js +2 -2
  93. package/lib/TableCell.js.map +1 -1
  94. package/lib/TableExpandedRow.js +4 -4
  95. package/lib/TableExpandedRow.js.map +1 -1
  96. package/lib/TableExpanderCell.js +2 -2
  97. package/lib/TableExpanderCell.js.map +1 -1
  98. package/lib/TableHead.js +2 -2
  99. package/lib/TableHead.js.map +1 -1
  100. package/lib/TableHeadCell.js +3 -3
  101. package/lib/TableHeadCell.js.map +1 -1
  102. package/lib/TableRow.js +3 -3
  103. package/lib/TableRow.js.map +1 -1
  104. package/lib/Textarea.js +28 -9
  105. package/lib/Textarea.js.map +1 -1
  106. package/lib/Title.js +2 -2
  107. package/lib/Title.js.map +1 -1
  108. package/lib/Toast.js +3 -3
  109. package/lib/Toast.js.map +1 -1
  110. package/lib/components/ArticleTeaser/index.js +4 -4
  111. package/lib/components/ArticleTeaser/index.js.map +1 -1
  112. package/lib/components/Chip/index.js +2 -2
  113. package/lib/components/Chip/index.js.map +1 -1
  114. package/lib/components/Dropdown/index.js +5 -5
  115. package/lib/components/Dropdown/index.js.map +1 -1
  116. package/lib/components/DropdownOld/index.js +3 -3
  117. package/lib/components/DropdownOld/index.js.map +1 -1
  118. package/lib/components/ElementHeader/styles.module.scss +1 -1
  119. package/lib/components/EmptyState/index.js +2 -2
  120. package/lib/components/EmptyState/index.js.map +1 -1
  121. package/lib/components/ExpanderHierarchy/index.js +7 -7
  122. package/lib/components/ExpanderHierarchy/index.js.map +1 -1
  123. package/lib/components/ExpanderList/index.js +6 -6
  124. package/lib/components/ExpanderList/index.js.map +1 -1
  125. package/lib/components/ExpanderList/styles.module.scss +3 -3
  126. package/lib/components/FavoriteButton/index.js +2 -2
  127. package/lib/components/FavoriteButton/index.js.map +1 -1
  128. package/lib/components/FormGroup/index.js +1 -1
  129. package/lib/components/HelpBubble/index.js +6 -6
  130. package/lib/components/HelpBubble/index.js.map +1 -1
  131. package/lib/components/HelpPanel/index.js +2 -2
  132. package/lib/components/HelpPanel/index.js.map +1 -1
  133. package/lib/components/HelpTriggerInline/index.js +2 -2
  134. package/lib/components/HelpTriggerInline/index.js.map +1 -1
  135. package/lib/components/Input/Input.d.ts +4 -1
  136. package/lib/components/Input/index.js +1 -1
  137. package/lib/components/Input/resourceHelper.d.ts +3 -0
  138. package/lib/components/Label/Label.d.ts +1 -1
  139. package/lib/components/LinkList/LinkList.d.ts +5 -4
  140. package/lib/components/LinkList/index.js +1 -0
  141. package/lib/components/LinkList/styles.module.scss +1 -0
  142. package/lib/components/Loader/index.js +4 -4
  143. package/lib/components/Loader/index.js.map +1 -1
  144. package/lib/components/MaxCharacters/MaxCharacters.d.ts +1 -1
  145. package/lib/components/Modal/index.js +9 -9
  146. package/lib/components/Modal/index.js.map +1 -1
  147. package/lib/components/NotificationPanel/index.js +6 -6
  148. package/lib/components/NotificationPanel/index.js.map +1 -1
  149. package/lib/components/Panel/PanelTitle/styles.module.scss +0 -1
  150. package/lib/components/PanelList/index.js +3 -3
  151. package/lib/components/PanelList/index.js.map +1 -1
  152. package/lib/components/PanelListOld/index.js +2 -2
  153. package/lib/components/PanelListOld/index.js.map +1 -1
  154. package/lib/components/PopMenu/index.js +4 -3
  155. package/lib/components/PopMenu/index.js.map +1 -1
  156. package/lib/components/PopOver/PopOver.d.ts +1 -1
  157. package/lib/components/Progressbar/index.js +2 -2
  158. package/lib/components/Progressbar/index.js.map +1 -1
  159. package/lib/components/PromoPanel/index.js +2 -2
  160. package/lib/components/PromoPanel/index.js.map +1 -1
  161. package/lib/components/ServiceMessage/index.js +5 -5
  162. package/lib/components/ServiceMessage/index.js.map +1 -1
  163. package/lib/components/SharingStatus/index.js +4 -4
  164. package/lib/components/SharingStatus/index.js.map +1 -1
  165. package/lib/components/Step/index.js +2 -2
  166. package/lib/components/Step/index.js.map +1 -1
  167. package/lib/components/Stepper/index.js +2 -2
  168. package/lib/components/Stepper/index.js.map +1 -1
  169. package/lib/components/StickyNote/index.js +8 -8
  170. package/lib/components/StickyNote/index.js.map +1 -1
  171. package/lib/components/Tabs/index.js +4 -4
  172. package/lib/components/Tabs/index.js.map +1 -1
  173. package/lib/components/Tag/index.js +2 -2
  174. package/lib/components/Tag/index.js.map +1 -1
  175. package/lib/components/Textarea/Textarea.d.ts +4 -1
  176. package/lib/components/Textarea/resourceHelper.d.ts +3 -0
  177. package/lib/components/Tile/index.js +4 -4
  178. package/lib/components/Tile/index.js.map +1 -1
  179. package/lib/components/Toggle/index.js +9 -9
  180. package/lib/components/Toggle/index.js.map +1 -1
  181. package/lib/components/Validation/index.js +3 -3
  182. package/lib/components/Validation/index.js.map +1 -1
  183. package/lib/constants.d.ts +2 -1
  184. package/lib/constants2.js +1 -0
  185. package/lib/constants2.js.map +1 -1
  186. package/lib/resources/HN.Designsystem.Input.en-GB.json.d.ts +6 -0
  187. package/lib/resources/HN.Designsystem.Input.nb-NO.json.d.ts +6 -0
  188. package/lib/resources/HN.Designsystem.Input.nn-NO.json.d.ts +6 -0
  189. package/lib/resources/HN.Designsystem.TextArea.en-GB.json.d.ts +6 -0
  190. package/lib/resources/HN.Designsystem.TextArea.nb-NO.json.d.ts +6 -0
  191. package/lib/resources/HN.Designsystem.TextArea.nn-NO.json.d.ts +6 -0
  192. package/package.json +2 -2
@@ -21,7 +21,7 @@ import { t as Close_default } from "../../Close.js";
21
21
  import "../../floating-ui.react.js";
22
22
  import { n as PopOverVariant, t as PopOver_default } from "../../PopOver.js";
23
23
  import React from "react";
24
- import classNames from "classnames";
24
+ import cn from "classnames";
25
25
  import { jsx, jsxs } from "react/jsx-runtime";
26
26
  import styles from "./styles.module.scss";
27
27
  var HN_Designsystem_HelpBubble_nb_NO_default = { ariaLabel: "Hjelpetekst" };
@@ -42,8 +42,8 @@ var HelpBubble = React.forwardRef((props, ref) => {
42
42
  ...resources,
43
43
  ariaLabel: props.ariaLabel ?? resources?.ariaLabel ?? defaultResources.ariaLabel
44
44
  };
45
- const helpBubbleClasses = classNames(styles.helpbubble, className);
46
- const contentClasses = classNames(styles.helpbubble__content);
45
+ const helpBubbleClasses = cn(styles.helpbubble, className);
46
+ const contentClasses = cn(styles.helpbubble__content);
47
47
  const renderLink = () => {
48
48
  if (onLinkClick && linkText) return /* @__PURE__ */ jsx("button", {
49
49
  className: styles.helpbubble__link,
@@ -73,17 +73,17 @@ var HelpBubble = React.forwardRef((props, ref) => {
73
73
  id: helpBubbleId,
74
74
  variant,
75
75
  controllerRef,
76
- role: "dialog",
76
+ role: "group",
77
77
  ref,
78
78
  show: showBubble,
79
79
  testId,
80
80
  children: /* @__PURE__ */ jsxs("div", {
81
81
  className: helpBubbleClasses,
82
82
  "data-analyticsid": AnalyticsId.HelpBubble,
83
- children: [renderCloseButton(), /* @__PURE__ */ jsxs("div", {
83
+ children: [/* @__PURE__ */ jsxs("div", {
84
84
  className: contentClasses,
85
85
  children: [children, renderLink()]
86
- })]
86
+ }), renderCloseButton()]
87
87
  })
88
88
  });
89
89
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["mergedResources: HNDesignsystemHelpBubble"],"sources":["../../../src/resources/HN.Designsystem.HelpBubble.nb-NO.json","../../../src/components/HelpBubble/resourceHelper.ts","../../../src/components/HelpBubble/HelpBubble.tsx","../../../src/components/HelpBubble/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Hjelpetekst\"\n}\n","import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.HelpBubble.nb-NO.json';\nimport { HNDesignsystemHelpBubble } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemHelpBubble => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { HNDesignsystemHelpBubble } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport AnchorLink, { AnchorLinkTargets } from '../AnchorLink';\nimport Close from '../Close';\nimport PopOver, { PopOverProps, PopOverVariant } from '../PopOver';\nimport { getResources } from './resourceHelper';\n\nimport styles from './styles.module.scss';\n\nexport const HelpBubbleVariant = PopOverVariant;\n\nexport interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'variant' | 'controllerRef' | 'role'> {\n /** Sets aria-label of the bubble. */\n ariaLabel?: string;\n /** Sets aria-labelledby of the bubble. */\n ariaLabelledById?: string;\n /** Id of the HelpBubble */\n helpBubbleId?: string;\n /** Content shown inside HelpBubble. */\n children: React.ReactNode;\n /** Ref for the element the HelpBubble is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Adds custom classes to the element. */\n className?: string;\n /** Determines the placement of the helpbubble. Default: automatic positioning. */\n variant?: keyof typeof HelpBubbleVariant;\n /** Show the bubble. Default: false. */\n showBubble?: boolean;\n /** Hide the close button in the bubble. */\n noCloseButton?: boolean;\n /** Visible text on the link. */\n linkText?: string;\n /** Url the link leads to */\n linkUrl?: string;\n /** Sets the target type of the link. _blank adds an arrow icon at the end of the link */\n linkTarget?: AnchorLinkTargets;\n /** Function is called when link is clicked */\n onLinkClick?: () => void;\n /** Function is called when user clicks the button */\n onClose?: () => void;\n /** aria-label to be passed onto Close */\n closeAriaLabel?: string;\n /** Resources for the component */\n resources?: Partial<HNDesignsystemHelpBubble>;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpBubble = React.forwardRef<HTMLDivElement | SVGSVGElement, HelpBubbleProps>((props, ref) => {\n const {\n ariaLabelledById,\n children,\n className = '',\n noCloseButton,\n linkText = 'Mer hjelp',\n linkUrl,\n linkTarget,\n onLinkClick,\n onClose,\n closeAriaLabel,\n // Props passed on to PopOver\n showBubble,\n helpBubbleId,\n variant,\n controllerRef,\n resources,\n testId,\n } = props;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n\n if (!showBubble) {\n return null;\n }\n\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemHelpBubble = {\n ...defaultResources,\n ...resources,\n ariaLabel: props.ariaLabel ?? resources?.ariaLabel ?? defaultResources.ariaLabel,\n };\n\n const helpBubbleClasses = classNames(styles.helpbubble, className);\n const contentClasses = classNames(styles.helpbubble__content);\n\n const renderLink = (): JSX.Element | undefined => {\n if (onLinkClick && linkText) {\n return (\n <button className={styles.helpbubble__link} onClick={onLinkClick} type=\"button\">\n {linkText}\n </button>\n );\n } else if (linkUrl && linkText) {\n return (\n <AnchorLink href={linkUrl} target={linkTarget}>\n {linkText}\n </AnchorLink>\n );\n }\n };\n\n const renderCloseButton = (): JSX.Element | undefined => {\n if (noCloseButton) {\n return;\n }\n return <Close small color=\"plum\" onClick={onClose} ariaLabel={closeAriaLabel} className={styles.helpbubble__close} />;\n };\n\n return (\n <PopOver\n ariaLabel={mergedResources.ariaLabel}\n ariaLabelledById={ariaLabelledById}\n id={helpBubbleId}\n variant={variant}\n controllerRef={controllerRef}\n role=\"dialog\"\n ref={ref}\n show={showBubble}\n testId={testId}\n >\n <div className={helpBubbleClasses} data-analyticsid={AnalyticsId.HelpBubble}>\n {renderCloseButton()}\n <div className={contentClasses}>\n {children}\n {renderLink()}\n </div>\n </div>\n </PopOver>\n );\n});\n\nHelpBubble.displayName = 'HelpBubble';\n\nexport default HelpBubble;\n","import HelpBubble from './HelpBubble';\nexport * from './HelpBubble';\nexport default HelpBubble;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,MAAa,gBAAgB,aAAwD;AACnF,SAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACMb,MAAa,oBAAoB;AAuCjC,IAAM,aAAa,MAAM,YAA6D,OAAO,QAAQ;CACnG,MAAM,EACJ,kBACA,UACA,YAAY,IACZ,eACA,WAAW,aACX,SACA,YACA,aACA,SACA,gBAEA,YACA,cACA,SACA,eACA,WACA,WACE;CAEJ,MAAM,EAAE,aAAa,YAA6B,gBAAgB,UAAU;AAE5E,KAAI,CAAC,WACH,QAAO;CAGT,MAAM,mBAAmB,aAAa,SAAS;CAC/C,MAAMA,kBAA4C;EAChD,GAAG;EACH,GAAG;EACH,WAAW,MAAM,aAAa,WAAW,aAAa,iBAAiB;EACxE;CAED,MAAM,oBAAoB,WAAW,OAAO,YAAY,UAAU;CAClE,MAAM,iBAAiB,WAAW,OAAO,oBAAoB;CAE7D,MAAM,mBAA4C;AAChD,MAAI,eAAe,SACjB,QACE,oBAAC,UAAA;GAAO,WAAW,OAAO;GAAkB,SAAS;GAAa,MAAK;aACpE;IACM;WAEF,WAAW,SACpB,QACE,oBAAC,oBAAA;GAAW,MAAM;GAAS,QAAQ;aAChC;IACU;;CAKnB,MAAM,0BAAmD;AACvD,MAAI,cACF;AAEF,SAAO,oBAAC,eAAA;GAAM,OAAA;GAAM,OAAM;GAAO,SAAS;GAAS,WAAW;GAAgB,WAAW,OAAO;IAAqB;;AAGvH,QACE,oBAAC,iBAAA;EACC,WAAW,gBAAgB;EACT;EAClB,IAAI;EACK;EACM;EACf,MAAK;EACA;EACL,MAAM;EACE;YAER,qBAAC,OAAA;GAAI,WAAW;GAAmB,oBAAkB,YAAY;cAC9D,mBAAmB,EACpB,qBAAC,OAAA;IAAI,WAAW;eACb,UACA,YAAY,CAAA;KACT,CAAA;IACF;GACE;EAEZ;AAEF,WAAW,cAAc;ACtIzB,IAAA,qBDwIe"}
1
+ {"version":3,"file":"index.js","names":["mergedResources: HNDesignsystemHelpBubble"],"sources":["../../../src/resources/HN.Designsystem.HelpBubble.nb-NO.json","../../../src/components/HelpBubble/resourceHelper.ts","../../../src/components/HelpBubble/HelpBubble.tsx","../../../src/components/HelpBubble/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Hjelpetekst\"\n}\n","import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.HelpBubble.nb-NO.json';\nimport { HNDesignsystemHelpBubble } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemHelpBubble => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { HNDesignsystemHelpBubble } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport AnchorLink, { AnchorLinkTargets } from '../AnchorLink';\nimport Close from '../Close';\nimport PopOver, { PopOverProps, PopOverVariant } from '../PopOver';\nimport { getResources } from './resourceHelper';\n\nimport styles from './styles.module.scss';\n\nexport const HelpBubbleVariant = PopOverVariant;\n\nexport interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'variant' | 'controllerRef' | 'role'> {\n /** Sets aria-label of the bubble. */\n ariaLabel?: string;\n /** Sets aria-labelledby of the bubble. */\n ariaLabelledById?: string;\n /** Id of the HelpBubble */\n helpBubbleId?: string;\n /** Content shown inside HelpBubble. */\n children: React.ReactNode;\n /** Ref for the element the HelpBubble is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Adds custom classes to the element. */\n className?: string;\n /** Determines the placement of the helpbubble. Default: automatic positioning. */\n variant?: keyof typeof HelpBubbleVariant;\n /** Show the bubble. Default: false. */\n showBubble?: boolean;\n /** Hide the close button in the bubble. */\n noCloseButton?: boolean;\n /** Visible text on the link. */\n linkText?: string;\n /** Url the link leads to */\n linkUrl?: string;\n /** Sets the target type of the link. _blank adds an arrow icon at the end of the link */\n linkTarget?: AnchorLinkTargets;\n /** Function is called when link is clicked */\n onLinkClick?: () => void;\n /** Function is called when user clicks the button */\n onClose?: () => void;\n /** aria-label to be passed onto Close */\n closeAriaLabel?: string;\n /** Resources for the component */\n resources?: Partial<HNDesignsystemHelpBubble>;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpBubble = React.forwardRef<HTMLDivElement | SVGSVGElement, HelpBubbleProps>((props, ref) => {\n const {\n ariaLabelledById,\n children,\n className = '',\n noCloseButton,\n linkText = 'Mer hjelp',\n linkUrl,\n linkTarget,\n onLinkClick,\n onClose,\n closeAriaLabel,\n // Props passed on to PopOver\n showBubble,\n helpBubbleId,\n variant,\n controllerRef,\n resources,\n testId,\n } = props;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n\n if (!showBubble) {\n return null;\n }\n\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemHelpBubble = {\n ...defaultResources,\n ...resources,\n ariaLabel: props.ariaLabel ?? resources?.ariaLabel ?? defaultResources.ariaLabel,\n };\n\n const helpBubbleClasses = classNames(styles.helpbubble, className);\n const contentClasses = classNames(styles.helpbubble__content);\n\n const renderLink = (): JSX.Element | undefined => {\n if (onLinkClick && linkText) {\n return (\n <button className={styles.helpbubble__link} onClick={onLinkClick} type=\"button\">\n {linkText}\n </button>\n );\n } else if (linkUrl && linkText) {\n return (\n <AnchorLink href={linkUrl} target={linkTarget}>\n {linkText}\n </AnchorLink>\n );\n }\n };\n\n const renderCloseButton = (): JSX.Element | undefined => {\n if (noCloseButton) {\n return;\n }\n return <Close small color=\"plum\" onClick={onClose} ariaLabel={closeAriaLabel} className={styles.helpbubble__close} />;\n };\n\n return (\n <PopOver\n ariaLabel={mergedResources.ariaLabel}\n ariaLabelledById={ariaLabelledById}\n id={helpBubbleId}\n variant={variant}\n controllerRef={controllerRef}\n role=\"group\"\n ref={ref}\n show={showBubble}\n testId={testId}\n >\n <div className={helpBubbleClasses} data-analyticsid={AnalyticsId.HelpBubble}>\n <div className={contentClasses}>\n {children}\n {renderLink()}\n </div>\n {renderCloseButton()}\n </div>\n </PopOver>\n );\n});\n\nHelpBubble.displayName = 'HelpBubble';\n\nexport default HelpBubble;\n","import HelpBubble from './HelpBubble';\nexport * from './HelpBubble';\nexport default HelpBubble;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,MAAa,gBAAgB,aAAwD;AACnF,SAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACMb,MAAa,oBAAoB;AAuCjC,IAAM,aAAa,MAAM,YAA6D,OAAO,QAAQ;CACnG,MAAM,EACJ,kBACA,UACA,YAAY,IACZ,eACA,WAAW,aACX,SACA,YACA,aACA,SACA,gBAEA,YACA,cACA,SACA,eACA,WACA,WACE;CAEJ,MAAM,EAAE,aAAa,YAA6B,gBAAgB,UAAU;AAE5E,KAAI,CAAC,WACH,QAAO;CAGT,MAAM,mBAAmB,aAAa,SAAS;CAC/C,MAAMA,kBAA4C;EAChD,GAAG;EACH,GAAG;EACH,WAAW,MAAM,aAAa,WAAW,aAAa,iBAAiB;EACxE;CAED,MAAM,oBAAoB,GAAW,OAAO,YAAY,UAAU;CAClE,MAAM,iBAAiB,GAAW,OAAO,oBAAoB;CAE7D,MAAM,mBAA4C;AAChD,MAAI,eAAe,SACjB,QACE,oBAAC,UAAA;GAAO,WAAW,OAAO;GAAkB,SAAS;GAAa,MAAK;aACpE;IACM;WAEF,WAAW,SACpB,QACE,oBAAC,oBAAA;GAAW,MAAM;GAAS,QAAQ;aAChC;IACU;;CAKnB,MAAM,0BAAmD;AACvD,MAAI,cACF;AAEF,SAAO,oBAAC,eAAA;GAAM,OAAA;GAAM,OAAM;GAAO,SAAS;GAAS,WAAW;GAAgB,WAAW,OAAO;IAAqB;;AAGvH,QACE,oBAAC,iBAAA;EACC,WAAW,gBAAgB;EACT;EAClB,IAAI;EACK;EACM;EACf,MAAK;EACA;EACL,MAAM;EACE;YAER,qBAAC,OAAA;GAAI,WAAW;GAAmB,oBAAkB,YAAY;cAC/D,qBAAC,OAAA;IAAI,WAAW;eACb,UACA,YAAY,CAAA;KACT,EACL,mBAAmB,CAAA;IAChB;GACE;EAEZ;AAEF,WAAW,cAAc;ACtIzB,IAAA,qBDwIe"}
@@ -33,12 +33,12 @@ import "../../Title2.js";
33
33
  import { t as HighlightPanel_default } from "../../HighlightPanel.js";
34
34
  import { t as HandWaving_default } from "../../HandWaving.js";
35
35
  import React from "react";
36
- import classNames from "classnames";
36
+ import cn from "classnames";
37
37
  import { jsx } from "react/jsx-runtime";
38
38
  import styles from "./styles.module.scss";
39
39
  var HelpPanel = ({ className, variant = "normal", testId, children, title }) => {
40
40
  return /* @__PURE__ */ jsx(HighlightPanel_default, {
41
- className: classNames([styles["help-panel"]], className),
41
+ className: cn([styles["help-panel"]], className),
42
42
  testId,
43
43
  svgIcon: HandWaving_default,
44
44
  title,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["HelpPanel: React.FC<HelpPanelProps>"],"sources":["../../../src/components/HelpPanel/HelpPanel.tsx","../../../src/components/HelpPanel/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HighlightPanel from '../HighlightPanel';\nimport HandWaving from '../Icons/HandWaving';\n\nimport styles from './styles.module.scss';\n\nexport type HelpPanelVariants = 'normal' | 'compact';\n\nexport interface HelpPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** If set the compact styling will be used */\n variant?: HelpPanelVariants;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets title if needed */\n title?: string;\n}\n\nconst HelpPanel: React.FC<HelpPanelProps> = ({ className, variant = 'normal', testId, children, title }) => {\n return (\n <HighlightPanel\n className={classNames([styles['help-panel']], className)}\n testId={testId}\n svgIcon={HandWaving}\n title={title}\n variant={variant}\n >\n {children}\n </HighlightPanel>\n );\n};\n\nexport default HelpPanel;\n","import HelpPanel from './HelpPanel';\nexport * from './HelpPanel';\nexport default HelpPanel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAMA,aAAuC,EAAE,WAAW,UAAU,UAAU,QAAQ,UAAU,YAAY;AAC1G,QACE,oBAAC,wBAAA;EACC,WAAW,WAAW,CAAC,OAAO,cAAc,EAAE,UAAU;EAChD;EACR,SAAS;EACF;EACE;EAER;GACc;;AChCrB,IAAA,oBDoCe"}
1
+ {"version":3,"file":"index.js","names":["HelpPanel: React.FC<HelpPanelProps>"],"sources":["../../../src/components/HelpPanel/HelpPanel.tsx","../../../src/components/HelpPanel/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HighlightPanel from '../HighlightPanel';\nimport HandWaving from '../Icons/HandWaving';\n\nimport styles from './styles.module.scss';\n\nexport type HelpPanelVariants = 'normal' | 'compact';\n\nexport interface HelpPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** If set the compact styling will be used */\n variant?: HelpPanelVariants;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets title if needed */\n title?: string;\n}\n\nconst HelpPanel: React.FC<HelpPanelProps> = ({ className, variant = 'normal', testId, children, title }) => {\n return (\n <HighlightPanel\n className={classNames([styles['help-panel']], className)}\n testId={testId}\n svgIcon={HandWaving}\n title={title}\n variant={variant}\n >\n {children}\n </HighlightPanel>\n );\n};\n\nexport default HelpPanel;\n","import HelpPanel from './HelpPanel';\nexport * from './HelpPanel';\nexport default HelpPanel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAMA,aAAuC,EAAE,WAAW,UAAU,UAAU,QAAQ,UAAU,YAAY;AAC1G,QACE,oBAAC,wBAAA;EACC,WAAW,GAAW,CAAC,OAAO,cAAc,EAAE,UAAU;EAChD;EACR,SAAS;EACF;EACE;EAER;GACc;;AChCrB,IAAA,oBDoCe"}
@@ -4,7 +4,7 @@ import { n as mergeRefs } from "../../refs.js";
4
4
  import { n as getAriaLabelAttributes } from "../../accessibility.js";
5
5
  import { n as HelpTriggerIconInternal } from "../../HelpTriggerIcon.js";
6
6
  import React from "react";
7
- import classNames from "classnames";
7
+ import cn from "classnames";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import styles from "./styles.module.scss";
10
10
  var HelpTriggerInline = React.forwardRef(({ ariaLabel, ariaLabelledById, children, className, testId, weight = "normal", ...rest }, ref) => {
@@ -12,7 +12,7 @@ var HelpTriggerInline = React.forwardRef(({ ariaLabel, ariaLabelledById, childre
12
12
  label: ariaLabel,
13
13
  id: ariaLabelledById
14
14
  });
15
- const helpTriggerInlineStyles = classNames(styles["help-trigger-inline"], className);
15
+ const helpTriggerInlineStyles = cn(styles["help-trigger-inline"], className);
16
16
  const { refObject, isHovered } = usePseudoClasses(ref);
17
17
  return /* @__PURE__ */ jsxs("button", {
18
18
  "aria-label": ariaLabel,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/HelpTriggerInline/HelpTriggerInline.tsx","../../../src/components/HelpTriggerInline/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport { HelpTriggerIconInternal, HelpTriggerWeights } from '../HelpTriggerIcon';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpTriggerInlineProps\n extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded'> {\n /**\n * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabel?: string;\n /**\n * Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabelledById?: string;\n /** Sets the text content of the HelpTriggerInline. */\n children: string;\n /**\n * Sets the colors of the help trigger. Default: normal.\n */\n weight?: HelpTriggerWeights;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Optional test id.\n */\n testId?: string;\n}\n\nconst HelpTriggerInline = React.forwardRef<HTMLButtonElement, HelpTriggerInlineProps>(\n ({ ariaLabel, ariaLabelledById, children, className, testId, weight = 'normal', ...rest }, ref) => {\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n const helpTriggerInlineStyles = classNames(styles['help-trigger-inline'], className);\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>);\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.HelpTriggerInline}\n className={helpTriggerInlineStyles}\n ref={mergeRefs([refObject, ref])}\n {...ariaLabelAttributes}\n {...rest}\n >\n <span className={styles['help-trigger-inline__text']}>{children}</span>\n <HelpTriggerIconInternal weight={weight} size={'inherit'} htmlMarkup={'span'} isHovered={isHovered} />\n </button>\n );\n }\n);\n\nHelpTriggerInline.displayName = 'HelpTriggerInline';\n\nexport default HelpTriggerInline;\n","import HelpTriggerInline from './HelpTriggerInline';\nexport * from './HelpTriggerInline';\nexport default HelpTriggerInline;\n"],"mappings":";;;;;;;;;AAsCA,IAAM,oBAAoB,MAAM,YAC7B,EAAE,WAAW,kBAAkB,UAAU,WAAW,QAAQ,SAAS,UAAU,GAAG,QAAQ,QAAQ;CACjG,MAAM,sBAAsB,uBAAuB;EAAE,OAAO;EAAW,IAAI;EAAkB,CAAC;CAC9F,MAAM,0BAA0B,WAAW,OAAO,wBAAwB,UAAU;CACpF,MAAM,EAAE,WAAW,cAAc,iBAAoC,IAA0C;AAE/G,QACE,qBAAC,UAAA;EACC,cAAY;EACZ,MAAK;EACL,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,KAAK,UAAU,CAAC,WAAW,IAAI,CAAC;EAChC,GAAI;EACJ,GAAI;aAEJ,oBAAC,QAAA;GAAK,WAAW,OAAO;GAA+B;IAAgB,EACvE,oBAAC,yBAAA;GAAgC;GAAQ,MAAM;GAAW,YAAY;GAAmB;IAAa,CAAA;GAC/F;EAGd;AAED,kBAAkB,cAAc;AC5DhC,IAAA,4BD8De"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/HelpTriggerInline/HelpTriggerInline.tsx","../../../src/components/HelpTriggerInline/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport { HelpTriggerIconInternal, HelpTriggerWeights } from '../HelpTriggerIcon';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpTriggerInlineProps\n extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded'> {\n /**\n * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabel?: string;\n /**\n * Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabelledById?: string;\n /** Sets the text content of the HelpTriggerInline. */\n children: string;\n /**\n * Sets the colors of the help trigger. Default: normal.\n */\n weight?: HelpTriggerWeights;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Optional test id.\n */\n testId?: string;\n}\n\nconst HelpTriggerInline = React.forwardRef<HTMLButtonElement, HelpTriggerInlineProps>(\n ({ ariaLabel, ariaLabelledById, children, className, testId, weight = 'normal', ...rest }, ref) => {\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n const helpTriggerInlineStyles = classNames(styles['help-trigger-inline'], className);\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>);\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.HelpTriggerInline}\n className={helpTriggerInlineStyles}\n ref={mergeRefs([refObject, ref])}\n {...ariaLabelAttributes}\n {...rest}\n >\n <span className={styles['help-trigger-inline__text']}>{children}</span>\n <HelpTriggerIconInternal weight={weight} size={'inherit'} htmlMarkup={'span'} isHovered={isHovered} />\n </button>\n );\n }\n);\n\nHelpTriggerInline.displayName = 'HelpTriggerInline';\n\nexport default HelpTriggerInline;\n","import HelpTriggerInline from './HelpTriggerInline';\nexport * from './HelpTriggerInline';\nexport default HelpTriggerInline;\n"],"mappings":";;;;;;;;;AAsCA,IAAM,oBAAoB,MAAM,YAC7B,EAAE,WAAW,kBAAkB,UAAU,WAAW,QAAQ,SAAS,UAAU,GAAG,QAAQ,QAAQ;CACjG,MAAM,sBAAsB,uBAAuB;EAAE,OAAO;EAAW,IAAI;EAAkB,CAAC;CAC9F,MAAM,0BAA0B,GAAW,OAAO,wBAAwB,UAAU;CACpF,MAAM,EAAE,WAAW,cAAc,iBAAoC,IAA0C;AAE/G,QACE,qBAAC,UAAA;EACC,cAAY;EACZ,MAAK;EACL,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,KAAK,UAAU,CAAC,WAAW,IAAI,CAAC;EAChC,GAAI;EACJ,GAAI;aAEJ,oBAAC,QAAA;GAAK,WAAW,OAAO;GAA+B;IAAgB,EACvE,oBAAC,yBAAA;GAAgC;GAAQ,MAAM;GAAW,YAAY;GAAmB;IAAa,CAAA;GAC/F;EAGd;AAED,kBAAkB,cAAc;AC5DhC,IAAA,4BD8De"}
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { FormOnColor, FormSize } from '../../constants';
3
+ import { HNDesignsystemInput } from '../../resources/Resources';
3
4
  import { ErrorWrapperClassNameProps } from '../ErrorWrapper';
4
5
  import { SvgIcon } from '../Icon';
5
6
  import { IconName } from '../Icons/IconNames';
@@ -44,8 +45,10 @@ export interface InputProps extends ErrorWrapperClassNameProps, Pick<React.Input
44
45
  rightOfInput?: React.ReactNode;
45
46
  /** max character limit in input */
46
47
  maxCharacters?: number;
47
- /** The text is displayed in the end of the text-counter */
48
+ /** @deprecated use resources instead. The text is displayed in the end of the text-counter */
48
49
  maxText?: string;
50
+ /** Resources for component */
51
+ resources?: Partial<HNDesignsystemInput>;
49
52
  }
50
53
  export declare enum InputTypes {
51
54
  text = "text",
@@ -41,7 +41,7 @@ import "../../useOutsideEvent.js";
41
41
  import "../../mobile.js";
42
42
  import "../../src.js";
43
43
  import "../../StatusDot.js";
44
- import "../../MaxCharacters.js";
45
44
  import { t as InputTypes } from "../../Input.js";
45
+ import "../../MaxCharacters.js";
46
46
  import { t as Input_default } from "../../Input2.js";
47
47
  export { InputTypes, Input_default as default };
@@ -0,0 +1,3 @@
1
+ import { LanguageLocales } from '../../constants';
2
+ import { HNDesignsystemInput } from '../../resources/Resources';
3
+ export declare const getResources: (language: LanguageLocales) => HNDesignsystemInput;
@@ -5,7 +5,7 @@ export type LabelText = {
5
5
  text: string;
6
6
  type?: 'normal' | 'subdued';
7
7
  };
8
- export type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p';
8
+ export type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p' | 'legend';
9
9
  export interface LabelProps {
10
10
  /** Component shown after label - discourage use of this */
11
11
  afterLabelChildren?: React.ReactNode;
@@ -43,6 +43,7 @@ export interface LinkListProps {
43
43
  type Modify<T, R> = Omit<T, keyof R> & R;
44
44
  export type LinkProps = Modify<React.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, {
45
45
  children: React.ReactNode;
46
+ /** @private Turns chevron icon on/off. Overwritten by LinkList so not possible to set on LinkList.Link */
46
47
  chevron?: boolean;
47
48
  className?: string;
48
49
  icon?: React.ReactElement;
@@ -54,10 +55,8 @@ export type LinkProps = Modify<React.HTMLAttributes<HTMLAnchorElement | HTMLButt
54
55
  target?: LinkAnchorTargets;
55
56
  /** HTML markup for link. Default: a */
56
57
  htmlMarkup?: LinkTags;
57
- /**
58
- * Ref for lenke/knapp
59
- */
60
- linkRef?: React.RefObject<HTMLButtonElement | HTMLAnchorElement>;
58
+ /** Ref for lenke/knapp */
59
+ linkRef?: React.RefObject<HTMLButtonElement | HTMLAnchorElement> | null;
61
60
  /** Sets the data-testid attribute. */
62
61
  testId?: string;
63
62
  /** Highlights text. Override if different from list */
@@ -66,6 +65,8 @@ export type LinkProps = Modify<React.HTMLAttributes<HTMLAnchorElement | HTMLButt
66
65
  resources?: Partial<HNDesignsystemLinkList>;
67
66
  /** @experimental id for content (only used in edit mode for aria-describedby) */
68
67
  contentId?: string;
68
+ /** Replaces the chevron with an arrow up right which is used for indicating external links */
69
+ external?: boolean;
69
70
  }> & Pick<LinkListProps, 'color' | 'size' | 'variant'> & ListEditModeItemProps;
70
71
  export declare const Link: LinkType;
71
72
  export declare const LinkList: CompoundComponent;
@@ -10,6 +10,7 @@ import "../../color.js";
10
10
  import "../../spacing.js";
11
11
  import "../../currys.js";
12
12
  import "../../Icon.js";
13
+ import "../../ArrowUpRight.js";
13
14
  import "../../language.js";
14
15
  import "../../Check.js";
15
16
  import "../../Avatar.js";
@@ -299,6 +299,7 @@
299
299
 
300
300
  &__status-marker {
301
301
  width: 6px;
302
+ margin-right: 2px;
302
303
  height: auto;
303
304
  background-color: transparent;
304
305
 
@@ -2,7 +2,7 @@ import { t as uuid } from "../../uuid.js";
2
2
  import "../../environment.js";
3
3
  import { c as ZIndex, n as AnalyticsId } from "../../constants2.js";
4
4
  import React, { useEffect, useRef, useState } from "react";
5
- import classNames from "classnames";
5
+ import cn from "classnames";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import loaderStyles from "./styles.module.scss";
8
8
  let Overlay = /* @__PURE__ */ function(Overlay$1) {
@@ -21,19 +21,19 @@ var Loader = (props) => {
21
21
  const isSmall = size === "small";
22
22
  const isMedium = size === "medium";
23
23
  const isLarge = size === "large";
24
- const loaderWrapperClasses = classNames({
24
+ const loaderWrapperClasses = cn({
25
25
  [loaderStyles["loader-wrapper--center"]]: center,
26
26
  [loaderStyles["loader-wrapper--overlay"]]: overlay,
27
27
  [loaderStyles["loader-wrapper--overlay-screen"]]: overlay === Overlay.screen,
28
28
  [loaderStyles["loader-wrapper--overlay-parent"]]: overlay === Overlay.parent && display,
29
29
  [loaderStyles["loader-wrapper--inline"]]: inline && display
30
30
  });
31
- const loaderClasses = classNames(loaderStyles.loader, {
31
+ const loaderClasses = cn(loaderStyles.loader, {
32
32
  [loaderStyles["loader--small"]]: isSmall,
33
33
  [loaderStyles["loader--medium"]]: isMedium,
34
34
  [loaderStyles["loader--large"]]: isLarge
35
35
  }, className);
36
- const loaderDotClasses = classNames(loaderStyles.loader__dot, {
36
+ const loaderDotClasses = cn(loaderStyles.loader__dot, {
37
37
  [loaderStyles["loader__dot--small"]]: isSmall,
38
38
  [loaderStyles["loader__dot--medium"]]: isMedium,
39
39
  [loaderStyles["loader__dot--large"]]: isLarge,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Loader: React.FC<LoaderProps>"],"sources":["../../../src/components/Loader/Loader.tsx","../../../src/components/Loader/index.ts"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\nimport { uuid } from '../../utils/uuid';\n\nimport loaderStyles from './styles.module.scss';\n\nexport type LoaderColors = PaletteNames;\nexport type LoaderSizes = 'tiny' | 'small' | 'medium' | 'large';\nexport enum Overlay {\n screen = 'screen',\n parent = 'parent',\n}\n\nexport interface LoaderProps {\n /** Sets the color of the loader. If overlay is used, the color will always be white. */\n color?: LoaderColors;\n /**\tAdds custom classes to the element. */\n className?: string;\n /** Changes the size of the loader. */\n size?: LoaderSizes;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** id of the label */\n labelId?: string;\n /** Centers the loader in a container */\n center?: boolean;\n /** Inline the loader so it can be used in a span or paragraph */\n inline?: boolean;\n /** Loader is displayed with grey background covering the entire screen */\n overlay?: keyof typeof Overlay;\n /** Individual id for loading icon (aria-labelledby). */\n ariaLabelledById?: string;\n /** String that labels the current loading element */\n ariaLabel?: string;\n}\n\nconst Loader: React.FC<LoaderProps> = props => {\n const {\n overlay,\n size = 'small',\n className = '',\n labelId = uuid(),\n testId,\n center,\n inline,\n ariaLabelledById,\n ariaLabel = 'Laster inn',\n } = props;\n const color = props.overlay ? 'white' : props.color || 'neutral';\n\n const showLoader = (): boolean => {\n if (overlay === Overlay.parent || inline) {\n return false;\n }\n\n return true;\n };\n\n const [display, setDisplay] = useState(showLoader());\n\n const isSmall = size === 'small';\n const isMedium = size === 'medium';\n const isLarge = size === 'large';\n\n const loaderWrapperClasses = classNames({\n [loaderStyles['loader-wrapper--center']]: center,\n [loaderStyles['loader-wrapper--overlay']]: overlay,\n [loaderStyles['loader-wrapper--overlay-screen']]: overlay === Overlay.screen,\n [loaderStyles['loader-wrapper--overlay-parent']]: overlay === Overlay.parent && display,\n [loaderStyles['loader-wrapper--inline']]: inline && display,\n });\n const loaderClasses = classNames(\n loaderStyles.loader,\n {\n [loaderStyles['loader--small']]: isSmall,\n [loaderStyles['loader--medium']]: isMedium,\n [loaderStyles['loader--large']]: isLarge,\n },\n className\n );\n const loaderDotClasses = classNames(loaderStyles.loader__dot, {\n [loaderStyles['loader__dot--small']]: isSmall,\n [loaderStyles['loader__dot--medium']]: isMedium,\n [loaderStyles['loader__dot--large']]: isLarge,\n [loaderStyles['loader__dot--banana']]: color === 'banana',\n [loaderStyles['loader__dot--cherry']]: color === 'cherry',\n [loaderStyles['loader__dot--kiwi']]: color === 'kiwi',\n [loaderStyles['loader__dot--neutral']]: color === 'neutral',\n [loaderStyles['loader__dot--plum']]: color === 'plum',\n [loaderStyles['loader__dot--black']]: color === 'black',\n [loaderStyles['loader__dot--white']]: color === 'white',\n });\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (overlay === Overlay.parent && wrapperRef.current?.parentElement?.style) {\n wrapperRef.current.parentElement.style.position = 'relative';\n setDisplay(true);\n }\n\n if (inline && wrapperRef.current?.parentElement?.style) {\n wrapperRef.current.parentElement.style.display = 'flex';\n setDisplay(true);\n }\n }, []);\n\n return (\n <div className={loaderWrapperClasses} ref={wrapperRef} style={overlay === Overlay.screen ? { zIndex: ZIndex.OverlayScreen } : {}}>\n {display && (\n <div\n data-testid={testId}\n data-analyticsid={AnalyticsId.Loader}\n role=\"progressbar\"\n aria-labelledby={ariaLabelledById || labelId}\n className={loaderClasses}\n >\n <div className={loaderDotClasses} />\n <div className={loaderDotClasses} />\n <div className={loaderDotClasses} />\n <div className={loaderDotClasses} />\n {!ariaLabelledById && (\n <span id={labelId} className={loaderStyles['loader__hidden-text']}>\n {ariaLabel}\n </span>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport default Loader;\n","import Loader from './Loader';\nexport * from './Loader';\nexport default Loader;\n"],"mappings":";;;;;;;AAYA,IAAY,UAAA,yBAAA,WAAL;AACL,WAAA,YAAA;AACA,WAAA,YAAA;;;AA0BF,IAAMA,UAAgC,UAAS;CAC7C,MAAM,EACJ,SACA,OAAO,SACP,YAAY,IACZ,UAAU,MAAM,EAChB,QACA,QACA,QACA,kBACA,YAAY,iBACV;CACJ,MAAM,QAAQ,MAAM,UAAU,UAAU,MAAM,SAAS;CAEvD,MAAM,mBAA4B;AAChC,MAAI,YAAY,QAAQ,UAAU,OAChC,QAAO;AAGT,SAAO;;CAGT,MAAM,CAAC,SAAS,cAAc,SAAS,YAAY,CAAC;CAEpD,MAAM,UAAU,SAAS;CACzB,MAAM,WAAW,SAAS;CAC1B,MAAM,UAAU,SAAS;CAEzB,MAAM,uBAAuB,WAAW;GACrC,aAAa,4BAA4B;GACzC,aAAa,6BAA6B;GAC1C,aAAa,oCAAoC,YAAY,QAAQ;GACrE,aAAa,oCAAoC,YAAY,QAAQ,UAAU;GAC/E,aAAa,4BAA4B,UAAU;EACrD,CAAC;CACF,MAAM,gBAAgB,WACpB,aAAa,QACb;GACG,aAAa,mBAAmB;GAChC,aAAa,oBAAoB;GACjC,aAAa,mBAAmB;EAClC,EACD,UACD;CACD,MAAM,mBAAmB,WAAW,aAAa,aAAa;GAC3D,aAAa,wBAAwB;GACrC,aAAa,yBAAyB;GACtC,aAAa,wBAAwB;GACrC,aAAa,yBAAyB,UAAU;GAChD,aAAa,yBAAyB,UAAU;GAChD,aAAa,uBAAuB,UAAU;GAC9C,aAAa,0BAA0B,UAAU;GACjD,aAAa,uBAAuB,UAAU;GAC9C,aAAa,wBAAwB,UAAU;GAC/C,aAAa,wBAAwB,UAAU;EACjD,CAAC;CAEF,MAAM,aAAa,OAAuB,KAAK;AAE/C,iBAAgB;AACd,MAAI,YAAY,QAAQ,UAAU,WAAW,SAAS,eAAe,OAAO;AAC1E,cAAW,QAAQ,cAAc,MAAM,WAAW;AAClD,cAAW,KAAK;;AAGlB,MAAI,UAAU,WAAW,SAAS,eAAe,OAAO;AACtD,cAAW,QAAQ,cAAc,MAAM,UAAU;AACjD,cAAW,KAAK;;IAEjB,EAAE,CAAC;AAEN,QACE,oBAAC,OAAA;EAAI,WAAW;EAAsB,KAAK;EAAY,OAAO,YAAY,QAAQ,SAAS,EAAE,QAAQ,OAAO,eAAe,GAAG,EAAE;YAC7H,WACC,qBAAC,OAAA;GACC,eAAa;GACb,oBAAkB,YAAY;GAC9B,MAAK;GACL,mBAAiB,oBAAoB;GACrC,WAAW;;IAEX,oBAAC,OAAA,EAAI,WAAW,kBAAA,CAAoB;IACpC,oBAAC,OAAA,EAAI,WAAW,kBAAA,CAAoB;IACpC,oBAAC,OAAA,EAAI,WAAW,kBAAA,CAAoB;IACpC,oBAAC,OAAA,EAAI,WAAW,kBAAA,CAAoB;IACnC,CAAC,oBACA,oBAAC,QAAA;KAAK,IAAI;KAAS,WAAW,aAAa;eACxC;MACI;;IAEL;GAEJ;;AClIV,IAAA,iBDsIe"}
1
+ {"version":3,"file":"index.js","names":["Loader: React.FC<LoaderProps>"],"sources":["../../../src/components/Loader/Loader.tsx","../../../src/components/Loader/index.ts"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\nimport { uuid } from '../../utils/uuid';\n\nimport loaderStyles from './styles.module.scss';\n\nexport type LoaderColors = PaletteNames;\nexport type LoaderSizes = 'tiny' | 'small' | 'medium' | 'large';\nexport enum Overlay {\n screen = 'screen',\n parent = 'parent',\n}\n\nexport interface LoaderProps {\n /** Sets the color of the loader. If overlay is used, the color will always be white. */\n color?: LoaderColors;\n /**\tAdds custom classes to the element. */\n className?: string;\n /** Changes the size of the loader. */\n size?: LoaderSizes;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** id of the label */\n labelId?: string;\n /** Centers the loader in a container */\n center?: boolean;\n /** Inline the loader so it can be used in a span or paragraph */\n inline?: boolean;\n /** Loader is displayed with grey background covering the entire screen */\n overlay?: keyof typeof Overlay;\n /** Individual id for loading icon (aria-labelledby). */\n ariaLabelledById?: string;\n /** String that labels the current loading element */\n ariaLabel?: string;\n}\n\nconst Loader: React.FC<LoaderProps> = props => {\n const {\n overlay,\n size = 'small',\n className = '',\n labelId = uuid(),\n testId,\n center,\n inline,\n ariaLabelledById,\n ariaLabel = 'Laster inn',\n } = props;\n const color = props.overlay ? 'white' : props.color || 'neutral';\n\n const showLoader = (): boolean => {\n if (overlay === Overlay.parent || inline) {\n return false;\n }\n\n return true;\n };\n\n const [display, setDisplay] = useState(showLoader());\n\n const isSmall = size === 'small';\n const isMedium = size === 'medium';\n const isLarge = size === 'large';\n\n const loaderWrapperClasses = classNames({\n [loaderStyles['loader-wrapper--center']]: center,\n [loaderStyles['loader-wrapper--overlay']]: overlay,\n [loaderStyles['loader-wrapper--overlay-screen']]: overlay === Overlay.screen,\n [loaderStyles['loader-wrapper--overlay-parent']]: overlay === Overlay.parent && display,\n [loaderStyles['loader-wrapper--inline']]: inline && display,\n });\n const loaderClasses = classNames(\n loaderStyles.loader,\n {\n [loaderStyles['loader--small']]: isSmall,\n [loaderStyles['loader--medium']]: isMedium,\n [loaderStyles['loader--large']]: isLarge,\n },\n className\n );\n const loaderDotClasses = classNames(loaderStyles.loader__dot, {\n [loaderStyles['loader__dot--small']]: isSmall,\n [loaderStyles['loader__dot--medium']]: isMedium,\n [loaderStyles['loader__dot--large']]: isLarge,\n [loaderStyles['loader__dot--banana']]: color === 'banana',\n [loaderStyles['loader__dot--cherry']]: color === 'cherry',\n [loaderStyles['loader__dot--kiwi']]: color === 'kiwi',\n [loaderStyles['loader__dot--neutral']]: color === 'neutral',\n [loaderStyles['loader__dot--plum']]: color === 'plum',\n [loaderStyles['loader__dot--black']]: color === 'black',\n [loaderStyles['loader__dot--white']]: color === 'white',\n });\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (overlay === Overlay.parent && wrapperRef.current?.parentElement?.style) {\n wrapperRef.current.parentElement.style.position = 'relative';\n setDisplay(true);\n }\n\n if (inline && wrapperRef.current?.parentElement?.style) {\n wrapperRef.current.parentElement.style.display = 'flex';\n setDisplay(true);\n }\n }, []);\n\n return (\n <div className={loaderWrapperClasses} ref={wrapperRef} style={overlay === Overlay.screen ? { zIndex: ZIndex.OverlayScreen } : {}}>\n {display && (\n <div\n data-testid={testId}\n data-analyticsid={AnalyticsId.Loader}\n role=\"progressbar\"\n aria-labelledby={ariaLabelledById || labelId}\n className={loaderClasses}\n >\n <div className={loaderDotClasses} />\n <div className={loaderDotClasses} />\n <div className={loaderDotClasses} />\n <div className={loaderDotClasses} />\n {!ariaLabelledById && (\n <span id={labelId} className={loaderStyles['loader__hidden-text']}>\n {ariaLabel}\n </span>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport default Loader;\n","import Loader from './Loader';\nexport * from './Loader';\nexport default Loader;\n"],"mappings":";;;;;;;AAYA,IAAY,UAAA,yBAAA,WAAL;AACL,WAAA,YAAA;AACA,WAAA,YAAA;;;AA0BF,IAAMA,UAAgC,UAAS;CAC7C,MAAM,EACJ,SACA,OAAO,SACP,YAAY,IACZ,UAAU,MAAM,EAChB,QACA,QACA,QACA,kBACA,YAAY,iBACV;CACJ,MAAM,QAAQ,MAAM,UAAU,UAAU,MAAM,SAAS;CAEvD,MAAM,mBAA4B;AAChC,MAAI,YAAY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iB,oBAAoB;GACrC,WAAW;;IAEX,oBAAC,OAAA,EAAI,WAAW,kBAAA,CAAoB;IACpC,oBAAC,OAAA,EAAI,WAAW,kBAAA,CAAoB;IACpC,oBAAC,OAAA,EAAI,WAAW,kBAAA,CAAoB;IACpC,oBAAC,OAAA,EAAI,WAAW,kBAAA,CAAoB;IACnC,CAAC,oBACA,oBAAC,QAAA;KAAK,IAAI;KAAS,WAAW,aAAa;eACxC;MACI;;IAEL;GAEJ;;AClIV,IAAA,iBDsIe"}
@@ -6,7 +6,7 @@ interface MaxCharactersProps {
6
6
  /** max character limit in textarea */
7
7
  maxCharacters: number;
8
8
  /** The text is displayed in the end of the text-counter */
9
- maxText?: string;
9
+ maxText: string;
10
10
  /** Changes the visuals of the textarea */
11
11
  onColor?: keyof typeof FormOnColor;
12
12
  /** Max width of the component */
@@ -36,7 +36,7 @@ import { t as AlertSignStroke_default } from "../../AlertSignStroke.js";
36
36
  import { t as CheckOutline_default } from "../../CheckOutline.js";
37
37
  import { t as Portal } from "../../Portal.js";
38
38
  import React, { useEffect } from "react";
39
- import classNames from "classnames";
39
+ import cn from "classnames";
40
40
  import { jsx, jsxs } from "react/jsx-runtime";
41
41
  import styles from "./styles.module.scss";
42
42
  let ModalVariants = /* @__PURE__ */ function(ModalVariants$1) {
@@ -129,8 +129,8 @@ var Modal = (props) => {
129
129
  useEffect(() => {
130
130
  dialogRef.current?.focus();
131
131
  }, []);
132
- const dialogClasses = classNames(className, styles.modal, variant && styles[`modal--${variant}`], size && styles[`modal--${size}`], contentIsScrollable && !showActions && styles["modal--no-actions"]);
133
- const titleClasses = classNames({
132
+ const dialogClasses = cn(className, styles.modal, variant && styles[`modal--${variant}`], size && styles[`modal--${size}`], contentIsScrollable && !showActions && styles["modal--no-actions"]);
133
+ const titleClasses = cn({
134
134
  [styles["modal__title--error"]]: variant === ModalVariants.error,
135
135
  [styles["modal__title--success"]]: variant === ModalVariants.success
136
136
  });
@@ -152,9 +152,9 @@ var Modal = (props) => {
152
152
  ...ariaLabelAttributes,
153
153
  ref: dialogRef,
154
154
  children: [
155
- /* @__PURE__ */ jsx("div", { className: classNames(styles["modal__shadow"], styles["modal__shadow--top"], { [styles["modal__shadow--show"]]: !topContentVisible && contentIsScrollable }) }),
155
+ /* @__PURE__ */ jsx("div", { className: cn(styles["modal__shadow"], styles["modal__shadow--top"], { [styles["modal__shadow--show"]]: !topContentVisible && contentIsScrollable }) }),
156
156
  /* @__PURE__ */ jsxs("div", {
157
- className: classNames(styles.modal__contentWrapper),
157
+ className: cn(styles.modal__contentWrapper),
158
158
  tabIndex: contentIsScrollable ? 0 : void 0,
159
159
  role: contentIsScrollable ? "region" : void 0,
160
160
  ...contentIsScrollable ? ariaLabelAttributes : {},
@@ -162,14 +162,14 @@ var Modal = (props) => {
162
162
  children: [!props.noCloseButton && /* @__PURE__ */ jsx("div", {
163
163
  className: styles.modal__closeWrapper,
164
164
  children: /* @__PURE__ */ jsx("div", {
165
- className: classNames(styles.modal__closeWrapper__close),
165
+ className: cn(styles.modal__closeWrapper__close),
166
166
  children: /* @__PURE__ */ jsx(Close_default, {
167
167
  onClick: props.onClose,
168
168
  ariaLabel: props.ariaLabelCloseBtn
169
169
  })
170
170
  })
171
171
  }), /* @__PURE__ */ jsxs("div", {
172
- className: classNames(size && styles[`modal__contentWrapper__scroll--${size}`]),
172
+ className: cn(size && styles[`modal__contentWrapper__scroll--${size}`]),
173
173
  children: [
174
174
  /* @__PURE__ */ jsx("div", { ref: topContent }),
175
175
  /* @__PURE__ */ jsxs("div", {
@@ -198,9 +198,9 @@ var Modal = (props) => {
198
198
  ]
199
199
  })]
200
200
  }),
201
- /* @__PURE__ */ jsx("div", { className: classNames(styles["modal__shadow"], styles["modal__shadow--bottom"], { [styles["modal__shadow--show"]]: !bottomContentVisible && contentIsScrollable }) }),
201
+ /* @__PURE__ */ jsx("div", { className: cn(styles["modal__shadow"], styles["modal__shadow--bottom"], { [styles["modal__shadow--show"]]: !bottomContentVisible && contentIsScrollable }) }),
202
202
  showActions && /* @__PURE__ */ jsxs("div", {
203
- className: classNames(styles["modal__call-to-action"], size && styles[`modal__call-to-action--${size}`]),
203
+ className: cn(styles["modal__call-to-action"], size && styles[`modal__call-to-action--${size}`]),
204
204
  children: [
205
205
  props.onSuccess && primaryButtonText && /* @__PURE__ */ jsx(Button_default, {
206
206
  onClick: props.onSuccess,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Modal: React.FC<ModalProps>"],"sources":["../../../src/components/Modal/Modal.tsx","../../../src/components/Modal/index.ts"],"sourcesContent":["import React, { useEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useReturnFocusOnUnmount } from '../../hooks/useReturnFocusOnUnmount';\nimport { palette } from '../../theme/palette';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { disableBodyScroll, enableBodyScroll } from '../../utils/scroll';\nimport { uuid } from '../../utils/uuid';\nimport Button from '../Button';\nimport Close from '../Close';\nimport Icon, { IconSize } from '../Icon';\nimport AlertSignFill from '../Icons/AlertSignFill';\nimport AlertSignStroke from '../Icons/AlertSignStroke';\nimport CheckOutline from '../Icons/CheckOutline';\nimport Portal from '../Portal';\nimport Title from '../Title/Title';\n\nimport styles from './styles.module.scss';\n\nexport enum ModalVariants {\n normal = 'normal',\n warning = 'warning',\n error = 'error',\n success = 'success',\n}\n\nexport enum ModalSize {\n large = 'large',\n medium = 'medium',\n}\n\nexport interface ModalProps {\n /** Title of the modal */\n title: string;\n /** id of the modal title */\n titleId?: string;\n /** Description of the modal. Will not render if the modal has children. */\n description?: string;\n /** Optional footer content that can be rendered instead of default CTA(s) */\n footerContent?: React.ReactNode;\n /** Changes the visual representation of the modal */\n variant?: keyof typeof ModalVariants;\n /** Change width of the modal (default: large) */\n size?: keyof typeof ModalSize;\n /** Icon displayed in title */\n icon?: React.ReactElement;\n /** Hides the close button */\n noCloseButton?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Primary button text */\n primaryButtonText?: string;\n /** Secondary button text */\n secondaryButtonText?: string;\n /** Sets the aria-label of the modal */\n ariaLabel?: string;\n /** Sets the aria-labelledby of the modal */\n ariaLabelledBy?: string;\n /** Close button aria-label */\n ariaLabelCloseBtn?: string;\n /** Alternative component to modal */\n children?: React.ReactNode;\n /** Component shown after title */\n afterTitleChildren?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Customize the z-index of the modal */\n zIndex?: number;\n /** Function is called when user clicks primary button */\n onSuccess?: () => void;\n /** Function is called when user clicks secondary button, clicks escape or outside the modal */\n onClose?: () => void;\n /** When enabled the component will be rendered in the bottom of document.body */\n printable?: boolean;\n /** If disabled, clicking escape or outside the modal will not close it */\n disableCloseEvents?: boolean;\n /** Aria role used for the Modal. Default is dialog */\n role?: 'dialog' | 'alertdialog';\n}\n\nconst getVariantIcon = (variant?: ModalProps['variant']): JSX.Element | null => {\n if (variant === ModalVariants.error) {\n return <Icon size={IconSize.Small} svgIcon={AlertSignFill} color={palette.cherry500} />;\n } else if (variant === ModalVariants.warning) {\n return <Icon size={IconSize.Small} svgIcon={AlertSignStroke} color={palette.black} />;\n } else if (variant === ModalVariants.success) {\n return <Icon size={IconSize.Small} svgIcon={CheckOutline} color={palette.kiwi900} />;\n }\n return null;\n};\n\nconst getIcon = (variant?: ModalProps['variant'], icon?: ModalProps['icon']): JSX.Element | null => {\n const variantIcon = getVariantIcon(variant);\n if (variantIcon) {\n return <div className={styles.modal__iconWrapper}>{variantIcon}</div>;\n }\n if (icon) {\n return (\n <div className={styles.modal__iconWrapper}>\n {React.cloneElement(icon, {\n size: IconSize.Small,\n })}\n </div>\n );\n }\n return null;\n};\n\nconst Modal: React.FC<ModalProps> = props => {\n const {\n footerContent,\n variant = ModalVariants.normal,\n primaryButtonText = 'OK',\n titleId = uuid(),\n className = '',\n size = ModalSize.large,\n zIndex = ZIndex.OverlayScreen,\n role = 'dialog',\n } = props;\n\n const topContent = React.useRef<HTMLDivElement>(null);\n const modalContentRef = React.useRef<HTMLDivElement>(null);\n const dialogRef = React.useRef<HTMLDivElement>(null);\n useFocusTrap(dialogRef, true);\n const topContentVisible = useIsVisible(topContent);\n const bottomContent = React.useRef<HTMLDivElement>(null);\n const bottomContentVisible = useIsVisible(bottomContent);\n const contentIsScrollable = modalContentRef.current && modalContentRef.current.scrollHeight > modalContentRef.current.clientHeight;\n useReturnFocusOnUnmount(dialogRef);\n\n function handleKeyboardEvent(e: KeyboardEvent): void {\n if (e.key === 'Escape' && props.onClose) {\n e.stopPropagation();\n props.onClose();\n }\n }\n\n function handleClickEvent(event: MouseEvent): void {\n if (event.target && overlayRef.current === event.target && props.onClose) {\n event.stopPropagation();\n props.onClose();\n }\n }\n\n const overlayRef = React.useRef<HTMLDivElement>(null);\n\n const showActions = (props.secondaryButtonText && props.secondaryButtonText?.length > 0) || props.onSuccess || footerContent;\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: props.ariaLabel, id: props.ariaLabelledBy, fallbackId: titleId });\n\n useEffect(() => {\n const overlayElement = overlayRef.current;\n disableBodyScroll();\n if (!props.disableCloseEvents && overlayElement) {\n overlayElement.addEventListener('keydown', handleKeyboardEvent);\n overlayElement.addEventListener('click', handleClickEvent);\n }\n return (): void => {\n enableBodyScroll();\n if (!props.disableCloseEvents && overlayElement) {\n overlayElement.removeEventListener('keydown', handleKeyboardEvent);\n overlayElement.removeEventListener('click', handleClickEvent);\n }\n };\n }, [props.disableCloseEvents]);\n\n useEffect(() => {\n dialogRef.current?.focus();\n }, []);\n\n const dialogClasses = cn(\n className,\n styles.modal,\n variant && styles[`modal--${variant}`],\n size && styles[`modal--${size}`],\n contentIsScrollable && !showActions && styles['modal--no-actions']\n );\n\n const titleClasses = cn({\n [styles['modal__title--error']]: variant === ModalVariants.error,\n [styles['modal__title--success']]: variant === ModalVariants.success,\n });\n\n const Component = (\n <div data-testid=\"dialog-container\">\n <div\n ref={overlayRef}\n className={styles['modal-overlay']}\n data-testid={props.testId}\n data-analyticsid={AnalyticsId.Modal}\n style={{ zIndex }}\n >\n <div className={styles.align}>\n <div className={dialogClasses} role={role} aria-modal=\"true\" tabIndex={-1} {...ariaLabelAttributes} ref={dialogRef}>\n <div\n className={cn(styles['modal__shadow'], styles['modal__shadow--top'], {\n [styles['modal__shadow--show']]: !topContentVisible && contentIsScrollable,\n })}\n />\n <div\n className={cn(styles.modal__contentWrapper)}\n tabIndex={contentIsScrollable ? 0 : undefined}\n role={contentIsScrollable ? 'region' : undefined}\n {...(contentIsScrollable ? ariaLabelAttributes : {})}\n ref={modalContentRef}\n >\n {!props.noCloseButton && (\n <div className={styles.modal__closeWrapper}>\n <div className={cn(styles.modal__closeWrapper__close)}>\n <Close onClick={props.onClose} ariaLabel={props.ariaLabelCloseBtn} />\n </div>\n </div>\n )}\n <div className={cn(size && styles[`modal__contentWrapper__scroll--${size}`])}>\n <div ref={topContent} />\n <div className={styles.modal__contentWrapper__title}>\n {getIcon(variant, props.icon)}\n <Title id={ariaLabelAttributes?.['aria-labelledby']} htmlMarkup=\"h3\" appearance=\"title3\" className={titleClasses}>\n {props.title}\n </Title>\n {props.afterTitleChildren && <div className={styles['modal__afterTitleChildren']}>{props.afterTitleChildren}</div>}\n </div>\n {props.children && <div>{props.children}</div>}\n {!props.children && <p className={styles.modal__description}>{props.description}</p>}\n <div ref={bottomContent} />\n </div>\n </div>\n <div\n className={cn(styles['modal__shadow'], styles['modal__shadow--bottom'], {\n [styles['modal__shadow--show']]: !bottomContentVisible && contentIsScrollable,\n })}\n />\n {showActions && (\n <div className={cn(styles['modal__call-to-action'], size && styles[`modal__call-to-action--${size}`])}>\n {props.onSuccess && primaryButtonText && <Button onClick={props.onSuccess}>{primaryButtonText}</Button>}\n {props.secondaryButtonText && props.secondaryButtonText?.length > 0 && (\n <Button variant=\"borderless\" onClick={props.onClose}>\n {props.secondaryButtonText}\n </Button>\n )}\n {footerContent}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n\n if (props.printable) {\n const printModal = 'print-modal';\n return (\n <Portal className={printModal} testId=\"print-modal\">\n <style media=\"print\">{`body > *:not(.${printModal}) {display: none;}`}</style>\n {Component}\n </Portal>\n );\n }\n\n return Component;\n};\n\nexport default Modal;\n","import Modal from './Modal';\nexport * from './Modal';\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAY,gBAAA,yBAAA,iBAAL;AACL,iBAAA,YAAA;AACA,iBAAA,aAAA;AACA,iBAAA,WAAA;AACA,iBAAA,aAAA;;;AAGF,IAAY,YAAA,yBAAA,aAAL;AACL,aAAA,WAAA;AACA,aAAA,YAAA;;;AAoDF,IAAM,kBAAkB,YAAwD;AAC9E,KAAI,YAAY,cAAc,MAC5B,QAAO,oBAAC,cAAA;EAAK,MAAM,SAAS;EAAO,SAAS;EAAe,OAAO,QAAQ;GAAa;UAC9E,YAAY,cAAc,QACnC,QAAO,oBAAC,cAAA;EAAK,MAAM,SAAS;EAAO,SAAS;EAAiB,OAAO,QAAQ;GAAS;UAC5E,YAAY,cAAc,QACnC,QAAO,oBAAC,cAAA;EAAK,MAAM,SAAS;EAAO,SAAS;EAAc,OAAO,QAAQ;GAAW;AAEtF,QAAO;;AAGT,IAAM,WAAW,SAAiC,SAAkD;CAClG,MAAM,cAAc,eAAe,QAAQ;AAC3C,KAAI,YACF,QAAO,oBAAC,OAAA;EAAI,WAAW,OAAO;YAAqB;GAAkB;AAEvE,KAAI,KACF,QACE,oBAAC,OAAA;EAAI,WAAW,OAAO;YACpB,MAAM,aAAa,MAAM,EACxB,MAAM,SAAS,OAChB,CAAC;GACE;AAGV,QAAO;;AAGT,IAAMA,SAA8B,UAAS;CAC3C,MAAM,EACJ,eACA,UAAU,cAAc,QACxB,oBAAoB,MACpB,UAAU,MAAM,EAChB,YAAY,IACZ,OAAO,UAAU,OACjB,SAAS,O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;aACD;WACP,MAAM,sBAAsB,oBAAC,OAAA;YAAI,WAAW,OAAO;sBAA+B,MAAM;aAAyB;;WAC9G;SACL,MAAM,YAAY,oBAAC,OAAA,EAAA,UAAK,MAAM,UAAA,CAAe;SAC7C,CAAC,MAAM,YAAY,oBAAC,KAAA;UAAE,WAAW,OAAO;oBAAqB,MAAM;WAAgB;SACpF,oBAAC,OAAA,EAAI,KAAK,eAAA,CAAiB;;SACvB,CAAA;QACF;MACN,oBAAC,OAAA,EACC,WAAW,WAAG,OAAO,kBAAkB,OAAO,0BAA0B,GACrE,OAAO,yBAAyB,CAAC,wBAAwB,qBAC3D,CAAC,EAAA,CACF;MACD,eACC,qBAAC,OAAA;OAAI,WAAW,WAAG,OAAO,0BAA0B,QAAQ,OAAO,0BAA0B,QAAQ;;QAClG,MAAM,aAAa,qBAAqB,oBAAC,gBAAA;SAAO,SAAS,MAAM;mBAAY;UAA2B;QACtG,MAAM,uBAAuB,MAAM,qBAAqB,SAAS,KAChE,oBAAC,gBAAA;SAAO,SAAQ;SAAa,SAAS,MAAM;mBACzC,MAAM;UACA;QAEV;;QACG;;MAEJ;KACF;IACF;GACF;AAGR,KAAI,MAAM,WAAW;EACnB,MAAM,aAAa;AACnB,SACE,qBAAC,QAAA;GAAO,WAAW;GAAY,QAAO;cACpC,oBAAC,SAAA;IAAM,OAAM;cAAS,iBAAiB,WAAW;KAA4B,EAC7E,UAAA;IACM;;AAIb,QAAO;;ACrQT,IAAA,gBDwQe"}
1
+ {"version":3,"file":"index.js","names":["Modal: React.FC<ModalProps>"],"sources":["../../../src/components/Modal/Modal.tsx","../../../src/components/Modal/index.ts"],"sourcesContent":["import React, { useEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useReturnFocusOnUnmount } from '../../hooks/useReturnFocusOnUnmount';\nimport { palette } from '../../theme/palette';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { disableBodyScroll, enableBodyScroll } from '../../utils/scroll';\nimport { uuid } from '../../utils/uuid';\nimport Button from '../Button';\nimport Close from '../Close';\nimport Icon, { IconSize } from '../Icon';\nimport AlertSignFill from '../Icons/AlertSignFill';\nimport AlertSignStroke from '../Icons/AlertSignStroke';\nimport CheckOutline from '../Icons/CheckOutline';\nimport Portal from '../Portal';\nimport Title from '../Title/Title';\n\nimport styles from './styles.module.scss';\n\nexport enum ModalVariants {\n normal = 'normal',\n warning = 'warning',\n error = 'error',\n success = 'success',\n}\n\nexport enum ModalSize {\n large = 'large',\n medium = 'medium',\n}\n\nexport interface ModalProps {\n /** Title of the modal */\n title: string;\n /** id of the modal title */\n titleId?: string;\n /** Description of the modal. Will not render if the modal has children. */\n description?: string;\n /** Optional footer content that can be rendered instead of default CTA(s) */\n footerContent?: React.ReactNode;\n /** Changes the visual representation of the modal */\n variant?: keyof typeof ModalVariants;\n /** Change width of the modal (default: large) */\n size?: keyof typeof ModalSize;\n /** Icon displayed in title */\n icon?: React.ReactElement;\n /** Hides the close button */\n noCloseButton?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Primary button text */\n primaryButtonText?: string;\n /** Secondary button text */\n secondaryButtonText?: string;\n /** Sets the aria-label of the modal */\n ariaLabel?: string;\n /** Sets the aria-labelledby of the modal */\n ariaLabelledBy?: string;\n /** Close button aria-label */\n ariaLabelCloseBtn?: string;\n /** Alternative component to modal */\n children?: React.ReactNode;\n /** Component shown after title */\n afterTitleChildren?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Customize the z-index of the modal */\n zIndex?: number;\n /** Function is called when user clicks primary button */\n onSuccess?: () => void;\n /** Function is called when user clicks secondary button, clicks escape or outside the modal */\n onClose?: () => void;\n /** When enabled the component will be rendered in the bottom of document.body */\n printable?: boolean;\n /** If disabled, clicking escape or outside the modal will not close it */\n disableCloseEvents?: boolean;\n /** Aria role used for the Modal. Default is dialog */\n role?: 'dialog' | 'alertdialog';\n}\n\nconst getVariantIcon = (variant?: ModalProps['variant']): JSX.Element | null => {\n if (variant === ModalVariants.error) {\n return <Icon size={IconSize.Small} svgIcon={AlertSignFill} color={palette.cherry500} />;\n } else if (variant === ModalVariants.warning) {\n return <Icon size={IconSize.Small} svgIcon={AlertSignStroke} color={palette.black} />;\n } else if (variant === ModalVariants.success) {\n return <Icon size={IconSize.Small} svgIcon={CheckOutline} color={palette.kiwi900} />;\n }\n return null;\n};\n\nconst getIcon = (variant?: ModalProps['variant'], icon?: ModalProps['icon']): JSX.Element | null => {\n const variantIcon = getVariantIcon(variant);\n if (variantIcon) {\n return <div className={styles.modal__iconWrapper}>{variantIcon}</div>;\n }\n if (icon) {\n return (\n <div className={styles.modal__iconWrapper}>\n {React.cloneElement(icon, {\n size: IconSize.Small,\n })}\n </div>\n );\n }\n return null;\n};\n\nconst Modal: React.FC<ModalProps> = props => {\n const {\n footerContent,\n variant = ModalVariants.normal,\n primaryButtonText = 'OK',\n titleId = uuid(),\n className = '',\n size = ModalSize.large,\n zIndex = ZIndex.OverlayScreen,\n role = 'dialog',\n } = props;\n\n const topContent = React.useRef<HTMLDivElement>(null);\n const modalContentRef = React.useRef<HTMLDivElement>(null);\n const dialogRef = React.useRef<HTMLDivElement>(null);\n useFocusTrap(dialogRef, true);\n const topContentVisible = useIsVisible(topContent);\n const bottomContent = React.useRef<HTMLDivElement>(null);\n const bottomContentVisible = useIsVisible(bottomContent);\n const contentIsScrollable = modalContentRef.current && modalContentRef.current.scrollHeight > modalContentRef.current.clientHeight;\n useReturnFocusOnUnmount(dialogRef);\n\n function handleKeyboardEvent(e: KeyboardEvent): void {\n if (e.key === 'Escape' && props.onClose) {\n e.stopPropagation();\n props.onClose();\n }\n }\n\n function handleClickEvent(event: MouseEvent): void {\n if (event.target && overlayRef.current === event.target && props.onClose) {\n event.stopPropagation();\n props.onClose();\n }\n }\n\n const overlayRef = React.useRef<HTMLDivElement>(null);\n\n const showActions = (props.secondaryButtonText && props.secondaryButtonText?.length > 0) || props.onSuccess || footerContent;\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: props.ariaLabel, id: props.ariaLabelledBy, fallbackId: titleId });\n\n useEffect(() => {\n const overlayElement = overlayRef.current;\n disableBodyScroll();\n if (!props.disableCloseEvents && overlayElement) {\n overlayElement.addEventListener('keydown', handleKeyboardEvent);\n overlayElement.addEventListener('click', handleClickEvent);\n }\n return (): void => {\n enableBodyScroll();\n if (!props.disableCloseEvents && overlayElement) {\n overlayElement.removeEventListener('keydown', handleKeyboardEvent);\n overlayElement.removeEventListener('click', handleClickEvent);\n }\n };\n }, [props.disableCloseEvents]);\n\n useEffect(() => {\n dialogRef.current?.focus();\n }, []);\n\n const dialogClasses = cn(\n className,\n styles.modal,\n variant && styles[`modal--${variant}`],\n size && styles[`modal--${size}`],\n contentIsScrollable && !showActions && styles['modal--no-actions']\n );\n\n const titleClasses = cn({\n [styles['modal__title--error']]: variant === ModalVariants.error,\n [styles['modal__title--success']]: variant === ModalVariants.success,\n });\n\n const Component = (\n <div data-testid=\"dialog-container\">\n <div\n ref={overlayRef}\n className={styles['modal-overlay']}\n data-testid={props.testId}\n data-analyticsid={AnalyticsId.Modal}\n style={{ zIndex }}\n >\n <div className={styles.align}>\n <div className={dialogClasses} role={role} aria-modal=\"true\" tabIndex={-1} {...ariaLabelAttributes} ref={dialogRef}>\n <div\n className={cn(styles['modal__shadow'], styles['modal__shadow--top'], {\n [styles['modal__shadow--show']]: !topContentVisible && contentIsScrollable,\n })}\n />\n <div\n className={cn(styles.modal__contentWrapper)}\n tabIndex={contentIsScrollable ? 0 : undefined}\n role={contentIsScrollable ? 'region' : undefined}\n {...(contentIsScrollable ? ariaLabelAttributes : {})}\n ref={modalContentRef}\n >\n {!props.noCloseButton && (\n <div className={styles.modal__closeWrapper}>\n <div className={cn(styles.modal__closeWrapper__close)}>\n <Close onClick={props.onClose} ariaLabel={props.ariaLabelCloseBtn} />\n </div>\n </div>\n )}\n <div className={cn(size && styles[`modal__contentWrapper__scroll--${size}`])}>\n <div ref={topContent} />\n <div className={styles.modal__contentWrapper__title}>\n {getIcon(variant, props.icon)}\n <Title id={ariaLabelAttributes?.['aria-labelledby']} htmlMarkup=\"h3\" appearance=\"title3\" className={titleClasses}>\n {props.title}\n </Title>\n {props.afterTitleChildren && <div className={styles['modal__afterTitleChildren']}>{props.afterTitleChildren}</div>}\n </div>\n {props.children && <div>{props.children}</div>}\n {!props.children && <p className={styles.modal__description}>{props.description}</p>}\n <div ref={bottomContent} />\n </div>\n </div>\n <div\n className={cn(styles['modal__shadow'], styles['modal__shadow--bottom'], {\n [styles['modal__shadow--show']]: !bottomContentVisible && contentIsScrollable,\n })}\n />\n {showActions && (\n <div className={cn(styles['modal__call-to-action'], size && styles[`modal__call-to-action--${size}`])}>\n {props.onSuccess && primaryButtonText && <Button onClick={props.onSuccess}>{primaryButtonText}</Button>}\n {props.secondaryButtonText && props.secondaryButtonText?.length > 0 && (\n <Button variant=\"borderless\" onClick={props.onClose}>\n {props.secondaryButtonText}\n </Button>\n )}\n {footerContent}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n\n if (props.printable) {\n const printModal = 'print-modal';\n return (\n <Portal className={printModal} testId=\"print-modal\">\n <style media=\"print\">{`body > *:not(.${printModal}) {display: none;}`}</style>\n {Component}\n </Portal>\n );\n }\n\n return Component;\n};\n\nexport default Modal;\n","import Modal from './Modal';\nexport * from './Modal';\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAY,gBAAA,yBAAA,iBAAL;AACL,iBAAA,YAAA;AACA,iBAAA,aAAA;AACA,iBAAA,WAAA;AACA,iBAAA,aAAA;;;AAGF,IAAY,YAAA,yBAAA,aAAL;AACL,aAAA,WAAA;AACA,aAAA,YAAA;;;AAoDF,IAAM,kBAAkB,YAAwD;AAC9E,KAAI,YAAY,cAAc,MAC5B,QAAO,oBAAC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mBAAY;UAA2B;QACtG,MAAM,uBAAuB,MAAM,qBAAqB,SAAS,KAChE,oBAAC,gBAAA;SAAO,SAAQ;SAAa,SAAS,MAAM;mBACzC,MAAM;UACA;QAEV;;QACG;;MAEJ;KACF;IACF;GACF;AAGR,KAAI,MAAM,WAAW;EACnB,MAAM,aAAa;AACnB,SACE,qBAAC,QAAA;GAAO,WAAW;GAAY,QAAO;cACpC,oBAAC,SAAA;IAAM,OAAM;cAAS,iBAAiB,WAAW;KAA4B,EAC7E,UAAA;IACM;;AAIb,QAAO;;ACrQT,IAAA,gBDwQe"}
@@ -34,12 +34,12 @@ import "../../ChevronUp.js";
34
34
  import "../../useExpand.js";
35
35
  import { t as Expander_default } from "../../Expander.js";
36
36
  import React from "react";
37
- import classNames from "classnames";
37
+ import cn from "classnames";
38
38
  import { jsx, jsxs } from "react/jsx-runtime";
39
39
  import styles from "./styles.module.scss";
40
40
  var FluidWrapper = ({ fluid, children }) => {
41
41
  if (fluid) return /* @__PURE__ */ jsx("div", {
42
- className: classNames(styles["fluid-wrapper"]),
42
+ className: cn(styles["fluid-wrapper"]),
43
43
  children
44
44
  });
45
45
  return children;
@@ -51,13 +51,13 @@ var NotificationPanel_default = React.forwardRef((props, ref) => {
51
51
  const isMobile = useIsMobileBreakpoint();
52
52
  const renderContent = () => {
53
53
  const outlineVariant = compactVariant === "outline";
54
- const contentClasses = classNames(styles["notification-panel__content"]);
55
- const labelClasses = classNames(styles["notification-panel__label"], {
54
+ const contentClasses = cn(styles["notification-panel__content"]);
55
+ const labelClasses = cn(styles["notification-panel__label"], {
56
56
  [styles["notification-panel__label--no-content"]]: !children && !expanderChildren,
57
57
  [styles["notification-panel__label--compact"]]: !!compactVariant,
58
58
  [styles["notification-panel__label--outline"]]: outlineVariant
59
59
  });
60
- const childrenClasses = classNames(styles["notification-panel__children"], {
60
+ const childrenClasses = cn(styles["notification-panel__children"], {
61
61
  [styles["notification-panel__children--with-label"]]: label,
62
62
  [styles["notification-panel__children--expander-no-label"]]: expanderChildren && !label,
63
63
  [styles["notification-panel__children--outline"]]: outlineVariant
@@ -85,7 +85,7 @@ var NotificationPanel_default = React.forwardRef((props, ref) => {
85
85
  ]
86
86
  });
87
87
  };
88
- const notificationPanelClasses = classNames(styles["notification-panel"], styles[`notification-panel--${variant}`], size && styles[`notification-panel--${size}`], {
88
+ const notificationPanelClasses = cn(styles["notification-panel"], styles[`notification-panel--${variant}`], size && styles[`notification-panel--${size}`], {
89
89
  [styles["notification-panel--compact"]]: !!compactVariant,
90
90
  [styles["notification-panel--compact--basic"]]: compactVariant === "basic",
91
91
  [styles["notification-panel--compact--outline"]]: compactVariant === "outline",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["FluidWrapper: React.FC<WrapFluidProps>"],"sources":["../../../src/components/NotificationPanel/NotificationPanel.tsx","../../../src/components/NotificationPanel/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport NotificationBadge from '../Badge/NotificationBadge';\nimport Close from '../Close';\nimport Expander from '../Expander';\n\nimport styles from './styles.module.scss';\n\nexport type NotificationPanelVariants = 'info' | 'warn' | 'error' | 'success';\nexport type NotificationCompactVariants = 'basic' | 'outline';\nexport type NotificationPanelSizes = 'small' | 'medium' | 'large';\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'span';\n\nexport interface NotificationPanelProps {\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds inner child elements. */\n children?: React.ReactNode;\n /** Adds inner expander elements. */\n expanderChildren?: React.ReactNode;\n /** Text for expanderButton. */\n expanderButtonText?: string;\n /** Text for expanderButton when closed. */\n expanderButtonClosedText?: string;\n /** Makes expander be open from start. */\n expanderOpenFromStart?: boolean;\n /** Changes the visual representation of the notification panel. */\n variant?: NotificationPanelVariants;\n /** Makes the panel more compact. Available in basic and outline. */\n compactVariant?: NotificationCompactVariants;\n /** Sets a fixed size for the content container. */\n size?: NotificationPanelSizes;\n /** Used in combination with dismissiable property to close the notification panel. */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Toggles the close button in the top right corner. */\n dismissable?: boolean;\n /** Enables a fluid outer container that spans the entire width of parent. */\n fluid?: boolean;\n /** Sets a label for the notification panel. */\n label?: string;\n /** Changes the underlying element of the label. */\n labelHtmlMarkup?: LabelTags;\n /** Close button aria-label */\n ariaLabelCloseBtn?: string;\n /** Custom id for the label */\n labelId?: string;\n /** Custom role for the panel. Default is no role. If variant is alert or crisis, the aria role will be set to \"alert\" unless the role-prop is also set. */\n role?: 'region' | 'alert' | 'status';\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ntype WrapFluidProps = Pick<NotificationPanelProps, 'fluid'> & {\n children: React.ReactElement;\n};\n\nconst FluidWrapper: React.FC<WrapFluidProps> = ({ fluid, children }) => {\n if (fluid) {\n const fluidClasses = classNames(styles['fluid-wrapper']);\n\n return <div className={fluidClasses}>{children}</div>;\n }\n return children;\n};\n\nconst NotificationPanel = React.forwardRef<HTMLDivElement, NotificationPanelProps>((props, ref) => {\n const {\n children,\n variant = 'info',\n dismissable = false,\n onClick,\n expanderChildren,\n expanderButtonText,\n expanderButtonClosedText,\n expanderOpenFromStart = false,\n compactVariant,\n label,\n labelId: labelIdProp,\n labelHtmlMarkup = 'h1',\n fluid = false,\n size,\n className,\n role,\n testId,\n } = props;\n const labelId = useIdWithFallback(labelIdProp);\n const [expanderOpen, setExpanderOpen] = React.useState(expanderOpenFromStart);\n const isMobile = useIsMobileBreakpoint();\n\n const renderContent = (): JSX.Element => {\n const outlineVariant = compactVariant === 'outline';\n const contentClasses = classNames(styles['notification-panel__content']);\n const labelClasses = classNames(styles['notification-panel__label'], {\n [styles['notification-panel__label--no-content']]: !children && !expanderChildren,\n [styles['notification-panel__label--compact']]: !!compactVariant,\n [styles['notification-panel__label--outline']]: outlineVariant,\n });\n const childrenClasses = classNames(styles['notification-panel__children'], {\n [styles['notification-panel__children--with-label']]: label,\n [styles['notification-panel__children--expander-no-label']]: expanderChildren && !label,\n [styles['notification-panel__children--outline']]: outlineVariant,\n });\n const CustomTag = labelHtmlMarkup;\n\n return (\n <div className={contentClasses} id={!label ? labelId : undefined}>\n {label && (\n <CustomTag className={labelClasses} id={labelId}>\n {label}\n </CustomTag>\n )}\n {children && <div className={childrenClasses}>{children}</div>}\n {expanderChildren && expanderButtonText && expanderButtonClosedText && !compactVariant && (\n <Expander\n title={expanderOpen ? expanderButtonText : expanderButtonClosedText}\n onExpand={setExpanderOpen}\n expanded={expanderOpen}\n testId=\"expand\"\n >\n {expanderChildren}\n </Expander>\n )}\n </div>\n );\n };\n\n const notificationPanelClasses = classNames(\n styles['notification-panel'],\n styles[`notification-panel--${variant}`],\n size && styles[`notification-panel--${size}`],\n {\n [styles['notification-panel--compact']]: !!compactVariant,\n [styles['notification-panel--compact--basic']]: compactVariant === 'basic',\n [styles['notification-panel--compact--outline']]: compactVariant === 'outline',\n [styles['notification-panel--with-content']]: expanderChildren || (label && children),\n [styles['notification-panel--dismissable']]: dismissable,\n },\n className\n );\n\n const ariaRole = role || (variant === 'error' && 'alert') || undefined;\n const ariaLabelAttributes = ariaRole ? getAriaLabelAttributes({ label, id: labelId }) : undefined;\n\n return (\n <FluidWrapper fluid={fluid}>\n <div\n ref={ref}\n role={ariaRole}\n data-testid={testId}\n data-analyticsid={AnalyticsId.NotificationPanel}\n className={notificationPanelClasses}\n {...ariaLabelAttributes}\n >\n <NotificationBadge\n variant={variant}\n size={compactVariant || isMobile ? IconSize.XSmall : IconSize.Small}\n className={styles['notification-panel__icon']}\n />\n {dismissable && (\n <span className={styles['notification-panel__close']}>\n <Close ariaLabel={props.ariaLabelCloseBtn} onClick={onClick} color=\"black\" />\n </span>\n )}\n {renderContent()}\n </div>\n </FluidWrapper>\n );\n});\n\nexport default NotificationPanel;\n","import NotificationPanel from './NotificationPanel';\nexport * from './NotificationPanel';\nexport default NotificationPanel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,IAAMA,gBAA0C,EAAE,OAAO,eAAe;AACtE,KAAI,MAGF,QAAO,oBAAC,OAAA;EAAI,WAFS,WAAW,OAAO,iBAAiB;EAElB;GAAe;AAEvD,QAAO;;AClET,IAAA,4BDqE0B,MAAM,YAAoD,OAAO,QAAQ;CACjG,MAAM,EACJ,UACA,UAAU,QACV,cAAc,OACd,SACA,kBACA,oBACA,0BACA,wBAAwB,OACxB,gBACA,OACA,SAAS,aACT,kBAAkB,MAClB,QAAQ,OACR,MACA,WACA,MACA,WACE;CACJ,MAAM,UAAU,kBAAkB,YAAY;CAC9C,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS,sBAAsB;CAC7E,MAAM,WAAW,uBAAuB;CAExC,MAAM,sBAAmC;EACvC,MAAM,iBAAiB,mBAAmB;EAC1C,MAAM,iBAAiB,WAAW,OAAO,+BAA+B;EACxE,MAAM,eAAe,WAAW,OAAO,8BAA8B;IAClE,OAAO,2CAA2C,CAAC,YAAY,CAAC;IAChE,OAAO,wCAAwC,CAAC,CAAC;IACjD,OAAO,wCAAwC;GACjD,CAAC;EACF,MAAM,kBAAkB,WAAW,OAAO,iCAAiC;IACxE,OAAO,8CAA8C;IACrD,OAAO,qDAAqD,oBAAoB,CAAC;IACjF,OAAO,2CAA2C;GACpD,CAAC;AAGF,SACE,qBAAC,OAAA;GAAI,WAAW;GAAgB,IAAI,CAAC,QAAQ,UAAU,KAAA;;IACpD,SACC,oBALY,iBAKX;KAAU,WAAW;KAAc,IAAI;eACrC;MACS;IAEb,YAAY,oBAAC,OAAA;KAAI,WAAW;KAAkB;MAAe;IAC7D,oBAAoB,sBAAsB,4BAA4B,CAAC,kBACtE,oBAAC,kBAAA;KACC,OAAO,eAAe,qBAAqB;KAC3C,UAAU;KACV,UAAU;KACV,QAAO;eAEN;MACQ;;IAET;;CAIV,MAAM,2BAA2B,WAC/B,OAAO,uBACP,OAAO,uBAAuB,YAC9B,QAAQ,OAAO,uBAAuB,SACtC;GACG,OAAO,iCAAiC,CAAC,CAAC;GAC1C,OAAO,wCAAwC,mBAAmB;GAClE,OAAO,0CAA0C,mBAAmB;GACpE,OAAO,sCAAsC,oBAAqB,SAAS;GAC3E,OAAO,qCAAqC;EAC9C,EACD,UACD;CAED,MAAM,WAAW,QAAS,YAAY,WAAW,WAAY,KAAA;CAC7D,MAAM,sBAAsB,WAAW,uBAAuB;EAAE;EAAO,IAAI;EAAS,CAAC,GAAG,KAAA;AAExF,QACE,oBAAC,cAAA;EAAoB;YACnB,qBAAC,OAAA;GACM;GACL,MAAM;GACN,eAAa;GACb,oBAAkB,YAAY;GAC9B,WAAW;GACX,GAAI;;IAEJ,oBAAC,2BAAA;KACU;KACT,MAAM,kBAAkB,WAAW,SAAS,SAAS,SAAS;KAC9D,WAAW,OAAO;MAClB;IACD,eACC,oBAAC,QAAA;KAAK,WAAW,OAAO;eACtB,oBAAC,eAAA;MAAM,WAAW,MAAM;MAA4B;MAAS,OAAM;OAAU;MACxE;IAER,eAAe;;IACZ;GACO;EAEjB"}
1
+ {"version":3,"file":"index.js","names":["FluidWrapper: React.FC<WrapFluidProps>"],"sources":["../../../src/components/NotificationPanel/NotificationPanel.tsx","../../../src/components/NotificationPanel/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport NotificationBadge from '../Badge/NotificationBadge';\nimport Close from '../Close';\nimport Expander from '../Expander';\n\nimport styles from './styles.module.scss';\n\nexport type NotificationPanelVariants = 'info' | 'warn' | 'error' | 'success';\nexport type NotificationCompactVariants = 'basic' | 'outline';\nexport type NotificationPanelSizes = 'small' | 'medium' | 'large';\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'span';\n\nexport interface NotificationPanelProps {\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds inner child elements. */\n children?: React.ReactNode;\n /** Adds inner expander elements. */\n expanderChildren?: React.ReactNode;\n /** Text for expanderButton. */\n expanderButtonText?: string;\n /** Text for expanderButton when closed. */\n expanderButtonClosedText?: string;\n /** Makes expander be open from start. */\n expanderOpenFromStart?: boolean;\n /** Changes the visual representation of the notification panel. */\n variant?: NotificationPanelVariants;\n /** Makes the panel more compact. Available in basic and outline. */\n compactVariant?: NotificationCompactVariants;\n /** Sets a fixed size for the content container. */\n size?: NotificationPanelSizes;\n /** Used in combination with dismissiable property to close the notification panel. */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Toggles the close button in the top right corner. */\n dismissable?: boolean;\n /** Enables a fluid outer container that spans the entire width of parent. */\n fluid?: boolean;\n /** Sets a label for the notification panel. */\n label?: string;\n /** Changes the underlying element of the label. */\n labelHtmlMarkup?: LabelTags;\n /** Close button aria-label */\n ariaLabelCloseBtn?: string;\n /** Custom id for the label */\n labelId?: string;\n /** Custom role for the panel. Default is no role. If variant is alert or crisis, the aria role will be set to \"alert\" unless the role-prop is also set. */\n role?: 'region' | 'alert' | 'status';\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ntype WrapFluidProps = Pick<NotificationPanelProps, 'fluid'> & {\n children: React.ReactElement;\n};\n\nconst FluidWrapper: React.FC<WrapFluidProps> = ({ fluid, children }) => {\n if (fluid) {\n const fluidClasses = classNames(styles['fluid-wrapper']);\n\n return <div className={fluidClasses}>{children}</div>;\n }\n return children;\n};\n\nconst NotificationPanel = React.forwardRef<HTMLDivElement, NotificationPanelProps>((props, ref) => {\n const {\n children,\n variant = 'info',\n dismissable = false,\n onClick,\n expanderChildren,\n expanderButtonText,\n expanderButtonClosedText,\n expanderOpenFromStart = false,\n compactVariant,\n label,\n labelId: labelIdProp,\n labelHtmlMarkup = 'h1',\n fluid = false,\n size,\n className,\n role,\n testId,\n } = props;\n const labelId = useIdWithFallback(labelIdProp);\n const [expanderOpen, setExpanderOpen] = React.useState(expanderOpenFromStart);\n const isMobile = useIsMobileBreakpoint();\n\n const renderContent = (): JSX.Element => {\n const outlineVariant = compactVariant === 'outline';\n const contentClasses = classNames(styles['notification-panel__content']);\n const labelClasses = classNames(styles['notification-panel__label'], {\n [styles['notification-panel__label--no-content']]: !children && !expanderChildren,\n [styles['notification-panel__label--compact']]: !!compactVariant,\n [styles['notification-panel__label--outline']]: outlineVariant,\n });\n const childrenClasses = classNames(styles['notification-panel__children'], {\n [styles['notification-panel__children--with-label']]: label,\n [styles['notification-panel__children--expander-no-label']]: expanderChildren && !label,\n [styles['notification-panel__children--outline']]: outlineVariant,\n });\n const CustomTag = labelHtmlMarkup;\n\n return (\n <div className={contentClasses} id={!label ? labelId : undefined}>\n {label && (\n <CustomTag className={labelClasses} id={labelId}>\n {label}\n </CustomTag>\n )}\n {children && <div className={childrenClasses}>{children}</div>}\n {expanderChildren && expanderButtonText && expanderButtonClosedText && !compactVariant && (\n <Expander\n title={expanderOpen ? expanderButtonText : expanderButtonClosedText}\n onExpand={setExpanderOpen}\n expanded={expanderOpen}\n testId=\"expand\"\n >\n {expanderChildren}\n </Expander>\n )}\n </div>\n );\n };\n\n const notificationPanelClasses = classNames(\n styles['notification-panel'],\n styles[`notification-panel--${variant}`],\n size && styles[`notification-panel--${size}`],\n {\n [styles['notification-panel--compact']]: !!compactVariant,\n [styles['notification-panel--compact--basic']]: compactVariant === 'basic',\n [styles['notification-panel--compact--outline']]: compactVariant === 'outline',\n [styles['notification-panel--with-content']]: expanderChildren || (label && children),\n [styles['notification-panel--dismissable']]: dismissable,\n },\n className\n );\n\n const ariaRole = role || (variant === 'error' && 'alert') || undefined;\n const ariaLabelAttributes = ariaRole ? getAriaLabelAttributes({ label, id: labelId }) : undefined;\n\n return (\n <FluidWrapper fluid={fluid}>\n <div\n ref={ref}\n role={ariaRole}\n data-testid={testId}\n data-analyticsid={AnalyticsId.NotificationPanel}\n className={notificationPanelClasses}\n {...ariaLabelAttributes}\n >\n <NotificationBadge\n variant={variant}\n size={compactVariant || isMobile ? IconSize.XSmall : IconSize.Small}\n className={styles['notification-panel__icon']}\n />\n {dismissable && (\n <span className={styles['notification-panel__close']}>\n <Close ariaLabel={props.ariaLabelCloseBtn} onClick={onClick} color=\"black\" />\n </span>\n )}\n {renderContent()}\n </div>\n </FluidWrapper>\n );\n});\n\nexport default NotificationPanel;\n","import NotificationPanel from './NotificationPanel';\nexport * from './NotificationPanel';\nexport default NotificationPanel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,IAAMA,gBAA0C,EAAE,OAAO,eAAe;AACtE,KAAI,MAGF,QAAO,oBAAC,OAAA;EAAI,WAFS,GAAW,OAAO,iBAAiB;EAElB;GAAe;AAEvD,QAAO;;AClET,IAAA,4BDqE0B,MAAM,YAAoD,OAAO,QAAQ;CACjG,MAAM,EACJ,UACA,UAAU,QACV,cAAc,OACd,SACA,kBACA,oBACA,0BACA,wBAAwB,OACxB,gBACA,OACA,SAAS,aACT,kBAAkB,MAClB,QAAQ,OACR,MACA,WACA,MACA,WACE;CACJ,MAAM,UAAU,kBAAkB,YAAY;CAC9C,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS,sBAAsB;CAC7E,MAAM,WAAW,uBAAuB;CAExC,MAAM,sBAAmC;EACvC,MAAM,iBAAiB,mBAAmB;EAC1C,MAAM,iBAAiB,GAAW,OAAO,+BAA+B;EACxE,MAAM,eAAe,GAAW,OAAO,8BAA8B;IAClE,OAAO,2CAA2C,CAAC,YAAY,CAAC;IAChE,OAAO,wCAAwC,CAAC,CAAC;IACjD,OAAO,wCAAwC;GACjD,CAAC;EACF,MAAM,kBAAkB,GAAW,OAAO,iCAAiC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getSpacer(2xs);
9
8
  grid-template-areas: 'title';
10
9
 
@@ -31,7 +31,7 @@ import "../../ChevronRight.js";
31
31
  import "../../PanelTitle.js";
32
32
  import { c as PanelVariant, l as Panel_default } from "../../Panel.js";
33
33
  import React from "react";
34
- import classNames from "classnames";
34
+ import cn from "classnames";
35
35
  import { jsx } from "react/jsx-runtime";
36
36
  import styles from "./styles.module.scss";
37
37
  var isPanelComponent = (element) => React.isValidElement(element) && element.type === Panel_default;
@@ -39,14 +39,14 @@ var PanelList_default = React.forwardRef(function BadgeForwardedRef(props, ref)
39
39
  const { testId, children, variant = PanelVariant.fill, highlightText } = props;
40
40
  const renderPanel = (panel) => React.cloneElement(panel, {
41
41
  variant,
42
- className: classNames(panel.props.className, styles[`panel-list__panel--${variant}`]),
42
+ className: cn(panel.props.className, styles[`panel-list__panel--${variant}`]),
43
43
  highlightText: panel.props.highlightText || highlightText
44
44
  });
45
45
  return /* @__PURE__ */ jsx("div", {
46
46
  ref,
47
47
  "data-testid": testId,
48
48
  "data-analyticsid": AnalyticsId.PanelList,
49
- className: classNames({ [styles["panel-list--outline"]]: variant === PanelVariant.outline }),
49
+ className: cn({ [styles["panel-list--outline"]]: variant === PanelVariant.outline }),
50
50
  children: React.Children.map(children, (child) => isPanelComponent(child) ? renderPanel(child) : child)
51
51
  });
52
52
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/PanelList/PanelList.tsx","../../../src/components/PanelList/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport Panel, { PanelProps, PanelVariant } from '../Panel/Panel';\n\nimport styles from './styles.module.scss';\n\nexport interface PanelListProps {\n /** Panels to render inside the PanelList */\n children?: React.ReactNode;\n /** Changes the visual representation of the panel. Default: fill */\n variant?: PanelVariant;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nconst isPanelComponent = (element: {} | null | undefined): element is React.ReactElement<PanelProps> =>\n React.isValidElement<PanelProps>(element) && (element as React.ReactElement).type === Panel;\n\nconst PanelList = React.forwardRef(function BadgeForwardedRef(props: PanelListProps, ref: React.ForwardedRef<HTMLDivElement>) {\n const { testId, children, variant = PanelVariant.fill, highlightText } = props;\n\n const renderPanel = (panel: React.ReactElement<PanelProps>): React.ReactElement<PanelProps> =>\n React.cloneElement(panel, {\n variant: variant,\n className: classNames(panel.props.className, styles[`panel-list__panel--${variant}`]),\n highlightText: panel.props.highlightText || highlightText,\n });\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PanelList}\n className={classNames({ [styles['panel-list--outline']]: variant === PanelVariant.outline })}\n >\n {React.Children.map(children, child => (isPanelComponent(child) ? renderPanel(child) : child))}\n </div>\n );\n});\n\nexport default PanelList;\n","import PanelList from './PanelList';\nexport * from './PanelList';\nexport default PanelList;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAM,oBAAoB,YACxB,MAAM,eAA2B,QAAQ,IAAK,QAA+B,SAAS;ACpBxF,IAAA,oBDsBkB,MAAM,WAAW,SAAS,kBAAkB,OAAuB,KAAyC;CAC5H,MAAM,EAAE,QAAQ,UAAU,UAAU,aAAa,MAAM,kBAAkB;CAEzE,MAAM,eAAe,UACnB,MAAM,aAAa,OAAO;EACf;EACT,WAAW,WAAW,MAAM,MAAM,WAAW,OAAO,sBAAsB,WAAW;EACrF,eAAe,MAAM,MAAM,iBAAiB;EAC7C,CAAC;AAEJ,QACE,oBAAC,OAAA;EACM;EACL,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW,WAAW,GAAG,OAAO,yBAAyB,YAAY,aAAa,SAAS,CAAC;YAE3F,MAAM,SAAS,IAAI,WAAU,UAAU,iBAAiB,MAAM,GAAG,YAAY,MAAM,GAAG,MAAO;GAC1F;EAER"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/PanelList/PanelList.tsx","../../../src/components/PanelList/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport Panel, { PanelProps, PanelVariant } from '../Panel/Panel';\n\nimport styles from './styles.module.scss';\n\nexport interface PanelListProps {\n /** Panels to render inside the PanelList */\n children?: React.ReactNode;\n /** Changes the visual representation of the panel. Default: fill */\n variant?: PanelVariant;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nconst isPanelComponent = (element: {} | null | undefined): element is React.ReactElement<PanelProps> =>\n React.isValidElement<PanelProps>(element) && (element as React.ReactElement).type === Panel;\n\nconst PanelList = React.forwardRef(function BadgeForwardedRef(props: PanelListProps, ref: React.ForwardedRef<HTMLDivElement>) {\n const { testId, children, variant = PanelVariant.fill, highlightText } = props;\n\n const renderPanel = (panel: React.ReactElement<PanelProps>): React.ReactElement<PanelProps> =>\n React.cloneElement(panel, {\n variant: variant,\n className: classNames(panel.props.className, styles[`panel-list__panel--${variant}`]),\n highlightText: panel.props.highlightText || highlightText,\n });\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PanelList}\n className={classNames({ [styles['panel-list--outline']]: variant === PanelVariant.outline })}\n >\n {React.Children.map(children, child => (isPanelComponent(child) ? renderPanel(child) : child))}\n </div>\n );\n});\n\nexport default PanelList;\n","import PanelList from './PanelList';\nexport * from './PanelList';\nexport default PanelList;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAM,oBAAoB,YACxB,MAAM,eAA2B,QAAQ,IAAK,QAA+B,SAAS;ACpBxF,IAAA,oBDsBkB,MAAM,WAAW,SAAS,kBAAkB,OAAuB,KAAyC;CAC5H,MAAM,EAAE,QAAQ,UAAU,UAAU,aAAa,MAAM,kBAAkB;CAEzE,MAAM,eAAe,UACnB,MAAM,aAAa,OAAO;EACf;EACT,WAAW,GAAW,MAAM,MAAM,WAAW,OAAO,sBAAsB,WAAW;EACrF,eAAe,MAAM,MAAM,iBAAiB;EAC7C,CAAC;AAEJ,QACE,oBAAC,OAAA;EACM;EACL,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW,GAAW,GAAG,OAAO,yBAAyB,YAAY,aAAa,SAAS,CAAC;YAE3F,MAAM,SAAS,IAAI,WAAU,UAAU,iBAAiB,MAAM,GAAG,YAAY,MAAM,GAAG,MAAO;GAC1F;EAER"}