@helsenorge/designsystem-react 13.0.0-workspaces-beta.7 → 13.0.2

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 (237) hide show
  1. package/fonts/source-sans-pro-200-extralight-italic.woff +0 -0
  2. package/fonts/source-sans-pro-200-extralight-italic.woff2 +0 -0
  3. package/fonts/source-sans-pro-200-extralight.woff +0 -0
  4. package/fonts/source-sans-pro-200-extralight.woff2 +0 -0
  5. package/fonts/source-sans-pro-300-light-italic.woff +0 -0
  6. package/fonts/source-sans-pro-300-light-italic.woff2 +0 -0
  7. package/fonts/source-sans-pro-300-light.woff +0 -0
  8. package/fonts/source-sans-pro-300-light.woff2 +0 -0
  9. package/fonts/source-sans-pro-400-regular-italic.woff +0 -0
  10. package/fonts/source-sans-pro-400-regular-italic.woff2 +0 -0
  11. package/fonts/source-sans-pro-400-regular.woff +0 -0
  12. package/fonts/source-sans-pro-400-regular.woff2 +0 -0
  13. package/fonts/source-sans-pro-600-semibold-italic.woff +0 -0
  14. package/fonts/source-sans-pro-600-semibold-italic.woff2 +0 -0
  15. package/fonts/source-sans-pro-600-semibold.woff +0 -0
  16. package/fonts/source-sans-pro-600-semibold.woff2 +0 -0
  17. package/fonts/source-sans-pro-700-bold-italic.woff +0 -0
  18. package/fonts/source-sans-pro-700-bold-italic.woff2 +0 -0
  19. package/fonts/source-sans-pro-700-bold.woff +0 -0
  20. package/fonts/source-sans-pro-700-bold.woff2 +0 -0
  21. package/fonts/source-sans-pro-900-black-italic.woff +0 -0
  22. package/fonts/source-sans-pro-900-black-italic.woff2 +0 -0
  23. package/fonts/source-sans-pro-900-black.woff +0 -0
  24. package/fonts/source-sans-pro-900-black.woff2 +0 -0
  25. package/lib/AnchorLink.js +14 -6
  26. package/lib/AnchorLink.js.map +1 -1
  27. package/lib/AsChildSlot.js +2 -1
  28. package/lib/AsChildSlot.js.map +1 -1
  29. package/lib/Avatar.js +2 -2
  30. package/lib/Avatar.js.map +1 -1
  31. package/lib/Badge.js +2 -2
  32. package/lib/Badge.js.map +1 -1
  33. package/lib/Button.js +6 -6
  34. package/lib/Button.js.map +1 -1
  35. package/lib/CHANGELOG.md +66 -1
  36. package/lib/Checkbox.js +7 -7
  37. package/lib/Checkbox.js.map +1 -1
  38. package/lib/Close.js +4 -4
  39. package/lib/Close.js.map +1 -1
  40. package/lib/DictionaryTrigger.js +2 -2
  41. package/lib/DictionaryTrigger.js.map +1 -1
  42. package/lib/Drawer.js +5 -5
  43. package/lib/Drawer.js.map +1 -1
  44. package/lib/Duolist.js +5 -5
  45. package/lib/Duolist.js.map +1 -1
  46. package/lib/ElementHeader.js +9 -9
  47. package/lib/ElementHeader.js.map +1 -1
  48. package/lib/ElementHeaderText.js +4 -4
  49. package/lib/ElementHeaderText.js.map +1 -1
  50. package/lib/ErrorWrapper.js +2 -2
  51. package/lib/ErrorWrapper.js.map +1 -1
  52. package/lib/Expander.js +7 -7
  53. package/lib/Expander.js.map +1 -1
  54. package/lib/FormFieldTag.js +32 -2
  55. package/lib/FormFieldTag.js.map +1 -1
  56. package/lib/FormGroup.js +5 -5
  57. package/lib/FormGroup.js.map +1 -1
  58. package/lib/FormLayout.js +3 -3
  59. package/lib/FormLayout.js.map +1 -1
  60. package/lib/HelpDetails.js +3 -3
  61. package/lib/HelpDetails.js.map +1 -1
  62. package/lib/HelpTriggerIcon.js +3 -3
  63. package/lib/HelpTriggerIcon.js.map +1 -1
  64. package/lib/HelpTriggerStandalone.js +3 -3
  65. package/lib/HelpTriggerStandalone.js.map +1 -1
  66. package/lib/HighlightPanel.js +3 -3
  67. package/lib/HighlightPanel.js.map +1 -1
  68. package/lib/HorizontalScroll.js +4 -4
  69. package/lib/HorizontalScroll.js.map +1 -1
  70. package/lib/Icon.js +2 -2
  71. package/lib/Icon.js.map +1 -1
  72. package/lib/InfoTeaser.js +3 -3
  73. package/lib/InfoTeaser.js.map +1 -1
  74. package/lib/Input.js +5 -6
  75. package/lib/Input.js.map +1 -1
  76. package/lib/Label.js +5 -5
  77. package/lib/Label.js.map +1 -1
  78. package/lib/LinkList.js +52 -25
  79. package/lib/LinkList.js.map +1 -1
  80. package/lib/List.js +2 -2
  81. package/lib/List.js.map +1 -1
  82. package/lib/ListEditMode.js +14 -10
  83. package/lib/ListEditMode.js.map +1 -1
  84. package/lib/MaxCharacters.js +2 -2
  85. package/lib/MaxCharacters.js.map +1 -1
  86. package/lib/Panel.js +12 -12
  87. package/lib/Panel.js.map +1 -1
  88. package/lib/PanelOld.js +14 -14
  89. package/lib/PanelOld.js.map +1 -1
  90. package/lib/PanelTitle.js +2 -2
  91. package/lib/PanelTitle.js.map +1 -1
  92. package/lib/PopOver.js +2 -2
  93. package/lib/PopOver.js.map +1 -1
  94. package/lib/RadioButton.js +5 -5
  95. package/lib/RadioButton.js.map +1 -1
  96. package/lib/Select.js +4 -4
  97. package/lib/Select.js.map +1 -1
  98. package/lib/SingleSelectItem.js +5 -5
  99. package/lib/SingleSelectItem.js.map +1 -1
  100. package/lib/Slider.js +4 -4
  101. package/lib/Slider.js.map +1 -1
  102. package/lib/Spacer.js +2 -2
  103. package/lib/Spacer.js.map +1 -1
  104. package/lib/StatusDot.js +4 -4
  105. package/lib/StatusDot.js.map +1 -1
  106. package/lib/StatusDotList.js +2 -2
  107. package/lib/StatusDotList.js.map +1 -1
  108. package/lib/StepButtons.js +5 -5
  109. package/lib/StepButtons.js.map +1 -1
  110. package/lib/TabList.js +8 -8
  111. package/lib/TabList.js.map +1 -1
  112. package/lib/TabPanel.js +2 -2
  113. package/lib/TabPanel.js.map +1 -1
  114. package/lib/Table.js +2 -2
  115. package/lib/Table.js.map +1 -1
  116. package/lib/TableBody.js +2 -2
  117. package/lib/TableBody.js.map +1 -1
  118. package/lib/TableCell.js +2 -2
  119. package/lib/TableCell.js.map +1 -1
  120. package/lib/TableExpandedRow.js +4 -4
  121. package/lib/TableExpandedRow.js.map +1 -1
  122. package/lib/TableExpanderCell.js +2 -2
  123. package/lib/TableExpanderCell.js.map +1 -1
  124. package/lib/TableHead.js +2 -2
  125. package/lib/TableHead.js.map +1 -1
  126. package/lib/TableHeadCell.js +3 -3
  127. package/lib/TableHeadCell.js.map +1 -1
  128. package/lib/TableRow.js +3 -3
  129. package/lib/TableRow.js.map +1 -1
  130. package/lib/Textarea.js +4 -4
  131. package/lib/Textarea.js.map +1 -1
  132. package/lib/Title.js +2 -2
  133. package/lib/Title.js.map +1 -1
  134. package/lib/Toast.js +3 -3
  135. package/lib/Toast.js.map +1 -1
  136. package/lib/components/AnchorLink/AnchorLink.d.ts +2 -0
  137. package/lib/components/AnchorLink/index.js +2 -0
  138. package/lib/components/ArticleTeaser/index.js +4 -4
  139. package/lib/components/ArticleTeaser/index.js.map +1 -1
  140. package/lib/components/AsChildSlot/styles.module.scss +0 -1
  141. package/lib/components/Button/Button.d.ts +1 -1
  142. package/lib/components/Checkbox/index.js +1 -1
  143. package/lib/components/Chip/index.js +2 -2
  144. package/lib/components/Chip/index.js.map +1 -1
  145. package/lib/components/Close/index.js +1 -1
  146. package/lib/components/Drawer/index.js +1 -1
  147. package/lib/components/Dropdown/index.js +7 -7
  148. package/lib/components/Dropdown/index.js.map +1 -1
  149. package/lib/components/DropdownOld/index.js +4 -4
  150. package/lib/components/DropdownOld/index.js.map +1 -1
  151. package/lib/components/ElementHeader/styles.module.scss +5 -5
  152. package/lib/components/EmptyState/index.js +2 -2
  153. package/lib/components/EmptyState/index.js.map +1 -1
  154. package/lib/components/ExpanderHierarchy/index.js +7 -7
  155. package/lib/components/ExpanderHierarchy/index.js.map +1 -1
  156. package/lib/components/ExpanderList/index.js +29 -26
  157. package/lib/components/ExpanderList/index.js.map +1 -1
  158. package/lib/components/ExpanderList/styles.module.scss +1 -0
  159. package/lib/components/FavoriteButton/FavoriteButton.d.ts +1 -1
  160. package/lib/components/FavoriteButton/index.js +3 -4
  161. package/lib/components/FavoriteButton/index.js.map +1 -1
  162. package/lib/components/FormGroup/index.js +1 -1
  163. package/lib/components/HelpBubble/index.js +5 -4
  164. package/lib/components/HelpBubble/index.js.map +1 -1
  165. package/lib/components/HelpDrawer/index.js +4 -3
  166. package/lib/components/HelpDrawer/index.js.map +1 -1
  167. package/lib/components/HelpExpanderStandalone/index.js +2 -2
  168. package/lib/components/HelpExpanderStandalone/index.js.map +1 -1
  169. package/lib/components/HelpPanel/index.js +2 -2
  170. package/lib/components/HelpPanel/index.js.map +1 -1
  171. package/lib/components/HelpTriggerInline/index.js +3 -3
  172. package/lib/components/HelpTriggerInline/index.js.map +1 -1
  173. package/lib/components/Input/index.js +1 -1
  174. package/lib/components/LinkList/LinkList.d.ts +7 -0
  175. package/lib/components/LinkList/index.js +1 -0
  176. package/lib/components/LinkList/resourceHelper.d.ts +3 -0
  177. package/lib/components/LinkList/styles.module.scss +4 -0
  178. package/lib/components/ListEditMode/ListEditMode.d.ts +6 -1
  179. package/lib/components/ListEditMode/styles.module.scss +4 -8
  180. package/lib/components/Loader/index.js +4 -4
  181. package/lib/components/Loader/index.js.map +1 -1
  182. package/lib/components/Modal/index.js +10 -10
  183. package/lib/components/Modal/index.js.map +1 -1
  184. package/lib/components/NotificationPanel/index.js +7 -7
  185. package/lib/components/NotificationPanel/index.js.map +1 -1
  186. package/lib/components/PanelList/index.js +3 -3
  187. package/lib/components/PanelList/index.js.map +1 -1
  188. package/lib/components/PanelListOld/index.js +2 -2
  189. package/lib/components/PanelListOld/index.js.map +1 -1
  190. package/lib/components/PopMenu/index.js +4 -3
  191. package/lib/components/PopMenu/index.js.map +1 -1
  192. package/lib/components/Progressbar/index.js +2 -2
  193. package/lib/components/Progressbar/index.js.map +1 -1
  194. package/lib/components/PromoPanel/index.js +2 -2
  195. package/lib/components/PromoPanel/index.js.map +1 -1
  196. package/lib/components/RadioButton/index.js +1 -1
  197. package/lib/components/ServiceMessage/index.js +6 -6
  198. package/lib/components/ServiceMessage/index.js.map +1 -1
  199. package/lib/components/SharingStatus/index.js +4 -4
  200. package/lib/components/SharingStatus/index.js.map +1 -1
  201. package/lib/components/Step/index.js +2 -2
  202. package/lib/components/Step/index.js.map +1 -1
  203. package/lib/components/Stepper/index.js +2 -2
  204. package/lib/components/Stepper/index.js.map +1 -1
  205. package/lib/components/StickyNote/index.js +9 -9
  206. package/lib/components/StickyNote/index.js.map +1 -1
  207. package/lib/components/Tabs/index.js +4 -4
  208. package/lib/components/Tabs/index.js.map +1 -1
  209. package/lib/components/Tag/index.js +2 -2
  210. package/lib/components/Tag/index.js.map +1 -1
  211. package/lib/components/Tile/index.js +5 -5
  212. package/lib/components/Tile/index.js.map +1 -1
  213. package/lib/components/Toast/index.js +1 -1
  214. package/lib/components/Toast/styles.module.scss +1 -1
  215. package/lib/components/ToastList/index.js +1 -1
  216. package/lib/components/Toggle/index.js +9 -9
  217. package/lib/components/Toggle/index.js.map +1 -1
  218. package/lib/components/Validation/index.js +4 -3
  219. package/lib/components/Validation/index.js.map +1 -1
  220. package/lib/designsystem-react.css +9 -2
  221. package/lib/hooks/useKeyboardEvent.d.ts +4 -2
  222. package/lib/hooks/useOutsideEvent.d.ts +4 -2
  223. package/lib/resources/HN.Designsystem.FormFieldTag.en-GB.json.d.ts +12 -0
  224. package/lib/resources/HN.Designsystem.FormFieldTag.nn-NO.json.d.ts +12 -0
  225. package/lib/resources/HN.Designsystem.FormFieldTag.se-NO.json.d.ts +12 -0
  226. package/lib/resources/HN.Designsystem.LinkList.en-GB.json.d.ts +6 -0
  227. package/lib/resources/HN.Designsystem.LinkList.nb-NO.json.d.ts +6 -0
  228. package/lib/resources/index.d.ts +0 -0
  229. package/lib/scss/supernova/styles/colors.css +9 -1
  230. package/lib/useKeyboardEvent.js +4 -2
  231. package/lib/useKeyboardEvent.js.map +1 -1
  232. package/lib/useOutsideEvent.js +1 -1
  233. package/lib/useOutsideEvent.js.map +1 -1
  234. package/lib/uuid.js +2 -1
  235. package/lib/uuid.js.map +1 -1
  236. package/package.json +60 -4
  237. package/scss/supernova/styles/colors.css +9 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ExpanderButton: React.FC<ExpanderButtonProps>","Expander: ExpanderType","ExpanderHierarchy: ExpanderHierarchyCompound"],"sources":["../../../src/components/ExpanderHierarchy/ExpanderButton.tsx","../../../src/components/ExpanderHierarchy/utils.ts","../../../src/components/ExpanderHierarchy/Expander.tsx","../../../src/components/ExpanderHierarchy/ExpanderHierarchy.tsx","../../../src/components/ExpanderHierarchy/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { ExpanderHierarchyCommonProps } from '../ExpanderHierarchy';\nimport Icon, { IconSize } from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\n\nimport styles from './expander.module.scss';\n\ninterface ExpanderButtonProps extends ExpanderHierarchyCommonProps {\n expanded: boolean;\n onExpand?: (isExpanded: boolean) => void;\n children: string;\n testId?: string;\n}\n\nconst ExpanderButton: React.FC<ExpanderButtonProps> = ({ htmlMarkup = 'h2', level = 1, print, expanded, onExpand, children, testId }) => {\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>();\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n\n const handleClick = (): void => {\n setIsExpanded(!isExpanded);\n };\n\n const CustomTag = htmlMarkup;\n\n const buttonClasses = classNames(\n styles.expander__button,\n level > 1 && styles[`expander__button--2-and-lower`],\n print && styles['expander__button--print']\n );\n\n const titleClasses = classNames(\n styles.expander__title,\n (level === 1 || level === 2 || level === 3) && styles[`expander__title--${level}`],\n level > 3 && styles[`expander__title--4-and-lower`],\n isExpanded && styles['expander__title--expanded'],\n print && styles['expander__title--print']\n );\n\n const iconClasses = classNames(\n styles.expander__icon,\n level > 1 && styles[`expander__icon--2-and-lower`],\n level > 2 && styles[`expander__icon--3-and-lower`]\n );\n\n return (\n <CustomTag className={titleClasses}>\n <button\n type=\"button\"\n onClick={handleClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n ref={refObject}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderHierarchyExpander}\n >\n {children}\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} isHovered={isHovered} className={iconClasses} size={IconSize.XSmall} />\n </button>\n </CustomTag>\n );\n};\n\nexport default ExpanderButton;\n","export type HeadingTags = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport const getHeadingTag = (htmlMarkup?: HeadingTags): HeadingTags => {\n switch (htmlMarkup) {\n case 'h2':\n return 'h3';\n case 'h3':\n return 'h4';\n case 'h4':\n return 'h5';\n case 'h5':\n return 'h6';\n case 'h6':\n return 'h6';\n default:\n return 'h2';\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport ExpanderButton from './ExpanderButton';\nimport ExpanderHierarchy, { ExpanderHierarchyCommonProps, ExpanderHierarchyProps } from './ExpanderHierarchy';\nimport { getHeadingTag } from './utils';\nimport { isComponent } from '../../utils/component';\n\nimport styles from './expander.module.scss';\n\nexport interface ExpanderProps extends ExpanderHierarchyCommonProps {\n /** Sets the trigger title */\n title: string;\n /** Opens or closes the expander */\n expanded?: boolean;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Sets the expanded content */\n children?: React.ReactNode;\n /** Sets the data-testid attribute on the expander button. */\n testId?: string;\n /** Adds custom classes to the element. */\n className?: string;\n}\n\nexport type ExpanderType = React.FC<ExpanderProps>;\n\nconst Expander: ExpanderType = ({\n title,\n htmlMarkup = 'h2',\n level = 1,\n print,\n expanded = false,\n onExpand,\n children,\n testId,\n className,\n}: ExpanderProps) => {\n const contentClasses = classNames(\n styles.expander__content,\n (level === 1 || level === 2) && styles[`expander__content--${level}`],\n level > 2 && styles[`expander__content--3-and-lower`]\n );\n\n return (\n <li className={classNames(styles.expander, className)}>\n <ExpanderButton htmlMarkup={htmlMarkup} level={level} print={print} expanded={expanded} onExpand={onExpand} testId={testId}>\n {title}\n </ExpanderButton>\n <div className={contentClasses}>\n {React.Children.map(children, child =>\n isComponent<ExpanderHierarchyProps>(child, ExpanderHierarchy)\n ? React.cloneElement(child, { htmlMarkup: getHeadingTag(htmlMarkup), level: level + 1, print })\n : child\n )}\n </div>\n </li>\n );\n};\n\nexport default Expander;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Expander, { ExpanderProps, ExpanderType } from './Expander';\nimport { HeadingTags } from './utils';\nimport { AnalyticsId } from '../../constants';\nimport { isComponent } from '../../utils/component';\n\nimport styles from './styles.module.scss';\n\nexport interface ExpanderHierarchyCommonProps {\n /** Changes the underlying element of the expander title. Default: h2. */\n htmlMarkup?: HeadingTags;\n /** Expand all children when printing. */\n print?: boolean;\n /** Expander nesting level. Should not be set manually. */\n level?: number;\n}\n\nexport interface ExpanderHierarchyProps extends ExpanderHierarchyCommonProps {\n children: React.ReactNode;\n /** Sets the data-testid attribute on the expander list. */\n testId?: string;\n}\n\nexport interface ExpanderHierarchyCompound extends React.FC<ExpanderHierarchyProps> {\n Expander: ExpanderType;\n}\n\nconst ExpanderHierarchy: ExpanderHierarchyCompound = ({\n htmlMarkup = 'h2',\n level = 1,\n print,\n children,\n testId,\n}: ExpanderHierarchyProps) => {\n const listClasses = classNames(\n styles.expanderhierarchy,\n level === 2 && styles[`expanderhierarchy--${level}`],\n level > 2 && styles[`expanderhierarchy--3-and-lower`]\n );\n\n return (\n <ul className={listClasses} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderHierarchy}>\n {React.Children.map(children, child =>\n isComponent<ExpanderProps>(child, Expander) ? React.cloneElement(child, { htmlMarkup, level, print }) : child\n )}\n </ul>\n );\n};\n\nExpanderHierarchy.Expander = Expander;\n\nexport default ExpanderHierarchy;\n","import ExpanderHierarchy from './ExpanderHierarchy';\nexport * from './ExpanderHierarchy';\nexport default ExpanderHierarchy;\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAMA,kBAAiD,EAA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W,OAAO,UAAU,UAAU;aACnD,oBAAC,wBAAA;GAA2B;GAAmB;GAAc;GAAiB;GAAoB;GAAkB;aACjH;IACc,EACjB,oBAAC,OAAA;GAAI,WAAW;aACb,MAAM,SAAS,IAAI,WAAU,UAC5B,YAAoC,OAAO,4BAAkB,GACzD,MAAM,aAAa,OAAO;IAAE,YAAY,cAAc,WAAW;IAAE,OAAO,QAAQ;IAAG;IAAO,CAAC,GAC7F,MACL;IACG,CAAA;GACH;;AAIT,IAAA,mBAAe;AC/Bf,IAAMC,qBAAgD,EACpD,aAAa,MACb,QAAQ,GACR,OACA,UACA,aAC4B;AAO5B,QACE,oBAAC,MAAA;EAAG,WAPc,GAClB,SAAO,mBACP,UAAU,KAAK,SAAO,sBAAsB,UAC5C,QAAQ,KAAK,SAAO,kCACrB;EAG6B,eAAa;EAAQ,oBAAkB,YAAY;YAC5E,MAAM,SAAS,IAAI,WAAU,UAC5B,YAA2B,OAAO,iBAAS,GAAG,MAAM,aAAa,OAAO;GAAE;GAAY;GAAO;GAAO,CAAC,GAAG,MACzG;GACE;;AAIT,kBAAkB,WAAW;AAE7B,IAAA,8BAAe;ACpDf,IAAA,4BAAe"}
1
+ {"version":3,"file":"index.js","names":["ExpanderButton: React.FC<ExpanderButtonProps>","Expander: ExpanderType","ExpanderHierarchy: ExpanderHierarchyCompound"],"sources":["../../../src/components/ExpanderHierarchy/ExpanderButton.tsx","../../../src/components/ExpanderHierarchy/utils.ts","../../../src/components/ExpanderHierarchy/Expander.tsx","../../../src/components/ExpanderHierarchy/ExpanderHierarchy.tsx","../../../src/components/ExpanderHierarchy/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { ExpanderHierarchyCommonProps } from '../ExpanderHierarchy';\nimport Icon, { IconSize } from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\n\nimport styles from './expander.module.scss';\n\ninterface ExpanderButtonProps extends ExpanderHierarchyCommonProps {\n expanded: boolean;\n onExpand?: (isExpanded: boolean) => void;\n children: string;\n testId?: string;\n}\n\nconst ExpanderButton: React.FC<ExpanderButtonProps> = ({ htmlMarkup = 'h2', level = 1, print, expanded, onExpand, children, testId }) => {\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>();\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n\n const handleClick = (): void => {\n setIsExpanded(!isExpanded);\n };\n\n const CustomTag = htmlMarkup;\n\n const buttonClasses = classNames(\n styles.expander__button,\n level > 1 && styles[`expander__button--2-and-lower`],\n print && styles['expander__button--print']\n );\n\n const titleClasses = classNames(\n styles.expander__title,\n (level === 1 || level === 2 || level === 3) && styles[`expander__title--${level}`],\n level > 3 && styles[`expander__title--4-and-lower`],\n isExpanded && styles['expander__title--expanded'],\n print && styles['expander__title--print']\n );\n\n const iconClasses = classNames(\n styles.expander__icon,\n level > 1 && styles[`expander__icon--2-and-lower`],\n level > 2 && styles[`expander__icon--3-and-lower`]\n );\n\n return (\n <CustomTag className={titleClasses}>\n <button\n type=\"button\"\n onClick={handleClick}\n className={buttonClasses}\n aria-expanded={isExpanded}\n ref={refObject}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderHierarchyExpander}\n >\n {children}\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} isHovered={isHovered} className={iconClasses} size={IconSize.XSmall} />\n </button>\n </CustomTag>\n );\n};\n\nexport default ExpanderButton;\n","export type HeadingTags = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport const getHeadingTag = (htmlMarkup?: HeadingTags): HeadingTags => {\n switch (htmlMarkup) {\n case 'h2':\n return 'h3';\n case 'h3':\n return 'h4';\n case 'h4':\n return 'h5';\n case 'h5':\n return 'h6';\n case 'h6':\n return 'h6';\n default:\n return 'h2';\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport ExpanderButton from './ExpanderButton';\nimport ExpanderHierarchy, { ExpanderHierarchyCommonProps, ExpanderHierarchyProps } from './ExpanderHierarchy';\nimport { getHeadingTag } from './utils';\nimport { isComponent } from '../../utils/component';\n\nimport styles from './expander.module.scss';\n\nexport interface ExpanderProps extends ExpanderHierarchyCommonProps {\n /** Sets the trigger title */\n title: string;\n /** Opens or closes the expander */\n expanded?: boolean;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Sets the expanded content */\n children?: React.ReactNode;\n /** Sets the data-testid attribute on the expander button. */\n testId?: string;\n /** Adds custom classes to the element. */\n className?: string;\n}\n\nexport type ExpanderType = React.FC<ExpanderProps>;\n\nconst Expander: ExpanderType = ({\n title,\n htmlMarkup = 'h2',\n level = 1,\n print,\n expanded = false,\n onExpand,\n children,\n testId,\n className,\n}: ExpanderProps) => {\n const contentClasses = classNames(\n styles.expander__content,\n (level === 1 || level === 2) && styles[`expander__content--${level}`],\n level > 2 && styles[`expander__content--3-and-lower`]\n );\n\n return (\n <li className={classNames(styles.expander, className)}>\n <ExpanderButton htmlMarkup={htmlMarkup} level={level} print={print} expanded={expanded} onExpand={onExpand} testId={testId}>\n {title}\n </ExpanderButton>\n <div className={contentClasses}>\n {React.Children.map(children, child =>\n isComponent<ExpanderHierarchyProps>(child, ExpanderHierarchy)\n ? React.cloneElement(child, { htmlMarkup: getHeadingTag(htmlMarkup), level: level + 1, print })\n : child\n )}\n </div>\n </li>\n );\n};\n\nexport default Expander;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Expander, { ExpanderProps, ExpanderType } from './Expander';\nimport { HeadingTags } from './utils';\nimport { AnalyticsId } from '../../constants';\nimport { isComponent } from '../../utils/component';\n\nimport styles from './styles.module.scss';\n\nexport interface ExpanderHierarchyCommonProps {\n /** Changes the underlying element of the expander title. Default: h2. */\n htmlMarkup?: HeadingTags;\n /** Expand all children when printing. */\n print?: boolean;\n /** Expander nesting level. Should not be set manually. */\n level?: number;\n}\n\nexport interface ExpanderHierarchyProps extends ExpanderHierarchyCommonProps {\n children: React.ReactNode;\n /** Sets the data-testid attribute on the expander list. */\n testId?: string;\n}\n\nexport interface ExpanderHierarchyCompound extends React.FC<ExpanderHierarchyProps> {\n Expander: ExpanderType;\n}\n\nconst ExpanderHierarchy: ExpanderHierarchyCompound = ({\n htmlMarkup = 'h2',\n level = 1,\n print,\n children,\n testId,\n}: ExpanderHierarchyProps) => {\n const listClasses = classNames(\n styles.expanderhierarchy,\n level === 2 && styles[`expanderhierarchy--${level}`],\n level > 2 && styles[`expanderhierarchy--3-and-lower`]\n );\n\n return (\n <ul className={listClasses} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderHierarchy}>\n {React.Children.map(children, child =>\n isComponent<ExpanderProps>(child, Expander) ? React.cloneElement(child, { htmlMarkup, level, print }) : child\n )}\n </ul>\n );\n};\n\nExpanderHierarchy.Expander = Expander;\n\nexport default ExpanderHierarchy;\n","import ExpanderHierarchy from './ExpanderHierarchy';\nexport * from './ExpanderHierarchy';\nexport default ExpanderHierarchy;\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAMA,kBAAiD,EAAE,aAAa,MAAM,QAAQ,GAAG,OAAO,UAAU,UAAU,UAAU,aAAa;CACvI,MAAM,EAAE,WAAW,cAAc,kBAAqC;CACtE,MAAM,CAAC,YAAY,iBAAiB,UAAU,UAAU,SAAS;CAEjE,MAAM,oBAA0B;AAC9B,gBAAc,CAAC,WAAW;;CAG5B,MAAM,YAAY;CAElB,MAAM,gBAAgB,WACpB,OAAO,kBACP,QAAQ,KAAK,OAAO,kCACpB,SAAS,OAAO,2BACjB;CAED,MAAM,eAAe,WACnB,OAAO,kBACN,UAAU,KAAK,UAAU,KAAK,UAAU,MAAM,OAAO,oBAAoB,UAC1E,QAAQ,KAAK,OAAO,iCACpB,cAAc,OAAO,8BACrB,SAAS,OAAO,0BACjB;CAED,MAAM,cAAc,WAClB,OAAO,gBACP,QAA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CACrB;EAG6B,eAAa;EAAQ,oBAAkB,YAAY;YAC5E,MAAM,SAAS,IAAI,WAAU,UAC5B,YAA2B,OAAO,iBAAS,GAAG,MAAM,aAAa,OAAO;GAAE;GAAY;GAAO;GAAO,CAAC,GAAG,MACzG;GACE;;AAIT,kBAAkB,WAAW;AAE7B,IAAA,8BAAe;ACpDf,IAAA,4BAAe"}
@@ -9,8 +9,8 @@ import "../../theme.js";
9
9
  import "../../color.js";
10
10
  import "../../spacing.js";
11
11
  import "../../currys.js";
12
- import "../../Icon.js";
13
12
  import { n as mergeRefs } from "../../refs.js";
13
+ import "../../Icon.js";
14
14
  import "../../Check.js";
15
15
  import "../../Avatar.js";
16
16
  import "../../CheckFill.js";
@@ -55,8 +55,8 @@ import { t as useExpand } from "../../useExpand.js";
55
55
  import { t as isElementInViewport } from "../../viewport.js";
56
56
  import { i as listEditModeWrapperClassnames, t as ListEditMode_default } from "../../ListEditMode.js";
57
57
  import React, { useEffect, useId, useRef, useState } from "react";
58
- import cn from "classnames";
59
- import { jsx, jsxs } from "react/jsx-runtime";
58
+ import classNames from "classnames";
59
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
60
60
  import expanderListStyles from "./styles.module.scss";
61
61
  const Expander = React.forwardRef((props, ref) => {
62
62
  const { id, children, padding = true, color = "neutral", className = "", icon, large = false, title, titleHtmlMarkup = "span", expanded = false, testId, handleExpanderClick, onExpand, renderChildrenWhenClosed, variant = "line", zIndex = 0, highlightText, status = "none", editMode = false } = props;
@@ -68,7 +68,7 @@ const Expander = React.forwardRef((props, ref) => {
68
68
  const isFillNegative = variant === "fill-negative";
69
69
  const isOutline = variant === "outline";
70
70
  const isLine = variant === "line";
71
- const itemClasses = cn(className, expanderListStyles["expander-list__item"], {
71
+ const itemClasses = classNames(className, expanderListStyles["expander-list__item"], {
72
72
  [expanderListStyles[`expander-list__item--fill`]]: isFill,
73
73
  [expanderListStyles[`expander-list__item--fill--${color}`]]: isFill,
74
74
  [expanderListStyles[`expander-list__item--fill-negative`]]: isFillNegative,
@@ -79,7 +79,7 @@ const Expander = React.forwardRef((props, ref) => {
79
79
  [expanderListStyles[`expander-list__item--line--${color}`]]: isLine,
80
80
  [expanderListStyles[`expander-list__item--new`]]: status === "new"
81
81
  });
82
- const expanderClasses = cn(expanderListStyles["expander-list-link"], expanderListStyles[`expander-list-link--${color}`], {
82
+ const expanderClasses = classNames(expanderListStyles["expander-list-link"], expanderListStyles[`expander-list-link--${color}`], {
83
83
  [expanderListStyles[`expander-list-link--fill--${color}`]]: isFill,
84
84
  [expanderListStyles[`expander-list-link--fill-negative`]]: isFillNegative,
85
85
  [expanderListStyles[`expander-list-link--fill-negative--${color}`]]: isFillNegative,
@@ -93,7 +93,7 @@ const Expander = React.forwardRef((props, ref) => {
93
93
  const renderContent = () => {
94
94
  if (!renderChildrenWhenClosed && !isExpanded) return null;
95
95
  return /* @__PURE__ */ jsx("div", {
96
- className: cn(expanderListStyles["expander-list-link__main-content"], {
96
+ className: classNames(expanderListStyles["expander-list-link__main-content"], {
97
97
  [expanderListStyles["expander-list-link__main-content--expanded"]]: isExpanded,
98
98
  [expanderListStyles["expander-list-link__main-content--padding"]]: padding,
99
99
  [expanderListStyles[`expander-list-link__main-content--outline--${color}`]]: isOutline,
@@ -106,27 +106,30 @@ const Expander = React.forwardRef((props, ref) => {
106
106
  })
107
107
  });
108
108
  };
109
- const statusMarkerClasses = cn(expanderListStyles["expander-list__item__status-marker"], { [expanderListStyles["expander-list__item__status-marker--new"]]: status === "new" });
110
- return /* @__PURE__ */ jsxs("li", {
109
+ const statusMarkerClasses = classNames(expanderListStyles["expander-list__item__status-marker"], { [expanderListStyles["expander-list__item__status-marker--new"]]: status === "new" });
110
+ return /* @__PURE__ */ jsx(Fragment, { children: editMode ? /* @__PURE__ */ jsxs("div", {
111
+ className: itemClasses,
112
+ children: [status !== "none" && /* @__PURE__ */ jsx("div", { className: statusMarkerClasses }), /* @__PURE__ */ jsx("div", {
113
+ id,
114
+ "data-testid": testId,
115
+ "data-analyticsid": AnalyticsId.ExpanderListExpander,
116
+ className: expanderClasses,
117
+ children: renderElementHeader(title, {
118
+ titleHtmlMarkup,
119
+ isHovered: false,
120
+ size: large ? "large" : "medium",
121
+ parentType: "expanderlist",
122
+ chevronIcon: void 0,
123
+ icon,
124
+ highlightText
125
+ })
126
+ })]
127
+ }) : /* @__PURE__ */ jsxs("li", {
111
128
  className: itemClasses,
112
129
  ref: mergeRefs([ref, expanderRef]),
113
130
  children: [
114
131
  status !== "none" && /* @__PURE__ */ jsx("div", { className: statusMarkerClasses }),
115
- editMode ? /* @__PURE__ */ jsx("div", {
116
- id,
117
- "data-testid": testId,
118
- "data-analyticsid": AnalyticsId.ExpanderListExpander,
119
- className: expanderClasses,
120
- children: renderElementHeader(title, {
121
- titleHtmlMarkup,
122
- isHovered: false,
123
- size: large ? "large" : "medium",
124
- parentType: "expanderlist",
125
- chevronIcon: void 0,
126
- icon,
127
- highlightText
128
- })
129
- }) : /* @__PURE__ */ jsx("button", {
132
+ /* @__PURE__ */ jsx("button", {
130
133
  type: "button",
131
134
  id,
132
135
  onClick: handleExpanderClick,
@@ -146,9 +149,9 @@ const Expander = React.forwardRef((props, ref) => {
146
149
  highlightText
147
150
  })
148
151
  }),
149
- !editMode && renderContent()
152
+ renderContent()
150
153
  ]
151
- });
154
+ }) });
152
155
  });
153
156
  var isExpanderComponent = (element) => React.isValidElement(element) && element.type === Expander;
154
157
  const ExpanderList = React.forwardRef((props, ref) => {
@@ -156,7 +159,7 @@ const ExpanderList = React.forwardRef((props, ref) => {
156
159
  const [activeExpander, setActiveExpander] = useState();
157
160
  const [latestExpander, setLatestExpander] = useState();
158
161
  const expanderIdBase = useId();
159
- const expanderListClasses = cn(expanderListStyles["expander-list"], className, {
162
+ const expanderListClasses = classNames(expanderListStyles["expander-list"], className, {
160
163
  [expanderListStyles[`expander-list--outline--${color}`]]: variant === "outline",
161
164
  [expanderListStyles[`expander-list--fill`]]: variant === "fill" || variant === "fill-negative",
162
165
  [listEditModeWrapperClassnames]: editMode
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Expander: ExpanderType","highlightTextChild: string | undefined"],"sources":["../../../src/components/ExpanderList/ExpanderList.tsx","../../../src/components/ExpanderList/index.ts"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { PaletteNames } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport { ElementHeaderType, renderElementHeader } from '../ElementHeader/ElementHeader';\nimport Highlighter from '../Highlighter';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport ListEditModeItem, { ListEditModeItemProps, listEditModeWrapperClassnames } from '../ListEditMode';\nimport { TitleTags } from '../Title';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {\n ElementHeader?: ElementHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\nexport type ExpanderListStatus = 'none' | 'new';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n /**\n * @experimental This prop is experimental and may change in the future.\n * Enables ListEditMode\n */\n editMode?: boolean;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: JSX.Element | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n /** Highlights text in title and content. Override if different from list. */\n highlightText?: string;\n /** Displays a status on the left side: default none */\n status?: ExpanderListStatus;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'variant'> &\n ListEditModeItemProps;\n\nexport const Expander: ExpanderType = React.forwardRef<HTMLLIElement, ExpanderProps>((props, ref) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n zIndex = 0,\n highlightText,\n status = 'none',\n editMode = false,\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered, isFocused } = usePseudoClasses(triggerRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const itemClasses = classNames(className, expanderListStyles['expander-list__item'], {\n [expanderListStyles[`expander-list__item--fill`]]: isFill,\n [expanderListStyles[`expander-list__item--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list__item--fill-negative`]]: isFillNegative,\n [expanderListStyles[`expander-list__item--fill-negative--${color}`]]: isFillNegative,\n [expanderListStyles['expander-list__item--outline']]: isOutline,\n [expanderListStyles[`expander-list__item--outline--${color}`]]: isOutline,\n [expanderListStyles['expander-list__item--line']]: isLine,\n [expanderListStyles[`expander-list__item--line--${color}`]]: isLine,\n [expanderListStyles[`expander-list__item--new`]]: status === 'new',\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles[`expander-list-link--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list-link--fill-negative`]]: isFillNegative,\n [expanderListStyles[`expander-list-link--fill-negative--${color}`]]: isFillNegative,\n [expanderListStyles['expander-list-link--outline']]: isOutline,\n [expanderListStyles[`expander-list-link--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link--line--${color}`]]: isLine,\n [expanderListStyles['expander-list-link--open']]: isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n [expanderListStyles[`expander-list-link--new`]]: status === 'new',\n });\n\n const renderContent = (): React.ReactNode => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(expanderListStyles['expander-list-link__main-content'], {\n [expanderListStyles['expander-list-link__main-content--expanded']]: isExpanded,\n [expanderListStyles['expander-list-link__main-content--padding']]: padding,\n [expanderListStyles[`expander-list-link__main-content--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link__main-content--new`]]: status === 'new',\n });\n\n return (\n <div className={mainContentClasses} data-state={isExpanded ? 'open' : 'closed'}>\n <Highlighter searchText={highlightText}>{children}</Highlighter>\n </div>\n );\n };\n\n const statusMarkerClasses = classNames(expanderListStyles['expander-list__item__status-marker'], {\n [expanderListStyles['expander-list__item__status-marker--new']]: status === 'new',\n });\n\n return (\n <li className={itemClasses} ref={mergeRefs([ref, expanderRef])}>\n {status !== 'none' && <div className={statusMarkerClasses}></div>}\n {editMode ? (\n <div id={id} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderListExpander} className={expanderClasses}>\n {renderElementHeader(title, {\n titleHtmlMarkup,\n isHovered: false,\n size: large ? 'large' : 'medium',\n parentType: 'expanderlist',\n chevronIcon: undefined,\n icon,\n highlightText,\n })}\n </div>\n ) : (\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isFocused ? zIndex + 1 : zIndex,\n }}\n >\n {renderElementHeader(title, {\n titleHtmlMarkup,\n isHovered: isHovered || isFocused,\n size: large ? 'large' : 'medium',\n parentType: 'expanderlist',\n chevronIcon: isExpanded ? ChevronUp : ChevronDown,\n icon,\n highlightText,\n })}\n </button>\n )}\n {!editMode && renderContent()}\n </li>\n );\n});\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: unknown | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nexport const ExpanderList = React.forwardRef((props: ExpanderListProps, ref: React.Ref<HTMLUListElement>) => {\n const {\n children,\n childPadding = true,\n large,\n renderChildrenWhenClosed = false,\n color = 'white',\n className = '',\n accordion = false,\n testId,\n variant,\n zIndex,\n highlightText,\n editMode = false,\n } = props;\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const expanderIdBase = useId();\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className, {\n [expanderListStyles[`expander-list--outline--${color}`]]: variant === 'outline',\n [expanderListStyles[`expander-list--fill`]]: variant === 'fill' || variant === 'fill-negative',\n [listEditModeWrapperClassnames]: editMode,\n });\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n const getExpanderId = (index: number): string => `${expanderIdBase}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n useEffect(() => {\n const newActiveExpander = React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }, [children]);\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n const highlightTextChild: string | undefined = child.props.highlightText || highlightText;\n\n if (editMode) {\n return (\n <ListEditModeItem color={color} variant={variant} onDelete={child.props.onDelete}>\n {React.cloneElement(child, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n 'aria-expanded': false,\n className: expanderListStyles['expander-list__item'],\n renderChildrenWhenClosed: false,\n variant,\n zIndex: zIndex,\n highlightText: highlightTextChild,\n editMode: true,\n })}\n </ListEditModeItem>\n );\n } else {\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n 'aria-expanded': expanded,\n className: expanderListStyles['expander-list__item'],\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${expanderIdBase}-${index}`),\n renderChildrenWhenClosed,\n variant,\n zIndex: zIndex,\n highlightText: highlightTextChild,\n });\n }\n }\n return child;\n })}\n </ul>\n );\n}) as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n","import ExpanderList from './ExpanderList';\nexport * from './ExpanderList';\nexport default ExpanderList;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,MAAaA,WAAyB,MAAM,YAA0C,OAAO,QAAQ;CACnG,MAAM,EACJ,IACA,UACA,UAAU,MACV,QAAQ,WACR,YAAY,IACZ,MACA,QAAQ,OACR,OACA,kBAAkB,QAClB,WAAW,OACX,QACA,qBACA,UACA,0BACA,UAAU,QACV,SAAS,GACT,eACA,SAAS,QACT,WAAW,UACT;CACJ,MAAM,CAAC,cAAc,UAAU,UAAU,SAAS;CAClD,MAAM,cAAc,OAAsB,KAAK;CAC/C,MAAM,aAAa,OAA0B,KAAK;CAClD,MAAM,EAAE,WAAW,cAAc,iBAAiB,WAAW;CAE7D,MAAM,SAAS,YAAY;CAC3B,MAAM,iBAAiB,YAAY;CACnC,MAAM,YAAY,YAAY;CAC9B,MAAM,SAAS,YAAY;CAE3B,MAAM,cAAc,GAAW,WAAW,mBAAmB,wBAAwB;GAClF,mBAAmB,+BAA+B;GAClD,mBAAmB,8BAA8B,WAAW;GAC5D,mBAAmB,wCAAwC;GAC3D,mBAAmB,uCAAuC,WAAW;GACrE,mBAAmB,kCAAkC;GACrD,mBAAmB,iCAAiC,WAAW;GAC/D,mBAAmB,+BAA+B;GAClD,mBAAmB,8BAA8B,WAAW;GAC5D,mBAAmB,8BAA8B,WAAW;EAC9D,CAAC;CAEF,MAAM,kBAAkB,GAAW,mBAAmB,uBAAuB,mBAAmB,uBAAuB,UAAU;GAC9H,mBAAmB,6BAA6B,WAAW;GAC3D,mBAAmB,uCAAuC;GAC1D,mBAAmB,sCAAsC,WAAW;GAC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AAa;EAAQ,oBAAkB,YAAY;YAC9F,MAAM,SAAS,IAAI,WAAW,OAAO,UAAU;AAC9C,OAAI,oBAAoB,MAAM,EAAE;IAC9B,MAAM,KAAK,cAAc,MAAM;IAC/B,MAAM,WAAW,iBAAiB;IAClC,MAAMC,qBAAyC,MAAM,MAAM,iBAAiB;AAE5E,QAAI,SACF,QACE,oBAAC,sBAAA;KAAwB;KAAgB;KAAS,UAAU,MAAM,MAAM;eACrE,MAAM,aAAa,OAAO;MACzB;MACA,KAAK;MACL;MACA,SAAS;MACT;MACA;MACA,iBAAiB;MACjB,WAAW,mBAAmB;MAC9B,0BAA0B;MAC1B;MACQ;MACR,eAAe;MACf,UAAU;MACX,CAAC;MACe;QAGrB,QAAO,MAAM,aAAa,OAA4C;KACpE;KACA,KAAK;KACL;KACA,SAAS;KACT;KACA;KACA,iBAAiB;KACjB,WAAW,mBAAmB;KAC9B,sBAAsB,UAAyC,oBAAoB,OAAO,GAAG,eAAe,GAAG,QAAQ;KACvH;KACA;KACQ;KACR,eAAe;KAChB,CAAC;;AAGN,UAAO;IACP;GACC;EAEP;AAEF,aAAa,cAAc;AAC3B,aAAa,WAAW;AACxB,SAAS,cAAc;ACvUvB,IAAA,uBDyUe"}
1
+ {"version":3,"file":"index.js","names":["Expander: ExpanderType","highlightTextChild: string | undefined"],"sources":["../../../src/components/ExpanderList/ExpanderList.tsx","../../../src/components/ExpanderList/index.ts"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { PaletteNames } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport { ElementHeaderType, renderElementHeader } from '../ElementHeader/ElementHeader';\nimport Highlighter from '../Highlighter';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport ListEditModeItem, { ListEditModeItemProps, listEditModeWrapperClassnames } from '../ListEditMode';\nimport { TitleTags } from '../Title';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {\n ElementHeader?: ElementHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\nexport type ExpanderListStatus = 'none' | 'new';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n /**\n * @experimental This prop is experimental and may change in the future.\n * Enables ListEditMode\n */\n editMode?: boolean;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: JSX.Element | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n /** Highlights text in title and content. Override if different from list. */\n highlightText?: string;\n /** Displays a status on the left side: default none */\n status?: ExpanderListStatus;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'variant'> &\n ListEditModeItemProps;\n\nexport const Expander: ExpanderType = React.forwardRef<HTMLLIElement, ExpanderProps>((props, ref) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n zIndex = 0,\n highlightText,\n status = 'none',\n editMode = false,\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered, isFocused } = usePseudoClasses(triggerRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const itemClasses = classNames(className, expanderListStyles['expander-list__item'], {\n [expanderListStyles[`expander-list__item--fill`]]: isFill,\n [expanderListStyles[`expander-list__item--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list__item--fill-negative`]]: isFillNegative,\n [expanderListStyles[`expander-list__item--fill-negative--${color}`]]: isFillNegative,\n [expanderListStyles['expander-list__item--outline']]: isOutline,\n [expanderListStyles[`expander-list__item--outline--${color}`]]: isOutline,\n [expanderListStyles['expander-list__item--line']]: isLine,\n [expanderListStyles[`expander-list__item--line--${color}`]]: isLine,\n [expanderListStyles[`expander-list__item--new`]]: status === 'new',\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles[`expander-list-link--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list-link--fill-negative`]]: isFillNegative,\n [expanderListStyles[`expander-list-link--fill-negative--${color}`]]: isFillNegative,\n [expanderListStyles['expander-list-link--outline']]: isOutline,\n [expanderListStyles[`expander-list-link--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link--line--${color}`]]: isLine,\n [expanderListStyles['expander-list-link--open']]: isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n [expanderListStyles[`expander-list-link--new`]]: status === 'new',\n });\n\n const renderContent = (): React.ReactNode => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(expanderListStyles['expander-list-link__main-content'], {\n [expanderListStyles['expander-list-link__main-content--expanded']]: isExpanded,\n [expanderListStyles['expander-list-link__main-content--padding']]: padding,\n [expanderListStyles[`expander-list-link__main-content--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link__main-content--new`]]: status === 'new',\n });\n\n return (\n <div className={mainContentClasses} data-state={isExpanded ? 'open' : 'closed'}>\n <Highlighter searchText={highlightText}>{children}</Highlighter>\n </div>\n );\n };\n\n const statusMarkerClasses = classNames(expanderListStyles['expander-list__item__status-marker'], {\n [expanderListStyles['expander-list__item__status-marker--new']]: status === 'new',\n });\n\n return (\n <>\n {editMode ? (\n <div className={itemClasses}>\n {status !== 'none' && <div className={statusMarkerClasses}></div>}\n <div id={id} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderListExpander} className={expanderClasses}>\n {renderElementHeader(title, {\n titleHtmlMarkup,\n isHovered: false,\n size: large ? 'large' : 'medium',\n parentType: 'expanderlist',\n chevronIcon: undefined,\n icon,\n highlightText,\n })}\n </div>\n </div>\n ) : (\n <li className={itemClasses} ref={mergeRefs([ref, expanderRef])}>\n {status !== 'none' && <div className={statusMarkerClasses}></div>}\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isFocused ? zIndex + 1 : zIndex,\n }}\n >\n {renderElementHeader(title, {\n titleHtmlMarkup,\n isHovered: isHovered || isFocused,\n size: large ? 'large' : 'medium',\n parentType: 'expanderlist',\n chevronIcon: isExpanded ? ChevronUp : ChevronDown,\n icon,\n highlightText,\n })}\n </button>\n {renderContent()}\n </li>\n )}\n </>\n );\n});\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: unknown | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nexport const ExpanderList = React.forwardRef((props: ExpanderListProps, ref: React.Ref<HTMLUListElement>) => {\n const {\n children,\n childPadding = true,\n large,\n renderChildrenWhenClosed = false,\n color = 'white',\n className = '',\n accordion = false,\n testId,\n variant,\n zIndex,\n highlightText,\n editMode = false,\n } = props;\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const expanderIdBase = useId();\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className, {\n [expanderListStyles[`expander-list--outline--${color}`]]: variant === 'outline',\n [expanderListStyles[`expander-list--fill`]]: variant === 'fill' || variant === 'fill-negative',\n [listEditModeWrapperClassnames]: editMode,\n });\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n const getExpanderId = (index: number): string => `${expanderIdBase}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n useEffect(() => {\n const newActiveExpander = React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }, [children]);\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n const highlightTextChild: string | undefined = child.props.highlightText || highlightText;\n\n if (editMode) {\n return (\n <ListEditModeItem color={color} variant={variant} onDelete={child.props.onDelete}>\n {React.cloneElement(child, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n 'aria-expanded': false,\n className: expanderListStyles['expander-list__item'],\n renderChildrenWhenClosed: false,\n variant,\n zIndex: zIndex,\n highlightText: highlightTextChild,\n editMode: true,\n })}\n </ListEditModeItem>\n );\n } else {\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n 'aria-expanded': expanded,\n className: expanderListStyles['expander-list__item'],\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${expanderIdBase}-${index}`),\n renderChildrenWhenClosed,\n variant,\n zIndex: zIndex,\n highlightText: highlightTextChild,\n });\n }\n }\n return child;\n })}\n </ul>\n );\n}) as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n","import ExpanderList from './ExpanderList';\nexport * from './ExpanderList';\nexport default ExpanderList;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,MAAaA,WAAyB,MAAM,YAA0C,OAAO,QAAQ;CACnG,MAAM,EACJ,IACA,UACA,UAAU,MACV,QAAQ,WACR,YAAY,IACZ,MACA,QAAQ,OACR,OACA,kBAAkB,QAClB,WAAW,O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AAS;MACT;MACA;MACA,iBAAiB;MACjB,WAAW,mBAAmB;MAC9B,0BAA0B;MAC1B;MACQ;MACR,eAAe;MACf,UAAU;MACX,CAAC;MACe;QAGrB,QAAO,MAAM,aAAa,OAA4C;KACpE;KACA,KAAK;KACL;KACA,SAAS;KACT;KACA;KACA,iBAAiB;KACjB,WAAW,mBAAmB;KAC9B,sBAAsB,UAAyC,oBAAoB,OAAO,GAAG,eAAe,GAAG,QAAQ;KACvH;KACA;KACQ;KACR,eAAe;KAChB,CAAC;;AAGN,UAAO;IACP;GACC;EAEP;AAEF,aAAa,cAAc;AAC3B,aAAa,WAAW;AACxB,SAAS,cAAc;AC5UvB,IAAA,uBD8Ue"}
@@ -39,6 +39,7 @@
39
39
  grid-template:
40
40
  'header' auto
41
41
  'content' auto / 1fr auto;
42
+ width: 100%;
42
43
 
43
44
  &--new {
44
45
  grid-template:
@@ -1,7 +1,7 @@
1
1
  import { default as React, AriaAttributes } from 'react';
2
2
  import { HTMLButtonProps } from '../../constants';
3
3
  import { HNDesignsystemFavoriteButton } from '../../resources/Resources';
4
- export interface FavoriteButtonProps extends HTMLButtonProps, AriaAttributes {
4
+ export interface FavoriteButtonProps extends Omit<HTMLButtonProps, 'type'>, AriaAttributes {
5
5
  /** Determines if the FavoriteButton is checked */
6
6
  checked: boolean;
7
7
  /** Gives a unique id to the button */
@@ -1,11 +1,11 @@
1
1
  import { n as AnalyticsId, s as LanguageLocales } from "../../constants2.js";
2
2
  import { t as usePseudoClasses } from "../../usePseudoClasses.js";
3
3
  import "../../grid.js";
4
- import { r as useLanguage } from "../../language.js";
5
4
  import { t as isMutableRefObject } from "../../refs.js";
5
+ import { r as useLanguage } from "../../language.js";
6
6
  import { n as useBreakpoint, t as Breakpoint } from "../../useBreakpoint.js";
7
7
  import React from "react";
8
- import cn from "classnames";
8
+ import classNames from "classnames";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
10
  import styles from "./styles.module.scss";
11
11
  var HN_Designsystem_FavoriteButton_nb_NO_default = { ariaLabel: "Favorittmarkering" };
@@ -99,7 +99,7 @@ const starIconHoverDesktop = (isChecked, isActive) => /* @__PURE__ */ jsxs(Fragm
99
99
  })] });
100
100
  const FavoriteButton = React.forwardRef(function FavoriteButtonForwardedRef(props, ref) {
101
101
  const { checked, id, onClick, resources, tabIndex, testId, ...other } = props;
102
- const buttonWrapperClasses = cn(styles.favoritebutton);
102
+ const buttonWrapperClasses = classNames(styles.favoritebutton);
103
103
  const { refObject, isHovered, isActive } = usePseudoClasses(isMutableRefObject(ref) ? ref : null);
104
104
  const breakpoint = useBreakpoint();
105
105
  const { language } = useLanguage(LanguageLocales.NORWEGIAN);
@@ -134,7 +134,6 @@ const FavoriteButton = React.forwardRef(function FavoriteButtonForwardedRef(prop
134
134
  overflow: "visible",
135
135
  role: "presentation",
136
136
  viewBox: isMobile ? "0 0 41 41" : "0 0 61 61",
137
- ...other,
138
137
  children: starIcon
139
138
  })
140
139
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["mergedResources: HNDesignsystemFavoriteButton"],"sources":["../../../src/resources/HN.Designsystem.FavoriteButton.nb-NO.json","../../../src/components/FavoriteButton/resourceHelper.ts","../../../src/components/FavoriteButton/StarIcon.tsx","../../../src/components/FavoriteButton/FavoriteButton.tsx","../../../src/components/FavoriteButton/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Favorittmarkering\"\n}\n","import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.FavoriteButton.nb-NO.json';\nimport { HNDesignsystemFavoriteButton } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemFavoriteButton => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import styles from './styles.module.scss';\n\nconst normalStroke = 'var(--color-action-graphics-onlight)';\nconst normalFill = 'transparent';\nconst hoverFill = '#126F8721'; // kan ikke bruke transparent token på svg\nconst hoverStroke = 'var(--color-action-graphics-onlight-hover)';\nconst activeStroke = 'var(--core-color-blueberry-800)';\n\nconst fillColor = (isChecked: boolean, isActive: boolean, isHovered: boolean): string => {\n if (isChecked) {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n } else {\n if (isHovered) {\n return hoverFill;\n } else {\n return normalFill;\n }\n }\n};\n\nconst strokeColor = (isActive: boolean, isHovered: boolean): string => {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n};\n\nexport const starIconNormalMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => {\n return (\n <>\n <path\n d=\"M20.1026 31.1787L13.4007 34.7023C10.833 36.0523 7.83185 33.8719 8.32233 31.0126L9.60261 23.5492L4.17653 18.2675C2.09656 16.2428 3.24317 12.712 6.11581 12.2956L13.5982 11.2112L16.9493 4.42107C18.2332 1.81969 21.9426 1.81969 23.2265 4.42107L26.5776 11.2112L34.06 12.2956C36.9326 12.712 38.0792 16.2428 35.9993 18.2675L30.5732 23.5492L31.852 31.0044C32.3428 33.8651 29.3386 36.0456 26.7708 34.6925L20.1026 31.1787Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n display=\"block\"\n />\n <path\n d=\"M20.0961 26.5515L12.6372 30.4731L14.0621 22.1671L8.01953 16.2853L16.3582 15.0768L20.0877 7.52002L23.8171 15.0768L32.1558 16.2853L26.1133 22.1671L27.5381 30.4731L20.0961 26.5515Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n );\n};\n\nexport const starIconHoverMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M22.2128 31.4832L16.2246 36.117C13.9303 37.8924 10.5961 36.2662 10.5826 33.3653L10.5475 25.7929L4.28665 21.5336C1.88672 19.9009 2.40278 16.2246 5.15948 15.3158L12.3399 12.9486L14.461 5.67964C15.2736 2.89484 18.9267 2.2507 20.6428 4.58962L25.1221 10.6947L32.6791 10.4633C35.5804 10.3745 37.3227 13.6526 35.6259 16.0077L31.1994 22.1514L33.7534 29.2712C34.7335 32.0033 32.1536 34.6724 29.3898 33.7857L22.2128 31.4832Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M21.4079 26.8365L14.7433 31.9937L14.7041 23.5664L7.73204 18.8233L15.7342 16.1851L18.0947 8.09555L23.0798 14.8899L31.5016 14.6321L26.5722 21.4738L29.4178 29.4062L21.4079 26.8365Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\nexport const starIconNormalDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M30.1061 44.1854L20.3139 49.3338C17.7461 50.6838 14.745 48.5034 15.2355 45.6441L17.1061 34.7394L9.17653 27.0207C7.09656 24.9961 8.24318 21.4653 11.1158 21.0489L22.053 19.4638L26.9493 9.54278C28.2331 6.9414 31.9426 6.94139 33.2265 9.54278L38.1227 19.4638L49.06 21.0489C51.9326 21.4653 53.0792 24.9961 50.9993 27.0207L43.0697 34.7394L44.9389 45.6359C45.4296 48.4966 42.4254 50.6772 39.8576 49.324L30.1061 44.1854Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M30.0998 39.4723L19.5927 44.9966L21.5998 33.2961L13.0879 25.0106L24.8343 23.3082L30.0879 12.6632L35.3414 23.3082L47.0879 25.0106L38.576 33.2961L40.5831 44.9966L30.0998 39.4723Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n\nexport const starIconHoverDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M33.1609 44.7458L24.4114 51.5164C22.1171 53.2918 18.783 51.6656 18.7695 48.7646L18.7181 37.7007L9.56864 31.4763C7.1687 29.8436 7.68476 26.1672 10.4415 25.2584L20.9373 21.7982L24.0364 11.1776C24.849 8.39281 28.5021 7.74867 30.2182 10.0876L36.7629 19.0077L47.8092 18.6695C50.7105 18.5807 52.4528 21.8588 50.756 24.2138L44.2872 33.1922L48.0201 43.5985C49.0002 46.3306 46.4203 48.9997 43.6565 48.113L33.1609 44.7458Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M32.3991 40.1029L23.0108 47.3678L22.9557 35.4965L13.1343 28.815L24.4067 25.0987L27.732 13.7031L34.7542 23.2741L46.6178 22.9109L39.674 32.5486L43.6823 43.7228L32.3991 40.1029Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n","import React, { AriaAttributes } from 'react';\n\nimport classNames from 'classnames';\n\nimport { getResources } from './resourceHelper';\nimport { starIconHoverDesktop, starIconHoverMobile, starIconNormalDesktop, starIconNormalMobile } from './StarIcon';\nimport { AnalyticsId, HTMLButtonProps, LanguageLocales } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemFavoriteButton } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport { isMutableRefObject } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport interface FavoriteButtonProps extends HTMLButtonProps, AriaAttributes {\n /** Determines if the FavoriteButton is checked */\n checked: boolean;\n /** Gives a unique id to the button */\n id?: string;\n /** Function that is called when clicked */\n onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Resources for component */\n resources?: Partial<HNDesignsystemFavoriteButton>;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const FavoriteButton = React.forwardRef(function FavoriteButtonForwardedRef(\n props: FavoriteButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement>\n) {\n const { checked, id, onClick, resources, tabIndex, testId, ...other } = props;\n\n const buttonWrapperClasses = classNames(styles.favoritebutton);\n const { refObject, isHovered, isActive } = usePseudoClasses<HTMLButtonElement>(isMutableRefObject(ref) ? ref : null);\n const breakpoint = useBreakpoint();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemFavoriteButton = {\n ...defaultResources,\n ...resources,\n ariaLabel: other['aria-label'] || resources?.ariaLabel || defaultResources.ariaLabel,\n };\n\n const isMobile = breakpoint <= Breakpoint.sm;\n\n const starIcon = ((): React.JSX.Element => {\n if (isMobile) {\n if (isHovered) {\n return starIconHoverMobile(checked, isActive);\n } else {\n return starIconNormalMobile(checked, isActive);\n }\n } else {\n if (isHovered) {\n return starIconHoverDesktop(checked, isActive);\n } else {\n return starIconNormalDesktop(checked, isActive);\n }\n }\n })();\n\n return (\n <button\n id={id}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.FavoriteButton}\n className={buttonWrapperClasses}\n ref={refObject}\n tabIndex={tabIndex}\n role=\"switch\"\n aria-checked={checked}\n type=\"button\"\n aria-label={mergedResources.ariaLabel}\n {...other}\n >\n <svg focusable={false} overflow=\"visible\" role=\"presentation\" viewBox={isMobile ? '0 0 41 41' : '0 0 61 61'} {...other}>\n {starIcon}\n </svg>\n </button>\n );\n});\n\nFavoriteButton.displayName = 'FavoriteButton';\n\nexport default FavoriteButton;\n","export * from './FavoriteButton';\n\nimport { FavoriteButton } from './FavoriteButton';\nexport default FavoriteButton;\n"],"mappings":";;;;;;;;;;;ACIA,MAAa,gBAAgB,aAA4D;AACvF,SAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACNb,IAAM,eAAe;AACrB,IAAM,aAAa;AACnB,IAAM,YAAY;AAClB,IAAM,cAAc;AACpB,IAAM,eAAe;AAErB,IAAM,aAAa,WAAoB,UAAmB,cAA+B;AACvF,KAAI,UACF,KAAI,SACF,QAAO;UAEH,UACF,QAAO;KAEP,QAAO;UAIP,UACF,QAAO;KAEP,QAAO;;AAKb,IAAM,eAAe,UAAmB,cAA+B;AACrE,KAAI,SACF,QAAO;UAEH,UACF,QAAO;KAEP,QAAO;;AAKb,MAAa,wBAAwB,WAAoB,aAAyC;AAChG,QACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAA;EACC,GAAE;EACF,QAAO;EACP,MAAK;EACL,aAAY;EACZ,eAAc;EACd,WAAW,OAAO;EAClB,SAAQ;GACR,EACF,oBAAC,QAAA;EACC,GAAE;EACF,QAAQ,YAAY,UAAU,MAAM;EACpC,MAAM,UAAU,WAAW,UAAU,MAAM;EAC3C,aAAY;EACZ,eAAc;EACd,gBAAe;GACf,CAAA,EAAA,CACD;;AAIP,MAAa,uBAAuB,WAAoB,aACtD,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAA;CACC,GAAE;CACF,QAAO;CACP,MAAK;CACL,aAAY;CACZ,eAAc;CACd,WAAW,OAAO;EAClB,EACF,oBAAC,QAAA;CACC,GAAE;CACF,QAAQ,YAAY,UAAU,KAAK;CACnC,MAAM,UAAU,WAAW,UAAU,KAAK;C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ACF,KAAI,UACF,QAAO,oBAAoB,SAAS,SAAS;MAE7C,QAAO,qBAAqB,SAAS,SAAS;WAG5C,UACF,QAAO,qBAAqB,SAAS,SAAS;MAE9C,QAAO,sBAAsB,SAAS,SAAS;KAGjD;AAEJ,QACE,oBAAC,UAAA;EACK;EACK;EACT,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,KAAK;EACK;EACV,MAAK;EACL,gBAAc;EACd,MAAK;EACL,cAAY,gBAAgB;EAC5B,GAAI;YAEJ,oBAAC,OAAA;GAAI,WAAW;GAAO,UAAS;GAAU,MAAK;GAAe,SAAS,WAAW,cAAc;GAAa,GAAI;aAC9G;IACG;GACC;EAEX;AAEF,eAAe,cAAc;ACrF7B,IAAA,yBAAe"}
1
+ {"version":3,"file":"index.js","names":["mergedResources: HNDesignsystemFavoriteButton"],"sources":["../../../src/resources/HN.Designsystem.FavoriteButton.nb-NO.json","../../../src/components/FavoriteButton/resourceHelper.ts","../../../src/components/FavoriteButton/StarIcon.tsx","../../../src/components/FavoriteButton/FavoriteButton.tsx","../../../src/components/FavoriteButton/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Favorittmarkering\"\n}\n","import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.FavoriteButton.nb-NO.json';\nimport { HNDesignsystemFavoriteButton } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemFavoriteButton => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import styles from './styles.module.scss';\n\nconst normalStroke = 'var(--color-action-graphics-onlight)';\nconst normalFill = 'transparent';\nconst hoverFill = '#126F8721'; // kan ikke bruke transparent token på svg\nconst hoverStroke = 'var(--color-action-graphics-onlight-hover)';\nconst activeStroke = 'var(--core-color-blueberry-800)';\n\nconst fillColor = (isChecked: boolean, isActive: boolean, isHovered: boolean): string => {\n if (isChecked) {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n } else {\n if (isHovered) {\n return hoverFill;\n } else {\n return normalFill;\n }\n }\n};\n\nconst strokeColor = (isActive: boolean, isHovered: boolean): string => {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n};\n\nexport const starIconNormalMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => {\n return (\n <>\n <path\n d=\"M20.1026 31.1787L13.4007 34.7023C10.833 36.0523 7.83185 33.8719 8.32233 31.0126L9.60261 23.5492L4.17653 18.2675C2.09656 16.2428 3.24317 12.712 6.11581 12.2956L13.5982 11.2112L16.9493 4.42107C18.2332 1.81969 21.9426 1.81969 23.2265 4.42107L26.5776 11.2112L34.06 12.2956C36.9326 12.712 38.0792 16.2428 35.9993 18.2675L30.5732 23.5492L31.852 31.0044C32.3428 33.8651 29.3386 36.0456 26.7708 34.6925L20.1026 31.1787Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n display=\"block\"\n />\n <path\n d=\"M20.0961 26.5515L12.6372 30.4731L14.0621 22.1671L8.01953 16.2853L16.3582 15.0768L20.0877 7.52002L23.8171 15.0768L32.1558 16.2853L26.1133 22.1671L27.5381 30.4731L20.0961 26.5515Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n );\n};\n\nexport const starIconHoverMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M22.2128 31.4832L16.2246 36.117C13.9303 37.8924 10.5961 36.2662 10.5826 33.3653L10.5475 25.7929L4.28665 21.5336C1.88672 19.9009 2.40278 16.2246 5.15948 15.3158L12.3399 12.9486L14.461 5.67964C15.2736 2.89484 18.9267 2.2507 20.6428 4.58962L25.1221 10.6947L32.6791 10.4633C35.5804 10.3745 37.3227 13.6526 35.6259 16.0077L31.1994 22.1514L33.7534 29.2712C34.7335 32.0033 32.1536 34.6724 29.3898 33.7857L22.2128 31.4832Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M21.4079 26.8365L14.7433 31.9937L14.7041 23.5664L7.73204 18.8233L15.7342 16.1851L18.0947 8.09555L23.0798 14.8899L31.5016 14.6321L26.5722 21.4738L29.4178 29.4062L21.4079 26.8365Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\nexport const starIconNormalDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M30.1061 44.1854L20.3139 49.3338C17.7461 50.6838 14.745 48.5034 15.2355 45.6441L17.1061 34.7394L9.17653 27.0207C7.09656 24.9961 8.24318 21.4653 11.1158 21.0489L22.053 19.4638L26.9493 9.54278C28.2331 6.9414 31.9426 6.94139 33.2265 9.54278L38.1227 19.4638L49.06 21.0489C51.9326 21.4653 53.0792 24.9961 50.9993 27.0207L43.0697 34.7394L44.9389 45.6359C45.4296 48.4966 42.4254 50.6772 39.8576 49.324L30.1061 44.1854Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M30.0998 39.4723L19.5927 44.9966L21.5998 33.2961L13.0879 25.0106L24.8343 23.3082L30.0879 12.6632L35.3414 23.3082L47.0879 25.0106L38.576 33.2961L40.5831 44.9966L30.0998 39.4723Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n\nexport const starIconHoverDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M33.1609 44.7458L24.4114 51.5164C22.1171 53.2918 18.783 51.6656 18.7695 48.7646L18.7181 37.7007L9.56864 31.4763C7.1687 29.8436 7.68476 26.1672 10.4415 25.2584L20.9373 21.7982L24.0364 11.1776C24.849 8.39281 28.5021 7.74867 30.2182 10.0876L36.7629 19.0077L47.8092 18.6695C50.7105 18.5807 52.4528 21.8588 50.756 24.2138L44.2872 33.1922L48.0201 43.5985C49.0002 46.3306 46.4203 48.9997 43.6565 48.113L33.1609 44.7458Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M32.3991 40.1029L23.0108 47.3678L22.9557 35.4965L13.1343 28.815L24.4067 25.0987L27.732 13.7031L34.7542 23.2741L46.6178 22.9109L39.674 32.5486L43.6823 43.7228L32.3991 40.1029Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n","import React, { AriaAttributes } from 'react';\n\nimport classNames from 'classnames';\n\nimport { getResources } from './resourceHelper';\nimport { starIconHoverDesktop, starIconHoverMobile, starIconNormalDesktop, starIconNormalMobile } from './StarIcon';\nimport { AnalyticsId, HTMLButtonProps, LanguageLocales } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemFavoriteButton } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport { isMutableRefObject } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport interface FavoriteButtonProps extends Omit<HTMLButtonProps, 'type'>, AriaAttributes {\n /** Determines if the FavoriteButton is checked */\n checked: boolean;\n /** Gives a unique id to the button */\n id?: string;\n /** Function that is called when clicked */\n onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Resources for component */\n resources?: Partial<HNDesignsystemFavoriteButton>;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const FavoriteButton = React.forwardRef(function FavoriteButtonForwardedRef(\n props: FavoriteButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement>\n) {\n const { checked, id, onClick, resources, tabIndex, testId, ...other } = props;\n\n const buttonWrapperClasses = classNames(styles.favoritebutton);\n const { refObject, isHovered, isActive } = usePseudoClasses<HTMLButtonElement>(isMutableRefObject(ref) ? ref : null);\n const breakpoint = useBreakpoint();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemFavoriteButton = {\n ...defaultResources,\n ...resources,\n ariaLabel: other['aria-label'] || resources?.ariaLabel || defaultResources.ariaLabel,\n };\n\n const isMobile = breakpoint <= Breakpoint.sm;\n\n const starIcon = ((): React.JSX.Element => {\n if (isMobile) {\n if (isHovered) {\n return starIconHoverMobile(checked, isActive);\n } else {\n return starIconNormalMobile(checked, isActive);\n }\n } else {\n if (isHovered) {\n return starIconHoverDesktop(checked, isActive);\n } else {\n return starIconNormalDesktop(checked, isActive);\n }\n }\n })();\n\n return (\n <button\n id={id}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.FavoriteButton}\n className={buttonWrapperClasses}\n ref={refObject}\n tabIndex={tabIndex}\n role=\"switch\"\n aria-checked={checked}\n type=\"button\"\n aria-label={mergedResources.ariaLabel}\n {...other}\n >\n <svg focusable={false} overflow=\"visible\" role=\"presentation\" viewBox={isMobile ? '0 0 41 41' : '0 0 61 61'}>\n {starIcon}\n </svg>\n </button>\n );\n});\n\nFavoriteButton.displayName = 'FavoriteButton';\n\nexport default FavoriteButton;\n","export * from './FavoriteButton';\n\nimport { FavoriteButton } from './FavoriteButton';\nexport default FavoriteButton;\n"],"mappings":";;;;;;;;;;;ACIA,MAAa,gBAAgB,aAA4D;AACvF,SAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACNb,IAAM,eAAe;AACrB,IAAM,aAAa;AACnB,IAAM,YAAY;AAClB,IAAM,cAAc;AACpB,IAAM,eAAe;AAErB,IAAM,aAAa,WAAoB,UAAmB,cAA+B;AACvF,KAAI,UACF,KAAI,SACF,QAAO;UAEH,UACF,QAAO;KAEP,QAAO;UAIP,UACF,QAAO;KAEP,QAAO;;AAKb,IAAM,eAAe,UAAmB,cAA+B;AACrE,KAAI,SACF,QAAO;UAEH,UACF,QAAO;KAEP,QAAO;;AAKb,MAAa,wBAAwB,WAAoB,aAAyC;AAChG,QACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAA;EACC,GAAE;EACF,QAAO;EACP,MAAK;EACL,aAAY;EACZ,eAAc;EACd,WAAW,OAAO;EAClB,SAAQ;GACR,EACF,oBAAC,QAAA;EACC,GAAE;EACF,QAAQ,YAAY,UAAU,MAAM;EACpC,MAAM,UAAU,WAAW,UAAU,MAAM;EAC3C,aAAY;EACZ,eAAc;EACd,gBAAe;GACf,CAAA,EAAA,CACD;;AAIP,MAAa,uBAAuB,WAAoB,aACtD,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAA;CACC,GAAE;CACF,QAAO;CACP,MAAK;CACL,aAAY;CACZ,eAAc;CACd,WAAW,OAAO;EAClB,EACF,oBAAC,QAAA;CACC,GAAE;CACF,QAAQ,YAAY,UAAU,KAAK;CACnC,MAAM,UAAU,WAAW,UAAU,KAAK;CAC1C,aAAa,YAAY,MAAM;CAC/B,aAAY;CACZ,eAAc;CACd,gBAAe;EACf,CAAA,EAAA,CACD;AAEL,MAAa,yBAAyB,WAAoB,aACxD,qBAAA,UAAA,EAAA,U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AS,SAAS;KAGjD;AAEJ,QACE,oBAAC,UAAA;EACK;EACK;EACT,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,KAAK;EACK;EACV,MAAK;EACL,gBAAc;EACd,MAAK;EACL,cAAY,gBAAgB;EAC5B,GAAI;YAEJ,oBAAC,OAAA;GAAI,WAAW;GAAO,UAAS;GAAU,MAAK;GAAe,SAAS,WAAW,cAAc;aAC7F;IACG;GACC;EAEX;AAEF,eAAe,cAAc;ACrF7B,IAAA,yBAAe"}
@@ -9,9 +9,9 @@ import "../../theme.js";
9
9
  import "../../color.js";
10
10
  import "../../spacing.js";
11
11
  import "../../currys.js";
12
+ import "../../refs.js";
12
13
  import "../../Icon.js";
13
14
  import "../../language.js";
14
- import "../../refs.js";
15
15
  import "../../Check.js";
16
16
  import "../../_rolldown_dynamic_import_helper.js";
17
17
  import "../../useIsServerSide.js";
@@ -7,11 +7,12 @@ import "../../theme.js";
7
7
  import "../../color.js";
8
8
  import "../../spacing.js";
9
9
  import "../../currys.js";
10
+ import "../../refs.js";
11
+ import "../../AsChildSlot.js";
10
12
  import "../../Icon.js";
11
13
  import "../../ArrowUpRight.js";
12
14
  import { t as AnchorLink_default } from "../../AnchorLink.js";
13
15
  import { r as useLanguage } from "../../language.js";
14
- import "../../refs.js";
15
16
  import "../../useBreakpoint.js";
16
17
  import "../../useIsMobileBreakpoint.js";
17
18
  import "../../accessibility.js";
@@ -20,7 +21,7 @@ import { t as Close_default } from "../../Close.js";
20
21
  import "../../floating-ui.react.js";
21
22
  import { n as PopOverVariant, t as PopOver_default } from "../../PopOver.js";
22
23
  import React from "react";
23
- import cn from "classnames";
24
+ import classNames from "classnames";
24
25
  import { jsx, jsxs } from "react/jsx-runtime";
25
26
  import styles from "./styles.module.scss";
26
27
  var HN_Designsystem_HelpBubble_nb_NO_default = { ariaLabel: "Hjelpetekst" };
@@ -41,8 +42,8 @@ var HelpBubble = React.forwardRef((props, ref) => {
41
42
  ...resources,
42
43
  ariaLabel: props.ariaLabel ?? resources?.ariaLabel ?? defaultResources.ariaLabel
43
44
  };
44
- const helpBubbleClasses = cn(styles.helpbubble, className);
45
- const contentClasses = cn(styles.helpbubble__content);
45
+ const helpBubbleClasses = classNames(styles.helpbubble, className);
46
+ const contentClasses = classNames(styles.helpbubble__content);
46
47
  const renderLink = () => {
47
48
  if (onLinkClick && linkText) return /* @__PURE__ */ jsx("button", {
48
49
  className: styles.helpbubble__link,
@@ -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,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;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=\"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"}
@@ -7,9 +7,9 @@ import "../../palette.js";
7
7
  import "../../spacers.js";
8
8
  import "../../theme.js";
9
9
  import "../../color.js";
10
+ import "../../refs.js";
10
11
  import "../../Icon.js";
11
12
  import { r as useLanguage } from "../../language.js";
12
- import "../../refs.js";
13
13
  import "../../_rolldown_dynamic_import_helper.js";
14
14
  import "../../useIsServerSide.js";
15
15
  import "../../LazyIcon.js";
@@ -47,15 +47,16 @@ const getResources = (language) => {
47
47
  }
48
48
  };
49
49
  var HelpDrawer = (props) => {
50
+ const { resources, ...drawerProps } = props;
50
51
  const { language } = useLanguage(LanguageLocales.NORWEGIAN);
51
52
  const defaultResources = getResources(language);
52
53
  const mergedResources = {
53
54
  ...defaultResources,
54
- ...props.resources,
55
+ ...resources,
55
56
  ariaLabel: props.ariaLabel ?? props.resources?.ariaLabel ?? defaultResources.ariaLabel
56
57
  };
57
58
  return /* @__PURE__ */ jsx(Drawer_default, {
58
- ...props,
59
+ ...drawerProps,
59
60
  closeColor: "plum",
60
61
  headerClasses: styles["help-drawer"],
61
62
  desktopDirection: "left",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["HelpDrawer: React.FC<HelpDrawerProps>","mergedResources: HNDesignsystemHelpDrawer"],"sources":["../../../src/resources/HN.Designsystem.HelpDrawer.nb-NO.json","../../../src/components/HelpDrawer/resourceHelper.ts","../../../src/components/HelpDrawer/HelpDrawer.tsx","../../../src/components/HelpDrawer/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Hjelpetekst\"\n}\n","import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.HelpDrawer.nb-NO.json';\nimport { HNDesignsystemHelpDrawer } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemHelpDrawer => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport { getResources } from './resourceHelper';\nimport { LanguageLocales } from '../../constants';\nimport { HNDesignsystemHelpDrawer } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport Drawer, { DrawerProps } from '../Drawer';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpDrawerProps\n extends Pick<\n DrawerProps,\n | 'ariaLabel'\n | 'ariaLabelledBy'\n | 'ariaLabelCloseBtn'\n | 'children'\n | 'isOpen'\n | 'onRequestClose'\n | 'title'\n | 'titleHtmlMarkup'\n | 'titleId'\n | 'zIndex'\n > {\n /** Resources for the component */\n resources?: Partial<HNDesignsystemHelpDrawer>;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpDrawer: React.FC<HelpDrawerProps> = props => {\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemHelpDrawer = {\n ...defaultResources,\n ...props.resources,\n ariaLabel: props.ariaLabel ?? props.resources?.ariaLabel ?? defaultResources.ariaLabel,\n };\n\n return (\n <Drawer\n {...props}\n closeColor={'plum'}\n headerClasses={styles['help-drawer']}\n desktopDirection={'left'}\n ariaLabel={mergedResources.ariaLabel}\n />\n );\n};\n\nexport default HelpDrawer;\n","import HelpDrawer from './HelpDrawer';\nexport * from './HelpDrawer';\nexport default HelpDrawer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,MAAa,gBAAgB,aAAwD;AACnF,SAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACsBb,IAAMA,cAAwC,UAAS;CACrD,MAAM,EAAE,aAAa,YAA6B,gBAAgB,UAAU;CAC5E,MAAM,mBAAmB,aAAa,SAAS;CAC/C,MAAMC,kBAA4C;EAChD,GAAG;EACH,GAAG,MAAM;EACT,WAAW,MAAM,aAAa,MAAM,WAAW,aAAa,iBAAiB;EAC9E;AAED,QACE,oBAAC,gBAAA;EACC,GAAI;EACJ,YAAY;EACZ,eAAe,OAAO;EACtB,kBAAkB;EAClB,WAAW,gBAAgB;GAC3B;;AC5CN,IAAA,qBDgDe"}
1
+ {"version":3,"file":"index.js","names":["HelpDrawer: React.FC<HelpDrawerProps>","mergedResources: HNDesignsystemHelpDrawer"],"sources":["../../../src/resources/HN.Designsystem.HelpDrawer.nb-NO.json","../../../src/components/HelpDrawer/resourceHelper.ts","../../../src/components/HelpDrawer/HelpDrawer.tsx","../../../src/components/HelpDrawer/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Hjelpetekst\"\n}\n","import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.HelpDrawer.nb-NO.json';\nimport { HNDesignsystemHelpDrawer } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemHelpDrawer => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport { getResources } from './resourceHelper';\nimport { LanguageLocales } from '../../constants';\nimport { HNDesignsystemHelpDrawer } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport Drawer, { DrawerProps } from '../Drawer';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpDrawerProps\n extends Pick<\n DrawerProps,\n | 'ariaLabel'\n | 'ariaLabelledBy'\n | 'ariaLabelCloseBtn'\n | 'children'\n | 'isOpen'\n | 'onRequestClose'\n | 'title'\n | 'titleHtmlMarkup'\n | 'titleId'\n | 'zIndex'\n > {\n /** Resources for the component */\n resources?: Partial<HNDesignsystemHelpDrawer>;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpDrawer: React.FC<HelpDrawerProps> = props => {\n const { resources, ...drawerProps } = props;\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemHelpDrawer = {\n ...defaultResources,\n ...resources,\n ariaLabel: props.ariaLabel ?? props.resources?.ariaLabel ?? defaultResources.ariaLabel,\n };\n\n return (\n <Drawer\n {...drawerProps}\n closeColor={'plum'}\n headerClasses={styles['help-drawer']}\n desktopDirection={'left'}\n ariaLabel={mergedResources.ariaLabel}\n />\n );\n};\n\nexport default HelpDrawer;\n","import HelpDrawer from './HelpDrawer';\nexport * from './HelpDrawer';\nexport default HelpDrawer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,MAAa,gBAAgB,aAAwD;AACnF,SAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACsBb,IAAMA,cAAwC,UAAS;CACrD,MAAM,EAAE,WAAW,GAAG,gBAAgB;CACtC,MAAM,EAAE,aAAa,YAA6B,gBAAgB,UAAU;CAC5E,MAAM,mBAAmB,aAAa,SAAS;CAC/C,MAAMC,kBAA4C;EAChD,GAAG;EACH,GAAG;EACH,WAAW,MAAM,aAAa,MAAM,WAAW,aAAa,iBAAiB;EAC9E;AAED,QACE,oBAAC,gBAAA;EACC,GAAI;EACJ,YAAY;EACZ,eAAe,OAAO;EACtB,kBAAkB;EAClB,WAAW,gBAAgB;GAC3B;;AC7CN,IAAA,qBDiDe"}
@@ -1,8 +1,8 @@
1
1
  import { a as IconSize, n as AnalyticsId } from "../../constants2.js";
2
2
  import { t as usePseudoClasses } from "../../usePseudoClasses.js";
3
3
  import "../../grid.js";
4
- import { t as Icon_default } from "../../Icon.js";
5
4
  import { n as mergeRefs } from "../../refs.js";
5
+ import { t as Icon_default } from "../../Icon.js";
6
6
  import "../../useBreakpoint.js";
7
7
  import "../../useIsMobileBreakpoint.js";
8
8
  import { n as getAriaLabelAttributes } from "../../accessibility.js";
@@ -23,7 +23,7 @@ var HelpExpanderStandalone = React.forwardRef(({ ariaLabel, ariaLabelledById, ch
23
23
  id: ariaLabelledById
24
24
  });
25
25
  const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);
26
- const { refObject, isHovered } = usePseudoClasses(ref, false);
26
+ const { refObject, isHovered } = usePseudoClasses(ref);
27
27
  return /* @__PURE__ */ jsxs("div", {
28
28
  className,
29
29
  "data-testid": testId,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/HelpExpanderStandalone/HelpExpanderStandalone.tsx","../../../src/components/HelpExpanderStandalone/index.ts"],"sourcesContent":["import React from 'react';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport HelpDetails from '../HelpDetails/HelpDetails';\nimport { HelpTriggerWeights } from '../HelpTriggerIcon/HelpTriggerIcon';\nimport HelpTriggerStandalone from '../HelpTriggerStandalone';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpExpanderStandaloneProps {\n /** Sets aria-label of the trigger. */\n ariaLabel?: string;\n /** Sets aria-labelledby of the trigger. */\n ariaLabelledById?: string;\n /** Sets the text content of the help text that appears when expanded. */\n children: React.ReactNode;\n /** Expands the component */\n expanded?: boolean;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\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 /** Sets the data-testid attribute. */\n testId?: string;\n /** The text that will be displayed in the trigger. */\n triggerText: string;\n}\n\nconst HelpExpanderStandalone = React.forwardRef<HTMLButtonElement, HelpExpanderStandaloneProps>(\n ({ ariaLabel, ariaLabelledById, children, className, expanded = false, onExpand, testId, triggerText, weight = 'normal' }, ref) => {\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>, false);\n\n return (\n <div className={className} data-testid={testId} data-analyticsid={AnalyticsId.HelpExpanderStandalone}>\n <HelpTriggerStandalone\n className={styles['help-expander-standalone-trigger']}\n aria-expanded={isExpanded}\n onClick={(): void => setIsExpanded(!isExpanded)}\n ref={mergeRefs([ref, refObject])}\n weight={weight}\n {...ariaLabelAttributes}\n >\n {triggerText}\n <Icon\n color={`var(--core-color-plum-${isHovered ? '900' : '700'})`}\n svgIcon={isExpanded ? ChevronUp : ChevronDown}\n size={IconSize.XXSmall}\n />\n </HelpTriggerStandalone>\n {isExpanded && <HelpDetails>{children}</HelpDetails>}\n </div>\n );\n }\n);\n\nHelpExpanderStandalone.displayName = 'HelpExpanderStandalone';\n\nexport default HelpExpanderStandalone;\n","import HelpExpanderStandalone from './HelpExpanderStandalone';\nexport * from './HelpExpanderStandalone';\nexport default HelpExpanderStandalone;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyCA,IAAM,yBAAyB,MAAM,YAClC,EAAE,WAAW,kBAAkB,UAAU,WAAW,WAAW,OAAO,UAAU,QAAQ,aAAa,SAAS,YAAY,QAAQ;CACjI,MAAM,sBAAsB,uBAAuB;EAAE,OAAO;EAAW,IAAI;EAAkB,CAAC;CAC9F,MAAM,CAAC,YAAY,iBAAiB,UAAU,UAAU,SAAS;CACjE,MAAM,EAAE,WAAW,cAAc,iBAAoC,KAA2C,MAAM;AAEtH,QACE,qBAAC,OAAA;EAAe;EAAW,eAAa;EAAQ,oBAAkB,YAAY;aAC5E,qBAAC,+BAAA;GACC,WAAW,OAAO;GAClB,iBAAe;GACf,eAAqB,cAAc,CAAC,WAAW;GAC/C,KAAK,UAAU,CAAC,KAAK,UAAU,CAAC;GACxB;GACR,GAAI;cAEH,aACD,oBAAC,cAAA;IACC,OAAO,yBAAyB,YAAY,QAAQ,MAAM;IAC1D,SAAS,aAAa,oBAAY;IAClC,MAAM,SAAS;KACf,CAAA;IACoB,EACvB,cAAc,oBAAC,qBAAA,EAAa,UAAA,CAAuB,CAAA;GAChD;EAGX;AAED,uBAAuB,cAAc;ACpErC,IAAA,iCDsEe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/HelpExpanderStandalone/HelpExpanderStandalone.tsx","../../../src/components/HelpExpanderStandalone/index.ts"],"sourcesContent":["import React from 'react';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport HelpDetails from '../HelpDetails/HelpDetails';\nimport { HelpTriggerWeights } from '../HelpTriggerIcon/HelpTriggerIcon';\nimport HelpTriggerStandalone from '../HelpTriggerStandalone';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpExpanderStandaloneProps {\n /** Sets aria-label of the trigger. */\n ariaLabel?: string;\n /** Sets aria-labelledby of the trigger. */\n ariaLabelledById?: string;\n /** Sets the text content of the help text that appears when expanded. */\n children: React.ReactNode;\n /** Expands the component */\n expanded?: boolean;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\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 /** Sets the data-testid attribute. */\n testId?: string;\n /** The text that will be displayed in the trigger. */\n triggerText: string;\n}\n\nconst HelpExpanderStandalone = React.forwardRef<HTMLButtonElement, HelpExpanderStandaloneProps>(\n ({ ariaLabel, ariaLabelledById, children, className, expanded = false, onExpand, testId, triggerText, weight = 'normal' }, ref) => {\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>);\n\n return (\n <div className={className} data-testid={testId} data-analyticsid={AnalyticsId.HelpExpanderStandalone}>\n <HelpTriggerStandalone\n className={styles['help-expander-standalone-trigger']}\n aria-expanded={isExpanded}\n onClick={(): void => setIsExpanded(!isExpanded)}\n ref={mergeRefs([ref, refObject])}\n weight={weight}\n {...ariaLabelAttributes}\n >\n {triggerText}\n <Icon\n color={`var(--core-color-plum-${isHovered ? '900' : '700'})`}\n svgIcon={isExpanded ? ChevronUp : ChevronDown}\n size={IconSize.XXSmall}\n />\n </HelpTriggerStandalone>\n {isExpanded && <HelpDetails>{children}</HelpDetails>}\n </div>\n );\n }\n);\n\nHelpExpanderStandalone.displayName = 'HelpExpanderStandalone';\n\nexport default HelpExpanderStandalone;\n","import HelpExpanderStandalone from './HelpExpanderStandalone';\nexport * from './HelpExpanderStandalone';\nexport default HelpExpanderStandalone;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyCA,IAAM,yBAAyB,MAAM,YAClC,EAAE,WAAW,kBAAkB,UAAU,WAAW,WAAW,OAAO,UAAU,QAAQ,aAAa,SAAS,YAAY,QAAQ;CACjI,MAAM,sBAAsB,uBAAuB;EAAE,OAAO;EAAW,IAAI;EAAkB,CAAC;CAC9F,MAAM,CAAC,YAAY,iBAAiB,UAAU,UAAU,SAAS;CACjE,MAAM,EAAE,WAAW,cAAc,iBAAoC,IAA0C;AAE/G,QACE,qBAAC,OAAA;EAAe;EAAW,eAAa;EAAQ,oBAAkB,YAAY;aAC5E,qBAAC,+BAAA;GACC,WAAW,OAAO;GAClB,iBAAe;GACf,eAAqB,cAAc,CAAC,WAAW;GAC/C,KAAK,UAAU,CAAC,KAAK,UAAU,CAAC;GACxB;GACR,GAAI;cAEH,aACD,oBAAC,cAAA;IACC,OAAO,yBAAyB,YAAY,QAAQ,MAAM;IAC1D,SAAS,aAAa,oBAAY;IAClC,MAAM,SAAS;KACf,CAAA;IACoB,EACvB,cAAc,oBAAC,qBAAA,EAAa,UAAA,CAAuB,CAAA;GAChD;EAGX;AAED,uBAAuB,cAAc;ACpErC,IAAA,iCDsEe"}
@@ -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 cn from "classnames";
36
+ import classNames 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: cn([styles["help-panel"]], className),
41
+ className: classNames([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,GAAW,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,WAAW,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 cn from "classnames";
7
+ import classNames 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,8 +12,8 @@ var HelpTriggerInline = React.forwardRef(({ ariaLabel, ariaLabelledById, childre
12
12
  label: ariaLabel,
13
13
  id: ariaLabelledById
14
14
  });
15
- const helpTriggerInlineStyles = cn(styles["help-trigger-inline"], className);
16
- const { refObject, isHovered } = usePseudoClasses(ref, false);
15
+ const helpTriggerInlineStyles = classNames(styles["help-trigger-inline"], className);
16
+ const { refObject, isHovered } = usePseudoClasses(ref);
17
17
  return /* @__PURE__ */ jsxs("button", {
18
18
  "aria-label": ariaLabel,
19
19
  type: "button",