@helsenorge/designsystem-react 13.4.0 → 13.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (497) hide show
  1. package/lib/CHANGELOG.md +40 -0
  2. package/lib/Checkbox.js.map +1 -1
  3. package/lib/Duolist.js +3 -0
  4. package/lib/Duolist.js.map +1 -1
  5. package/lib/Expander.js +6 -2
  6. package/lib/Expander.js.map +1 -1
  7. package/lib/FormGroup.js +4 -3
  8. package/lib/FormGroup.js.map +1 -1
  9. package/lib/HelpTriggerIcon.js.map +1 -1
  10. package/lib/HelpTriggerStandalone.js.map +1 -1
  11. package/lib/InfoTeaser.js +2 -1
  12. package/lib/InfoTeaser.js.map +1 -1
  13. package/lib/Input.js.map +1 -1
  14. package/lib/Label.js.map +1 -1
  15. package/lib/LinkList.js +8 -4
  16. package/lib/LinkList.js.map +1 -1
  17. package/lib/Panel.js +61 -37
  18. package/lib/Panel.js.map +1 -1
  19. package/lib/PanelOld.js.map +1 -1
  20. package/lib/PopOver.js.map +1 -1
  21. package/lib/RadioButton.js.map +1 -1
  22. package/lib/Select.js.map +1 -1
  23. package/lib/Slider.js.map +1 -1
  24. package/lib/Textarea.js.map +1 -1
  25. package/lib/__mocks__/uuid.js +0 -1
  26. package/lib/__mocks__/uuid.js.map +1 -1
  27. package/lib/components/AnchorLink/index.js +0 -13
  28. package/lib/components/AsChildSlot/index.js +0 -1
  29. package/lib/components/Avatar/index.js +0 -4
  30. package/lib/components/Badge/index.js +0 -8
  31. package/lib/components/Button/index.js +0 -17
  32. package/lib/components/Checkbox/index.js +0 -44
  33. package/lib/components/Close/index.js +0 -8
  34. package/lib/components/DictionaryTrigger/index.js +0 -1
  35. package/lib/components/Drawer/index.js +0 -37
  36. package/lib/components/Drawer/styles.module.scss +6 -0
  37. package/lib/components/Dropdown/SingleSelect/index.js +0 -2
  38. package/lib/components/Dropdown/SingleSelect/index.js.map +1 -1
  39. package/lib/components/Dropdown/index.js +0 -37
  40. package/lib/components/Dropdown/index.js.map +1 -1
  41. package/lib/components/DropdownOld/index.js +0 -28
  42. package/lib/components/DropdownOld/index.js.map +1 -1
  43. package/lib/components/Duolist/Duolist.d.ts +3 -1
  44. package/lib/components/Duolist/index.js +0 -4
  45. package/lib/components/ElementHeader/ElementHeaderText/index.js +0 -9
  46. package/lib/components/ElementHeader/ElementHeaderText/index.js.map +1 -1
  47. package/lib/components/ElementHeader/StatusDotList/index.js +0 -34
  48. package/lib/components/ElementHeader/index.js +0 -48
  49. package/lib/components/ElementHeader/index.js.map +1 -1
  50. package/lib/components/ElementHeader/styles.module.scss +1 -1
  51. package/lib/components/EmptyState/index.js +0 -2
  52. package/lib/components/EmptyState/index.js.map +1 -1
  53. package/lib/components/Expander/index.js +0 -24
  54. package/lib/components/Expander/styles.module.scss +16 -7
  55. package/lib/components/Expander/styles.module.scss.d.ts +2 -1
  56. package/lib/components/ExpanderHierarchy/index.js +0 -1
  57. package/lib/components/ExpanderHierarchy/index.js.map +1 -1
  58. package/lib/components/ExpanderList/index.js +0 -46
  59. package/lib/components/ExpanderList/index.js.map +1 -1
  60. package/lib/components/ExpanderList/styles.module.scss +3 -3
  61. package/lib/components/EyebrowHeader/index.js +0 -1
  62. package/lib/components/EyebrowHeader/index.js.map +1 -1
  63. package/lib/components/FavoriteButton/index.js +0 -1
  64. package/lib/components/FavoriteButton/index.js.map +1 -1
  65. package/lib/components/FormFieldTag/index.js +0 -2
  66. package/lib/components/FormGroup/FormGroup.d.ts +5 -0
  67. package/lib/components/FormGroup/index.js +0 -55
  68. package/lib/components/FormGroup/index.js.map +1 -1
  69. package/lib/components/FormLayout/index.js +0 -1
  70. package/lib/components/HelpBubble/index.js +3 -20
  71. package/lib/components/HelpBubble/index.js.map +1 -1
  72. package/lib/components/HelpDrawer/index.js +0 -36
  73. package/lib/components/HelpDrawer/index.js.map +1 -1
  74. package/lib/components/HelpExpanderInline/index.js +0 -2
  75. package/lib/components/HelpExpanderInline/index.js.map +1 -1
  76. package/lib/components/HelpExpanderStandalone/index.js +0 -6
  77. package/lib/components/HelpExpanderStandalone/index.js.map +1 -1
  78. package/lib/components/HelpPanel/index.js +0 -32
  79. package/lib/components/HelpPanel/index.js.map +1 -1
  80. package/lib/components/HelpTeaser/HelpTeaser.d.ts +2 -0
  81. package/lib/components/HelpTeaser/index.js +2 -9
  82. package/lib/components/HelpTeaser/index.js.map +1 -1
  83. package/lib/components/HelpTooltip/index.js +0 -2
  84. package/lib/components/HelpTooltip/index.js.map +1 -1
  85. package/lib/components/HelpTriggerIcon/index.js +0 -4
  86. package/lib/components/HelpTriggerInline/index.js.map +1 -1
  87. package/lib/components/HelpTriggerStandalone/index.js +0 -8
  88. package/lib/components/HighlightPanel/index.js +0 -32
  89. package/lib/components/Highlighter/index.js +0 -8
  90. package/lib/components/HorizontalScroll/index.js +0 -5
  91. package/lib/components/Icons/AlarmClock.js +0 -1
  92. package/lib/components/Icons/AlarmClock.js.map +1 -1
  93. package/lib/components/Icons/AlertSignFill.js +0 -2
  94. package/lib/components/Icons/AlertSignStroke.js +0 -2
  95. package/lib/components/Icons/Archive.js +0 -1
  96. package/lib/components/Icons/Archive.js.map +1 -1
  97. package/lib/components/Icons/ArrowDown.js +0 -2
  98. package/lib/components/Icons/ArrowLeft.js +0 -1
  99. package/lib/components/Icons/ArrowLeft.js.map +1 -1
  100. package/lib/components/Icons/ArrowRight.js +0 -2
  101. package/lib/components/Icons/ArrowUp.js +0 -2
  102. package/lib/components/Icons/ArrowUpRight.js +0 -2
  103. package/lib/components/Icons/Attachment.js +0 -1
  104. package/lib/components/Icons/Attachment.js.map +1 -1
  105. package/lib/components/Icons/Avatar.js +0 -1
  106. package/lib/components/Icons/Avatar.js.map +1 -1
  107. package/lib/components/Icons/Braille.js +0 -1
  108. package/lib/components/Icons/Braille.js.map +1 -1
  109. package/lib/components/Icons/Bus.js +0 -1
  110. package/lib/components/Icons/Bus.js.map +1 -1
  111. package/lib/components/Icons/Calendar.js +0 -2
  112. package/lib/components/Icons/CalendarChange.js +0 -1
  113. package/lib/components/Icons/CalendarChange.js.map +1 -1
  114. package/lib/components/Icons/CalendarCheck.js +0 -1
  115. package/lib/components/Icons/CalendarCheck.js.map +1 -1
  116. package/lib/components/Icons/CalendarSave.js +0 -1
  117. package/lib/components/Icons/CalendarSave.js.map +1 -1
  118. package/lib/components/Icons/Candle.js +0 -1
  119. package/lib/components/Icons/Candle.js.map +1 -1
  120. package/lib/components/Icons/Change.js +0 -1
  121. package/lib/components/Icons/Change.js.map +1 -1
  122. package/lib/components/Icons/Check.js +0 -2
  123. package/lib/components/Icons/CheckFill.js +0 -2
  124. package/lib/components/Icons/ChevronDown.js +0 -2
  125. package/lib/components/Icons/ChevronLeft.js +0 -2
  126. package/lib/components/Icons/ChevronRight.js +0 -2
  127. package/lib/components/Icons/ChevronUp.js +0 -2
  128. package/lib/components/Icons/ChevronsDown.js +0 -1
  129. package/lib/components/Icons/ChevronsDown.js.map +1 -1
  130. package/lib/components/Icons/ChevronsUp.js +0 -1
  131. package/lib/components/Icons/ChevronsUp.js.map +1 -1
  132. package/lib/components/Icons/Contacts.js +0 -1
  133. package/lib/components/Icons/Contacts.js.map +1 -1
  134. package/lib/components/Icons/Copy.js +0 -1
  135. package/lib/components/Icons/Copy.js.map +1 -1
  136. package/lib/components/Icons/DotActive.js +0 -1
  137. package/lib/components/Icons/DotActive.js.map +1 -1
  138. package/lib/components/Icons/DotAlert.js +0 -1
  139. package/lib/components/Icons/DotAlert.js.map +1 -1
  140. package/lib/components/Icons/DotCancelled.js +0 -1
  141. package/lib/components/Icons/DotCancelled.js.map +1 -1
  142. package/lib/components/Icons/DotHalfDisc.js +0 -1
  143. package/lib/components/Icons/DotHalfDisc.js.map +1 -1
  144. package/lib/components/Icons/DotInactive.js +0 -1
  145. package/lib/components/Icons/DotInactive.js.map +1 -1
  146. package/lib/components/Icons/DotInfo.js +0 -1
  147. package/lib/components/Icons/DotInfo.js.map +1 -1
  148. package/lib/components/Icons/DotLookingGlass.js +0 -1
  149. package/lib/components/Icons/DotLookingGlass.js.map +1 -1
  150. package/lib/components/Icons/DotPending.js +0 -1
  151. package/lib/components/Icons/DotPending.js.map +1 -1
  152. package/lib/components/Icons/DotQuestionMark.js +0 -1
  153. package/lib/components/Icons/DotQuestionMark.js.map +1 -1
  154. package/lib/components/Icons/DotSuccess.js +0 -1
  155. package/lib/components/Icons/DotSuccess.js.map +1 -1
  156. package/lib/components/Icons/DotTransparent.js +0 -1
  157. package/lib/components/Icons/DotTransparent.js.map +1 -1
  158. package/lib/components/Icons/DotWarningTriangle.js +0 -1
  159. package/lib/components/Icons/DotWarningTriangle.js.map +1 -1
  160. package/lib/components/Icons/Download.js +0 -1
  161. package/lib/components/Icons/Download.js.map +1 -1
  162. package/lib/components/Icons/Drag.js +0 -1
  163. package/lib/components/Icons/Drag.js.map +1 -1
  164. package/lib/components/Icons/EChat.js +0 -1
  165. package/lib/components/Icons/EChat.js.map +1 -1
  166. package/lib/components/Icons/Ear.js +0 -1
  167. package/lib/components/Icons/Ear.js.map +1 -1
  168. package/lib/components/Icons/EarDeaf.js +0 -1
  169. package/lib/components/Icons/EarDeaf.js.map +1 -1
  170. package/lib/components/Icons/EarHearingAid.js +0 -1
  171. package/lib/components/Icons/EarHearingAid.js.map +1 -1
  172. package/lib/components/Icons/EarVolume.js +0 -1
  173. package/lib/components/Icons/EarVolume.js.map +1 -1
  174. package/lib/components/Icons/Edit.js +0 -1
  175. package/lib/components/Icons/Edit.js.map +1 -1
  176. package/lib/components/Icons/EmergencyCall.js +0 -1
  177. package/lib/components/Icons/EmergencyCall.js.map +1 -1
  178. package/lib/components/Icons/EmoticonAnnoyed.js +0 -1
  179. package/lib/components/Icons/EmoticonAnnoyed.js.map +1 -1
  180. package/lib/components/Icons/EmoticonDelighted.js +0 -1
  181. package/lib/components/Icons/EmoticonDelighted.js.map +1 -1
  182. package/lib/components/Icons/EmoticonDisappointed.js +0 -1
  183. package/lib/components/Icons/EmoticonDisappointed.js.map +1 -1
  184. package/lib/components/Icons/EmoticonHappy.js +0 -1
  185. package/lib/components/Icons/EmoticonHappy.js.map +1 -1
  186. package/lib/components/Icons/EmoticonMeh.js +0 -1
  187. package/lib/components/Icons/EmoticonMeh.js.map +1 -1
  188. package/lib/components/Icons/EnterFullScreen.js +0 -1
  189. package/lib/components/Icons/EnterFullScreen.js.map +1 -1
  190. package/lib/components/Icons/Envelope.js +0 -1
  191. package/lib/components/Icons/Envelope.js.map +1 -1
  192. package/lib/components/Icons/Eraser.js +0 -1
  193. package/lib/components/Icons/Eraser.js.map +1 -1
  194. package/lib/components/Icons/ErrorSignFill.js +0 -2
  195. package/lib/components/Icons/ErrorSignStroke.js +0 -1
  196. package/lib/components/Icons/ErrorSignStroke.js.map +1 -1
  197. package/lib/components/Icons/ExitFullScreen.js +0 -1
  198. package/lib/components/Icons/ExitFullScreen.js.map +1 -1
  199. package/lib/components/Icons/Eye.js +0 -1
  200. package/lib/components/Icons/Eye.js.map +1 -1
  201. package/lib/components/Icons/FallingLeaf.js +0 -1
  202. package/lib/components/Icons/FallingLeaf.js.map +1 -1
  203. package/lib/components/Icons/File.js +0 -1
  204. package/lib/components/Icons/File.js.map +1 -1
  205. package/lib/components/Icons/Filter.js +0 -1
  206. package/lib/components/Icons/Filter.js.map +1 -1
  207. package/lib/components/Icons/Form.js +0 -1
  208. package/lib/components/Icons/Form.js.map +1 -1
  209. package/lib/components/Icons/Forward.js +0 -2
  210. package/lib/components/Icons/Gallery.js +0 -1
  211. package/lib/components/Icons/Gallery.js.map +1 -1
  212. package/lib/components/Icons/Glasses.js +0 -1
  213. package/lib/components/Icons/Glasses.js.map +1 -1
  214. package/lib/components/Icons/Globe.js +0 -1
  215. package/lib/components/Icons/Globe.js.map +1 -1
  216. package/lib/components/Icons/Graph.js +0 -1
  217. package/lib/components/Icons/Graph.js.map +1 -1
  218. package/lib/components/Icons/Group.js +0 -1
  219. package/lib/components/Icons/Group.js.map +1 -1
  220. package/lib/components/Icons/GroupTwins.js +0 -1
  221. package/lib/components/Icons/GroupTwins.js.map +1 -1
  222. package/lib/components/Icons/HTMLFile.js +0 -1
  223. package/lib/components/Icons/HTMLFile.js.map +1 -1
  224. package/lib/components/Icons/HandsAndHeart.js +0 -1
  225. package/lib/components/Icons/HandsAndHeart.js.map +1 -1
  226. package/lib/components/Icons/HealthcarePerson.js +0 -1
  227. package/lib/components/Icons/HealthcarePerson.js.map +1 -1
  228. package/lib/components/Icons/HealthcarePersonell.js +0 -1
  229. package/lib/components/Icons/HealthcarePersonell.js.map +1 -1
  230. package/lib/components/Icons/HearingProtection.js +0 -1
  231. package/lib/components/Icons/HearingProtection.js.map +1 -1
  232. package/lib/components/Icons/Heart.js +0 -1
  233. package/lib/components/Icons/Heart.js.map +1 -1
  234. package/lib/components/Icons/HelpSign.js +0 -1
  235. package/lib/components/Icons/HelpSign.js.map +1 -1
  236. package/lib/components/Icons/History.js +0 -1
  237. package/lib/components/Icons/History.js.map +1 -1
  238. package/lib/components/Icons/Home.js +0 -1
  239. package/lib/components/Icons/Home.js.map +1 -1
  240. package/lib/components/Icons/HomeFill.js +0 -1
  241. package/lib/components/Icons/HomeFill.js.map +1 -1
  242. package/lib/components/Icons/Hospital.js +0 -1
  243. package/lib/components/Icons/Hospital.js.map +1 -1
  244. package/lib/components/Icons/Hourglass.js +0 -1
  245. package/lib/components/Icons/Hourglass.js.map +1 -1
  246. package/lib/components/Icons/InfoSignFill.js +0 -2
  247. package/lib/components/Icons/InfoSignStroke.js +0 -1
  248. package/lib/components/Icons/InfoSignStroke.js.map +1 -1
  249. package/lib/components/Icons/Journal.js +0 -1
  250. package/lib/components/Icons/Journal.js.map +1 -1
  251. package/lib/components/Icons/LegalDocument.js +0 -1
  252. package/lib/components/Icons/LegalDocument.js.map +1 -1
  253. package/lib/components/Icons/List.js +0 -1
  254. package/lib/components/Icons/List.js.map +1 -1
  255. package/lib/components/Icons/Location.js +0 -1
  256. package/lib/components/Icons/Location.js.map +1 -1
  257. package/lib/components/Icons/LocationFill.js +0 -1
  258. package/lib/components/Icons/LocationFill.js.map +1 -1
  259. package/lib/components/Icons/Lock.js +0 -1
  260. package/lib/components/Icons/Lock.js.map +1 -1
  261. package/lib/components/Icons/Login.js +0 -1
  262. package/lib/components/Icons/Login.js.map +1 -1
  263. package/lib/components/Icons/Logout.js +0 -1
  264. package/lib/components/Icons/Logout.js.map +1 -1
  265. package/lib/components/Icons/MaleDoctorCompact.js +0 -1
  266. package/lib/components/Icons/MaleDoctorCompact.js.map +1 -1
  267. package/lib/components/Icons/MaleDoctorCompactFill.js +0 -1
  268. package/lib/components/Icons/MaleDoctorCompactFill.js.map +1 -1
  269. package/lib/components/Icons/Medicine.js +0 -1
  270. package/lib/components/Icons/Medicine.js.map +1 -1
  271. package/lib/components/Icons/Menu.js +0 -1
  272. package/lib/components/Icons/Menu.js.map +1 -1
  273. package/lib/components/Icons/Minus.js +0 -1
  274. package/lib/components/Icons/Minus.js.map +1 -1
  275. package/lib/components/Icons/MobilePhone.js +0 -1
  276. package/lib/components/Icons/MobilePhone.js.map +1 -1
  277. package/lib/components/Icons/NoAccess.js +0 -1
  278. package/lib/components/Icons/NoAccess.js.map +1 -1
  279. package/lib/components/Icons/NoEye.js +0 -1
  280. package/lib/components/Icons/NoEye.js.map +1 -1
  281. package/lib/components/Icons/NoFilter.js +0 -1
  282. package/lib/components/Icons/NoFilter.js.map +1 -1
  283. package/lib/components/Icons/PaperPlane.js +0 -1
  284. package/lib/components/Icons/PaperPlane.js.map +1 -1
  285. package/lib/components/Icons/Pause.js +0 -1
  286. package/lib/components/Icons/Pause.js.map +1 -1
  287. package/lib/components/Icons/Pencil.js +0 -2
  288. package/lib/components/Icons/PersonCancel.js +0 -1
  289. package/lib/components/Icons/PersonCancel.js.map +1 -1
  290. package/lib/components/Icons/PersonalPlan.js +0 -1
  291. package/lib/components/Icons/PersonalPlan.js.map +1 -1
  292. package/lib/components/Icons/Play.js +0 -1
  293. package/lib/components/Icons/Play.js.map +1 -1
  294. package/lib/components/Icons/PlusLarge.js +0 -1
  295. package/lib/components/Icons/PlusLarge.js.map +1 -1
  296. package/lib/components/Icons/PlusSmall.js +0 -2
  297. package/lib/components/Icons/Printer.js +0 -1
  298. package/lib/components/Icons/Printer.js.map +1 -1
  299. package/lib/components/Icons/QrCode.js +0 -1
  300. package/lib/components/Icons/QrCode.js.map +1 -1
  301. package/lib/components/Icons/Receptionist.js +0 -1
  302. package/lib/components/Icons/Receptionist.js.map +1 -1
  303. package/lib/components/Icons/Referral.js +0 -1
  304. package/lib/components/Icons/Referral.js.map +1 -1
  305. package/lib/components/Icons/Refresh.js +0 -1
  306. package/lib/components/Icons/Refresh.js.map +1 -1
  307. package/lib/components/Icons/Reply.js +0 -1
  308. package/lib/components/Icons/Reply.js.map +1 -1
  309. package/lib/components/Icons/Save.js +0 -1
  310. package/lib/components/Icons/Save.js.map +1 -1
  311. package/lib/components/Icons/ScreenReader.js +0 -1
  312. package/lib/components/Icons/ScreenReader.js.map +1 -1
  313. package/lib/components/Icons/Search.js +0 -1
  314. package/lib/components/Icons/Search.js.map +1 -1
  315. package/lib/components/Icons/SectionSign.js +0 -1
  316. package/lib/components/Icons/SectionSign.js.map +1 -1
  317. package/lib/components/Icons/Settings.js +0 -1
  318. package/lib/components/Icons/Settings.js.map +1 -1
  319. package/lib/components/Icons/SettingsFill.js +0 -1
  320. package/lib/components/Icons/SettingsFill.js.map +1 -1
  321. package/lib/components/Icons/Share.js +0 -1
  322. package/lib/components/Icons/Share.js.map +1 -1
  323. package/lib/components/Icons/SortDown.js +0 -1
  324. package/lib/components/Icons/SortDown.js.map +1 -1
  325. package/lib/components/Icons/SortUp.js +0 -1
  326. package/lib/components/Icons/SortUp.js.map +1 -1
  327. package/lib/components/Icons/SpeechBubble.js +0 -1
  328. package/lib/components/Icons/SpeechBubble.js.map +1 -1
  329. package/lib/components/Icons/Stopwatch.js +0 -1
  330. package/lib/components/Icons/Stopwatch.js.map +1 -1
  331. package/lib/components/Icons/Sun.js +0 -1
  332. package/lib/components/Icons/Sun.js.map +1 -1
  333. package/lib/components/Icons/SupportingPerson.js +0 -1
  334. package/lib/components/Icons/SupportingPerson.js.map +1 -1
  335. package/lib/components/Icons/TimePassing.js +0 -1
  336. package/lib/components/Icons/TimePassing.js.map +1 -1
  337. package/lib/components/Icons/Tombstone.js +0 -1
  338. package/lib/components/Icons/Tombstone.js.map +1 -1
  339. package/lib/components/Icons/Toolbox.js +0 -1
  340. package/lib/components/Icons/Toolbox.js.map +1 -1
  341. package/lib/components/Icons/TrashCan.js +0 -1
  342. package/lib/components/Icons/TrashCan.js.map +1 -1
  343. package/lib/components/Icons/TreatmentAids.js +0 -1
  344. package/lib/components/Icons/TreatmentAids.js.map +1 -1
  345. package/lib/components/Icons/TriangleX.js +0 -2
  346. package/lib/components/Icons/Undo.js +0 -2
  347. package/lib/components/Icons/Upload.js +0 -1
  348. package/lib/components/Icons/Upload.js.map +1 -1
  349. package/lib/components/Icons/Vaccine.js +0 -1
  350. package/lib/components/Icons/Vaccine.js.map +1 -1
  351. package/lib/components/Icons/VerticalDots.js +0 -2
  352. package/lib/components/Icons/VideoCamera.js +0 -1
  353. package/lib/components/Icons/VideoCamera.js.map +1 -1
  354. package/lib/components/Icons/VideoChat.js +0 -1
  355. package/lib/components/Icons/VideoChat.js.map +1 -1
  356. package/lib/components/Icons/Wallet.js +0 -1
  357. package/lib/components/Icons/Wallet.js.map +1 -1
  358. package/lib/components/Icons/Watch.js +0 -2
  359. package/lib/components/Icons/X.js +0 -2
  360. package/lib/components/Icons/Zoom.js +0 -1
  361. package/lib/components/Icons/Zoom.js.map +1 -1
  362. package/lib/components/Icons/ZoomInLeft.js +0 -1
  363. package/lib/components/Icons/ZoomInLeft.js.map +1 -1
  364. package/lib/components/Icons/ZoomOutLeft.js +0 -1
  365. package/lib/components/Icons/ZoomOutLeft.js.map +1 -1
  366. package/lib/components/Illustration/index.js +0 -2
  367. package/lib/components/Illustrations/BabyMobile.js +0 -2
  368. package/lib/components/Illustrations/BabyMobile.js.map +1 -1
  369. package/lib/components/Illustrations/BabyMobileMedium.js +0 -3
  370. package/lib/components/Illustrations/Child.js +0 -2
  371. package/lib/components/Illustrations/Child.js.map +1 -1
  372. package/lib/components/Illustrations/ChildMedium.js +0 -3
  373. package/lib/components/Illustrations/FacialRecognitionFingerprint.js +0 -2
  374. package/lib/components/Illustrations/FacialRecognitionFingerprint.js.map +1 -1
  375. package/lib/components/Illustrations/FacialRecognitionFingerprintMedium.js +0 -3
  376. package/lib/components/Illustrations/GiveBabyFood.js +0 -2
  377. package/lib/components/Illustrations/GiveBabyFood.js.map +1 -1
  378. package/lib/components/Illustrations/GiveBabyFoodMedium.js +0 -3
  379. package/lib/components/Illustrations/ReadLetters.js +0 -2
  380. package/lib/components/Illustrations/ReadLetters.js.map +1 -1
  381. package/lib/components/Illustrations/ReadLettersMedium.js +0 -3
  382. package/lib/components/Illustrations/Stroller.js +0 -2
  383. package/lib/components/Illustrations/Stroller.js.map +1 -1
  384. package/lib/components/Illustrations/StrollerMedium.js +0 -3
  385. package/lib/components/Illustrations/Support2.js +0 -2
  386. package/lib/components/Illustrations/Support2.js.map +1 -1
  387. package/lib/components/Illustrations/Support2Medium.js +0 -3
  388. package/lib/components/InfoTeaser/InfoTeaser.d.ts +2 -0
  389. package/lib/components/InfoTeaser/index.js +0 -8
  390. package/lib/components/InfoTeaser/styles.module.scss +0 -2
  391. package/lib/components/Input/Input.d.ts +2 -2
  392. package/lib/components/Input/index.js +0 -44
  393. package/lib/components/Label/Label.d.ts +1 -1
  394. package/lib/components/Label/index.js +0 -38
  395. package/lib/components/LazyIcon/index.js +0 -4
  396. package/lib/components/LazyIllustration/index.js +0 -6
  397. package/lib/components/LinkList/LinkList.d.ts +4 -3
  398. package/lib/components/LinkList/index.js +0 -53
  399. package/lib/components/LinkList/styles.module.scss +1 -0
  400. package/lib/components/List/index.js +0 -1
  401. package/lib/components/ListEditMode/index.js +0 -4
  402. package/lib/components/Loader/index.js +0 -1
  403. package/lib/components/Loader/index.js.map +1 -1
  404. package/lib/components/Logo/index.js +0 -4
  405. package/lib/components/Logo/index.js.map +1 -1
  406. package/lib/components/Modal/index.js +0 -21
  407. package/lib/components/Modal/index.js.map +1 -1
  408. package/lib/components/NotificationPanel/index.js +0 -28
  409. package/lib/components/NotificationPanel/index.js.map +1 -1
  410. package/lib/components/Panel/PanelTitle/index.js +0 -11
  411. package/lib/components/Panel/PanelTitle/styles.module.scss +0 -1
  412. package/lib/components/Panel/index.js +0 -31
  413. package/lib/components/Panel/index.js.map +1 -1
  414. package/lib/components/PanelList/PanelList.d.ts +6 -0
  415. package/lib/components/PanelList/index.js +3 -53
  416. package/lib/components/PanelList/index.js.map +1 -1
  417. package/lib/components/PanelListOld/index.js +0 -34
  418. package/lib/components/PanelListOld/index.js.map +1 -1
  419. package/lib/components/PanelOld/index.js +0 -35
  420. package/lib/components/PopMenu/index.js +0 -50
  421. package/lib/components/PopMenu/index.js.map +1 -1
  422. package/lib/components/PopOver/PopOver.d.ts +1 -1
  423. package/lib/components/PopOver/index.js +0 -3
  424. package/lib/components/Portal/index.js +0 -1
  425. package/lib/components/PromoPanel/index.js +0 -10
  426. package/lib/components/PromoPanel/index.js.map +1 -1
  427. package/lib/components/RadioButton/index.js +0 -43
  428. package/lib/components/Select/index.js +0 -43
  429. package/lib/components/Select/styles.module.scss +2 -0
  430. package/lib/components/ServiceMessage/index.js +0 -43
  431. package/lib/components/ServiceMessage/index.js.map +1 -1
  432. package/lib/components/Slider/index.js +0 -10
  433. package/lib/components/Spacer/index.js +0 -1
  434. package/lib/components/StatusDot/index.js +0 -33
  435. package/lib/components/StepButtons/index.js +0 -1
  436. package/lib/components/Stepper/index.js +0 -1
  437. package/lib/components/Stepper/index.js.map +1 -1
  438. package/lib/components/StickyNote/index.js +0 -3
  439. package/lib/components/StickyNote/index.js.map +1 -1
  440. package/lib/components/Table/TableBody/index.js +0 -13
  441. package/lib/components/Table/TableCell/index.js +0 -13
  442. package/lib/components/Table/TableExpandedRow/index.js +0 -29
  443. package/lib/components/Table/TableExpanderCell/index.js +0 -30
  444. package/lib/components/Table/TableHead/index.js +0 -13
  445. package/lib/components/Table/TableHeadCell/index.js +0 -16
  446. package/lib/components/Table/TableRow/index.js +0 -30
  447. package/lib/components/Table/index.js +0 -31
  448. package/lib/components/Table/index.js.map +1 -1
  449. package/lib/components/Tabs/TabList/index.js +0 -14
  450. package/lib/components/Tabs/index.js +0 -13
  451. package/lib/components/Tabs/index.js.map +1 -1
  452. package/lib/components/Tag/index.js +0 -2
  453. package/lib/components/Tag/index.js.map +1 -1
  454. package/lib/components/Textarea/Textarea.d.ts +1 -1
  455. package/lib/components/Textarea/index.js +0 -43
  456. package/lib/components/Tile/index.js +0 -2
  457. package/lib/components/Tile/index.js.map +1 -1
  458. package/lib/components/Title/index.js +0 -1
  459. package/lib/components/Toast/index.js +0 -10
  460. package/lib/components/Toast/index.js.map +1 -1
  461. package/lib/components/ToastList/index.js +0 -9
  462. package/lib/components/ToastList/index.js.map +1 -1
  463. package/lib/components/Toggle/index.js +1 -1
  464. package/lib/components/Toggle/index.js.map +1 -1
  465. package/lib/components/Validation/index.js +0 -51
  466. package/lib/components/Validation/index.js.map +1 -1
  467. package/lib/constants.d.ts +2 -1
  468. package/lib/constants2.js +1 -0
  469. package/lib/constants2.js.map +1 -1
  470. package/lib/floating-ui.react.js +65 -61
  471. package/lib/floating-ui.react.js.map +1 -1
  472. package/lib/hoc/withBreakpoint/index.js +0 -2
  473. package/lib/hoc/withBreakpoint/index.js.map +1 -1
  474. package/lib/hoc/withBreakpoint/withBreakpoint.js +0 -2
  475. package/lib/hooks/useBreakpoint.js +0 -1
  476. package/lib/hooks/useExpand.js +0 -1
  477. package/lib/hooks/useFocusToggle.js +0 -2
  478. package/lib/hooks/useFocusTrap.js +0 -3
  479. package/lib/hooks/useFocusableElements.js +0 -1
  480. package/lib/hooks/useIcons.js +0 -6
  481. package/lib/hooks/useIsMobileBreakpoint.js +0 -2
  482. package/lib/hooks/useIsVisible.js +0 -1
  483. package/lib/hooks/useLayoutEvent.js +0 -1
  484. package/lib/hooks/useReturnFocusOnUnmount.js +0 -2
  485. package/lib/hooks/useRovingFocus.js +0 -2
  486. package/lib/hooks/useSize.js +0 -1
  487. package/lib/hooks/useToggle.js +0 -1
  488. package/lib/index.js +0 -9
  489. package/lib/theme/currys/color.js +0 -4
  490. package/lib/theme/currys/index.js +0 -5
  491. package/lib/theme/currys/spacing.js +0 -1
  492. package/lib/theme/index.js +0 -3
  493. package/lib/utils/uuid.js +0 -1
  494. package/lib/uuid.js +1 -1
  495. package/package.json +4 -9
  496. package/lib/scss/_figma-tokens.scss +0 -68
  497. package/scss/_figma-tokens.scss +0 -68
@@ -1 +1 @@
1
- {"version":3,"file":"PanelOld.js","names":["StatusText: React.FC<{ status?: keyof typeof PanelOldStatus; statusMessage?: string }>","PreContainer: React.FC<{ children?: React.ReactNode }>","DateTime: React.FC<{ date?: string; time?: string }>","PanelLayout1: React.FC<LayoutProps>","PanelLayout2: React.FC<LayoutProps>","PanelLayout3: React.FC<LayoutProps>","commonProps: Partial<ButtonProps> & AriaLabelAttributes","layoutProps: LayoutProps"],"sources":["../src/components/PanelOld/PanelOld.tsx","../src/components/PanelOld/index.tsx"],"sourcesContent":["import React, { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnchorTarget, AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { palette } from '../../theme/palette';\nimport { AriaLabelAttributes, getAriaLabelAttributes } from '../../utils/accessibility';\nimport Badge from '../Badge';\nimport Button, { ButtonProps, ButtonTags } from '../Button';\nimport Icon, { IconSize, SvgPathProps } from '../Icon';\nimport AlertSignFill from '../Icons/AlertSignFill';\nimport ArrowRight from '../Icons/ArrowRight';\nimport Calendar from '../Icons/Calendar';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport Pencil from '../Icons/Pencil';\nimport Watch from '../Icons/Watch';\nimport Title, { TitleTags } from '../Title';\n\nimport panelStyles from './styles.module.scss';\n\nexport enum PanelOldStatus {\n normal = 'normal',\n new = 'new',\n error = 'error',\n draft = 'draft',\n}\n\nexport enum PanelOldVariant {\n fill = 'fill',\n white = 'white',\n stroke = 'stroke',\n line = 'line',\n}\n\nexport enum PanelOldLayout {\n layout1 = 'layout1',\n layout2 = 'layout2',\n layout3a = 'layout3a',\n layout3b = 'layout3b',\n layout3c = 'layout3c',\n}\n\nexport interface PanelOldProps {\n /** Adds custom classes to the element. */\n className?: string;\n /** Panel section A content */\n contentA?: React.ReactNode | string;\n /** Panel section B content */\n contentB?: React.ReactNode | string;\n /** Content for a container that renders above A and B regardless of layout */\n contentHeader?: React.ReactNode;\n /** Container acts as a button, clicking anywhere triggers a panel button click */\n containerAsButton?: boolean;\n /** Panel children */\n children?: React.ReactNode;\n /** Displays date with icon */\n date?: string;\n /** Expands or collapses the panel */\n expanded?: boolean;\n /** Whether the panel can be focused */\n focusable?: boolean;\n /** Icon displayed in title */\n icon?: React.ReactNode;\n /** Panel button text */\n buttonText?: string;\n /** Panel button close text */\n buttonTextClose?: string;\n /** HTML markup for panel button. Default: a */\n buttonHtmlMarkup?: ButtonTags;\n /** Callback when the panel button is clicked */\n buttonOnClick?: ButtonProps['onClick'];\n /** Panel button is aria-labelledby the text in the button itself + the element set in buttonAriaLabelledById. Default: auto-generated id for title (if title is set). */\n buttonAriaLabelledById?: string;\n /** Panel button aria label */\n buttonAriaLabel?: string;\n /** Layout of the panel */\n layout?: keyof typeof PanelOldLayout;\n /** Removes top border when variant is \"line\" */\n noTopBorder?: boolean;\n /** Called when the panel is opened/closed */\n onExpand?: (isExpanded: boolean) => void;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Displays a status on the left side: default normal */\n status?: keyof typeof PanelOldStatus;\n /** Displayed on top of the panel with a status icon */\n statusMessage?: string;\n /** Sets the data-testid attribute for testing purposes */\n testId?: string;\n /** Displays time with icon */\n time?: string;\n /** Title of the panel */\n title?: string;\n /** Changes the underlying element of the title. Default: h2 */\n titleHtmlMarkup?: TitleTags;\n /** Changes the visual representation of the panel */\n variant?: keyof typeof PanelOldVariant;\n /** URL to details, renders as a button with anchor tag */\n url?: string;\n /** target used in the button: default is _self */\n target?: AnchorTarget;\n}\n\nexport interface LayoutProps\n extends Pick<PanelOldProps, 'contentA' | 'contentB' | 'contentHeader' | 'icon' | 'layout' | 'status' | 'statusMessage'> {\n ctaContainer?: React.ReactNode;\n titleElement: React.ReactNode;\n}\n\nconst StatusText: React.FC<{ status?: keyof typeof PanelOldStatus; statusMessage?: string }> = ({ status, statusMessage }) => {\n const statusIcon = (): { color: string; svgIcon: React.FC<SvgPathProps> } => {\n if (status === PanelOldStatus.error) {\n return { color: palette.cherry500, svgIcon: AlertSignFill };\n }\n\n return { color: palette.black, svgIcon: Pencil };\n };\n\n const statusMessageClass = classNames(panelStyles['status-message'], {\n [panelStyles['status-message--new']]: status === PanelOldStatus.new,\n });\n\n if ((status === PanelOldStatus.error || status === PanelOldStatus.draft) && statusMessage) {\n return (\n <div className={statusMessageClass} data-testid=\"display-status\">\n {<Icon {...statusIcon()} size={IconSize.XSmall} />} <span>{statusMessage}</span>\n </div>\n );\n }\n\n return null;\n};\n\nconst PreContainer: React.FC<{ children?: React.ReactNode }> = ({ children }) => {\n if (typeof children === 'undefined') return null;\n return <div className={panelStyles['header-container']}>{children}</div>;\n};\n\nconst DateTime: React.FC<{ date?: string; time?: string }> = ({ date, time }) => {\n if (date || time) {\n return (\n <div className={panelStyles['datetime-container']} data-testid=\"datetime\">\n {date && (\n <div className={panelStyles['datetime-container__icon']}>\n <Icon svgIcon={Calendar} size={IconSize.XSmall} />\n <span>{date}</span>\n </div>\n )}\n {time && (\n <div className={panelStyles['datetime-container__icon']}>\n <Icon svgIcon={Watch} size={IconSize.XSmall} />\n <span>{time}</span>\n </div>\n )}\n </div>\n );\n }\n\n return null;\n};\n\nconst PanelLayout1: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n status,\n statusMessage,\n titleElement,\n}) => {\n const panelLayoutClasses = classNames(panelStyles['panel__layout-1'], {\n [panelStyles['panel__layout-1--with-icon']]: icon,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-1'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n\n return (\n <div className={panelLayoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div className={panelStyles['panel__layout-1__content-a']}>\n {titleElement}\n {contentA}\n </div>\n {contentB && <div>{contentB}</div>}\n {ctaContainer}\n </div>\n );\n};\n\nconst PanelLayout2: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n status,\n statusMessage,\n titleElement,\n}) => {\n const panelLayoutClasses = classNames(panelStyles['panel__layout-2'], {\n [panelStyles['panel__layout-2--with-icon']]: icon,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-2'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n const lastColumnClass = panelStyles['panel__layout-2__last-column'];\n\n return (\n <div className={panelLayoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div className={panelStyles['panel__layout-2__content-a']}>\n {titleElement}\n {contentA}\n </div>\n {contentB && <div className={lastColumnClass}>{contentB}</div>}\n {ctaContainer && <div className={lastColumnClass}>{ctaContainer}</div>}\n </div>\n );\n};\n\nconst PanelLayout3: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n layout,\n status,\n statusMessage,\n titleElement,\n}) => {\n const layoutClasses = classNames(panelStyles['panel__layout-3'], {\n [panelStyles['panel__layout-3--with-icon']]: icon,\n [panelStyles['panel__layout-3--a']]: layout === PanelOldLayout.layout3a,\n [panelStyles['panel__layout-3--b']]: layout === PanelOldLayout.layout3b,\n [panelStyles['panel__layout-3--c']]: layout === PanelOldLayout.layout3c,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-3'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n\n return (\n <div className={layoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div>\n {titleElement}\n {contentA}\n </div>\n <div className={panelStyles['panel__layout-3__last-column']}>\n {contentB && <div className={panelStyles['panel__layout-3__last-column__content-b']}>{contentB}</div>}\n {ctaContainer}\n </div>\n </div>\n );\n};\n\nconst PanelOld = React.forwardRef(function PanelForwardedRef(props: PanelOldProps, ref: React.ForwardedRef<HTMLHeadingElement>) {\n const {\n buttonAriaLabel,\n buttonAriaLabelledById,\n buttonText = 'Se detaljer',\n buttonTextClose = 'Skjul detaljer',\n buttonHtmlMarkup = 'a',\n buttonOnClick,\n children,\n className,\n containerAsButton = false,\n contentA,\n contentB,\n contentHeader,\n date,\n expanded = false,\n focusable = false,\n icon,\n layout = PanelOldLayout.layout2,\n noTopBorder,\n onExpand,\n renderChildrenWhenClosed = false,\n status = PanelOldStatus.normal,\n statusMessage,\n target = '_self',\n testId,\n time,\n title,\n titleHtmlMarkup = 'h2',\n url,\n variant = PanelOldVariant.fill,\n } = props;\n\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const titleId = useId();\n const buttonTextId = useId();\n const hasBadge = statusMessage && status === PanelOldStatus.new;\n const noContentB = typeof contentB === 'undefined';\n const layout1 = layout === 'layout1' || noContentB;\n const layout2 = !noContentB && layout === 'layout2';\n const layout3 = !noContentB && (layout === 'layout3a' || layout === 'layout3b' || layout === 'layout3c');\n const panelWrapperClasses = classNames(panelStyles['panel-wrapper'], className);\n\n const panelClasses = classNames(panelStyles.panel, {\n [panelStyles['panel--fill']]: variant === PanelOldVariant.fill,\n [panelStyles['panel--stroke']]: variant === PanelOldVariant.stroke,\n [panelStyles['panel--white']]: variant === PanelOldVariant.white,\n [panelStyles['panel--line']]: variant === PanelOldVariant.line,\n [panelStyles['panel--no-top-border']]: variant === PanelOldVariant.line && noTopBorder,\n [panelStyles['panel--selected']]: isExpanded,\n [panelStyles['panel--new']]: status === PanelOldStatus.new,\n [panelStyles['panel--draft']]: status === PanelOldStatus.draft,\n [panelStyles['panel--error']]: status === PanelOldStatus.error,\n [panelStyles['panel--status']]: status && status !== PanelOldStatus.normal,\n [panelStyles['panel--with-icon']]: icon,\n [panelStyles['panel--button']]: containerAsButton,\n [panelStyles['panel--clickable']]: children || url || onExpand || buttonOnClick || containerAsButton,\n });\n\n const renderCTAContainer = () => {\n const hasButton = children || url || buttonOnClick;\n const btnContainerClasses = classNames(panelStyles['panel__btn-container'], {\n [panelStyles['panel__btn-container--no-content-b']]: noContentB,\n [panelStyles['panel__btn-container--no-button']]: !hasButton,\n });\n\n return (\n (hasButton || date || time) && (\n <div className={btnContainerClasses}>\n {<DateTime date={date} time={time} />}\n {hasButton && <div className={panelStyles['panel__details-btn']}>{renderDetailsButton()}</div>}\n </div>\n )\n );\n };\n\n const renderDetailsButton = (): React.ReactNode => {\n const ariaLabelAttributes = getAriaLabelAttributes({\n label: buttonAriaLabel,\n id: (buttonAriaLabelledById && `${buttonTextId} ${buttonAriaLabelledById}`) || (title && titleId && `${buttonTextId} ${titleId}`),\n prefer: 'label',\n });\n\n const commonProps: Partial<ButtonProps> & AriaLabelAttributes = {\n onClick: buttonOnClick ? buttonOnClick : (): void => setIsExpanded(!isExpanded),\n className: containerAsButton ? panelStyles['panel__expand'] : undefined,\n variant: 'borderless',\n ellipsis: true,\n ...ariaLabelAttributes,\n };\n\n if (children) {\n return (\n <Button testId=\"expand\" aria-expanded={isExpanded} {...commonProps}>\n <span id={buttonTextId}>{isExpanded ? buttonTextClose : buttonText}</span>\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} />\n </Button>\n );\n }\n\n return (\n <Button testId=\"url\" htmlMarkup={buttonHtmlMarkup} href={url} target={target} {...commonProps}>\n <span id={buttonTextId}>{buttonText}</span>\n <Icon svgIcon={ArrowRight} />\n </Button>\n );\n };\n\n const renderContent = (): React.ReactNode | null => {\n if (!children || (!renderChildrenWhenClosed && !isExpanded)) {\n return null;\n }\n\n const panelDetailsClasses = classNames(panelStyles['panel-details'], {\n [panelStyles['panel-details--open']]: isExpanded,\n [panelStyles['panel-details--line']]: variant === PanelOldVariant.line,\n [panelStyles['panel-details--white']]: variant === PanelOldVariant.white,\n });\n\n return (\n <div className={panelDetailsClasses} data-testid=\"panel-details\">\n <div>{children}</div>\n </div>\n );\n };\n\n const renderTitle = () => {\n const titleContainerClasses = classNames(panelStyles['title-container'], {\n [panelStyles['title-container--no-content-a']]: !contentA,\n });\n const titleClasses = classNames(panelStyles['title-container__title'], {\n [panelStyles['title-container__title--badge']]: hasBadge,\n });\n\n return (\n title && (\n <div className={titleContainerClasses}>\n <Title appearance=\"title3\" htmlMarkup={titleHtmlMarkup} id={titleId} className={titleClasses}>\n {title}\n </Title>\n {hasBadge && (\n <div className={panelStyles.panel__badge}>\n <Badge color=\"blueberry\" testId=\"badge-status\">\n {statusMessage}\n </Badge>\n </div>\n )}\n </div>\n )\n );\n };\n\n const layoutProps: LayoutProps = {\n contentA: contentA,\n contentB: contentB,\n contentHeader: contentHeader,\n ctaContainer: renderCTAContainer(),\n icon: icon,\n status: status,\n statusMessage: statusMessage,\n titleElement: renderTitle(),\n };\n\n return (\n <div\n tabIndex={focusable ? -1 : undefined}\n ref={ref}\n data-testid={testId}\n className={panelWrapperClasses}\n data-analyticsid={AnalyticsId.PanelOld}\n >\n <div className={panelClasses}>\n {layout1 && <PanelLayout1 {...layoutProps} />}\n {layout2 && <PanelLayout2 {...layoutProps} />}\n {layout3 && <PanelLayout3 {...layoutProps} layout={layout} />}\n </div>\n {renderContent()}\n </div>\n );\n});\n\nexport default PanelOld;\n","import PanelOld from './PanelOld';\nexport * from './PanelOld';\nexport default PanelOld;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,IAAY,iBAAA,yBAAA,kBAAL;AACL,kBAAA,YAAA;AACA,kBAAA,SAAA;AACA,kBAAA,WAAA;AACA,kBAAA,WAAA;;;AAGF,IAAY,kBAAA,yBAAA,mBAAL;AACL,mBAAA,UAAA;AACA,mBAAA,WAAA;AACA,mBAAA,YAAA;AACA,mBAAA,UAAA;;;AAGF,IAAY,iBAAA,yBAAA,kBAAL;AACL,kBAAA,aAAA;AACA,kBAAA,aAAA;AACA,kBAAA,cAAA;AACA,kBAAA,cAAA;AACA,kBAAA,cAAA;;;AAsEF,IAAMA,cAA0F,EAAE,QAAQ,oBAAoB;CAC5H,MAAM,mBAAuE;AAC3E,MAAI,WAAW,eAAe,MAC5B,QAAO;GAAE,OAAO,QAAQ;GAAW,SAAS;GAAe;AAG7D,SAAO;GAAE,OAAO,QAAQ;GAAO,SAAS;GAAQ;;CAGlD,MAAM,qBAAqB,WAAW,YAAY,mBAAmB,GAClE,YAAY,yBAAyB,WAAW,eAAe,KACjE,CAAC;AAEF,MAAK,WAAW,eAAe,SAAS,WAAW,eAAe,UAAU,cAC1E,QACE,qBAAC,OAAA;EAAI,WAAW;EAAoB,eAAY;;GAC7C,oBAAC,cAAA;IAAK,GAAI,YAAY;IAAE,MAAM,SAAS;KAAU;GAAC;GAAC,oBAAC,QAAA,EAAA,UAAM,eAAA,CAAqB;;GAC5E;AAIV,QAAO;;AAGT,IAAMC,gBAA0D,EAAE,eAAe;AAC/E,KAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAO,oBAAC,OAAA;EAAI,WAAW,YAAY;EAAsB;GAAe;;AAG1E,IAAMC,YAAwD,EAAE,MAAM,WAAW;AAC/E,KAAI,QAAQ,KACV,QACE,qBAAC,OAAA;EAAI,WAAW,YAAY;EAAuB,eAAY;aA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Y;IAAiB,IAAI;IAAS,WAAW;cAC7E;KACK,EACP,YACC,oBAAC,OAAA;IAAI,WAAW,YAAY;cAC1B,oBAAC,eAAA;KAAM,OAAM;KAAY,QAAO;eAC7B;MACK;KACJ,CAAA;IAEJ;;CAKZ,MAAMC,cAA2B;EACrB;EACA;EACK;EACf,cAAc,oBAAoB;EAC5B;EACE;EACO;EACf,cAAc,aAAa;EAC5B;AAED,QACE,qBAAC,OAAA;EACC,UAAU,YAAY,KAAK,KAAA;EACtB;EACL,eAAa;EACb,WAAW;EACX,oBAAkB,YAAY;aAE9B,qBAAC,OAAA;GAAI,WAAW;;IACb,WAAW,oBAAC,cAAA,EAAa,GAAI,aAAA,CAAe;IAC5C,WAAW,oBAAC,cAAA,EAAa,GAAI,aAAA,CAAe;IAC5C,WAAW,oBAAC,cAAA;KAAa,GAAI;KAAqB;MAAU;;IACzD,EACL,eAAe,CAAA;GACZ;EAER"}
1
+ {"version":3,"file":"PanelOld.js","names":["StatusText: React.FC<{ status?: keyof typeof PanelOldStatus; statusMessage?: string }>","PreContainer: React.FC<{ children?: React.ReactNode }>","DateTime: React.FC<{ date?: string; time?: string }>","PanelLayout1: React.FC<LayoutProps>","PanelLayout2: React.FC<LayoutProps>","PanelLayout3: React.FC<LayoutProps>","commonProps: Partial<ButtonProps> & AriaLabelAttributes","layoutProps: LayoutProps"],"sources":["../src/components/PanelOld/PanelOld.tsx","../src/components/PanelOld/index.tsx"],"sourcesContent":["import React, { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport { type AnchorTarget, AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { palette } from '../../theme/palette';\nimport { type AriaLabelAttributes, getAriaLabelAttributes } from '../../utils/accessibility';\nimport Badge from '../Badge';\nimport Button, { type ButtonProps, type ButtonTags } from '../Button';\nimport Icon, { IconSize, type SvgPathProps } from '../Icon';\nimport AlertSignFill from '../Icons/AlertSignFill';\nimport ArrowRight from '../Icons/ArrowRight';\nimport Calendar from '../Icons/Calendar';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport Pencil from '../Icons/Pencil';\nimport Watch from '../Icons/Watch';\nimport Title, { type TitleTags } from '../Title';\n\nimport panelStyles from './styles.module.scss';\n\nexport enum PanelOldStatus {\n normal = 'normal',\n new = 'new',\n error = 'error',\n draft = 'draft',\n}\n\nexport enum PanelOldVariant {\n fill = 'fill',\n white = 'white',\n stroke = 'stroke',\n line = 'line',\n}\n\nexport enum PanelOldLayout {\n layout1 = 'layout1',\n layout2 = 'layout2',\n layout3a = 'layout3a',\n layout3b = 'layout3b',\n layout3c = 'layout3c',\n}\n\nexport interface PanelOldProps {\n /** Adds custom classes to the element. */\n className?: string;\n /** Panel section A content */\n contentA?: React.ReactNode | string;\n /** Panel section B content */\n contentB?: React.ReactNode | string;\n /** Content for a container that renders above A and B regardless of layout */\n contentHeader?: React.ReactNode;\n /** Container acts as a button, clicking anywhere triggers a panel button click */\n containerAsButton?: boolean;\n /** Panel children */\n children?: React.ReactNode;\n /** Displays date with icon */\n date?: string;\n /** Expands or collapses the panel */\n expanded?: boolean;\n /** Whether the panel can be focused */\n focusable?: boolean;\n /** Icon displayed in title */\n icon?: React.ReactNode;\n /** Panel button text */\n buttonText?: string;\n /** Panel button close text */\n buttonTextClose?: string;\n /** HTML markup for panel button. Default: a */\n buttonHtmlMarkup?: ButtonTags;\n /** Callback when the panel button is clicked */\n buttonOnClick?: ButtonProps['onClick'];\n /** Panel button is aria-labelledby the text in the button itself + the element set in buttonAriaLabelledById. Default: auto-generated id for title (if title is set). */\n buttonAriaLabelledById?: string;\n /** Panel button aria label */\n buttonAriaLabel?: string;\n /** Layout of the panel */\n layout?: keyof typeof PanelOldLayout;\n /** Removes top border when variant is \"line\" */\n noTopBorder?: boolean;\n /** Called when the panel is opened/closed */\n onExpand?: (isExpanded: boolean) => void;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Displays a status on the left side: default normal */\n status?: keyof typeof PanelOldStatus;\n /** Displayed on top of the panel with a status icon */\n statusMessage?: string;\n /** Sets the data-testid attribute for testing purposes */\n testId?: string;\n /** Displays time with icon */\n time?: string;\n /** Title of the panel */\n title?: string;\n /** Changes the underlying element of the title. Default: h2 */\n titleHtmlMarkup?: TitleTags;\n /** Changes the visual representation of the panel */\n variant?: keyof typeof PanelOldVariant;\n /** URL to details, renders as a button with anchor tag */\n url?: string;\n /** target used in the button: default is _self */\n target?: AnchorTarget;\n}\n\nexport interface LayoutProps extends Pick<\n PanelOldProps,\n 'contentA' | 'contentB' | 'contentHeader' | 'icon' | 'layout' | 'status' | 'statusMessage'\n> {\n ctaContainer?: React.ReactNode;\n titleElement: React.ReactNode;\n}\n\nconst StatusText: React.FC<{ status?: keyof typeof PanelOldStatus; statusMessage?: string }> = ({ status, statusMessage }) => {\n const statusIcon = (): { color: string; svgIcon: React.FC<SvgPathProps> } => {\n if (status === PanelOldStatus.error) {\n return { color: palette.cherry500, svgIcon: AlertSignFill };\n }\n\n return { color: palette.black, svgIcon: Pencil };\n };\n\n const statusMessageClass = classNames(panelStyles['status-message'], {\n [panelStyles['status-message--new']]: status === PanelOldStatus.new,\n });\n\n if ((status === PanelOldStatus.error || status === PanelOldStatus.draft) && statusMessage) {\n return (\n <div className={statusMessageClass} data-testid=\"display-status\">\n {<Icon {...statusIcon()} size={IconSize.XSmall} />} <span>{statusMessage}</span>\n </div>\n );\n }\n\n return null;\n};\n\nconst PreContainer: React.FC<{ children?: React.ReactNode }> = ({ children }) => {\n if (typeof children === 'undefined') return null;\n return <div className={panelStyles['header-container']}>{children}</div>;\n};\n\nconst DateTime: React.FC<{ date?: string; time?: string }> = ({ date, time }) => {\n if (date || time) {\n return (\n <div className={panelStyles['datetime-container']} data-testid=\"datetime\">\n {date && (\n <div className={panelStyles['datetime-container__icon']}>\n <Icon svgIcon={Calendar} size={IconSize.XSmall} />\n <span>{date}</span>\n </div>\n )}\n {time && (\n <div className={panelStyles['datetime-container__icon']}>\n <Icon svgIcon={Watch} size={IconSize.XSmall} />\n <span>{time}</span>\n </div>\n )}\n </div>\n );\n }\n\n return null;\n};\n\nconst PanelLayout1: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n status,\n statusMessage,\n titleElement,\n}) => {\n const panelLayoutClasses = classNames(panelStyles['panel__layout-1'], {\n [panelStyles['panel__layout-1--with-icon']]: icon,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-1'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n\n return (\n <div className={panelLayoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div className={panelStyles['panel__layout-1__content-a']}>\n {titleElement}\n {contentA}\n </div>\n {contentB && <div>{contentB}</div>}\n {ctaContainer}\n </div>\n );\n};\n\nconst PanelLayout2: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n status,\n statusMessage,\n titleElement,\n}) => {\n const panelLayoutClasses = classNames(panelStyles['panel__layout-2'], {\n [panelStyles['panel__layout-2--with-icon']]: icon,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-2'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n const lastColumnClass = panelStyles['panel__layout-2__last-column'];\n\n return (\n <div className={panelLayoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div className={panelStyles['panel__layout-2__content-a']}>\n {titleElement}\n {contentA}\n </div>\n {contentB && <div className={lastColumnClass}>{contentB}</div>}\n {ctaContainer && <div className={lastColumnClass}>{ctaContainer}</div>}\n </div>\n );\n};\n\nconst PanelLayout3: React.FC<LayoutProps> = ({\n contentA,\n contentB,\n contentHeader,\n ctaContainer,\n icon,\n layout,\n status,\n statusMessage,\n titleElement,\n}) => {\n const layoutClasses = classNames(panelStyles['panel__layout-3'], {\n [panelStyles['panel__layout-3--with-icon']]: icon,\n [panelStyles['panel__layout-3--a']]: layout === PanelOldLayout.layout3a,\n [panelStyles['panel__layout-3--b']]: layout === PanelOldLayout.layout3b,\n [panelStyles['panel__layout-3--c']]: layout === PanelOldLayout.layout3c,\n });\n const iconClasses = classNames(panelStyles.panel__icon, panelStyles['panel__icon--layout-3'], {\n [panelStyles['panel__icon--no-content']]: !contentA && !contentB,\n });\n\n return (\n <div className={layoutClasses}>\n <StatusText status={status} statusMessage={statusMessage} />\n <PreContainer>{contentHeader}</PreContainer>\n {icon && <div className={iconClasses}>{icon}</div>}\n <div>\n {titleElement}\n {contentA}\n </div>\n <div className={panelStyles['panel__layout-3__last-column']}>\n {contentB && <div className={panelStyles['panel__layout-3__last-column__content-b']}>{contentB}</div>}\n {ctaContainer}\n </div>\n </div>\n );\n};\n\nconst PanelOld = React.forwardRef(function PanelForwardedRef(props: PanelOldProps, ref: React.ForwardedRef<HTMLHeadingElement>) {\n const {\n buttonAriaLabel,\n buttonAriaLabelledById,\n buttonText = 'Se detaljer',\n buttonTextClose = 'Skjul detaljer',\n buttonHtmlMarkup = 'a',\n buttonOnClick,\n children,\n className,\n containerAsButton = false,\n contentA,\n contentB,\n contentHeader,\n date,\n expanded = false,\n focusable = false,\n icon,\n layout = PanelOldLayout.layout2,\n noTopBorder,\n onExpand,\n renderChildrenWhenClosed = false,\n status = PanelOldStatus.normal,\n statusMessage,\n target = '_self',\n testId,\n time,\n title,\n titleHtmlMarkup = 'h2',\n url,\n variant = PanelOldVariant.fill,\n } = props;\n\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const titleId = useId();\n const buttonTextId = useId();\n const hasBadge = statusMessage && status === PanelOldStatus.new;\n const noContentB = typeof contentB === 'undefined';\n const layout1 = layout === 'layout1' || noContentB;\n const layout2 = !noContentB && layout === 'layout2';\n const layout3 = !noContentB && (layout === 'layout3a' || layout === 'layout3b' || layout === 'layout3c');\n const panelWrapperClasses = classNames(panelStyles['panel-wrapper'], className);\n\n const panelClasses = classNames(panelStyles.panel, {\n [panelStyles['panel--fill']]: variant === PanelOldVariant.fill,\n [panelStyles['panel--stroke']]: variant === PanelOldVariant.stroke,\n [panelStyles['panel--white']]: variant === PanelOldVariant.white,\n [panelStyles['panel--line']]: variant === PanelOldVariant.line,\n [panelStyles['panel--no-top-border']]: variant === PanelOldVariant.line && noTopBorder,\n [panelStyles['panel--selected']]: isExpanded,\n [panelStyles['panel--new']]: status === PanelOldStatus.new,\n [panelStyles['panel--draft']]: status === PanelOldStatus.draft,\n [panelStyles['panel--error']]: status === PanelOldStatus.error,\n [panelStyles['panel--status']]: status && status !== PanelOldStatus.normal,\n [panelStyles['panel--with-icon']]: icon,\n [panelStyles['panel--button']]: containerAsButton,\n [panelStyles['panel--clickable']]: children || url || onExpand || buttonOnClick || containerAsButton,\n });\n\n const renderCTAContainer = () => {\n const hasButton = children || url || buttonOnClick;\n const btnContainerClasses = classNames(panelStyles['panel__btn-container'], {\n [panelStyles['panel__btn-container--no-content-b']]: noContentB,\n [panelStyles['panel__btn-container--no-button']]: !hasButton,\n });\n\n return (\n (hasButton || date || time) && (\n <div className={btnContainerClasses}>\n {<DateTime date={date} time={time} />}\n {hasButton && <div className={panelStyles['panel__details-btn']}>{renderDetailsButton()}</div>}\n </div>\n )\n );\n };\n\n const renderDetailsButton = (): React.ReactNode => {\n const ariaLabelAttributes = getAriaLabelAttributes({\n label: buttonAriaLabel,\n id: (buttonAriaLabelledById && `${buttonTextId} ${buttonAriaLabelledById}`) || (title && titleId && `${buttonTextId} ${titleId}`),\n prefer: 'label',\n });\n\n const commonProps: Partial<ButtonProps> & AriaLabelAttributes = {\n onClick: buttonOnClick ? buttonOnClick : (): void => setIsExpanded(!isExpanded),\n className: containerAsButton ? panelStyles['panel__expand'] : undefined,\n variant: 'borderless',\n ellipsis: true,\n ...ariaLabelAttributes,\n };\n\n if (children) {\n return (\n <Button testId=\"expand\" aria-expanded={isExpanded} {...commonProps}>\n <span id={buttonTextId}>{isExpanded ? buttonTextClose : buttonText}</span>\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} />\n </Button>\n );\n }\n\n return (\n <Button testId=\"url\" htmlMarkup={buttonHtmlMarkup} href={url} target={target} {...commonProps}>\n <span id={buttonTextId}>{buttonText}</span>\n <Icon svgIcon={ArrowRight} />\n </Button>\n );\n };\n\n const renderContent = (): React.ReactNode | null => {\n if (!children || (!renderChildrenWhenClosed && !isExpanded)) {\n return null;\n }\n\n const panelDetailsClasses = classNames(panelStyles['panel-details'], {\n [panelStyles['panel-details--open']]: isExpanded,\n [panelStyles['panel-details--line']]: variant === PanelOldVariant.line,\n [panelStyles['panel-details--white']]: variant === PanelOldVariant.white,\n });\n\n return (\n <div className={panelDetailsClasses} data-testid=\"panel-details\">\n <div>{children}</div>\n </div>\n );\n };\n\n const renderTitle = () => {\n const titleContainerClasses = classNames(panelStyles['title-container'], {\n [panelStyles['title-container--no-content-a']]: !contentA,\n });\n const titleClasses = classNames(panelStyles['title-container__title'], {\n [panelStyles['title-container__title--badge']]: hasBadge,\n });\n\n return (\n title && (\n <div className={titleContainerClasses}>\n <Title appearance=\"title3\" htmlMarkup={titleHtmlMarkup} id={titleId} className={titleClasses}>\n {title}\n </Title>\n {hasBadge && (\n <div className={panelStyles.panel__badge}>\n <Badge color=\"blueberry\" testId=\"badge-status\">\n {statusMessage}\n </Badge>\n </div>\n )}\n </div>\n )\n );\n };\n\n const layoutProps: LayoutProps = {\n contentA: contentA,\n contentB: contentB,\n contentHeader: contentHeader,\n ctaContainer: renderCTAContainer(),\n icon: icon,\n status: status,\n statusMessage: statusMessage,\n titleElement: renderTitle(),\n };\n\n return (\n <div\n tabIndex={focusable ? -1 : undefined}\n ref={ref}\n data-testid={testId}\n className={panelWrapperClasses}\n data-analyticsid={AnalyticsId.PanelOld}\n >\n <div className={panelClasses}>\n {layout1 && <PanelLayout1 {...layoutProps} />}\n {layout2 && <PanelLayout2 {...layoutProps} />}\n {layout3 && <PanelLayout3 {...layoutProps} layout={layout} />}\n </div>\n {renderContent()}\n </div>\n );\n});\n\nexport default PanelOld;\n","import PanelOld from './PanelOld';\nexport * from './PanelOld';\nexport default PanelOld;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,IAAY,iBAAA,yBAAA,kBAAL;AACL,kBAAA,YAAA;AACA,kBAAA,SAAA;AACA,kBAAA,WAAA;AACA,kBAAA,WAAA;;;AAGF,IAAY,kBAAA,yBAAA,mBAAL;AACL,mBAAA,UAAA;AACA,mBAAA,WAAA;AACA,mBAAA,YAAA;AACA,mBAAA,UAAA;;;AAGF,IAAY,iBAAA,yBAAA,kBAAL;AACL,kBAAA,aAAA;AACA,kBAAA,aAAA;AACA,kBAAA,cAAA;AACA,kBAAA,cAAA;AACA,kBAAA,cAAA;;;AAwEF,IAAMA,cAA0F,EAAE,QAAQ,oBAAoB;CAC5H,MAAM,mBAAuE;AAC3E,MAAI,WAAW,eAAe,MAC5B,QAAO;GAAE,OAAO,QAAQ;GAAW,SAAS;GAAe;AAG7D,SAAO;GAAE,OAAO,QAAQ;GAAO,SAAS;GAAQ;;CAGlD,MAAM,qBAAqB,WAAW,YAAY,mBAAmB,GAClE,YAAY,yBAAyB,WAAW,eAAe,KACjE,CAAC;AAEF,MAAK,WAAW,eAAe,SAAS,WAAW,eAAe,UAAU,cAC1E,QACE,qBAAC,OAAA;EAAI,WAAW;EAAoB,eAAY;;GAC7C,oBAAC,cAAA;IAAK,GAAI,YAAY;IAAE,MAAM,SAAS;KAAU;GAAC;GAAC,oBAAC,QAAA,EAAA,UAAM,eAAA,CAAqB;;GAC5E;AAIV,QAAO;;AAGT,IAAMC,gBAA0D,EAAE,eAAe;AAC/E,KAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAO,oBAAC,OAAA;EAAI,WAAW,YAAY;EAAsB;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Y,2BAA2B,GACpE,YAAY,mCAAmC,UACjD,CAAC;AAEF,SACE,SACE,qBAAC,OAAA;GAAI,WAAW;cACd,oBAAC,eAAA;IAAM,YAAW;IAAS,YAAY;IAAiB,IAAI;IAAS,WAAW;cAC7E;KACK,EACP,YACC,oBAAC,OAAA;IAAI,WAAW,YAAY;cAC1B,oBAAC,eAAA;KAAM,OAAM;KAAY,QAAO;eAC7B;MACK;KACJ,CAAA;IAEJ;;CAKZ,MAAMC,cAA2B;EACrB;EACA;EACK;EACf,cAAc,oBAAoB;EAC5B;EACE;EACO;EACf,cAAc,aAAa;EAC5B;AAED,QACE,qBAAC,OAAA;EACC,UAAU,YAAY,KAAK,KAAA;EACtB;EACL,eAAa;EACb,WAAW;EACX,oBAAkB,YAAY;aAE9B,qBAAC,OAAA;GAAI,WAAW;;IACb,WAAW,oBAAC,cAAA,EAAa,GAAI,aAAA,CAAe;IAC5C,WAAW,oBAAC,cAAA,EAAa,GAAI,aAAA,CAAe;IAC5C,WAAW,oBAAC,cAAA;KAAa,GAAI;KAAqB;MAAU;;IACzD,EACL,eAAe,CAAA;GACZ;EAER"}
@@ -1 +1 @@
1
- {"version":3,"file":"PopOver.js","names":[],"sources":["../src/components/PopOver/PopOver.tsx","../src/components/PopOver/index.ts"],"sourcesContent":["import React, { useRef } from 'react';\n\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n FloatingArrow,\n arrow,\n hide,\n FloatingFocusManager,\n useMergeRefs,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\n\nimport styles from './styles.module.scss';\n\nexport enum PopOverVariant {\n positionautomatic = 'positionautomatic',\n positionbelow = 'positionbelow',\n positionabove = 'positionabove',\n}\n\nexport type PopOverRole = 'tooltip' | 'dialog';\n\nexport type PopOverPlacement = 'top' | 'bottom';\n\nexport interface PopOverProps {\n /** Sets aria-label of the bubble. If role is set to dialog ariaLabel or ariaLabelledById MUST be set! */\n ariaLabel?: string;\n /** Sets aria-labelledby of the bubble. If role is set to dialog ariaLabel or ariaLabelledById MUST be set! */\n ariaLabelledById?: string;\n /** Id of the PopOver */\n id?: string;\n /** Content shown inside PopOver. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the PopOver is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Show the popover. Only applies when role=tooltip. Default: false. */\n show?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** @deprecated Adds custom classes to the arrow element. */\n arrowClassName?: string;\n /** @deprecated use placement instead. Determines the placement of the popover. Default: automatic positioning. */\n variant?: keyof typeof PopOverVariant;\n /** Sets the placement of the popover relative to the trigger if there is space, otherwise automatic. */\n placement?: PopOverPlacement;\n /** Sets role of the PopOver element */\n role?: PopOverRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Overrides the default z-index of PopOver */\n zIndex?: number;\n}\n\nconst PopOver = React.forwardRef<HTMLDivElement | SVGSVGElement | HTMLElement, PopOverProps>((props, ref) => {\n const {\n ariaLabel,\n ariaLabelledById,\n id,\n children,\n controllerRef,\n show = false,\n className = '',\n variant = PopOverVariant.positionautomatic,\n role = 'dialog',\n testId,\n zIndex = ZIndex.PopOver,\n placement,\n } = props;\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n\n const placementProp = placement ?? (variant === PopOverVariant.positionabove ? 'top' : 'bottom');\n\n const arrowRef = useRef(null);\n const { refs, floatingStyles, context, middlewareData } = useFloating({\n middleware: [offset(10), flip(), shift({ padding: 8 }), hide(), arrow({ element: arrowRef })],\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: {\n reference: controllerRef.current,\n },\n });\n\n const click = useClick(context);\n const dismiss = useDismiss(context);\n\n const { getFloatingProps } = useInteractions([click, dismiss]);\n\n const isVisible = show && !middlewareData.hide?.referenceHidden;\n\n const mergedRef = useMergeRefs<HTMLElement | SVGSVGElement>([refs.setFloating, ref]);\n\n return (\n <FloatingFocusManager context={context} modal={false}>\n <div\n id={id}\n ref={mergedRef}\n style={{ ...floatingStyles, visibility: isVisible ? 'visible' : 'hidden', zIndex: zIndex }}\n className={classNames(styles.popover, className)}\n {...getFloatingProps()}\n role={role}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PopOver}\n {...ariaLabelAttributes}\n >\n {children}\n <FloatingArrow\n ref={arrowRef}\n className={styles['popover__arrow']}\n context={context}\n fill={'var(--core-color-white)'}\n stroke={'var(--color-base-border-onlight)'}\n strokeWidth={1}\n />\n </div>\n </FloatingFocusManager>\n );\n});\n\nPopOver.displayName = 'PopOver';\n\nexport default PopOver;\n","import PopOver from './PopOver';\nexport * from './PopOver';\nexport default PopOver;\n"],"mappings":";;;;;;;AAwBA,IAAY,iBAAA,yBAAA,kBAAL;AACL,kBAAA,uBAAA;AACA,kBAAA,mBAAA;AACA,kBAAA,mBAAA;;;AAoCF,IAAM,UAAU,MAAM,YAAwE,OAAO,QAAQ;CAC3G,MAAM,EACJ,WACA,kBACA,IACA,UACA,eACA,OAAO,OACP,YAAY,IACZ,UAAU,eAAe,mBACzB,OAAO,UACP,QACA,SAAS,OAAO,SAChB,cACE;CAEJ,MAAM,sBAAsB,uBAAuB;EAAE,OAAO;EAAW,IAAI;EAAkB,CAAC;CAE9F,MAAM,gBAAgB,cAAc,YAAY,eAAe,gBAAgB,QAAQ;CAEvF,MAAM,WAAW,OAAO,KAAK;CAC7B,MAAM,EAAE,MAAM,gBAAgB,SAAS,mBAAmB,YAAY;EACpE,YAAY;GAAC,OAAO,GAAG;GAAE,MAAM;GAAE,MAAM,EAAE,SAAS,GAAG,CAAC;GAAE,MAAM;GAAE,MAAM,EAAE,SAAS,UAAU,CAAC;GAAC;EAC7F,WAAW;EACX,sBAAsB;EACtB,UAAU,EACR,WAAW,cAAc,SAC1B;EACF,CAAC;CAKF,MAAM,EAAE,qBAAqB,gBAAgB,CAH/B,SAAS,QAAQ,EACf,WAAW,QAAQ,CAE0B,CAAC;CAE9D,MAAM,YAAY,QAAQ,CAAC,eAAe,MAAM;AAIhD,QACE,oBAAC,sBAAA;EAA8B;EAAS,OAAO;YAC7C,qBAAC,OAAA;GACK;GACJ,KANY,aAA0C,CAAC,KAAK,aAAa,IAAI,CAAC;GAO9E,OAAO;IAAE,GAAG;IAAgB,YAAY,YAAY,YAAY;IAAkB;IAAQ;GAC1F,WAAW,WAAW,OAAO,SAAS,UAAU;GAChD,GAAI,kBAAkB;GAChB;GACN,eAAa;GACb,oBAAkB,YAAY;GAC9B,GAAI;cAEH,UACD,oBAAC,eAAA;IACC,KAAK;IACL,WAAW,OAAO;IACT;IACT,MAAM;IACN,QAAQ;IACR,aAAa;KACb,CAAA;IACE;GACe;EAEzB;AAEF,QAAQ,cAAc;AC/HtB,IAAA,oBDiIe"}
1
+ {"version":3,"file":"PopOver.js","names":[],"sources":["../src/components/PopOver/PopOver.tsx","../src/components/PopOver/index.ts"],"sourcesContent":["import React, { useRef } from 'react';\n\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n FloatingArrow,\n arrow,\n hide,\n FloatingFocusManager,\n useMergeRefs,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\n\nimport styles from './styles.module.scss';\n\nexport enum PopOverVariant {\n positionautomatic = 'positionautomatic',\n positionbelow = 'positionbelow',\n positionabove = 'positionabove',\n}\n\nexport type PopOverRole = 'tooltip' | 'dialog' | 'group';\n\nexport type PopOverPlacement = 'top' | 'bottom';\n\nexport interface PopOverProps {\n /** Sets aria-label of the bubble. If role is set to dialog ariaLabel or ariaLabelledById MUST be set! */\n ariaLabel?: string;\n /** Sets aria-labelledby of the bubble. If role is set to dialog ariaLabel or ariaLabelledById MUST be set! */\n ariaLabelledById?: string;\n /** Id of the PopOver */\n id?: string;\n /** Content shown inside PopOver. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the PopOver is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Show the popover. Only applies when role=tooltip. Default: false. */\n show?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** @deprecated Adds custom classes to the arrow element. */\n arrowClassName?: string;\n /** @deprecated use placement instead. Determines the placement of the popover. Default: automatic positioning. */\n variant?: keyof typeof PopOverVariant;\n /** Sets the placement of the popover relative to the trigger if there is space, otherwise automatic. */\n placement?: PopOverPlacement;\n /** Sets role of the PopOver element */\n role?: PopOverRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Overrides the default z-index of PopOver */\n zIndex?: number;\n}\n\nconst PopOver = React.forwardRef<HTMLDivElement | SVGSVGElement | HTMLElement, PopOverProps>((props, ref) => {\n const {\n ariaLabel,\n ariaLabelledById,\n id,\n children,\n controllerRef,\n show = false,\n className = '',\n variant = PopOverVariant.positionautomatic,\n role = 'dialog',\n testId,\n zIndex = ZIndex.PopOver,\n placement,\n } = props;\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n\n const placementProp = placement ?? (variant === PopOverVariant.positionabove ? 'top' : 'bottom');\n\n const arrowRef = useRef(null);\n const { refs, floatingStyles, context, middlewareData } = useFloating({\n middleware: [offset(10), flip(), shift({ padding: 8 }), hide(), arrow({ element: arrowRef })],\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: {\n reference: controllerRef.current,\n },\n });\n\n const click = useClick(context);\n const dismiss = useDismiss(context);\n\n const { getFloatingProps } = useInteractions([click, dismiss]);\n\n const isVisible = show && !middlewareData.hide?.referenceHidden;\n\n const mergedRef = useMergeRefs<HTMLElement | SVGSVGElement>([refs.setFloating, ref]);\n\n return (\n <FloatingFocusManager context={context} modal={false}>\n <div\n id={id}\n ref={mergedRef}\n style={{ ...floatingStyles, visibility: isVisible ? 'visible' : 'hidden', zIndex: zIndex }}\n className={classNames(styles.popover, className)}\n {...getFloatingProps()}\n role={role}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PopOver}\n {...ariaLabelAttributes}\n >\n {children}\n <FloatingArrow\n ref={arrowRef}\n className={styles['popover__arrow']}\n context={context}\n fill={'var(--core-color-white)'}\n stroke={'var(--color-base-border-onlight)'}\n strokeWidth={1}\n />\n </div>\n </FloatingFocusManager>\n );\n});\n\nPopOver.displayName = 'PopOver';\n\nexport default PopOver;\n","import PopOver from './PopOver';\nexport * from './PopOver';\nexport default PopOver;\n"],"mappings":";;;;;;;AAwBA,IAAY,iBAAA,yBAAA,kBAAL;AACL,kBAAA,uBAAA;AACA,kBAAA,mBAAA;AACA,kBAAA,mBAAA;;;AAoCF,IAAM,UAAU,MAAM,YAAwE,OAAO,QAAQ;CAC3G,MAAM,EACJ,WACA,kBACA,IACA,UACA,eACA,OAAO,OACP,YAAY,IACZ,UAAU,eAAe,mBACzB,OAAO,UACP,QACA,SAAS,OAAO,SAChB,cACE;CAEJ,MAAM,sBAAsB,uBAAuB;EAAE,OAAO;EAAW,IAAI;EAAkB,CAAC;CAE9F,MAAM,gBAAgB,cAAc,YAAY,eAAe,gBAAgB,QAAQ;CAEvF,MAAM,WAAW,OAAO,KAAK;CAC7B,MAAM,EAAE,MAAM,gBAAgB,SAAS,mBAAmB,YAAY;EACpE,YAAY;GAAC,OAAO,GAAG;GAAE,MAAM;GAAE,MAAM,EAAE,SAAS,GAAG,CAAC;GAAE,MAAM;GAAE,MAAM,EAAE,SAAS,UAAU,CAAC;GAAC;EAC7F,WAAW;EACX,sBAAsB;EACtB,UAAU,EACR,WAAW,cAAc,SAC1B;EACF,CAAC;CAKF,MAAM,EAAE,qBAAqB,gBAAgB,CAH/B,SAAS,QAAQ,EACf,WAAW,QAAQ,CAE0B,CAAC;CAE9D,MAAM,YAAY,QAAQ,CAAC,eAAe,MAAM;AAIhD,QACE,oBAAC,sBAAA;EAA8B;EAAS,OAAO;YAC7C,qBAAC,OAAA;GACK;GACJ,KANY,aAA0C,CAAC,KAAK,aAAa,IAAI,CAAC;GAO9E,OAAO;IAAE,GAAG;IAAgB,YAAY,YAAY,YAAY;IAAkB;IAAQ;GAC1F,WAAW,WAAW,OAAO,SAAS,UAAU;GAChD,GAAI,kBAAkB;GAChB;GACN,eAAa;GACb,oBAAkB,YAAY;GAC9B,GAAI;cAEH,UACD,oBAAC,eAAA;IACC,KAAK;IACL,WAAW,OAAO;IACT;IACT,MAAM;IACN,QAAQ;IACR,aAAa;KACb,CAAA;IACE;GACe;EAEzB;AAEF,QAAQ,cAAc;AC/HtB,IAAA,oBDiIe"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.js","names":[],"sources":["../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormOnColor, FormSize } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { isMutableRefObject, mergeRefs } from '../../utils/refs';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport { getLabelText, renderLabelAsParent } from '../Label';\n\nimport radioButtonStyles from './styles.module.scss';\n\nexport interface RadioButtonProps\n extends ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-describedby' | 'name' | 'value' | 'disabled' | 'checked' | 'defaultChecked' | 'required' | 'onChange'\n > {\n /** Adds custom classes to the element. */\n className?: string;\n /** The <Label/> next to the radioButton - sublabels kan ikke kombineres med large variant */\n label: React.ReactNode;\n /** Adds custom classes to the label element. */\n labelClassNames?: string;\n /** input id of the radioButton */\n inputId?: string;\n /** Changes the visuals of the radioButton */\n onColor?: keyof typeof FormOnColor;\n /** Changes the visuals of the radioButton. Large version only works when used inside a FormGroup wrapper. */\n size?: keyof typeof FormSize;\n /** Activates Error style for the radioButton - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const getRadioLabelClasses = (\n radioId: string,\n onColor: FormOnColor,\n large: boolean,\n checkedRadioId?: string\n): string | undefined => {\n const onCherry = onColor === 'oninvalid';\n const checked = radioId === checkedRadioId;\n\n return classNames({\n [radioButtonStyles['radio-button-label__large--on-grey']]: large && onColor === 'ongrey' && !checked,\n [radioButtonStyles['radio-button-label__large--on-blueberry']]: onColor === 'onblueberry' && !checked && large,\n [radioButtonStyles['radio-button-label__large--selected']]: large && checked && !onCherry,\n [radioButtonStyles['radio-button-label__large--selected-invalid']]: large && checked && onCherry,\n });\n};\n\nexport const RadioButton = React.forwardRef((props: RadioButtonProps, ref: React.Ref<HTMLInputElement>) => {\n const {\n className,\n defaultChecked,\n onChange,\n disabled,\n label,\n inputId = uuid(),\n onColor = FormOnColor.onwhite,\n name = inputId,\n size,\n errorText,\n errorTextId: errorTextIdProp,\n error = !!errorText,\n errorWrapperClassName,\n value = getLabelText(label),\n testId,\n required,\n labelClassNames,\n ...rest\n } = props;\n const invalid = error || onColor === FormOnColor.oninvalid;\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const onCherry = onColor === FormOnColor.oninvalid;\n const isLarge = size === FormSize.large;\n const [checked, changeChecked] = useState<boolean>();\n const { refObject, isFocused } = usePseudoClasses<HTMLInputElement>(isMutableRefObject(ref) ? ref : null);\n const mergedRefs = mergeRefs([ref, refObject]);\n const errorTextId = useIdWithFallback(errorTextIdProp);\n\n const radioButtonWrapperClasses = classNames(radioButtonStyles['radio-button-wrapper'], {\n [radioButtonStyles['radio-button-wrapper__large']]: isLarge,\n [radioButtonStyles['radio-button-wrapper__large--focused']]: isLarge && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--selected']]: isLarge && checked && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--invalid']]: isLarge && onCherry && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--on-blueberry']]: isLarge && onBlueberry && isFocused,\n });\n const radioButtonLabelClasses = classNames(\n radioButtonStyles['radio-button-label'],\n {\n [radioButtonStyles['radio-button-label--disabled']]: disabled,\n [radioButtonStyles['radio-button-label--on-dark']]: onDark,\n [radioButtonStyles['radio-button-label--invalid']]: invalid,\n [radioButtonStyles['radio-button-label__large']]: isLarge,\n [radioButtonStyles['radio-button-label__large--focused']]: isFocused && isLarge,\n [radioButtonStyles['radio-button-label__large--disabled']]: isLarge && disabled,\n },\n labelClassNames\n );\n const radioButtonClasses = classNames(\n radioButtonStyles['radio-button'],\n {\n [radioButtonStyles['radio-button--on-dark']]: onDark,\n [radioButtonStyles['radio-button--disabled']]: disabled,\n [radioButtonStyles['radio-button--on-blueberry']]: onBlueberry,\n [radioButtonStyles['radio-button--invalid']]: invalid,\n [radioButtonStyles['radio-button__large']]: isLarge,\n [radioButtonStyles['radio-button__large--disabled']]: isLarge && disabled,\n [radioButtonStyles['radio-button__large--invalid']]: isLarge && invalid,\n },\n className\n );\n\n const change = (e: React.ChangeEvent<HTMLInputElement>): void => {\n changeChecked(e.target.checked);\n if (onChange) onChange(e);\n };\n\n const getLabelContent = (): React.ReactNode => (\n <input\n {...rest}\n id={inputId}\n name={name}\n className={radioButtonClasses}\n type=\"radio\"\n disabled={disabled}\n value={value}\n ref={mergedRefs}\n defaultChecked={defaultChecked}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n required={required}\n onChange={(e): void => change(e)}\n />\n );\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.RadioButton} className={radioButtonWrapperClasses}>\n {renderLabelAsParent(\n label,\n getLabelContent(),\n inputId,\n onColor as FormOnColor,\n radioButtonLabelClasses,\n undefined,\n radioButtonStyles['radiobutton-sublabel-wrapper'],\n isLarge\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"mappings":";;;;;;;;;;;;AA2CA,MAAa,wBACX,SACA,SACA,OACA,mBACuB;CACvB,MAAM,WAAW,YAAY;CAC7B,MAAM,UAAU,YAAY;AAE5B,QAAO,WAAW;GACf,kBAAkB,wCAAwC,SAAS,YAAY,YAAY,CAAC;GAC5F,kBAAkB,6CAA6C,YAAY,iBAAiB,CAAC,WAAW;GACxG,kBAAkB,yCAAyC,SAAS,WAAW,CAAC;GAChF,kBAAkB,iDAAiD,SAAS,WAAW;EACzF,CAAC;;AAGJ,MAAa,cAAc,MAAM,YAAY,OAAyB,QAAqC;CACzG,MAAM,EACJ,WACA,gBACA,UACA,UACA,OACA,UAAU,MAAM,EAChB,UAAU,YAAY,SACtB,OAAO,SACP,MACA,WACA,aAAa,iBACb,QAAQ,CAAC,CAAC,WACV,uBACA,QAAQ,aAAa,MAAM,EAC3B,QACA,UACA,iBACA,GAAG,SACD;CACJ,MAAM,UAAU,SAAS,YAAY,YAAY;CACjD,MAAM,SAAS,YAAY,YAAY;CACvC,MAAM,cAAc,YAAY,YAAY;CAC5C,MAAM,WAAW,YAAY,YAAY;CACzC,MAAM,UAAU,SAAS,SAAS;CAClC,MAAM,CAAC,SAAS,iBAAiB,UAAmB;CACpD,MAAM,EAAE,WAAW,cAAc,iBAAmC,mBAAmB,IAAI,GAAG,MAAM,KAAK;CACzG,MAAM,aAAa,UAAU,CAAC,KAAK,UAAU,CAAC;CAC9C,MAAM,cAAc,kBAAkB,gBAAgB;CAEtD,MAAM,4BAA4B,WAAW,kBAAkB,yBAAyB;GACrF,kBAAkB,iCAAiC;GACnD,kBAAkB,0CAA0C,WAAW;GACvE,kBAAkB,2CAA2C,WAAW,WAAW;GACnF,kBAAkB,0CAA0C,WAAW,YAAY;GACnF,kBAAkB,+CAA+C,WAAW,eAAe;EAC7F,CAAC;CACF,MAAM,0BAA0B,WAC9B,kBAAkB,uBAClB;GACG,kBAAkB,kCAAkC;GACpD,kBAAkB,iCAAiC;GACnD,kBAAkB,iCAAiC;GACnD,kBAAkB,+BAA+B;GACjD,kBAAkB,wCAAwC,aAAa;GACvE,kBAAkB,yCAAyC,WAAW;EACxE,EACD,gBACD;CACD,MAAM,qBAAqB,WACzB,kBAAkB,iBAClB;GACG,kBAAkB,2BAA2B;GAC7C,kBAAkB,4BAA4B;GAC9C,kBAAkB,gCAAgC;GAClD,kBAAkB,2BAA2B;GAC7C,kBAAkB,yBAAyB;GAC3C,kBAAkB,mCAAmC,WAAW;GAChE,kBAAkB,kCAAkC,WAAW;EACjE,EACD,UACD;CAED,MAAM,UAAU,MAAiD;AAC/D,gBAAc,EAAE,OAAO,QAAQ;AAC/B,MAAI,SAAU,UAAS,EAAE;;CAG3B,MAAM,wBACJ,oBAAC,SAAA;EACC,GAAI;EACJ,IAAI;EACE;EACN,WAAW;EACX,MAAK;EACK;EACH;EACP,KAAK;EACW;EAChB,oBAAkB,mBAAmB,OAAO,YAAY;EAC9C;EACV,WAAW,MAAY,OAAO,EAAE;GAChC;AAGJ,QACE,oBAAC,sBAAA;EAAa,WAAW;EAAkC;EAAwB;YACjF,oBAAC,OAAA;GAAI,eAAa;GAAQ,oBAAkB,YAAY;GAAa,WAAW;aAC7E,oBACC,OACA,iBAAiB,EACjB,SACA,SACA,yBACA,KAAA,GACA,kBAAkB,iCAClB,QACD;IACG;GACO;EAEjB;AAEF,YAAY,cAAc;AAE1B,IAAA,sBAAe"}
1
+ {"version":3,"file":"RadioButton.js","names":[],"sources":["../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormOnColor, FormSize } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { isMutableRefObject, mergeRefs } from '../../utils/refs';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { type ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport { getLabelText, renderLabelAsParent } from '../Label';\n\nimport radioButtonStyles from './styles.module.scss';\n\nexport interface RadioButtonProps\n extends\n ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-describedby' | 'name' | 'value' | 'disabled' | 'checked' | 'defaultChecked' | 'required' | 'onChange'\n > {\n /** Adds custom classes to the element. */\n className?: string;\n /** The <Label/> next to the radioButton - sublabels kan ikke kombineres med large variant */\n label: React.ReactNode;\n /** Adds custom classes to the label element. */\n labelClassNames?: string;\n /** input id of the radioButton */\n inputId?: string;\n /** Changes the visuals of the radioButton */\n onColor?: keyof typeof FormOnColor;\n /** Changes the visuals of the radioButton. Large version only works when used inside a FormGroup wrapper. */\n size?: keyof typeof FormSize;\n /** Activates Error style for the radioButton - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const getRadioLabelClasses = (\n radioId: string,\n onColor: FormOnColor,\n large: boolean,\n checkedRadioId?: string\n): string | undefined => {\n const onCherry = onColor === 'oninvalid';\n const checked = radioId === checkedRadioId;\n\n return classNames({\n [radioButtonStyles['radio-button-label__large--on-grey']]: large && onColor === 'ongrey' && !checked,\n [radioButtonStyles['radio-button-label__large--on-blueberry']]: onColor === 'onblueberry' && !checked && large,\n [radioButtonStyles['radio-button-label__large--selected']]: large && checked && !onCherry,\n [radioButtonStyles['radio-button-label__large--selected-invalid']]: large && checked && onCherry,\n });\n};\n\nexport const RadioButton = React.forwardRef((props: RadioButtonProps, ref: React.Ref<HTMLInputElement>) => {\n const {\n className,\n defaultChecked,\n onChange,\n disabled,\n label,\n inputId = uuid(),\n onColor = FormOnColor.onwhite,\n name = inputId,\n size,\n errorText,\n errorTextId: errorTextIdProp,\n error = !!errorText,\n errorWrapperClassName,\n value = getLabelText(label),\n testId,\n required,\n labelClassNames,\n ...rest\n } = props;\n const invalid = error || onColor === FormOnColor.oninvalid;\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const onCherry = onColor === FormOnColor.oninvalid;\n const isLarge = size === FormSize.large;\n const [checked, changeChecked] = useState<boolean>();\n const { refObject, isFocused } = usePseudoClasses<HTMLInputElement>(isMutableRefObject(ref) ? ref : null);\n const mergedRefs = mergeRefs([ref, refObject]);\n const errorTextId = useIdWithFallback(errorTextIdProp);\n\n const radioButtonWrapperClasses = classNames(radioButtonStyles['radio-button-wrapper'], {\n [radioButtonStyles['radio-button-wrapper__large']]: isLarge,\n [radioButtonStyles['radio-button-wrapper__large--focused']]: isLarge && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--selected']]: isLarge && checked && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--invalid']]: isLarge && onCherry && isFocused,\n [radioButtonStyles['radio-button-wrapper__large--on-blueberry']]: isLarge && onBlueberry && isFocused,\n });\n const radioButtonLabelClasses = classNames(\n radioButtonStyles['radio-button-label'],\n {\n [radioButtonStyles['radio-button-label--disabled']]: disabled,\n [radioButtonStyles['radio-button-label--on-dark']]: onDark,\n [radioButtonStyles['radio-button-label--invalid']]: invalid,\n [radioButtonStyles['radio-button-label__large']]: isLarge,\n [radioButtonStyles['radio-button-label__large--focused']]: isFocused && isLarge,\n [radioButtonStyles['radio-button-label__large--disabled']]: isLarge && disabled,\n },\n labelClassNames\n );\n const radioButtonClasses = classNames(\n radioButtonStyles['radio-button'],\n {\n [radioButtonStyles['radio-button--on-dark']]: onDark,\n [radioButtonStyles['radio-button--disabled']]: disabled,\n [radioButtonStyles['radio-button--on-blueberry']]: onBlueberry,\n [radioButtonStyles['radio-button--invalid']]: invalid,\n [radioButtonStyles['radio-button__large']]: isLarge,\n [radioButtonStyles['radio-button__large--disabled']]: isLarge && disabled,\n [radioButtonStyles['radio-button__large--invalid']]: isLarge && invalid,\n },\n className\n );\n\n const change = (e: React.ChangeEvent<HTMLInputElement>): void => {\n changeChecked(e.target.checked);\n if (onChange) onChange(e);\n };\n\n const getLabelContent = (): React.ReactNode => (\n <input\n {...rest}\n id={inputId}\n name={name}\n className={radioButtonClasses}\n type=\"radio\"\n disabled={disabled}\n value={value}\n ref={mergedRefs}\n defaultChecked={defaultChecked}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n required={required}\n onChange={(e): void => change(e)}\n />\n );\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.RadioButton} className={radioButtonWrapperClasses}>\n {renderLabelAsParent(\n label,\n getLabelContent(),\n inputId,\n onColor as FormOnColor,\n radioButtonLabelClasses,\n undefined,\n radioButtonStyles['radiobutton-sublabel-wrapper'],\n isLarge\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"mappings":";;;;;;;;;;;;AA4CA,MAAa,wBACX,SACA,SACA,OACA,mBACuB;CACvB,MAAM,WAAW,YAAY;CAC7B,MAAM,UAAU,YAAY;AAE5B,QAAO,WAAW;GACf,kBAAkB,wCAAwC,SAAS,YAAY,YAAY,CAAC;GAC5F,kBAAkB,6CAA6C,YAAY,iBAAiB,CAAC,WAAW;GACxG,kBAAkB,yCAAyC,SAAS,WAAW,CAAC;GAChF,kBAAkB,iDAAiD,SAAS,WAAW;EACzF,CAAC;;AAGJ,MAAa,cAAc,MAAM,YAAY,OAAyB,QAAqC;CACzG,MAAM,EACJ,WACA,gBACA,UACA,UACA,OACA,UAAU,MAAM,EAChB,UAAU,YAAY,SACtB,OAAO,SACP,MACA,WACA,aAAa,iBACb,QAAQ,CAAC,CAAC,WACV,uBACA,QA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K;EACH;EACP,KAAK;EACW;EAChB,oBAAkB,mBAAmB,OAAO,YAAY;EAC9C;EACV,WAAW,MAAY,OAAO,EAAE;GAChC;AAGJ,QACE,oBAAC,sBAAA;EAAa,WAAW;EAAkC;EAAwB;YACjF,oBAAC,OAAA;GAAI,eAAa;GAAQ,oBAAkB,YAAY;GAAa,WAAW;aAC7E,oBACC,OACA,iBAAiB,EACjB,SACA,SACA,yBACA,KAAA,GACA,kBAAkB,iCAClB,QACD;IACG;GACO;EAEjB;AAEF,YAAY,cAAc;AAE1B,IAAA,sBAAe"}
package/lib/Select.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":[],"sources":["../src/components/Select/Select.tsx","../src/components/Select/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\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, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { renderLabel } from '../Label';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends 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}\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.forwardRef(function SelectForwardedRef(props: SelectProps, ref: React.Ref<HTMLSelectElement>) {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId: 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 ...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, selectId, 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":";;;;;;;;;;;;AAmDA,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,MAAa,SAAS,MAAM,WAAW,SAAS,mBAAmB,OAAoB,KAAmC;CACxH,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,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,OAAO,UAAU,QAAuB,EACrD,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;EAEjB;AC9IF,IAAA,mBDgJe"}
1
+ {"version":3,"file":"Select.js","names":[],"sources":["../src/components/Select/Select.tsx","../src/components/Select/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\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, { type ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { renderLabel } from '../Label';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends\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}\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.forwardRef(function SelectForwardedRef(props: SelectProps, ref: React.Ref<HTMLSelectElement>) {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId: 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 ...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, selectId, 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":";;;;;;;;;;;;AAoDA,IAAM,qBAAqB,eAA+B;AAGxD,QAAO,QAAQ,aAAA,GAAwC;;AAGzD,IAAM,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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;EAEjB;AC/IF,IAAA,mBDiJe"}
package/lib/Slider.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","names":["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 React, { useEffect, useState, useRef, useId } from 'react';\n\nimport classNames from 'classnames';\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, { ErrorWrapperClassNameProps } 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\n const setSafeValue = (newValue: number): void => {\n if (newValue > max) {\n setValue(max);\n } else if (newValue < min) {\n setValue(min);\n } else {\n setValue(newValue);\n }\n };\n\n useEffect(() => {\n setSafeValue(initial);\n }, [min, max]);\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,\n 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}\n\nexport const Slider = React.forwardRef((props: SliderProps, ref: React.Ref<HTMLInputElement>) => {\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 ...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":";;;;;;;;;;;;AAeA,IAAM,sBAAsB,SAAiB,KAAa,QAAmD;CAC3G,MAAM,CAAC,OAAO,YAAY,SAAS,QAAQ;CAE3C,MAAM,gBAAgB,aAA2B;AAC/C,MAAI,WAAW,IACb,UAAS,IAAI;WACJ,WAAW,IACpB,UAAS,IAAI;MAEb,UAAS,SAAS;;AAItB,iBAAgB;AACd,eAAa,QAAQ;IACpB,CAAC,KAAK,IAAI,CAAC;AAEd,QAAO,CAAC,OAAO,aAAa;;AA2C9B,MAAa,SAAS,MAAM,YAAY,OAAoB,QAAqC;CAC/F,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,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;CACtC,MAAM,WAAW,OAAuB,KAAK;CAC7C,MAAM,EAAE,WAAW,cAAc,iBAAmC,mBAAmB,IAAI,GAAG,MAAM,KAAK;CACzG,MAAM,aAAa,UAAU,CAAC,KAAK,UAAU,CAAC;CAE9C,MAA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,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;EAEjB;AAEF,OAAO,cAAc;AC9YrB,IAAA,mBDgZe"}
1
+ {"version":3,"file":"Slider.js","names":["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 React, { useEffect, useState, useRef, useId } from 'react';\n\nimport classNames from 'classnames';\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, { type ErrorWrapperClassNameProps } 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\n const setSafeValue = (newValue: number): void => {\n if (newValue > max) {\n setValue(max);\n } else if (newValue < min) {\n setValue(min);\n } else {\n setValue(newValue);\n }\n };\n\n useEffect(() => {\n setSafeValue(initial);\n }, [min, max]);\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}\n\nexport const Slider = React.forwardRef((props: SliderProps, ref: React.Ref<HTMLInputElement>) => {\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 ...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":";;;;;;;;;;;;AAeA,IAAM,sBAAsB,SAAiB,KAAa,QAAmD;CAC3G,MAAM,CAAC,OAAO,YAAY,SAAS,QAAQ;CAE3C,MAAM,gBAAgB,aAA2B;AAC/C,MAAI,WAAW,IACb,UAAS,IAAI;WACJ,WAAW,IACpB,UAAS,IAAI;MAEb,UAAS,SAAS;;AAItB,iBAAgB;AACd,eAAa,QAAQ;IACpB,CAAC,KAAK,IAAI,CAAC;AAEd,QAAO,CAAC,OAAO,aAAa;;AA0C9B,MAAa,SAAS,MAAM,YAAY,OAAoB,QAAqC;CAC/F,MAAM,EACJ,OACA,WACA,OACA,WACA,aAAa,iBACb,uBACA,WACA,YACA,WAAW,OACX,UACA,OACA,OAAO,GACP,WAAW,GACX,WAAW,QAAQ,MAAM,SAAS,IA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iB,EACzC,oBAAC,QAAA;MAAK,IAAI;gBAAe;OAAkB,CAAA;MACtC;;IAEL,CAAA;GACO;EAEjB;AAEF,OAAO,cAAc;AC7YrB,IAAA,mBD+Ye"}
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","names":["mergedResources: HNDesignsystemTextArea"],"sources":["../src/resources/HN.Designsystem.TextArea.en-GB.json","../src/resources/HN.Designsystem.TextArea.nb-NO.json","../src/resources/HN.Designsystem.TextArea.nn-NO.json","../src/components/Textarea/resourceHelper.ts","../src/components/Textarea/Textarea.tsx","../src/components/Textarea/index.tsx"],"sourcesContent":["{\n \"characters\": \"characters\"\n}\n","{\n \"characters\": \"tegn\"\n}\n","{\n \"characters\": \"teikn\"\n}\n","import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.TextArea.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.TextArea.nb-NO.json';\nimport nnNO from '../../resources/HN.Designsystem.TextArea.nn-NO.json';\nimport { HNDesignsystemTextArea } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemTextArea => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN_NYNORSK:\n return nnNO;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React, { useState, useRef, useEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor, LanguageLocales } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { HNDesignsystemTextArea } from '../../resources/Resources';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { useLanguage } from '../../utils/language';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport { renderLabel } from '../Label';\nimport MaxCharacters from '../MaxCharacters/MaxCharacters';\n\nimport styles from './styles.module.scss';\n\nexport interface TextareaProps\n extends ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLTextAreaElement>,\n | 'aria-describedby'\n | 'autoFocus'\n | 'disabled'\n | 'name'\n | 'autoComplete'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'defaultValue'\n | 'onChange'\n | 'value'\n > {\n /** max character limit in textarea */\n maxCharacters?: number;\n /** @deprecated use resources instead. The text is displayed in the end of the text-counter */\n maxText?: string;\n /** Width of textarea in characters (approximate) */\n width?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** If true, the component will have a bottom margin. */\n marginBottom?: boolean;\n /** If true, the component will be transparent. */\n transparent?: boolean;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Label of the input */\n label?: React.ReactNode;\n /** id of the textarea */\n textareaId?: string;\n /** max rows */\n maxRows?: number;\n /** min rows */\n minRows?: number;\n /** auto-grows until maxRows */\n grow?: boolean;\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 /** Resources for component */\n resources?: Partial<HNDesignsystemTextArea>;\n}\n\nconst getTextareaMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n const scrollbarWidth = '16px';\n const borderWidth = '4px';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${scrollbarWidth} + ${borderWidth})`;\n};\n\nconst Textarea = React.forwardRef((props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) => {\n const {\n maxCharacters,\n maxText,\n width,\n testId,\n defaultValue,\n marginBottom: gutterBottom,\n transparent,\n onColor = FormOnColor.onwhite,\n label,\n textareaId = uuid(),\n minRows = 3,\n maxRows = 10,\n grow,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n autoFocus,\n disabled,\n name,\n autoComplete = 'off',\n placeholder,\n readOnly,\n required,\n onChange,\n value,\n resources,\n ...rest\n } = props;\n\n const [rows, setRows] = useState(minRows);\n const [textareaInput, setTextareaInput] = useState(value || defaultValue || '');\n const referanse = useRef<HTMLDivElement>(null);\n const errorTextUuid = useIdWithFallback(errorTextIdProp);\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemTextArea = {\n ...defaultResources,\n ...resources,\n characters: maxText || resources?.characters || defaultResources.characters,\n };\n\n useEffect(() => {\n setTextareaInput(defaultValue || '');\n }, [defaultValue]);\n\n const resizeHeight = (target: HTMLTextAreaElement): void => {\n const textareaLineHeight = 28;\n\n const previousRows = target.rows;\n target.rows = minRows; // reset number of rows in textarea\n\n const currentRows = Math.floor((target.scrollHeight - 16) / textareaLineHeight); // scrollHeight - 16px of padding to calculate the rows\n\n if (currentRows === previousRows) {\n target.rows = currentRows;\n }\n\n if (currentRows >= maxRows) {\n target.rows = maxRows;\n target.scrollTop = target.scrollHeight;\n }\n\n if (currentRows < maxRows) {\n setRows(currentRows);\n } else {\n setRows(maxRows);\n }\n };\n\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;\n const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;\n\n const textareaWrapperClass = cn(styles.textarea, {\n [styles['textarea--gutterBottom']]: gutterBottom,\n });\n\n const contentWrapperClass = cn(styles['input-container'], {\n [styles['input-container--transparent']]: transparent,\n [styles['input-container--on-blueberry']]: onBlueberry,\n [styles['input-container--on-dark']]: onDark,\n [styles['input-container--invalid']]: onError,\n [styles['input-container--disabled']]: props.disabled,\n });\n\n const textareaClass = cn(styles['input-container__input'], {\n [styles[`input-container__input--disabled`]]: props.disabled,\n });\n\n useEffect(() => {\n if (value) setTextareaInput(value);\n\n if (grow && referanse.current?.children && referanse.current?.children[0]) {\n const textarea = referanse.current?.children[0] as HTMLTextAreaElement;\n resizeHeight(textarea);\n }\n }, [value]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n setTextareaInput(e.target.value);\n\n if (onChange) {\n onChange(e);\n }\n\n if (grow) {\n resizeHeight(e.target);\n }\n };\n\n const maxWidth = width ? getTextareaMaxWidth(width) : undefined;\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Textarea} className={textareaWrapperClass}>\n {renderLabel(label, textareaId, onColor as FormOnColor)}\n <div className={contentWrapperClass} ref={referanse} style={{ maxWidth }}>\n <textarea\n {...rest}\n rows={rows}\n defaultValue={defaultValue}\n id={textareaId}\n className={textareaClass}\n ref={ref}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={!!onError}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n disabled={disabled}\n name={name}\n autoComplete={autoComplete ? autoComplete : undefined}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n onChange={onChangeHandler}\n value={value}\n />\n </div>\n {maxCharacters && (\n <MaxCharacters\n maxCharacters={maxCharacters}\n length={textareaInput.toString().length}\n maxText={mergedResources.characters}\n onColor={onColor}\n maxWidth={maxWidth}\n />\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nTextarea.displayName = 'Textarea';\n\nexport default Textarea;\n","import Textarea from './Textarea';\nexport * from './Textarea';\nexport default Textarea;\n"],"mappings":";;;;;;;;;;;;;;;AGMA,MAAa,gBAAgB,aAAsD;AACjF,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB,kBACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACqDb,IAAM,uBAAuB,iBAA+B;AAK1D,QAAO,QAAQ,eAAA,GAAwC;;AAGzD,IAAM,WAAW,MAAM,YAAY,OAAsB,QAAwC;CAC/F,MAAM,EACJ,eACA,SACA,O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["../src/resources/HN.Designsystem.TextArea.en-GB.json","../src/resources/HN.Designsystem.TextArea.nb-NO.json","../src/resources/HN.Designsystem.TextArea.nn-NO.json","../src/components/Textarea/resourceHelper.ts","../src/components/Textarea/Textarea.tsx","../src/components/Textarea/index.tsx"],"sourcesContent":["{\n \"characters\": \"characters\"\n}\n","{\n \"characters\": \"tegn\"\n}\n","{\n \"characters\": \"teikn\"\n}\n","import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.TextArea.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.TextArea.nb-NO.json';\nimport nnNO from '../../resources/HN.Designsystem.TextArea.nn-NO.json';\nimport { HNDesignsystemTextArea } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemTextArea => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN_NYNORSK:\n return nnNO;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React, { useState, useRef, useEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport type { HNDesignsystemTextArea } from '../../resources/Resources';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor, LanguageLocales } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { useLanguage } from '../../utils/language';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { type ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport { renderLabel } from '../Label';\nimport MaxCharacters from '../MaxCharacters/MaxCharacters';\n\nimport styles from './styles.module.scss';\n\nexport interface TextareaProps\n extends\n ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLTextAreaElement>,\n | 'aria-describedby'\n | 'autoFocus'\n | 'disabled'\n | 'name'\n | 'autoComplete'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'defaultValue'\n | 'onChange'\n | 'value'\n > {\n /** max character limit in textarea */\n maxCharacters?: number;\n /** @deprecated use resources instead. The text is displayed in the end of the text-counter */\n maxText?: string;\n /** Width of textarea in characters (approximate) */\n width?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** If true, the component will have a bottom margin. */\n marginBottom?: boolean;\n /** If true, the component will be transparent. */\n transparent?: boolean;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Label of the input */\n label?: React.ReactNode;\n /** id of the textarea */\n textareaId?: string;\n /** max rows */\n maxRows?: number;\n /** min rows */\n minRows?: number;\n /** auto-grows until maxRows */\n grow?: boolean;\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 /** Resources for component */\n resources?: Partial<HNDesignsystemTextArea>;\n}\n\nconst getTextareaMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n const scrollbarWidth = '16px';\n const borderWidth = '4px';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${scrollbarWidth} + ${borderWidth})`;\n};\n\nconst Textarea = React.forwardRef((props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) => {\n const {\n maxCharacters,\n maxText,\n width,\n testId,\n defaultValue,\n marginBottom: gutterBottom,\n transparent,\n onColor = FormOnColor.onwhite,\n label,\n textareaId = uuid(),\n minRows = 3,\n maxRows = 10,\n grow,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n autoFocus,\n disabled,\n name,\n autoComplete = 'off',\n placeholder,\n readOnly,\n required,\n onChange,\n value,\n resources,\n ...rest\n } = props;\n\n const [rows, setRows] = useState(minRows);\n const [textareaInput, setTextareaInput] = useState(value || defaultValue || '');\n const referanse = useRef<HTMLDivElement>(null);\n const errorTextUuid = useIdWithFallback(errorTextIdProp);\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemTextArea = {\n ...defaultResources,\n ...resources,\n characters: maxText || resources?.characters || defaultResources.characters,\n };\n\n useEffect(() => {\n setTextareaInput(defaultValue || '');\n }, [defaultValue]);\n\n const resizeHeight = (target: HTMLTextAreaElement): void => {\n const textareaLineHeight = 28;\n\n const previousRows = target.rows;\n target.rows = minRows; // reset number of rows in textarea\n\n const currentRows = Math.floor((target.scrollHeight - 16) / textareaLineHeight); // scrollHeight - 16px of padding to calculate the rows\n\n if (currentRows === previousRows) {\n target.rows = currentRows;\n }\n\n if (currentRows >= maxRows) {\n target.rows = maxRows;\n target.scrollTop = target.scrollHeight;\n }\n\n if (currentRows < maxRows) {\n setRows(currentRows);\n } else {\n setRows(maxRows);\n }\n };\n\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;\n const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;\n\n const textareaWrapperClass = cn(styles.textarea, {\n [styles['textarea--gutterBottom']]: gutterBottom,\n });\n\n const contentWrapperClass = cn(styles['input-container'], {\n [styles['input-container--transparent']]: transparent,\n [styles['input-container--on-blueberry']]: onBlueberry,\n [styles['input-container--on-dark']]: onDark,\n [styles['input-container--invalid']]: onError,\n [styles['input-container--disabled']]: props.disabled,\n });\n\n const textareaClass = cn(styles['input-container__input'], {\n [styles[`input-container__input--disabled`]]: props.disabled,\n });\n\n useEffect(() => {\n if (value) setTextareaInput(value);\n\n if (grow && referanse.current?.children && referanse.current?.children[0]) {\n const textarea = referanse.current?.children[0] as HTMLTextAreaElement;\n resizeHeight(textarea);\n }\n }, [value]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n setTextareaInput(e.target.value);\n\n if (onChange) {\n onChange(e);\n }\n\n if (grow) {\n resizeHeight(e.target);\n }\n };\n\n const maxWidth = width ? getTextareaMaxWidth(width) : undefined;\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Textarea} className={textareaWrapperClass}>\n {renderLabel(label, textareaId, onColor as FormOnColor)}\n <div className={contentWrapperClass} ref={referanse} style={{ maxWidth }}>\n <textarea\n {...rest}\n rows={rows}\n defaultValue={defaultValue}\n id={textareaId}\n className={textareaClass}\n ref={ref}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={!!onError}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n disabled={disabled}\n name={name}\n autoComplete={autoComplete ? autoComplete : undefined}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n onChange={onChangeHandler}\n value={value}\n />\n </div>\n {maxCharacters && (\n <MaxCharacters\n maxCharacters={maxCharacters}\n length={textareaInput.toString().length}\n maxText={mergedResources.characters}\n onColor={onColor}\n maxWidth={maxWidth}\n />\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nTextarea.displayName = 'Textarea';\n\nexport default Textarea;\n","import Textarea from './Textarea';\nexport * from './Textarea';\nexport default Textarea;\n"],"mappings":";;;;;;;;;;;;;;;AGMA,MAAa,gBAAgB,aAAsD;AACjF,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB,kBACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACuDb,IAAM,uBAAuB,iBAA+B;AAK1D,QAAO,QAAQ,eAAA,GAAwC;;AAGzD,IAAM,WAAW,MAAM,YAAY,OAAsB,QAAwC;CAC/F,MAAM,EACJ,eACA,SACA,OACA,QACA,cACA,cAAc,cACd,aACA,UAAU,YAAY,SACtB,OACA,aAAa,MAAM,EACnB,UAAU,GACV,UAAU,IACV,MACA,OACA,WACA,aAAa,iBACb,uBACA,WACA,UACA,MACA,eAAe,OACf,aACA,UACA,UACA,UACA,OACA,WACA,GAAG,SACD;CAEJ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,CAAC;AAEF,iBAAgB;AACd,MAAI,MAAO,kBAAiB,MAAM;AAElC,MAAI,QAAQ,UAAU,SAAS,YAAY,UAAU,SAAS,SAAS,IAAI;GACzE,MAAM,WAAW,UAAU,SAAS,SAAS;AAC7C,gBAAa,SAAS;;IAEvB,CAAC,MAAM,CAAC;CAEX,MAAM,mBAAmB,MAAoD;AAC3E,mBAAiB,EAAE,OAAO,MAAM;AAEhC,MAAI,SACF,UAAS,EAAE;AAGb,MAAI,KACF,cAAa,EAAE,OAAO;;CAI1B,MAAM,WAAW,QAAQ,oBAAoB,MAAM,GAAG,KAAA;AAEtD,QACE,oBAAC,sBAAA;EAAa,WAAW;EAAkC;EAAW,aAAa;YACjF,qBAAC,OAAA;GAAI,eAAa;GAAQ,oBAAkB,YAAY;GAAU,WAAW;;IAC1E,YAAY,OAAO,YAAY,QAAuB;IACvD,oBAAC,OAAA;KAAI,WAAW;KAAqB,KAAK;KAAW,OAAO,EAAE,UAAU;eACtE,oBAAC,YAAA;MACC,GAAI;MACE;MACQ;MACd,IAAI;MACJ,WAAW;MACN;MACL,oBAAkB,mBAAmB,OAAO,cAAc;MAC1D,gBAAc,CAAC,CAAC;MAEL;MACD;MACJ;MACN,cAAc,eAAe,eAAe,KAAA;MAC/B;MACH;MACA;MACV,UAAU;MACH;OACP;MACE;IACL,iBACC,oBAAC,uBAAA;KACgB;KACf,QAAQ,cAAc,UAAU,CAAC;KACjC,SAAS,gBAAgB;KAChB;KACC;MACV;;IAEA;GACO;EAEjB;AAEF,SAAS,cAAc;ACzOvB,IAAA,qBD2Oe"}
@@ -1,5 +1,4 @@
1
1
  import { r as uuid_exports } from "../uuid.js";
2
- import "../environment.js";
3
2
  var testId = { id: 0 };
4
3
  vi.spyOn(uuid_exports, "uuid").mockImplementation(() => {
5
4
  testId.id++;
@@ -1 +1 @@
1
- {"version":3,"file":"uuid.js","names":[],"sources":["../../src/__mocks__/uuid.ts"],"sourcesContent":["import * as uuidUtils from '../utils/uuid';\n\nconst testId = {\n id: 0,\n};\n\n/**\n * Returnerer en unik, forutsigbar id hver gang uuid() kalles\n */\nvi.spyOn(uuidUtils, 'uuid').mockImplementation(() => {\n testId.id++;\n return `testid-${testId.id}`;\n});\n"],"mappings":";;AAEA,IAAM,SAAS,EACb,IAAI,GACL;AAKD,GAAG,MAAM,cAAW,OAAO,CAAC,yBAAyB;AACnD,QAAO;AACP,QAAO,UAAU,OAAO;EACxB"}
1
+ {"version":3,"file":"uuid.js","names":[],"sources":["../../src/__mocks__/uuid.ts"],"sourcesContent":["import * as uuidUtils from '../utils/uuid';\n\nconst testId = {\n id: 0,\n};\n\n/**\n * Returnerer en unik, forutsigbar id hver gang uuid() kalles\n */\nvi.spyOn(uuidUtils, 'uuid').mockImplementation(() => {\n testId.id++;\n return `testid-${testId.id}`;\n});\n"],"mappings":";AAEA,IAAM,SAAS,EACb,IAAI,GACL;AAKD,GAAG,MAAM,cAAW,OAAO,CAAC,yBAAyB;AACnD,QAAO;AACP,QAAO,UAAU,OAAO;EACxB"}
@@ -1,15 +1,2 @@
1
- import "../../constants2.js";
2
- import "../../usePseudoClasses.js";
3
- import "../../grid.js";
4
- import "../../palette.js";
5
- import "../../spacers.js";
6
- import "../../theme.js";
7
- import "../../color.js";
8
- import "../../spacing.js";
9
- import "../../currys.js";
10
- import "../../refs.js";
11
- import "../../AsChildSlot.js";
12
- import "../../Icon.js";
13
- import "../../ArrowUpRight.js";
14
1
  import { t as AnchorLink_default } from "../../AnchorLink.js";
15
2
  export { AnchorLink_default as default };
@@ -1,3 +1,2 @@
1
- import "../../refs.js";
2
1
  import { n as AsChildSlot, t as AsChildSlot_default } from "../../AsChildSlot.js";
3
2
  export { AsChildSlot, AsChildSlot_default as default };
@@ -1,6 +1,2 @@
1
- import "../../constants2.js";
2
- import "../../palette.js";
3
- import "../../Icon.js";
4
- import "../../Check.js";
5
1
  import { n as AvatarSize, t as Avatar_default } from "../../Avatar.js";
6
2
  export { AvatarSize, Avatar_default as default };
@@ -1,10 +1,2 @@
1
- import "../../constants2.js";
2
- import "../../palette.js";
3
- import "../../Icon.js";
4
- import "../../CheckFill.js";
5
- import "../../ErrorSignFill.js";
6
- import "../../InfoSignFill.js";
7
- import "../../TriangleX.js";
8
- import "../../NotificationBadge.js";
9
1
  import { t as Badge_default } from "../../Badge.js";
10
2
  export { Badge_default as default };
@@ -1,19 +1,2 @@
1
- import "../../environment.js";
2
- import "../../constants2.js";
3
- import "../../usePseudoClasses.js";
4
- import "../../grid.js";
5
- import "../../palette.js";
6
- import "../../spacers.js";
7
- import "../../theme.js";
8
- import "../../color.js";
9
- import "../../Icon.js";
10
- import "../../_rolldown_dynamic_import_helper.js";
11
- import "../../useIsServerSide.js";
12
- import "../../LazyIcon.js";
13
- import "../../component.js";
14
- import "../../useIcons.js";
15
- import "../../useBreakpoint.js";
16
- import "../../useIsMobileBreakpoint.js";
17
- import "../../ArrowRight.js";
18
1
  import { t as Button_default } from "../../Button.js";
19
2
  export { Button_default as default };
@@ -1,47 +1,3 @@
1
- import "../../uuid.js";
2
- import "../../environment.js";
3
- import "../../constants2.js";
4
- import "../../usePseudoClasses.js";
5
- import "../../grid.js";
6
- import "../../palette.js";
7
- import "../../spacers.js";
8
- import "../../theme.js";
9
- import "../../color.js";
10
- import "../../spacing.js";
11
- import "../../currys.js";
12
- import "../../refs.js";
13
- import "../../Icon.js";
14
- import "../../language.js";
15
- import "../../Check.js";
16
- import "../../_rolldown_dynamic_import_helper.js";
17
- import "../../useIsServerSide.js";
18
- import "../../LazyIcon.js";
19
- import "../../component.js";
20
- import "../../useBreakpoint.js";
21
- import "../../useIdWithFallback.js";
22
- import "../../accessibility.js";
23
- import "../../ErrorWrapper.js";
24
- import "../../Spacer.js";
25
- import "../../Label.js";
26
- import "../../FormFieldTag.js";
27
- import "../../useElementList.js";
28
- import "../../useFocusableElements.js";
29
- import "../../useFocusToggle.js";
30
- import "../../focus.js";
31
- import "../../useFocusTrap.js";
32
- import "../../useIntersectionObserver.js";
33
- import "../../useIsVisible.js";
34
- import "../../debounce.js";
35
- import "../../useLayoutEvent.js";
36
- import "../../usePrevious.js";
37
- import "../../useSize.js";
38
- import "../../useResizeObserver.js";
39
- import "../../useToggle.js";
40
- import "../../useKeyboardEvent.js";
41
- import "../../useOutsideEvent.js";
42
- import "../../mobile.js";
43
- import "../../src.js";
44
- import "../../StatusDot.js";
45
1
  import { t as Checkbox } from "../../Checkbox.js";
46
2
  import { t as Checkbox_default } from "../../Checkbox2.js";
47
3
  export { Checkbox, Checkbox_default as default };
@@ -1,10 +1,2 @@
1
- import "../../constants2.js";
2
- import "../../usePseudoClasses.js";
3
- import "../../grid.js";
4
- import "../../refs.js";
5
- import "../../Icon.js";
6
- import "../../useBreakpoint.js";
7
- import "../../useIsMobileBreakpoint.js";
8
- import "../../X.js";
9
1
  import { t as Close_default } from "../../Close.js";
10
2
  export { Close_default as default };
@@ -1,3 +1,2 @@
1
- import "../../constants2.js";
2
1
  import { t as DictionaryTrigger_default } from "../../DictionaryTrigger.js";
3
2
  export { DictionaryTrigger_default as default };
@@ -1,39 +1,2 @@
1
- import "../../uuid.js";
2
- import "../../environment.js";
3
- import "../../constants2.js";
4
- import "../../usePseudoClasses.js";
5
- import "../../grid.js";
6
- import "../../palette.js";
7
- import "../../spacers.js";
8
- import "../../theme.js";
9
- import "../../color.js";
10
- import "../../refs.js";
11
- import "../../Icon.js";
12
- import "../../language.js";
13
- import "../../_rolldown_dynamic_import_helper.js";
14
- import "../../useIsServerSide.js";
15
- import "../../LazyIcon.js";
16
- import "../../component.js";
17
- import "../../useIcons.js";
18
- import "../../useBreakpoint.js";
19
- import "../../useIsMobileBreakpoint.js";
20
- import "../../ArrowRight.js";
21
- import "../../Button.js";
22
- import "../../accessibility.js";
23
- import "../../useElementList.js";
24
- import "../../useFocusableElements.js";
25
- import "../../focus.js";
26
- import "../../useFocusTrap.js";
27
- import "../../useIntersectionObserver.js";
28
- import "../../useIsVisible.js";
29
- import "../../useKeyboardEvent.js";
30
- import "../../useOutsideEvent.js";
31
- import "../../X.js";
32
- import "../../Close.js";
33
1
  import { t as Drawer_default } from "../../Drawer.js";
34
- import "../../deepContains.js";
35
- import "../../useReturnFocusOnUnmount.js";
36
- import "../../scroll.js";
37
- import "../../Title.js";
38
- import "../../Title2.js";
39
2
  export { Drawer_default as default };
@@ -182,5 +182,11 @@
182
182
  column-gap: var(--core-space-2xs) 0;
183
183
  padding: var(--core-space-2xs) 0;
184
184
  }
185
+
186
+ // Hack in order to not cut the buttons on iOS in app browser from iOS 26
187
+ // Selector targets iOS
188
+ @supports (font: -apple-system-body) and (-webkit-appearance: none) {
189
+ padding-bottom: 2.5rem;
190
+ }
185
191
  }
186
192
  }
@@ -1,5 +1,3 @@
1
- import "../../../refs.js";
2
- import "../../../AsChildSlot.js";
3
1
  import { n as SingleSelectItem_default, t as SingleSelectItem } from "../../../SingleSelectItem.js";
4
2
  var SingleSelect_default = SingleSelectItem_default;
5
3
  export { SingleSelectItem, SingleSelect_default as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/Dropdown/SingleSelect/index.ts"],"sourcesContent":["import SingleSelectItem from './SingleSelectItem';\nexport * from './SingleSelectItem';\nexport default SingleSelectItem;\n"],"mappings":";;;AAEA,IAAA,uBAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/Dropdown/SingleSelect/index.ts"],"sourcesContent":["import SingleSelectItem from './SingleSelectItem';\nexport * from './SingleSelectItem';\nexport default SingleSelectItem;\n"],"mappings":";AAEA,IAAA,uBAAe"}