@helsenorge/designsystem-react 14.6.0 → 14.7.1

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 (281) hide show
  1. package/lib/AnchorLink.js +2 -2
  2. package/lib/AnchorLink.js.map +1 -1
  3. package/lib/Avatar.js +2 -2
  4. package/lib/Avatar.js.map +1 -1
  5. package/lib/Badge.js +2 -2
  6. package/lib/Badge.js.map +1 -1
  7. package/lib/Button.js +6 -6
  8. package/lib/Button.js.map +1 -1
  9. package/lib/CHANGELOG.md +17 -0
  10. package/lib/Checkbox.js +6 -6
  11. package/lib/Checkbox.js.map +1 -1
  12. package/lib/Chip.js +60 -0
  13. package/lib/Chip.js.map +1 -0
  14. package/lib/Close.js +3 -3
  15. package/lib/Close.js.map +1 -1
  16. package/lib/DictionaryTrigger.js +2 -2
  17. package/lib/DictionaryTrigger.js.map +1 -1
  18. package/lib/Drawer.js +42 -19
  19. package/lib/Drawer.js.map +1 -1
  20. package/lib/DrawerNavigation.js +81 -0
  21. package/lib/DrawerNavigation.js.map +1 -0
  22. package/lib/DrawerNavigation2.js +5 -0
  23. package/lib/DrawerNavigation2.js.map +1 -0
  24. package/lib/Duolist.js +5 -5
  25. package/lib/Duolist.js.map +1 -1
  26. package/lib/ElementHeader.js +9 -9
  27. package/lib/ElementHeader.js.map +1 -1
  28. package/lib/ElementHeaderText.js +4 -4
  29. package/lib/ElementHeaderText.js.map +1 -1
  30. package/lib/ErrorWrapper.js +2 -2
  31. package/lib/ErrorWrapper.js.map +1 -1
  32. package/lib/Expander.js +8 -8
  33. package/lib/Expander.js.map +1 -1
  34. package/lib/Filter.js +44 -0
  35. package/lib/Filter.js.map +1 -0
  36. package/lib/FilterButton.js +40 -0
  37. package/lib/FilterButton.js.map +1 -0
  38. package/lib/FilterButtonAndChipsWrapper.js +14 -0
  39. package/lib/FilterButtonAndChipsWrapper.js.map +1 -0
  40. package/lib/FilterDrawer.js +91 -0
  41. package/lib/FilterDrawer.js.map +1 -0
  42. package/lib/FilterLinkList.js +61 -0
  43. package/lib/FilterLinkList.js.map +1 -0
  44. package/lib/FilterLinkList2.js +5 -0
  45. package/lib/FilterLinkList2.js.map +1 -0
  46. package/lib/FilterOverviewLinkList.js +22 -0
  47. package/lib/FilterOverviewLinkList.js.map +1 -0
  48. package/lib/FilterOverviewSearch.js +16 -0
  49. package/lib/FilterOverviewSearch.js.map +1 -0
  50. package/lib/FilterResultCountAndSortWrapper.js +19 -0
  51. package/lib/FilterResultCountAndSortWrapper.js.map +1 -0
  52. package/lib/FilterSearch.js +87 -0
  53. package/lib/FilterSearch.js.map +1 -0
  54. package/lib/FilterSearch2.js +5 -0
  55. package/lib/FilterSearch2.js.map +1 -0
  56. package/lib/FilterSort.js +30 -0
  57. package/lib/FilterSort.js.map +1 -0
  58. package/lib/FormFieldTag.js +2 -2
  59. package/lib/FormFieldTag.js.map +1 -1
  60. package/lib/FormGroup.js +6 -6
  61. package/lib/FormGroup.js.map +1 -1
  62. package/lib/FormLayout.js +3 -3
  63. package/lib/FormLayout.js.map +1 -1
  64. package/lib/HelpDetails.js +3 -3
  65. package/lib/HelpDetails.js.map +1 -1
  66. package/lib/HelpTriggerIcon.js +2 -2
  67. package/lib/HelpTriggerIcon.js.map +1 -1
  68. package/lib/HelpTriggerStandalone.js +2 -2
  69. package/lib/HelpTriggerStandalone.js.map +1 -1
  70. package/lib/HighlightPanel.js +3 -3
  71. package/lib/HighlightPanel.js.map +1 -1
  72. package/lib/HorizontalScroll.js +4 -4
  73. package/lib/HorizontalScroll.js.map +1 -1
  74. package/lib/Icon.js +2 -2
  75. package/lib/Icon.js.map +1 -1
  76. package/lib/InfoTeaser.js +3 -3
  77. package/lib/InfoTeaser.js.map +1 -1
  78. package/lib/Input.js +4 -4
  79. package/lib/Input.js.map +1 -1
  80. package/lib/LinkList.js +5 -5
  81. package/lib/LinkList.js.map +1 -1
  82. package/lib/List.js +2 -2
  83. package/lib/List.js.map +1 -1
  84. package/lib/ListEditMode.js +4 -4
  85. package/lib/ListEditMode.js.map +1 -1
  86. package/lib/MaxCharacters.js +2 -2
  87. package/lib/MaxCharacters.js.map +1 -1
  88. package/lib/PanelTitle.js +2 -2
  89. package/lib/PanelTitle.js.map +1 -1
  90. package/lib/PopOver.js +2 -2
  91. package/lib/PopOver.js.map +1 -1
  92. package/lib/Search.js +26 -0
  93. package/lib/Search.js.map +1 -0
  94. package/lib/Select.js +7 -6
  95. package/lib/Select.js.map +1 -1
  96. package/lib/SingleSelectItem.js +3 -3
  97. package/lib/SingleSelectItem.js.map +1 -1
  98. package/lib/Slider.js +4 -4
  99. package/lib/Slider.js.map +1 -1
  100. package/lib/Spacer.js +2 -2
  101. package/lib/Spacer.js.map +1 -1
  102. package/lib/StatusDot.js +4 -4
  103. package/lib/StatusDot.js.map +1 -1
  104. package/lib/StatusDotList.js +2 -2
  105. package/lib/StatusDotList.js.map +1 -1
  106. package/lib/StepButtons.js +5 -5
  107. package/lib/StepButtons.js.map +1 -1
  108. package/lib/TabList.js +8 -8
  109. package/lib/TabList.js.map +1 -1
  110. package/lib/TabPanel.js +2 -2
  111. package/lib/TabPanel.js.map +1 -1
  112. package/lib/TableBody.js +2 -2
  113. package/lib/TableBody.js.map +1 -1
  114. package/lib/TableCell.js +2 -2
  115. package/lib/TableCell.js.map +1 -1
  116. package/lib/TableExpandedRow.js +4 -4
  117. package/lib/TableExpandedRow.js.map +1 -1
  118. package/lib/TableExpanderCell.js +2 -2
  119. package/lib/TableExpanderCell.js.map +1 -1
  120. package/lib/TableHead.js +2 -2
  121. package/lib/TableHead.js.map +1 -1
  122. package/lib/TableHeadCell.js +3 -3
  123. package/lib/TableHeadCell.js.map +1 -1
  124. package/lib/TableRow.js +3 -3
  125. package/lib/TableRow.js.map +1 -1
  126. package/lib/Textarea.js +4 -4
  127. package/lib/Textarea.js.map +1 -1
  128. package/lib/Title.js +4 -3
  129. package/lib/Title.js.map +1 -1
  130. package/lib/Toast.js +3 -3
  131. package/lib/Toast.js.map +1 -1
  132. package/lib/components/ArticleTeaser/index.js +4 -4
  133. package/lib/components/ArticleTeaser/index.js.map +1 -1
  134. package/lib/components/Chip/index.js +1 -59
  135. package/lib/components/Drawer/Drawer.d.ts +6 -0
  136. package/lib/components/Drawer/styles.module.scss +19 -0
  137. package/lib/components/Drawer/styles.module.scss.d.ts +1 -0
  138. package/lib/components/Dropdown/index.js +5 -5
  139. package/lib/components/Dropdown/index.js.map +1 -1
  140. package/lib/components/DropdownOld/index.js +3 -3
  141. package/lib/components/DropdownOld/index.js.map +1 -1
  142. package/lib/components/EmptyState/index.js +2 -2
  143. package/lib/components/EmptyState/index.js.map +1 -1
  144. package/lib/components/ExpanderHierarchy/index.js +7 -7
  145. package/lib/components/ExpanderHierarchy/index.js.map +1 -1
  146. package/lib/components/ExpanderList/index.js +6 -6
  147. package/lib/components/ExpanderList/index.js.map +1 -1
  148. package/lib/components/FavoriteButton/index.js +2 -2
  149. package/lib/components/FavoriteButton/index.js.map +1 -1
  150. package/lib/components/Filter/DrawerNavigation/DrawerNavigation.d.ts +35 -0
  151. package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.example.d.ts +2 -0
  152. package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.module.scss +15 -0
  153. package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.module.scss.d.ts +11 -0
  154. package/lib/components/Filter/DrawerNavigation/index.d.ts +4 -0
  155. package/lib/components/Filter/DrawerNavigation/index.js +3 -0
  156. package/lib/components/Filter/DrawerNavigation/useDrawerNavigation.d.ts +7 -0
  157. package/lib/components/Filter/FilterButton/FilterButton.d.ts +7 -0
  158. package/lib/components/Filter/FilterButton/index.d.ts +3 -0
  159. package/lib/components/Filter/FilterButton/index.js +2 -0
  160. package/lib/components/Filter/FilterButton/styles.module.scss +52 -0
  161. package/lib/components/Filter/FilterButton/styles.module.scss.d.ts +12 -0
  162. package/lib/components/Filter/FilterButtonAndChipsWrapper/FilterButtonAndChipsWrapper.d.ts +11 -0
  163. package/lib/components/Filter/FilterButtonAndChipsWrapper/index.d.ts +3 -0
  164. package/lib/components/Filter/FilterButtonAndChipsWrapper/index.js +2 -0
  165. package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss +8 -0
  166. package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss.d.ts +9 -0
  167. package/lib/components/Filter/FilterDrawer/FilterDrawer.d.ts +42 -0
  168. package/lib/components/Filter/FilterDrawer/index.d.ts +3 -0
  169. package/lib/components/Filter/FilterDrawer/index.js +2 -0
  170. package/lib/components/Filter/FilterDrawer/styles.module.scss +29 -0
  171. package/lib/components/Filter/FilterDrawer/styles.module.scss.d.ts +10 -0
  172. package/lib/components/Filter/FilterLinkList/FilterLinkList.d.ts +35 -0
  173. package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss +89 -0
  174. package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss.d.ts +14 -0
  175. package/lib/components/Filter/FilterLinkList/index.d.ts +3 -0
  176. package/lib/components/Filter/FilterLinkList/index.js +3 -0
  177. package/lib/components/Filter/FilterOverviewLinkList/FilterOverviewLinkList.d.ts +19 -0
  178. package/lib/components/Filter/FilterOverviewLinkList/index.d.ts +3 -0
  179. package/lib/components/Filter/FilterOverviewLinkList/index.js +2 -0
  180. package/lib/components/Filter/FilterOverviewSearch/FilterOverviewSearch.d.ts +9 -0
  181. package/lib/components/Filter/FilterOverviewSearch/index.d.ts +3 -0
  182. package/lib/components/Filter/FilterOverviewSearch/index.js +2 -0
  183. package/lib/components/Filter/FilterOverviewSearch/styles.module.scss +14 -0
  184. package/lib/components/Filter/FilterOverviewSearch/styles.module.scss.d.ts +9 -0
  185. package/lib/components/Filter/FilterResultCountAndSortWrapper/FilterResultCountAndSortWrapper.d.ts +8 -0
  186. package/lib/components/Filter/FilterResultCountAndSortWrapper/index.d.ts +3 -0
  187. package/lib/components/Filter/FilterResultCountAndSortWrapper/index.js +2 -0
  188. package/lib/components/Filter/FilterResultCountAndSortWrapper/styles.module.scss +17 -0
  189. package/lib/components/Filter/FilterResultCountAndSortWrapper/styles.module.scss.d.ts +11 -0
  190. package/lib/components/Filter/FilterSearch/FilterSearch.d.ts +19 -0
  191. package/lib/components/Filter/FilterSearch/index.d.ts +3 -0
  192. package/lib/components/Filter/FilterSearch/index.js +2 -0
  193. package/lib/components/Filter/FilterSearch/styles.module.scss +181 -0
  194. package/lib/components/Filter/FilterSearch/styles.module.scss.d.ts +16 -0
  195. package/lib/components/Filter/FilterSort/FilterSort.d.ts +8 -0
  196. package/lib/components/Filter/FilterSort/index.d.ts +3 -0
  197. package/lib/components/Filter/FilterSort/index.js +2 -0
  198. package/lib/components/Filter/FilterSort/styles.module.scss +33 -0
  199. package/lib/components/Filter/FilterSort/styles.module.scss.d.ts +11 -0
  200. package/lib/components/Filter/getFilterChips/getFilterChips.d.ts +17 -0
  201. package/lib/components/Filter/getFilterChips/index.d.ts +3 -0
  202. package/lib/components/Filter/getFilterChips/index.js +2 -0
  203. package/lib/components/Filter/index.d.ts +25 -0
  204. package/lib/components/Filter/index.js +137 -0
  205. package/lib/components/Filter/index.js.map +1 -0
  206. package/lib/components/Filter/resourceHelper.d.ts +3 -0
  207. package/lib/components/Filter/resourcesMock.d.ts +41 -0
  208. package/lib/components/Filter/useFilter.d.ts +20 -0
  209. package/lib/components/Filter/useFilterDrawer.d.ts +11 -0
  210. package/lib/components/Filter/utils.d.ts +81 -0
  211. package/lib/components/HelpBubble/index.js +3 -3
  212. package/lib/components/HelpBubble/index.js.map +1 -1
  213. package/lib/components/HelpPanel/index.js +2 -2
  214. package/lib/components/HelpPanel/index.js.map +1 -1
  215. package/lib/components/HelpTriggerInline/index.js +2 -2
  216. package/lib/components/HelpTriggerInline/index.js.map +1 -1
  217. package/lib/components/Icons/Filter.js +1 -43
  218. package/lib/components/Icons/Search.js +1 -25
  219. package/lib/components/Label/utils.d.ts +1 -0
  220. package/lib/components/Loader/index.js +4 -4
  221. package/lib/components/Loader/index.js.map +1 -1
  222. package/lib/components/Modal/index.js +9 -9
  223. package/lib/components/Modal/index.js.map +1 -1
  224. package/lib/components/NotificationPanel/index.js +6 -6
  225. package/lib/components/NotificationPanel/index.js.map +1 -1
  226. package/lib/components/Panel/index.js +12 -12
  227. package/lib/components/Panel/index.js.map +1 -1
  228. package/lib/components/PanelList/index.js +3 -3
  229. package/lib/components/PanelList/index.js.map +1 -1
  230. package/lib/components/PopMenu/index.js +3 -3
  231. package/lib/components/PopMenu/index.js.map +1 -1
  232. package/lib/components/Progressbar/index.js +2 -2
  233. package/lib/components/Progressbar/index.js.map +1 -1
  234. package/lib/components/PromoPanel/index.js +2 -2
  235. package/lib/components/PromoPanel/index.js.map +1 -1
  236. package/lib/components/Select/Select.d.ts +2 -0
  237. package/lib/components/Select/styles.module.scss +1 -0
  238. package/lib/components/ServiceMessage/index.js +5 -5
  239. package/lib/components/ServiceMessage/index.js.map +1 -1
  240. package/lib/components/SharingStatus/index.js +4 -4
  241. package/lib/components/SharingStatus/index.js.map +1 -1
  242. package/lib/components/Step/index.js +2 -2
  243. package/lib/components/Step/index.js.map +1 -1
  244. package/lib/components/Stepper/index.js +2 -2
  245. package/lib/components/Stepper/index.js.map +1 -1
  246. package/lib/components/StickyNote/index.js +8 -8
  247. package/lib/components/StickyNote/index.js.map +1 -1
  248. package/lib/components/Table/index.js +2 -2
  249. package/lib/components/Table/index.js.map +1 -1
  250. package/lib/components/Tabs/index.js +4 -4
  251. package/lib/components/Tabs/index.js.map +1 -1
  252. package/lib/components/Tag/index.js +2 -2
  253. package/lib/components/Tag/index.js.map +1 -1
  254. package/lib/components/Tile/index.js +4 -4
  255. package/lib/components/Tile/index.js.map +1 -1
  256. package/lib/components/Title/Title.d.ts +2 -0
  257. package/lib/components/Toggle/index.js +7 -7
  258. package/lib/components/Toggle/index.js.map +1 -1
  259. package/lib/components/Validation/index.js +2 -2
  260. package/lib/components/Validation/index.js.map +1 -1
  261. package/lib/getFilterChips.js +30 -0
  262. package/lib/getFilterChips.js.map +1 -0
  263. package/lib/index.d.ts +1 -0
  264. package/lib/index.js +2 -1
  265. package/lib/resource.js +4 -0
  266. package/lib/resource.js.map +1 -0
  267. package/lib/resourceHelper.js +31 -0
  268. package/lib/resourceHelper.js.map +1 -0
  269. package/lib/resources/HN.Designsystem.Drawer.nn-NO.json.d.ts +7 -0
  270. package/lib/resources/HN.Designsystem.Filter.en-GB.json.d.ts +13 -0
  271. package/lib/resources/HN.Designsystem.Filter.nb-NO.json.d.ts +13 -0
  272. package/lib/utils/resource.d.ts +6 -0
  273. package/lib/utils/resource.js +2 -0
  274. package/lib/utils2.js +11 -9
  275. package/lib/utils2.js.map +1 -1
  276. package/lib/utils3.js +5 -5
  277. package/lib/utils3.js.map +1 -1
  278. package/package.json +1 -1
  279. package/lib/components/Chip/index.js.map +0 -1
  280. package/lib/components/Icons/Filter.js.map +0 -1
  281. package/lib/components/Icons/Search.js.map +0 -1
package/lib/Search.js ADDED
@@ -0,0 +1,26 @@
1
+ import { t as getIcon } from "./utils.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ var Search = ({ size, isHovered }) => {
4
+ return getIcon({
5
+ size,
6
+ isHovered,
7
+ normal: /* @__PURE__ */ jsx("path", { d: "M21.277 7.738c7.27 0 13.165 5.895 13.165 13.166 0 2.222-.55 4.316-1.523 6.153l6.268 6.268a3.929 3.929 0 01-5.41 5.695l-.146-.139-6.289-6.289a13.11 13.11 0 01-6.065 1.478c-7.272 0-13.166-5.895-13.166-13.166 0-7.271 5.894-13.166 13.166-13.166zM32 28.542a13.24 13.24 0 01-3.164 3.142l5.996 5.995a2.229 2.229 0 003.26-3.036l-.108-.116zM21.277 9.438c-6.333 0-11.466 5.133-11.466 11.466 0 6.332 5.133 11.466 11.466 11.466 2.258 0 4.365-.654 6.14-1.781l.163-.163.034.035a11.529 11.529 0 003.165-3.14l-.047-.048.228-.226a11.412 11.412 0 001.782-6.143c0-6.333-5.133-11.466-11.465-11.466z" }),
8
+ normalHover: /* @__PURE__ */ jsx("path", { d: "M21.527 6.932c7.932 0 14.363 6.43 14.363 14.362 0 2.556-.668 4.956-1.838 7.035l5.386 5.386a3.929 3.929 0 01-5.41 5.696l-.146-.14-5.406-5.404a14.298 14.298 0 01-6.949 1.79c-7.932 0-14.362-6.43-14.362-14.363 0-7.932 6.43-14.362 14.362-14.362zM33.11 29.79a14.445 14.445 0 01-3.162 3.141l5.137 5.138a2.229 2.229 0 003.26-3.035l-.108-.117zM21.527 8.632c-6.993 0-12.662 5.669-12.662 12.662 0 6.993 5.669 12.663 12.662 12.663 6.993 0 12.663-5.67 12.663-12.663S28.52 8.632 21.527 8.632z" }),
9
+ xSmall: /* @__PURE__ */ jsx("path", { d: "M34.476 34.206c-.486.487-1.333.487-1.82 0l-4.402-4.403a10.426 10.426 0 001.78-1.857l4.442 4.44c.243.243.376.567.376.91 0 .345-.133.668-.376.91M21.742 30.07c-4.592 0-8.327-3.737-8.327-8.327 0-4.592 3.735-8.327 8.327-8.327 4.591 0 8.327 3.735 8.327 8.327 0 4.59-3.736 8.327-8.327 8.327m14.181.871l-4.8-4.8c.63-1.338.991-2.825.991-4.398 0-5.72-4.653-10.374-10.372-10.374-5.72 0-10.374 4.653-10.374 10.374 0 5.72 4.653 10.372 10.374 10.372 1.717 0 3.333-.426 4.76-1.168l4.708 4.708a3.312 3.312 0 002.357.976c.89 0 1.727-.348 2.356-.976a3.339 3.339 0 000-4.714" }),
10
+ xSmallHover: /* @__PURE__ */ jsx("path", { d: "M34.7 34.43c-.486.485-1.338.487-1.823 0l-3.388-3.39c.663-.55 1.255-1.18 1.785-1.859l3.426 3.424c.244.242.377.567.377.911 0 .346-.133.669-.377.914m-12.76-2.994c-5.238 0-9.5-4.26-9.5-9.499 0-5.238 4.262-9.499 9.5-9.499 5.237 0 9.498 4.261 9.498 9.5 0 5.237-4.26 9.498-9.499 9.498m14.21-.28l-3.734-3.736a11.744 11.744 0 001.356-5.483c0-6.524-5.31-11.832-11.832-11.832-6.524 0-11.834 5.308-11.834 11.832 0 6.525 5.31 11.834 11.834 11.834 2.12 0 4.108-.57 5.831-1.55l3.656 3.658c.633.63 1.47.979 2.362.979.893 0 1.732-.348 2.36-.98.632-.63.98-1.467.98-2.362 0-.89-.348-1.73-.98-2.36" }),
11
+ xxSmall: /* @__PURE__ */ jsx("path", {
12
+ "fill-rule": "evenodd",
13
+ "clip-rule": "evenodd",
14
+ d: "M20.1738 6.88672C27.4533 6.88672 33.3765 12.8075 33.377 20.0879C33.377 22.0407 32.934 23.8871 32.1699 25.5547L38.0918 31.4785C39.7973 33.1852 39.7973 35.9613 38.0918 37.668C37.2652 38.4933 36.1671 38.9509 34.998 38.9512C33.8287 38.9512 32.7281 38.4937 31.9023 37.668L26.1016 31.8672C24.3175 32.7694 22.3071 33.291 20.1738 33.291C12.8934 33.2906 6.97266 27.3673 6.97266 20.0879C6.97311 12.8077 12.8937 6.88717 20.1738 6.88672ZM33.9766 35.8223C34.0595 35.8891 34.1486 35.9464 34.2422 35.9941L34.1055 35.9141C34.0613 35.8856 34.0179 35.8555 33.9766 35.8223ZM30.5879 28.166C30.0088 28.9128 29.3558 29.5973 28.6309 30.2051L34 35.5742C34.5316 36.105 35.4668 36.1054 35.998 35.5742C36.2647 35.3076 36.4102 34.9522 36.4102 34.5742C36.4099 34.1967 36.264 33.8424 35.998 33.5762L30.5879 28.166ZM12.3984 30.5039C12.4725 30.5593 12.5498 30.6102 12.625 30.6641C12.3803 30.4889 12.1399 30.3085 11.9082 30.1172L12.3984 30.5039ZM20.1758 9.85156C14.5314 9.85197 9.93993 14.4435 9.93945 20.0879C9.93945 25.7316 14.5311 30.3258 20.1758 30.3262C25.8208 30.3262 30.4141 25.7318 30.4141 20.0879C30.4136 14.4432 25.8205 9.85156 20.1758 9.85156ZM24.2363 29.7051C24.392 29.6391 24.5456 29.5693 24.6973 29.4961C24.3933 29.6428 24.0811 29.7753 23.7617 29.8926L24.2363 29.7051ZM30.4199 18.0801C30.5472 18.7301 30.6152 19.4012 30.6152 20.0879L30.6016 19.5527C30.5761 19.0518 30.5139 18.5601 30.4199 18.0801ZM30.5898 12.3145C30.6024 12.3312 30.6145 12.3484 30.627 12.3652C30.4902 12.1806 30.3492 11.9993 30.2031 11.8223L30.5898 12.3145ZM23.2754 10.1211C24.0922 10.3756 24.8663 10.7276 25.584 11.1641L25.1484 10.9121C24.5564 10.59 23.9293 10.3248 23.2754 10.1211Z"
15
+ }),
16
+ xxSmallHover: /* @__PURE__ */ jsx("path", {
17
+ "fill-rule": "evenodd",
18
+ "clip-rule": "evenodd",
19
+ d: "M20.0664 5.13281C28.324 5.13306 35.0464 11.8511 35.0469 20.1113C35.0469 22.5634 34.442 24.8729 33.3926 26.918L37.957 31.4863C38.7823 32.3116 39.2383 33.4111 39.2383 34.5762C39.2382 35.7464 38.7821 36.8427 37.957 37.668C37.1342 38.4934 36.0347 38.9492 34.8672 38.9492C33.6999 38.9491 32.6029 38.4943 31.7754 37.6699L27.3105 33.2031C25.1607 34.3979 22.6954 35.0956 20.0664 35.0957C11.806 35.0954 5.08398 28.3719 5.08398 20.1113C5.08443 11.8511 11.8063 5.13314 20.0664 5.13281ZM31.7402 29.459C31.1525 30.1928 30.5023 30.8761 29.7871 31.4902L33.8711 35.5762C34.3983 36.1051 35.3349 36.1032 35.8633 35.5762C36.1311 35.3083 36.2772 34.9554 36.2773 34.5762C36.2773 34.1993 36.132 33.8448 35.8652 33.5801L31.7402 29.459ZM26.5273 33.3926C25.4214 33.9344 24.2397 34.3442 23.002 34.5977C23.3028 34.5361 23.6006 34.4664 23.8945 34.3867C25.1149 34.0558 26.2734 33.5714 27.3496 32.959C27.0807 33.112 26.8062 33.256 26.5273 33.3926ZM38.0957 31.9355C38.3575 32.2543 38.5693 32.6057 38.7246 32.9805C38.5174 32.4804 38.2105 32.0211 37.8164 31.627L38.0957 31.9355ZM20.0664 8.44531C13.6343 8.44564 8.40039 13.6791 8.40039 20.1113C8.40058 26.5434 13.6344 31.777 20.0664 31.7773C26.4984 31.777 31.7322 26.5434 31.7324 20.1113C31.7324 13.6791 26.4985 8.44568 20.0664 8.44531ZM17.6777 8.48633C16.327 8.76346 15.0598 9.27215 13.918 9.9668C14.7339 9.47055 15.6142 9.07065 16.543 8.78125C16.9139 8.66566 17.2923 8.56542 17.6777 8.48633ZM22.4551 8.48828C22.6482 8.52791 22.8397 8.57217 23.0293 8.62109C22.6501 8.52325 22.2639 8.443 21.8711 8.38281L22.4551 8.48828ZM20.0664 8.24609C19.6577 8.24609 19.2537 8.2661 18.8555 8.30664L19.457 8.26172C19.6589 8.25145 19.862 8.2461 20.0664 8.24609Z"
20
+ })
21
+ });
22
+ };
23
+ var Search_default = Search;
24
+ export { Search_default as t };
25
+
26
+ //# sourceMappingURL=Search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Search.js","names":["Search: React.FC<SvgPathProps>"],"sources":["../src/components/Icons/Search.tsx"],"sourcesContent":["import type { SvgPathProps } from '../Icon';\n\nimport { getIcon } from '../Icon/utils';\n\nconst Search: React.FC<SvgPathProps> = ({ size, isHovered }: SvgPathProps): React.ReactElement => {\n const normal = (\n <path d=\"M21.277 7.738c7.27 0 13.165 5.895 13.165 13.166 0 2.222-.55 4.316-1.523 6.153l6.268 6.268a3.929 3.929 0 01-5.41 5.695l-.146-.139-6.289-6.289a13.11 13.11 0 01-6.065 1.478c-7.272 0-13.166-5.895-13.166-13.166 0-7.271 5.894-13.166 13.166-13.166zM32 28.542a13.24 13.24 0 01-3.164 3.142l5.996 5.995a2.229 2.229 0 003.26-3.036l-.108-.116zM21.277 9.438c-6.333 0-11.466 5.133-11.466 11.466 0 6.332 5.133 11.466 11.466 11.466 2.258 0 4.365-.654 6.14-1.781l.163-.163.034.035a11.529 11.529 0 003.165-3.14l-.047-.048.228-.226a11.412 11.412 0 001.782-6.143c0-6.333-5.133-11.466-11.465-11.466z\" />\n );\n\n const normalHover = (\n <path d=\"M21.527 6.932c7.932 0 14.363 6.43 14.363 14.362 0 2.556-.668 4.956-1.838 7.035l5.386 5.386a3.929 3.929 0 01-5.41 5.696l-.146-.14-5.406-5.404a14.298 14.298 0 01-6.949 1.79c-7.932 0-14.362-6.43-14.362-14.363 0-7.932 6.43-14.362 14.362-14.362zM33.11 29.79a14.445 14.445 0 01-3.162 3.141l5.137 5.138a2.229 2.229 0 003.26-3.035l-.108-.117zM21.527 8.632c-6.993 0-12.662 5.669-12.662 12.662 0 6.993 5.669 12.663 12.662 12.663 6.993 0 12.663-5.67 12.663-12.663S28.52 8.632 21.527 8.632z\" />\n );\n\n const xSmall = (\n <path d=\"M34.476 34.206c-.486.487-1.333.487-1.82 0l-4.402-4.403a10.426 10.426 0 001.78-1.857l4.442 4.44c.243.243.376.567.376.91 0 .345-.133.668-.376.91M21.742 30.07c-4.592 0-8.327-3.737-8.327-8.327 0-4.592 3.735-8.327 8.327-8.327 4.591 0 8.327 3.735 8.327 8.327 0 4.59-3.736 8.327-8.327 8.327m14.181.871l-4.8-4.8c.63-1.338.991-2.825.991-4.398 0-5.72-4.653-10.374-10.372-10.374-5.72 0-10.374 4.653-10.374 10.374 0 5.72 4.653 10.372 10.374 10.372 1.717 0 3.333-.426 4.76-1.168l4.708 4.708a3.312 3.312 0 002.357.976c.89 0 1.727-.348 2.356-.976a3.339 3.339 0 000-4.714\" />\n );\n\n const xSmallHover = (\n <path d=\"M34.7 34.43c-.486.485-1.338.487-1.823 0l-3.388-3.39c.663-.55 1.255-1.18 1.785-1.859l3.426 3.424c.244.242.377.567.377.911 0 .346-.133.669-.377.914m-12.76-2.994c-5.238 0-9.5-4.26-9.5-9.499 0-5.238 4.262-9.499 9.5-9.499 5.237 0 9.498 4.261 9.498 9.5 0 5.237-4.26 9.498-9.499 9.498m14.21-.28l-3.734-3.736a11.744 11.744 0 001.356-5.483c0-6.524-5.31-11.832-11.832-11.832-6.524 0-11.834 5.308-11.834 11.832 0 6.525 5.31 11.834 11.834 11.834 2.12 0 4.108-.57 5.831-1.55l3.656 3.658c.633.63 1.47.979 2.362.979.893 0 1.732-.348 2.36-.98.632-.63.98-1.467.98-2.362 0-.89-.348-1.73-.98-2.36\" />\n );\n\n const xxSmall = (\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M20.1738 6.88672C27.4533 6.88672 33.3765 12.8075 33.377 20.0879C33.377 22.0407 32.934 23.8871 32.1699 25.5547L38.0918 31.4785C39.7973 33.1852 39.7973 35.9613 38.0918 37.668C37.2652 38.4933 36.1671 38.9509 34.998 38.9512C33.8287 38.9512 32.7281 38.4937 31.9023 37.668L26.1016 31.8672C24.3175 32.7694 22.3071 33.291 20.1738 33.291C12.8934 33.2906 6.97266 27.3673 6.97266 20.0879C6.97311 12.8077 12.8937 6.88717 20.1738 6.88672ZM33.9766 35.8223C34.0595 35.8891 34.1486 35.9464 34.2422 35.9941L34.1055 35.9141C34.0613 35.8856 34.0179 35.8555 33.9766 35.8223ZM30.5879 28.166C30.0088 28.9128 29.3558 29.5973 28.6309 30.2051L34 35.5742C34.5316 36.105 35.4668 36.1054 35.998 35.5742C36.2647 35.3076 36.4102 34.9522 36.4102 34.5742C36.4099 34.1967 36.264 33.8424 35.998 33.5762L30.5879 28.166ZM12.3984 30.5039C12.4725 30.5593 12.5498 30.6102 12.625 30.6641C12.3803 30.4889 12.1399 30.3085 11.9082 30.1172L12.3984 30.5039ZM20.1758 9.85156C14.5314 9.85197 9.93993 14.4435 9.93945 20.0879C9.93945 25.7316 14.5311 30.3258 20.1758 30.3262C25.8208 30.3262 30.4141 25.7318 30.4141 20.0879C30.4136 14.4432 25.8205 9.85156 20.1758 9.85156ZM24.2363 29.7051C24.392 29.6391 24.5456 29.5693 24.6973 29.4961C24.3933 29.6428 24.0811 29.7753 23.7617 29.8926L24.2363 29.7051ZM30.4199 18.0801C30.5472 18.7301 30.6152 19.4012 30.6152 20.0879L30.6016 19.5527C30.5761 19.0518 30.5139 18.5601 30.4199 18.0801ZM30.5898 12.3145C30.6024 12.3312 30.6145 12.3484 30.627 12.3652C30.4902 12.1806 30.3492 11.9993 30.2031 11.8223L30.5898 12.3145ZM23.2754 10.1211C24.0922 10.3756 24.8663 10.7276 25.584 11.1641L25.1484 10.9121C24.5564 10.59 23.9293 10.3248 23.2754 10.1211Z\"\n />\n );\n\n const xxSmallHover = (\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M20.0664 5.13281C28.324 5.13306 35.0464 11.8511 35.0469 20.1113C35.0469 22.5634 34.442 24.8729 33.3926 26.918L37.957 31.4863C38.7823 32.3116 39.2383 33.4111 39.2383 34.5762C39.2382 35.7464 38.7821 36.8427 37.957 37.668C37.1342 38.4934 36.0347 38.9492 34.8672 38.9492C33.6999 38.9491 32.6029 38.4943 31.7754 37.6699L27.3105 33.2031C25.1607 34.3979 22.6954 35.0956 20.0664 35.0957C11.806 35.0954 5.08398 28.3719 5.08398 20.1113C5.08443 11.8511 11.8063 5.13314 20.0664 5.13281ZM31.7402 29.459C31.1525 30.1928 30.5023 30.8761 29.7871 31.4902L33.8711 35.5762C34.3983 36.1051 35.3349 36.1032 35.8633 35.5762C36.1311 35.3083 36.2772 34.9554 36.2773 34.5762C36.2773 34.1993 36.132 33.8448 35.8652 33.5801L31.7402 29.459ZM26.5273 33.3926C25.4214 33.9344 24.2397 34.3442 23.002 34.5977C23.3028 34.5361 23.6006 34.4664 23.8945 34.3867C25.1149 34.0558 26.2734 33.5714 27.3496 32.959C27.0807 33.112 26.8062 33.256 26.5273 33.3926ZM38.0957 31.9355C38.3575 32.2543 38.5693 32.6057 38.7246 32.9805C38.5174 32.4804 38.2105 32.0211 37.8164 31.627L38.0957 31.9355ZM20.0664 8.44531C13.6343 8.44564 8.40039 13.6791 8.40039 20.1113C8.40058 26.5434 13.6344 31.777 20.0664 31.7773C26.4984 31.777 31.7322 26.5434 31.7324 20.1113C31.7324 13.6791 26.4985 8.44568 20.0664 8.44531ZM17.6777 8.48633C16.327 8.76346 15.0598 9.27215 13.918 9.9668C14.7339 9.47055 15.6142 9.07065 16.543 8.78125C16.9139 8.66566 17.2923 8.56542 17.6777 8.48633ZM22.4551 8.48828C22.6482 8.52791 22.8397 8.57217 23.0293 8.62109C22.6501 8.52325 22.2639 8.443 21.8711 8.38281L22.4551 8.48828ZM20.0664 8.24609C19.6577 8.24609 19.2537 8.2661 18.8555 8.30664L19.457 8.26172C19.6589 8.25145 19.862 8.2461 20.0664 8.24609Z\"\n />\n );\n\n return getIcon({ size, isHovered, normal, normalHover, xSmall, xSmallHover, xxSmall, xxSmallHover });\n};\n\nexport default Search;\n"],"mappings":";;AAIA,IAAMA,UAAkC,EAAE,MAAM,gBAAkD;AAiChG,QAAO,QAAQ;EAAE;EAAM;EAAW,QA/BhC,oBAAC,QAAA,EAAK,GAAE,skBAAA,CAAukB;EA+BviB,aA3BxC,oBAAC,QAAA,EAAK,GAAE,keAAA,CAAme;EA2Btb,QAvBrD,oBAAC,QAAA,EAAK,GAAE,+iBAAA,CAAgjB;EAuB3f,aAnB7D,oBAAC,QAAA,EAAK,GAAE,qkBAAA,CAAskB;EAmBpgB,SAf1E,oBAAC,QAAA;GACC,aAAU;GACV,aAAU;GACV,GAAE;IACF;EAWiF,cAPnF,oBAAC,QAAA;GACC,aAAU;GACV,aAAU;GACV,GAAE;IACF;EAG+F,CAAC;;AAGtG,IAAA,iBAAe"}
package/lib/Select.js CHANGED
@@ -6,7 +6,7 @@ import { t as getAriaDescribedBy } from "./accessibility.js";
6
6
  import { t as ErrorWrapper_default } from "./ErrorWrapper.js";
7
7
  import { n as renderLabel } from "./utils2.js";
8
8
  import { t as ChevronDown_default } from "./ChevronDown.js";
9
- import classNames from "classnames";
9
+ import cn from "classnames";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import selectStyles from "./components/Select/styles.module.scss";
12
12
  var getSelectMaxWidth = (characters) => {
@@ -16,24 +16,24 @@ var getIconColor = (invalid, disabled) => {
16
16
  return disabled ? getColor("neutral", 500) : getColor(invalid ? "cherry" : "blueberry", 600);
17
17
  };
18
18
  const Select = (props) => {
19
- const { className, children, concept = "normal", disabled, error, errorText, errorTextId: errorTextIdProp, selectId: selectIdProp, errorWrapperClassName, label, name = props.selectId, onColor = FormOnColor.onwhite, testId, width, required, value, defaultValue, autoComplete = "off", wrapperClassName, ref, ...rest } = props;
19
+ const { className, children, concept = "normal", disabled, error, errorText, errorTextId: errorTextIdProp, selectId: selectIdProp, errorWrapperClassName, label, name = props.selectId, onColor = FormOnColor.onwhite, testId, width, required, value, defaultValue, autoComplete = "off", wrapperClassName, ref, labelClassName, ...rest } = props;
20
20
  const selectId = useIdWithFallback(selectIdProp);
21
21
  const errorTextId = useIdWithFallback(errorTextIdProp);
22
22
  const onBlueberry = onColor === "onblueberry";
23
23
  const invalid = onColor === "oninvalid" || !!errorText || !!error;
24
24
  const iconColor = getIconColor(invalid, !!disabled);
25
25
  const maxWidth = width ? getSelectMaxWidth(width) : void 0;
26
- const selectInnerWrapperClasses = classNames(selectStyles["select-inner-wrapper"], {
26
+ const selectInnerWrapperClasses = cn(selectStyles["select-inner-wrapper"], {
27
27
  [selectStyles["select-inner-wrapper--transparent"]]: concept === "transparent",
28
28
  [selectStyles["select-inner-wrapper--on-blueberry"]]: onBlueberry,
29
29
  [selectStyles["select-inner-wrapper--invalid"]]: invalid,
30
30
  [selectStyles["select-inner-wrapper--disabled"]]: disabled
31
31
  }, className);
32
- const selectClasses = classNames(selectStyles.select, {
32
+ const selectClasses = cn(selectStyles.select, {
33
33
  [selectStyles["select--on-blueberry"]]: onBlueberry,
34
34
  [selectStyles["select--invalid"]]: invalid
35
35
  });
36
- const selectWrapperClasses = classNames(selectStyles["select-wrapper"], wrapperClassName);
36
+ const selectWrapperClasses = cn(selectStyles["select-wrapper"], wrapperClassName);
37
37
  return /* @__PURE__ */ jsx(ErrorWrapper_default, {
38
38
  className: errorWrapperClassName,
39
39
  errorText,
@@ -46,7 +46,8 @@ const Select = (props) => {
46
46
  children: [renderLabel({
47
47
  label,
48
48
  inputId: selectId,
49
- onColor
49
+ onColor,
50
+ className: labelClassName
50
51
  }), /* @__PURE__ */ jsxs("div", {
51
52
  className: selectInnerWrapperClasses,
52
53
  "data-testid": testId + "-inner-wrapper",
package/lib/Select.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":["Select: React.FC<SelectProps>"],"sources":["../src/components/Select/Select.tsx","../src/components/Select/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport type { ErrorWrapperClassNameProps } from '../ErrorWrapper';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor, IconSize } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\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/utils';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends\n ErrorWrapperClassNameProps,\n 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 onColor?: keyof typeof FormOnColor;\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 /** Ref passed to the select element */\n ref?: React.Ref<HTMLSelectElement | null>;\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): string => {\n const iconColor = invalid ? 'cherry' : 'blueberry';\n return disabled ? getColor('neutral', 500) : getColor(iconColor, 600);\n};\n\nexport const Select: React.FC<SelectProps> = props => {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n selectId: selectIdProp,\n errorWrapperClassName,\n label,\n name = props.selectId,\n onColor = FormOnColor.onwhite,\n testId,\n width,\n required,\n value,\n defaultValue,\n autoComplete = 'off',\n wrapperClassName,\n ref,\n ...rest\n } = props;\n\n const selectId = useIdWithFallback(selectIdProp);\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const onBlueberry = onColor === 'onblueberry';\n const invalid = onColor === '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 className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Select} className={selectWrapperClasses} style={{ maxWidth }}>\n {renderLabel({ label: label, inputId: selectId, onColor: onColor as FormOnColor })}\n <div className={selectInnerWrapperClasses} data-testid={testId + '-inner-wrapper'}>\n <Icon\n className={selectStyles['select-arrow']}\n svgIcon={ChevronDown}\n color={iconColor}\n size={IconSize.XSmall}\n testId={testId + '-icon'}\n />\n <select\n {...rest}\n aria-invalid={!!invalid}\n id={selectId}\n name={name}\n className={selectClasses}\n disabled={disabled}\n ref={ref}\n required={required}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n aria-required={!!required}\n value={value}\n defaultValue={defaultValue}\n autoComplete={autoComplete ? autoComplete : undefined}\n >\n {children}\n </select>\n </div>\n </div>\n </ErrorWrapper>\n );\n};\n\nexport default Select;\n","import Select from './Select';\nexport * from './Select';\nexport default Select;\n"],"mappings":";;;;;;;;;;;AAsDA,IAAM,qBAAqB,eAA+B;AAGxD,QAAO,QAAQ,aAAA,GAAwC;;AAGzD,IAAM,gBAAgB,SAAkB,aAA8B;AAEpE,QAAO,WAAW,SAAS,WAAW,IAAI,GAAG,SAD3B,UAAU,WAAW,aAC0B,IAAI;;AAGvE,MAAaA,UAAgC,UAAS;CACpD,MAAM,EACJ,WACA,UACA,UAAU,UACV,UACA,OACA,WACA,aAAa,iBACb,UAAU,cACV,uBACA,OACA,OAAO,MAAM,UACb,UAAU,YAAY,SACtB,QACA,OACA,UACA,OACA,cACA,eAAe,OACf,kBACA,KACA,GAAG,SACD;CAEJ,MAAM,WAAW,kBAAkB,aAAa;CAChD,MAAM,cAAc,kBAAkB,gBAAgB;CACtD,MAAM,cAAc,YAAY;CAChC,MAAM,UAAU,YAAY,eAAe,CAAC,CAAC,aAAa,CAAC,CAAC;CAC5D,MAAM,YAAY,aAAa,SAAS,CAAC,CAAC,SAAS;CACnD,MAAM,WAAW,QAAQ,kBAAkB,MAAM,GAAG,KAAA;CAEpD,MAAM,4BAA4B,WAChC,aAAa,yBACb;GACG,aAAa,uCAAuC,YAAY;GAChE,aAAa,wCAAwC;GACrD,aAAa,mCAAmC;GAChD,aAAa,oCAAoC;EACnD,EACD,UACD;CAED,MAAM,gBAAgB,WAAW,aAAa,QAAQ;GACnD,aAAa,0BAA0B;GACvC,aAAa,qBAAqB;EACpC,CAAC;CAEF,MAAM,uBAAuB,WAAW,aAAa,mBAAmB,iBAAiB;AAEzF,QACE,oBAAC,sBAAA;EAAa,WAAW;EAAkC;EAAwB;YACjF,qBAAC,OAAA;GAAI,eAAa;GAAQ,oBAAkB,YAAY;GAAQ,WAAW;GAAsB,OAAO,EAAE,UAAU;cACjH,YAAY;IAAS;IAAO,SAAS;IAAmB;IAAwB,CAAC,EAClF,qBAAC,OAAA;IAAI,WAAW;IAA2B,eAAa,SAAS;eAC/D,oBAAC,cAAA;KACC,WAAW,aAAa;KACxB,SAAS;KACT,OAAO;KACP,MAAM,SAAS;KACf,QAAQ,SAAS;MACjB,EACF,oBAAC,UAAA;KACC,GAAI;KACJ,gBAAc,CAAC,CAAC;KAChB,IAAI;KACE;KACN,WAAW;KACD;KACL;KACK;KACV,oBAAkB,mBAAmB,OAAO,YAAY;KACxD,iBAAe,CAAC,CAAC;KACV;KACO;KACd,cAAc,eAAe,eAAe,KAAA;KAE3C;MACM,CAAA;KACL,CAAA;IACF;GACO;;AChJnB,IAAA,mBDoJe"}
1
+ {"version":3,"file":"Select.js","names":["Select: React.FC<SelectProps>"],"sources":["../src/components/Select/Select.tsx","../src/components/Select/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport type { ErrorWrapperClassNameProps } from '../ErrorWrapper';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor, IconSize } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\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/utils';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends\n ErrorWrapperClassNameProps,\n 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 /** Adds custom classes to the label wrapper */\n labelClassName?: string;\n /** Changes the visuals of the component */\n onColor?: keyof typeof FormOnColor;\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 /** Ref passed to the select element */\n ref?: React.Ref<HTMLSelectElement | null>;\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): string => {\n const iconColor = invalid ? 'cherry' : 'blueberry';\n return disabled ? getColor('neutral', 500) : getColor(iconColor, 600);\n};\n\nexport const Select: React.FC<SelectProps> = props => {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n selectId: selectIdProp,\n errorWrapperClassName,\n label,\n name = props.selectId,\n onColor = FormOnColor.onwhite,\n testId,\n width,\n required,\n value,\n defaultValue,\n autoComplete = 'off',\n wrapperClassName,\n ref,\n labelClassName,\n ...rest\n } = props;\n\n const selectId = useIdWithFallback(selectIdProp);\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const onBlueberry = onColor === 'onblueberry';\n const invalid = onColor === '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 className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Select} className={selectWrapperClasses} style={{ maxWidth }}>\n {renderLabel({ label: label, inputId: selectId, onColor: onColor as FormOnColor, className: labelClassName })}\n <div className={selectInnerWrapperClasses} data-testid={testId + '-inner-wrapper'}>\n <Icon\n className={selectStyles['select-arrow']}\n svgIcon={ChevronDown}\n color={iconColor}\n size={IconSize.XSmall}\n testId={testId + '-icon'}\n />\n <select\n {...rest}\n aria-invalid={!!invalid}\n id={selectId}\n name={name}\n className={selectClasses}\n disabled={disabled}\n ref={ref}\n required={required}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n aria-required={!!required}\n value={value}\n defaultValue={defaultValue}\n autoComplete={autoComplete ? autoComplete : undefined}\n >\n {children}\n </select>\n </div>\n </div>\n </ErrorWrapper>\n );\n};\n\nexport default Select;\n","import Select from './Select';\nexport * from './Select';\nexport default Select;\n"],"mappings":";;;;;;;;;;;AAwDA,IAAM,qBAAqB,eAA+B;AAGxD,QAAO,QAAQ,aAAA,GAAwC;;AAGzD,IAAM,gBAAgB,SAAkB,aAA8B;AAEpE,QAAO,WAAW,SAAS,WAAW,IAAI,GAAG,SAD3B,UAAU,WAAW,aA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BAAmB,OAAO,YAAY;KACxD,iBAAe,CAAC,CAAC;KACV;KACO;KACd,cAAc,eAAe,eAAe,KAAA;KAE3C;MACM,CAAA;KACL,CAAA;IACF;GACO;;ACnJnB,IAAA,mBDuJe"}
@@ -1,5 +1,5 @@
1
1
  import { t as AsChildSlot_default } from "./AsChildSlot.js";
2
- import classNames from "classnames";
2
+ import cn from "classnames";
3
3
  import React, { useId } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  import styles from "./components/Dropdown/SingleSelect/styles.module.scss";
@@ -21,8 +21,8 @@ const SingleSelectItem = (props) => {
21
21
  group,
22
22
  optionValue
23
23
  ]);
24
- const contentClasses = classNames(styles["single-select-item__content"], { [styles["single-select-item__content--disabled"]]: isDisabled });
25
- const dotClasses = classNames(styles["single-select-item__dot"], {
24
+ const contentClasses = cn(styles["single-select-item__content"], { [styles["single-select-item__content--disabled"]]: isDisabled });
25
+ const dotClasses = cn(styles["single-select-item__dot"], {
26
26
  [styles["single-select-item__dot--disabled"]]: isDisabled,
27
27
  [styles["single-select-item__dot--checked"]]: isSelected
28
28
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SingleSelectItem.js","names":["SingleSelectItem: React.FC<SingleSelectItemProps>"],"sources":["../src/components/Dropdown/SingleSelect/utils.tsx","../src/components/Dropdown/SingleSelect/SingleSelectItem.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { SingleSelectContextType } from './SingleSelect';\n\nexport const SingleSelectContext = React.createContext<SingleSelectContextType | null>(null);\n\nexport const useSingleSelect = (): SingleSelectContextType | null => React.useContext(SingleSelectContext);\n","import React, { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { AsChildSlotHandle } from '../../AsChildSlot';\n\nimport { useSingleSelect } from './utils';\nimport AsChildSlot from '../../AsChildSlot';\n\nimport styles from './styles.module.scss';\n\nexport interface SingleSelectItemProps extends Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, 'disabled'> {\n /** The text to the singleSelectItem */\n text?: string;\n /** input id of the singleSelectItem */\n inputId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** When true, onclick and keyboard events will be passed to the child Button or AnchorLink. */\n asChild?: boolean;\n /** Only use when asChild is set to true and only pass one child */\n children?: React.ReactNode;\n /** Value for this singleSelectItem option - used by the parent wrapper to keep track of the context */\n value?: string;\n /** aria-describedby passthrough if needed */\n ['aria-describedby']?: string;\n /** Marks this option as initially selected */\n defaultSelected?: boolean;\n /** Ref that is passed to the component */\n ref?: React.Ref<HTMLElement | null>;\n}\n\nexport const SingleSelectItem: React.FC<SingleSelectItemProps> = props => {\n const { text, value, testId, asChild = false, children, disabled, defaultSelected, ref, ...rest } = props;\n\n const generatedId = useId();\n const inputId = props.inputId ?? generatedId;\n const group = useSingleSelect();\n const optionValue = typeof value === 'string' && value.length > 0 ? value : inputId;\n const isSelected = group ? group.value === optionValue : false;\n const isDisabled = !!disabled || !!group?.disabled;\n const asChildSlotRef = React.useRef<AsChildSlotHandle | null>(null);\n\n React.useEffect(() => {\n if (defaultSelected && group && typeof group.value === 'undefined') {\n group.onValueChange?.(optionValue);\n }\n }, [defaultSelected, group, optionValue]);\n\n const contentClasses = classNames(styles['single-select-item__content'], {\n [styles['single-select-item__content--disabled']]: isDisabled,\n });\n const dotClasses = classNames(styles['single-select-item__dot'], {\n [styles['single-select-item__dot--disabled']]: isDisabled,\n [styles['single-select-item__dot--checked']]: isSelected,\n });\n\n const childArray = React.Children.toArray(children).filter(React.isValidElement) as React.ReactElement[];\n const childElement = childArray[0] ?? null;\n\n const selectThis = (e?: React.SyntheticEvent): void => {\n if (isDisabled) return;\n if (group && group.value !== optionValue) {\n group.onValueChange?.(optionValue, e);\n }\n };\n\n const content = (\n <>\n <span className={dotClasses} aria-hidden />\n <span>{text}</span>\n </>\n );\n\n const Component = (asChild ? AsChildSlot : 'button') as React.ElementType;\n const childWithInjectedContent = childElement ? React.cloneElement(childElement, undefined, content) : null;\n\n const componentProps = asChild\n ? {\n ref: asChildSlotRef,\n elementRef: ref,\n className: contentClasses,\n disabled: isDisabled,\n onSelect: (e: React.SyntheticEvent): void => selectThis(e),\n ariaCurrent: isSelected ? 'true' : undefined,\n children: childWithInjectedContent,\n }\n : {\n ...rest,\n type: 'button' as const,\n className: contentClasses,\n disabled: isDisabled,\n onClick: (e: React.MouseEvent<HTMLButtonElement>): void => {\n e.preventDefault();\n selectThis(e);\n },\n onKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (e.key === 'Enter') {\n e.preventDefault();\n selectThis(e);\n }\n },\n ref: ref,\n 'aria-disabled': isDisabled || undefined,\n 'aria-current': isSelected ? 'true' : undefined,\n children: content,\n };\n\n return (\n <div data-testid={testId} className={styles['single-select-item']}>\n <Component {...componentProps} />\n </div>\n );\n};\n\nSingleSelectItem.displayName = 'Dropdown.SingleSelectItem';\n\nexport default SingleSelectItem;\n"],"mappings":";;;;;AAIA,MAAa,sBAAsB,MAAM,cAA8C,KAAK;AAE5F,MAAa,wBAAwD,MAAM,WAAW,oBAAoB;AC0B1G,MAAaA,oBAAoD,UAAS;CACxE,MAAM,EAAE,MAAM,OAAO,QAAQ,UAAU,OAAO,UAAU,UAAU,iBAAiB,KAAK,GAAG,SAAS;CAEpG,MAAM,cAAc,OAAO;CAC3B,MAAM,UAAU,MAAM,WAAW;CACjC,MAAM,QAAQ,iBAAiB;CAC/B,MAAM,cAAc,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ;CAC5E,MAAM,aAAa,QAAQ,MAAM,UAAU,cAAc;CACzD,MAAM,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO;CAC1C,MAAM,iBAAiB,MAAM,OAAiC,KAAK;AAEnE,OAAM,gBAAgB;AACpB,MAAI,mBAAmB,SAAS,OAAO,MAAM,UAAU,YACrD,OAAM,gBAAgB,YAAY;IAEnC;EAAC;EAAiB;EAAO;EAAY,CAAC;CAEzC,MAAM,iBAAiB,WAAW,OAAO,gCAAgC,GACtE,OA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own/SingleSelect/utils.tsx","../src/components/Dropdown/SingleSelect/SingleSelectItem.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { SingleSelectContextType } from './SingleSelect';\n\nexport const SingleSelectContext = React.createContext<SingleSelectContextType | null>(null);\n\nexport const useSingleSelect = (): SingleSelectContextType | null => React.useContext(SingleSelectContext);\n","import React, { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { AsChildSlotHandle } from '../../AsChildSlot';\n\nimport { useSingleSelect } from './utils';\nimport AsChildSlot from '../../AsChildSlot';\n\nimport styles from './styles.module.scss';\n\nexport interface SingleSelectItemProps extends Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, 'disabled'> {\n /** The text to the singleSelectItem */\n text?: string;\n /** input id of the singleSelectItem */\n inputId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** When true, onclick and keyboard events will be passed to the child Button or AnchorLink. */\n asChild?: boolean;\n /** Only use when asChild is set to true and only pass one child */\n children?: React.ReactNode;\n /** Value for this singleSelectItem option - used by the parent wrapper to keep track of the context */\n value?: string;\n /** aria-describedby passthrough if needed */\n ['aria-describedby']?: string;\n /** Marks this option as initially selected */\n defaultSelected?: boolean;\n /** Ref that is passed to the component */\n ref?: React.Ref<HTMLElement | null>;\n}\n\nexport const SingleSelectItem: React.FC<SingleSelectItemProps> = props => {\n const { text, value, testId, asChild = false, children, disabled, defaultSelected, ref, ...rest } = props;\n\n const generatedId = useId();\n const inputId = props.inputId ?? generatedId;\n const group = useSingleSelect();\n const optionValue = typeof value === 'string' && value.length > 0 ? value : inputId;\n const isSelected = group ? group.value === optionValue : false;\n const isDisabled = !!disabled || !!group?.disabled;\n const asChildSlotRef = React.useRef<AsChildSlotHandle | null>(null);\n\n React.useEffect(() => {\n if (defaultSelected && group && typeof group.value === 'undefined') {\n group.onValueChange?.(optionValue);\n }\n }, [defaultSelected, group, optionValue]);\n\n const contentClasses = classNames(styles['single-select-item__content'], {\n [styles['single-select-item__content--disabled']]: isDisabled,\n });\n const dotClasses = classNames(styles['single-select-item__dot'], {\n [styles['single-select-item__dot--disabled']]: isDisabled,\n [styles['single-select-item__dot--checked']]: isSelected,\n });\n\n const childArray = React.Children.toArray(children).filter(React.isValidElement) as React.ReactElement[];\n const childElement = childArray[0] ?? null;\n\n const selectThis = (e?: React.SyntheticEvent): void => {\n if (isDisabled) return;\n if (group && group.value !== optionValue) {\n group.onValueChange?.(optionValue, e);\n }\n };\n\n const content = (\n <>\n <span className={dotClasses} aria-hidden />\n <span>{text}</span>\n </>\n );\n\n const Component = (asChild ? AsChildSlot : 'button') as React.ElementType;\n const childWithInjectedContent = childElement ? React.cloneElement(childElement, undefined, content) : null;\n\n const componentProps = asChild\n ? {\n ref: asChildSlotRef,\n elementRef: ref,\n className: contentClasses,\n disabled: isDisabled,\n onSelect: (e: React.SyntheticEvent): void => selectThis(e),\n ariaCurrent: isSelected ? 'true' : undefined,\n children: childWithInjectedContent,\n }\n : {\n ...rest,\n type: 'button' as const,\n className: contentClasses,\n disabled: isDisabled,\n onClick: (e: React.MouseEvent<HTMLButtonElement>): void => {\n e.preventDefault();\n selectThis(e);\n },\n onKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (e.key === 'Enter') {\n e.preventDefault();\n selectThis(e);\n }\n },\n ref: ref,\n 'aria-disabled': isDisabled || undefined,\n 'aria-current': isSelected ? 'true' : undefined,\n children: content,\n };\n\n return (\n <div data-testid={testId} className={styles['single-select-item']}>\n <Component {...componentProps} />\n </div>\n );\n};\n\nSingleSelectItem.displayName = 'Dropdown.SingleSelectItem';\n\nexport default SingleSelectItem;\n"],"mappings":";;;;;AAIA,MAAa,sBAAsB,MAAM,cAA8C,KAAK;AAE5F,MAAa,wBAAwD,MAAM,WAAW,oBAAoB;AC0B1G,MAAaA,oBAAoD,UAAS;CACxE,MAAM,EAAE,MAAM,OAAO,QAAQ,UAAU,OAAO,UAAU,UAAU,iBAAiB,KAAK,GAAG,SAAS;CAEpG,MAAM,cAAc,OAAO;C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,gBAAgB;AAClB,cAAW,EAAE;;EAEf,YAAY,MAAoD;AAC9D,OAAI,EAAE,QAAQ,SAAS;AACrB,MAAE,gBAAgB;AAClB,eAAW,EAAE;;;EAGZ;EACL,iBAAiB,cAAc,KAAA;EAC/B,gBAAgB,aAAa,SAAS,KAAA;EACtC,UAAU;EACX;AAEL,QACE,oBAAC,OAAA;EAAI,eAAa;EAAQ,WAAW,OAAO;YAC1C,oBAAC,WAAA,EAAU,GAAI,gBAAA,CAAkB;GAC7B;;AAIV,iBAAiB,cAAc;AAE/B,IAAA,2BAAe"}
package/lib/Slider.js CHANGED
@@ -6,7 +6,7 @@ import { n as getAriaLabelAttributes } from "./accessibility.js";
6
6
  import { t as ErrorWrapper_default } from "./ErrorWrapper.js";
7
7
  import { t as useSize } from "./useSize.js";
8
8
  import { t as Title_default } from "./Title2.js";
9
- import classNames from "classnames";
9
+ import cn from "classnames";
10
10
  import { useEffect, useId, useRef, useState } from "react";
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
12
  import styles from "./components/Slider/styles.module.scss";
@@ -238,13 +238,13 @@ const Slider = (props) => {
238
238
  renderEmojies(),
239
239
  /* @__PURE__ */ jsxs("div", {
240
240
  ref: trackRef,
241
- className: classNames(styles["slider__track-wrapper"], disabled && styles["slider__track-wrapper--disabled"]),
241
+ className: cn(styles["slider__track-wrapper"], disabled && styles["slider__track-wrapper--disabled"]),
242
242
  onPointerDown: handlePointerDown,
243
243
  children: [/* @__PURE__ */ jsx("div", {
244
- className: classNames(styles.slider__track, disabled && styles["slider__track--disabled"]),
244
+ className: cn(styles.slider__track, disabled && styles["slider__track--disabled"]),
245
245
  children: renderSteps()
246
246
  }), /* @__PURE__ */ jsx("div", {
247
- className: classNames(styles.slider__marker, {
247
+ className: cn(styles.slider__marker, {
248
248
  [styles["slider__marker--disabled"]]: disabled,
249
249
  [styles["slider__marker--selected"]]: selectedState,
250
250
  [styles["slider__marker--invalid"]]: invalid,
package/lib/Slider.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","names":["Slider: React.FC<SliderProps>","handleKeyDown: React.KeyboardEventHandler<HTMLDivElement>","handleTrackClick: React.MouseEventHandler<HTMLDivElement>","handlePointerDown: React.PointerEventHandler<HTMLDivElement>"],"sources":["../src/components/Slider/Slider.tsx","../src/components/Slider/index.ts"],"sourcesContent":["import { useEffect, useState, useRef, useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { ErrorWrapperClassNameProps } from '../ErrorWrapper';\n\nimport { AnalyticsId } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { useSize } from '../../hooks/useSize';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { isMutableRefObject, mergeRefs } from '../../utils/refs';\nimport ErrorWrapper from '../ErrorWrapper';\nimport Title from '../Title';\n\nimport styles from './styles.module.scss';\n\nconst useSafeNumberValue = (initial: number, min: number, max: number): [number, (value: number) => void] => {\n const [value, setValue] = useState(initial);\n const [prevMin, setPrevMin] = useState(min);\n const [prevMax, setPrevMax] = useState(max);\n\n const getSafeValue = (newValue: number): number => {\n if (newValue > max) {\n return max;\n }\n if (newValue < min) {\n return min;\n }\n return newValue;\n };\n\n const setSafeValue = (newValue: number): void => {\n setValue(getSafeValue(newValue));\n };\n\n if (min !== prevMin || max !== prevMax) {\n setPrevMin(min);\n setPrevMax(max);\n const safeValue = getSafeValue(initial);\n if (safeValue !== value) {\n setValue(safeValue);\n }\n }\n\n return [value, setSafeValue];\n};\n\nexport type SliderStep = {\n label?: number | string;\n emojiUniCode?: string;\n};\n\nexport interface SliderProps\n extends ErrorWrapperClassNameProps, Pick<React.InputHTMLAttributes<HTMLInputElement>, 'id' | 'name' | 'onChange' | 'onBlur'> {\n /** Activates Error style for the input */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /**\tSets the title of the slider. */\n title?: string;\n /** Adds the left hand label to the element. */\n labelLeft?: string;\n /** Adds the right hand label to the element. */\n labelRight?: string;\n /**\tSets aria-label of the slider. */\n ariaLabel?: string;\n /** Disables the slider element. */\n disabled?: boolean;\n /** Sets the minimum allowed value on the slider - this overrides the use of steps prop for minValue/maxValue. */\n minValue?: number;\n /** Sets the maximum allowed value on the slider - this overrides the use of steps prop for minValue/maxValue. */\n maxValue?: number;\n /** If set to false will only trigger onChange once a user interaction has been made, updates to this prop will be taken into account - true by default */\n selected?: boolean;\n /** Sets the steps data for the slider */\n steps?: SliderStep[];\n /** Sets the step to move per point in the slider */\n step?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the value of the slider */\n value?: number;\n /** Ref passed to component */\n ref?: React.Ref<HTMLInputElement | null>;\n}\n\nexport const Slider: React.FC<SliderProps> = props => {\n const {\n title,\n ariaLabel,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n labelLeft,\n labelRight,\n disabled = false,\n onChange,\n steps,\n step = 1,\n minValue = 0,\n maxValue = steps ? steps.length - 1 : 100,\n selected = true,\n testId,\n value,\n ref,\n ...rest\n } = props;\n\n const [isMoving, setIsMoving] = useState(false);\n const [selectedState, setSelectedState] = useState(typeof value === 'undefined' ? selected : true);\n const [valueState, setValueState] = useSafeNumberValue(\n typeof value === 'undefined' ? (maxValue - minValue) / 2 + minValue : value,\n minValue,\n maxValue\n );\n\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const baseId = useId();\n const titleId = 'title-' + baseId;\n const labelLeftId = 'label-' + baseId;\n const labelRightId = 'label-right-' + baseId;\n const trackRef = useRef<HTMLDivElement>(null);\n const { refObject, isFocused } = usePseudoClasses<HTMLInputElement>(isMutableRefObject(ref) ? ref : null);\n const mergedRefs = mergeRefs([ref, refObject]);\n\n const { width: trackWidth } = useSize(trackRef) || { width: 0 };\n const largeStep = maxValue / 10;\n const invalid = !!errorText || !!error;\n\n useEffect(() => {\n const handlePointerUp = (): void => {\n setIsMoving(false);\n };\n\n document.addEventListener('pointerup', handlePointerUp);\n\n return (): void => {\n document.removeEventListener('pointerup', handlePointerUp);\n };\n }, []);\n\n const getValueBasedOnMarkerPosition = (markerPosition: number): number => {\n const trackPosition = trackRef.current?.getBoundingClientRect().x ?? 0;\n\n // Calculate the normalized position (0 to 1) of the marker along the track\n const normalizedPosition = (markerPosition - trackPosition) / trackWidth;\n const valueRange = maxValue - minValue;\n // Calculate the value without considering the step\n let value = normalizedPosition * valueRange + minValue;\n // Adjust the value to account for the step increment\n const stepCount = Math.round(value / step);\n value = stepCount * step;\n value = Math.max(minValue, Math.min(maxValue, value));\n\n return value;\n };\n\n useEffect(() => {\n const handlePointerMove = (e: PointerEvent): void => {\n if (!disabled && isMoving) {\n const newValue = getValueBasedOnMarkerPosition(e.clientX);\n setValueState(newValue);\n }\n };\n\n document.addEventListener('pointermove', handlePointerMove);\n\n return (): void => {\n document.removeEventListener('pointermove', handlePointerMove);\n };\n }, [isMoving]);\n\n useEffect(() => {\n if (value !== valueState && typeof value !== 'undefined') {\n handleSelected();\n setValueState(value);\n }\n }, [value]);\n\n useEffect(() => {\n if (typeof value === 'undefined' && selected !== selectedState) {\n setSelectedState(selected);\n }\n }, [selected]);\n\n const handleSelected = (): void => {\n if (selectedState === false) {\n setSelectedState(true);\n }\n };\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n let flag = false;\n\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n setValueState(valueState - step);\n flag = true;\n break;\n case 'PageDown':\n setValueState(valueState - largeStep);\n flag = true;\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n setValueState(valueState + step);\n flag = true;\n break;\n case 'PageUp':\n setValueState(valueState + largeStep);\n flag = true;\n break;\n case 'Home':\n setValueState(minValue);\n flag = true;\n break;\n case 'End':\n setValueState(maxValue);\n flag = true;\n break;\n default:\n break;\n }\n\n if (flag) {\n handleSelected();\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleTrackClick: React.MouseEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n const newValue = getValueBasedOnMarkerPosition(e.clientX);\n setValueState(newValue);\n refObject.current?.focus();\n };\n\n const handlePointerDown: React.PointerEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n handleTrackClick(e);\n setIsMoving(true);\n handleSelected();\n\n e.preventDefault();\n e.stopPropagation();\n\n refObject.current?.focus();\n };\n\n const markerXPos = maxValue !== minValue ? (trackWidth / (maxValue - minValue)) * (valueState - minValue) : 0;\n\n const getAriaValueText = (): string | undefined => {\n const stepIndex = steps ? Math.round((valueState - minValue) / step) : null;\n\n if (steps && stepIndex !== null && stepIndex >= 0 && stepIndex < steps.length) {\n const step = steps[stepIndex];\n const emojiCode = step.emojiUniCode;\n const label = typeof step.label !== 'undefined' ? step.label.toString() : undefined;\n\n return emojiCode && label ? `${emojiCode} ${label}` : emojiCode || label;\n }\n\n return undefined;\n };\n\n const getAriaLabeledById = (): string | undefined => {\n if (title && labelLeft && labelRight) {\n return [titleId, labelLeftId, labelRightId].join(' ');\n }\n if (title && labelLeft) {\n return [titleId, labelLeftId].join(' ');\n }\n if (title && labelRight) {\n return [titleId, labelRightId].join(' ');\n }\n if (title) {\n return titleId;\n }\n };\n\n const ariaLabelAttributes = getAriaLabelAttributes({\n label: ariaLabel,\n id: getAriaLabeledById(),\n prefer: 'label',\n });\n\n const getXPositionStyling = (index: number, stepsLength: number): { left: string } => {\n return { left: `${(index / (stepsLength - 1)) * 100}%` };\n };\n\n useEffect(() => {\n if (selectedState && onChange) {\n onChange({\n target: {\n name: props.name,\n value: valueState,\n },\n } as unknown as React.ChangeEvent<HTMLInputElement>);\n }\n }, [valueState, selectedState]);\n\n const renderEmojies = (): React.ReactNode => {\n return (\n <div className={styles['slider__emoji-container']}>\n {steps?.map((step, index) => {\n return (\n step.emojiUniCode && (\n <div\n aria-hidden={true}\n key={'emoji' + index}\n className={styles['slider__emoji']}\n style={getXPositionStyling(index, steps.length)}\n >\n {step.emojiUniCode}\n </div>\n )\n );\n })}\n </div>\n );\n };\n\n const renderSteps = (): React.ReactNode => {\n return steps?.map((_step, index) => {\n return <div key={'step' + index} className={styles['slider__track__step']} style={getXPositionStyling(index, steps.length)} />;\n });\n };\n\n const renderStepLabels = (): React.ReactNode => {\n return (\n <div className={styles['slider__value-container']}>\n {steps?.map((step, index) => {\n return (\n typeof step.label !== 'undefined' && (\n <div\n aria-hidden={true}\n key={'label' + index}\n className={styles['slider__value']}\n style={getXPositionStyling(index, steps.length)}\n >\n {step.label}\n </div>\n )\n );\n })}\n </div>\n );\n };\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <input\n aria-valuetext={getAriaValueText()}\n className={styles['sr-only-slider']}\n disabled={disabled}\n min={minValue}\n max={maxValue}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n value={valueState}\n ref={mergedRefs}\n type=\"range\"\n {...rest}\n {...ariaLabelAttributes}\n />\n <div className={styles.slider} data-testid={testId} data-analyticsid={AnalyticsId.Slider}>\n {title && (\n <Title className={styles['slider__title']} htmlMarkup={'h3'} margin={0} appearance={'title3'} id={titleId}>\n {title}\n </Title>\n )}\n <div className={styles['slider__content-container']}>\n {renderEmojies()}\n {/* Slider streken er klikkbar med mus/touch */}\n <div\n ref={trackRef}\n className={classNames(styles['slider__track-wrapper'], disabled && styles['slider__track-wrapper--disabled'])}\n onPointerDown={handlePointerDown}\n >\n <div className={classNames(styles.slider__track, disabled && styles['slider__track--disabled'])}>{renderSteps()}</div>\n <div\n className={classNames(styles.slider__marker, {\n [styles['slider__marker--disabled']]: disabled,\n [styles['slider__marker--selected']]: selectedState,\n [styles['slider__marker--invalid']]: invalid,\n [styles['slider__marker--focused']]: !disabled && isFocused,\n })}\n style={{\n left: `${markerXPos}px`,\n }}\n />\n </div>\n {renderStepLabels()}\n </div>\n {(labelLeft || labelRight) && (\n <span className={styles.slider__options}>\n <span id={labelLeftId}>{labelLeft}</span>\n <span id={labelRightId}>{labelRight}</span>\n </span>\n )}\n </div>\n </ErrorWrapper>\n );\n};\n\nSlider.displayName = 'Slider';\n\nexport default Slider;\n","import Slider from './Slider';\nexport * from './Slider';\nexport default Slider;\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAM,sBAAsB,SAAiB,KAAa,QAAmD;CAC3G,MAAM,CAAC,OAAO,YAAY,SAAS,QAAQ;CAC3C,MAAM,CAAC,SAAS,cAAc,SAAS,IAAI;CAC3C,MAAM,CAAC,SAAS,cAAc,SAAS,IAAI;CAE3C,MAAM,gBAAgB,aAA6B;AACjD,MAAI,WAAW,IACb,QAAO;AAET,MAAI,WAAW,IACb,QAAO;AAET,SAAO;;CAGT,MAAM,gBAAgB,aAA2B;AAC/C,WAAS,aAAa,SAAS,CAAC;;AAGlC,KAAI,QAAQ,WAAW,QAAQ,SAAS;AACtC,aAAW,IAAI;AACf,aAAW,IAAI;EACf,MAAM,YAAY,aAAa,QAAQ;AACvC,MAAI,cAAc,MAChB,UAAS,UAAU;;AAIvB,QAAO,CAAC,OAAO,aAAa;;AA4C9B,MAAaA,UAAgC,UAAS;CACpD,MAAM,EACJ,OACA,WACA,OACA,WACA,aAAa,iBACb,uBACA,WACA,YACA,WAAW,OACX,UACA,OACA,OAAO,GACP,WAAW,GACX,WAAW,QAAQ,MAAM,SAAS,IAAI,KACtC,WAAW,MACX,QACA,OACA,KACA,GAAG,SACD;CAEJ,MAAM,CAAC,UAAU,eAAe,SAAS,MAAM;CAC/C,MAAM,CAAC,eAAe,oBAAoB,SAAS,OAAO,UAAU,cAAc,WAAW,KAAK;CAClG,MAAM,CAAC,YAAY,iBAAiB,mBAClC,OAAO,UAAU,eAAe,WAAW,YAAY,IAAI,WAAW,OACtE,UACA,SACD;CAED,MAAM,cAAc,kBAAkB,gBAAgB;CACtD,MAAM,SAAS,OAAO;CACtB,MAAM,UAAU,WAAW;CAC3B,MAAM,cAAc,WAAW;CAC/B,MAAM,eAAe,iBAAiB;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AO;GACR;GACV,KAAK;GACL,KAAK;GACK;GACV,WAAW;GACX,OAAO;GACP,KAAK;GACL,MAAK;GACL,GAAI;GACJ,GAAI;IACJ,EACF,qBAAC,OAAA;GAAI,WAAW,OAAO;GAAQ,eAAa;GAAQ,oBAAkB,YAAY;;IAC/E,SACC,oBAAC,eAAA;KAAM,WAAW,OAAO;KAAkB,YAAY;KAAM,QAAQ;KAAG,YAAY;KAAU,IAAI;eAC/F;MACK;IAEV,qBAAC,OAAA;KAAI,WAAW,OAAO;;MACpB,eAAe;MAEhB,qBAAC,OAAA;OACC,KAAK;OACL,WAAW,WAAW,OAAO,0BAA0B,YAAY,OAAO,mCAAmC;OAC7G,eAAe;kBAEf,oBAAC,OAAA;QAAI,WAAW,WAAW,OAAO,eAAe,YAAY,OAAO,2BAA2B;kBAAG,aAAa;SAAO,EACtH,oBAAC,OAAA;QACC,WAAW,WAAW,OAAO,gBAAgB;UAC1C,OAAO,8BAA8B;UACrC,OAAO,8BAA8B;UACrC,OAAO,6BAA6B;UACpC,OAAO,6BAA6B,CAAC,YAAY;SACnD,CAAC;QACF,OAAO,EACL,MAAM,GAAG,WAAW,KACrB;SACD,CAAA;QACE;MACL,kBAAkB;;MACf;KACJ,aAAa,eACb,qBAAC,QAAA;KAAK,WAAW,OAAO;gBACtB,oBAAC,QAAA;MAAK,IAAI;gBAAc;OAAiB,EACzC,oBAAC,QAAA;MAAK,IAAI;gBAAe;OAAkB,CAAA;MACtC;;IAEL,CAAA;GACO;;AAInB,OAAO,cAAc;AC7ZrB,IAAA,mBD+Ze"}
1
+ {"version":3,"file":"Slider.js","names":["Slider: React.FC<SliderProps>","handleKeyDown: React.KeyboardEventHandler<HTMLDivElement>","handleTrackClick: React.MouseEventHandler<HTMLDivElement>","handlePointerDown: React.PointerEventHandler<HTMLDivElement>"],"sources":["../src/components/Slider/Slider.tsx","../src/components/Slider/index.ts"],"sourcesContent":["import { useEffect, useState, useRef, useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { ErrorWrapperClassNameProps } from '../ErrorWrapper';\n\nimport { AnalyticsId } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { useSize } from '../../hooks/useSize';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { isMutableRefObject, mergeRefs } from '../../utils/refs';\nimport ErrorWrapper from '../ErrorWrapper';\nimport Title from '../Title';\n\nimport styles from './styles.module.scss';\n\nconst useSafeNumberValue = (initial: number, min: number, max: number): [number, (value: number) => void] => {\n const [value, setValue] = useState(initial);\n const [prevMin, setPrevMin] = useState(min);\n const [prevMax, setPrevMax] = useState(max);\n\n const getSafeValue = (newValue: number): number => {\n if (newValue > max) {\n return max;\n }\n if (newValue < min) {\n return min;\n }\n return newValue;\n };\n\n const setSafeValue = (newValue: number): void => {\n setValue(getSafeValue(newValue));\n };\n\n if (min !== prevMin || max !== prevMax) {\n setPrevMin(min);\n setPrevMax(max);\n const safeValue = getSafeValue(initial);\n if (safeValue !== value) {\n setValue(safeValue);\n }\n }\n\n return [value, setSafeValue];\n};\n\nexport type SliderStep = {\n label?: number | string;\n emojiUniCode?: string;\n};\n\nexport interface SliderProps\n extends ErrorWrapperClassNameProps, Pick<React.InputHTMLAttributes<HTMLInputElement>, 'id' | 'name' | 'onChange' | 'onBlur'> {\n /** Activates Error style for the input */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /**\tSets the title of the slider. */\n title?: string;\n /** Adds the left hand label to the element. */\n labelLeft?: string;\n /** Adds the right hand label to the element. */\n labelRight?: string;\n /**\tSets aria-label of the slider. */\n ariaLabel?: string;\n /** Disables the slider element. */\n disabled?: boolean;\n /** Sets the minimum allowed value on the slider - this overrides the use of steps prop for minValue/maxValue. */\n minValue?: number;\n /** Sets the maximum allowed value on the slider - this overrides the use of steps prop for minValue/maxValue. */\n maxValue?: number;\n /** If set to false will only trigger onChange once a user interaction has been made, updates to this prop will be taken into account - true by default */\n selected?: boolean;\n /** Sets the steps data for the slider */\n steps?: SliderStep[];\n /** Sets the step to move per point in the slider */\n step?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the value of the slider */\n value?: number;\n /** Ref passed to component */\n ref?: React.Ref<HTMLInputElement | null>;\n}\n\nexport const Slider: React.FC<SliderProps> = props => {\n const {\n title,\n ariaLabel,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n labelLeft,\n labelRight,\n disabled = false,\n onChange,\n steps,\n step = 1,\n minValue = 0,\n maxValue = steps ? steps.length - 1 : 100,\n selected = true,\n testId,\n value,\n ref,\n ...rest\n } = props;\n\n const [isMoving, setIsMoving] = useState(false);\n const [selectedState, setSelectedState] = useState(typeof value === 'undefined' ? selected : true);\n const [valueState, setValueState] = useSafeNumberValue(\n typeof value === 'undefined' ? (maxValue - minValue) / 2 + minValue : value,\n minValue,\n maxValue\n );\n\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const baseId = useId();\n const titleId = 'title-' + baseId;\n const labelLeftId = 'label-' + baseId;\n const labelRightId = 'label-right-' + baseId;\n const trackRef = useRef<HTMLDivElement>(null);\n const { refObject, isFocused } = usePseudoClasses<HTMLInputElement>(isMutableRefObject(ref) ? ref : null);\n const mergedRefs = mergeRefs([ref, refObject]);\n\n const { width: trackWidth } = useSize(trackRef) || { width: 0 };\n const largeStep = maxValue / 10;\n const invalid = !!errorText || !!error;\n\n useEffect(() => {\n const handlePointerUp = (): void => {\n setIsMoving(false);\n };\n\n document.addEventListener('pointerup', handlePointerUp);\n\n return (): void => {\n document.removeEventListener('pointerup', handlePointerUp);\n };\n }, []);\n\n const getValueBasedOnMarkerPosition = (markerPosition: number): number => {\n const trackPosition = trackRef.current?.getBoundingClientRect().x ?? 0;\n\n // Calculate the normalized position (0 to 1) of the marker along the track\n const normalizedPosition = (markerPosition - trackPosition) / trackWidth;\n const valueRange = maxValue - minValue;\n // Calculate the value without considering the step\n let value = normalizedPosition * valueRange + minValue;\n // Adjust the value to account for the step increment\n const stepCount = Math.round(value / step);\n value = stepCount * step;\n value = Math.max(minValue, Math.min(maxValue, value));\n\n return value;\n };\n\n useEffect(() => {\n const handlePointerMove = (e: PointerEvent): void => {\n if (!disabled && isMoving) {\n const newValue = getValueBasedOnMarkerPosition(e.clientX);\n setValueState(newValue);\n }\n };\n\n document.addEventListener('pointermove', handlePointerMove);\n\n return (): void => {\n document.removeEventListener('pointermove', handlePointerMove);\n };\n }, [isMoving]);\n\n useEffect(() => {\n if (value !== valueState && typeof value !== 'undefined') {\n handleSelected();\n setValueState(value);\n }\n }, [value]);\n\n useEffect(() => {\n if (typeof value === 'undefined' && selected !== selectedState) {\n setSelectedState(selected);\n }\n }, [selected]);\n\n const handleSelected = (): void => {\n if (selectedState === false) {\n setSelectedState(true);\n }\n };\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n let flag = false;\n\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n setValueState(valueState - step);\n flag = true;\n break;\n case 'PageDown':\n setValueState(valueState - largeStep);\n flag = true;\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n setValueState(valueState + step);\n flag = true;\n break;\n case 'PageUp':\n setValueState(valueState + largeStep);\n flag = true;\n break;\n case 'Home':\n setValueState(minValue);\n flag = true;\n break;\n case 'End':\n setValueState(maxValue);\n flag = true;\n break;\n default:\n break;\n }\n\n if (flag) {\n handleSelected();\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleTrackClick: React.MouseEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n const newValue = getValueBasedOnMarkerPosition(e.clientX);\n setValueState(newValue);\n refObject.current?.focus();\n };\n\n const handlePointerDown: React.PointerEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n handleTrackClick(e);\n setIsMoving(true);\n handleSelected();\n\n e.preventDefault();\n e.stopPropagation();\n\n refObject.current?.focus();\n };\n\n const markerXPos = maxValue !== minValue ? (trackWidth / (maxValue - minValue)) * (valueState - minValue) : 0;\n\n const getAriaValueText = (): string | undefined => {\n const stepIndex = steps ? Math.round((valueState - minValue) / step) : null;\n\n if (steps && stepIndex !== null && stepIndex >= 0 && stepIndex < steps.length) {\n const step = steps[stepIndex];\n const emojiCode = step.emojiUniCode;\n const label = typeof step.label !== 'undefined' ? step.label.toString() : undefined;\n\n return emojiCode && label ? `${emojiCode} ${label}` : emojiCode || label;\n }\n\n return undefined;\n };\n\n const getAriaLabeledById = (): string | undefined => {\n if (title && labelLeft && labelRight) {\n return [titleId, labelLeftId, labelRightId].join(' ');\n }\n if (title && labelLeft) {\n return [titleId, labelLeftId].join(' ');\n }\n if (title && labelRight) {\n return [titleId, labelRightId].join(' ');\n }\n if (title) {\n return titleId;\n }\n };\n\n const ariaLabelAttributes = getAriaLabelAttributes({\n label: ariaLabel,\n id: getAriaLabeledById(),\n prefer: 'label',\n });\n\n const getXPositionStyling = (index: number, stepsLength: number): { left: string } => {\n return { left: `${(index / (stepsLength - 1)) * 100}%` };\n };\n\n useEffect(() => {\n if (selectedState && onChange) {\n onChange({\n target: {\n name: props.name,\n value: valueState,\n },\n } as unknown as React.ChangeEvent<HTMLInputElement>);\n }\n }, [valueState, selectedState]);\n\n const renderEmojies = (): React.ReactNode => {\n return (\n <div className={styles['slider__emoji-container']}>\n {steps?.map((step, index) => {\n return (\n step.emojiUniCode && (\n <div\n aria-hidden={true}\n key={'emoji' + index}\n className={styles['slider__emoji']}\n style={getXPositionStyling(index, steps.length)}\n >\n {step.emojiUniCode}\n </div>\n )\n );\n })}\n </div>\n );\n };\n\n const renderSteps = (): React.ReactNode => {\n return steps?.map((_step, index) => {\n return <div key={'step' + index} className={styles['slider__track__step']} style={getXPositionStyling(index, steps.length)} />;\n });\n };\n\n const renderStepLabels = (): React.ReactNode => {\n return (\n <div className={styles['slider__value-container']}>\n {steps?.map((step, index) => {\n return (\n typeof step.label !== 'undefined' && (\n <div\n aria-hidden={true}\n key={'label' + index}\n className={styles['slider__value']}\n style={getXPositionStyling(index, steps.length)}\n >\n {step.label}\n </div>\n )\n );\n })}\n </div>\n );\n };\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <input\n aria-valuetext={getAriaValueText()}\n className={styles['sr-only-slider']}\n disabled={disabled}\n min={minValue}\n max={maxValue}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n value={valueState}\n ref={mergedRefs}\n type=\"range\"\n {...rest}\n {...ariaLabelAttributes}\n />\n <div className={styles.slider} data-testid={testId} data-analyticsid={AnalyticsId.Slider}>\n {title && (\n <Title className={styles['slider__title']} htmlMarkup={'h3'} margin={0} appearance={'title3'} id={titleId}>\n {title}\n </Title>\n )}\n <div className={styles['slider__content-container']}>\n {renderEmojies()}\n {/* Slider streken er klikkbar med mus/touch */}\n <div\n ref={trackRef}\n className={classNames(styles['slider__track-wrapper'], disabled && styles['slider__track-wrapper--disabled'])}\n onPointerDown={handlePointerDown}\n >\n <div className={classNames(styles.slider__track, disabled && styles['slider__track--disabled'])}>{renderSteps()}</div>\n <div\n className={classNames(styles.slider__marker, {\n [styles['slider__marker--disabled']]: disabled,\n [styles['slider__marker--selected']]: selectedState,\n [styles['slider__marker--invalid']]: invalid,\n [styles['slider__marker--focused']]: !disabled && isFocused,\n })}\n style={{\n left: `${markerXPos}px`,\n }}\n />\n </div>\n {renderStepLabels()}\n </div>\n {(labelLeft || labelRight) && (\n <span className={styles.slider__options}>\n <span id={labelLeftId}>{labelLeft}</span>\n <span id={labelRightId}>{labelRight}</span>\n </span>\n )}\n </div>\n </ErrorWrapper>\n );\n};\n\nSlider.displayName = 'Slider';\n\nexport default Slider;\n","import Slider from './Slider';\nexport * from './Slider';\nexport default Slider;\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAM,sBAAsB,SAAiB,KAAa,QAAmD;CAC3G,MAAM,CAAC,OAAO,YAAY,SAAS,QAAQ;CAC3C,MAAM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I;eAC/F;MACK;IAEV,qBAAC,OAAA;KAAI,WAAW,OAAO;;MACpB,eAAe;MAEhB,qBAAC,OAAA;OACC,KAAK;OACL,WAAW,GAAW,OAAO,0BAA0B,YAAY,OAAO,mCAAmC;OAC7G,eAAe;kBAEf,oBAAC,OAAA;QAAI,WAAW,GAAW,OAAO,eAAe,YAAY,OAAO,2BAA2B;kBAAG,aAAa;SAAO,EACtH,oBAAC,OAAA;QACC,WAAW,GAAW,OAAO,gBAAgB;UAC1C,OAAO,8BAA8B;UACrC,OAAO,8BAA8B;UACrC,OAAO,6BAA6B;UACpC,OAAO,6BAA6B,CAAC,YAAY;SACnD,CAAC;QACF,OAAO,EACL,MAAM,GAAG,WAAW,KACrB;SACD,CAAA;QACE;MACL,kBAAkB;;MACf;KACJ,aAAa,eACb,qBAAC,QAAA;KAAK,WAAW,OAAO;gBACtB,oBAAC,QAAA;MAAK,IAAI;gBAAc;OAAiB,EACzC,oBAAC,QAAA;MAAK,IAAI;gBAAe;OAAkB,CAAA;MACtC;;IAEL,CAAA;GACO;;AAInB,OAAO,cAAc;AC7ZrB,IAAA,mBD+Ze"}
package/lib/Spacer.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { n as AnalyticsId } from "./constants2.js";
2
- import classNames from "classnames";
2
+ import cn from "classnames";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import spacerStyles from "./components/Spacer/styles.module.scss";
5
5
  var Spacer = (props) => {
6
6
  const { size = "s", className, testId, ref } = props;
7
7
  return /* @__PURE__ */ jsx("span", {
8
- className: classNames(spacerStyles.spacer, {
8
+ className: cn(spacerStyles.spacer, {
9
9
  [spacerStyles["spacer--4xs"]]: size === "4xs",
10
10
  [spacerStyles["spacer--3xs"]]: size === "3xs",
11
11
  [spacerStyles["spacer--2xs"]]: size === "2xs",
package/lib/Spacer.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Spacer.js","names":["Spacer: React.FC<SpacerProps>"],"sources":["../src/components/Spacer/Spacer.tsx","../src/components/Spacer/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport type { SpacerSizes } from './../../theme/spacers';\n\nimport { AnalyticsId } from '../../constants';\n\nimport spacerStyles from './styles.module.scss';\n\nexport interface SpacerProps {\n /** Sets the size of the spacer. */\n size?: SpacerSizes;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the component */\n ref?: React.Ref<HTMLElement | null>;\n}\n\nconst Spacer: React.FC<SpacerProps> = (props: SpacerProps) => {\n const { size = 's', className, testId, ref } = props;\n const spacerClasses = classNames(\n spacerStyles.spacer,\n {\n [spacerStyles['spacer--4xs']]: size === '4xs',\n [spacerStyles['spacer--3xs']]: size === '3xs',\n [spacerStyles['spacer--2xs']]: size === '2xs',\n [spacerStyles['spacer--xs']]: size === 'xs',\n [spacerStyles['spacer--s']]: size === 's',\n [spacerStyles['spacer--m']]: size === 'm',\n [spacerStyles['spacer--l']]: size === 'l',\n [spacerStyles['spacer--xl']]: size === 'xl',\n [spacerStyles['spacer--2xl']]: size === '2xl',\n [spacerStyles['spacer--3xl']]: size === '3xl',\n [spacerStyles['spacer--4xl']]: size === '4xl',\n [spacerStyles['spacer--5xl']]: size === '5xl',\n [spacerStyles['spacer--6xl']]: size === '6xl',\n },\n className\n );\n\n return <span className={spacerClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Spacer}></span>;\n};\n\nexport default Spacer;\n","import Spacer from './Spacer';\nexport * from './Spacer';\nexport default Spacer;\n"],"mappings":";;;;AAmBA,IAAMA,UAAiC,UAAuB;CAC5D,MAAM,EAAE,OAAO,KAAK,WAAW,QAAQ,QAAQ;AAqB/C,QAAO,oBAAC,QAAA;EAAK,WApBS,WACpB,aAAa,QACb;IACG,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,gBAAgB,SAAS;IACtC,aAAa,eAAe,SAAS;IACrC,aAAa,eAAe,SAAS;IACrC,aAAa,eAAe,SAAS;IACrC,aAAa,gBAAgB,SAAS;IACtC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;GACzC,EACD,UACD;EAE2C;EAAK,eAAa;EAAQ,oBAAkB,YAAY;GAAe;;ACvCrH,IAAA,mBD0Ce"}
1
+ {"version":3,"file":"Spacer.js","names":["Spacer: React.FC<SpacerProps>"],"sources":["../src/components/Spacer/Spacer.tsx","../src/components/Spacer/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport type { SpacerSizes } from './../../theme/spacers';\n\nimport { AnalyticsId } from '../../constants';\n\nimport spacerStyles from './styles.module.scss';\n\nexport interface SpacerProps {\n /** Sets the size of the spacer. */\n size?: SpacerSizes;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the component */\n ref?: React.Ref<HTMLElement | null>;\n}\n\nconst Spacer: React.FC<SpacerProps> = (props: SpacerProps) => {\n const { size = 's', className, testId, ref } = props;\n const spacerClasses = classNames(\n spacerStyles.spacer,\n {\n [spacerStyles['spacer--4xs']]: size === '4xs',\n [spacerStyles['spacer--3xs']]: size === '3xs',\n [spacerStyles['spacer--2xs']]: size === '2xs',\n [spacerStyles['spacer--xs']]: size === 'xs',\n [spacerStyles['spacer--s']]: size === 's',\n [spacerStyles['spacer--m']]: size === 'm',\n [spacerStyles['spacer--l']]: size === 'l',\n [spacerStyles['spacer--xl']]: size === 'xl',\n [spacerStyles['spacer--2xl']]: size === '2xl',\n [spacerStyles['spacer--3xl']]: size === '3xl',\n [spacerStyles['spacer--4xl']]: size === '4xl',\n [spacerStyles['spacer--5xl']]: size === '5xl',\n [spacerStyles['spacer--6xl']]: size === '6xl',\n },\n className\n );\n\n return <span className={spacerClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Spacer}></span>;\n};\n\nexport default Spacer;\n","import Spacer from './Spacer';\nexport * from './Spacer';\nexport default Spacer;\n"],"mappings":";;;;AAmBA,IAAMA,UAAiC,UAAuB;CAC5D,MAAM,EAAE,OAAO,KAAK,WAAW,QAAQ,QAAQ;AAqB/C,QAAO,oBAAC,QAAA;EAAK,WApBS,GACpB,aAAa,QACb;IACG,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,gBAAgB,SAAS;IACtC,aAAa,eAAe,SAAS;IACrC,aAAa,eAAe,SAAS;IACrC,aAAa,eAAe,SAAS;IACrC,aAAa,gBAAgB,SAAS;IACtC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;IACvC,aAAa,iBAAiB,SAAS;GACzC,EACD,UACD;EAE2C;EAAK,eAAa;EAAQ,oBAAkB,YAAY;GAAe;;ACvCrH,IAAA,mBD0Ce"}
package/lib/StatusDot.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as IconSize, n as AnalyticsId, r as FormOnColor } from "./constants2.js";
2
2
  import { t as getColor } from "./color.js";
3
3
  import { r as LazyIcon } from "./LazyIcon.js";
4
- import classNames from "classnames";
4
+ import cn from "classnames";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import styles from "./components/StatusDot/styles.module.scss";
7
7
  let StatusDotOnColor = /* @__PURE__ */ function(StatusDotOnColor$1) {
@@ -37,7 +37,7 @@ var StatusDotIcon = ({ onColor, variant = "info" }) => {
37
37
  color: onColor === StatusDotOnColor.ondark ? getColor("white") : getColor("black"),
38
38
  size: IconSize.XXSmall,
39
39
  onColor,
40
- className: classNames({
40
+ className: cn({
41
41
  [styles[`statusdot__dot--${variant}`]]: typeof variant !== "undefined",
42
42
  [styles["statusdot__dot--on-dark"]]: onColor === StatusDotOnColor.ondark
43
43
  })
@@ -128,8 +128,8 @@ var StatusDotIcon = ({ onColor, variant = "info" }) => {
128
128
  };
129
129
  var StatusDot = (props) => {
130
130
  const { id, onColor = StatusDotOnColor.onwhite, variant = StatusDotVariant.info, text, className, testId, ref } = props;
131
- const statusDotClasses = classNames(styles["statusdot"], className);
132
- const labelClasses = classNames(styles["statusdot__label"], { [styles["statusdot__label--on-dark"]]: onColor === StatusDotOnColor.ondark });
131
+ const statusDotClasses = cn(styles["statusdot"], className);
132
+ const labelClasses = cn(styles["statusdot__label"], { [styles["statusdot__label--on-dark"]]: onColor === StatusDotOnColor.ondark });
133
133
  return /* @__PURE__ */ jsxs("span", {
134
134
  id,
135
135
  ref,
@@ -1 +1 @@
1
- {"version":3,"file":"StatusDot.js","names":["StatusDotIcon: React.FC<StatusDotIconProps>","StatusDot: React.FC<StatusDotProps>"],"sources":["../src/components/StatusDot/constants.ts","../src/components/StatusDot/StatusDot.tsx","../src/components/StatusDot/index.ts"],"sourcesContent":["import { FormOnColor } from '../../constants';\n\nexport enum StatusDotOnColor {\n onwhite = FormOnColor.onwhite,\n ondark = FormOnColor.ondark,\n}\n\nexport enum StatusDotVariant {\n success = 'success',\n inprocess = 'inprocess',\n exception = 'exception',\n unknown = 'unknown',\n inspected = 'inspected',\n cancelled = 'cancelled',\n alert = 'alert',\n transparent = 'transparent',\n info = 'info',\n group = 'group',\n recurring = 'recurring',\n noaccess = 'noaccess',\n draft = 'draft',\n hidden = 'hidden',\n login = 'login',\n attachment = 'attachment',\n active = 'active',\n pending = 'pending',\n inactive = 'inactive',\n ready = 'ready',\n}\n","import classNames from 'classnames';\n\nimport { StatusDotOnColor, StatusDotVariant } from './constants';\nimport { IconSize } from '../..';\nimport { AnalyticsId } from '../../constants';\nimport { getColor } from '../../theme/currys';\nimport { LazyIcon } from '../LazyIcon';\n\nimport styles from './styles.module.scss';\n\nexport interface StatusDotIconProps {\n /** Defines the color of the icon */\n onColor?: keyof typeof StatusDotOnColor;\n /** The variant defines style formatting and what icon to use */\n variant?: keyof typeof StatusDotVariant;\n}\n\nconst StatusDotIcon: React.FC<StatusDotIconProps> = ({ onColor, variant = 'info' }) => {\n const color = onColor === StatusDotOnColor.ondark ? getColor('white') : getColor('black');\n const iconProps = {\n color,\n size: IconSize.XXSmall,\n onColor,\n className: classNames({\n [styles[`statusdot__dot--${variant}`]]: typeof variant !== 'undefined',\n [styles['statusdot__dot--on-dark']]: onColor === StatusDotOnColor.ondark,\n }),\n };\n\n switch (variant) {\n case StatusDotVariant.success:\n return <LazyIcon {...iconProps} iconName={'DotCheckmark'} />;\n case StatusDotVariant.inprocess:\n return <LazyIcon {...iconProps} iconName={'DotHalfDisc'} />;\n case StatusDotVariant.exception:\n return <LazyIcon {...iconProps} iconName={'DotTriangle'} />;\n case StatusDotVariant.unknown:\n return <LazyIcon {...iconProps} iconName={'DotQuestionMark'} />;\n case StatusDotVariant.inspected:\n return <LazyIcon {...iconProps} iconName={'DotLookingGlass'} />;\n case StatusDotVariant.cancelled:\n return <LazyIcon {...iconProps} iconName={'DotX'} />;\n case StatusDotVariant.alert:\n return <LazyIcon {...iconProps} iconName={'DotExclamationMark'} />;\n case StatusDotVariant.transparent:\n return <LazyIcon {...iconProps} iconName={'DotOutline'} />;\n case StatusDotVariant.info:\n return <LazyIcon {...iconProps} iconName={'DotInfo'} />;\n case StatusDotVariant.group:\n return <LazyIcon {...iconProps} iconName={'DotGroup'} />;\n case StatusDotVariant.recurring:\n return <LazyIcon {...iconProps} iconName={'DotCircleArrows'} />;\n case StatusDotVariant.noaccess:\n return <LazyIcon {...iconProps} iconName={'DotNoAccess'} />;\n case StatusDotVariant.draft:\n return <LazyIcon {...iconProps} iconName={'DotPencil'} />;\n case StatusDotVariant.hidden:\n return <LazyIcon {...iconProps} iconName={'DotNoEye'} />;\n case StatusDotVariant.login:\n return <LazyIcon {...iconProps} iconName={'DotLogin'} />;\n case StatusDotVariant.attachment:\n return <LazyIcon {...iconProps} iconName={'DotAttachment'} />;\n case StatusDotVariant.active:\n return <LazyIcon {...iconProps} iconName={'DotFill'} />;\n case StatusDotVariant.pending:\n return <LazyIcon {...iconProps} iconName={'DotDot'} />;\n case StatusDotVariant.inactive:\n return <LazyIcon {...iconProps} iconName={'DotOutline'} />;\n case StatusDotVariant.ready:\n return <LazyIcon {...iconProps} iconName={'DotOutline'} />;\n }\n\n return null;\n};\n\nexport interface StatusDotProps {\n /** id that is placed on the wrapper */\n id?: string;\n /** Defines the color mode, onwhite, ondark etc. */\n onColor?: keyof typeof StatusDotOnColor;\n /** Visual variants for the statusdot */\n variant?: keyof typeof StatusDotVariant;\n /** Text placed to the right of the statusdot */\n text: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the root element */\n ref?: React.Ref<HTMLElement | null>;\n}\n\nexport type StatusDotType = typeof StatusDot;\nconst StatusDot: React.FC<StatusDotProps> = (props: StatusDotProps) => {\n const { id, onColor = StatusDotOnColor.onwhite, variant = StatusDotVariant.info, text, className, testId, ref } = props;\n const statusDotClasses = classNames(styles['statusdot'], className);\n const labelClasses = classNames(styles['statusdot__label'], {\n [styles['statusdot__label--on-dark']]: onColor === StatusDotOnColor.ondark,\n });\n\n return (\n <span id={id} ref={ref} className={statusDotClasses} data-testid={testId} data-analyticsid={AnalyticsId.StatusDot}>\n <span className={styles['statusdot__dot']} data-testid={testId + '-dot'}>\n <StatusDotIcon onColor={onColor} variant={variant} />\n </span>\n <span className={labelClasses}>{text}</span>\n </span>\n );\n};\n\nexport default StatusDot;\n","import StatusDot from './StatusDot';\nexport { StatusDotOnColor, StatusDotVariant } from './constants';\nexport * from './StatusDot';\nexport default StatusDot;\n"],"mappings":";;;;;;AAEA,IAAY,mBAAA,yBAAA,oBAAL;AACL,oBAAA,mBAAA,aAAU,YAAY,WAAA;AACtB,oBAAA,mBAAA,YAAS,YAAY,UAAA;;;AAGvB,IAAY,mBAAA,yBAAA,oBAAL;AACL,oBAAA,aAAA;AACA,oBAAA,eAAA;AACA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AkB,eAAa;EAAQ,oBAAkB,YAAY;aACtG,oBAAC,QAAA;GAAK,WAAW,OAAO;GAAmB,eAAa,SAAS;aAC/D,oBAAC,eAAA;IAAuB;IAAkB;KAAW;IAChD,EACP,oBAAC,QAAA;GAAK,WAAW;aAAe;IAAY,CAAA;GACvC;;ACvGX,IAAA,sBD2Ge"}
1
+ {"version":3,"file":"StatusDot.js","names":["StatusDotIcon: React.FC<StatusDotIconProps>","StatusDot: React.FC<StatusDotProps>"],"sources":["../src/components/StatusDot/constants.ts","../src/components/StatusDot/StatusDot.tsx","../src/components/StatusDot/index.ts"],"sourcesContent":["import { FormOnColor } from '../../constants';\n\nexport enum StatusDotOnColor {\n onwhite = FormOnColor.onwhite,\n ondark = FormOnColor.ondark,\n}\n\nexport enum StatusDotVariant {\n success = 'success',\n inprocess = 'inprocess',\n exception = 'exception',\n unknown = 'unknown',\n inspected = 'inspected',\n cancelled = 'cancelled',\n alert = 'alert',\n transparent = 'transparent',\n info = 'info',\n group = 'group',\n recurring = 'recurring',\n noaccess = 'noaccess',\n draft = 'draft',\n hidden = 'hidden',\n login = 'login',\n attachment = 'attachment',\n active = 'active',\n pending = 'pending',\n inactive = 'inactive',\n ready = 'ready',\n}\n","import classNames from 'classnames';\n\nimport { StatusDotOnColor, StatusDotVariant } from './constants';\nimport { IconSize } from '../..';\nimport { AnalyticsId } from '../../constants';\nimport { getColor } from '../../theme/currys';\nimport { LazyIcon } from '../LazyIcon';\n\nimport styles from './styles.module.scss';\n\nexport interface StatusDotIconProps {\n /** Defines the color of the icon */\n onColor?: keyof typeof StatusDotOnColor;\n /** The variant defines style formatting and what icon to use */\n variant?: keyof typeof StatusDotVariant;\n}\n\nconst StatusDotIcon: React.FC<StatusDotIconProps> = ({ onColor, variant = 'info' }) => {\n const color = onColor === StatusDotOnColor.ondark ? getColor('white') : getColor('black');\n const iconProps = {\n color,\n size: IconSize.XXSmall,\n onColor,\n className: classNames({\n [styles[`statusdot__dot--${variant}`]]: typeof variant !== 'undefined',\n [styles['statusdot__dot--on-dark']]: onColor === StatusDotOnColor.ondark,\n }),\n };\n\n switch (variant) {\n case StatusDotVariant.success:\n return <LazyIcon {...iconProps} iconName={'DotCheckmark'} />;\n case StatusDotVariant.inprocess:\n return <LazyIcon {...iconProps} iconName={'DotHalfDisc'} />;\n case StatusDotVariant.exception:\n return <LazyIcon {...iconProps} iconName={'DotTriangle'} />;\n case StatusDotVariant.unknown:\n return <LazyIcon {...iconProps} iconName={'DotQuestionMark'} />;\n case StatusDotVariant.inspected:\n return <LazyIcon {...iconProps} iconName={'DotLookingGlass'} />;\n case StatusDotVariant.cancelled:\n return <LazyIcon {...iconProps} iconName={'DotX'} />;\n case StatusDotVariant.alert:\n return <LazyIcon {...iconProps} iconName={'DotExclamationMark'} />;\n case StatusDotVariant.transparent:\n return <LazyIcon {...iconProps} iconName={'DotOutline'} />;\n case StatusDotVariant.info:\n return <LazyIcon {...iconProps} iconName={'DotInfo'} />;\n case StatusDotVariant.group:\n return <LazyIcon {...iconProps} iconName={'DotGroup'} />;\n case StatusDotVariant.recurring:\n return <LazyIcon {...iconProps} iconName={'DotCircleArrows'} />;\n case StatusDotVariant.noaccess:\n return <LazyIcon {...iconProps} iconName={'DotNoAccess'} />;\n case StatusDotVariant.draft:\n return <LazyIcon {...iconProps} iconName={'DotPencil'} />;\n case StatusDotVariant.hidden:\n return <LazyIcon {...iconProps} iconName={'DotNoEye'} />;\n case StatusDotVariant.login:\n return <LazyIcon {...iconProps} iconName={'DotLogin'} />;\n case StatusDotVariant.attachment:\n return <LazyIcon {...iconProps} iconName={'DotAttachment'} />;\n case StatusDotVariant.active:\n return <LazyIcon {...iconProps} iconName={'DotFill'} />;\n case StatusDotVariant.pending:\n return <LazyIcon {...iconProps} iconName={'DotDot'} />;\n case StatusDotVariant.inactive:\n return <LazyIcon {...iconProps} iconName={'DotOutline'} />;\n case StatusDotVariant.ready:\n return <LazyIcon {...iconProps} iconName={'DotOutline'} />;\n }\n\n return null;\n};\n\nexport interface StatusDotProps {\n /** id that is placed on the wrapper */\n id?: string;\n /** Defines the color mode, onwhite, ondark etc. */\n onColor?: keyof typeof StatusDotOnColor;\n /** Visual variants for the statusdot */\n variant?: keyof typeof StatusDotVariant;\n /** Text placed to the right of the statusdot */\n text: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the root element */\n ref?: React.Ref<HTMLElement | null>;\n}\n\nexport type StatusDotType = typeof StatusDot;\nconst StatusDot: React.FC<StatusDotProps> = (props: StatusDotProps) => {\n const { id, onColor = StatusDotOnColor.onwhite, variant = StatusDotVariant.info, text, className, testId, ref } = props;\n const statusDotClasses = classNames(styles['statusdot'], className);\n const labelClasses = classNames(styles['statusdot__label'], {\n [styles['statusdot__label--on-dark']]: onColor === StatusDotOnColor.ondark,\n });\n\n return (\n <span id={id} ref={ref} className={statusDotClasses} data-testid={testId} data-analyticsid={AnalyticsId.StatusDot}>\n <span className={styles['statusdot__dot']} data-testid={testId + '-dot'}>\n <StatusDotIcon onColor={onColor} variant={variant} />\n </span>\n <span className={labelClasses}>{text}</span>\n </span>\n );\n};\n\nexport default StatusDot;\n","import StatusDot from './StatusDot';\nexport { StatusDotOnColor, StatusDotVariant } from './constants';\nexport * from './StatusDot';\nexport default StatusDot;\n"],"mappings":";;;;;;AAEA,IAAY,mBAAA,yBAAA,oBAAL;AACL,oBAAA,mBAAA,aAAU,YAAY,WAAA;AACtB,oBAAA,mBAAA,YAAS,YAAY,UAAA;;;AAGvB,IAAY,mBAAA,yBAAA,oBAAL;AACL,oBAAA,aAAA;AACA,oBAAA,eAAA;AACA,oBAAA,eAAA;AACA,oBAAA,aAAA;AACA,oBAAA,eAAA;AACA,oBAAA,eAAA;AACA,oBAAA,WAAA;AACA,oBAAA,iBAAA;AACA,oBAAA,UAAA;AACA,oBAAA,WAAA;AACA,oBAAA,eAAA;AACA,oBAAA,cAAA;AACA,oBAAA,WAAA;AACA,oBAAA,YAAA;A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
@@ -1,12 +1,12 @@
1
1
  import { r as StatusDotVariant, t as StatusDot_default } from "./StatusDot.js";
2
- import classNames from "classnames";
2
+ import cn from "classnames";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import styles from "./components/ElementHeader/StatusDotList/styles.module.scss";
5
5
  const StatusDotList = (props) => {
6
6
  const { additionalText, children, className = "", testId, stacking = "horizontal", hiddenForChild = false, topStatusDot, bottomStatusDot } = props;
7
7
  return /* @__PURE__ */ jsxs("span", {
8
8
  "data-testid": testId,
9
- className: classNames(styles["statusdotlist"], className),
9
+ className: cn(styles["statusdotlist"], className),
10
10
  children: [
11
11
  topStatusDot,
12
12
  hiddenForChild && /* @__PURE__ */ jsx(StatusDot_default, {
@@ -1 +1 @@
1
- {"version":3,"file":"StatusDotList.js","names":["StatusDotList: React.FC<StatusDotListProps>"],"sources":["../src/components/ElementHeader/StatusDotList/StatusDotList.tsx","../src/components/ElementHeader/StatusDotList/index.ts"],"sourcesContent":["import cn from 'classnames';\n\nimport type { StatusDotProps } from '../../StatusDot';\n\nimport StatusDot, { StatusDotVariant } from '../../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type StatusDotListType = typeof StatusDotList;\n\nexport interface StatusDotListProps {\n /** Additional text to the bottom statusdot */\n additionalText?: string;\n /** StatusDot that is under the others and outside the stacking */\n bottomStatusDot?: React.ReactElement<StatusDotProps>;\n /** Stacking of the statusdots */\n stacking?: 'vertical' | 'horizontal';\n /** StatusDots as children */\n children?: React.ReactNode;\n /** Adds custom classes */\n className?: string;\n /** Show a hidden for child statusdot over the other */\n hiddenForChild?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** StatusDot that is over the others and outside the stacking */\n topStatusDot?: React.ReactElement<StatusDotProps>;\n}\n\nexport const StatusDotList: React.FC<StatusDotListProps> = props => {\n const {\n additionalText,\n children,\n className = '',\n testId,\n stacking = 'horizontal',\n hiddenForChild = false,\n topStatusDot,\n bottomStatusDot,\n } = props;\n\n return (\n <span data-testid={testId} className={cn(styles['statusdotlist'], className)}>\n {topStatusDot}\n {/* @todo: legg til tekst i SOT */}\n {hiddenForChild && <StatusDot variant={StatusDotVariant.hidden} text=\"Skjult for barnet\" />}\n <span data-stacking={stacking} className={styles['statusdotlist__children']}>\n {children}\n </span>\n {bottomStatusDot}\n {additionalText && <span className={styles['statusdotlist__additional-text']}>{additionalText}</span>}\n </span>\n );\n};\n\nexport default StatusDotList;\n","import StatusDotList from './StatusDotList';\nexport * from './StatusDotList';\nexport default StatusDotList;\n"],"mappings":";;;;AA6BA,MAAaA,iBAA8C,UAAS;CAClE,MAAM,EACJ,gBACA,UACA,YAAY,IACZ,QACA,WAAW,cACX,iBAAiB,OACjB,cACA,oBACE;AAEJ,QACE,qBAAC,QAAA;EAAK,eAAa;EAAQ,WAAW,WAAG,OAAO,kBAAkB,UAAU;;GACzE;GAEA,kBAAkB,oBAAC,mBAAA;IAAU,SAAS,iBAAiB;IAAQ,MAAK;KAAsB;GAC3F,oBAAC,QAAA;IAAK,iBAAe;IAAU,WAAW,OAAO;IAC9C;KACI;GACN;GACA,kBAAkB,oBAAC,QAAA;IAAK,WAAW,OAAO;cAAoC;KAAsB;;GAChG;;ACjDX,IAAA,0BDqDe"}
1
+ {"version":3,"file":"StatusDotList.js","names":["StatusDotList: React.FC<StatusDotListProps>"],"sources":["../src/components/ElementHeader/StatusDotList/StatusDotList.tsx","../src/components/ElementHeader/StatusDotList/index.ts"],"sourcesContent":["import cn from 'classnames';\n\nimport type { StatusDotProps } from '../../StatusDot';\n\nimport StatusDot, { StatusDotVariant } from '../../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type StatusDotListType = typeof StatusDotList;\n\nexport interface StatusDotListProps {\n /** Additional text to the bottom statusdot */\n additionalText?: string;\n /** StatusDot that is under the others and outside the stacking */\n bottomStatusDot?: React.ReactElement<StatusDotProps>;\n /** Stacking of the statusdots */\n stacking?: 'vertical' | 'horizontal';\n /** StatusDots as children */\n children?: React.ReactNode;\n /** Adds custom classes */\n className?: string;\n /** Show a hidden for child statusdot over the other */\n hiddenForChild?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** StatusDot that is over the others and outside the stacking */\n topStatusDot?: React.ReactElement<StatusDotProps>;\n}\n\nexport const StatusDotList: React.FC<StatusDotListProps> = props => {\n const {\n additionalText,\n children,\n className = '',\n testId,\n stacking = 'horizontal',\n hiddenForChild = false,\n topStatusDot,\n bottomStatusDot,\n } = props;\n\n return (\n <span data-testid={testId} className={cn(styles['statusdotlist'], className)}>\n {topStatusDot}\n {/* @todo: legg til tekst i SOT */}\n {hiddenForChild && <StatusDot variant={StatusDotVariant.hidden} text=\"Skjult for barnet\" />}\n <span data-stacking={stacking} className={styles['statusdotlist__children']}>\n {children}\n </span>\n {bottomStatusDot}\n {additionalText && <span className={styles['statusdotlist__additional-text']}>{additionalText}</span>}\n </span>\n );\n};\n\nexport default StatusDotList;\n","import StatusDotList from './StatusDotList';\nexport * from './StatusDotList';\nexport default StatusDotList;\n"],"mappings":";;;;AA6BA,MAAaA,iBAA8C,UAAS;CAClE,MAAM,EACJ,gBACA,UACA,YAAY,IACZ,QACA,WAAW,cACX,iBAAiB,OACjB,cACA,oBACE;AAEJ,QACE,qBAAC,QAAA;EAAK,eAAa;EAAQ,WAAW,GAAG,OAAO,kBAAkB,UAAU;;GACzE;GAEA,kBAAkB,oBAAC,mBAAA;IAAU,SAAS,iBAAiB;IAAQ,MAAK;KAAsB;GAC3F,oBAAC,QAAA;IAAK,iBAAe;IAAU,WAAW,OAAO;IAC9C;KACI;GACN;GACA,kBAAkB,oBAAC,QAAA;IAAK,WAAW,OAAO;cAAoC;KAAsB;;GAChG;;ACjDX,IAAA,0BDqDe"}
@@ -1,11 +1,11 @@
1
1
  import { n as AnalyticsId } from "./constants2.js";
2
- import classNames from "classnames";
2
+ import cn from "classnames";
3
3
  import React from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import styles from "./components/StepButtons/styles.module.scss";
6
6
  const StepButtons = (props) => {
7
7
  const { backButton, forwardButton, additionalButtons, cancelButton, sticky = false, testId } = props;
8
- const navigationClasses = classNames(styles.stepbuttons, sticky && styles["stepbuttons--has-sticky-buttons"]);
8
+ const navigationClasses = cn(styles.stepbuttons, sticky && styles["stepbuttons--has-sticky-buttons"]);
9
9
  if (backButton || forwardButton || additionalButtons || cancelButton) return /* @__PURE__ */ jsxs("div", {
10
10
  className: navigationClasses,
11
11
  "data-testid": testId,
@@ -15,14 +15,14 @@ const StepButtons = (props) => {
15
15
  className: styles.stepbuttons__buttons,
16
16
  children: [backButton && React.cloneElement(backButton, {
17
17
  variant: "outline",
18
- wrapperClassName: classNames(styles["stepbuttons__button--back"])
18
+ wrapperClassName: cn(styles["stepbuttons__button--back"])
19
19
  }), forwardButton && React.cloneElement(forwardButton, {
20
20
  variant: "fill",
21
- wrapperClassName: classNames(styles["stepbuttons__button--forward"])
21
+ wrapperClassName: cn(styles["stepbuttons__button--forward"])
22
22
  })]
23
23
  }),
24
24
  additionalButtons && /* @__PURE__ */ jsx("div", {
25
- className: classNames(styles.stepbuttons__buttons, styles["stepbuttons__buttons--additional"]),
25
+ className: cn(styles.stepbuttons__buttons, styles["stepbuttons__buttons--additional"]),
26
26
  children: additionalButtons
27
27
  }),
28
28
  cancelButton && /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"StepButtons.js","names":["StepButtons: React.FC<StepButtonsProps>"],"sources":["../src/components/StepButtons/StepButtons.tsx","../src/components/StepButtons/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { ButtonProps } from '../Button';\n\nimport { AnalyticsId } from '../../constants';\n\nimport styles from './styles.module.scss';\n\nexport interface StepButtonsProps {\n /** Knapp for å gå tilbake. Vises med \"outline\" variant. */\n backButton?: React.ReactElement<ButtonProps>;\n /** Knapp for å gå videre. Vises med \"fill\" variant. */\n forwardButton?: React.ReactElement<ButtonProps>;\n /** Ekstra knapper. Valgfritt utseende. */\n additionalButtons?: React.ReactElement<ButtonProps>[];\n /** Knapp for å avbryte eller fortsette senere. Vises med \"borderless\" variant. */\n cancelButton?: React.ReactElement<ButtonProps>;\n /** Knappene vil vises sticky nederst på skjermen. Default: false */\n sticky?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const StepButtons: React.FC<StepButtonsProps> = props => {\n const { backButton, forwardButton, additionalButtons, cancelButton, sticky = false, testId } = props;\n\n const navigationClasses = classNames(styles.stepbuttons, sticky && styles['stepbuttons--has-sticky-buttons']);\n\n if (backButton || forwardButton || additionalButtons || cancelButton) {\n return (\n <div className={navigationClasses} data-testid={testId} data-analyticsid={AnalyticsId.StepButtons}>\n {(backButton || forwardButton) && (\n <div className={styles.stepbuttons__buttons}>\n {backButton &&\n React.cloneElement(backButton, {\n variant: 'outline',\n wrapperClassName: classNames(styles['stepbuttons__button--back']),\n })}\n {forwardButton &&\n React.cloneElement(forwardButton, {\n variant: 'fill',\n wrapperClassName: classNames(styles['stepbuttons__button--forward']),\n })}\n </div>\n )}\n {additionalButtons && (\n <div className={classNames(styles.stepbuttons__buttons, styles['stepbuttons__buttons--additional'])}>{additionalButtons}</div>\n )}\n {cancelButton && (\n <div className={styles.stepbuttons__buttons}>\n {React.cloneElement(cancelButton, {\n variant: 'borderless',\n })}\n </div>\n )}\n </div>\n );\n }\n return null;\n};\n\nexport default StepButtons;\n","import StepButtons from './StepButtons';\nexport * from './StepButtons';\nexport default StepButtons;\n"],"mappings":";;;;;AAyBA,MAAaA,eAA0C,UAAS;CAC9D,MAAM,EAAE,YAAY,eAAe,mBAAmB,cAAc,SAAS,OAAO,WAAW;CAE/F,MAAM,oBAAoB,WAAW,OAAO,aAAa,UAAU,OAAO,mCAAmC;AAE7G,KAAI,cAAc,iBAAiB,qBAAqB,aACtD,QACE,qBAAC,OAAA;EAAI,WAAW;EAAmB,eAAa;EAAQ,oBAAkB,YAAY;;IAClF,cAAc,kBACd,qBAAC,OAAA;IAAI,WAAW,OAAO;eACpB,cACC,MAAM,aAAa,YAAY;KAC7B,SAAS;KACT,kBAAkB,WAAW,OAAO,6BAA6B;KAClE,CAAC,EACH,iBACC,MAAM,aAAa,eAAe;KAChC,SAAS;KACT,kBAAkB,WAAW,OAAO,gCAAgC;KACrE,CAAC,CAAA;KACA;GAEP,qBACC,oBAAC,OAAA;IAAI,WAAW,WAAW,OAAO,sBAAsB,OAAO,oCAAoC;cAAG;KAAwB;GAE/H,gBACC,oBAAC,OAAA;IAAI,WAAW,OAAO;cACpB,MAAM,aAAa,cAAc,EAChC,SAAS,cACV,CAAC;KACE;;GAEJ;AAGV,QAAO;;AC1DT,IAAA,wBD6De"}
1
+ {"version":3,"file":"StepButtons.js","names":["StepButtons: React.FC<StepButtonsProps>"],"sources":["../src/components/StepButtons/StepButtons.tsx","../src/components/StepButtons/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { ButtonProps } from '../Button';\n\nimport { AnalyticsId } from '../../constants';\n\nimport styles from './styles.module.scss';\n\nexport interface StepButtonsProps {\n /** Knapp for å gå tilbake. Vises med \"outline\" variant. */\n backButton?: React.ReactElement<ButtonProps>;\n /** Knapp for å gå videre. Vises med \"fill\" variant. */\n forwardButton?: React.ReactElement<ButtonProps>;\n /** Ekstra knapper. Valgfritt utseende. */\n additionalButtons?: React.ReactElement<ButtonProps>[];\n /** Knapp for å avbryte eller fortsette senere. Vises med \"borderless\" variant. */\n cancelButton?: React.ReactElement<ButtonProps>;\n /** Knappene vil vises sticky nederst på skjermen. Default: false */\n sticky?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const StepButtons: React.FC<StepButtonsProps> = props => {\n const { backButton, forwardButton, additionalButtons, cancelButton, sticky = false, testId } = props;\n\n const navigationClasses = classNames(styles.stepbuttons, sticky && styles['stepbuttons--has-sticky-buttons']);\n\n if (backButton || forwardButton || additionalButtons || cancelButton) {\n return (\n <div className={navigationClasses} data-testid={testId} data-analyticsid={AnalyticsId.StepButtons}>\n {(backButton || forwardButton) && (\n <div className={styles.stepbuttons__buttons}>\n {backButton &&\n React.cloneElement(backButton, {\n variant: 'outline',\n wrapperClassName: classNames(styles['stepbuttons__button--back']),\n })}\n {forwardButton &&\n React.cloneElement(forwardButton, {\n variant: 'fill',\n wrapperClassName: classNames(styles['stepbuttons__button--forward']),\n })}\n </div>\n )}\n {additionalButtons && (\n <div className={classNames(styles.stepbuttons__buttons, styles['stepbuttons__buttons--additional'])}>{additionalButtons}</div>\n )}\n {cancelButton && (\n <div className={styles.stepbuttons__buttons}>\n {React.cloneElement(cancelButton, {\n variant: 'borderless',\n })}\n </div>\n )}\n </div>\n );\n }\n return null;\n};\n\nexport default StepButtons;\n","import StepButtons from './StepButtons';\nexport * from './StepButtons';\nexport default StepButtons;\n"],"mappings":";;;;;AAyBA,MAAaA,eAA0C,UAAS;CAC9D,MAAM,EAAE,YAAY,eAAe,mBAAmB,cAAc,SAAS,OAAO,WAAW;CAE/F,MAAM,oBAAoB,GAAW,OAAO,aAAa,UAAU,OAAO,mCAAmC;AAE7G,KAAI,cAAc,iBAAiB,qBAAqB,aACtD,QACE,qBAAC,OAAA;EAAI,WAAW;EAAmB,eAAa;EAAQ,oBAAkB,YAAY;;IAClF,cAAc,kBACd,qBAAC,OAAA;IAAI,WAAW,OAAO;eACpB,cACC,MAAM,aAAa,YAAY;KAC7B,SAAS;KACT,kBAAkB,GAAW,OAAO,6BAA6B;KAClE,CAAC,EACH,iBACC,MAAM,aAAa,eAAe;KAChC,SAAS;KACT,kBAAkB,GAAW,OAAO,gCAAgC;KACrE,CAAC,CAAA;KACA;GAEP,qBACC,oBAAC,OAAA;IAAI,WAAW,GAAW,OAAO,sBAAsB,OAAO,oCAAoC;cAAG;KAAwB;GAE/H,gBACC,oBAAC,OAAA;IAAI,WAAW,OAAO;cACpB,MAAM,aAAa,cAAc,EAChC,SAAS,cACV,CAAC;KACE;;GAEJ;AAGV,QAAO;;AC1DT,IAAA,wBD6De"}
package/lib/TabList.js CHANGED
@@ -8,7 +8,7 @@ import { t as useIsVisible } from "./useIsVisible.js";
8
8
  import { t as ChevronLeft_default } from "./ChevronLeft.js";
9
9
  import { t as ChevronRight_default } from "./ChevronRight.js";
10
10
  import { t as useRovingFocus } from "./useRovingFocus.js";
11
- import classNames from "classnames";
11
+ import cn from "classnames";
12
12
  import React, { useEffect, useRef } from "react";
13
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
14
  import styles from "./components/Tabs/TabList/styles.module.scss";
@@ -48,7 +48,7 @@ var TabItem = (props) => {
48
48
  props.onTabListClick(props.index);
49
49
  scrollToTab(props.index);
50
50
  };
51
- const tabButtonClasses = classNames(styles["tab-list__tab"], styles[`tab-list__tab--${props.color}`], {
51
+ const tabButtonClasses = cn(styles["tab-list__tab"], styles[`tab-list__tab--${props.color}`], {
52
52
  [styles["tab-list__tab--selected"]]: isSelected,
53
53
  [styles["tab-list__tab--not-selected"]]: !isSelected
54
54
  });
@@ -96,7 +96,7 @@ var TabList = (props) => {
96
96
  const listRef = useRef(null);
97
97
  const tabRefs = useRef(React.Children.map(children, () => React.createRef()) || []);
98
98
  useRovingFocus(onTabListClick, tabRefs, listRef, true);
99
- const tablistClasses = classNames(styles["tab-list"], styles[`tab-list--${onColor}`]);
99
+ const tablistClasses = cn(styles["tab-list"], styles[`tab-list--${onColor}`]);
100
100
  const getBackgroundColor = (onColor$1) => {
101
101
  switch (onColor$1) {
102
102
  case "onwhite": return "var(--color-base-background-white)";
@@ -139,14 +139,14 @@ var TabList = (props) => {
139
139
  className: styles["tab-list-wrapper"],
140
140
  children: [
141
141
  shouldShowFadeStart() && /* @__PURE__ */ jsxs("div", {
142
- className: classNames(styles["tab-list__start-wrapper"]),
142
+ className: cn(styles["tab-list__start-wrapper"]),
143
143
  children: [/* @__PURE__ */ jsx(TabChevron_default, {
144
144
  onClick: () => scrollInList("left"),
145
145
  direction: "left",
146
146
  backgroundColor: `${getBackgroundColor(onColor)}`,
147
147
  ariaLabel: ariaLabelLeftButton
148
148
  }), /* @__PURE__ */ jsx("div", {
149
- className: classNames(styles["tab-list__fade-start"]),
149
+ className: cn(styles["tab-list__fade-start"]),
150
150
  style: { backgroundColor: `${getBackgroundColor(onColor)}` }
151
151
  })]
152
152
  }),
@@ -169,9 +169,9 @@ var TabList = (props) => {
169
169
  })
170
170
  }),
171
171
  shouldShowFadeEnd() && /* @__PURE__ */ jsxs("div", {
172
- className: classNames(styles["tab-list__end-wrapper"]),
172
+ className: cn(styles["tab-list__end-wrapper"]),
173
173
  children: [/* @__PURE__ */ jsx("div", {
174
- className: classNames(styles["tab-list__fade-end"]),
174
+ className: cn(styles["tab-list__fade-end"]),
175
175
  style: { backgroundColor: `${getBackgroundColor(onColor)}` }
176
176
  }), /* @__PURE__ */ jsx(TabChevron_default, {
177
177
  onClick: () => scrollInList("right"),
@@ -180,7 +180,7 @@ var TabList = (props) => {
180
180
  ariaLabel: ariaLabelRightButton
181
181
  })]
182
182
  }),
183
- /* @__PURE__ */ jsx("div", { className: classNames(styles["tab-list__border"]) })
183
+ /* @__PURE__ */ jsx("div", { className: cn(styles["tab-list__border"]) })
184
184
  ]
185
185
  });
186
186
  };