@helsenorge/designsystem-react 7.12.0 → 7.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/_virtual/dynamic-import-helper.js +11 -4
  3. package/_virtual/dynamic-import-helper.js.map +1 -1
  4. package/_virtual/index.js +2 -2
  5. package/components/AnchorLink/AnchorLink.js +16 -16
  6. package/components/AnchorLink/AnchorLink.js.map +1 -1
  7. package/components/Avatar/Avatar.js +9 -9
  8. package/components/Avatar/Avatar.js.map +1 -1
  9. package/components/Badge/Badge.js +7 -7
  10. package/components/Badge/Badge.js.map +1 -1
  11. package/components/Badge/NotificationBadge.js +5 -5
  12. package/components/Badge/NotificationBadge.js.map +1 -1
  13. package/components/Button/Button.js +23 -23
  14. package/components/Button/Button.js.map +1 -1
  15. package/components/ButtonWithModal/ButtonWithModal.js +5 -5
  16. package/components/ButtonWithModal/ButtonWithModal.js.map +1 -1
  17. package/components/Checkbox/Checkbox.js +41 -42
  18. package/components/Checkbox/Checkbox.js.map +1 -1
  19. package/components/Checkbox/index.js +2 -3
  20. package/components/Checkbox/index.js.map +1 -1
  21. package/components/Checkbox/styles.module.scss +2 -2
  22. package/components/Close/Close.js +9 -9
  23. package/components/Close/Close.js.map +1 -1
  24. package/components/DictionaryTrigger/DictionaryTrigger.js +14 -15
  25. package/components/DictionaryTrigger/DictionaryTrigger.js.map +1 -1
  26. package/components/DictionaryTrigger/styles.module.scss +1 -2
  27. package/components/Dropdown/Dropdown.js +24 -24
  28. package/components/Dropdown/Dropdown.js.map +1 -1
  29. package/components/Dropdown/styles.module.scss +1 -1
  30. package/components/Duolist/Duolist.d.ts +3 -0
  31. package/components/Duolist/Duolist.js +45 -36
  32. package/components/Duolist/Duolist.js.map +1 -1
  33. package/components/Duolist/index.js +5 -5
  34. package/components/Duolist/styles.module.scss +4 -0
  35. package/components/Duolist/styles.module.scss.d.ts +1 -0
  36. package/components/EmptyState/EmptyState.js +3 -3
  37. package/components/EmptyState/EmptyState.js.map +1 -1
  38. package/components/EmptyState/NobodyHome.js +3 -3
  39. package/components/EmptyState/NobodyHome.js.map +1 -1
  40. package/components/ErrorWrapper/ErrorWrapper.js +4 -4
  41. package/components/ErrorWrapper/ErrorWrapper.js.map +1 -1
  42. package/components/ErrorWrapper/index.js +2 -3
  43. package/components/ErrorWrapper/index.js.map +1 -1
  44. package/components/Expander/Expander.js +10 -10
  45. package/components/Expander/Expander.js.map +1 -1
  46. package/components/Expander/styles.module.scss +1 -1
  47. package/components/ExpanderHierarchy/Expander.js +5 -5
  48. package/components/ExpanderHierarchy/Expander.js.map +1 -1
  49. package/components/ExpanderHierarchy/ExpanderButton.js +7 -7
  50. package/components/ExpanderHierarchy/ExpanderButton.js.map +1 -1
  51. package/components/ExpanderHierarchy/ExpanderHierarchy.js +13 -14
  52. package/components/ExpanderHierarchy/ExpanderHierarchy.js.map +1 -1
  53. package/components/ExpanderHierarchy/expander.module.scss +2 -2
  54. package/components/ExpanderList/ExpanderList.js +34 -35
  55. package/components/ExpanderList/ExpanderList.js.map +1 -1
  56. package/components/ExpanderList/index.js +2 -3
  57. package/components/ExpanderList/index.js.map +1 -1
  58. package/components/ExpanderList/styles.module.scss +1 -1
  59. package/components/FormExample/FormExample.d.ts +0 -1
  60. package/components/FormExample/FormExample.js +12 -12
  61. package/components/FormExample/FormExample.js.map +1 -1
  62. package/components/FormExample/index.js +5 -5
  63. package/components/FormGroup/FormGroup.js +37 -38
  64. package/components/FormGroup/FormGroup.js.map +1 -1
  65. package/components/FormGroup/index.js +2 -3
  66. package/components/FormGroup/index.js.map +1 -1
  67. package/components/FormLayout/FormLayout.js +16 -17
  68. package/components/FormLayout/FormLayout.js.map +1 -1
  69. package/components/FormLayout/index.js +4 -4
  70. package/components/GridExample/GridExample.js +3 -3
  71. package/components/GridExample/GridExample.js.map +1 -1
  72. package/components/GridExample/index.js +3 -4
  73. package/components/GridExample/index.js.map +1 -1
  74. package/components/HelpBubble/HelpBubble.js +26 -27
  75. package/components/HelpBubble/HelpBubble.js.map +1 -1
  76. package/components/HelpBubble/styles.module.scss +1 -1
  77. package/components/HelpBubbleExample/HelpBubbleExample.js +3 -3
  78. package/components/HelpBubbleExample/HelpBubbleExample.js.map +1 -1
  79. package/components/HelpPanel/HelpPanel.js +11 -11
  80. package/components/HelpPanel/HelpPanel.js.map +1 -1
  81. package/components/HelpQuestion/HelpQuestion.js +16 -17
  82. package/components/HelpQuestion/HelpQuestion.js.map +1 -1
  83. package/components/HighlightBox/HighlightBox.js +16 -16
  84. package/components/HighlightBox/HighlightBox.js.map +1 -1
  85. package/components/HighlightBox/styles.module.scss +4 -4
  86. package/components/HorizontalScroll/HorizontalScroll.js +4 -4
  87. package/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
  88. package/components/HorizontalScroll/index.js +2 -3
  89. package/components/HorizontalScroll/index.js.map +1 -1
  90. package/components/Illustration/Illustration.js +16 -17
  91. package/components/Illustration/Illustration.js.map +1 -1
  92. package/components/Illustration/index.js +5 -5
  93. package/components/Input/Input.js +65 -67
  94. package/components/Input/Input.js.map +1 -1
  95. package/components/Label/Label.js +16 -16
  96. package/components/Label/Label.js.map +1 -1
  97. package/components/LazyIcon/ErrorBoundary.js +7 -8
  98. package/components/LazyIcon/ErrorBoundary.js.map +1 -1
  99. package/components/LazyIcon/LazyIcon.js +4 -4
  100. package/components/LazyIcon/LazyIcon.js.map +1 -1
  101. package/components/LazyIcon/index.js +3 -3
  102. package/components/LazyIllustration/LazyIllustration.js +10 -10
  103. package/components/LazyIllustration/LazyIllustration.js.map +1 -1
  104. package/components/LazyIllustration/index.js +5 -5
  105. package/components/LinkList/LinkList.js +36 -37
  106. package/components/LinkList/LinkList.js.map +1 -1
  107. package/components/LinkList/index.js +2 -3
  108. package/components/LinkList/index.js.map +1 -1
  109. package/components/List/List.js +7 -8
  110. package/components/List/List.js.map +1 -1
  111. package/components/ListHeader/ListHeader.js +1 -1
  112. package/components/ListHeader/ListHeader.js.map +1 -1
  113. package/components/ListHeader/ListHeaderText/ListHeaderText.js +18 -19
  114. package/components/ListHeader/ListHeaderText/ListHeaderText.js.map +1 -1
  115. package/components/ListHeader/ListHeaderText/index.js +2 -3
  116. package/components/ListHeader/ListHeaderText/index.js.map +1 -1
  117. package/components/Loader/Loader.js +2 -2
  118. package/components/Loader/Loader.js.map +1 -1
  119. package/components/Logo/Logo.js +5 -5
  120. package/components/Logo/Logo.js.map +1 -1
  121. package/components/MaxCharacters/MaxCharacters.js +5 -5
  122. package/components/MaxCharacters/MaxCharacters.js.map +1 -1
  123. package/components/Modal/Modal.js +32 -33
  124. package/components/Modal/Modal.js.map +1 -1
  125. package/components/Modal/styles.module.scss +8 -8
  126. package/components/NotificationPanel/NotificationPanel.js +14 -14
  127. package/components/NotificationPanel/NotificationPanel.js.map +1 -1
  128. package/components/NotificationPanel/styles.module.scss +3 -3
  129. package/components/Panel/Panel.js +25 -25
  130. package/components/Panel/Panel.js.map +1 -1
  131. package/components/Panel/styles.module.scss +3 -3
  132. package/components/PanelList/PanelList.js +8 -8
  133. package/components/PanelList/PanelList.js.map +1 -1
  134. package/components/PopMenu/PopMenu.js +14 -14
  135. package/components/PopMenu/PopMenu.js.map +1 -1
  136. package/components/PopMenu/index.js +3 -3
  137. package/components/PopOver/PopOver.js +27 -28
  138. package/components/PopOver/PopOver.js.map +1 -1
  139. package/components/Portal/index.js.map +1 -1
  140. package/components/Progressbar/Progressbar.js +13 -13
  141. package/components/Progressbar/Progressbar.js.map +1 -1
  142. package/components/PromoPanel/PromoPanel.js +16 -16
  143. package/components/PromoPanel/PromoPanel.js.map +1 -1
  144. package/components/RadioButton/RadioButton.js +52 -53
  145. package/components/RadioButton/RadioButton.js.map +1 -1
  146. package/components/RadioButton/index.js +4 -4
  147. package/components/RadioButton/styles.module.scss +2 -2
  148. package/components/Select/Select.js +21 -21
  149. package/components/Select/Select.js.map +1 -1
  150. package/components/Select/index.js +2 -3
  151. package/components/Select/index.js.map +1 -1
  152. package/components/ServiceMessage/ServiceMessage.js +30 -30
  153. package/components/ServiceMessage/ServiceMessage.js.map +1 -1
  154. package/components/ServiceMessage/styles.module.scss +10 -10
  155. package/components/SharingStatus/SharingStatus.js +7 -7
  156. package/components/SharingStatus/SharingStatus.js.map +1 -1
  157. package/components/Slider/Slider.js +15 -17
  158. package/components/Slider/Slider.js.map +1 -1
  159. package/components/Slider/index.js +2 -3
  160. package/components/Slider/index.js.map +1 -1
  161. package/components/Spacer/Spacer.js +4 -4
  162. package/components/Spacer/Spacer.js.map +1 -1
  163. package/components/StatusDot/StatusDot.js +8 -8
  164. package/components/StatusDot/StatusDot.js.map +1 -1
  165. package/components/Step/Step.js +10 -10
  166. package/components/Step/Step.js.map +1 -1
  167. package/components/StepButtons/StepButtons.js +4 -4
  168. package/components/StepButtons/StepButtons.js.map +1 -1
  169. package/components/StepButtons/index.js +2 -3
  170. package/components/StepButtons/index.js.map +1 -1
  171. package/components/Stepper/Dot.js +3 -3
  172. package/components/Stepper/Dot.js.map +1 -1
  173. package/components/Stepper/DotList.js +4 -4
  174. package/components/Stepper/DotList.js.map +1 -1
  175. package/components/Stepper/Stepper.js +10 -10
  176. package/components/Stepper/Stepper.js.map +1 -1
  177. package/components/Table/Table.js +1 -1
  178. package/components/Table/TableBody/TableBody.js +3 -3
  179. package/components/Table/TableBody/TableBody.js.map +1 -1
  180. package/components/Table/TableBody/index.js +3 -4
  181. package/components/Table/TableBody/index.js.map +1 -1
  182. package/components/Table/TableCell/TableCell.js +10 -10
  183. package/components/Table/TableCell/TableCell.js.map +1 -1
  184. package/components/Table/TableCell/index.js +4 -4
  185. package/components/Table/TableExpandedRow/TableExpandedRow.js +8 -8
  186. package/components/Table/TableExpandedRow/TableExpandedRow.js.map +1 -1
  187. package/components/Table/TableExpandedRow/index.js +3 -4
  188. package/components/Table/TableExpandedRow/index.js.map +1 -1
  189. package/components/Table/TableExpanderCell/TableExpanderCell.js +3 -3
  190. package/components/Table/TableExpanderCell/TableExpanderCell.js.map +1 -1
  191. package/components/Table/TableExpanderCell/TableExpanderCellMobile.js +11 -11
  192. package/components/Table/TableExpanderCell/TableExpanderCellMobile.js.map +1 -1
  193. package/components/Table/TableExpanderCell/index.js +3 -4
  194. package/components/Table/TableExpanderCell/index.js.map +1 -1
  195. package/components/Table/TableHead/TableHead.js +9 -9
  196. package/components/Table/TableHead/TableHead.js.map +1 -1
  197. package/components/Table/TableHead/index.js +4 -4
  198. package/components/Table/TableHeadCell/TableHeadCell.js +15 -15
  199. package/components/Table/TableHeadCell/TableHeadCell.js.map +1 -1
  200. package/components/Table/TableHeadCell/index.js +4 -4
  201. package/components/Table/TableRow/TableRow.js +16 -16
  202. package/components/Table/TableRow/TableRow.js.map +1 -1
  203. package/components/Table/TableRow/index.js +3 -4
  204. package/components/Table/TableRow/index.js.map +1 -1
  205. package/components/Table/styles.module.scss +3 -3
  206. package/components/Table/utils.d.ts +1 -1
  207. package/components/Tabs/Tab.js +2 -2
  208. package/components/Tabs/Tab.js.map +1 -1
  209. package/components/Tabs/TabList/TabList.js +43 -38
  210. package/components/Tabs/TabList/TabList.js.map +1 -1
  211. package/components/Tabs/TabList/styles.module.scss +14 -4
  212. package/components/Tabs/TabPanel/TabPanel.d.ts +5 -1
  213. package/components/Tabs/TabPanel/TabPanel.js +13 -9
  214. package/components/Tabs/TabPanel/TabPanel.js.map +1 -1
  215. package/components/Tabs/TabPanel/styles.module.scss +48 -6
  216. package/components/Tabs/TabPanel/styles.module.scss.d.ts +4 -0
  217. package/components/Tabs/Tabs.d.ts +8 -4
  218. package/components/Tabs/Tabs.js +85 -16
  219. package/components/Tabs/Tabs.js.map +1 -1
  220. package/components/Tabs/styles.module.scss +38 -2
  221. package/components/Tabs/styles.module.scss.d.ts +7 -1
  222. package/components/Tag/Tag.js +3 -3
  223. package/components/Tag/Tag.js.map +1 -1
  224. package/components/TagList/TagList.js +1 -1
  225. package/components/TagList/TagList.js.map +1 -1
  226. package/components/Textarea/Textarea.js +48 -49
  227. package/components/Textarea/Textarea.js.map +1 -1
  228. package/components/Tile/Tile.js +14 -15
  229. package/components/Tile/Tile.js.map +1 -1
  230. package/components/Tile/index.js +2 -3
  231. package/components/Tile/index.js.map +1 -1
  232. package/components/Title/Title.js +10 -10
  233. package/components/Title/Title.js.map +1 -1
  234. package/components/Title/index.js +4 -4
  235. package/components/Tooltip/Tooltip.js +4 -4
  236. package/components/Tooltip/Tooltip.js.map +1 -1
  237. package/components/Tooltip/TooltipWord/TooltipWord.js +17 -18
  238. package/components/Tooltip/TooltipWord/TooltipWord.js.map +1 -1
  239. package/components/Tooltip/index.js +5 -5
  240. package/components/TooltipExample/TooltipExample.js +4 -4
  241. package/components/TooltipExample/TooltipExample.js.map +1 -1
  242. package/components/Trigger/HelpSign.js +3 -3
  243. package/components/Trigger/HelpSign.js.map +1 -1
  244. package/components/Trigger/Trigger.js +25 -26
  245. package/components/Trigger/Trigger.js.map +1 -1
  246. package/components/Validation/ErrorList.js +5 -5
  247. package/components/Validation/ErrorList.js.map +1 -1
  248. package/components/Validation/ErrorListItem.js +8 -8
  249. package/components/Validation/ErrorListItem.js.map +1 -1
  250. package/components/Validation/Validation.js +13 -14
  251. package/components/Validation/Validation.js.map +1 -1
  252. package/components/Validation/ValidationSummary.js +4 -4
  253. package/components/Validation/ValidationSummary.js.map +1 -1
  254. package/components/Validation/index.js +3 -4
  255. package/components/Validation/index.js.map +1 -1
  256. package/components/Validation/types.d.ts +0 -1
  257. package/constants.d.ts +2 -1
  258. package/constants.js +1 -1
  259. package/constants.js.map +1 -1
  260. package/hooks/useIcons.d.ts +0 -1
  261. package/hooks/useIcons.js +1 -1
  262. package/hooks/useLayoutEvent.js +1 -2
  263. package/hooks/useLayoutEvent.js.map +1 -1
  264. package/hooks/useSticky.d.ts +1 -1
  265. package/package.json +1 -1
  266. package/scss/_palette.scss +1 -0
  267. package/scss/typography.module.scss +1 -1
  268. package/scss/typography.module.scss.d.ts +1 -1
  269. package/scss/typography.stories.tsx +157 -0
  270. package/theme/currys/color.d.ts +1 -1
  271. package/utils/accessibility.d.ts +2 -1
  272. package/utils/accessibility.js +1 -1
  273. package/utils/accessibility.js.map +1 -1
  274. package/utils/component.d.ts +3 -3
  275. package/utils/refs.d.ts +1 -2
  276. package/_virtual/index2.js +0 -5
  277. package/_virtual/index2.js.map +0 -1
  278. package/_virtual/index3.js +0 -5
  279. package/_virtual/index3.js.map +0 -1
  280. package/components/AnchorLink/AnchorLink.stories.d.ts +0 -31
  281. package/components/Avatar/Avatar.stories.d.ts +0 -36
  282. package/components/Badge/Badge.stories.d.ts +0 -42
  283. package/components/Button/Button.stories.d.ts +0 -56
  284. package/components/Checkbox/Checkbox.stories.d.ts +0 -54
  285. package/components/Close/Close.stories.d.ts +0 -29
  286. package/components/DictionaryTrigger/DictionaryTrigger.stories.d.ts +0 -30
  287. package/components/Dropdown/Dropdown.stories.d.ts +0 -67
  288. package/components/Duolist/Duolist.stories.d.ts +0 -32
  289. package/components/EmptyState/EmptyState.stories.d.ts +0 -26
  290. package/components/Expander/Expander.stories.d.ts +0 -60
  291. package/components/ExpanderHierarchy/ExpanderHierarchy.stories.d.ts +0 -44
  292. package/components/ExpanderList/ExpanderList.stories.d.ts +0 -59
  293. package/components/FormGroup/FormGroup.stories.d.ts +0 -50
  294. package/components/FormLayout/FormLayout.stories.d.ts +0 -32
  295. package/components/HelpBubble/HelpBubble.stories.d.ts +0 -46
  296. package/components/HelpPanel/HelpPanel.stories.d.ts +0 -31
  297. package/components/HelpQuestion/HelpQuestion.stories.d.ts +0 -29
  298. package/components/HighlightBox/HighlightBox.stories.d.ts +0 -42
  299. package/components/Icon/Icon.stories.d.ts +0 -38
  300. package/components/Illustration/Illustration.stories.d.ts +0 -34
  301. package/components/Illustration/Illustrations.stories.d.ts +0 -41
  302. package/components/Input/Input.stories.d.ts +0 -94
  303. package/components/Label/Label.stories.d.ts +0 -25
  304. package/components/LazyIcon/LazyIcon.stories.d.ts +0 -25
  305. package/components/LazyIllustration/LazyIllustration.stories.d.ts +0 -38
  306. package/components/LinkList/LinkList.stories.d.ts +0 -49
  307. package/components/List/List.stories.d.ts +0 -52
  308. package/components/Loader/Loader.stories.d.ts +0 -31
  309. package/components/Logo/Logo.stories.d.ts +0 -37
  310. package/components/Modal/Modal.stories.d.ts +0 -76
  311. package/components/NotificationPanel/NotificationPanel.stories.d.ts +0 -60
  312. package/components/Panel/Panel.stories.d.ts +0 -89
  313. package/components/PanelList/PanelList.stories.d.ts +0 -27
  314. package/components/PopMenu/PopMenu.stories.d.ts +0 -39
  315. package/components/PopOver/PopOver.stories.d.ts +0 -38
  316. package/components/Progressbar/Progressbar.stories.d.ts +0 -43
  317. package/components/PromoPanel/PromoPanel.stories.d.ts +0 -45
  318. package/components/RadioButton/RadioButton.stories.d.ts +0 -57
  319. package/components/Select/Select.stories.d.ts +0 -38
  320. package/components/ServiceMessage/ServiceMessage.stories.d.ts +0 -71
  321. package/components/SharingStatus/SharingStatus.stories.d.ts +0 -31
  322. package/components/Slider/Slider.stories.d.ts +0 -52
  323. package/components/Spacer/Spacer.stories.d.ts +0 -17
  324. package/components/StatusDot/StatusDot.stories.d.ts +0 -31
  325. package/components/Step/Step.stories.d.ts +0 -32
  326. package/components/StepButtons/StepButtons.stories.d.ts +0 -19
  327. package/components/Stepper/Stepper.stories.d.ts +0 -38
  328. package/components/Table/Table.stories.d.ts +0 -90
  329. package/components/Tabs/Tabs.stories.d.ts +0 -50
  330. package/components/Tag/Tag.stories.d.ts +0 -48
  331. package/components/TagList/TagList.stories.d.ts +0 -17
  332. package/components/Textarea/Textarea.stories.d.ts +0 -94
  333. package/components/Tile/Tile.stories.d.ts +0 -65
  334. package/components/Title/Title.stories.d.ts +0 -40
  335. package/components/Tooltip/Tooltip.stories.d.ts +0 -34
  336. package/components/Trigger/Trigger.stories.d.ts +0 -52
  337. package/components/Validation/Validation.stories.d.ts +0 -37
  338. package/hoc/withBreakpoint/withBreakpoint.stories.d.ts +0 -17
  339. package/hooks/useBreakpoint.stories.d.ts +0 -16
  340. package/hooks/useDelayedState.stories.d.ts +0 -27
  341. package/hooks/useElementList.stories.d.ts +0 -16
  342. package/hooks/useFocusToggle.stories.d.ts +0 -16
  343. package/hooks/useFocusTrap.stories.d.ts +0 -16
  344. package/hooks/useFocusableElements.stories.d.ts +0 -16
  345. package/hooks/useHover.stories.d.ts +0 -16
  346. package/hooks/useIntersectionObserver.stories.d.ts +0 -16
  347. package/hooks/useInterval.stories.d.ts +0 -16
  348. package/hooks/useIsVisible.stories.d.ts +0 -27
  349. package/hooks/useKeyboardEvent.stories.d.ts +0 -16
  350. package/hooks/useLayoutEvent.stories.d.ts +0 -16
  351. package/hooks/useOutsideEvent.stories.d.ts +0 -16
  352. package/hooks/usePseudoClasses.stories.d.ts +0 -16
  353. package/hooks/useResizeObserver.stories.d.ts +0 -16
  354. package/hooks/useRovingFocus.stories.d.ts +0 -17
  355. package/hooks/useSize.stories.d.ts +0 -16
  356. package/hooks/useSticky.stories.d.ts +0 -16
  357. package/hooks/useUuid.stories.d.ts +0 -16
@@ -1,21 +1,21 @@
1
1
  import t from "react";
2
2
  import h from "classnames";
3
- import { AnalyticsId as C, IconSize as i } from "../../constants.js";
4
- import { useBreakpoint as P, Breakpoint as a } from "../../hooks/useBreakpoint.js";
5
- import { useHover as b } from "../../hooks/useHover.js";
3
+ import { AnalyticsId as C, IconSize as o } from "../../constants.js";
4
+ import { useBreakpoint as b, Breakpoint as a } from "../../hooks/useBreakpoint.js";
5
+ import { useHover as g } from "../../hooks/useHover.js";
6
6
  import { getColor as m } from "../../theme/currys/color.js";
7
- import { Icon as g } from "../Icon/Icon.js";
8
- import E from "../Icons/ArrowRight.js";
9
- import _ from "../Icons/ArrowUpRight.js";
10
- import v from "../LazyIllustration/LazyIllustration.js";
11
- import y from "../Title/Title.js";
7
+ import { Icon as E } from "../Icon/Icon.js";
8
+ import _ from "../Icons/ArrowRight.js";
9
+ import P from "../Icons/ArrowUpRight.js";
10
+ import { LazyIllustration as v } from "../LazyIllustration/LazyIllustration.js";
11
+ import { Title as y } from "../Title/Title.js";
12
12
  import n from "../PromoPanel/styles.module.scss";
13
- const I = (e) => e.linkComponent ? t.cloneElement(e.linkComponent, { children: e.children }) : e.linkHtmlMarkup === "button" ? /* @__PURE__ */ t.createElement("button", { type: "button", onClick: e.linkOnClick }, e.children) : /* @__PURE__ */ t.createElement("a", { href: e.href, target: e.target, onClick: e.linkOnClick }, e.children), N = (e) => {
14
- const { isHovered: c, hoverRef: u } = b(), { color: l = "neutral", titleHtmlMarkup: k = "h2", linkHtmlMarkup: f = "a" } = e, r = P(), s = h(
13
+ const I = (e) => e.linkComponent ? t.cloneElement(e.linkComponent, { children: e.children }) : e.linkHtmlMarkup === "button" ? /* @__PURE__ */ t.createElement("button", { type: "button", onClick: e.linkOnClick }, e.children) : /* @__PURE__ */ t.createElement("a", { href: e.href, target: e.target, onClick: e.linkOnClick }, e.children), T = (e) => {
14
+ const { isHovered: c, hoverRef: u } = g(), { color: l = "neutral", titleHtmlMarkup: k = "h2", linkHtmlMarkup: f = "a" } = e, r = b(), s = h(
15
15
  n.promopanel,
16
16
  n[`promopanel--${l}`],
17
17
  !e.illustration && n["promopanel--no-illustration"]
18
- ), o = /* @__PURE__ */ t.createElement(
18
+ ), i = /* @__PURE__ */ t.createElement(
19
19
  I,
20
20
  {
21
21
  href: e.href,
@@ -34,18 +34,18 @@ const I = (e) => e.linkComponent ? t.cloneElement(e.linkComponent, { children: e
34
34
  color: l,
35
35
  className: n.promopanel__illustration
36
36
  }
37
- ), /* @__PURE__ */ t.createElement("div", { className: n.promopanel__content }, e.title && /* @__PURE__ */ t.createElement(y, { htmlMarkup: k, appearance: "title3" }, o), e.title ? e.children : o), /* @__PURE__ */ t.createElement(
38
- g,
37
+ ), /* @__PURE__ */ t.createElement("div", { className: n.promopanel__content }, e.title && /* @__PURE__ */ t.createElement(y, { htmlMarkup: k, appearance: "title3" }, i), e.title ? e.children : i), /* @__PURE__ */ t.createElement(
38
+ E,
39
39
  {
40
40
  className: n.promopanel__icon,
41
- svgIcon: e.target === "_blank" ? _ : E,
42
- size: r >= a.md ? i.Small : i.XSmall,
41
+ svgIcon: e.target === "_blank" ? P : _,
42
+ size: r >= a.md ? o.Small : o.XSmall,
43
43
  isHovered: c,
44
44
  color: m("blueberry", 500),
45
45
  hoverColor: m("blueberry", 600)
46
46
  }
47
47
  ));
48
- }, T = N;
48
+ };
49
49
  export {
50
50
  T as default
51
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PromoPanel.js","sources":["../../../src/components/PromoPanel/PromoPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { getColor } from '../../theme/currys/color';\nimport { PaletteNames } from '../../theme/palette';\nimport { AnchorLinkTags, AnchorLinkTargets } from '../AnchorLink';\nimport Icon from '../Icon';\nimport ArrowRight from '../Icons/ArrowRight';\nimport ArrowUpRight from '../Icons/ArrowUpRight';\nimport LazyIllustration from '../LazyIllustration';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\nexport type PromoPanelColors = Extract<PaletteNames, 'neutral' | 'blueberry' | 'cherry'>;\n\nexport interface PromoPanelProps {\n /** Used as the link text if set. title or children must be set for the link to have accessible text. */\n title?: string;\n /** Used as the link text if title is not set. */\n children?: string;\n /** Illustration element */\n illustration?: 'Doctor' | 'HealthcarePersonnel';\n /** Changes the underlying element of the title. */\n titleHtmlMarkup?: TitleTags;\n /** Changes the background color. Default: white */\n color?: PromoPanelColors;\n /** Not used if linkComponent is set */\n href?: string;\n /** Anchor link target. If linkComponent is set, this prop is only used to display the right icon for external links. */\n target?: AnchorLinkTargets;\n /** HTML markup for anchor link. Not used if linkComponent is set. Default: a */\n linkHtmlMarkup?: AnchorLinkTags;\n /** Function that is called when clicked. Not used if linkComponent is set. */\n linkOnClick?: () => void;\n /** Custom link component. Must be \"a\" a or \"button\" element with no styling. */\n linkComponent?: React.ReactElement;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface PromoPanelLinkProps {\n children?: string;\n href?: string;\n target?: AnchorLinkTargets;\n linkComponent?: React.ReactElement;\n linkHtmlMarkup?: AnchorLinkTags;\n linkOnClick?: () => void;\n}\n\nconst PromoPanelLink: React.FC<PromoPanelLinkProps> = props => {\n if (props.linkComponent) {\n return React.cloneElement(props.linkComponent, { children: props.children });\n }\n\n if (props.linkHtmlMarkup === 'button') {\n return (\n <button type={'button'} onClick={props.linkOnClick}>\n {props.children}\n </button>\n );\n }\n return (\n <a href={props.href} target={props.target} onClick={props.linkOnClick}>\n {props.children}\n </a>\n );\n};\n\nconst PromoPanel: React.FC<PromoPanelProps> = props => {\n const { isHovered, hoverRef } = useHover<HTMLDivElement>();\n\n const { color = 'neutral', titleHtmlMarkup = 'h2', linkHtmlMarkup = 'a' } = props;\n\n const breakpoint = useBreakpoint();\n\n const promoPanelClasses = classNames(\n styles.promopanel,\n styles[`promopanel--${color}`],\n !props.illustration && styles['promopanel--no-illustration']\n );\n\n const promoPanelLink = (\n <PromoPanelLink\n href={props.href}\n target={props.target}\n linkComponent={props.linkComponent}\n linkHtmlMarkup={linkHtmlMarkup}\n linkOnClick={props.linkOnClick}\n >\n {props.title || props.children}\n </PromoPanelLink>\n );\n\n const illustrationSize = ((): number => {\n if (breakpoint >= Breakpoint.md) {\n return 156;\n }\n\n return 110;\n })();\n\n return (\n <div className={promoPanelClasses} data-testid={props.testId} data-analyticsid={AnalyticsId.PromoPanel} ref={hoverRef}>\n {props.illustration && (\n <LazyIllustration\n illustrationName={props.illustration}\n size={illustrationSize}\n color={color}\n className={styles.promopanel__illustration}\n />\n )}\n <div className={styles.promopanel__content}>\n {props.title && (\n <Title htmlMarkup={titleHtmlMarkup} appearance={'title3'}>\n {promoPanelLink}\n </Title>\n )}\n {!props.title ? promoPanelLink : props.children}\n </div>\n <Icon\n className={styles.promopanel__icon}\n svgIcon={props.target === '_blank' ? ArrowUpRight : ArrowRight}\n size={breakpoint >= Breakpoint.md ? IconSize.Small : IconSize.XSmall}\n isHovered={isHovered}\n color={getColor('blueberry', 500)}\n hoverColor={getColor('blueberry', 600)}\n />\n </div>\n );\n};\n\nexport default PromoPanel;\n"],"names":["PromoPanelLink","props","React","PromoPanel","isHovered","hoverRef","useHover","color","titleHtmlMarkup","linkHtmlMarkup","breakpoint","useBreakpoint","promoPanelClasses","classNames","styles","promoPanelLink","illustrationSize","Breakpoint","AnalyticsId","LazyIllustration","Title","Icon","ArrowUpRight","ArrowRight","IconSize","getColor","PromoPanel$1"],"mappings":";;;;;;;;;;;;AAsDA,MAAMA,IAAgD,CAASC,MACzDA,EAAM,gBACDC,EAAM,aAAaD,EAAM,eAAe,EAAE,UAAUA,EAAM,UAAU,IAGzEA,EAAM,mBAAmB,WAEzBC,gBAAAA,EAAA,cAAC,YAAO,MAAM,UAAU,SAASD,EAAM,YAAA,GACpCA,EAAM,QACT,IAIDC,gBAAAA,EAAA,cAAA,KAAA,EAAE,MAAMD,EAAM,MAAM,QAAQA,EAAM,QAAQ,SAASA,EAAM,YACvD,GAAAA,EAAM,QACT,GAIEE,IAAwC,CAASF,MAAA;AACrD,QAAM,EAAE,WAAAG,GAAW,UAAAC,EAAS,IAAIC,EAAyB,GAEnD,EAAE,OAAAC,IAAQ,WAAW,iBAAAC,IAAkB,MAAM,gBAAAC,IAAiB,IAAQ,IAAAR,GAEtES,IAAaC,KAEbC,IAAoBC;AAAA,IACxBC,EAAO;AAAA,IACPA,EAAO,eAAeP,CAAK,EAAE;AAAA,IAC7B,CAACN,EAAM,gBAAgBa,EAAO,6BAA6B;AAAA,EAAA,GAGvDC,IACJb,gBAAAA,EAAA;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,MAAMC,EAAM;AAAA,MACZ,QAAQA,EAAM;AAAA,MACd,eAAeA,EAAM;AAAA,MACrB,gBAAAQ;AAAA,MACA,aAAaR,EAAM;AAAA,IAAA;AAAA,IAElBA,EAAM,SAASA,EAAM;AAAA,EAAA,GAIpBe,IACAN,KAAcO,EAAW,KACpB,MAGF;AAGT,SACGf,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAWU,GAAmB,eAAaX,EAAM,QAAQ,oBAAkBiB,EAAY,YAAY,KAAKb,EAAA,GAC1GJ,EAAM,gBACLC,gBAAAA,EAAA;AAAA,IAACiB;AAAA,IAAA;AAAA,MACC,kBAAkBlB,EAAM;AAAA,MACxB,MAAMe;AAAA,MACN,OAAAT;AAAA,MACA,WAAWO,EAAO;AAAA,IAAA;AAAA,EACpB,mCAED,OAAI,EAAA,WAAWA,EAAO,oBACpB,GAAAb,EAAM,SACLC,gBAAAA,EAAA,cAACkB,GAAM,EAAA,YAAYZ,GAAiB,YAAY,YAC7CO,CACH,GAEAd,EAAM,QAAyBA,EAAM,WAAvBc,CAClB,GACAb,gBAAAA,EAAA;AAAA,IAACmB;AAAA,IAAA;AAAA,MACC,WAAWP,EAAO;AAAA,MAClB,SAASb,EAAM,WAAW,WAAWqB,IAAeC;AAAA,MACpD,MAAMb,KAAcO,EAAW,KAAKO,EAAS,QAAQA,EAAS;AAAA,MAC9D,WAAApB;AAAA,MACA,OAAOqB,EAAS,aAAa,GAAG;AAAA,MAChC,YAAYA,EAAS,aAAa,GAAG;AAAA,IAAA;AAAA,EAAA,CAEzC;AAEJ,GAEAC,IAAevB;"}
1
+ {"version":3,"file":"PromoPanel.js","sources":["../../../src/components/PromoPanel/PromoPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { getColor } from '../../theme/currys/color';\nimport { PaletteNames } from '../../theme/palette';\nimport { AnchorLinkTags, AnchorLinkTargets } from '../AnchorLink';\nimport Icon from '../Icon';\nimport ArrowRight from '../Icons/ArrowRight';\nimport ArrowUpRight from '../Icons/ArrowUpRight';\nimport LazyIllustration from '../LazyIllustration';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\nexport type PromoPanelColors = Extract<PaletteNames, 'neutral' | 'blueberry' | 'cherry'>;\n\nexport interface PromoPanelProps {\n /** Used as the link text if set. title or children must be set for the link to have accessible text. */\n title?: string;\n /** Used as the link text if title is not set. */\n children?: string;\n /** Illustration element */\n illustration?: 'Doctor' | 'HealthcarePersonnel';\n /** Changes the underlying element of the title. */\n titleHtmlMarkup?: TitleTags;\n /** Changes the background color. Default: white */\n color?: PromoPanelColors;\n /** Not used if linkComponent is set */\n href?: string;\n /** Anchor link target. If linkComponent is set, this prop is only used to display the right icon for external links. */\n target?: AnchorLinkTargets;\n /** HTML markup for anchor link. Not used if linkComponent is set. Default: a */\n linkHtmlMarkup?: AnchorLinkTags;\n /** Function that is called when clicked. Not used if linkComponent is set. */\n linkOnClick?: () => void;\n /** Custom link component. Must be \"a\" a or \"button\" element with no styling. */\n linkComponent?: React.ReactElement;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface PromoPanelLinkProps {\n children?: string;\n href?: string;\n target?: AnchorLinkTargets;\n linkComponent?: React.ReactElement;\n linkHtmlMarkup?: AnchorLinkTags;\n linkOnClick?: () => void;\n}\n\nconst PromoPanelLink: React.FC<PromoPanelLinkProps> = props => {\n if (props.linkComponent) {\n return React.cloneElement(props.linkComponent, { children: props.children });\n }\n\n if (props.linkHtmlMarkup === 'button') {\n return (\n <button type={'button'} onClick={props.linkOnClick}>\n {props.children}\n </button>\n );\n }\n return (\n <a href={props.href} target={props.target} onClick={props.linkOnClick}>\n {props.children}\n </a>\n );\n};\n\nconst PromoPanel: React.FC<PromoPanelProps> = props => {\n const { isHovered, hoverRef } = useHover<HTMLDivElement>();\n\n const { color = 'neutral', titleHtmlMarkup = 'h2', linkHtmlMarkup = 'a' } = props;\n\n const breakpoint = useBreakpoint();\n\n const promoPanelClasses = classNames(\n styles.promopanel,\n styles[`promopanel--${color}`],\n !props.illustration && styles['promopanel--no-illustration']\n );\n\n const promoPanelLink = (\n <PromoPanelLink\n href={props.href}\n target={props.target}\n linkComponent={props.linkComponent}\n linkHtmlMarkup={linkHtmlMarkup}\n linkOnClick={props.linkOnClick}\n >\n {props.title || props.children}\n </PromoPanelLink>\n );\n\n const illustrationSize = ((): number => {\n if (breakpoint >= Breakpoint.md) {\n return 156;\n }\n\n return 110;\n })();\n\n return (\n <div className={promoPanelClasses} data-testid={props.testId} data-analyticsid={AnalyticsId.PromoPanel} ref={hoverRef}>\n {props.illustration && (\n <LazyIllustration\n illustrationName={props.illustration}\n size={illustrationSize}\n color={color}\n className={styles.promopanel__illustration}\n />\n )}\n <div className={styles.promopanel__content}>\n {props.title && (\n <Title htmlMarkup={titleHtmlMarkup} appearance={'title3'}>\n {promoPanelLink}\n </Title>\n )}\n {!props.title ? promoPanelLink : props.children}\n </div>\n <Icon\n className={styles.promopanel__icon}\n svgIcon={props.target === '_blank' ? ArrowUpRight : ArrowRight}\n size={breakpoint >= Breakpoint.md ? IconSize.Small : IconSize.XSmall}\n isHovered={isHovered}\n color={getColor('blueberry', 500)}\n hoverColor={getColor('blueberry', 600)}\n />\n </div>\n );\n};\n\nexport default PromoPanel;\n"],"names":["PromoPanelLink","props","React","PromoPanel","isHovered","hoverRef","useHover","color","titleHtmlMarkup","linkHtmlMarkup","breakpoint","useBreakpoint","promoPanelClasses","classNames","styles","promoPanelLink","illustrationSize","Breakpoint","AnalyticsId","LazyIllustration","Title","Icon","ArrowUpRight","ArrowRight","IconSize","getColor"],"mappings":";;;;;;;;;;;;AAsDA,MAAMA,IAAgD,CAASC,MACzDA,EAAM,gBACDC,EAAM,aAAaD,EAAM,eAAe,EAAE,UAAUA,EAAM,UAAU,IAGzEA,EAAM,mBAAmB,WAEzBC,gBAAAA,EAAA,cAAC,YAAO,MAAM,UAAU,SAASD,EAAM,YAAA,GACpCA,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WP,EAAO;AAAA,MAClB,SAASb,EAAM,WAAW,WAAWqB,IAAeC;AAAA,MACpD,MAAMb,KAAcO,EAAW,KAAKO,EAAS,QAAQA,EAAS;AAAA,MAC9D,WAAApB;AAAA,MACA,OAAOqB,EAAS,aAAa,GAAG;AAAA,MAChC,YAAYA,EAAS,aAAa,GAAG;AAAA,IAAA;AAAA,EAAA,CAEzC;AAEJ;"}
@@ -1,6 +1,6 @@
1
- import p, { useState as q } from "react";
1
+ import p, { useState as U } from "react";
2
2
  import l from "classnames";
3
- import { FormMode as i, FormSize as W, AnalyticsId as $ } from "../../constants.js";
3
+ import { FormMode as i, FormSize as q, AnalyticsId as W } from "../../constants.js";
4
4
  import { usePseudoClasses as G } from "../../hooks/usePseudoClasses.js";
5
5
  import { useUuid as H } from "../../hooks/useUuid.js";
6
6
  import { getAriaDescribedBy as J } from "../../utils/accessibility.js";
@@ -9,96 +9,95 @@ import { uuid as V } from "../../utils/uuid.js";
9
9
  import { getLabelText as X, renderLabelAsParent as Y } from "../Label/Label.js";
10
10
  import e from "../RadioButton/styles.module.scss";
11
11
  const se = (s, o, a, b) => {
12
- const n = o === "oninvalid", r = s === b;
12
+ const n = o === "oninvalid", t = s === b;
13
13
  return l({
14
- [e["radio-button-label__large--on-grey"]]: a && o === "ongrey" && !r,
15
- [e["radio-button-label__large--on-blueberry"]]: o === "onblueberry" && !r && a,
16
- [e["radio-button-label__large--selected"]]: a && r && !n,
17
- [e["radio-button-label__large--selected-invalid"]]: a && r && n
14
+ [e["radio-button-label__large--on-grey"]]: a && o === "ongrey" && !t,
15
+ [e["radio-button-label__large--on-blueberry"]]: o === "onblueberry" && !t && a,
16
+ [e["radio-button-label__large--selected"]]: a && t && !n,
17
+ [e["radio-button-label__large--selected-invalid"]]: a && t && n
18
18
  });
19
- }, v = p.forwardRef((s, o) => {
19
+ }, Z = p.forwardRef((s, o) => {
20
20
  const {
21
21
  className: a,
22
22
  defaultChecked: b = !1,
23
23
  onChange: n,
24
- disabled: r,
24
+ disabled: t,
25
25
  label: f,
26
26
  inputId: _ = V(),
27
27
  mode: d = i.onwhite,
28
- name: w = _,
29
- size: B,
28
+ name: v = _,
29
+ size: w,
30
30
  errorText: u,
31
- error: R = !!u,
32
- errorTextId: k,
33
- value: N = X(f),
34
- testId: L,
35
- required: x,
36
- labelClassNames: I,
37
- ...S
38
- } = s, g = R || d === i.oninvalid, y = d === i.ondark, h = d === i.onblueberry, T = d === i.oninvalid, t = B === W.large, [A, E] = q(b), { refObject: F, isFocused: c } = G(K(o) ? o : null), j = Q([o, F]), C = H(k), z = l(e["radio-button-wrapper"], {
31
+ error: k = !!u,
32
+ errorTextId: B,
33
+ value: R = X(f),
34
+ testId: N,
35
+ required: L,
36
+ labelClassNames: x,
37
+ ...I
38
+ } = s, g = k || d === i.oninvalid, y = d === i.ondark, h = d === i.onblueberry, S = d === i.oninvalid, r = w === q.large, [T, A] = U(b), { refObject: E, isFocused: c } = G(K(o) ? o : null), F = Q([o, E]), C = H(B), j = l(e["radio-button-wrapper"], {
39
39
  [e["radio-button-wrapper--with-error"]]: u,
40
- [e["radio-button-wrapper__large"]]: t,
41
- [e["radio-button-wrapper__large--focused"]]: t && c,
42
- [e["radio-button-wrapper__large--selected"]]: t && A && c,
43
- [e["radio-button-wrapper__large--invalid"]]: t && T && c,
44
- [e["radio-button-wrapper__large--on-blueberry"]]: t && h && c
45
- }), D = l(
40
+ [e["radio-button-wrapper__large"]]: r,
41
+ [e["radio-button-wrapper__large--focused"]]: r && c,
42
+ [e["radio-button-wrapper__large--selected"]]: r && T && c,
43
+ [e["radio-button-wrapper__large--invalid"]]: r && S && c,
44
+ [e["radio-button-wrapper__large--on-blueberry"]]: r && h && c
45
+ }), z = l(
46
46
  e["radio-button-label"],
47
47
  {
48
- [e["radio-button-label--disabled"]]: r,
48
+ [e["radio-button-label--disabled"]]: t,
49
49
  [e["radio-button-label--on-dark"]]: y,
50
50
  [e["radio-button-label--invalid"]]: g,
51
- [e["radio-button-label__large"]]: t,
52
- [e["radio-button-label__large--disabled"]]: t && r
51
+ [e["radio-button-label__large"]]: r,
52
+ [e["radio-button-label__large--disabled"]]: r && t
53
53
  },
54
- I
55
- ), M = l(
54
+ x
55
+ ), D = l(
56
56
  e["radio-button"],
57
57
  {
58
58
  [e["radio-button--on-dark"]]: y,
59
- [e["radio-button--disabled"]]: r,
59
+ [e["radio-button--disabled"]]: t,
60
60
  [e["radio-button--on-blueberry"]]: h,
61
61
  [e["radio-button--invalid"]]: g,
62
- [e["radio-button__large"]]: t,
63
- [e["radio-button__large--disabled"]]: t && r,
64
- [e["radio-button__large--invalid"]]: t && g
62
+ [e["radio-button__large"]]: r,
63
+ [e["radio-button__large--disabled"]]: r && t,
64
+ [e["radio-button__large--invalid"]]: r && g
65
65
  },
66
66
  a
67
- ), O = l(e["radio-button-errors"]), P = (m) => {
68
- E(m.target.checked), n && n(m);
69
- }, U = () => /* @__PURE__ */ p.createElement(
67
+ ), M = l(e["radio-button-errors"]), O = (m) => {
68
+ A(m.target.checked), n && n(m);
69
+ }, P = () => /* @__PURE__ */ p.createElement(
70
70
  "input",
71
71
  {
72
72
  id: _,
73
- name: w,
74
- className: M,
73
+ name: v,
74
+ className: D,
75
75
  type: "radio",
76
- disabled: r,
77
- value: N,
78
- ref: j,
76
+ disabled: t,
77
+ value: R,
78
+ ref: F,
79
79
  defaultChecked: b,
80
80
  "aria-describedby": J(s, C),
81
- required: x,
82
- ...S,
83
- onChange: (m) => P(m)
81
+ required: L,
82
+ ...I,
83
+ onChange: (m) => O(m)
84
84
  }
85
85
  );
86
- return /* @__PURE__ */ p.createElement("div", { "data-testid": L, "data-analyticsid": $.RadioButton, className: z }, u && /* @__PURE__ */ p.createElement("p", { className: O, id: C }, u), Y(
86
+ return /* @__PURE__ */ p.createElement("div", { "data-testid": N, "data-analyticsid": W.RadioButton, className: j }, u && /* @__PURE__ */ p.createElement("p", { className: M, id: C }, u), Y(
87
87
  f,
88
- U(),
88
+ P(),
89
89
  _,
90
90
  d,
91
- D,
91
+ z,
92
92
  void 0,
93
93
  e["radiobutton-sublabel-wrapper"],
94
- t
94
+ r
95
95
  ));
96
96
  });
97
- v.displayName = "RadioButton";
98
- const be = v;
97
+ Z.displayName = "RadioButton";
99
98
  export {
100
- v as RadioButton,
101
- be as default,
99
+ Z as RadioButton,
100
+ Z as default,
102
101
  se as getRadioLabelClasses
103
102
  };
104
103
  //# sourceMappingURL=RadioButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.js","sources":["../../../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormMode, FormSize } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { isMutableRefObject, mergeRefs } from '../../utils/refs';\nimport { uuid } from '../../utils/uuid';\nimport { getLabelText, renderLabelAsParent } from '../Label';\n\nimport radioButtonStyles from './styles.module.scss';\n\nexport interface RadioButtonProps\n extends Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-describedby' | 'name' | 'value' | 'disabled' | 'defaultChecked' | 'required' | 'onChange'\n > {\n /** Adds custom classes to the element. */\n className?: string;\n /** The <Label/> next to the radioButton - sublabels kan ikke kombineres med large variant */\n label: React.ReactNode;\n /** Adds custom classes to the label element. */\n labelClassNames?: string;\n /** input id of the radioButton */\n inputId?: string;\n /** Changes the visuals of the radioButton */\n mode?: keyof typeof FormMode;\n /** Changes the visuals of the radioButton */\n size?: keyof typeof FormSize;\n /** Activates Error style for the radioButton - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const getRadioLabelClasses = (radioId: string, mode: FormMode, large: boolean, checkedRadioId?: string): string | undefined => {\n const onCherry = mode === 'oninvalid';\n const checked = radioId === checkedRadioId;\n\n return classNames({\n [radioButtonStyles['radio-button-label__large--on-grey']]: large && mode === 'ongrey' && !checked,\n [radioButtonStyles['radio-button-label__large--on-blueberry']]: mode === 'onblueberry' && !checked && large,\n [radioButtonStyles['radio-button-label__large--selected']]: large && checked && !onCherry,\n [radioButtonStyles['radio-button-label__large--selected-invalid']]: large && checked && onCherry,\n });\n};\n\nexport const RadioButton = React.forwardRef((props: RadioButtonProps, ref: React.Ref<HTMLInputElement>) => {\n const {\n className,\n defaultChecked = false,\n onChange,\n disabled,\n label,\n inputId = uuid(),\n mode = FormMode.onwhite,\n name = inputId,\n size,\n errorText,\n error = !!errorText,\n errorTextId,\n value = getLabelText(label),\n testId,\n required,\n labelClassNames,\n ...rest\n } = props;\n const invalid = error || mode === FormMode.oninvalid;\n const onDark = mode === FormMode.ondark;\n const onBlueberry = mode === FormMode.onblueberry;\n const onCherry = mode === FormMode.oninvalid;\n const isLarge = size === FormSize.large;\n const [checked, changeChecked] = useState<boolean>(defaultChecked);\n const { refObject, isFocused } = usePseudoClasses<HTMLInputElement>(isMutableRefObject(ref) ? ref : null);\n const mergedRefs = mergeRefs([ref, refObject]);\n const errorTextUuid = useUuid(errorTextId);\n\n const radioButtonWrapperClasses = classNames(radioButtonStyles['radio-button-wrapper'], {\n [radioButtonStyles['radio-button-wrapper--with-error']]: errorText,\n [radioButtonStyles['radio-button-wrapper__large']]: isLarge,\n [radioButtonStyles['radio-button-wrapper__large--focused']]: isLarge && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--selected']]: isLarge && checked && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--invalid']]: isLarge && onCherry && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--on-blueberry']]: isLarge && onBlueberry && isFocused,\n });\n const radioButtonLabelClasses = classNames(\n radioButtonStyles['radio-button-label'],\n {\n [radioButtonStyles['radio-button-label--disabled']]: disabled,\n [radioButtonStyles['radio-button-label--on-dark']]: onDark,\n [radioButtonStyles['radio-button-label--invalid']]: invalid,\n [radioButtonStyles['radio-button-label__large']]: isLarge,\n [radioButtonStyles['radio-button-label__large--disabled']]: isLarge && disabled,\n },\n labelClassNames\n );\n const radioButtonClasses = classNames(\n radioButtonStyles['radio-button'],\n {\n [radioButtonStyles['radio-button--on-dark']]: onDark,\n [radioButtonStyles['radio-button--disabled']]: disabled,\n [radioButtonStyles['radio-button--on-blueberry']]: onBlueberry,\n [radioButtonStyles['radio-button--invalid']]: invalid,\n [radioButtonStyles['radio-button__large']]: isLarge,\n [radioButtonStyles['radio-button__large--disabled']]: isLarge && disabled,\n [radioButtonStyles['radio-button__large--invalid']]: isLarge && invalid,\n },\n className\n );\n const errorStyles = classNames(radioButtonStyles['radio-button-errors']);\n\n const change = (e: React.ChangeEvent<HTMLInputElement>): void => {\n changeChecked(e.target.checked);\n onChange && onChange(e);\n };\n\n const getLabelContent = (): React.ReactNode => (\n <input\n id={inputId}\n name={name}\n className={radioButtonClasses}\n type=\"radio\"\n disabled={disabled}\n value={value}\n ref={mergedRefs}\n defaultChecked={defaultChecked}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n required={required}\n {...rest}\n onChange={(e): void => change(e)}\n />\n );\n\n return (\n <div data-testid={testId} data-analyticsid={AnalyticsId.RadioButton} className={radioButtonWrapperClasses}>\n {errorText && (\n <p className={errorStyles} id={errorTextUuid}>\n {errorText}\n </p>\n )}\n {renderLabelAsParent(\n label,\n getLabelContent(),\n inputId,\n mode as FormMode,\n radioButtonLabelClasses,\n undefined,\n radioButtonStyles['radiobutton-sublabel-wrapper'],\n isLarge\n )}\n </div>\n );\n});\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"names":["getRadioLabelClasses","radioId","mode","large","checkedRadioId","onCherry","checked","classNames","radioButtonStyles","RadioButton","React","props","ref","className","defaultChecked","onChange","disabled","label","inputId","uuid","FormMode","name","size","errorText","error","errorTextId","value","getLabelText","testId","required","labelClassNames","rest","invalid","onDark","onBlueberry","isLarge","FormSize","changeChecked","useState","refObject","isFocused","usePseudoClasses","isMutableRefObject","mergedRefs","mergeRefs","errorTextUuid","useUuid","radioButtonWrapperClasses","radioButtonLabelClasses","radioButtonClasses","errorStyles","change","e","getLabelContent","getAriaDescribedBy","AnalyticsId","renderLabelAsParent","RadioButton$1"],"mappings":";;;;;;;;;;AAyCO,MAAMA,KAAuB,CAACC,GAAiBC,GAAgBC,GAAgBC,MAAgD;AACpI,QAAMC,IAAWH,MAAS,aACpBI,IAAUL,MAAYG;AAE5B,SAAOG,EAAW;AAAA,IAChB,CAACC,EAAkB,oCAAoC,CAAC,GAAGL,KAASD,MAAS,YAAY,CAACI;AAAA,IAC1F,CAACE,EAAkB,yCAAyC,CAAC,GAAGN,MAAS,iBAAiB,CAACI,KAAWH;AAAA,IACtG,CAACK,EAAkB,qCAAqC,CAAC,GAAGL,KAASG,KAAW,CAACD;AAAA,IACjF,CAACG,EAAkB,6CAA6C,CAAC,GAAGL,KAASG,KAAWD;AAAA,EAAA,CACzF;AACH,GAEaI,IAAcC,EAAM,WAAW,CAACC,GAAyBC,MAAqC;AACnG,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC,IAAUC,EAAK;AAAA,IACf,MAAAjB,IAAOkB,EAAS;AAAA,IAChB,MAAAC,IAAOH;AAAA,IACP,MAAAI;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC,IAAQ,CAAC,CAACD;AAAA,IACV,aAAAE;AAAA,IACA,OAAAC,IAAQC,EAAaV,CAAK;AAAA,IAC1B,QAAAW;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,GAAGC;AAAA,EACD,IAAApB,GACEqB,IAAUR,KAAStB,MAASkB,EAAS,WACrCa,IAAS/B,MAASkB,EAAS,QAC3Bc,IAAchC,MAASkB,EAAS,aAChCf,IAAWH,MAASkB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ACnD,CAAC1B,EAAkB,uBAAuB,CAAC,GAAGwB;AAAA,MAC9C,CAACxB,EAAkB,qBAAqB,CAAC,GAAG2B;AAAA,MAC5C,CAAC3B,EAAkB,+BAA+B,CAAC,GAAG2B,KAAWnB;AAAA,MACjE,CAACR,EAAkB,8BAA8B,CAAC,GAAG2B,KAAWH;AAAA,IAClE;AAAA,IACAnB;AAAA,EAAA,GAEIqC,IAAc3C,EAAWC,EAAkB,qBAAqB,CAAC,GAEjE2C,IAAS,CAACC,MAAiD;AACjD,IAAAf,EAAAe,EAAE,OAAO,OAAO,GAC9BrC,KAAYA,EAASqC,CAAC;AAAA,EAAA,GAGlBC,IAAkB,MACtB3C,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAIQ;AAAA,MACJ,MAAAG;AAAA,MACA,WAAW4B;AAAA,MACX,MAAK;AAAA,MACL,UAAAjC;AAAA,MACA,OAAAU;AAAA,MACA,KAAKiB;AAAA,MACL,gBAAA7B;AAAA,MACA,oBAAkBwC,EAAmB3C,GAAOkC,CAAa;AAAA,MACzD,UAAAhB;AAAA,MACC,GAAGE;AAAA,MACJ,UAAU,CAACqB,MAAYD,EAAOC,CAAC;AAAA,IAAA;AAAA,EAAA;AAInC,yCACG,OAAI,EAAA,eAAaxB,GAAQ,oBAAkB2B,EAAY,aAAa,WAAWR,EAC7E,GAAAxB,qCACE,KAAE,EAAA,WAAW2B,GAAa,IAAIL,EAAA,GAC5BtB,CACH,GAEDiC;AAAA,IACCvC;AAAA,IACAoC,EAAgB;AAAA,IAChBnC;AAAA,IACAhB;AAAA,IACA8C;AAAA,IACA;AAAA,IACAxC,EAAkB,8BAA8B;AAAA,IAChD2B;AAAA,EAAA,CAEJ;AAEJ,CAAC;AAED1B,EAAY,cAAc;AAE1B,MAAAgD,KAAehD;"}
1
+ {"version":3,"file":"RadioButton.js","sources":["../../../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormMode, FormSize } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { isMutableRefObject, mergeRefs } from '../../utils/refs';\nimport { uuid } from '../../utils/uuid';\nimport { getLabelText, renderLabelAsParent } from '../Label';\n\nimport radioButtonStyles from './styles.module.scss';\n\nexport interface RadioButtonProps\n extends Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-describedby' | 'name' | 'value' | 'disabled' | 'defaultChecked' | 'required' | 'onChange'\n > {\n /** Adds custom classes to the element. */\n className?: string;\n /** The <Label/> next to the radioButton - sublabels kan ikke kombineres med large variant */\n label: React.ReactNode;\n /** Adds custom classes to the label element. */\n labelClassNames?: string;\n /** input id of the radioButton */\n inputId?: string;\n /** Changes the visuals of the radioButton */\n mode?: keyof typeof FormMode;\n /** Changes the visuals of the radioButton */\n size?: keyof typeof FormSize;\n /** Activates Error style for the radioButton - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const getRadioLabelClasses = (radioId: string, mode: FormMode, large: boolean, checkedRadioId?: string): string | undefined => {\n const onCherry = mode === 'oninvalid';\n const checked = radioId === checkedRadioId;\n\n return classNames({\n [radioButtonStyles['radio-button-label__large--on-grey']]: large && mode === 'ongrey' && !checked,\n [radioButtonStyles['radio-button-label__large--on-blueberry']]: mode === 'onblueberry' && !checked && large,\n [radioButtonStyles['radio-button-label__large--selected']]: large && checked && !onCherry,\n [radioButtonStyles['radio-button-label__large--selected-invalid']]: large && checked && onCherry,\n });\n};\n\nexport const RadioButton = React.forwardRef((props: RadioButtonProps, ref: React.Ref<HTMLInputElement>) => {\n const {\n className,\n defaultChecked = false,\n onChange,\n disabled,\n label,\n inputId = uuid(),\n mode = FormMode.onwhite,\n name = inputId,\n size,\n errorText,\n error = !!errorText,\n errorTextId,\n value = getLabelText(label),\n testId,\n required,\n labelClassNames,\n ...rest\n } = props;\n const invalid = error || mode === FormMode.oninvalid;\n const onDark = mode === FormMode.ondark;\n const onBlueberry = mode === FormMode.onblueberry;\n const onCherry = mode === FormMode.oninvalid;\n const isLarge = size === FormSize.large;\n const [checked, changeChecked] = useState<boolean>(defaultChecked);\n const { refObject, isFocused } = usePseudoClasses<HTMLInputElement>(isMutableRefObject(ref) ? ref : null);\n const mergedRefs = mergeRefs([ref, refObject]);\n const errorTextUuid = useUuid(errorTextId);\n\n const radioButtonWrapperClasses = classNames(radioButtonStyles['radio-button-wrapper'], {\n [radioButtonStyles['radio-button-wrapper--with-error']]: errorText,\n [radioButtonStyles['radio-button-wrapper__large']]: isLarge,\n [radioButtonStyles['radio-button-wrapper__large--focused']]: isLarge && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--selected']]: isLarge && checked && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--invalid']]: isLarge && onCherry && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--on-blueberry']]: isLarge && onBlueberry && isFocused,\n });\n const radioButtonLabelClasses = classNames(\n radioButtonStyles['radio-button-label'],\n {\n [radioButtonStyles['radio-button-label--disabled']]: disabled,\n [radioButtonStyles['radio-button-label--on-dark']]: onDark,\n [radioButtonStyles['radio-button-label--invalid']]: invalid,\n [radioButtonStyles['radio-button-label__large']]: isLarge,\n [radioButtonStyles['radio-button-label__large--disabled']]: isLarge && disabled,\n },\n labelClassNames\n );\n const radioButtonClasses = classNames(\n radioButtonStyles['radio-button'],\n {\n [radioButtonStyles['radio-button--on-dark']]: onDark,\n [radioButtonStyles['radio-button--disabled']]: disabled,\n [radioButtonStyles['radio-button--on-blueberry']]: onBlueberry,\n [radioButtonStyles['radio-button--invalid']]: invalid,\n [radioButtonStyles['radio-button__large']]: isLarge,\n [radioButtonStyles['radio-button__large--disabled']]: isLarge && disabled,\n [radioButtonStyles['radio-button__large--invalid']]: isLarge && invalid,\n },\n className\n );\n const errorStyles = classNames(radioButtonStyles['radio-button-errors']);\n\n const change = (e: React.ChangeEvent<HTMLInputElement>): void => {\n changeChecked(e.target.checked);\n onChange && onChange(e);\n };\n\n const getLabelContent = (): React.ReactNode => (\n <input\n id={inputId}\n name={name}\n className={radioButtonClasses}\n type=\"radio\"\n disabled={disabled}\n value={value}\n ref={mergedRefs}\n defaultChecked={defaultChecked}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n required={required}\n {...rest}\n onChange={(e): void => change(e)}\n />\n );\n\n return (\n <div data-testid={testId} data-analyticsid={AnalyticsId.RadioButton} className={radioButtonWrapperClasses}>\n {errorText && (\n <p className={errorStyles} id={errorTextUuid}>\n {errorText}\n </p>\n )}\n {renderLabelAsParent(\n label,\n getLabelContent(),\n inputId,\n mode as FormMode,\n radioButtonLabelClasses,\n undefined,\n radioButtonStyles['radiobutton-sublabel-wrapper'],\n isLarge\n )}\n </div>\n );\n});\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"names":["getRadioLabelClasses","radioId","mode","large","checkedRadioId","onCherry","checked","classNames","radioButtonStyles","RadioButton","React","props","ref","className","defaultChecked","onChange","disabled","label","inputId","uuid","FormMode","name","size","errorText","error","errorTextId","value","getLabelText","testId","required","labelClassNames","rest","invalid","onDark","onBlueberry","isLarge","FormSize","changeChecked","useState","refObject","isFocused","usePseudoClasses","isMutableRefObject","mergedRefs","mergeRefs","errorTextUuid","useUuid","radioButtonWrapperClasses","radioButtonLabelClasses","radioButtonClasses","errorStyles","change","e","getLabelContent","getAriaDescribedBy","AnalyticsId","renderLabelAsParent"],"mappings":";;;;;;;;;;AAyCO,MAAMA,KAAuB,CAACC,GAAiBC,GAAgBC,GAAgBC,MAAgD;AACpI,QAAMC,IAAWH,MAAS,aACpBI,IAAUL,MAAYG;AAE5B,SAAOG,EAAW;AAAA,IAChB,CAACC,EAAkB,oCAAoC,CAAC,GAAGL,KA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EAAA,GAGlBC,IAAkB,MACtB3C,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAIQ;AAAA,MACJ,MAAAG;AAAA,MACA,WAAW4B;AAAA,MACX,MAAK;AAAA,MACL,UAAAjC;AAAA,MACA,OAAAU;AAAA,MACA,KAAKiB;AAAA,MACL,gBAAA7B;AAAA,MACA,oBAAkBwC,EAAmB3C,GAAOkC,CAAa;AAAA,MACzD,UAAAhB;AAAA,MACC,GAAGE;AAAA,MACJ,UAAU,CAACqB,MAAYD,EAAOC,CAAC;AAAA,IAAA;AAAA,EAAA;AAInC,yCACG,OAAI,EAAA,eAAaxB,GAAQ,oBAAkB2B,EAAY,aAAa,WAAWR,EAC7E,GAAAxB,qCACE,KAAE,EAAA,WAAW2B,GAAa,IAAIL,EAAA,GAC5BtB,CACH,GAEDiC;AAAA,IACCvC;AAAA,IACAoC,EAAgB;AAAA,IAChBnC;AAAA,IACAhB;AAAA,IACA8C;AAAA,IACA;AAAA,IACAxC,EAAkB,8BAA8B;AAAA,IAChD2B;AAAA,EAAA,CAEJ;AAEJ,CAAC;AAED1B,EAAY,cAAc;"}
@@ -1,8 +1,8 @@
1
- import t from "./RadioButton.js";
2
- import { RadioButton as r, getRadioLabelClasses as d } from "./RadioButton.js";
1
+ import { RadioButton as t } from "./RadioButton.js";
2
+ import { getRadioLabelClasses as r } from "./RadioButton.js";
3
3
  export {
4
- r as RadioButton,
4
+ t as RadioButton,
5
5
  t as default,
6
- d as getRadioLabelClasses
6
+ r as getRadioLabelClasses
7
7
  };
8
8
  //# sourceMappingURL=index.js.map
@@ -27,11 +27,11 @@
27
27
  }
28
28
 
29
29
  &--with-error#{&}__large {
30
- padding: getSpacer(m) getSpacer(m);
30
+ padding: getSpacer(m);
31
31
  }
32
32
 
33
33
  &__large {
34
- margin: getSpacer(2xs) 0 getSpacer(2xs) 0;
34
+ margin: getSpacer(2xs) 0;
35
35
 
36
36
  &--focused {
37
37
  box-shadow: 0 0 0 getSpacer(3xs);
@@ -1,15 +1,15 @@
1
1
  import r from "react";
2
2
  import s from "classnames";
3
- import { FormMode as B, AnalyticsId as F, IconSize as H, AVERAGE_CHARACTER_WIDTH_PX as M } from "../../constants.js";
3
+ import { FormMode as F, AnalyticsId as H, IconSize as M, AVERAGE_CHARACTER_WIDTH_PX as U } from "../../constants.js";
4
4
  import { useUuid as w } from "../../hooks/useUuid.js";
5
5
  import { getColor as v } from "../../theme/currys/color.js";
6
- import { getAriaDescribedBy as U } from "../../utils/accessibility.js";
7
- import V from "../ErrorWrapper/ErrorWrapper.js";
8
- import { Icon as X } from "../Icon/Icon.js";
6
+ import { getAriaDescribedBy as V } from "../../utils/accessibility.js";
7
+ import { ErrorWrapper as X } from "../ErrorWrapper/ErrorWrapper.js";
8
+ import { Icon as $ } from "../Icon/Icon.js";
9
9
  import G from "../Icons/ChevronDown.js";
10
10
  import { renderLabel as L } from "../Label/Label.js";
11
11
  import e from "../Select/styles.module.scss";
12
- const P = (o) => `calc(${o * M}px + 2rem)`, j = (o, t) => t ? v("neutral", 500) : v(o ? "cherry" : "blueberry", 600), k = r.forwardRef(function(t, c) {
12
+ const P = (o) => `calc(${o * U}px + 2rem)`, j = (o, t) => t ? v("neutral", 500) : v(o ? "cherry" : "blueberry", 600), ae = r.forwardRef(function(t, c) {
13
13
  const {
14
14
  className: y,
15
15
  children: I,
@@ -18,19 +18,19 @@ const P = (o) => `calc(${o * M}px + 2rem)`, j = (o, t) => t ? v("neutral", 500)
18
18
  error: E,
19
19
  errorText: i,
20
20
  errorTextId: x,
21
- label: S,
21
+ label: W,
22
22
  selectId: d,
23
- name: W = d,
24
- mode: n = B.onwhite,
25
- testId: g,
23
+ name: g = d,
24
+ mode: n = F.onwhite,
25
+ testId: N,
26
26
  width: m,
27
27
  required: p,
28
- value: N,
28
+ value: S,
29
29
  defaultValue: A,
30
30
  autoComplete: u = "off",
31
31
  wrapperClassName: R,
32
32
  ...T
33
- } = t, f = w(d), b = w(x), C = n === "onblueberry", a = n === "oninvalid" || !!i || !!E, _ = j(a, !!l), D = m ? P(m) : void 0, $ = s(
33
+ } = t, f = w(d), b = w(x), C = n === "onblueberry", a = n === "oninvalid" || !!i || !!E, _ = j(a, !!l), D = m ? P(m) : void 0, q = s(
34
34
  e["select-inner-wrapper"],
35
35
  {
36
36
  [e["select-inner-wrapper--transparent"]]: h === "transparent",
@@ -39,32 +39,32 @@ const P = (o) => `calc(${o * M}px + 2rem)`, j = (o, t) => t ? v("neutral", 500)
39
39
  [e["select-inner-wrapper--disabled"]]: l
40
40
  },
41
41
  y
42
- ), q = s(e.select, {
42
+ ), z = s(e.select, {
43
43
  [e["select--on-blueberry"]]: C,
44
44
  [e["select--invalid"]]: a
45
- }), z = s(e["select-wrapper"], R);
46
- return /* @__PURE__ */ r.createElement(V, { errorText: i, errorTextId: b }, /* @__PURE__ */ r.createElement("div", { "data-testid": g, "data-analyticsid": F.Select, className: z, style: { maxWidth: D } }, L(S, f, n), /* @__PURE__ */ r.createElement("div", { className: $ }, /* @__PURE__ */ r.createElement(X, { className: e["select-arrow"], svgIcon: G, color: _, size: H.XSmall }), /* @__PURE__ */ r.createElement(
45
+ }), B = s(e["select-wrapper"], R);
46
+ return /* @__PURE__ */ r.createElement(X, { errorText: i, errorTextId: b }, /* @__PURE__ */ r.createElement("div", { "data-testid": N, "data-analyticsid": H.Select, className: B, style: { maxWidth: D } }, L(W, f, n), /* @__PURE__ */ r.createElement("div", { className: q }, /* @__PURE__ */ r.createElement($, { className: e["select-arrow"], svgIcon: G, color: _, size: M.XSmall }), /* @__PURE__ */ r.createElement(
47
47
  "select",
48
48
  {
49
49
  "aria-invalid": !!a,
50
50
  id: f,
51
- name: W,
52
- className: q,
51
+ name: g,
52
+ className: z,
53
53
  disabled: l,
54
54
  ref: c,
55
55
  required: p,
56
- "aria-describedby": U(t, b),
56
+ "aria-describedby": V(t, b),
57
57
  "aria-required": !!p,
58
- value: N,
58
+ value: S,
59
59
  defaultValue: A,
60
60
  autoComplete: u || void 0,
61
61
  ...T
62
62
  },
63
63
  I
64
64
  ))));
65
- }), le = k;
65
+ });
66
66
  export {
67
- k as Select,
68
- le as default
67
+ ae as Select,
68
+ ae as default
69
69
  };
70
70
  //# sourceMappingURL=Select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormMode, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getColor } from '../../theme/currys';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport ErrorWrapper from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { renderLabel } from '../Label';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends Pick<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n 'aria-describedby' | 'name' | 'disabled' | 'required' | 'value' | 'onChange' | 'autoComplete'\n > {\n /** Sets the content of the select element. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the component */\n concept?: SelectConcept;\n /** The label text above the select */\n label?: React.ReactNode;\n /** Changes the visuals of the component */\n mode?: keyof typeof FormMode;\n /** Activates Error style for the select component - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** select id of the select element */\n selectId?: string;\n /** Width of select in characters (approximate) */\n width?: number;\n /** Gives defaultvalue to the comp. Preferred over selected prop on option by react */\n defaultValue?: string | number;\n /** Adds custom classes to the wrapper tag */\n wrapperClassName?: string;\n}\n\nconst getSelectMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth})`;\n};\n\nconst getIconColor = (invalid: boolean, disabled: boolean) => {\n const iconColor = invalid ? 'cherry' : 'blueberry';\n return disabled ? getColor('neutral', 500) : getColor(iconColor, 600);\n};\n\nexport const Select = React.forwardRef(function SelectForwardedRef(props: SelectProps, ref: React.Ref<HTMLSelectElement>) {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId,\n label,\n selectId,\n name = selectId,\n mode = FormMode.onwhite,\n testId,\n width,\n required,\n value,\n defaultValue,\n autoComplete = 'off',\n wrapperClassName,\n ...rest\n } = props;\n\n const uuid = useUuid(selectId);\n const errorTextUuid = useUuid(errorTextId);\n const onBlueberry = mode === 'onblueberry';\n const invalid = mode === 'oninvalid' || !!errorText || !!error;\n const iconColor = getIconColor(invalid, !!disabled);\n const maxWidth = width ? getSelectMaxWidth(width) : undefined;\n\n const selectInnerWrapperClasses = classNames(\n selectStyles['select-inner-wrapper'],\n {\n [selectStyles['select-inner-wrapper--transparent']]: concept === 'transparent',\n [selectStyles['select-inner-wrapper--on-blueberry']]: onBlueberry,\n [selectStyles['select-inner-wrapper--invalid']]: invalid,\n [selectStyles['select-inner-wrapper--disabled']]: disabled,\n },\n className\n );\n\n const selectClasses = classNames(selectStyles.select, {\n [selectStyles['select--on-blueberry']]: onBlueberry,\n [selectStyles['select--invalid']]: invalid,\n });\n\n const selectWrapperClasses = classNames(selectStyles['select-wrapper'], wrapperClassName);\n\n return (\n <ErrorWrapper errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Select} className={selectWrapperClasses} style={{ maxWidth }}>\n {renderLabel(label, uuid, mode as FormMode)}\n <div className={selectInnerWrapperClasses}>\n <Icon className={selectStyles['select-arrow']} svgIcon={ChevronDown} color={iconColor} size={IconSize.XSmall} />\n <select\n aria-invalid={!!invalid}\n id={uuid}\n name={name}\n className={selectClasses}\n disabled={disabled}\n ref={ref}\n required={required}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-required={!!required}\n value={value}\n defaultValue={defaultValue}\n autoComplete={autoComplete ? autoComplete : undefined}\n {...rest}\n >\n {children}\n </select>\n </div>\n </div>\n </ErrorWrapper>\n );\n});\n\nexport default Select;\n"],"names":["getSelectMaxWidth","characters","AVERAGE_CHARACTER_WIDTH_PX","getIconColor","invalid","disabled","getColor","Select","React","props","ref","className","children","concept","error","errorText","errorTextId","label","selectId","name","mode","FormMode","testId","width","required","value","defaultValue","autoComplete","wrapperClassName","rest","uuid","useUuid","errorTextUuid","onBlueberry","iconColor","maxWidth","selectInnerWrapperClasses","classNames","selectStyles","selectClasses","selectWrapperClasses","ErrorWrapper","AnalyticsId","renderLabel","Icon","ChevronDown","IconSize","getAriaDescribedBy","Select$1"],"mappings":";;;;;;;;;;;AAkDA,MAAMA,IAAoB,CAACC,MAGlB,QAAQA,IAAaC,CAA0B,cAGlDC,IAAe,CAACC,GAAkBC,MAE/BA,IAAWC,EAAS,WAAW,GAAG,IAAIA,EAD3BF,IAAU,WAAW,aAC0B,GAAG,GAGzDG,IAASC,EAAM,WAAW,SAA4BC,GAAoBC,GAAmC;AAClH,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,UAAAR;AAAA,IACA,OAAAS;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC,IAAOD;AAAA,IACP,MAAAE,IAAOC,EAAS;AAAA,IAChB,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,kBAAAC;AAAA,IACA,GAAGC;AAAA,EACD,IAAApB,GAEEqB,IAAOC,EAAQb,CAAQ,GACvBc,IAAgBD,EAAQf,CAAW,GACnCiB,IAAcb,MAAS,eACvBhB,IAAUgB,MAAS,eAAe,CAAC,CAACL,KAAa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AAAA,MACjB,OAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAcC,KAA8B;AAAA,MAC3C,GAAGE;AAAA,IAAA;AAAA,IAEHjB;AAAA,EAEL,CAAA,CACF,CACF;AAEJ,CAAC,GAEDoC,KAAezC;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormMode, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getColor } from '../../theme/currys';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport ErrorWrapper from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { renderLabel } from '../Label';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends Pick<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n 'aria-describedby' | 'name' | 'disabled' | 'required' | 'value' | 'onChange' | 'autoComplete'\n > {\n /** Sets the content of the select element. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the component */\n concept?: SelectConcept;\n /** The label text above the select */\n label?: React.ReactNode;\n /** Changes the visuals of the component */\n mode?: keyof typeof FormMode;\n /** Activates Error style for the select component - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** select id of the select element */\n selectId?: string;\n /** Width of select in characters (approximate) */\n width?: number;\n /** Gives defaultvalue to the comp. Preferred over selected prop on option by react */\n defaultValue?: string | number;\n /** Adds custom classes to the wrapper tag */\n wrapperClassName?: string;\n}\n\nconst getSelectMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth})`;\n};\n\nconst getIconColor = (invalid: boolean, disabled: boolean) => {\n const iconColor = invalid ? 'cherry' : 'blueberry';\n return disabled ? getColor('neutral', 500) : getColor(iconColor, 600);\n};\n\nexport const Select = React.forwardRef(function SelectForwardedRef(props: SelectProps, ref: React.Ref<HTMLSelectElement>) {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId,\n label,\n selectId,\n name = selectId,\n mode = FormMode.onwhite,\n testId,\n width,\n required,\n value,\n defaultValue,\n autoComplete = 'off',\n wrapperClassName,\n ...rest\n } = props;\n\n const uuid = useUuid(selectId);\n const errorTextUuid = useUuid(errorTextId);\n const onBlueberry = mode === 'onblueberry';\n const invalid = mode === 'oninvalid' || !!errorText || !!error;\n const iconColor = getIconColor(invalid, !!disabled);\n const maxWidth = width ? getSelectMaxWidth(width) : undefined;\n\n const selectInnerWrapperClasses = classNames(\n selectStyles['select-inner-wrapper'],\n {\n [selectStyles['select-inner-wrapper--transparent']]: concept === 'transparent',\n [selectStyles['select-inner-wrapper--on-blueberry']]: onBlueberry,\n [selectStyles['select-inner-wrapper--invalid']]: invalid,\n [selectStyles['select-inner-wrapper--disabled']]: disabled,\n },\n className\n );\n\n const selectClasses = classNames(selectStyles.select, {\n [selectStyles['select--on-blueberry']]: onBlueberry,\n [selectStyles['select--invalid']]: invalid,\n });\n\n const selectWrapperClasses = classNames(selectStyles['select-wrapper'], wrapperClassName);\n\n return (\n <ErrorWrapper errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Select} className={selectWrapperClasses} style={{ maxWidth }}>\n {renderLabel(label, uuid, mode as FormMode)}\n <div className={selectInnerWrapperClasses}>\n <Icon className={selectStyles['select-arrow']} svgIcon={ChevronDown} color={iconColor} size={IconSize.XSmall} />\n <select\n aria-invalid={!!invalid}\n id={uuid}\n name={name}\n className={selectClasses}\n disabled={disabled}\n ref={ref}\n required={required}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-required={!!required}\n value={value}\n defaultValue={defaultValue}\n autoComplete={autoComplete ? autoComplete : undefined}\n {...rest}\n >\n {children}\n </select>\n </div>\n </div>\n </ErrorWrapper>\n );\n});\n\nexport default Select;\n"],"names":["getSelectMaxWidth","characters","AVERAGE_CHARACTER_WIDTH_PX","getIconColor","invalid","disabled","getColor","Select","React","props","ref","className","children","concept","error","errorText","errorTextId","label","selectId","name","mode","FormMode","testId","width","required","value","defaultValue","autoComplete","wrapperClassName","rest","uuid","useUuid","errorTextUuid","onBlueberry","iconColor","maxWidth","selectInnerWrapperClasses","classNames","selectStyles","selectClasses","selectWrapperClasses","ErrorWrapper","AnalyticsId","renderLabel","Icon","ChevronDown","IconSize","getAriaDescribedBy"],"mappings":";;;;;;;;;;;AAkDA,MAAMA,IAAoB,CAACC,MAGlB,QAAQA,IAAaC,CAA0B,cAGlDC,IAAe,CAACC,GAAkBC,MAE/BA,IAAWC,EAAS,WAAW,GAAG,IAAIA,EAD3BF,IAAU,WAAW,aAC0B,GAAG,GAGzDG,KAASC,EAAM,WAAW,SAA4BC,GAAoBC,GAAmC;AAClH,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,UAAAR;AAAA,IACA,OAAAS;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC,IAAOD;AAAA,IACP,MAAAE,IAAOC,EAAS;AAAA,IAChB,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,kBAAAC;AAAA,IACA,GAAGC;AAAA,EACD,IAAApB,GAEEqB,IAAOC,EAAQb,CAAQ,GACvBc,IAAgBD,EAAQf,CAAW,GACnCiB,IAAcb,MAAS,eACvBhB,IAAUgB,MAAS,eAAe,CAAC,CAACL,KAAa,CAAC,C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jB,OAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAcC,KAA8B;AAAA,MAC3C,GAAGE;AAAA,IAAA;AAAA,IAEHjB;AAAA,EAEL,CAAA,CACF,CACF;AAEJ,CAAC;"}
@@ -1,7 +1,6 @@
1
- import t from "./Select.js";
2
- import { Select as f } from "./Select.js";
1
+ import { Select as t } from "./Select.js";
3
2
  export {
4
- f as Select,
3
+ t as Select,
5
4
  t as default
6
5
  };
7
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -5,62 +5,62 @@ import { useHover as u } from "../../hooks/useHover.js";
5
5
  import { useUuid as w } from "../../hooks/useUuid.js";
6
6
  import { getColor as H } from "../../theme/currys/color.js";
7
7
  import { breakpoints as L } from "../../theme/grid.js";
8
- import { getAriaLabelAttributes as M } from "../../utils/accessibility.js";
9
- import X from "../Badge/NotificationBadge.js";
10
- import y from "../Close/Close.js";
8
+ import { getAriaLabelAttributes as X } from "../../utils/accessibility.js";
9
+ import y from "../Badge/NotificationBadge.js";
10
+ import A from "../Close/Close.js";
11
11
  import { Icon as C } from "../Icon/Icon.js";
12
12
  import { IconSize as E } from "../../constants.js";
13
- import A from "../Icons/ChevronDown.js";
13
+ import M from "../Icons/ChevronDown.js";
14
14
  import U from "../Icons/ChevronUp.js";
15
15
  import B from "../Icons/Forward.js";
16
- import $ from "../Icons/X.js";
16
+ import j from "../Icons/X.js";
17
17
  import s from "../ServiceMessage/styles.module.scss";
18
- const j = ({ label: c, variant: t, id: m, hasExpander: r, isExpanded: i, dismissable: v, onExpand: l, onDismiss: _, closeBtnText: n }) => {
19
- const g = z(), { isHovered: a, hoverRef: d } = u(), o = g < L.lg ? E.XSmall : E.Small, N = r ? "button" : "span", f = p(
18
+ const F = ({ label: c, variant: t, id: m, hasExpander: r, isExpanded: l, dismissable: v, onExpand: i, onDismiss: _, closeBtnText: n }) => {
19
+ const d = z(), { isHovered: a, hoverRef: g } = u(), o = d < L.lg ? E.XSmall : E.Small, N = r ? "button" : "span", f = p(
20
20
  s["service-message__label-container"],
21
21
  r && s["service-message__label-container--has-expander"]
22
22
  );
23
- return /* @__PURE__ */ e.createElement("div", { className: f, ref: d }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__container"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__row"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__col"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__label"] }, /* @__PURE__ */ e.createElement(X, { variant: t == "alert" ? "error" : t, size: o, isHovered: a }), /* @__PURE__ */ e.createElement("h1", { className: s["service-message__title"], id: m }, /* @__PURE__ */ e.createElement(
23
+ return /* @__PURE__ */ e.createElement("div", { className: f, ref: g }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__container"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__row"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__col"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__label"] }, /* @__PURE__ */ e.createElement(y, { variant: t == "alert" ? "error" : t, size: o, isHovered: a }), /* @__PURE__ */ e.createElement("h1", { className: s["service-message__title"], id: m }, /* @__PURE__ */ e.createElement(
24
24
  N,
25
25
  {
26
26
  className: s["service-message__toggle"],
27
- onClick: r ? l : void 0,
28
- "aria-expanded": r ? i : void 0
27
+ onClick: r ? i : void 0,
28
+ "aria-expanded": r ? l : void 0
29
29
  },
30
30
  c
31
- )), r && /* @__PURE__ */ e.createElement(C, { size: o, svgIcon: i ? U : A, isHovered: a }), !r && v && /* @__PURE__ */ e.createElement(y, { onClick: _, ariaLabel: n, className: s["service-message__close"] }))))));
32
- }, F = ({ info: c, extraInfo: t, urlTitle: m, url: r, target: i, dismissable: v, closeBtnText: l, onDismiss: _ }) => {
33
- const { hoverRef: n, isHovered: g } = u(), { hoverRef: a, isHovered: d } = u(), o = r && m;
34
- return /* @__PURE__ */ e.createElement("div", { className: s["service-message__container"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__row"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__col"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__content"] }, c && /* @__PURE__ */ e.createElement("p", { className: s["service-message__info"] }, c), t && /* @__PURE__ */ e.createElement("p", { className: p(s["service-message__info"], s["service-message__info--extra"]) }, t), /* @__PURE__ */ e.createElement("div", { className: s["service-message__actions"] }, o && /* @__PURE__ */ e.createElement("a", { className: s["service-message__action"], href: r, ref: n, target: i }, m, /* @__PURE__ */ e.createElement(C, { size: E.XSmall, svgIcon: B, color: H("blueberry", 700), isHovered: g })), v && /* @__PURE__ */ e.createElement(
31
+ )), r && /* @__PURE__ */ e.createElement(C, { size: o, svgIcon: l ? U : M, isHovered: a }), !r && v && /* @__PURE__ */ e.createElement(A, { onClick: _, ariaLabel: n, className: s["service-message__close"] }))))));
32
+ }, $ = ({ info: c, extraInfo: t, urlTitle: m, url: r, target: l, dismissable: v, closeBtnText: i, onDismiss: _ }) => {
33
+ const { hoverRef: n, isHovered: d } = u(), { hoverRef: a, isHovered: g } = u(), o = r && m;
34
+ return /* @__PURE__ */ e.createElement("div", { className: s["service-message__container"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__row"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__col"] }, /* @__PURE__ */ e.createElement("div", { className: s["service-message__content"] }, c && /* @__PURE__ */ e.createElement("p", { className: s["service-message__info"] }, c), t && /* @__PURE__ */ e.createElement("p", { className: p(s["service-message__info"], s["service-message__info--extra"]) }, t), /* @__PURE__ */ e.createElement("div", { className: s["service-message__actions"] }, o && /* @__PURE__ */ e.createElement("a", { className: s["service-message__action"], href: r, ref: n, target: l }, m, /* @__PURE__ */ e.createElement(C, { size: E.XSmall, svgIcon: B, color: H("blueberry", 700), isHovered: d })), v && /* @__PURE__ */ e.createElement(
35
35
  "button",
36
36
  {
37
37
  ref: a,
38
38
  className: p(s["service-message__action"], s["service-message__action--close"]),
39
- "aria-label": l,
39
+ "aria-label": i,
40
40
  onClick: _
41
41
  },
42
- l,
43
- /* @__PURE__ */ e.createElement(C, { size: E.XSmall, svgIcon: $, color: H("blueberry", 700), isHovered: d })
42
+ i,
43
+ /* @__PURE__ */ e.createElement(C, { size: E.XSmall, svgIcon: j, color: H("blueberry", 700), isHovered: g })
44
44
  ))))));
45
- }, q = ({
45
+ }, ae = ({
46
46
  label: c,
47
47
  dismissable: t = !0,
48
48
  onDismiss: m,
49
49
  info: r,
50
- extraInfo: i,
50
+ extraInfo: l,
51
51
  urlTitle: v,
52
- url: l,
52
+ url: i,
53
53
  target: _ = "_self",
54
54
  closeBtnText: n = "fjern melding",
55
- expanderOpenFromStart: g = !1,
55
+ expanderOpenFromStart: d = !1,
56
56
  variant: a = "error",
57
- testId: d
57
+ testId: g
58
58
  }) => {
59
- const [o, N] = h(g), f = w(), b = !!r || !!i, S = a === "alert" || a === "error" ? "alert" : "region", R = M({ label: c, id: f }), k = () => {
59
+ const [o, N] = h(d), f = w(), b = !!r || !!l, R = a === "alert" || a === "error" ? "alert" : "region", S = X({ label: c, id: f }), k = () => {
60
60
  b && N(!o);
61
61
  }, I = p(s["service-message"], s[`service-message--${a}`]);
62
- return /* @__PURE__ */ e.createElement("div", { className: I, role: S, ...R, "data-testid": d }, /* @__PURE__ */ e.createElement(
63
- j,
62
+ return /* @__PURE__ */ e.createElement("div", { className: I, role: R, ...S, "data-testid": g }, /* @__PURE__ */ e.createElement(
63
+ F,
64
64
  {
65
65
  label: c,
66
66
  variant: a,
@@ -73,20 +73,20 @@ const j = ({ label: c, variant: t, id: m, hasExpander: r, isExpanded: i, dismiss
73
73
  closeBtnText: n
74
74
  }
75
75
  ), b && o && /* @__PURE__ */ e.createElement(
76
- F,
76
+ $,
77
77
  {
78
78
  info: r,
79
- extraInfo: i,
79
+ extraInfo: l,
80
80
  urlTitle: v,
81
- url: l,
81
+ url: i,
82
82
  target: _,
83
83
  dismissable: t,
84
84
  onDismiss: m,
85
85
  closeBtnText: n
86
86
  }
87
87
  ));
88
- }, te = q;
88
+ };
89
89
  export {
90
- te as default
90
+ ae as default
91
91
  };
92
92
  //# sourceMappingURL=ServiceMessage.js.map