@helsenorge/designsystem-react 14.0.0-beta.7 → 14.0.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 (245) hide show
  1. package/lib/AnchorLink.js +2 -2
  2. package/lib/AnchorLink.js.map +1 -1
  3. package/lib/Avatar.js +2 -2
  4. package/lib/Avatar.js.map +1 -1
  5. package/lib/Badge.js +2 -2
  6. package/lib/Badge.js.map +1 -1
  7. package/lib/Button.js +6 -6
  8. package/lib/Button.js.map +1 -1
  9. package/lib/CHANGELOG.md +340 -11
  10. package/lib/Checkbox.js +6 -6
  11. package/lib/Checkbox.js.map +1 -1
  12. package/lib/Close.js +3 -3
  13. package/lib/Close.js.map +1 -1
  14. package/lib/DictionaryTrigger.js +2 -2
  15. package/lib/DictionaryTrigger.js.map +1 -1
  16. package/lib/DoctorSmall.js +22 -34
  17. package/lib/DoctorSmall.js.map +1 -1
  18. package/lib/Drawer.js +6 -5
  19. package/lib/Drawer.js.map +1 -1
  20. package/lib/Duolist.js +5 -5
  21. package/lib/Duolist.js.map +1 -1
  22. package/lib/ElementHeader.js +9 -9
  23. package/lib/ElementHeader.js.map +1 -1
  24. package/lib/ElementHeaderText.js +4 -4
  25. package/lib/ElementHeaderText.js.map +1 -1
  26. package/lib/ErrorWrapper.js +2 -2
  27. package/lib/ErrorWrapper.js.map +1 -1
  28. package/lib/Expander.js +8 -8
  29. package/lib/Expander.js.map +1 -1
  30. package/lib/FormFieldTag.js +2 -2
  31. package/lib/FormFieldTag.js.map +1 -1
  32. package/lib/FormGroup.js +5 -5
  33. package/lib/FormGroup.js.map +1 -1
  34. package/lib/FormLayout.js +3 -3
  35. package/lib/FormLayout.js.map +1 -1
  36. package/lib/HelpDetails.js +3 -3
  37. package/lib/HelpDetails.js.map +1 -1
  38. package/lib/HelpTriggerIcon.js +12 -8
  39. package/lib/HelpTriggerIcon.js.map +1 -1
  40. package/lib/HelpTriggerStandalone.js +2 -2
  41. package/lib/HelpTriggerStandalone.js.map +1 -1
  42. package/lib/HighlightPanel.js +3 -3
  43. package/lib/HighlightPanel.js.map +1 -1
  44. package/lib/HorizontalScroll.js +4 -4
  45. package/lib/HorizontalScroll.js.map +1 -1
  46. package/lib/Icon.js +2 -2
  47. package/lib/Icon.js.map +1 -1
  48. package/lib/IllustrationNames.js +6 -2
  49. package/lib/IllustrationNames.js.map +1 -1
  50. package/lib/InfoTeaser.js +3 -3
  51. package/lib/InfoTeaser.js.map +1 -1
  52. package/lib/Input.js +9 -7
  53. package/lib/Input.js.map +1 -1
  54. package/lib/LazyIcon.js +2 -0
  55. package/lib/LazyIcon.js.map +1 -1
  56. package/lib/LazyIllustration.js +5 -1
  57. package/lib/LazyIllustration.js.map +1 -1
  58. package/lib/LinkList.js +5 -5
  59. package/lib/LinkList.js.map +1 -1
  60. package/lib/List.js +2 -2
  61. package/lib/List.js.map +1 -1
  62. package/lib/ListEditMode.js +4 -4
  63. package/lib/ListEditMode.js.map +1 -1
  64. package/lib/MaxCharacters.js +2 -2
  65. package/lib/MaxCharacters.js.map +1 -1
  66. package/lib/PanelTitle.js +2 -2
  67. package/lib/PanelTitle.js.map +1 -1
  68. package/lib/PopOver.js +2 -2
  69. package/lib/PopOver.js.map +1 -1
  70. package/lib/Select.js +4 -4
  71. package/lib/Select.js.map +1 -1
  72. package/lib/SingleSelectItem.js +3 -3
  73. package/lib/SingleSelectItem.js.map +1 -1
  74. package/lib/Slider.js +18 -10
  75. package/lib/Slider.js.map +1 -1
  76. package/lib/Spacer.js +2 -2
  77. package/lib/Spacer.js.map +1 -1
  78. package/lib/StatusDot.js +4 -4
  79. package/lib/StatusDot.js.map +1 -1
  80. package/lib/StatusDotList.js +2 -2
  81. package/lib/StatusDotList.js.map +1 -1
  82. package/lib/StepButtons.js +5 -5
  83. package/lib/StepButtons.js.map +1 -1
  84. package/lib/StorkMedium.js +96 -0
  85. package/lib/StorkMedium.js.map +1 -0
  86. package/lib/TabList.js +8 -8
  87. package/lib/TabList.js.map +1 -1
  88. package/lib/TabPanel.js +2 -2
  89. package/lib/TabPanel.js.map +1 -1
  90. package/lib/TableBody.js +2 -2
  91. package/lib/TableBody.js.map +1 -1
  92. package/lib/TableCell.js +2 -2
  93. package/lib/TableCell.js.map +1 -1
  94. package/lib/TableExpandedRow.js +4 -4
  95. package/lib/TableExpandedRow.js.map +1 -1
  96. package/lib/TableExpanderCell.js +2 -2
  97. package/lib/TableExpanderCell.js.map +1 -1
  98. package/lib/TableHead.js +2 -2
  99. package/lib/TableHead.js.map +1 -1
  100. package/lib/TableHeadCell.js +3 -3
  101. package/lib/TableHeadCell.js.map +1 -1
  102. package/lib/TableRow.js +3 -3
  103. package/lib/TableRow.js.map +1 -1
  104. package/lib/Textarea.js +17 -16
  105. package/lib/Textarea.js.map +1 -1
  106. package/lib/ThinkingMedium.js +98 -0
  107. package/lib/ThinkingMedium.js.map +1 -0
  108. package/lib/Title.js +2 -2
  109. package/lib/Title.js.map +1 -1
  110. package/lib/Toast.js +3 -3
  111. package/lib/Toast.js.map +1 -1
  112. package/lib/components/ArticleTeaser/index.js +4 -4
  113. package/lib/components/ArticleTeaser/index.js.map +1 -1
  114. package/lib/components/Button/styles.module.scss +1 -3
  115. package/lib/components/Chip/index.js +2 -2
  116. package/lib/components/Chip/index.js.map +1 -1
  117. package/lib/components/Drawer/styles.module.scss +4 -21
  118. package/lib/components/Drawer/styles.module.scss.d.ts +1 -1
  119. package/lib/components/Dropdown/index.js +5 -5
  120. package/lib/components/Dropdown/index.js.map +1 -1
  121. package/lib/components/DropdownOld/index.js +3 -3
  122. package/lib/components/DropdownOld/index.js.map +1 -1
  123. package/lib/components/EmptyState/index.js +2 -2
  124. package/lib/components/EmptyState/index.js.map +1 -1
  125. package/lib/components/ExpanderHierarchy/Expander.d.ts +1 -1
  126. package/lib/components/ExpanderHierarchy/index.js +7 -7
  127. package/lib/components/ExpanderHierarchy/index.js.map +1 -1
  128. package/lib/components/ExpanderList/index.js +19 -10
  129. package/lib/components/ExpanderList/index.js.map +1 -1
  130. package/lib/components/FavoriteButton/index.js +2 -2
  131. package/lib/components/FavoriteButton/index.js.map +1 -1
  132. package/lib/components/HelpBubble/index.js +3 -3
  133. package/lib/components/HelpBubble/index.js.map +1 -1
  134. package/lib/components/HelpPanel/index.js +2 -2
  135. package/lib/components/HelpPanel/index.js.map +1 -1
  136. package/lib/components/HelpTriggerIcon/HelpSign.d.ts +0 -1
  137. package/lib/components/HelpTriggerInline/index.js +2 -2
  138. package/lib/components/HelpTriggerInline/index.js.map +1 -1
  139. package/lib/components/HelpTriggerInline/styles.module.scss +1 -0
  140. package/lib/components/Icons/AdditionalIconInformation.d.ts +8 -0
  141. package/lib/components/Icons/AdditionalIconInformation.js +8 -0
  142. package/lib/components/Icons/AdditionalIconInformation.js.map +1 -1
  143. package/lib/components/Icons/IconNames.d.ts +1 -1
  144. package/lib/components/Icons/IconNames.js +2 -0
  145. package/lib/components/Icons/IconNames.js.map +1 -1
  146. package/lib/components/Icons/StarFill.d.ts +4 -0
  147. package/lib/components/Icons/StarFill.js +16 -0
  148. package/lib/components/Icons/StarFill.js.map +1 -0
  149. package/lib/components/Icons/StarStroke.d.ts +4 -0
  150. package/lib/components/Icons/StarStroke.js +16 -0
  151. package/lib/components/Icons/StarStroke.js.map +1 -0
  152. package/lib/components/Illustrations/IllustrationNames.d.ts +1 -1
  153. package/lib/components/Illustrations/Stork.d.ts +11 -0
  154. package/lib/components/Illustrations/Stork.js +16 -0
  155. package/lib/components/Illustrations/Stork.js.map +1 -0
  156. package/lib/components/Illustrations/StorkMedium.d.ts +4 -0
  157. package/lib/components/Illustrations/StorkMedium.js +2 -0
  158. package/lib/components/Illustrations/Thinking.d.ts +9 -0
  159. package/lib/components/Illustrations/Thinking.js +16 -0
  160. package/lib/components/Illustrations/Thinking.js.map +1 -0
  161. package/lib/components/Illustrations/ThinkingMedium.d.ts +4 -0
  162. package/lib/components/Illustrations/ThinkingMedium.js +2 -0
  163. package/lib/components/Loader/index.js +19 -17
  164. package/lib/components/Loader/index.js.map +1 -1
  165. package/lib/components/Modal/index.js +9 -9
  166. package/lib/components/Modal/index.js.map +1 -1
  167. package/lib/components/NotificationPanel/index.js +6 -6
  168. package/lib/components/NotificationPanel/index.js.map +1 -1
  169. package/lib/components/Panel/index.js +12 -12
  170. package/lib/components/Panel/index.js.map +1 -1
  171. package/lib/components/PanelList/index.js +3 -3
  172. package/lib/components/PanelList/index.js.map +1 -1
  173. package/lib/components/PopMenu/index.js +3 -3
  174. package/lib/components/PopMenu/index.js.map +1 -1
  175. package/lib/components/Progressbar/index.js +2 -2
  176. package/lib/components/Progressbar/index.js.map +1 -1
  177. package/lib/components/PromoPanel/index.js +2 -2
  178. package/lib/components/PromoPanel/index.js.map +1 -1
  179. package/lib/components/ServiceMessage/ServiceMessage.d.ts +3 -0
  180. package/lib/components/ServiceMessage/index.js +7 -7
  181. package/lib/components/ServiceMessage/index.js.map +1 -1
  182. package/lib/components/SharingStatus/index.js +4 -4
  183. package/lib/components/SharingStatus/index.js.map +1 -1
  184. package/lib/components/Step/index.js +2 -2
  185. package/lib/components/Step/index.js.map +1 -1
  186. package/lib/components/Stepper/index.js +2 -2
  187. package/lib/components/Stepper/index.js.map +1 -1
  188. package/lib/components/StickyNote/index.js +16 -13
  189. package/lib/components/StickyNote/index.js.map +1 -1
  190. package/lib/components/Table/index.js +2 -2
  191. package/lib/components/Table/index.js.map +1 -1
  192. package/lib/components/Tabs/index.js +4 -4
  193. package/lib/components/Tabs/index.js.map +1 -1
  194. package/lib/components/Tag/index.js +2 -2
  195. package/lib/components/Tag/index.js.map +1 -1
  196. package/lib/components/Tile/index.js +4 -4
  197. package/lib/components/Tile/index.js.map +1 -1
  198. package/lib/components/Toggle/index.js +9 -9
  199. package/lib/components/Toggle/index.js.map +1 -1
  200. package/lib/components/Validation/index.js +2 -2
  201. package/lib/components/Validation/index.js.map +1 -1
  202. package/lib/floating-ui.react.js +126 -129
  203. package/lib/floating-ui.react.js.map +1 -1
  204. package/lib/hooks/useIsServerSide.d.ts +1 -1
  205. package/lib/resources/HN.Designsystem.ArticleTeaser.en-GB.json.d.ts +7 -0
  206. package/lib/resources/HN.Designsystem.ArticleTeaser.nb-NO.json.d.ts +7 -0
  207. package/lib/resources/HN.Designsystem.Drawer.en-GB.json.d.ts +6 -0
  208. package/lib/resources/HN.Designsystem.Drawer.nb-NO.json.d.ts +6 -0
  209. package/lib/resources/HN.Designsystem.Dropdown.en-GB.json.d.ts +6 -0
  210. package/lib/resources/HN.Designsystem.Dropdown.nb-NO.json.d.ts +6 -0
  211. package/lib/resources/HN.Designsystem.FavoriteButton.nb-NO.json.d.ts +6 -0
  212. package/lib/resources/HN.Designsystem.FormFieldTag.en-GB.json.d.ts +12 -0
  213. package/lib/resources/HN.Designsystem.FormFieldTag.nb-NO.json.d.ts +12 -0
  214. package/lib/resources/HN.Designsystem.FormFieldTag.nn-NO.json.d.ts +12 -0
  215. package/lib/resources/HN.Designsystem.FormFieldTag.se-NO.json.d.ts +12 -0
  216. package/lib/resources/HN.Designsystem.HelpBubble.nb-NO.json.d.ts +6 -0
  217. package/lib/resources/HN.Designsystem.HelpDrawer.nb-NO.json.d.ts +6 -0
  218. package/lib/resources/HN.Designsystem.InfoTeaser.en-GB.json.d.ts +7 -0
  219. package/lib/resources/HN.Designsystem.InfoTeaser.nb-NO.json.d.ts +7 -0
  220. package/lib/resources/HN.Designsystem.Input.en-GB.json.d.ts +6 -0
  221. package/lib/resources/HN.Designsystem.Input.nb-NO.json.d.ts +6 -0
  222. package/lib/resources/HN.Designsystem.Input.nn-NO.json.d.ts +6 -0
  223. package/lib/resources/HN.Designsystem.LinkList.en-GB.json.d.ts +6 -0
  224. package/lib/resources/HN.Designsystem.LinkList.nb-NO.json.d.ts +6 -0
  225. package/lib/resources/HN.Designsystem.Panel.en-GB.json.d.ts +7 -0
  226. package/lib/resources/HN.Designsystem.Panel.nb-NO.json.d.ts +7 -0
  227. package/lib/resources/HN.Designsystem.Tabs.en-GB.json.d.ts +7 -0
  228. package/lib/resources/HN.Designsystem.Tabs.nb-NO.json.d.ts +7 -0
  229. package/lib/resources/HN.Designsystem.TextArea.en-GB.json.d.ts +6 -0
  230. package/lib/resources/HN.Designsystem.TextArea.nb-NO.json.d.ts +6 -0
  231. package/lib/resources/HN.Designsystem.TextArea.nn-NO.json.d.ts +6 -0
  232. package/lib/resources/index.d.ts +1 -0
  233. package/lib/useBreakpoint.js +15 -24
  234. package/lib/useBreakpoint.js.map +1 -1
  235. package/lib/useExpand.js +5 -3
  236. package/lib/useExpand.js.map +1 -1
  237. package/lib/useIsServerSide.js +5 -6
  238. package/lib/useIsServerSide.js.map +1 -1
  239. package/lib/useToggle.js +5 -3
  240. package/lib/useToggle.js.map +1 -1
  241. package/lib/utils2.js +7 -7
  242. package/lib/utils2.js.map +1 -1
  243. package/lib/utils3.js +5 -5
  244. package/lib/utils3.js.map +1 -1
  245. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Sjekk om React kjører på server, eller ikke. (useEffect kjører ikke på server)
2
+ * Sjekk om React kjører på server, eller ikke.
3
3
  *
4
4
  * @returns true dersom koden kjører på server
5
5
  */
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonClose": "Show more",
3
+ "expandButtonOpen": "Show less"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonClose": "Vis mer",
3
+ "expandButtonOpen": "Vis mindre"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "ariaLabelCloseBtn": "Close"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "ariaLabelCloseBtn": "Lukk"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "closeText": "Close"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "closeText": "Lukk"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "ariaLabel": "Favorittmarkering"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ "allRequired": "All fields must be filled out",
3
+ "requiredField": "Required",
4
+ "optional": "Optional",
5
+ "allOptional": "All fields are optional",
6
+ "requiredRadiobuttonList": "Select one",
7
+ "requiredCheckboxList": "Select one or more",
8
+ "requiredSingleCheckbox": "Must be selected"
9
+ }
10
+ ;
11
+
12
+ export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ "allRequired": "Alle felt må fylles ut",
3
+ "requiredField": "Må fylles ut",
4
+ "optional": "Valgfritt",
5
+ "allOptional": "Alle felt er valgfrie",
6
+ "requiredRadiobuttonList": "Velg én",
7
+ "requiredCheckboxList": "Velg én eller flere",
8
+ "requiredSingleCheckbox": "Må velges"
9
+ }
10
+ ;
11
+
12
+ export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ "allRequired": "Alle felt må fyllast ut",
3
+ "requiredField": "Må fyllast ut",
4
+ "optional": "Valfritt",
5
+ "allOptional": "Alle felt er valfrie",
6
+ "requiredRadiobuttonList": "Vel éin",
7
+ "requiredCheckboxList": "Vel éin eller fleire",
8
+ "requiredSingleCheckbox": "Må veljast"
9
+ }
10
+ ;
11
+
12
+ export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ "allRequired": "Buot sajiid ferte deavdit",
3
+ "requiredField": "Ferte devdojuvvot",
4
+ "optional": "Válljenláhkái",
5
+ "allOptional": "Buot sajit eat válljenláhkái",
6
+ "requiredRadiobuttonList": "Vállje ovtta",
7
+ "requiredCheckboxList": "Vállje ovtta dahje máŋga",
8
+ "requiredSingleCheckbox": "Ferte válljejuvvot"
9
+ }
10
+ ;
11
+
12
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "ariaLabel": "Hjelpetekst"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "ariaLabel": "Hjelpetekst"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonOpen": "Show less",
3
+ "expandButtonClose": "Show more"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonOpen": "Vis mindre",
3
+ "expandButtonClose": "Vis mer"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "characters": "characters"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "characters": "tegn"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "characters": "teikn"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "editMode_deleteButtonAriaLabel": "Delete"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "editMode_deleteButtonAriaLabel": "Slett"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonOpen": "See details",
3
+ "expandButtonClose": "Hide details"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonOpen": "Se detaljer",
3
+ "expandButtonClose": "Skjul detaljer"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "ariaLabelRightButton": "Scroll right",
3
+ "ariaLabelLeftButton": "Scroll left"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "ariaLabelRightButton": "Scroll til høyre",
3
+ "ariaLabelLeftButton": "Scroll til venstre"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "characters": "characters"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "characters": "tegn"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ "characters": "teikn"
3
+ }
4
+ ;
5
+
6
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { r as screen, t as breakpoints } from "./grid.js";
2
- import { useEffect, useState } from "react";
2
+ import { useSyncExternalStore } from "react";
3
3
  let Breakpoint = /* @__PURE__ */ function(Breakpoint$1) {
4
4
  Breakpoint$1[Breakpoint$1["xxs"] = breakpoints.xxs] = "xxs";
5
5
  Breakpoint$1[Breakpoint$1["xs"] = breakpoints.xs] = "xs";
@@ -17,30 +17,21 @@ function getCurrentBreakpoint() {
17
17
  };
18
18
  }).find((entry) => entry.mq.matches)?.breakpoint ?? Breakpoint.xxs;
19
19
  }
20
- const useBreakpoint = () => {
21
- const [breakpoint, setBreakpoint] = useState(Breakpoint.xxs);
22
- useEffect(() => {
23
- setBreakpoint(getCurrentBreakpoint());
24
- }, []);
25
- useEffect(() => {
26
- const mediaQueryList = Object.values(screen).map((mediaQuery) => {
27
- const mq = window.matchMedia(mediaQuery);
28
- const handler = () => {
29
- setBreakpoint(getCurrentBreakpoint());
30
- };
31
- mq.addEventListener("change", handler);
32
- return {
33
- mq,
34
- handler
35
- };
20
+ function subscribeToBreakpointChanges(callback) {
21
+ const mediaQueryList = Object.values(screen).map((mediaQuery) => {
22
+ const mq = window.matchMedia(mediaQuery);
23
+ mq.addEventListener("change", callback);
24
+ return mq;
25
+ });
26
+ return () => {
27
+ mediaQueryList.forEach((mq) => {
28
+ mq.removeEventListener("change", callback);
36
29
  });
37
- return () => {
38
- mediaQueryList.forEach(({ mq, handler }) => {
39
- mq.removeEventListener("change", handler);
40
- });
41
- };
42
- }, []);
43
- return breakpoint;
30
+ };
31
+ }
32
+ var getServerSnapshot = () => Breakpoint.xxs;
33
+ const useBreakpoint = () => {
34
+ return useSyncExternalStore(subscribeToBreakpointChanges, getCurrentBreakpoint, getServerSnapshot);
44
35
  };
45
36
  export { useBreakpoint as n, Breakpoint as t };
46
37
 
@@ -1 +1 @@
1
- {"version":3,"file":"useBreakpoint.js","names":[],"sources":["../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(Breakpoint.xxs);\n\n useEffect(() => {\n // Oppdater breakpoint i useEffect for å støtte server side rendering\n setBreakpoint(getCurrentBreakpoint());\n }, []);\n\n useEffect(() => {\n const mediaQueryList = Object.values(screen).map(mediaQuery => {\n const mq = window.matchMedia(mediaQuery);\n const handler = (): void => {\n setBreakpoint(getCurrentBreakpoint());\n };\n\n mq.addEventListener('change', handler);\n return { mq, handler };\n });\n\n return (): void => {\n mediaQueryList.forEach(({ mq, handler }) => {\n mq.removeEventListener('change', handler);\n });\n };\n }, []);\n\n return breakpoint;\n};\n"],"mappings":";;AAIA,IAAY,aAAA,yBAAA,cAAL;AACL,cAAA,aAAA,SAAM,YAAY,OAAA;AAClB,cAAA,aAAA,QAAK,YAAY,MAAA;AACjB,cAAA,aAAA,QAAK,YAAY,MAAA;AACjB,cAAA,aAAA,QAAK,YAAY,MAAA;AACjB,cAAA,aAAA,QAAK,YAAY,MAAA;AACjB,cAAA,aAAA,QAAK,YAAY,MAAA;;;AAGnB,SAAS,uBAAmC;AAa1C,QAVuB,OAAO,QAAQ,OAAO,CAC1C,SAAS,CACT,KAAK,CAAC,MAAM,gBAAgB;AAC3B,SAAO;GACL,YAAY,WAAW;GACvB,IAAI,OAAO,WAAW,WAAW;GAClC;GACD,CAE2B,MAAK,UAAS,MAAM,GAAG,QAAQ,EAC9C,cAAc,WAAW;;AAG3C,MAAa,sBAAkC;CAC7C,MAAM,CAAC,YAAY,iBAAiB,SAAqB,WAAW,IAAI;AAExE,iBAAgB;AAEd,gBAAc,sBAAsB,CAAC;IACpC,EAAE,CAAC;AAEN,iBAAgB;EACd,MAAM,iBAAiB,OAAO,OAAO,OAAO,CAAC,KAAI,eAAc;GAC7D,MAAM,KAAK,OAAO,WAAW,WAAW;GACxC,MAAM,gBAAsB;AAC1B,kBAAc,sBAAsB,CAAC;;AAGvC,MAAG,iBAAiB,UAAU,QAAQ;AACtC,UAAO;IAAE;IAAI;IAAS;IACtB;AAEF,eAAmB;AACjB,kBAAe,SAAS,EAAE,IAAI,cAAc;AAC1C,OAAG,oBAAoB,UAAU,QAAQ;KACzC;;IAEH,EAAE,CAAC;AAEN,QAAO"}
1
+ {"version":3,"file":"useBreakpoint.js","names":[],"sources":["../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\n/** Sjekker nettleserens media queries fra største til minste; det høyeste treffet gjelder */\nfunction getCurrentBreakpoint(): Breakpoint {\n const mediaQueryList = Object.entries(screen)\n .reverse() // Sjekk xl, lg, md, osv. i synkende rekkefølge\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\n/** Event listeners for media queries - dette varslet React ved endringer */\nfunction subscribeToBreakpointChanges(callback: () => void): () => void {\n const mediaQueryList = Object.values(screen).map(mediaQuery => {\n const mq = window.matchMedia(mediaQuery);\n mq.addEventListener('change', callback);\n return mq;\n });\n\n return (): void => {\n mediaQueryList.forEach(mq => {\n mq.removeEventListener('change', callback);\n });\n };\n}\n\n/** Brukes ved server side rendering der window ikke finnes. Returnerer minste breakpoint som default */\nconst getServerSnapshot = (): Breakpoint => Breakpoint.xxs;\n\nexport const useBreakpoint = (): Breakpoint => {\n return useSyncExternalStore(subscribeToBreakpointChanges, getCurrentBreakpoint, getServerSnapshot);\n};\n"],"mappings":";;AAIA,IAAY,aAAA,yBAAA,cAAL;AACL,cAAA,aAAA,SAAM,YAAY,OAAA;AAClB,cAAA,aAAA,QAAK,YAAY,MAAA;AACjB,cAAA,aAAA,QAAK,YAAY,MAAA;AACjB,cAAA,aAAA,QAAK,YAAY,MAAA;AACjB,cAAA,aAAA,QAAK,YAAY,MAAA;AACjB,cAAA,aAAA,QAAK,YAAY,MAAA;;;AAInB,SAAS,uBAAmC;AAW1C,QAVuB,OAAO,QAAQ,OAAO,CAC1C,SAAS,CACT,KAAK,CAAC,MAAM,gBAAgB;AAC3B,SAAO;GACL,YAAY,WAAW;GACvB,IAAI,OAAO,WAAW,WAAW;GAClC;GACD,CAE2B,MAAK,UAAS,MAAM,GAAG,QAAQ,EAC9C,cAAc,WAAW;;AAI3C,SAAS,6BAA6B,UAAkC;CACtE,MAAM,iBAAiB,OAAO,OAAO,OAAO,CAAC,KAAI,eAAc;EAC7D,MAAM,KAAK,OAAO,WAAW,WAAW;AACxC,KAAG,iBAAiB,UAAU,SAAS;AACvC,SAAO;GACP;AAEF,cAAmB;AACjB,iBAAe,SAAQ,OAAM;AAC3B,MAAG,oBAAoB,UAAU,SAAS;IAC1C;;;AAKN,IAAM,0BAAsC,WAAW;AAEvD,MAAa,sBAAkC;AAC7C,QAAO,qBAAqB,8BAA8B,sBAAsB,kBAAkB"}
package/lib/useExpand.js CHANGED
@@ -2,10 +2,12 @@ import { t as usePrevious } from "./usePrevious.js";
2
2
  import { useEffect, useState } from "react";
3
3
  const useExpand = (expanded, onExpand) => {
4
4
  const [isExpanded, setIsExpanded] = useState(expanded);
5
+ const [prevExpanded, setPrevExpanded] = useState(expanded);
5
6
  const previousIsExpanded = usePrevious(isExpanded);
6
- useEffect(() => {
7
- if (expanded !== isExpanded) setIsExpanded(expanded);
8
- }, [expanded]);
7
+ if (expanded !== prevExpanded) {
8
+ setPrevExpanded(expanded);
9
+ setIsExpanded(expanded);
10
+ }
9
11
  useEffect(() => {
10
12
  if (onExpand && isExpanded !== !!previousIsExpanded) onExpand(isExpanded);
11
13
  }, [isExpanded, onExpand]);
@@ -1 +1 @@
1
- {"version":3,"file":"useExpand.js","names":[],"sources":["../src/hooks/useExpand.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react';\nimport { useEffect, useState } from 'react';\n\nimport { usePrevious } from './usePrevious';\n\nexport const useExpand = (expanded: boolean, onExpand?: (isExpanded: boolean) => void): [boolean, Dispatch<SetStateAction<boolean>>] => {\n const [isExpanded, setIsExpanded] = useState(expanded);\n const previousIsExpanded = usePrevious(isExpanded);\n\n useEffect(() => {\n if (expanded !== isExpanded) {\n setIsExpanded(expanded);\n }\n }, [expanded]);\n\n useEffect(() => {\n if (onExpand && isExpanded !== !!previousIsExpanded) {\n onExpand(isExpanded);\n }\n }, [isExpanded, onExpand]);\n\n return [isExpanded, setIsExpanded];\n};\n"],"mappings":";;AAKA,MAAa,aAAa,UAAmB,aAA2F;CACtI,MAAM,CAAC,YAAY,iBAAiB,SAAS,SAAS;CACtD,MAAM,qBAAqB,YAAY,WAAW;AAElD,iBAAgB;AACd,MAAI,aAAa,WACf,eAAc,SAAS;IAExB,CAAC,SAAS,CAAC;AAEd,iBAAgB;AACd,MAAI,YAAY,eAAe,CAAC,CAAC,mBAC/B,UAAS,WAAW;IAErB,CAAC,YAAY,SAAS,CAAC;AAE1B,QAAO,CAAC,YAAY,cAAc"}
1
+ {"version":3,"file":"useExpand.js","names":[],"sources":["../src/hooks/useExpand.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react';\nimport { useEffect, useState } from 'react';\n\nimport { usePrevious } from './usePrevious';\n\nexport const useExpand = (expanded: boolean, onExpand?: (isExpanded: boolean) => void): [boolean, Dispatch<SetStateAction<boolean>>] => {\n const [isExpanded, setIsExpanded] = useState(expanded);\n const [prevExpanded, setPrevExpanded] = useState(expanded);\n const previousIsExpanded = usePrevious(isExpanded);\n\n if (expanded !== prevExpanded) {\n setPrevExpanded(expanded);\n setIsExpanded(expanded);\n }\n\n useEffect(() => {\n if (onExpand && isExpanded !== !!previousIsExpanded) {\n onExpand(isExpanded);\n }\n }, [isExpanded, onExpand]);\n\n return [isExpanded, setIsExpanded];\n};\n"],"mappings":";;AAKA,MAAa,aAAa,UAAmB,aAA2F;CACtI,MAAM,CAAC,YAAY,iBAAiB,SAAS,SAAS;CACtD,MAAM,CAAC,cAAc,mBAAmB,SAAS,SAAS;CAC1D,MAAM,qBAAqB,YAAY,WAAW;AAElD,KAAI,aAAa,cAAc;AAC7B,kBAAgB,SAAS;AACzB,gBAAc,SAAS;;AAGzB,iBAAgB;AACd,MAAI,YAAY,eAAe,CAAC,CAAC,mBAC/B,UAAS,WAAW;IAErB,CAAC,YAAY,SAAS,CAAC;AAE1B,QAAO,CAAC,YAAY,cAAc"}
@@ -1,10 +1,9 @@
1
- import { useEffect, useState } from "react";
1
+ import { useSyncExternalStore } from "react";
2
+ var emptySubscribe = () => () => {};
3
+ var getClientSnapshot = () => false;
4
+ var getServerSnapshot = () => true;
2
5
  const useIsServerSide = () => {
3
- const [isServerSide, setIsServerSide] = useState(true);
4
- useEffect(() => {
5
- setIsServerSide(false);
6
- }, []);
7
- return isServerSide;
6
+ return useSyncExternalStore(emptySubscribe, getClientSnapshot, getServerSnapshot);
8
7
  };
9
8
  export { useIsServerSide as t };
10
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"useIsServerSide.js","names":[],"sources":["../src/hooks/useIsServerSide.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\n/**\n * Sjekk om React kjører på server, eller ikke. (useEffect kjører ikke på server)\n *\n * @returns true dersom koden kjører på server\n */\nexport const useIsServerSide = (): boolean => {\n const [isServerSide, setIsServerSide] = useState(true);\n\n useEffect(() => {\n setIsServerSide(false);\n }, []);\n\n return isServerSide;\n};\n"],"mappings":";AAOA,MAAa,wBAAiC;CAC5C,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;AAEtD,iBAAgB;AACd,kBAAgB,MAAM;IACrB,EAAE,CAAC;AAEN,QAAO"}
1
+ {"version":3,"file":"useIsServerSide.js","names":[],"sources":["../src/hooks/useIsServerSide.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nconst emptySubscribe = (): (() => void) => (): void => {};\nconst getClientSnapshot = (): boolean => false;\nconst getServerSnapshot = (): boolean => true;\n\n/**\n * Sjekk om React kjører på server, eller ikke.\n *\n * @returns true dersom koden kjører på server\n */\nexport const useIsServerSide = (): boolean => {\n return useSyncExternalStore(emptySubscribe, getClientSnapshot, getServerSnapshot);\n};\n"],"mappings":";AAEA,IAAM,6BAAiD;AACvD,IAAM,0BAAmC;AACzC,IAAM,0BAAmC;AAOzC,MAAa,wBAAiC;AAC5C,QAAO,qBAAqB,gBAAgB,mBAAmB,kBAAkB"}
package/lib/useToggle.js CHANGED
@@ -2,13 +2,15 @@ import { t as usePrevious } from "./usePrevious.js";
2
2
  import { useEffect, useState } from "react";
3
3
  const useToggle = (initialValue, callback) => {
4
4
  const [value, setValue] = useState(initialValue);
5
+ const [prevInitialValue, setPrevInitialValue] = useState(initialValue);
5
6
  const previousValue = usePrevious(value);
7
+ if (initialValue !== prevInitialValue) {
8
+ setPrevInitialValue(initialValue);
9
+ setValue(initialValue);
10
+ }
6
11
  const toggleValue = () => {
7
12
  setValue(!value);
8
13
  };
9
- useEffect(() => {
10
- if (initialValue !== value) setValue(initialValue);
11
- }, [initialValue]);
12
14
  useEffect(() => {
13
15
  if (callback && value !== !!previousValue) callback(value);
14
16
  }, [value, callback]);
@@ -1 +1 @@
1
- {"version":3,"file":"useToggle.js","names":[],"sources":["../src/hooks/useToggle.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { usePrevious } from './usePrevious';\n\n/**\n * Hook for å toggle en boolean og kjøre en callback når verdien endres\n *\n * @param initialValue Initiell verdi for boolean\n * @param callback Funksjon som kalles når value endrer verdi (optional)\n * @returns Objekt med nåværende verdi og funksjon som kan kalles for å toggle verdien\n */\nexport const useToggle = (initialValue: boolean, callback?: (value: boolean) => void): { value: boolean; toggleValue: () => void } => {\n const [value, setValue] = useState(initialValue);\n const previousValue = usePrevious(value);\n\n const toggleValue = (): void => {\n setValue(!value);\n };\n\n useEffect(() => {\n if (initialValue !== value) {\n setValue(initialValue);\n }\n }, [initialValue]);\n\n useEffect(() => {\n if (callback && value !== !!previousValue) {\n callback(value);\n }\n }, [value, callback]);\n\n return { value, toggleValue };\n};\n"],"mappings":";;AAWA,MAAa,aAAa,cAAuB,aAAqF;CACpI,MAAM,CAAC,OAAO,YAAY,SAAS,aAAa;CAChD,MAAM,gBAAgB,YAAY,MAAM;CAExC,MAAM,oBAA0B;AAC9B,WAAS,CAAC,MAAM;;AAGlB,iBAAgB;AACd,MAAI,iBAAiB,MACnB,UAAS,aAAa;IAEvB,CAAC,aAAa,CAAC;AAElB,iBAAgB;AACd,MAAI,YAAY,UAAU,CAAC,CAAC,cAC1B,UAAS,MAAM;IAEhB,CAAC,OAAO,SAAS,CAAC;AAErB,QAAO;EAAE;EAAO;EAAa"}
1
+ {"version":3,"file":"useToggle.js","names":[],"sources":["../src/hooks/useToggle.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { usePrevious } from './usePrevious';\n\n/**\n * Hook for å toggle en boolean og kjøre en callback når verdien endres\n *\n * @param initialValue Initiell verdi for boolean\n * @param callback Funksjon som kalles når value endrer verdi (optional)\n * @returns Objekt med nåværende verdi og funksjon som kan kalles for å toggle verdien\n */\nexport const useToggle = (initialValue: boolean, callback?: (value: boolean) => void): { value: boolean; toggleValue: () => void } => {\n const [value, setValue] = useState(initialValue);\n const [prevInitialValue, setPrevInitialValue] = useState(initialValue);\n const previousValue = usePrevious(value);\n\n if (initialValue !== prevInitialValue) {\n setPrevInitialValue(initialValue);\n setValue(initialValue);\n }\n\n const toggleValue = (): void => {\n setValue(!value);\n };\n\n useEffect(() => {\n if (callback && value !== !!previousValue) {\n callback(value);\n }\n }, [value, callback]);\n\n return { value, toggleValue };\n};\n"],"mappings":";;AAWA,MAAa,aAAa,cAAuB,aAAqF;CACpI,MAAM,CAAC,OAAO,YAAY,SAAS,aAAa;CAChD,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,aAAa;CACtE,MAAM,gBAAgB,YAAY,MAAM;AAExC,KAAI,iBAAiB,kBAAkB;AACrC,sBAAoB,aAAa;AACjC,WAAS,aAAa;;CAGxB,MAAM,oBAA0B;AAC9B,WAAS,CAAC,MAAM;;AAGlB,iBAAgB;AACd,MAAI,YAAY,UAAU,CAAC,CAAC,cAC1B,UAAS,MAAM;IAEhB,CAAC,OAAO,SAAS,CAAC;AAErB,QAAO;EAAE;EAAO;EAAa"}
package/lib/utils2.js CHANGED
@@ -3,14 +3,14 @@ import { t as isComponent } from "./component.js";
3
3
  import { t as Spacer_default } from "./Spacer.js";
4
4
  import { t as FormFieldTag_default } from "./FormFieldTag.js";
5
5
  import { t as StatusDot_default } from "./StatusDot.js";
6
- import cn from "classnames";
6
+ import classNames from "classnames";
7
7
  import React from "react";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import styles from "./components/Label/styles.module.scss";
10
10
  const Sublabel = ({ children, className, id, onColor, sublabelTexts, testId }) => {
11
11
  const mapSublabels = (hideFromScreenReader) => {
12
12
  return sublabelTexts && sublabelTexts.map((sublabelText, index) => {
13
- const labelClasses = cn(styles.label, styles["sublabel"], {
13
+ const labelClasses = classNames(styles.label, styles["sublabel"], {
14
14
  [styles["sublabel--subdued"]]: sublabelText.type === "subdued",
15
15
  [styles["sublabel--on-dark"]]: onColor === FormOnColor.ondark
16
16
  });
@@ -40,13 +40,13 @@ const Sublabel = ({ children, className, id, onColor, sublabelTexts, testId }) =
40
40
  };
41
41
  var Label = ({ afterLabelChildren, children, className, formFieldTag, htmlFor, htmlMarkup = "label", labelClassName, labelTextClassName, labelId, labelTexts, onColor = FormOnColor.onwhite, statusDot, sublabel, sublabelWrapperClassName, testId, afterLabelChildrenClassName }) => {
42
42
  const hasChildren = children && typeof children !== "undefined";
43
- const labelWrapperClasses = cn(styles["label-wrapper"], { [styles["label-wrapper--no-bottom-margin"]]: hasChildren }, className);
44
- const mainLabelWrapperClasses = cn({ [styles["label-wrapper--after-label-children"]]: afterLabelChildren });
45
- const afterLabelChildrenClasses = cn(styles["after-label-children"], afterLabelChildrenClassName);
43
+ const labelWrapperClasses = classNames(styles["label-wrapper"], { [styles["label-wrapper--no-bottom-margin"]]: hasChildren }, className);
44
+ const mainLabelWrapperClasses = classNames({ [styles["label-wrapper--after-label-children"]]: afterLabelChildren });
45
+ const afterLabelChildrenClasses = classNames(styles["after-label-children"], afterLabelChildrenClassName);
46
46
  const mapLabels = () => {
47
47
  if (typeof labelTexts === "undefined") return null;
48
48
  return labelTexts.map((labelText, index) => {
49
- const labelClasses = cn(styles.label, {
49
+ const labelClasses = classNames(styles.label, {
50
50
  [styles["label--subdued"]]: labelText.type === "subdued",
51
51
  [styles["label--on-dark"]]: onColor === FormOnColor.ondark
52
52
  }, labelTextClassName);
@@ -115,7 +115,7 @@ const renderLabelAsParent = (props) => {
115
115
  htmlFor: props.inputId,
116
116
  onColor: props.onColor,
117
117
  children: props.children,
118
- labelClassName: cn(props.labelClassName, props.label.props.labelClassName),
118
+ labelClassName: classNames(props.labelClassName, props.label.props.labelClassName),
119
119
  labelTextClassName: props.labelTextClassName,
120
120
  htmlMarkup: props.markup || "label",
121
121
  sublabelWrapperClassName: props.sublabelWrapperClassName,
package/lib/utils2.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils2.js","names":["Sublabel: React.FC<SublabelProps>","Label: FunctionComponent<LabelProps>"],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/utils.tsx"],"sourcesContent":["import cn from 'classnames';\n\nimport type { LabelText } from './Label';\n\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 type { FunctionComponent } from 'react';\nimport React from 'react';\n\nimport cn from 'classnames';\n\nimport type { SublabelProps } from './SubLabel';\nimport type { FormFieldTagProps } from '../FormFieldTag';\nimport type { StatusDotProps } from '../StatusDot';\n\nimport { Sublabel } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot 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 /** Gives a custom classname to the afterLabelChildren wrapper. Used in checkbox and radiobutton */\n afterLabelChildrenClassName?: string;\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 afterLabelChildrenClassName,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(styles['label-wrapper'], { [styles['label-wrapper--no-bottom-margin']]: hasChildren }, className);\n const mainLabelWrapperClasses = cn({\n [styles['label-wrapper--after-label-children']]: afterLabelChildren,\n });\n const afterLabelChildrenClasses = cn(styles['after-label-children'], afterLabelChildrenClassName);\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 className={mainLabelWrapperClasses}>\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 {afterLabelChildren && <div className={afterLabelChildrenClasses}>{afterLabelChildren}</div>}\n </div>\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 );\n};\n\nexport default Label;\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport type { LabelProps, LabelTags } from './Label';\nimport type { FormOnColor } from '../../constants';\n\nimport Label from './Label';\nimport { isComponent } from '../../utils/component';\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\ninterface RenderLabelProps {\n label: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n markup?: LabelTags;\n}\n\nexport const renderLabel = (props: RenderLabelProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n htmlMarkup: props.markup || 'label',\n onColor: props.onColor,\n })\n : typeof props.label === 'string' && (\n <Label labelTexts={[{ text: props.label, type: 'normal' }]} htmlFor={props.inputId} onColor={props.onColor} />\n )}\n </>\n );\n};\n\ninterface RenderLabelAsParentProps {\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 afterLabelChildrenClassName?: string;\n}\n\nexport const renderLabelAsParent = (props: RenderLabelAsParentProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n onColor: props.onColor,\n children: props.children,\n labelClassName: cn(props.labelClassName, props.label.props.labelClassName),\n labelTextClassName: props.labelTextClassName,\n htmlMarkup: props.markup || 'label',\n sublabelWrapperClassName: props.sublabelWrapperClassName,\n sublabel: props.large ? undefined : props.label.props.sublabel,\n statusDot: props.large ? undefined : props.label.props.statusDot,\n afterLabelChildrenClassName: props.afterLabelChildrenClassName,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'subdued' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n htmlMarkup={props.markup || 'label'}\n labelClassName={props.labelClassName}\n labelTextClassName={props.labelTextClassName}\n sublabelWrapperClassName={props.sublabelWrapperClassName}\n afterLabelChildrenClassName={props.afterLabelChildrenClassName}\n >\n {props.children}\n </Label>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;AAwBA,MAAaA,YAAqC,EAAE,UAAU,WAAW,IAAI,SAAS,eAAe,aAAa;CAChH,MAAM,gBAAgB,yBAAoD;AACxE,SACE,iBACA,cAAc,KAAK,cAAc,UAAU;GACzC,MAAM,eAAe,GAAG,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;GAA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AAC,eAAA;EACC,YAAY,CAAC;GAAE,MAAM,MAAM;GAAO,MAAM;GAAW,CAAC;EACpD,SAAS,MAAM;EACf,SAAS,MAAM;EACf,YAAY,MAAM,UAAU;EAC5B,gBAAgB,MAAM;EACtB,oBAAoB,MAAM;EAC1B,0BAA0B,MAAM;EAChC,6BAA6B,MAAM;YAElC,MAAM;GACD,EAAA,CAEb"}
1
+ {"version":3,"file":"utils2.js","names":["Sublabel: React.FC<SublabelProps>","Label: FunctionComponent<LabelProps>"],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/utils.tsx"],"sourcesContent":["import cn from 'classnames';\n\nimport type { LabelText } from './Label';\n\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 type { FunctionComponent } from 'react';\nimport React from 'react';\n\nimport cn from 'classnames';\n\nimport type { SublabelProps } from './SubLabel';\nimport type { FormFieldTagProps } from '../FormFieldTag';\nimport type { StatusDotProps } from '../StatusDot';\n\nimport { Sublabel } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot 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 /** Gives a custom classname to the afterLabelChildren wrapper. Used in checkbox and radiobutton */\n afterLabelChildrenClassName?: string;\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 afterLabelChildrenClassName,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(styles['label-wrapper'], { [styles['label-wrapper--no-bottom-margin']]: hasChildren }, className);\n const mainLabelWrapperClasses = cn({\n [styles['label-wrapper--after-label-children']]: afterLabelChildren,\n });\n const afterLabelChildrenClasses = cn(styles['after-label-children'], afterLabelChildrenClassName);\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 className={mainLabelWrapperClasses}>\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 {afterLabelChildren && <div className={afterLabelChildrenClasses}>{afterLabelChildren}</div>}\n </div>\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 );\n};\n\nexport default Label;\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport type { LabelProps, LabelTags } from './Label';\nimport type { FormOnColor } from '../../constants';\n\nimport Label from './Label';\nimport { isComponent } from '../../utils/component';\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\ninterface RenderLabelProps {\n label: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n markup?: LabelTags;\n}\n\nexport const renderLabel = (props: RenderLabelProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n htmlMarkup: props.markup || 'label',\n onColor: props.onColor,\n })\n : typeof props.label === 'string' && (\n <Label labelTexts={[{ text: props.label, type: 'normal' }]} htmlFor={props.inputId} onColor={props.onColor} />\n )}\n </>\n );\n};\n\ninterface RenderLabelAsParentProps {\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 afterLabelChildrenClassName?: string;\n}\n\nexport const renderLabelAsParent = (props: RenderLabelAsParentProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n onColor: props.onColor,\n children: props.children,\n labelClassName: cn(props.labelClassName, props.label.props.labelClassName),\n labelTextClassName: props.labelTextClassName,\n htmlMarkup: props.markup || 'label',\n sublabelWrapperClassName: props.sublabelWrapperClassName,\n sublabel: props.large ? undefined : props.label.props.sublabel,\n statusDot: props.large ? undefined : props.label.props.statusDot,\n afterLabelChildrenClassName: props.afterLabelChildrenClassName,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'subdued' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n htmlMarkup={props.markup || 'label'}\n labelClassName={props.labelClassName}\n labelTextClassName={props.labelTextClassName}\n sublabelWrapperClassName={props.sublabelWrapperClassName}\n afterLabelChildrenClassName={props.afterLabelChildrenClassName}\n >\n {props.children}\n </Label>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;AAwBA,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;;ACAP,IAAMC,SAAwC,EAC5C,oBACA,UACA,WACA,cACA,SACA,aAAa,SACb,gBACA,oBACA,SACA,YACA,UAAU,YAAY,SACtB,WACA,UACA,0BACA,QACA,kCACI;CACJ,MAAM,cAAc,YAAY,OAAO,aAAa;CACpD,M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AA6B,MAAM;YAElC,MAAM;GACD,EAAA,CAEb"}
package/lib/utils3.js CHANGED
@@ -6,7 +6,7 @@ import { t as useIdWithFallback } from "./useIdWithFallback.js";
6
6
  import { t as getAriaDescribedBy } from "./accessibility.js";
7
7
  import { t as ErrorWrapper_default } from "./ErrorWrapper.js";
8
8
  import { r as renderLabelAsParent, t as getLabelText } from "./utils2.js";
9
- import cn from "classnames";
9
+ import classNames from "classnames";
10
10
  import { useState } from "react";
11
11
  import { jsx } from "react/jsx-runtime";
12
12
  import radioButtonStyles from "./components/RadioButton/styles.module.scss";
@@ -21,14 +21,14 @@ const RadioButton = (props) => {
21
21
  const { refObject, isFocused } = usePseudoClasses(isMutableRefObject(ref) ? ref : null);
22
22
  const mergedRefs = mergeRefs([ref, refObject]);
23
23
  const errorTextId = useIdWithFallback(errorTextIdProp);
24
- const radioButtonWrapperClasses = cn(radioButtonStyles["radio-button-wrapper"], {
24
+ const radioButtonWrapperClasses = classNames(radioButtonStyles["radio-button-wrapper"], {
25
25
  [radioButtonStyles["radio-button-wrapper__large"]]: isLarge,
26
26
  [radioButtonStyles["radio-button-wrapper__large--focused"]]: isLarge && isFocused,
27
27
  [radioButtonStyles["radio-button-wrapper__large--selected"]]: isLarge && checked && isFocused,
28
28
  [radioButtonStyles["radio-button-wrapper__large--invalid"]]: isLarge && onCherry && isFocused,
29
29
  [radioButtonStyles["radio-button-wrapper__large--on-blueberry"]]: isLarge && onBlueberry && isFocused
30
30
  });
31
- const radioButtonLabelClasses = cn(radioButtonStyles["radio-button-label"], {
31
+ const radioButtonLabelClasses = classNames(radioButtonStyles["radio-button-label"], {
32
32
  [radioButtonStyles["radio-button-label--disabled"]]: disabled,
33
33
  [radioButtonStyles["radio-button-label--on-dark"]]: onDark,
34
34
  [radioButtonStyles["radio-button-label--invalid"]]: invalid,
@@ -36,7 +36,7 @@ const RadioButton = (props) => {
36
36
  [radioButtonStyles["radio-button-label__large--focused"]]: isFocused && isLarge,
37
37
  [radioButtonStyles["radio-button-label__large--disabled"]]: isLarge && disabled
38
38
  }, labelClassNames);
39
- const radioButtonClasses = cn(radioButtonStyles["radio-button"], {
39
+ const radioButtonClasses = classNames(radioButtonStyles["radio-button"], {
40
40
  [radioButtonStyles["radio-button--on-dark"]]: onDark,
41
41
  [radioButtonStyles["radio-button--disabled"]]: disabled,
42
42
  [radioButtonStyles["radio-button--on-blueberry"]]: onBlueberry,
@@ -89,7 +89,7 @@ var RadioButton_default = RadioButton;
89
89
  const getRadioLabelClasses = (radioId, onColor, large, checkedRadioId) => {
90
90
  const onCherry = onColor === "oninvalid";
91
91
  const checked = radioId === checkedRadioId;
92
- return cn({
92
+ return classNames({
93
93
  [radioButtonStyles["radio-button-label__large--on-grey"]]: large && onColor === "ongrey" && !checked,
94
94
  [radioButtonStyles["radio-button-label__large--on-blueberry"]]: onColor === "onblueberry" && !checked && large,
95
95
  [radioButtonStyles["radio-button-label__large--selected"]]: large && checked && !onCherry,