@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
package/lib/Label.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","names":["Sublabel: React.FC<SublabelProps>","Label: FunctionComponent<LabelProps>"],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport cn from 'classnames';\n\nimport { LabelText } from './Label';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport Spacer from '../Spacer';\n\nimport styles from './styles.module.scss';\n\nexport interface SublabelProps {\n /** Sets the content of the Sublabel */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** id that is placed on the wrapper */\n id: string;\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: FormOnColor;\n /** Array of sublabel strings. Can be of type semibold or normal */\n sublabelTexts?: LabelText[];\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Sublabel: React.FC<SublabelProps> = ({ children, className, id, onColor, sublabelTexts, testId }) => {\n const mapSublabels = (hideFromScreenReader?: boolean): React.ReactNode => {\n return (\n sublabelTexts &&\n sublabelTexts.map((sublabelText, index) => {\n const labelClasses = cn(styles.label, styles['sublabel'], {\n [styles['sublabel--subdued']]: sublabelText.type === 'subdued',\n [styles['sublabel--on-dark']]: onColor === FormOnColor.ondark,\n });\n return (\n hideFromScreenReader === sublabelText.hideFromScreenReader && (\n <span className={labelClasses} key={index}>\n {sublabelText.text}\n </span>\n )\n );\n })\n );\n };\n\n const subLabels = mapSublabels();\n const ariaHiddenSublabels = mapSublabels(true);\n\n return (\n <>\n <Spacer size={'3xs'} />\n {(subLabels || children) && (\n <div className={className} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Sublabel}>\n {subLabels}\n {children}\n </div>\n )}\n {ariaHiddenSublabels && (\n <div className={className} data-testid={testId}>\n {ariaHiddenSublabels}\n </div>\n )}\n </>\n );\n};\n","import React, { FunctionComponent } from 'react';\n\nimport cn from 'classnames';\n\nimport { Sublabel, SublabelProps } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag, { FormFieldTagProps } from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot, { StatusDotProps } from '../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type LabelText = {\n hideFromScreenReader?: boolean;\n text: string;\n type?: 'normal' | 'subdued';\n};\n\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p';\n\nexport interface LabelProps {\n /** Component shown after label - discourage use of this */\n afterLabelChildren?: React.ReactNode;\n /** Sets the content of the Label */\n children?: React.ReactNode;\n /** Sets a tag that describes whether the form field is required or optional */\n formFieldTag?: React.ReactNode;\n /** Adds custom classes to the label tag. */\n labelClassName?: string;\n /** Adds custom classes to the label text. */\n labelTextClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Id that is put on the \"for\" attribute of the label */\n htmlFor?: string;\n /** Changes the underlying element of the label */\n htmlMarkup?: LabelTags;\n /** Id som plasseres på <label/> */\n labelId?: string;\n /** Array of main label strings. Can be of type semibold or normal */\n labelTexts?: LabelText[];\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: keyof typeof FormOnColor;\n /** StatusDot placed underneath the last sublabel */\n statusDot?: React.ReactNode;\n /** Sublabel component */\n sublabel?: React.ReactNode;\n /** Adds custom classes to the div wrapping the sublabels. */\n sublabelWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const getLabelText = (label: React.ReactNode): string => {\n let allLabelText = '';\n\n if (isComponent<LabelProps>(label, Label)) {\n label.props.labelTexts?.forEach(labelText => {\n allLabelText += !labelText.hideFromScreenReader ? labelText.text : '';\n });\n }\n\n return allLabelText;\n};\n\nexport const renderLabel = (label: React.ReactNode, inputId: string, onColor: FormOnColor, markup?: LabelTags): React.ReactNode => {\n return (\n <>\n {label && isComponent<LabelProps>(label, Label)\n ? React.cloneElement(label, {\n htmlFor: inputId,\n htmlMarkup: markup || 'label',\n onColor,\n })\n : typeof label === 'string' && <Label labelTexts={[{ text: label, type: 'normal' }]} htmlFor={inputId} onColor={onColor} />}\n </>\n );\n};\n\nexport const renderLabelAsParent = (\n label: React.ReactNode,\n children: React.ReactNode,\n inputId: string,\n onColor: FormOnColor,\n labelClassName?: string,\n labelTextClassName?: string,\n sublabelWrapperClassName?: string,\n large?: boolean,\n markup?: LabelTags\n): React.ReactNode => {\n return (\n <>\n {label && isComponent<LabelProps>(label, Label)\n ? React.cloneElement(label, {\n htmlFor: inputId,\n onColor,\n children: children,\n labelClassName: cn(labelClassName, label.props.labelClassName),\n labelTextClassName: labelTextClassName,\n htmlMarkup: markup || 'label',\n sublabelWrapperClassName: sublabelWrapperClassName,\n sublabel: large ? undefined : label.props.sublabel,\n statusDot: large ? undefined : label.props.statusDot,\n })\n : typeof label === 'string' && (\n <Label\n labelTexts={[{ text: label, type: 'subdued' }]}\n htmlFor={inputId}\n onColor={onColor}\n htmlMarkup={markup || 'label'}\n labelClassName={labelClassName}\n labelTextClassName={labelTextClassName}\n sublabelWrapperClassName={sublabelWrapperClassName}\n >\n {children}\n </Label>\n )}\n </>\n );\n};\n\nconst Label: FunctionComponent<LabelProps> = ({\n afterLabelChildren,\n children,\n className,\n formFieldTag,\n htmlFor,\n htmlMarkup = 'label',\n labelClassName,\n labelTextClassName,\n labelId,\n labelTexts,\n onColor = FormOnColor.onwhite,\n statusDot,\n sublabel,\n sublabelWrapperClassName,\n testId,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(\n styles['label-wrapper'],\n { [styles['label-wrapper--no-bottom-margin']]: hasChildren, [styles['label-wrapper--after-label-children']]: afterLabelChildren },\n className\n );\n\n const mapLabels = (): React.ReactNode => {\n if (typeof labelTexts === 'undefined') return null;\n\n return labelTexts.map((labelText, index) => {\n const labelClasses = cn(\n styles.label,\n {\n [styles['label--subdued']]: labelText.type === 'subdued',\n [styles['label--on-dark']]: onColor === FormOnColor.ondark,\n },\n labelTextClassName\n );\n return (\n <span aria-hidden={labelText.hideFromScreenReader} className={labelClasses} key={index}>\n {labelText.text}\n </span>\n );\n });\n };\n const CustomTag = htmlMarkup;\n\n return (\n <div className={labelWrapperClasses}>\n <div>\n <CustomTag className={labelClassName} id={labelId} htmlFor={htmlFor} data-testid={testId} data-analyticsid={AnalyticsId.Label}>\n <span className={styles['label-content-wrapper']}>\n {children}\n <span className={styles.label__texts}>{mapLabels()}</span>\n </span>\n </CustomTag>\n {(sublabel || statusDot || formFieldTag) && (\n <div className={sublabelWrapperClassName}>\n {formFieldTag && isComponent<FormFieldTagProps>(formFieldTag, FormFieldTag) && React.cloneElement(formFieldTag)}\n {sublabel &&\n isComponent<SublabelProps>(sublabel, Sublabel) &&\n React.cloneElement(sublabel, {\n onColor: onColor as FormOnColor,\n })}\n {statusDot && isComponent<StatusDotProps>(statusDot, StatusDot) && (\n <>\n <Spacer size={'3xs'} />\n {React.cloneElement(statusDot, {\n onColor: onColor === FormOnColor.ondark ? 'ondark' : 'onwhite',\n })}\n </>\n )}\n </div>\n )}\n </div>\n {afterLabelChildren && <div className={styles['after-label-children']}>{afterLabelChildren}</div>}\n </div>\n );\n};\n\nexport default Label;\n","import Label from './Label';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,UACD,oBAAC,QAAA;KAAK,WAAW,OAAO;eAAe,WAAW;MAAQ,CAAA;KACrD;IACG,GACV,YAAY,aAAa,iBACzB,qBAAC,OAAA;GAAI,WAAW;;IACb,gBAAgB,YAA+B,cAAc,qBAAa,IAAI,MAAM,aAAa,aAAa;IAC9G,YACC,YAA2B,UAAU,SAAS,IAC9C,MAAM,aAAa,UAAU,EAClB,SACV,CAAC;IACH,aAAa,YAA4B,WAAW,kBAAU,IAC7D,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,gBAAA,EAAO,MAAM,OAAA,CAAS,EACtB,MAAM,aAAa,WAAW,EAC7B,SAAS,YAAY,YAAY,SAAS,WAAW,WACtD,CAAC,CAAA,EAAA,CACD;;IAED,CAAA,EAAA,CAEJ,EACL,sBAAsB,oBAAC,OAAA;GAAI,WAAW,OAAO;aAA0B;IAAyB,CAAA;GAC7F;;ACjMV,IAAA,kBDqMe"}
1
+ {"version":3,"file":"Label.js","names":["Sublabel: React.FC<SublabelProps>","Label: FunctionComponent<LabelProps>"],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport cn from 'classnames';\n\nimport { LabelText } from './Label';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport Spacer from '../Spacer';\n\nimport styles from './styles.module.scss';\n\nexport interface SublabelProps {\n /** Sets the content of the Sublabel */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** id that is placed on the wrapper */\n id: string;\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: FormOnColor;\n /** Array of sublabel strings. Can be of type semibold or normal */\n sublabelTexts?: LabelText[];\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Sublabel: React.FC<SublabelProps> = ({ children, className, id, onColor, sublabelTexts, testId }) => {\n const mapSublabels = (hideFromScreenReader?: boolean): React.ReactNode => {\n return (\n sublabelTexts &&\n sublabelTexts.map((sublabelText, index) => {\n const labelClasses = cn(styles.label, styles['sublabel'], {\n [styles['sublabel--subdued']]: sublabelText.type === 'subdued',\n [styles['sublabel--on-dark']]: onColor === FormOnColor.ondark,\n });\n return (\n hideFromScreenReader === sublabelText.hideFromScreenReader && (\n <span className={labelClasses} key={index}>\n {sublabelText.text}\n </span>\n )\n );\n })\n );\n };\n\n const subLabels = mapSublabels();\n const ariaHiddenSublabels = mapSublabels(true);\n\n return (\n <>\n <Spacer size={'3xs'} />\n {(subLabels || children) && (\n <div className={className} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Sublabel}>\n {subLabels}\n {children}\n </div>\n )}\n {ariaHiddenSublabels && (\n <div className={className} data-testid={testId}>\n {ariaHiddenSublabels}\n </div>\n )}\n </>\n );\n};\n","import React, { FunctionComponent } from 'react';\n\nimport cn from 'classnames';\n\nimport { Sublabel, SublabelProps } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag, { FormFieldTagProps } from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot, { StatusDotProps } from '../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type LabelText = {\n hideFromScreenReader?: boolean;\n text: string;\n type?: 'normal' | 'subdued';\n};\n\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p' | 'legend';\n\nexport interface LabelProps {\n /** Component shown after label - discourage use of this */\n afterLabelChildren?: React.ReactNode;\n /** Sets the content of the Label */\n children?: React.ReactNode;\n /** Sets a tag that describes whether the form field is required or optional */\n formFieldTag?: React.ReactNode;\n /** Adds custom classes to the label tag. */\n labelClassName?: string;\n /** Adds custom classes to the label text. */\n labelTextClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Id that is put on the \"for\" attribute of the label */\n htmlFor?: string;\n /** Changes the underlying element of the label */\n htmlMarkup?: LabelTags;\n /** Id som plasseres på <label/> */\n labelId?: string;\n /** Array of main label strings. Can be of type semibold or normal */\n labelTexts?: LabelText[];\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: keyof typeof FormOnColor;\n /** StatusDot placed underneath the last sublabel */\n statusDot?: React.ReactNode;\n /** Sublabel component */\n sublabel?: React.ReactNode;\n /** Adds custom classes to the div wrapping the sublabels. */\n sublabelWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const getLabelText = (label: React.ReactNode): string => {\n let allLabelText = '';\n\n if (isComponent<LabelProps>(label, Label)) {\n label.props.labelTexts?.forEach(labelText => {\n allLabelText += !labelText.hideFromScreenReader ? labelText.text : '';\n });\n }\n\n return allLabelText;\n};\n\nexport const renderLabel = (label: React.ReactNode, inputId: string, onColor: FormOnColor, markup?: LabelTags): React.ReactNode => {\n return (\n <>\n {label && isComponent<LabelProps>(label, Label)\n ? React.cloneElement(label, {\n htmlFor: inputId,\n htmlMarkup: markup || 'label',\n onColor,\n })\n : typeof label === 'string' && <Label labelTexts={[{ text: label, type: 'normal' }]} htmlFor={inputId} onColor={onColor} />}\n </>\n );\n};\n\nexport const renderLabelAsParent = (\n label: React.ReactNode,\n children: React.ReactNode,\n inputId: string,\n onColor: FormOnColor,\n labelClassName?: string,\n labelTextClassName?: string,\n sublabelWrapperClassName?: string,\n large?: boolean,\n markup?: LabelTags\n): React.ReactNode => {\n return (\n <>\n {label && isComponent<LabelProps>(label, Label)\n ? React.cloneElement(label, {\n htmlFor: inputId,\n onColor,\n children: children,\n labelClassName: cn(labelClassName, label.props.labelClassName),\n labelTextClassName: labelTextClassName,\n htmlMarkup: markup || 'label',\n sublabelWrapperClassName: sublabelWrapperClassName,\n sublabel: large ? undefined : label.props.sublabel,\n statusDot: large ? undefined : label.props.statusDot,\n })\n : typeof label === 'string' && (\n <Label\n labelTexts={[{ text: label, type: 'subdued' }]}\n htmlFor={inputId}\n onColor={onColor}\n htmlMarkup={markup || 'label'}\n labelClassName={labelClassName}\n labelTextClassName={labelTextClassName}\n sublabelWrapperClassName={sublabelWrapperClassName}\n >\n {children}\n </Label>\n )}\n </>\n );\n};\n\nconst Label: FunctionComponent<LabelProps> = ({\n afterLabelChildren,\n children,\n className,\n formFieldTag,\n htmlFor,\n htmlMarkup = 'label',\n labelClassName,\n labelTextClassName,\n labelId,\n labelTexts,\n onColor = FormOnColor.onwhite,\n statusDot,\n sublabel,\n sublabelWrapperClassName,\n testId,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(\n styles['label-wrapper'],\n { [styles['label-wrapper--no-bottom-margin']]: hasChildren, [styles['label-wrapper--after-label-children']]: afterLabelChildren },\n className\n );\n\n const mapLabels = (): React.ReactNode => {\n if (typeof labelTexts === 'undefined') return null;\n\n return labelTexts.map((labelText, index) => {\n const labelClasses = cn(\n styles.label,\n {\n [styles['label--subdued']]: labelText.type === 'subdued',\n [styles['label--on-dark']]: onColor === FormOnColor.ondark,\n },\n labelTextClassName\n );\n return (\n <span aria-hidden={labelText.hideFromScreenReader} className={labelClasses} key={index}>\n {labelText.text}\n </span>\n );\n });\n };\n const CustomTag = htmlMarkup;\n\n return (\n <div className={labelWrapperClasses}>\n <div>\n <CustomTag className={labelClassName} id={labelId} htmlFor={htmlFor} data-testid={testId} data-analyticsid={AnalyticsId.Label}>\n <span className={styles['label-content-wrapper']}>\n {children}\n <span className={styles.label__texts}>{mapLabels()}</span>\n </span>\n </CustomTag>\n {(sublabel || statusDot || formFieldTag) && (\n <div className={sublabelWrapperClassName}>\n {formFieldTag && isComponent<FormFieldTagProps>(formFieldTag, FormFieldTag) && React.cloneElement(formFieldTag)}\n {sublabel &&\n isComponent<SublabelProps>(sublabel, Sublabel) &&\n React.cloneElement(sublabel, {\n onColor: onColor as FormOnColor,\n })}\n {statusDot && isComponent<StatusDotProps>(statusDot, StatusDot) && (\n <>\n <Spacer size={'3xs'} />\n {React.cloneElement(statusDot, {\n onColor: onColor === FormOnColor.ondark ? 'ondark' : 'onwhite',\n })}\n </>\n )}\n </div>\n )}\n </div>\n {afterLabelChildren && <div className={styles['after-label-children']}>{afterLabelChildren}</div>}\n </div>\n );\n};\n\nexport default Label;\n","import Label from './Label';\nexport { Sublabel } from './SubLabel';\nexport * from './Label';\nexport default Label;\n"],"mappings":";;;;;;;;;AAyBA,MAAaA,YAAqC,EAAE,UAAU,WAAW,IAAI,SAAS,eAAe,aAAa;CAChH,MAAM,gBAAgB,yBAAoD;AACxE,SACE,iBACA,cAAc,KAAK,cAAc,UAAU;GACzC,MAAM,eAAe,WAAG,OAAO,OAAO,OAAO,aAAa;KACvD,OAAO,uBAAuB,aAAa,SAAS;KACpD,OAAO,uBAAuB,YAAY,YAAY;IACxD,CAAC;AACF,UACE,yBAAyB,aAAa,wBACpC,oBAAC,QAAA;IAAK,WAAW;cACd,aAAa;MADoB,MAE7B;IAGX;;CAIN,MAAM,YAAY,cAAc;CAChC,MAAM,sBAAsB,aAAa,KAAK;AAE9C,QACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,gBAAA,EAAO,MAAM,OAAA,CAAS;GACrB,aAAa,aACb,qBAAC,OAAA;GAAe;GAAe;GAAI,eAAa;GAAQ,oBAAkB,YAAY;cACnF,WACA,SAAA;IACG;EAEP,uBACC,oBAAC,OAAA;GAAe;GAAW,eAAa;aACrC;IACG;KAEP;;ACRP,MAAa,gBAAgB,UAAmC;CAC9D,IAAI,eAAe;AAEnB,KAAI,YAAwB,OAAO,MAAM,CACvC,OAAM,MAAM,YAAY,SAAQ,cAAa;AAC3C,kBAAgB,CAAC,UAAU,uBAAuB,UAAU,OAAO;GACnE;AAGJ,QAAO;;AAGT,MAAa,eAAe,OAAwB,SAAiB,SAAsB,WAAwC;AACjI,QACE,oBAAA,UAAA,EAAA,UACG,SAAS,YAAwB,OAAO,MAAM,GAC3C,MAAM,aAAa,OAAO;EACxB,SAAS;EACT,YAAY,UAAU;EACtB;EACD,CAAC,GACF,OAAO,UAAU,YAAY,oBAAC,OAAA;EAAM,YAAY,CAAC;GAAE,M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W;GAAgB,IAAI;GAAkB;GAAS,eAAa;GAAQ,oBAAkB,YAAY;aACtH,qBAAC,QAAA;IAAK,WAAW,OAAO;eACrB,UACD,oBAAC,QAAA;KAAK,WAAW,OAAO;eAAe,WAAW;MAAQ,CAAA;KACrD;IACG,GACV,YAAY,aAAa,iBACzB,qBAAC,OAAA;GAAI,WAAW;;IACb,gBAAgB,YAA+B,cAAc,qBAAa,IAAI,MAAM,aAAa,aAAa;IAC9G,YACC,YAA2B,UAAU,SAAS,IAC9C,MAAM,aAAa,UAAU,EAClB,SACV,CAAC;IACH,aAAa,YAA4B,WAAW,kBAAU,IAC7D,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,gBAAA,EAAO,MAAM,OAAA,CAAS,EACtB,MAAM,aAAa,WAAW,EAC7B,SAAS,YAAY,YAAY,SAAS,WAAW,WACtD,CAAC,CAAA,EAAA,CACD;;IAED,CAAA,EAAA,CAEJ,EACL,sBAAsB,oBAAC,OAAA;GAAI,WAAW,OAAO;aAA0B;IAAyB,CAAA;GAC7F;;ACjMV,IAAA,kBDqMe"}
package/lib/LinkList.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { n as AnalyticsId, s as LanguageLocales } from "./constants2.js";
2
2
  import { t as usePseudoClasses } from "./usePseudoClasses.js";
3
+ import { t as ArrowUpRight_default } from "./ArrowUpRight.js";
3
4
  import { r as useLanguage } from "./language.js";
4
5
  import { i as renderElementHeader } from "./ElementHeader.js";
5
6
  import { i as listEditModeWrapperClassnames, t as ListEditMode_default } from "./ListEditMode.js";
@@ -18,7 +19,7 @@ const getResources = (language) => {
18
19
  }
19
20
  };
20
21
  const Link = React.forwardRef((props, ref) => {
21
- const { children, className = "", color = "white", icon, image, size = "medium", chevron = false, linkRef, status = "none", testId, target, variant, htmlMarkup = "a", highlightText, editMode = false, contentId, resources, ...restProps } = props;
22
+ const { children, className = "", color = "white", icon, image, size = "medium", chevron = false, linkRef, status = "none", testId, target, variant, htmlMarkup = "a", highlightText, editMode = false, contentId, resources, external = false, ...restProps } = props;
22
23
  const { refObject, isHovered } = usePseudoClasses(linkRef);
23
24
  const isFill = variant === "fill";
24
25
  const isFillNegative = variant === "fill-negative";
@@ -46,6 +47,9 @@ const Link = React.forwardRef((props, ref) => {
46
47
  className: LinkListStyles["link-list__image-container"],
47
48
  children: image
48
49
  });
50
+ let chevronIcon = void 0;
51
+ if (external) chevronIcon = ArrowUpRight_default;
52
+ else if (chevron) chevronIcon = ChevronRight_default;
49
53
  return editMode ? /* @__PURE__ */ jsx("div", {
50
54
  id: contentId,
51
55
  className: liClasses,
@@ -57,7 +61,7 @@ const Link = React.forwardRef((props, ref) => {
57
61
  titleHtmlMarkup: "span",
58
62
  size,
59
63
  parentType: "linklist",
60
- chevronIcon: chevron ? ChevronRight_default : void 0,
64
+ chevronIcon,
61
65
  icon: icon ?? imageContainer,
62
66
  highlightText
63
67
  })]
@@ -78,7 +82,7 @@ const Link = React.forwardRef((props, ref) => {
78
82
  isHovered,
79
83
  size,
80
84
  parentType: "linklist",
81
- chevronIcon: chevron ? ChevronRight_default : void 0,
85
+ chevronIcon,
82
86
  icon: icon ?? imageContainer,
83
87
  highlightText
84
88
  })]
@@ -92,7 +96,7 @@ const Link = React.forwardRef((props, ref) => {
92
96
  isHovered,
93
97
  size,
94
98
  parentType: "linklist",
95
- chevronIcon: chevron ? ChevronRight_default : void 0,
99
+ chevronIcon,
96
100
  icon: icon ?? imageContainer,
97
101
  highlightText
98
102
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"LinkList.js","names":["Link: LinkType","mergedResources: HNDesignsystemLinkList"],"sources":["../src/resources/HN.Designsystem.LinkList.en-GB.json","../src/resources/HN.Designsystem.LinkList.nb-NO.json","../src/components/LinkList/resourceHelper.ts","../src/components/LinkList/LinkList.tsx","../src/components/LinkList/index.ts"],"sourcesContent":["{\n \"editMode_deleteButtonAriaLabel\": \"Delete\"\n}\n","{\n \"editMode_deleteButtonAriaLabel\": \"Slett\"\n}\n","import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.LinkList.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.LinkList.nb-NO.json';\nimport { HNDesignsystemLinkList } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemLinkList => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemLinkList } from '../../resources/Resources';\nimport { PaletteNames } from '../../theme/palette';\nimport { useLanguage } from '../../utils/language';\nimport { ElementHeaderType, renderElementHeader } from '../ElementHeader/ElementHeader';\nimport ChevronRight from '../Icons/ChevronRight';\nimport ListEditModeItem, { ListEditModeItemProps, listEditModeWrapperClassnames } from '../ListEditMode';\nimport { getResources } from './resourceHelper';\n\nimport LinkListStyles from './styles.module.scss';\n\nexport type LinkListSize = 'small' | 'medium' | 'large';\n\nexport type LinkListStatus = 'none' | 'new';\n\nexport type LinkAnchorTargets = '_self' | '_blank' | '_parent';\n\nexport type LinkListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport type LinkListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\nexport interface LinkType extends React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLLIElement>> {\n ElementHeader?: ElementHeaderType;\n}\n\nexport type LinkTags = 'button' | 'a';\nexport interface CompoundComponent extends React.ForwardRefExoticComponent<LinkListProps & React.RefAttributes<HTMLUListElement>> {\n Link: LinkType;\n}\n\nexport interface LinkListProps {\n /** Items in the LinkList */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: LinkListColors;\n /** Toggles chevron icon on or off. */\n chevron?: boolean;\n /** Changes size of the LinkList. */\n size?: LinkListSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: LinkListVariant;\n /** Highlights text. Used for search results */\n highlightText?: string;\n /**\n * @experimental This prop is experimental and may change in the future.\n * Enables ListEditMode\n */\n editMode?: boolean;\n /** Resources for component */\n resources?: Partial<HNDesignsystemLinkList>;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\nexport type LinkProps = Modify<\n React.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>,\n {\n children: React.ReactNode;\n chevron?: boolean;\n className?: string;\n icon?: React.ReactElement;\n /** Renders the image in the LinkList header */\n image?: React.ReactElement;\n /** Displays a status on the left side: default none */\n status?: LinkListStatus;\n href?: string;\n target?: LinkAnchorTargets;\n /** HTML markup for link. Default: a */\n htmlMarkup?: LinkTags;\n /**\n * Ref for lenke/knapp\n */\n linkRef?: React.RefObject<HTMLButtonElement | HTMLAnchorElement> | null;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text. Override if different from list */\n highlightText?: string;\n /** Resources for component */\n resources?: Partial<HNDesignsystemLinkList>;\n /** @experimental id for content (only used in edit mode for aria-describedby) */\n contentId?: string;\n }\n> &\n Pick<LinkListProps, 'color' | 'size' | 'variant'> &\n ListEditModeItemProps;\n\nexport const Link: LinkType = React.forwardRef((props: LinkProps, ref: React.Ref<HTMLLIElement>) => {\n const {\n children,\n className = '',\n color = 'white',\n icon,\n image,\n size = 'medium',\n chevron = false,\n linkRef,\n status = 'none',\n testId,\n target,\n variant,\n htmlMarkup = 'a',\n highlightText,\n editMode = false,\n contentId,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n resources, // used by ListEditModeItem in LinkList\n ...restProps\n } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement | HTMLAnchorElement>(linkRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const liClasses = cn(LinkListStyles['link-list'], {\n [LinkListStyles['link-list__list-item--line']]: isLine,\n [LinkListStyles['link-list__list-item--outline']]: isOutline,\n [LinkListStyles[`link-list__list-item--outline--${color}`]]: isOutline,\n });\n const linkClasses = cn(\n LinkListStyles['link-list__anchor'],\n LinkListStyles[`link-list__anchor--${color}`],\n {\n [LinkListStyles[`link-list__anchor--line--${color}`]]: isLine,\n [LinkListStyles['link-list__anchor--fill']]: isFill,\n [LinkListStyles[`link-list__anchor--fill--${color}`]]: isFill,\n [LinkListStyles['link-list__anchor--outline']]: isOutline,\n [LinkListStyles[`link-list__anchor--outline--${color}`]]: isOutline,\n [LinkListStyles['link-list__anchor--fill-negative']]: isFillNegative,\n [LinkListStyles[`link-list__anchor--fill-negative--${color}`]]: isFillNegative,\n [LinkListStyles[`link-list__anchor--${size}`]]: size,\n [LinkListStyles['link-list__anchor--button']]: htmlMarkup === 'button',\n [LinkListStyles['link-list__anchor--new']]: status === 'new',\n },\n className\n );\n\n const statusMarkerClasses = cn(LinkListStyles['link-list__status-marker'], {\n [LinkListStyles['link-list__status-marker--new']]: status === 'new',\n });\n\n const imageContainer = <span className={LinkListStyles['link-list__image-container']}>{image}</span>;\n\n return editMode ? (\n <div id={contentId} className={liClasses} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n <div className={linkClasses}>\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n size,\n parentType: 'linklist',\n chevronIcon: chevron ? ChevronRight : undefined,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </div>\n </div>\n ) : (\n <li className={liClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n {htmlMarkup === 'a' ? (\n <a\n className={linkClasses}\n ref={refObject as React.RefObject<HTMLAnchorElement>}\n rel={target === '_blank' ? 'noopener noreferrer' : undefined}\n target={target}\n {...restProps}\n >\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n isHovered,\n size,\n parentType: 'linklist',\n chevronIcon: chevron ? ChevronRight : undefined,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </a>\n ) : (\n htmlMarkup === 'button' && (\n <button className={linkClasses} ref={refObject as React.RefObject<HTMLButtonElement>} type=\"button\" {...restProps}>\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n isHovered,\n size,\n parentType: 'linklist',\n chevronIcon: chevron ? ChevronRight : undefined,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </button>\n )\n )}\n </li>\n );\n});\n\nexport const LinkList = React.forwardRef(function LinkListForwardedRef(props: LinkListProps, ref: React.Ref<HTMLUListElement>) {\n const {\n children,\n className = '',\n chevron = false,\n size = 'medium',\n color = 'white',\n testId,\n variant = 'line',\n highlightText,\n editMode = false,\n resources,\n } = props;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemLinkList = {\n ...defaultResources,\n ...resources,\n };\n\n const listClassNames = cn(LinkListStyles['link-list'], className, {\n [LinkListStyles[`link-list--outline--${color}`]]: variant === 'outline',\n [listEditModeWrapperClassnames]: editMode,\n });\n\n return (\n <ul ref={ref} className={listClassNames} data-testid={testId} data-analyticsid={AnalyticsId.LinkList}>\n {React.Children.map(children, (child: React.ReactNode, index) => {\n if (React.isValidElement<LinkProps>(child) && child.type === Link) {\n if (editMode) {\n const childResources = child.props.resources;\n const deleteAriaLabel = childResources?.editMode_deleteButtonAriaLabel ?? mergedResources.editMode_deleteButtonAriaLabel;\n const itemId = `linklist-item-${index}`;\n\n return (\n <ListEditModeItem\n color={color}\n variant={variant}\n onDelete={child.props.onDelete}\n contentId={itemId}\n deleteButtonAriaLabel={deleteAriaLabel}\n >\n {React.cloneElement(child, {\n color,\n size,\n chevron: false,\n variant,\n highlightText: highlightText,\n editMode: true,\n contentId: itemId,\n })}\n </ListEditModeItem>\n );\n } else {\n return React.cloneElement(child, {\n color,\n size,\n chevron,\n variant,\n highlightText: highlightText,\n editMode: false,\n });\n }\n }\n return null;\n })}\n </ul>\n );\n}) as CompoundComponent;\n\nLinkList.displayName = 'LinkList';\nLinkList.Link = Link;\nLink.displayName = 'LinkList.Link';\n\nexport default LinkList;\n","import LinkList from './LinkList';\nexport * from './LinkList';\nexport default LinkList;\n"],"mappings":";;;;;;;;;;;;AEKA,MAAa,gBAAgB,aAAsD;AACjF,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACmFb,MAAaA,OAAiB,MAAM,YAAY,OAAkB,QAAkC;CAClG,MAAM,EACJ,UACA,YAAY,IACZ,QAAQ,SACR,MACA,OACA,OAAO,UACP,UAAU,OACV,SACA,SAAS,QACT,QACA,QACA,SACA,aAAa,KACb,eACA,WAAW,OACX,WAEA,WACA,GAAG,cACD;CACJ,MAAM,EAAE,WAAW,cAAc,iBAAwD,QAAQ;CAEjG,MAAM,SAAS,YAAY;CAC3B,MAAM,iBAAiB,YAAY;CACnC,MAAM,YAAY,YAAY;CAC9B,MAAM,SAAS,YAAY;CAE3B,MAAM,YAAY,WAAG,eAAe,cAAc;GAC/C,eAAe,gCAAgC;GAC/C,eAAe,mCAAmC;GAClD,eAAe,kCAAkC,WAAW;EAC9D,CAAC;CACF,MAAM,cAAc,WAClB,eAAe,sBACf,eAAe,sBAAsB,UACrC;GACG,eAAe,4BAA4B,WAAW;GACtD,eAAe,6BAA6B;GAC5C,eAAe,4BAA4B,WAAW;GACtD,eAAe,gCAAgC;GAC/C,eAAe,+BAA+B,WAAW;GACzD,eAAe,sCAAsC;GACrD,eAAe,qCAAqC,WAAW;GAC/D,eAAe,sBAAsB,UAAU;GAC/C,eAAe,+BAA+B,eAAe;GAC7D,eAAe,4BAA4B,WAAW;EACxD,EACD,UACD;CAED,MAAM,sBAAsB,WAAG,eAAe,6BAA6B,GACxE,eAAe,mCAAmC,WAAW,OAC/D,CAAC;CAEF,MAAM,iBAAiB,oBAAC,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AAS;EAI7C,GAAG;EACJ;AAOD,QACE,oBAAC,MAAA;EAAQ;EAAK,WANO,WAAG,eAAe,cAAc,WAAW;IAC/D,eAAe,uBAAuB,WAAW,YAAY;IAC7D,gCAAgC;GAClC,CAAC;EAGyC,eAAa;EAAQ,oBAAkB,YAAY;YACzF,MAAM,SAAS,IAAI,WAAW,OAAwB,UAAU;AAC/D,OAAI,MAAM,eAA0B,MAAM,IAAI,MAAM,SAAS,KAC3D,KAAI,UAAU;IAEZ,MAAM,kBADiB,MAAM,MAAM,WACK,kCAAkC,gBAAgB;IAC1F,MAAM,SAAS,iBAAiB;AAEhC,WACE,oBAAC,sBAAA;KACQ;KACE;KACT,UAAU,MAAM,MAAM;KACtB,WAAW;KACX,uBAAuB;eAEtB,MAAM,aAAa,OAAO;MACzB;MACA;MACA,SAAS;MACT;MACe;MACf,UAAU;MACV,WAAW;MACZ,CAAC;MACe;SAGrB,QAAO,MAAM,aAAa,OAAO;IAC/B;IACA;IACA;IACA;IACe;IACf,UAAU;IACX,CAAC;AAGN,UAAO;IACP;GACC;EAEP;AAEF,SAAS,cAAc;AACvB,SAAS,OAAO;AAChB,KAAK,cAAc;ACvRnB,IAAA,qBDyRe"}
1
+ {"version":3,"file":"LinkList.js","names":["Link: LinkType","mergedResources: HNDesignsystemLinkList"],"sources":["../src/resources/HN.Designsystem.LinkList.en-GB.json","../src/resources/HN.Designsystem.LinkList.nb-NO.json","../src/components/LinkList/resourceHelper.ts","../src/components/LinkList/LinkList.tsx","../src/components/LinkList/index.ts"],"sourcesContent":["{\n \"editMode_deleteButtonAriaLabel\": \"Delete\"\n}\n","{\n \"editMode_deleteButtonAriaLabel\": \"Slett\"\n}\n","import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.LinkList.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.LinkList.nb-NO.json';\nimport { HNDesignsystemLinkList } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemLinkList => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemLinkList } from '../../resources/Resources';\nimport { PaletteNames } from '../../theme/palette';\nimport { useLanguage } from '../../utils/language';\nimport { ElementHeaderType, renderElementHeader } from '../ElementHeader/ElementHeader';\nimport ChevronRight from '../Icons/ChevronRight';\nimport ListEditModeItem, { ListEditModeItemProps, listEditModeWrapperClassnames } from '../ListEditMode';\nimport { getResources } from './resourceHelper';\nimport ArrowUpRight from '../Icons/ArrowUpRight';\n\nimport LinkListStyles from './styles.module.scss';\n\nexport type LinkListSize = 'small' | 'medium' | 'large';\n\nexport type LinkListStatus = 'none' | 'new';\n\nexport type LinkAnchorTargets = '_self' | '_blank' | '_parent';\n\nexport type LinkListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport type LinkListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\nexport interface LinkType extends React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLLIElement>> {\n ElementHeader?: ElementHeaderType;\n}\n\nexport type LinkTags = 'button' | 'a';\nexport interface CompoundComponent extends React.ForwardRefExoticComponent<LinkListProps & React.RefAttributes<HTMLUListElement>> {\n Link: LinkType;\n}\n\nexport interface LinkListProps {\n /** Items in the LinkList */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: LinkListColors;\n /** Toggles chevron icon on or off. */\n chevron?: boolean;\n /** Changes size of the LinkList. */\n size?: LinkListSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: LinkListVariant;\n /** Highlights text. Used for search results */\n highlightText?: string;\n /**\n * @experimental This prop is experimental and may change in the future.\n * Enables ListEditMode\n */\n editMode?: boolean;\n /** Resources for component */\n resources?: Partial<HNDesignsystemLinkList>;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\nexport type LinkProps = Modify<\n React.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>,\n {\n children: React.ReactNode;\n /** @private Turns chevron icon on/off. Overwritten by LinkList so not possible to set on LinkList.Link */\n chevron?: boolean;\n className?: string;\n icon?: React.ReactElement;\n /** Renders the image in the LinkList header */\n image?: React.ReactElement;\n /** Displays a status on the left side: default none */\n status?: LinkListStatus;\n href?: string;\n target?: LinkAnchorTargets;\n /** HTML markup for link. Default: a */\n htmlMarkup?: LinkTags;\n /** Ref for lenke/knapp */\n linkRef?: React.RefObject<HTMLButtonElement | HTMLAnchorElement> | null;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text. Override if different from list */\n highlightText?: string;\n /** Resources for component */\n resources?: Partial<HNDesignsystemLinkList>;\n /** @experimental id for content (only used in edit mode for aria-describedby) */\n contentId?: string;\n /** Replaces the chevron with an arrow up right which is used for indicating external links */\n external?: boolean;\n }\n> &\n Pick<LinkListProps, 'color' | 'size' | 'variant'> &\n ListEditModeItemProps;\n\nexport const Link: LinkType = React.forwardRef((props: LinkProps, ref: React.Ref<HTMLLIElement>) => {\n const {\n children,\n className = '',\n color = 'white',\n icon,\n image,\n size = 'medium',\n chevron = false,\n linkRef,\n status = 'none',\n testId,\n target,\n variant,\n htmlMarkup = 'a',\n highlightText,\n editMode = false,\n contentId,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n resources, // used by ListEditModeItem in LinkList\n external = false,\n ...restProps\n } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement | HTMLAnchorElement>(linkRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const liClasses = cn(LinkListStyles['link-list'], {\n [LinkListStyles['link-list__list-item--line']]: isLine,\n [LinkListStyles['link-list__list-item--outline']]: isOutline,\n [LinkListStyles[`link-list__list-item--outline--${color}`]]: isOutline,\n });\n const linkClasses = cn(\n LinkListStyles['link-list__anchor'],\n LinkListStyles[`link-list__anchor--${color}`],\n {\n [LinkListStyles[`link-list__anchor--line--${color}`]]: isLine,\n [LinkListStyles['link-list__anchor--fill']]: isFill,\n [LinkListStyles[`link-list__anchor--fill--${color}`]]: isFill,\n [LinkListStyles['link-list__anchor--outline']]: isOutline,\n [LinkListStyles[`link-list__anchor--outline--${color}`]]: isOutline,\n [LinkListStyles['link-list__anchor--fill-negative']]: isFillNegative,\n [LinkListStyles[`link-list__anchor--fill-negative--${color}`]]: isFillNegative,\n [LinkListStyles[`link-list__anchor--${size}`]]: size,\n [LinkListStyles['link-list__anchor--button']]: htmlMarkup === 'button',\n [LinkListStyles['link-list__anchor--new']]: status === 'new',\n },\n className\n );\n\n const statusMarkerClasses = cn(LinkListStyles['link-list__status-marker'], {\n [LinkListStyles['link-list__status-marker--new']]: status === 'new',\n });\n\n const imageContainer = <span className={LinkListStyles['link-list__image-container']}>{image}</span>;\n\n let chevronIcon = undefined;\n if (external) {\n chevronIcon = ArrowUpRight;\n } else if (chevron) {\n chevronIcon = ChevronRight;\n }\n\n return editMode ? (\n <div id={contentId} className={liClasses} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n <div className={linkClasses}>\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </div>\n </div>\n ) : (\n <li className={liClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n {htmlMarkup === 'a' ? (\n <a\n className={linkClasses}\n ref={refObject as React.RefObject<HTMLAnchorElement>}\n rel={target === '_blank' ? 'noopener noreferrer' : undefined}\n target={target}\n {...restProps}\n >\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n isHovered,\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </a>\n ) : (\n htmlMarkup === 'button' && (\n <button className={linkClasses} ref={refObject as React.RefObject<HTMLButtonElement>} type=\"button\" {...restProps}>\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n isHovered,\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </button>\n )\n )}\n </li>\n );\n});\n\nexport const LinkList = React.forwardRef(function LinkListForwardedRef(props: LinkListProps, ref: React.Ref<HTMLUListElement>) {\n const {\n children,\n className = '',\n chevron = false,\n size = 'medium',\n color = 'white',\n testId,\n variant = 'line',\n highlightText,\n editMode = false,\n resources,\n } = props;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemLinkList = {\n ...defaultResources,\n ...resources,\n };\n\n const listClassNames = cn(LinkListStyles['link-list'], className, {\n [LinkListStyles[`link-list--outline--${color}`]]: variant === 'outline',\n [listEditModeWrapperClassnames]: editMode,\n });\n\n return (\n <ul ref={ref} className={listClassNames} data-testid={testId} data-analyticsid={AnalyticsId.LinkList}>\n {React.Children.map(children, (child: React.ReactNode, index) => {\n if (React.isValidElement<LinkProps>(child) && child.type === Link) {\n if (editMode) {\n const childResources = child.props.resources;\n const deleteAriaLabel = childResources?.editMode_deleteButtonAriaLabel ?? mergedResources.editMode_deleteButtonAriaLabel;\n const itemId = `linklist-item-${index}`;\n\n return (\n <ListEditModeItem\n color={color}\n variant={variant}\n onDelete={child.props.onDelete}\n contentId={itemId}\n deleteButtonAriaLabel={deleteAriaLabel}\n >\n {React.cloneElement(child, {\n color,\n size,\n chevron: false,\n variant,\n highlightText: highlightText,\n editMode: true,\n contentId: itemId,\n })}\n </ListEditModeItem>\n );\n } else {\n return React.cloneElement(child, {\n color,\n size,\n chevron,\n variant,\n highlightText: highlightText,\n editMode: false,\n });\n }\n }\n return null;\n })}\n </ul>\n );\n}) as CompoundComponent;\n\nLinkList.displayName = 'LinkList';\nLinkList.Link = Link;\nLink.displayName = 'LinkList.Link';\n\nexport default LinkList;\n","import LinkList from './LinkList';\nexport * from './LinkList';\nexport default LinkList;\n"],"mappings":";;;;;;;;;;;;;AEKA,MAAa,gBAAgB,aAAsD;AACjF,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACqFb,MAAaA,OAAiB,MAAM,YAAY,OAAkB,QAAkC;CAClG,MAAM,EACJ,UACA,YAAY,IACZ,QAAQ,SACR,MACA,OACA,OAAO,UACP,UAAU,OACV,SACA,SAAS,QACT,QACA,QACA,SACA,aAAa,KACb,eACA,WAAW,OACX,WAEA,WACA,WAAW,OACX,GAAG,cACD;CACJ,MAAM,EAAE,WAAW,cAAc,iBAAwD,QAAQ;CAEjG,MAAM,SAAS,YAAY;CAC3B,MAAM,iBAAiB,YAAY;CACnC,MAAM,YAAY,YAAY;CAC9B,MAAM,SAAS,YAAY;CAE3B,MAAM,YAAY,WAAG,eAAe,cAAc;GAC/C,eAAe,gCAAgC;GAC/C,eAAe,mCAAmC;GAClD,eAAe,kCAAkC,WAAW;EAC9D,CAAC;CACF,MAAM,cAAc,WAClB,eAAe,sBACf,eAAe,sBAAsB,UACrC;GACG,eAAe,4BAA4B,WAAW;GACtD,eAAe,6BAA6B;GAC5C,eAAe,4BAA4B,WAAW;GACtD,eAAe,gCAAgC;GAC/C,eAAe,+BAA+B,WAAW;GACzD,eAAe,sCAAsC;GACrD,eAAe,qCAAqC,WAAW;GAC/D,eAAe,sBAAsB,UAAU;GAC/C,eAAe,+BAA+B,eAAe;GAC7D,eAAe,4BAA4B,WAAW;EACxD,EACD,UACD;CAED,MAAM,sBAAsB,WAAG,eAAe,6BAA6B,GACxE,eAAe,mCAAmC,WAAW,OAC/D,CAAC;CAEF,M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SAAS;EAI7C,GAAG;EACJ;AAOD,QACE,oBAAC,MAAA;EAAQ;EAAK,WANO,WAAG,eAAe,cAAc,WAAW;IAC/D,eAAe,uBAAuB,WAAW,YAAY;IAC7D,gCAAgC;GAClC,CAAC;EAGyC,eAAa;EAAQ,oBAAkB,YAAY;YACzF,MAAM,SAAS,IAAI,WAAW,OAAwB,UAAU;AAC/D,OAAI,MAAM,eAA0B,MAAM,IAAI,MAAM,SAAS,KAC3D,KAAI,UAAU;IAEZ,MAAM,kBADiB,MAAM,MAAM,WACK,kCAAkC,gBAAgB;IAC1F,MAAM,SAAS,iBAAiB;AAEhC,WACE,oBAAC,sBAAA;KACQ;KACE;KACT,UAAU,MAAM,MAAM;KACtB,WAAW;KACX,uBAAuB;eAEtB,MAAM,aAAa,OAAO;MACzB;MACA;MACA,SAAS;MACT;MACe;MACf,UAAU;MACV,WAAW;MACZ,CAAC;MACe;SAGrB,QAAO,MAAM,aAAa,OAAO;IAC/B;IACA;IACA;IACA;IACe;IACf,UAAU;IACX,CAAC;AAGN,UAAO;IACP;GACC;EAEP;AAEF,SAAS,cAAc;AACvB,SAAS,OAAO;AAChB,KAAK,cAAc;ACjSnB,IAAA,qBDmSe"}
package/lib/Panel.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as IconSize, s as LanguageLocales } from "./constants2.js";
1
+ import { a as IconSize, n as AnalyticsId, s as LanguageLocales } from "./constants2.js";
2
2
  import { t as Icon_default } from "./Icon.js";
3
3
  import { r as useLanguage } from "./language.js";
4
4
  import { t as Button_default } from "./Button.js";
@@ -11,7 +11,8 @@ import { t as PanelTitle_default } from "./PanelTitle.js";
11
11
  import React from "react";
12
12
  import classNames from "classnames";
13
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
- import styles from "./components/Panel/styles.module.scss";
14
+ import styles from "./components/PanelList/styles.module.scss";
15
+ import styles$1 from "./components/Panel/styles.module.scss";
15
16
  var HN_Designsystem_Panel_en_GB_default = {
16
17
  expandButtonOpen: "See details",
17
18
  expandButtonClose: "Hide details"
@@ -27,6 +28,25 @@ const getResources = (language) => {
27
28
  default: return HN_Designsystem_Panel_nb_NO_default;
28
29
  }
29
30
  };
31
+ const PanelListContext = React.createContext(null);
32
+ var PanelList_default = React.forwardRef(function BadgeForwardedRef(props, ref) {
33
+ const { testId, children, variant = PanelVariant.fill, highlightText } = props;
34
+ const contextValue = React.useMemo(() => ({
35
+ variant,
36
+ highlightText,
37
+ applyPanelClassName: (existingClassName) => classNames(existingClassName, styles[`panel-list__panel--${variant}`])
38
+ }), [variant, highlightText]);
39
+ return /* @__PURE__ */ jsx(PanelListContext.Provider, {
40
+ value: contextValue,
41
+ children: /* @__PURE__ */ jsx("div", {
42
+ ref,
43
+ "data-testid": testId,
44
+ "data-analyticsid": AnalyticsId.PanelList,
45
+ className: classNames({ [styles["panel-list--outline"]]: variant === PanelVariant.outline }),
46
+ children
47
+ })
48
+ });
49
+ });
30
50
  let PanelLayout = /* @__PURE__ */ function(PanelLayout$1) {
31
51
  PanelLayout$1["vertical"] = "vertical";
32
52
  PanelLayout$1["horizontal"] = "horizontal";
@@ -53,10 +73,10 @@ let PanelStatus = /* @__PURE__ */ function(PanelStatus$1) {
53
73
  return PanelStatus$1;
54
74
  }({});
55
75
  var ExpandButton = ({ onClick, isExpanded, resources }) => {
56
- const buttonClassName = classNames(styles["expander__button"], isExpanded && styles["expander__button--expanded"]);
76
+ const buttonClassName = classNames(styles$1["expander__button"], isExpanded && styles$1["expander__button--expanded"]);
57
77
  return /* @__PURE__ */ jsxs(Button_default, {
58
78
  variant: "borderless",
59
- textClassName: styles["expander__button__text"],
79
+ textClassName: styles$1["expander__button__text"],
60
80
  wrapperClassName: buttonClassName,
61
81
  "aria-expanded": isExpanded,
62
82
  onClick,
@@ -67,6 +87,7 @@ var ExpandButton = ({ onClick, isExpanded, resources }) => {
67
87
  });
68
88
  };
69
89
  var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayout.vertical, variant = PanelVariant.fill, color = "neutral", stacking = PanelStacking.default, testId, children, expanded = false, focusable, status = PanelStatus.none, buttonBottomAriaLabel, buttonBottomOnClick, buttonBottomText, className, resources, onExpand, highlightText }, ref) {
90
+ const panelListContext = React.useContext(PanelListContext);
70
91
  const [preContainer, setPreContainer] = React.useState([]);
71
92
  const [title, setTitle] = React.useState([]);
72
93
  const [content, setContent] = React.useState([]);
@@ -77,6 +98,9 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
77
98
  const panelRef = ref ?? localRef;
78
99
  const expandedContentRef = React.useRef(null);
79
100
  const defaultScroll = 100;
101
+ const effectiveVariant = panelListContext?.variant ?? variant;
102
+ const effectiveHighlightText = panelListContext?.highlightText ?? highlightText;
103
+ const effectiveClassName = panelListContext?.applyPanelClassName(className) ?? className;
80
104
  const { language } = useLanguage(LanguageLocales.NORWEGIAN);
81
105
  const mergedResources = {
82
106
  ...getResources(language),
@@ -96,7 +120,7 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
96
120
  else if (child.type === PanelTitle_default) {
97
121
  newTitle.push(React.cloneElement(child, {
98
122
  key,
99
- highlightText: child.props.highlightText || highlightText
123
+ highlightText: child.props.highlightText || effectiveHighlightText
100
124
  }));
101
125
  if (child.props.icon) localHasIcon = true;
102
126
  } else if (child.type === A || child.type === B || child.type === C) newContent.push(React.cloneElement(child, { key }));
@@ -126,26 +150,26 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
126
150
  }
127
151
  }
128
152
  }, [isExpanded]);
129
- const colorScheme = variant === PanelVariant.fill ? color : "white";
130
- const outerClassnames = classNames(className, {
131
- [styles["panel__border--outline--outer"]]: variant === PanelVariant.outline,
132
- [styles["panel__border--line"]]: variant === PanelVariant.line,
133
- [styles["panel__border--fill--neutral"]]: variant === PanelVariant.fill && colorScheme === "neutral",
134
- [styles["panel__border--fill--new"]]: variant === PanelVariant.fill && status === PanelStatus.new,
135
- [styles["panel__border--fill--status"]]: variant === PanelVariant.fill && status !== PanelStatus.none
153
+ const colorScheme = effectiveVariant === PanelVariant.fill ? color : "white";
154
+ const outerClassnames = classNames(effectiveClassName, {
155
+ [styles$1["panel__border--outline--outer"]]: effectiveVariant === PanelVariant.outline,
156
+ [styles$1["panel__border--line"]]: effectiveVariant === PanelVariant.line,
157
+ [styles$1["panel__border--fill--neutral"]]: effectiveVariant === PanelVariant.fill && colorScheme === "neutral",
158
+ [styles$1["panel__border--fill--new"]]: effectiveVariant === PanelVariant.fill && status === PanelStatus.new,
159
+ [styles$1["panel__border--fill--status"]]: effectiveVariant === PanelVariant.fill && status !== PanelStatus.none
136
160
  });
137
- const panelClassnames = classNames(styles["panel"], styles[`panel--${colorScheme}`], styles["panel--status"], {
138
- [styles["panel--line"]]: variant === PanelVariant.line,
139
- [styles["panel--new"]]: status === PanelStatus.new,
140
- [styles["panel--draft"]]: status === PanelStatus.draft,
141
- [styles["panel--error"]]: status === PanelStatus.error,
142
- [styles["panel--icon"]]: hasIcon
161
+ const panelClassnames = classNames(styles$1["panel"], styles$1[`panel--${colorScheme}`], styles$1["panel--status"], {
162
+ [styles$1["panel--line"]]: effectiveVariant === PanelVariant.line,
163
+ [styles$1["panel--new"]]: status === PanelStatus.new,
164
+ [styles$1["panel--draft"]]: status === PanelStatus.draft,
165
+ [styles$1["panel--error"]]: status === PanelStatus.error,
166
+ [styles$1["panel--icon"]]: hasIcon
143
167
  });
144
- const contentContainerLayout = classNames(styles["panel__content"], styles[`panel__content--${layout}`], { [styles[`panel__content--b-first`]]: stacking === PanelStacking.bFirst });
168
+ const contentContainerLayout = classNames(styles$1["panel__content"], styles$1[`panel__content--${layout}`], { [styles$1[`panel__content--b-first`]]: stacking === PanelStacking.bFirst });
145
169
  const expanderBorderLayout = classNames({
146
- [styles["panel__expander__border--expanded"]]: isExpanded && status === PanelStatus.none,
147
- [styles[`panel__expander__border--not-expanded--${colorScheme}`]]: !isExpanded && status === PanelStatus.none,
148
- [styles[`panel__expander__border--not-expanded--line`]]: !isExpanded && status === PanelStatus.none && variant === PanelVariant.line
170
+ [styles$1["panel__expander__border--expanded"]]: isExpanded && status === PanelStatus.none,
171
+ [styles$1[`panel__expander__border--not-expanded--${colorScheme}`]]: !isExpanded && status === PanelStatus.none,
172
+ [styles$1[`panel__expander__border--not-expanded--line`]]: !isExpanded && status === PanelStatus.none && effectiveVariant === PanelVariant.line
149
173
  });
150
174
  const handleExpandClick = () => {
151
175
  setIsExpanded(!isExpanded);
@@ -153,7 +177,7 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
153
177
  return expandableContent.length > 0 ? /* @__PURE__ */ jsx("div", {
154
178
  className: outerClassnames,
155
179
  children: /* @__PURE__ */ jsx("div", {
156
- className: classNames({ [styles["panel__border--outline--inner"]]: variant === PanelVariant.outline }),
180
+ className: classNames({ [styles$1["panel__border--outline--inner"]]: effectiveVariant === PanelVariant.outline }),
157
181
  children: /* @__PURE__ */ jsx("div", {
158
182
  className: expanderBorderLayout,
159
183
  children: /* @__PURE__ */ jsxs("div", {
@@ -163,13 +187,13 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
163
187
  tabIndex: focusable ? -1 : void 0,
164
188
  children: [
165
189
  /* @__PURE__ */ jsxs(Highlighter_default, {
166
- searchText: highlightText,
190
+ searchText: effectiveHighlightText,
167
191
  children: [preContainer, title]
168
192
  }),
169
193
  /* @__PURE__ */ jsx("div", {
170
194
  className: contentContainerLayout,
171
195
  children: /* @__PURE__ */ jsx(Highlighter_default, {
172
- searchText: highlightText,
196
+ searchText: effectiveHighlightText,
173
197
  children: content
174
198
  })
175
199
  }),
@@ -181,8 +205,8 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
181
205
  isExpanded && /* @__PURE__ */ jsxs("div", {
182
206
  ref: expandedContentRef,
183
207
  "data-testid": testId + "-details",
184
- children: [/* @__PURE__ */ jsx("div", { className: styles["panel__expander__separator"] }), /* @__PURE__ */ jsx(Highlighter_default, {
185
- searchText: highlightText,
208
+ children: [/* @__PURE__ */ jsx("div", { className: styles$1["panel__expander__separator"] }), /* @__PURE__ */ jsx(Highlighter_default, {
209
+ searchText: effectiveHighlightText,
186
210
  children: expandableContent
187
211
  })]
188
212
  })
@@ -193,7 +217,7 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
193
217
  }) : /* @__PURE__ */ jsx("div", {
194
218
  className: outerClassnames,
195
219
  children: /* @__PURE__ */ jsx("div", {
196
- className: classNames({ [styles["panel__border--outline--inner"]]: variant === PanelVariant.outline }),
220
+ className: classNames({ [styles$1["panel__border--outline--inner"]]: effectiveVariant === PanelVariant.outline }),
197
221
  children: /* @__PURE__ */ jsxs("div", {
198
222
  className: panelClassnames,
199
223
  "data-testid": testId,
@@ -201,18 +225,18 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
201
225
  tabIndex: focusable ? -1 : void 0,
202
226
  children: [
203
227
  /* @__PURE__ */ jsxs(Highlighter_default, {
204
- searchText: highlightText,
228
+ searchText: effectiveHighlightText,
205
229
  children: [preContainer, title]
206
230
  }),
207
231
  /* @__PURE__ */ jsx("div", {
208
232
  className: contentContainerLayout,
209
233
  children: /* @__PURE__ */ jsx(Highlighter_default, {
210
- searchText: highlightText,
234
+ searchText: effectiveHighlightText,
211
235
  children: content
212
236
  })
213
237
  }),
214
238
  buttonBottomText && buttonBottomOnClick && /* @__PURE__ */ jsx("div", {
215
- className: styles["panel__button-bottom"],
239
+ className: styles$1["panel__button-bottom"],
216
240
  children: /* @__PURE__ */ jsxs(Button_default, {
217
241
  variant: "borderless",
218
242
  type: "button",
@@ -232,31 +256,31 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
232
256
  });
233
257
  const PreContainer = ({ children }) => {
234
258
  return /* @__PURE__ */ jsx("div", {
235
- className: styles["panel__pre-container"],
259
+ className: styles$1["panel__pre-container"],
236
260
  children
237
261
  });
238
262
  };
239
263
  const A = ({ children }) => {
240
264
  return /* @__PURE__ */ jsx("div", {
241
- className: classNames(styles["panel__content__item"], styles["panel__content__item--a"]),
265
+ className: classNames(styles$1["panel__content__item"], styles$1["panel__content__item--a"]),
242
266
  children
243
267
  });
244
268
  };
245
269
  const B = ({ children }) => {
246
270
  return /* @__PURE__ */ jsx("div", {
247
- className: classNames(styles["panel__content__item"], styles["panel__content__item--b"]),
271
+ className: classNames(styles$1["panel__content__item"], styles$1["panel__content__item--b"]),
248
272
  children
249
273
  });
250
274
  };
251
275
  const C = ({ children }) => {
252
276
  return /* @__PURE__ */ jsx("div", {
253
- className: classNames(styles["panel__content__item"], styles["panel__content__item--c"]),
277
+ className: classNames(styles$1["panel__content__item"], styles$1["panel__content__item--c"]),
254
278
  children
255
279
  });
256
280
  };
257
281
  const ExpandedContent = ({ children }) => {
258
282
  return /* @__PURE__ */ jsx("div", {
259
- className: classNames(styles["panel__expander__content"]),
283
+ className: classNames(styles$1["panel__expander__content"]),
260
284
  children
261
285
  });
262
286
  };
@@ -269,6 +293,6 @@ Panel.B = B;
269
293
  Panel.C = C;
270
294
  Panel.ExpandedContent = ExpandedContent;
271
295
  var Panel_default = Panel;
272
- export { PanelLayout as a, PanelVariant as c, ExpandedContent as i, Panel_default as l, B as n, PanelStacking as o, C as r, PanelStatus as s, A as t, PreContainer as u };
296
+ export { PanelLayout as a, PanelVariant as c, PanelListContext as d, PanelList_default as f, ExpandedContent as i, Panel_default as l, B as n, PanelStacking as o, C as r, PanelStatus as s, A as t, PreContainer as u };
273
297
 
274
298
  //# sourceMappingURL=Panel.js.map
package/lib/Panel.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.js","names":["mergedResources: HNDesignsystemPanel","newPreContainer: React.ReactNode[]","newTitle: React.ReactNode[]","newContent: React.ReactNode[]","newExpandableContent: React.ReactNode[]","PreContainer: React.FC<ContentProps>","A: React.FC<ContentProps>","B: React.FC<ContentProps>","C: React.FC<ContentProps>","ExpandedContent: React.FC<ContentProps>"],"sources":["../src/resources/HN.Designsystem.Panel.en-GB.json","../src/resources/HN.Designsystem.Panel.nb-NO.json","../src/components/Panel/resourceHelper.ts","../src/components/Panel/Panel.tsx"],"sourcesContent":["{\n \"expandButtonOpen\": \"See details\",\n \"expandButtonClose\": \"Hide details\"\n}\n","{\n \"expandButtonOpen\": \"Se detaljer\",\n \"expandButtonClose\": \"Skjul detaljer\"\n}\n","import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Panel.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Panel.nb-NO.json';\nimport { HNDesignsystemPanel } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemPanel => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { LanguageLocales } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { PaletteNames } from '../../theme/palette';\nimport Button from '../Button';\nimport Icon, { IconSize } from '../Icon';\nimport PanelTitle, { PanelTitleProps } from './PanelTitle';\nimport { getResources } from './resourceHelper';\nimport { HNDesignsystemPanel } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport Highlighter from '../Highlighter';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronRight from '../Icons/ChevronRight';\nimport ChevronUp from '../Icons/ChevronUp';\n\nimport styles from './styles.module.scss';\n\nexport enum PanelLayout {\n vertical = 'vertical',\n horizontal = 'horizontal',\n combined = 'combined',\n bAsRightCol = 'bAsRightCol',\n}\n\nexport type PanelColors = Extract<PaletteNames, 'white' | 'neutral'>;\n\nexport enum PanelVariant {\n fill = 'fill',\n line = 'line',\n outline = 'outline',\n}\n\nexport enum PanelStacking {\n default = 'default',\n bFirst = 'bFirst',\n}\n\nexport enum PanelStatus {\n none = 'none',\n new = 'new',\n error = 'error',\n draft = 'draft',\n}\n\nexport interface PanelProps {\n /** Aria label on call to action button */\n buttonBottomAriaLabel?: string;\n /** Sets the text on the bottom call to action button */\n buttonBottomText?: string;\n /** Sets the action on the bottom call to action button */\n buttonBottomOnClick?: () => void;\n /** Expands or collapses the panel. Only applicable when ExpandedContent is used */\n expanded?: boolean;\n /** Whether the panel can be focused */\n focusable?: boolean;\n /** Sets the layout and order of the content boxes */\n layout?: PanelLayout;\n /** Sets the visual variant of panel */\n variant?: PanelVariant;\n /** Sets the color for panel if it has variant fill */\n color?: PanelColors;\n /** Sets classes on the outermost container of the panel */\n className?: string;\n /** Action called when toggling expansion of ExpandedContent */\n onExpand?: (isExpanded?: boolean) => void;\n /** Sets the stacking order of the content boxes */\n stacking?: PanelStacking;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Children elements to be rendered inside the panel */\n children?: React.ReactNode;\n /** Displays a status on the left side: default normal */\n status?: PanelStatus;\n /** Resources for component */\n resources?: Partial<HNDesignsystemPanel>;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n}\n\nconst ExpandButton = ({\n onClick,\n isExpanded,\n resources,\n}: {\n onClick: () => void;\n isExpanded: boolean | undefined;\n resources: Partial<HNDesignsystemPanel>;\n}): React.JSX.Element => {\n const buttonClassName = classNames(styles['expander__button'], isExpanded && styles['expander__button--expanded']);\n\n return (\n <Button\n variant=\"borderless\"\n textClassName={styles['expander__button__text']}\n wrapperClassName={buttonClassName}\n aria-expanded={isExpanded}\n onClick={onClick}\n >\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} size={IconSize.XSmall} />\n <span>{isExpanded ? resources.expandButtonClose : resources.expandButtonOpen}</span>\n </Button>\n );\n};\nconst PanelRoot = React.forwardRef(function PanelForwardedRef(\n {\n layout = PanelLayout.vertical,\n variant = PanelVariant.fill,\n color = 'neutral',\n stacking = PanelStacking.default,\n testId,\n children,\n expanded = false,\n focusable,\n status = PanelStatus.none,\n buttonBottomAriaLabel,\n buttonBottomOnClick,\n buttonBottomText,\n className,\n resources,\n onExpand,\n highlightText,\n }: PanelProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n const [preContainer, setPreContainer] = React.useState<React.ReactNode[]>([]);\n const [title, setTitle] = React.useState<React.ReactNode[]>([]);\n const [content, setContent] = React.useState<React.ReactNode[]>([]);\n const [expandableContent, setExpandableContent] = React.useState<React.ReactNode[]>([]);\n const [hasIcon, setHasIcon] = React.useState(false);\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const localRef = React.useRef<HTMLDivElement>(null);\n const panelRef = ref ?? localRef;\n const expandedContentRef = React.useRef<HTMLDivElement>(null);\n const defaultScroll = 100;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemPanel = {\n ...defaultResources,\n ...resources,\n };\n\n React.useEffect(() => {\n let index = 0;\n let localHasIcon = false;\n const newPreContainer: React.ReactNode[] = [];\n const newTitle: React.ReactNode[] = [];\n const newContent: React.ReactNode[] = [];\n const newExpandableContent: React.ReactNode[] = [];\n\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\n const key = child.key ?? `panel-child-${index++}`;\n\n if (child.type === PreContainer) {\n newPreContainer.push(React.cloneElement(child, { key }));\n } else if (child.type === PanelTitle) {\n newTitle.push(\n React.cloneElement(child as React.ReactElement<PanelTitleProps>, {\n key,\n highlightText: child.props.highlightText || highlightText,\n })\n );\n if (child.props.icon) {\n localHasIcon = true;\n }\n } else if (child.type === A || child.type === B || child.type === C) {\n newContent.push(React.cloneElement(child, { key }));\n } else if (child.type === ExpandedContent) {\n newExpandableContent.push(React.cloneElement(child, { key }));\n }\n }\n });\n\n setPreContainer(newPreContainer);\n setTitle(newTitle);\n setContent(newContent);\n setExpandableContent(newExpandableContent);\n setHasIcon(localHasIcon);\n }, [children]);\n\n React.useEffect(() => {\n if (expanded) {\n // Hvis panel åpnes controlled skal ikke scroll skje\n return;\n }\n // Scroller oppover når expanded content åpnes uncontrolled\n if (isExpanded) {\n if ('current' in panelRef && panelRef.current && expandedContentRef.current) {\n const panelRect = panelRef.current.getBoundingClientRect();\n const expandedContentRect = expandedContentRef.current.getBoundingClientRect();\n\n const scrollAmount = Math.min(defaultScroll, panelRect.top - 20);\n\n // Scroller kun oppover, og kun dersom expandedContent havner utenfor skjermen når åpnet\n if (scrollAmount > 0 && expandedContentRect.bottom > window.innerHeight) {\n const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n if (prefersReducedMotion) {\n return;\n }\n window.scrollBy({\n top: scrollAmount,\n behavior: 'smooth',\n });\n }\n }\n }\n }, [isExpanded]);\n\n const colorScheme = variant === PanelVariant.fill ? color : 'white';\n\n const outerClassnames = classNames(className, {\n [styles['panel__border--outline--outer']]: variant === PanelVariant.outline,\n [styles['panel__border--line']]: variant === PanelVariant.line,\n [styles['panel__border--fill--neutral']]: variant === PanelVariant.fill && colorScheme === 'neutral',\n [styles['panel__border--fill--new']]: variant === PanelVariant.fill && status === PanelStatus.new,\n [styles['panel__border--fill--status']]: variant === PanelVariant.fill && status !== PanelStatus.none,\n });\n const panelClassnames = classNames(styles['panel'], styles[`panel--${colorScheme}`], styles['panel--status'], {\n [styles['panel--line']]: variant === PanelVariant.line,\n [styles['panel--new']]: status === PanelStatus.new,\n [styles['panel--draft']]: status === PanelStatus.draft,\n [styles['panel--error']]: status === PanelStatus.error,\n [styles['panel--icon']]: hasIcon,\n });\n const contentContainerLayout = classNames(styles['panel__content'], styles[`panel__content--${layout}`], {\n [styles[`panel__content--b-first`]]: stacking === PanelStacking.bFirst,\n });\n const expanderBorderLayout = classNames({\n [styles['panel__expander__border--expanded']]: isExpanded && status === PanelStatus.none,\n [styles[`panel__expander__border--not-expanded--${colorScheme}`]]: !isExpanded && status === PanelStatus.none,\n [styles[`panel__expander__border--not-expanded--line`]]: !isExpanded && status === PanelStatus.none && variant === PanelVariant.line,\n });\n\n const handleExpandClick = (): void => {\n setIsExpanded(!isExpanded);\n };\n\n return expandableContent.length > 0 ? (\n <div className={outerClassnames}>\n <div className={classNames({ [styles['panel__border--outline--inner']]: variant === PanelVariant.outline })}>\n <div className={expanderBorderLayout}>\n <div className={panelClassnames} data-testid={testId} ref={panelRef} tabIndex={focusable ? -1 : undefined}>\n <Highlighter searchText={highlightText}>\n {preContainer}\n {title}\n </Highlighter>\n <div className={contentContainerLayout}>\n <Highlighter searchText={highlightText}>{content}</Highlighter>\n </div>\n <ExpandButton onClick={handleExpandClick} isExpanded={isExpanded} resources={mergedResources} />\n {isExpanded && (\n <div ref={expandedContentRef} data-testid={testId + '-details'}>\n <div className={styles['panel__expander__separator']} />\n <Highlighter searchText={highlightText}>{expandableContent}</Highlighter>\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n ) : (\n <div className={outerClassnames}>\n <div className={classNames({ [styles['panel__border--outline--inner']]: variant === PanelVariant.outline })}>\n <div className={panelClassnames} data-testid={testId} ref={panelRef} tabIndex={focusable ? -1 : undefined}>\n <Highlighter searchText={highlightText}>\n {preContainer}\n {title}\n </Highlighter>\n <div className={contentContainerLayout}>\n <Highlighter searchText={highlightText}>{content}</Highlighter>\n </div>\n {buttonBottomText && buttonBottomOnClick && (\n <div className={styles['panel__button-bottom']}>\n <Button variant=\"borderless\" type=\"button\" size=\"medium\" onClick={buttonBottomOnClick} aria-label={buttonBottomAriaLabel}>\n {buttonBottomText}\n <Icon svgIcon={ChevronRight} size={IconSize.XSmall} />\n </Button>\n </div>\n )}\n </div>\n </div>\n </div>\n );\n});\n\nexport interface ContentProps {\n /** Children elements to be rendered inside the content box */\n children?: React.ReactNode;\n}\n\nexport const PreContainer: React.FC<ContentProps> = ({ children }) => {\n return <div className={styles['panel__pre-container']}>{children}</div>;\n};\n\nexport const A: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--a']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const B: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--b']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const C: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--c']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const ExpandedContent: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__expander__content']);\n return <div className={styling}>{children}</div>;\n};\n\ntype PanelComponent = typeof PanelRoot & {\n PreContainer: React.FC<ContentProps>;\n Title: React.FC<PanelTitleProps>;\n A: React.FC<ContentProps>;\n B: React.FC<ContentProps>;\n C: React.FC<ContentProps>;\n ExpandedContent: React.FC<ContentProps>;\n};\nPanelRoot.displayName = 'Panel';\nconst Panel = PanelRoot as PanelComponent;\nPanel.PreContainer = PreContainer;\nPanel.Title = PanelTitle;\nPanel.A = A;\nPanel.B = B;\nPanel.C = C;\nPanel.ExpandedContent = ExpandedContent;\n\nexport default Panel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AEKA,MAAa,gBAAgB,aAAmD;AAC9E,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACSb,IAAY,cAAA,yBAAA,eAAL;AACL,eAAA,cAAA;AACA,eAAA,gBAAA;AACA,eAAA,cAAA;AACA,eAAA,iBAAA;;;AAKF,IAAY,eAAA,yBAAA,gBAAL;AACL,gBAAA,UAAA;AACA,gBAAA,UAAA;AACA,gBAAA,aAAA;;;AAGF,IAAY,gBAAA,yBAAA,iBAAL;AACL,iBAAA,aAAA;AACA,iBAAA,YAAA;;;AAGF,IAAY,cAAA,yBAAA,eAAL;AACL,eAAA,UAAA;AACA,eAAA,SAAA;AACA,eAAA,WAAA;AACA,eAAA,WAAA;;;AAsCF,IAAM,gBAAgB,EACpB,SACA,YACA,gBAKuB;CACvB,MAAM,kBAAkB,WAAW,OAAO,qBAAqB,cAAc,OAAO,8BAA8B;AAElH,QACE,qBAAC,gBAAA;EACC,SAAQ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,UAAU,cAAc;AACxB,IAAM,QAAQ;AACd,MAAM,eAAe;AACrB,MAAM,QAAQ;AACd,MAAM,IAAI;AACV,MAAM,IAAI;AACV,MAAM,IAAI;AACV,MAAM,kBAAkB;AAExB,IAAA,gBAAe"}
1
+ {"version":3,"file":"Panel.js","names":["contextValue: PanelListContextValue","mergedResources: HNDesignsystemPanel","newPreContainer: React.ReactNode[]","newTitle: React.ReactNode[]","newContent: React.ReactNode[]","newExpandableContent: React.ReactNode[]","PreContainer: React.FC<ContentProps>","A: React.FC<ContentProps>","B: React.FC<ContentProps>","C: React.FC<ContentProps>","ExpandedContent: React.FC<ContentProps>"],"sources":["../src/resources/HN.Designsystem.Panel.en-GB.json","../src/resources/HN.Designsystem.Panel.nb-NO.json","../src/components/Panel/resourceHelper.ts","../src/components/PanelList/PanelList.tsx","../src/components/Panel/Panel.tsx"],"sourcesContent":["{\n \"expandButtonOpen\": \"See details\",\n \"expandButtonClose\": \"Hide details\"\n}\n","{\n \"expandButtonOpen\": \"Se detaljer\",\n \"expandButtonClose\": \"Skjul detaljer\"\n}\n","import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Panel.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Panel.nb-NO.json';\nimport { HNDesignsystemPanel } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemPanel => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { PanelVariant } from '../Panel/Panel';\n\nimport styles from './styles.module.scss';\n\nexport interface PanelListProps {\n /** Panels to render inside the PanelList */\n children?: React.ReactNode;\n /** Changes the visual representation of the panel. Default: fill */\n variant?: PanelVariant;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n}\n\ninterface PanelListContextValue {\n variant: PanelVariant;\n highlightText?: string;\n applyPanelClassName: (existingClassName?: string) => string;\n}\n\nexport const PanelListContext = React.createContext<PanelListContextValue | null>(null);\n\nconst PanelList = React.forwardRef(function BadgeForwardedRef(props: PanelListProps, ref: React.ForwardedRef<HTMLDivElement>) {\n const { testId, children, variant = PanelVariant.fill, highlightText } = props;\n\n const contextValue: PanelListContextValue = React.useMemo(\n () => ({\n variant,\n highlightText,\n applyPanelClassName: (existingClassName?: string) => classNames(existingClassName, styles[`panel-list__panel--${variant}`]),\n }),\n [variant, highlightText]\n );\n\n return (\n <PanelListContext.Provider value={contextValue}>\n <div\n ref={ref}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PanelList}\n className={classNames({ [styles['panel-list--outline']]: variant === PanelVariant.outline })}\n >\n {children}\n </div>\n </PanelListContext.Provider>\n );\n});\n\nexport default PanelList;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { LanguageLocales } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { PaletteNames } from '../../theme/palette';\nimport Button from '../Button';\nimport Icon, { IconSize } from '../Icon';\nimport PanelTitle, { PanelTitleProps } from './PanelTitle';\nimport { getResources } from './resourceHelper';\nimport { HNDesignsystemPanel } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport Highlighter from '../Highlighter';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronRight from '../Icons/ChevronRight';\nimport ChevronUp from '../Icons/ChevronUp';\nimport { PanelListContext } from '../PanelList/PanelList';\n\nimport styles from './styles.module.scss';\n\nexport enum PanelLayout {\n vertical = 'vertical',\n horizontal = 'horizontal',\n combined = 'combined',\n bAsRightCol = 'bAsRightCol',\n}\n\nexport type PanelColors = Extract<PaletteNames, 'white' | 'neutral'>;\n\nexport enum PanelVariant {\n fill = 'fill',\n line = 'line',\n outline = 'outline',\n}\n\nexport enum PanelStacking {\n default = 'default',\n bFirst = 'bFirst',\n}\n\nexport enum PanelStatus {\n none = 'none',\n new = 'new',\n error = 'error',\n draft = 'draft',\n}\n\nexport interface PanelProps {\n /** Aria label on call to action button */\n buttonBottomAriaLabel?: string;\n /** Sets the text on the bottom call to action button */\n buttonBottomText?: string;\n /** Sets the action on the bottom call to action button */\n buttonBottomOnClick?: () => void;\n /** Expands or collapses the panel. Only applicable when ExpandedContent is used */\n expanded?: boolean;\n /** Whether the panel can be focused */\n focusable?: boolean;\n /** Sets the layout and order of the content boxes */\n layout?: PanelLayout;\n /** Sets the visual variant of panel */\n variant?: PanelVariant;\n /** Sets the color for panel if it has variant fill */\n color?: PanelColors;\n /** Sets classes on the outermost container of the panel */\n className?: string;\n /** Action called when toggling expansion of ExpandedContent */\n onExpand?: (isExpanded?: boolean) => void;\n /** Sets the stacking order of the content boxes */\n stacking?: PanelStacking;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Children elements to be rendered inside the panel */\n children?: React.ReactNode;\n /** Displays a status on the left side: default normal */\n status?: PanelStatus;\n /** Resources for component */\n resources?: Partial<HNDesignsystemPanel>;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n}\n\nconst ExpandButton = ({\n onClick,\n isExpanded,\n resources,\n}: {\n onClick: () => void;\n isExpanded: boolean | undefined;\n resources: Partial<HNDesignsystemPanel>;\n}): React.JSX.Element => {\n const buttonClassName = classNames(styles['expander__button'], isExpanded && styles['expander__button--expanded']);\n\n return (\n <Button\n variant=\"borderless\"\n textClassName={styles['expander__button__text']}\n wrapperClassName={buttonClassName}\n aria-expanded={isExpanded}\n onClick={onClick}\n >\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} size={IconSize.XSmall} />\n <span>{isExpanded ? resources.expandButtonClose : resources.expandButtonOpen}</span>\n </Button>\n );\n};\nconst PanelRoot = React.forwardRef(function PanelForwardedRef(\n {\n layout = PanelLayout.vertical,\n variant = PanelVariant.fill,\n color = 'neutral',\n stacking = PanelStacking.default,\n testId,\n children,\n expanded = false,\n focusable,\n status = PanelStatus.none,\n buttonBottomAriaLabel,\n buttonBottomOnClick,\n buttonBottomText,\n className,\n resources,\n onExpand,\n highlightText,\n }: PanelProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n const panelListContext = React.useContext(PanelListContext);\n const [preContainer, setPreContainer] = React.useState<React.ReactNode[]>([]);\n const [title, setTitle] = React.useState<React.ReactNode[]>([]);\n const [content, setContent] = React.useState<React.ReactNode[]>([]);\n const [expandableContent, setExpandableContent] = React.useState<React.ReactNode[]>([]);\n const [hasIcon, setHasIcon] = React.useState(false);\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const localRef = React.useRef<HTMLDivElement>(null);\n const panelRef = ref ?? localRef;\n const expandedContentRef = React.useRef<HTMLDivElement>(null);\n const defaultScroll = 100;\n\n // Use context values if available, otherwise use props\n const effectiveVariant = panelListContext?.variant ?? variant;\n const effectiveHighlightText = panelListContext?.highlightText ?? highlightText;\n const effectiveClassName = panelListContext?.applyPanelClassName(className) ?? className;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemPanel = {\n ...defaultResources,\n ...resources,\n };\n\n React.useEffect(() => {\n let index = 0;\n let localHasIcon = false;\n const newPreContainer: React.ReactNode[] = [];\n const newTitle: React.ReactNode[] = [];\n const newContent: React.ReactNode[] = [];\n const newExpandableContent: React.ReactNode[] = [];\n\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\n const key = child.key ?? `panel-child-${index++}`;\n\n if (child.type === PreContainer) {\n newPreContainer.push(React.cloneElement(child, { key }));\n } else if (child.type === PanelTitle) {\n newTitle.push(\n React.cloneElement(child as React.ReactElement<PanelTitleProps>, {\n key,\n highlightText: child.props.highlightText || effectiveHighlightText,\n })\n );\n if (child.props.icon) {\n localHasIcon = true;\n }\n } else if (child.type === A || child.type === B || child.type === C) {\n newContent.push(React.cloneElement(child, { key }));\n } else if (child.type === ExpandedContent) {\n newExpandableContent.push(React.cloneElement(child, { key }));\n }\n }\n });\n\n setPreContainer(newPreContainer);\n setTitle(newTitle);\n setContent(newContent);\n setExpandableContent(newExpandableContent);\n setHasIcon(localHasIcon);\n }, [children]);\n\n React.useEffect(() => {\n if (expanded) {\n // Hvis panel åpnes controlled skal ikke scroll skje\n return;\n }\n // Scroller oppover når expanded content åpnes uncontrolled\n if (isExpanded) {\n if ('current' in panelRef && panelRef.current && expandedContentRef.current) {\n const panelRect = panelRef.current.getBoundingClientRect();\n const expandedContentRect = expandedContentRef.current.getBoundingClientRect();\n\n const scrollAmount = Math.min(defaultScroll, panelRect.top - 20);\n\n // Scroller kun oppover, og kun dersom expandedContent havner utenfor skjermen når åpnet\n if (scrollAmount > 0 && expandedContentRect.bottom > window.innerHeight) {\n const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n if (prefersReducedMotion) {\n return;\n }\n window.scrollBy({\n top: scrollAmount,\n behavior: 'smooth',\n });\n }\n }\n }\n }, [isExpanded]);\n\n const colorScheme = effectiveVariant === PanelVariant.fill ? color : 'white';\n\n const outerClassnames = classNames(effectiveClassName, {\n [styles['panel__border--outline--outer']]: effectiveVariant === PanelVariant.outline,\n [styles['panel__border--line']]: effectiveVariant === PanelVariant.line,\n [styles['panel__border--fill--neutral']]: effectiveVariant === PanelVariant.fill && colorScheme === 'neutral',\n [styles['panel__border--fill--new']]: effectiveVariant === PanelVariant.fill && status === PanelStatus.new,\n [styles['panel__border--fill--status']]: effectiveVariant === PanelVariant.fill && status !== PanelStatus.none,\n });\n const panelClassnames = classNames(styles['panel'], styles[`panel--${colorScheme}`], styles['panel--status'], {\n [styles['panel--line']]: effectiveVariant === PanelVariant.line,\n [styles['panel--new']]: status === PanelStatus.new,\n [styles['panel--draft']]: status === PanelStatus.draft,\n [styles['panel--error']]: status === PanelStatus.error,\n [styles['panel--icon']]: hasIcon,\n });\n const contentContainerLayout = classNames(styles['panel__content'], styles[`panel__content--${layout}`], {\n [styles[`panel__content--b-first`]]: stacking === PanelStacking.bFirst,\n });\n const expanderBorderLayout = classNames({\n [styles['panel__expander__border--expanded']]: isExpanded && status === PanelStatus.none,\n [styles[`panel__expander__border--not-expanded--${colorScheme}`]]: !isExpanded && status === PanelStatus.none,\n [styles[`panel__expander__border--not-expanded--line`]]:\n !isExpanded && status === PanelStatus.none && effectiveVariant === PanelVariant.line,\n });\n\n const handleExpandClick = (): void => {\n setIsExpanded(!isExpanded);\n };\n\n return expandableContent.length > 0 ? (\n <div className={outerClassnames}>\n <div className={classNames({ [styles['panel__border--outline--inner']]: effectiveVariant === PanelVariant.outline })}>\n <div className={expanderBorderLayout}>\n <div className={panelClassnames} data-testid={testId} ref={panelRef} tabIndex={focusable ? -1 : undefined}>\n <Highlighter searchText={effectiveHighlightText}>\n {preContainer}\n {title}\n </Highlighter>\n <div className={contentContainerLayout}>\n <Highlighter searchText={effectiveHighlightText}>{content}</Highlighter>\n </div>\n <ExpandButton onClick={handleExpandClick} isExpanded={isExpanded} resources={mergedResources} />\n {isExpanded && (\n <div ref={expandedContentRef} data-testid={testId + '-details'}>\n <div className={styles['panel__expander__separator']} />\n <Highlighter searchText={effectiveHighlightText}>{expandableContent}</Highlighter>\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n ) : (\n <div className={outerClassnames}>\n <div className={classNames({ [styles['panel__border--outline--inner']]: effectiveVariant === PanelVariant.outline })}>\n <div className={panelClassnames} data-testid={testId} ref={panelRef} tabIndex={focusable ? -1 : undefined}>\n <Highlighter searchText={effectiveHighlightText}>\n {preContainer}\n {title}\n </Highlighter>\n <div className={contentContainerLayout}>\n <Highlighter searchText={effectiveHighlightText}>{content}</Highlighter>\n </div>\n {buttonBottomText && buttonBottomOnClick && (\n <div className={styles['panel__button-bottom']}>\n <Button variant=\"borderless\" type=\"button\" size=\"medium\" onClick={buttonBottomOnClick} aria-label={buttonBottomAriaLabel}>\n {buttonBottomText}\n <Icon svgIcon={ChevronRight} size={IconSize.XSmall} />\n </Button>\n </div>\n )}\n </div>\n </div>\n </div>\n );\n});\n\nexport interface ContentProps {\n /** Children elements to be rendered inside the content box */\n children?: React.ReactNode;\n}\n\nexport const PreContainer: React.FC<ContentProps> = ({ children }) => {\n return <div className={styles['panel__pre-container']}>{children}</div>;\n};\n\nexport const A: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--a']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const B: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--b']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const C: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--c']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const ExpandedContent: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__expander__content']);\n return <div className={styling}>{children}</div>;\n};\n\ntype PanelComponent = typeof PanelRoot & {\n PreContainer: React.FC<ContentProps>;\n Title: React.FC<PanelTitleProps>;\n A: React.FC<ContentProps>;\n B: React.FC<ContentProps>;\n C: React.FC<ContentProps>;\n ExpandedContent: React.FC<ContentProps>;\n};\nPanelRoot.displayName = 'Panel';\nconst Panel = PanelRoot as PanelComponent;\nPanel.PreContainer = PreContainer;\nPanel.Title = PanelTitle;\nPanel.A = A;\nPanel.B = B;\nPanel.C = C;\nPanel.ExpandedContent = ExpandedContent;\n\nexport default Panel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AEKA,MAAa,gBAAgB,aAAmD;AAC9E,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACeb,MAAa,mBAAmB,MAAM,cAA4C,KAAK;AA4BvF,IAAA,oBA1BkB,MAAM,WAAW,SAAS,kBAAkB,OAAuB,KAAyC;CAC5H,MAAM,EAAE,QAAQ,UAAU,UAAU,aAAa,MAAM,kBAAkB;CAEzE,MAAMA,eAAsC,MAAM,eACzC;EACL;EACA;EAC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