@fremtind/jokul 5.0.0-next.0 → 5.0.0-next.2

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 (636) hide show
  1. package/README.md +30 -7
  2. package/bin/jokul.mjs +10 -0
  3. package/bin/run-jokul-cli.mjs +63 -0
  4. package/build/build-stats.html +1 -1
  5. package/build/cjs/components/beta/description-list/DescriptionList.cjs +2 -0
  6. package/build/cjs/components/beta/description-list/DescriptionList.cjs.map +1 -0
  7. package/build/cjs/components/beta/description-list/DescriptionListItem.cjs +2 -0
  8. package/build/cjs/components/beta/description-list/DescriptionListItem.cjs.map +1 -0
  9. package/build/cjs/{components-beta → components/beta}/description-list/index.d.cts +2 -2
  10. package/build/cjs/components/beta/nav-link/NavLink.cjs +2 -0
  11. package/build/cjs/components/beta/nav-link/NavLink.cjs.map +1 -0
  12. package/build/cjs/components/beta/nav-link/index.d.cts +1 -0
  13. package/build/cjs/{components-beta → components/beta}/nav-link/types.d.cts +1 -1
  14. package/build/cjs/components/beta/select/Select.cjs +2 -0
  15. package/build/cjs/components/beta/select/Select.cjs.map +1 -0
  16. package/build/cjs/components/beta/select/index.d.cts +2 -0
  17. package/build/cjs/{components-beta → components/beta}/select/types.d.cts +1 -1
  18. package/build/cjs/components/breadcrumb/types.d.cts +1 -1
  19. package/build/cjs/components/card/Card.cjs +1 -1
  20. package/build/cjs/components/card/Card.cjs.map +1 -1
  21. package/build/cjs/components/card/types.cjs +1 -1
  22. package/build/cjs/components/card/types.cjs.map +1 -1
  23. package/build/cjs/components/card/types.d.cts +2 -2
  24. package/build/cjs/components/checkbox/Checkbox.cjs +1 -1
  25. package/build/cjs/components/checkbox/Checkbox.cjs.map +1 -1
  26. package/build/cjs/components/checkbox/types.d.cts +1 -1
  27. package/build/cjs/components/cookie-consent/CookieConsent.cjs +1 -1
  28. package/build/cjs/components/cookie-consent/CookieConsent.cjs.map +1 -1
  29. package/build/cjs/components/cookie-consent/CookieConsent.d.cts +1 -1
  30. package/build/cjs/components/cookie-consent/types.d.cts +5 -1
  31. package/build/cjs/components/datepicker/DatePicker.cjs +1 -1
  32. package/build/cjs/components/datepicker/DatePicker.cjs.map +1 -1
  33. package/build/cjs/components/datepicker/types.d.cts +1 -1
  34. package/build/cjs/components/description-list/index.cjs +1 -1
  35. package/build/cjs/components/description-list/index.d.cts +3 -3
  36. package/build/cjs/components/description-list/types.d.cts +1 -1
  37. package/build/cjs/components/expander/ExpandablePanel.cjs +1 -1
  38. package/build/cjs/components/expander/ExpandablePanel.cjs.map +1 -1
  39. package/build/cjs/components/feedback/feedbackContext.cjs.map +1 -1
  40. package/build/cjs/components/feedback/feedbackContext.d.cts +1 -1
  41. package/build/cjs/components/feedback/followup/followupContext.cjs.map +1 -1
  42. package/build/cjs/components/feedback/followup/followupContext.d.cts +1 -1
  43. package/build/cjs/components/feedback/main-question/mainQuestionContext.cjs.map +1 -1
  44. package/build/cjs/components/feedback/main-question/mainQuestionContext.d.cts +1 -1
  45. package/build/cjs/components/feedback/questions/smileyUtils.cjs.map +1 -1
  46. package/build/cjs/components/file-input/internal/Dropzone.cjs.map +1 -1
  47. package/build/cjs/components/file-input/internal/Dropzone.d.cts +1 -1
  48. package/build/cjs/components/file-input/internal/fileInputContext.cjs.map +1 -1
  49. package/build/cjs/components/file-input/internal/fileInputContext.d.cts +1 -1
  50. package/build/cjs/components/icon/development/internal/IconsExampleGrid.d.cts +1 -1
  51. package/build/cjs/components/input-group/InputGroup.d.cts +2 -2
  52. package/build/cjs/components/input-group/types.d.cts +1 -1
  53. package/build/cjs/components/link/Link.cjs +1 -1
  54. package/build/cjs/components/link/Link.cjs.map +1 -1
  55. package/build/cjs/components/link/Link.d.cts +2 -2
  56. package/build/cjs/components/link/types.d.cts +1 -4
  57. package/build/cjs/components/link-list/LinkList.d.cts +1 -1
  58. package/build/cjs/components/list/ListItem.cjs.map +1 -1
  59. package/build/cjs/components/list/ListItem.d.cts +1 -1
  60. package/build/cjs/components/logo/types.d.cts +1 -1
  61. package/build/cjs/components/menu/types.d.cts +1 -1
  62. package/build/cjs/components/modal/Modal.cjs +1 -1
  63. package/build/cjs/components/modal/Modal.cjs.map +1 -1
  64. package/build/cjs/components/modal/Modal.d.cts +2 -9
  65. package/build/cjs/components/modal/index.d.cts +1 -1
  66. package/build/cjs/components/modal/types.d.cts +19 -1
  67. package/build/cjs/components/nav-link/index.cjs +1 -1
  68. package/build/cjs/components/nav-link/index.d.cts +2 -2
  69. package/build/cjs/components/popover/Popover.cjs +1 -1
  70. package/build/cjs/components/popover/Popover.cjs.map +1 -1
  71. package/build/cjs/components/radio-button/BaseRadioButton.cjs +1 -1
  72. package/build/cjs/components/radio-button/BaseRadioButton.cjs.map +1 -1
  73. package/build/cjs/components/radio-button/radioGroupContext.cjs.map +1 -1
  74. package/build/cjs/components/radio-button/radioGroupContext.d.cts +1 -1
  75. package/build/cjs/components/screen-reader-only/types.d.cts +1 -1
  76. package/build/cjs/components/select/index.cjs +1 -1
  77. package/build/cjs/components/select/index.d.cts +2 -2
  78. package/build/cjs/components/select/types.d.cts +1 -1
  79. package/build/cjs/components/system-message/types.d.cts +1 -1
  80. package/build/cjs/components/table/types.d.cts +1 -1
  81. package/build/cjs/components/table-of-contents/TableOfContents.d.cts +1 -1
  82. package/build/cjs/components/tabs/types.d.cts +1 -1
  83. package/build/cjs/components/toast/types.d.cts +1 -1
  84. package/build/cjs/components/toggle-switch/types.d.cts +1 -1
  85. package/build/cjs/components/tooltip/Tooltip.cjs.map +1 -1
  86. package/build/cjs/components/tooltip/Tooltip.d.cts +1 -1
  87. package/build/cjs/hooks/useAnimatedHeight/types.d.cts +1 -1
  88. package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeight.cjs +1 -1
  89. package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeight.cjs.map +1 -1
  90. package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeightBetween.cjs +1 -1
  91. package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeightBetween.cjs.map +1 -1
  92. package/build/cjs/hooks/useAnimatedHeight/useAutoAnimateHeight.cjs +1 -1
  93. package/build/cjs/hooks/useAnimatedHeight/useAutoAnimateHeight.cjs.map +1 -1
  94. package/build/cjs/hooks/useAnimatedHeight/useAutoAnimateHeight.d.cts +1 -1
  95. package/build/cjs/hooks/useAriaLiveRegion/useAriaLiveRegion.d.cts +1 -1
  96. package/build/cjs/hooks/useBrowserPreferences/useBrowserPreferences.cjs.map +1 -1
  97. package/build/cjs/hooks/useBrowserPreferences/useBrowserPreferences.d.cts +1 -1
  98. package/build/cjs/hooks/useScreen/useScreen.cjs +1 -1
  99. package/build/cjs/hooks/useScreen/useScreen.cjs.map +1 -1
  100. package/build/cjs/tailwind/plugins/jokulTypographyPlugin.cjs +1 -1
  101. package/build/cjs/tailwind/plugins/jokulTypographyPlugin.cjs.map +1 -1
  102. package/build/cjs/tailwind/tailwindPreset.cjs +1 -1
  103. package/build/cjs/tailwind/tailwindPreset.cjs.map +1 -1
  104. package/build/cjs/tokens.cjs +2 -0
  105. package/build/cjs/tokens.cjs.map +1 -0
  106. package/build/cjs/tokens.d.cts +235 -0
  107. package/build/cjs/utilities/getThemeAndSize.cjs +1 -1
  108. package/build/cjs/utilities/getThemeAndSize.cjs.map +1 -1
  109. package/build/cjs/utilities/getThemeAndSize.d.cts +1 -1
  110. package/build/cjs/utilities/index.d.cts +1 -0
  111. package/build/cjs/{core → utilities}/types.d.cts +1 -1
  112. package/build/es/components/beta/description-list/DescriptionList.js +2 -0
  113. package/build/es/components/beta/description-list/DescriptionList.js.map +1 -0
  114. package/build/es/components/beta/description-list/DescriptionListItem.js +2 -0
  115. package/build/es/components/beta/description-list/DescriptionListItem.js.map +1 -0
  116. package/build/es/{components-beta → components/beta}/description-list/index.d.ts +2 -2
  117. package/build/es/components/beta/nav-link/NavLink.js +2 -0
  118. package/build/es/components/beta/nav-link/NavLink.js.map +1 -0
  119. package/build/es/components/beta/nav-link/index.d.ts +1 -0
  120. package/build/es/{components-beta → components/beta}/nav-link/types.d.ts +1 -1
  121. package/build/es/components/beta/select/Select.js +2 -0
  122. package/build/es/components/beta/select/Select.js.map +1 -0
  123. package/build/es/components/beta/select/index.d.ts +2 -0
  124. package/build/es/{components-beta → components/beta}/select/types.d.ts +1 -1
  125. package/build/es/components/breadcrumb/types.d.ts +1 -1
  126. package/build/es/components/card/Card.js +1 -1
  127. package/build/es/components/card/Card.js.map +1 -1
  128. package/build/es/components/card/types.d.ts +2 -2
  129. package/build/es/components/card/types.js +1 -1
  130. package/build/es/components/card/types.js.map +1 -1
  131. package/build/es/components/checkbox/Checkbox.js +1 -1
  132. package/build/es/components/checkbox/Checkbox.js.map +1 -1
  133. package/build/es/components/checkbox/types.d.ts +1 -1
  134. package/build/es/components/cookie-consent/CookieConsent.d.ts +1 -1
  135. package/build/es/components/cookie-consent/CookieConsent.js +1 -1
  136. package/build/es/components/cookie-consent/CookieConsent.js.map +1 -1
  137. package/build/es/components/cookie-consent/types.d.ts +5 -1
  138. package/build/es/components/datepicker/DatePicker.js +1 -1
  139. package/build/es/components/datepicker/DatePicker.js.map +1 -1
  140. package/build/es/components/datepicker/types.d.ts +1 -1
  141. package/build/es/components/description-list/index.d.ts +3 -3
  142. package/build/es/components/description-list/index.js +1 -1
  143. package/build/es/components/description-list/types.d.ts +1 -1
  144. package/build/es/components/expander/ExpandablePanel.js +1 -1
  145. package/build/es/components/expander/ExpandablePanel.js.map +1 -1
  146. package/build/es/components/feedback/feedbackContext.d.ts +1 -1
  147. package/build/es/components/feedback/feedbackContext.js.map +1 -1
  148. package/build/es/components/feedback/followup/followupContext.d.ts +1 -1
  149. package/build/es/components/feedback/followup/followupContext.js.map +1 -1
  150. package/build/es/components/feedback/main-question/mainQuestionContext.d.ts +1 -1
  151. package/build/es/components/feedback/main-question/mainQuestionContext.js.map +1 -1
  152. package/build/es/components/feedback/questions/smileyUtils.js.map +1 -1
  153. package/build/es/components/file-input/internal/Dropzone.d.ts +1 -1
  154. package/build/es/components/file-input/internal/Dropzone.js.map +1 -1
  155. package/build/es/components/file-input/internal/fileInputContext.d.ts +1 -1
  156. package/build/es/components/file-input/internal/fileInputContext.js.map +1 -1
  157. package/build/es/components/icon/development/internal/IconsExampleGrid.d.ts +1 -1
  158. package/build/es/components/input-group/InputGroup.d.ts +2 -2
  159. package/build/es/components/input-group/types.d.ts +1 -1
  160. package/build/es/components/link/Link.d.ts +2 -2
  161. package/build/es/components/link/Link.js +1 -1
  162. package/build/es/components/link/Link.js.map +1 -1
  163. package/build/es/components/link/types.d.ts +1 -4
  164. package/build/es/components/link-list/LinkList.d.ts +1 -1
  165. package/build/es/components/list/ListItem.d.ts +1 -1
  166. package/build/es/components/list/ListItem.js.map +1 -1
  167. package/build/es/components/logo/types.d.ts +1 -1
  168. package/build/es/components/menu/types.d.ts +1 -1
  169. package/build/es/components/modal/Modal.d.ts +2 -9
  170. package/build/es/components/modal/Modal.js +1 -1
  171. package/build/es/components/modal/Modal.js.map +1 -1
  172. package/build/es/components/modal/index.d.ts +1 -1
  173. package/build/es/components/modal/types.d.ts +19 -1
  174. package/build/es/components/nav-link/index.d.ts +2 -2
  175. package/build/es/components/nav-link/index.js +1 -1
  176. package/build/es/components/popover/Popover.js +1 -1
  177. package/build/es/components/popover/Popover.js.map +1 -1
  178. package/build/es/components/radio-button/BaseRadioButton.js +1 -1
  179. package/build/es/components/radio-button/BaseRadioButton.js.map +1 -1
  180. package/build/es/components/radio-button/radioGroupContext.d.ts +1 -1
  181. package/build/es/components/radio-button/radioGroupContext.js.map +1 -1
  182. package/build/es/components/screen-reader-only/types.d.ts +1 -1
  183. package/build/es/components/select/index.d.ts +2 -2
  184. package/build/es/components/select/index.js +1 -1
  185. package/build/es/components/select/types.d.ts +1 -1
  186. package/build/es/components/system-message/types.d.ts +1 -1
  187. package/build/es/components/table/types.d.ts +1 -1
  188. package/build/es/components/table-of-contents/TableOfContents.d.ts +1 -1
  189. package/build/es/components/tabs/types.d.ts +1 -1
  190. package/build/es/components/toast/types.d.ts +1 -1
  191. package/build/es/components/toggle-switch/types.d.ts +1 -1
  192. package/build/es/components/tooltip/Tooltip.d.ts +1 -1
  193. package/build/es/components/tooltip/Tooltip.js.map +1 -1
  194. package/build/es/hooks/useAnimatedHeight/types.d.ts +1 -1
  195. package/build/es/hooks/useAnimatedHeight/useAnimatedHeight.js +1 -1
  196. package/build/es/hooks/useAnimatedHeight/useAnimatedHeight.js.map +1 -1
  197. package/build/es/hooks/useAnimatedHeight/useAnimatedHeightBetween.js +1 -1
  198. package/build/es/hooks/useAnimatedHeight/useAnimatedHeightBetween.js.map +1 -1
  199. package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.d.ts +1 -1
  200. package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.js +1 -1
  201. package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.js.map +1 -1
  202. package/build/es/hooks/useAriaLiveRegion/useAriaLiveRegion.d.ts +1 -1
  203. package/build/es/hooks/useBrowserPreferences/useBrowserPreferences.d.ts +1 -1
  204. package/build/es/hooks/useBrowserPreferences/useBrowserPreferences.js.map +1 -1
  205. package/build/es/hooks/useScreen/useScreen.js +1 -1
  206. package/build/es/hooks/useScreen/useScreen.js.map +1 -1
  207. package/build/es/tailwind/plugins/jokulTypographyPlugin.js +1 -1
  208. package/build/es/tailwind/plugins/jokulTypographyPlugin.js.map +1 -1
  209. package/build/es/tailwind/tailwindPreset.js +1 -1
  210. package/build/es/tailwind/tailwindPreset.js.map +1 -1
  211. package/build/es/tokens.d.ts +235 -0
  212. package/build/es/tokens.js +2 -0
  213. package/build/es/tokens.js.map +1 -0
  214. package/build/es/utilities/getThemeAndSize.d.ts +1 -1
  215. package/build/es/utilities/getThemeAndSize.js +1 -1
  216. package/build/es/utilities/getThemeAndSize.js.map +1 -1
  217. package/build/es/utilities/index.d.ts +1 -0
  218. package/build/es/{core → utilities}/types.d.ts +1 -1
  219. package/codemods/__tests__/import-paths.test.mjs +84 -0
  220. package/codemods/import-paths.mjs +393 -0
  221. package/package.json +12 -585
  222. package/styles/base.css +1822 -0
  223. package/styles/base.min.css +2 -0
  224. package/styles/components/autosuggest/autosuggest.css +6 -12
  225. package/styles/components/autosuggest/autosuggest.min.css +1 -1
  226. package/styles/components/autosuggest/autosuggest.scss +3 -3
  227. package/styles/{components-beta → components/beta}/description-list/description-list.css +1 -1
  228. package/styles/{components-beta → components/beta}/description-list/description-list.min.css +1 -1
  229. package/styles/{components-beta → components/beta}/description-list/description-list.scss +2 -2
  230. package/styles/{components-beta → components/beta}/nav-link/navlink.css +11 -14
  231. package/styles/components/beta/nav-link/navlink.min.css +1 -0
  232. package/styles/{components-beta → components/beta}/nav-link/navlink.scss +4 -4
  233. package/styles/components/beta/select/_index.scss +3 -0
  234. package/styles/{components-beta → components/beta}/select/select.css +13 -16
  235. package/styles/components/beta/select/select.min.css +1 -0
  236. package/styles/{components-beta → components/beta}/select/select.scss +9 -9
  237. package/styles/components/breadcrumb/breadcrumb.css +1 -1
  238. package/styles/components/breadcrumb/breadcrumb.min.css +1 -1
  239. package/styles/components/breadcrumb/breadcrumb.scss +1 -1
  240. package/styles/components/button/button.css +15 -14
  241. package/styles/components/button/button.min.css +1 -1
  242. package/styles/components/button/button.scss +14 -14
  243. package/styles/components/card/card.css +8 -11
  244. package/styles/components/card/card.min.css +1 -1
  245. package/styles/components/card/card.scss +7 -11
  246. package/styles/components/checkbox/checkbox.css +55 -42
  247. package/styles/components/checkbox/checkbox.min.css +1 -1
  248. package/styles/components/checkbox/checkbox.scss +43 -36
  249. package/styles/components/checkbox-panel/checkbox-panel.css +84 -72
  250. package/styles/components/checkbox-panel/checkbox-panel.min.css +1 -1
  251. package/styles/components/checkbox-panel/checkbox-panel.scss +5 -1
  252. package/styles/components/checkbox-panel/development/styles.scss +1 -1
  253. package/styles/components/chip/chip.css +6 -9
  254. package/styles/components/chip/chip.min.css +1 -1
  255. package/styles/components/chip/chip.scss +3 -3
  256. package/styles/components/combobox/combobox.css +30 -39
  257. package/styles/components/combobox/combobox.min.css +1 -1
  258. package/styles/components/combobox/combobox.scss +10 -8
  259. package/styles/components/cookie-consent/cookie-consent.css +1 -5
  260. package/styles/components/cookie-consent/cookie-consent.min.css +1 -1
  261. package/styles/components/cookie-consent/cookie-consent.scss +1 -1
  262. package/styles/components/countdown/countdown.css +4 -4
  263. package/styles/components/countdown/countdown.min.css +1 -1
  264. package/styles/components/datepicker/_calendar-date-button.scss +9 -9
  265. package/styles/components/datepicker/_calendar-navigation-dropdown.scss +3 -3
  266. package/styles/components/datepicker/_calendar-navigation.scss +1 -1
  267. package/styles/components/datepicker/_calendar-table.scss +1 -1
  268. package/styles/components/datepicker/_calendar.scss +7 -8
  269. package/styles/components/datepicker/datepicker.css +27 -31
  270. package/styles/components/datepicker/datepicker.min.css +1 -1
  271. package/styles/components/datepicker/datepicker.scss +1 -1
  272. package/styles/components/description-list/description-list.css +2 -2
  273. package/styles/components/description-list/description-list.min.css +1 -1
  274. package/styles/components/description-list/description-list.scss +3 -3
  275. package/styles/components/expander/expandable.css +20 -20
  276. package/styles/components/expander/expandable.min.css +1 -1
  277. package/styles/components/expander/expandable.scss +16 -20
  278. package/styles/components/feedback/feedback.css +14 -20
  279. package/styles/components/feedback/feedback.min.css +1 -1
  280. package/styles/components/feedback/feedback.scss +5 -10
  281. package/styles/components/file/file.css +10 -18
  282. package/styles/components/file/file.min.css +1 -1
  283. package/styles/components/file/file.scss +7 -7
  284. package/styles/components/file-input/file-input.css +52 -70
  285. package/styles/components/file-input/file-input.min.css +1 -1
  286. package/styles/components/file-input/file-input.scss +4 -4
  287. package/styles/components/help/help.css +2 -2
  288. package/styles/components/help/help.min.css +1 -1
  289. package/styles/components/help/help.scss +3 -3
  290. package/styles/components/icon/_base-styles.scss +3 -5
  291. package/styles/components/icon/icon.css +13 -34
  292. package/styles/components/icon/icon.min.css +1 -1
  293. package/styles/components/icon/icon.scss +5 -19
  294. package/styles/components/icon-button/icon-button.css +3 -3
  295. package/styles/components/icon-button/icon-button.min.css +1 -1
  296. package/styles/components/icon-button/icon-button.scss +1 -1
  297. package/styles/components/image/image.css +2 -2
  298. package/styles/components/image/image.min.css +1 -1
  299. package/styles/components/image/image.scss +1 -1
  300. package/styles/components/input-group/_field-group.scss +1 -1
  301. package/styles/components/input-group/_labels.scss +1 -1
  302. package/styles/components/input-group/input-group.css +12 -27
  303. package/styles/components/input-group/input-group.min.css +1 -1
  304. package/styles/components/input-group/input-group.scss +1 -1
  305. package/styles/components/input-panel/input-panel.css +26 -30
  306. package/styles/components/input-panel/input-panel.min.css +1 -1
  307. package/styles/components/input-panel/input-panel.scss +22 -20
  308. package/styles/components/link/link.css +7 -8
  309. package/styles/components/link/link.min.css +1 -1
  310. package/styles/components/link/link.scss +1 -2
  311. package/styles/components/link-list/link-list.css +17 -23
  312. package/styles/components/link-list/link-list.min.css +1 -1
  313. package/styles/components/link-list/link-list.scss +7 -3
  314. package/styles/components/list/list.css +6 -27
  315. package/styles/components/list/list.min.css +1 -1
  316. package/styles/components/list/list.scss +11 -15
  317. package/styles/components/loader/loader.css +6 -6
  318. package/styles/components/loader/loader.min.css +1 -1
  319. package/styles/components/loader/loader.scss +1 -1
  320. package/styles/components/loader/skeleton-loader.css +4 -4
  321. package/styles/components/loader/skeleton-loader.min.css +1 -1
  322. package/styles/components/loader/skeleton-loader.scss +2 -2
  323. package/styles/components/logo/logo.css +4 -4
  324. package/styles/components/logo/logo.min.css +1 -1
  325. package/styles/components/logo/logo.scss +1 -1
  326. package/styles/components/menu/_menu-divider.scss +2 -2
  327. package/styles/components/menu/_menu-item.scss +1 -1
  328. package/styles/components/menu/menu.css +8 -23
  329. package/styles/components/menu/menu.min.css +1 -1
  330. package/styles/components/menu/menu.scss +8 -12
  331. package/styles/components/message/message.css +25 -27
  332. package/styles/components/message/message.min.css +1 -1
  333. package/styles/components/message/message.scss +17 -7
  334. package/styles/components/modal/_layout.scss +22 -0
  335. package/styles/components/modal/_modal-base.scss +32 -0
  336. package/styles/components/modal/_motion.scss +45 -0
  337. package/styles/components/modal/_overlay.scss +20 -0
  338. package/styles/components/modal/_parts.scss +33 -0
  339. package/styles/components/modal/_placement.scss +59 -0
  340. package/styles/components/modal/modal.css +120 -42
  341. package/styles/components/modal/modal.min.css +1 -1
  342. package/styles/components/modal/modal.scss +6 -95
  343. package/styles/components/nav-link/nav-link.css +5 -5
  344. package/styles/components/nav-link/nav-link.min.css +1 -1
  345. package/styles/components/nav-link/nav-link.scss +2 -2
  346. package/styles/components/pagination/development/styles.scss +1 -1
  347. package/styles/components/pagination/pagination.css +2 -2
  348. package/styles/components/pagination/pagination.min.css +1 -1
  349. package/styles/components/pagination/pagination.scss +1 -1
  350. package/styles/components/popover/popover.css +17 -18
  351. package/styles/components/popover/popover.min.css +1 -1
  352. package/styles/components/popover/popover.scss +21 -11
  353. package/styles/components/progress-bar/progress-bar.css +29 -5
  354. package/styles/components/progress-bar/progress-bar.min.css +1 -1
  355. package/styles/components/progress-bar/progress-bar.scss +6 -1
  356. package/styles/components/radio-button/radio-button.css +53 -36
  357. package/styles/components/radio-button/radio-button.min.css +1 -1
  358. package/styles/components/radio-button/radio-button.scss +40 -31
  359. package/styles/components/radio-panel/development/styles.scss +1 -1
  360. package/styles/components/radio-panel/radio-panel.css +29 -30
  361. package/styles/components/radio-panel/radio-panel.min.css +1 -1
  362. package/styles/components/radio-panel/radio-panel.scss +5 -1
  363. package/styles/components/search/search-with-submit-button.css +3 -3
  364. package/styles/components/search/search-with-submit-button.min.css +1 -1
  365. package/styles/components/search/search-with-submit-button.scss +2 -2
  366. package/styles/components/search/search.css +10 -16
  367. package/styles/components/search/search.min.css +1 -1
  368. package/styles/components/search/search.scss +2 -2
  369. package/styles/components/segmented-control/segmented-control.css +91 -114
  370. package/styles/components/segmented-control/segmented-control.min.css +1 -1
  371. package/styles/components/segmented-control/segmented-control.scss +5 -5
  372. package/styles/components/select/select.css +27 -36
  373. package/styles/components/select/select.min.css +1 -1
  374. package/styles/components/select/select.scss +13 -14
  375. package/styles/components/summary-table/development/summary-table-example.scss +1 -1
  376. package/styles/components/summary-table/summary-table.css +5 -8
  377. package/styles/components/summary-table/summary-table.min.css +1 -1
  378. package/styles/components/summary-table/summary-table.scss +5 -5
  379. package/styles/components/system-message/system-message.css +22 -15
  380. package/styles/components/system-message/system-message.min.css +1 -1
  381. package/styles/components/system-message/system-message.scss +18 -9
  382. package/styles/components/table/_table-caption.scss +1 -1
  383. package/styles/components/table/_table-cell.scss +1 -1
  384. package/styles/components/table/_table-head.scss +3 -13
  385. package/styles/components/table/_table-header.scss +4 -4
  386. package/styles/components/table/_table-pagination.scss +1 -1
  387. package/styles/components/table/_table-row.scss +3 -3
  388. package/styles/components/table/table.css +20 -48
  389. package/styles/components/table/table.min.css +1 -1
  390. package/styles/components/table/table.scss +1 -1
  391. package/styles/components/table-of-contents/table-of-contents.css +4 -8
  392. package/styles/components/table-of-contents/table-of-contents.min.css +1 -1
  393. package/styles/components/table-of-contents/table-of-contents.scss +2 -2
  394. package/styles/components/tabs/tabs.css +9 -12
  395. package/styles/components/tabs/tabs.min.css +1 -1
  396. package/styles/components/tabs/tabs.scss +3 -3
  397. package/styles/components/tag/tag.css +18 -11
  398. package/styles/components/tag/tag.min.css +1 -1
  399. package/styles/components/tag/tag.scss +18 -8
  400. package/styles/components/text-area/text-area.css +17 -26
  401. package/styles/components/text-area/text-area.min.css +1 -1
  402. package/styles/components/text-area/text-area.scss +1 -1
  403. package/styles/components/text-input/text-input.css +12 -18
  404. package/styles/components/text-input/text-input.min.css +1 -1
  405. package/styles/components/text-input/text-input.scss +2 -3
  406. package/styles/components/toast/toast.css +21 -20
  407. package/styles/components/toast/toast.min.css +1 -1
  408. package/styles/components/toast/toast.scss +16 -14
  409. package/styles/components/toggle-switch/_toggle-slider.scss +5 -5
  410. package/styles/components/toggle-switch/toggle-switch.css +21 -29
  411. package/styles/components/toggle-switch/toggle-switch.min.css +2 -2
  412. package/styles/components/toggle-switch/toggle-switch.scss +10 -17
  413. package/styles/components/tooltip/tooltip.css +7 -11
  414. package/styles/components/tooltip/tooltip.min.css +1 -1
  415. package/styles/components/tooltip/tooltip.scss +4 -4
  416. package/styles/{styles.css → components.css} +801 -872
  417. package/styles/components.min.css +3 -0
  418. package/styles/{styles.scss → components.scss} +2 -2
  419. package/styles/{core/global → global}/_base-class.scss +6 -4
  420. package/styles/{core/global → global}/_top-layer.scss +1 -1
  421. package/styles/hooks/stories/styles.scss +7 -9
  422. package/styles/{core/jkl/_theme.scss → jkl/_forced-colors.scss} +0 -49
  423. package/styles/{core/jkl → jkl}/_index.scss +3 -6
  424. package/styles/{core/jkl → jkl}/_motion.scss +8 -26
  425. package/styles/{core/jkl → jkl}/_ornaments.scss +1 -1
  426. package/styles/{core/jkl → jkl}/_reset.scss +2 -2
  427. package/styles/{core/jkl → jkl}/_spacing.scss +1 -6
  428. package/styles/jkl/_tokens.scss +386 -0
  429. package/styles/{core/jkl → jkl}/_typography.scss +5 -98
  430. package/styles/shared/input/shared-input-styles.scss +7 -7
  431. package/styles/shared/track/track.scss +3 -3
  432. package/styles/tailwind.css +213 -0
  433. package/styles/theme/_color-scheme.scss +153 -0
  434. package/styles/{core/theme → theme}/_dynamic-spacing.scss +9 -5
  435. package/styles/theme/_fonts.scss +147 -0
  436. package/styles/theme/_index.scss +8 -0
  437. package/styles/theme/_size.scss +53 -0
  438. package/styles/theme/_tokens.scss +94 -0
  439. package/styles/theme/brands/dnb/_color-scheme.scss +119 -0
  440. package/styles/theme/brands/eika/_color-scheme.scss +119 -0
  441. package/styles/theme/brands/sparebank1/_color-scheme.scss +119 -0
  442. package/styles/{core/utility → utility}/_headings.scss +1 -1
  443. package/styles/utility/_paragraphs.scss +24 -0
  444. package/styles/{core/utility → utility}/_screen-reader.scss +1 -1
  445. package/styles/{core/utility → utility}/_spacing.scss +4 -3
  446. package/build/cjs/components-beta/description-list/DescriptionList.cjs +0 -2
  447. package/build/cjs/components-beta/description-list/DescriptionList.cjs.map +0 -1
  448. package/build/cjs/components-beta/description-list/DescriptionListItem.cjs +0 -2
  449. package/build/cjs/components-beta/description-list/DescriptionListItem.cjs.map +0 -1
  450. package/build/cjs/components-beta/nav-link/NavLink.cjs +0 -2
  451. package/build/cjs/components-beta/nav-link/NavLink.cjs.map +0 -1
  452. package/build/cjs/components-beta/nav-link/index.d.cts +0 -1
  453. package/build/cjs/components-beta/select/Select.cjs +0 -2
  454. package/build/cjs/components-beta/select/Select.cjs.map +0 -1
  455. package/build/cjs/components-beta/select/index.d.cts +0 -2
  456. package/build/cjs/core/index.cjs +0 -2
  457. package/build/cjs/core/index.cjs.map +0 -1
  458. package/build/cjs/core/index.d.cts +0 -2
  459. package/build/cjs/core/tokens/build-tailwind-4.cjs +0 -2
  460. package/build/cjs/core/tokens/build-tailwind-4.cjs.map +0 -1
  461. package/build/cjs/core/tokens/build-tailwind-4.d.cts +0 -1
  462. package/build/cjs/core/tokens/style-dictionary/build.cjs +0 -2
  463. package/build/cjs/core/tokens/style-dictionary/build.cjs.map +0 -1
  464. package/build/cjs/core/tokens/style-dictionary/build.d.cts +0 -0
  465. package/build/cjs/core/tokens/style-dictionary/config.cjs +0 -2
  466. package/build/cjs/core/tokens/style-dictionary/config.cjs.map +0 -1
  467. package/build/cjs/core/tokens/style-dictionary/config.d.cts +0 -4
  468. package/build/cjs/core/tokens/style-dictionary/filters/index.cjs +0 -2
  469. package/build/cjs/core/tokens/style-dictionary/filters/index.cjs.map +0 -1
  470. package/build/cjs/core/tokens/style-dictionary/filters/index.d.cts +0 -3
  471. package/build/cjs/core/tokens/style-dictionary/formats/css-dynamic-color-variables.cjs +0 -2
  472. package/build/cjs/core/tokens/style-dictionary/formats/css-dynamic-color-variables.cjs.map +0 -1
  473. package/build/cjs/core/tokens/style-dictionary/formats/css-dynamic-color-variables.d.cts +0 -3
  474. package/build/cjs/core/tokens/style-dictionary/formats/css-theme-variables.cjs +0 -2
  475. package/build/cjs/core/tokens/style-dictionary/formats/css-theme-variables.cjs.map +0 -1
  476. package/build/cjs/core/tokens/style-dictionary/formats/css-theme-variables.d.cts +0 -3
  477. package/build/cjs/core/tokens/style-dictionary/formats/index.cjs +0 -2
  478. package/build/cjs/core/tokens/style-dictionary/formats/index.cjs.map +0 -1
  479. package/build/cjs/core/tokens/style-dictionary/formats/index.d.cts +0 -6
  480. package/build/cjs/core/tokens/style-dictionary/formats/javascript-esm.cjs +0 -2
  481. package/build/cjs/core/tokens/style-dictionary/formats/javascript-esm.cjs.map +0 -1
  482. package/build/cjs/core/tokens/style-dictionary/formats/javascript-esm.d.cts +0 -3
  483. package/build/cjs/core/tokens/style-dictionary/formats/scss-theme-variables.cjs +0 -2
  484. package/build/cjs/core/tokens/style-dictionary/formats/scss-theme-variables.cjs.map +0 -1
  485. package/build/cjs/core/tokens/style-dictionary/formats/scss-theme-variables.d.cts +0 -3
  486. package/build/cjs/core/tokens/style-dictionary/formats/tailwindcss-colors.cjs +0 -2
  487. package/build/cjs/core/tokens/style-dictionary/formats/tailwindcss-colors.cjs.map +0 -1
  488. package/build/cjs/core/tokens/style-dictionary/formats/tailwindcss-colors.d.cts +0 -3
  489. package/build/cjs/core/tokens/style-dictionary/register.cjs +0 -2
  490. package/build/cjs/core/tokens/style-dictionary/register.cjs.map +0 -1
  491. package/build/cjs/core/tokens/style-dictionary/register.d.cts +0 -1
  492. package/build/cjs/core/tokens/style-dictionary/transforms/index.cjs +0 -2
  493. package/build/cjs/core/tokens/style-dictionary/transforms/index.cjs.map +0 -1
  494. package/build/cjs/core/tokens/style-dictionary/transforms/index.d.cts +0 -2
  495. package/build/cjs/core/tokens/style-dictionary/transforms/strip-light-dark.cjs +0 -2
  496. package/build/cjs/core/tokens/style-dictionary/transforms/strip-light-dark.cjs.map +0 -1
  497. package/build/cjs/core/tokens/style-dictionary/transforms/strip-light-dark.d.cts +0 -3
  498. package/build/cjs/index.cjs +0 -2
  499. package/build/cjs/index.cjs.map +0 -1
  500. package/build/cjs/index.d.cts +0 -3
  501. package/build/es/components-beta/description-list/DescriptionList.js +0 -2
  502. package/build/es/components-beta/description-list/DescriptionList.js.map +0 -1
  503. package/build/es/components-beta/description-list/DescriptionListItem.js +0 -2
  504. package/build/es/components-beta/description-list/DescriptionListItem.js.map +0 -1
  505. package/build/es/components-beta/nav-link/NavLink.js +0 -2
  506. package/build/es/components-beta/nav-link/NavLink.js.map +0 -1
  507. package/build/es/components-beta/nav-link/index.d.ts +0 -1
  508. package/build/es/components-beta/select/Select.js +0 -2
  509. package/build/es/components-beta/select/Select.js.map +0 -1
  510. package/build/es/components-beta/select/index.d.ts +0 -2
  511. package/build/es/core/index.d.ts +0 -2
  512. package/build/es/core/index.js +0 -2
  513. package/build/es/core/index.js.map +0 -1
  514. package/build/es/core/tokens/build-tailwind-4.d.ts +0 -1
  515. package/build/es/core/tokens/build-tailwind-4.js +0 -2
  516. package/build/es/core/tokens/build-tailwind-4.js.map +0 -1
  517. package/build/es/core/tokens/style-dictionary/build.d.ts +0 -0
  518. package/build/es/core/tokens/style-dictionary/build.js +0 -2
  519. package/build/es/core/tokens/style-dictionary/build.js.map +0 -1
  520. package/build/es/core/tokens/style-dictionary/config.d.ts +0 -4
  521. package/build/es/core/tokens/style-dictionary/config.js +0 -2
  522. package/build/es/core/tokens/style-dictionary/config.js.map +0 -1
  523. package/build/es/core/tokens/style-dictionary/filters/index.d.ts +0 -3
  524. package/build/es/core/tokens/style-dictionary/filters/index.js +0 -2
  525. package/build/es/core/tokens/style-dictionary/filters/index.js.map +0 -1
  526. package/build/es/core/tokens/style-dictionary/formats/css-dynamic-color-variables.d.ts +0 -3
  527. package/build/es/core/tokens/style-dictionary/formats/css-dynamic-color-variables.js +0 -2
  528. package/build/es/core/tokens/style-dictionary/formats/css-dynamic-color-variables.js.map +0 -1
  529. package/build/es/core/tokens/style-dictionary/formats/css-theme-variables.d.ts +0 -3
  530. package/build/es/core/tokens/style-dictionary/formats/css-theme-variables.js +0 -2
  531. package/build/es/core/tokens/style-dictionary/formats/css-theme-variables.js.map +0 -1
  532. package/build/es/core/tokens/style-dictionary/formats/index.d.ts +0 -6
  533. package/build/es/core/tokens/style-dictionary/formats/index.js +0 -2
  534. package/build/es/core/tokens/style-dictionary/formats/index.js.map +0 -1
  535. package/build/es/core/tokens/style-dictionary/formats/javascript-esm.d.ts +0 -3
  536. package/build/es/core/tokens/style-dictionary/formats/javascript-esm.js +0 -2
  537. package/build/es/core/tokens/style-dictionary/formats/javascript-esm.js.map +0 -1
  538. package/build/es/core/tokens/style-dictionary/formats/scss-theme-variables.d.ts +0 -3
  539. package/build/es/core/tokens/style-dictionary/formats/scss-theme-variables.js +0 -2
  540. package/build/es/core/tokens/style-dictionary/formats/scss-theme-variables.js.map +0 -1
  541. package/build/es/core/tokens/style-dictionary/formats/tailwindcss-colors.d.ts +0 -3
  542. package/build/es/core/tokens/style-dictionary/formats/tailwindcss-colors.js +0 -2
  543. package/build/es/core/tokens/style-dictionary/formats/tailwindcss-colors.js.map +0 -1
  544. package/build/es/core/tokens/style-dictionary/register.d.ts +0 -1
  545. package/build/es/core/tokens/style-dictionary/register.js +0 -2
  546. package/build/es/core/tokens/style-dictionary/register.js.map +0 -1
  547. package/build/es/core/tokens/style-dictionary/transforms/index.d.ts +0 -2
  548. package/build/es/core/tokens/style-dictionary/transforms/index.js +0 -2
  549. package/build/es/core/tokens/style-dictionary/transforms/index.js.map +0 -1
  550. package/build/es/core/tokens/style-dictionary/transforms/strip-light-dark.d.ts +0 -3
  551. package/build/es/core/tokens/style-dictionary/transforms/strip-light-dark.js +0 -2
  552. package/build/es/core/tokens/style-dictionary/transforms/strip-light-dark.js.map +0 -1
  553. package/build/es/index.d.ts +0 -3
  554. package/build/es/index.js +0 -2
  555. package/build/es/index.js.map +0 -1
  556. package/build/index-Ck94bTpt.cjs +0 -2
  557. package/build/index-Ck94bTpt.cjs.map +0 -1
  558. package/build/index-DOHQmuhD.js +0 -2
  559. package/build/index-DOHQmuhD.js.map +0 -1
  560. package/src/fonts/styles/_index.scss +0 -1
  561. package/src/fonts/styles/webfonts.scss +0 -145
  562. package/src/tailwind/v4/jokul-tailwind.css +0 -266
  563. package/styles/components-beta/nav-link/navlink.min.css +0 -1
  564. package/styles/components-beta/select/_index.scss +0 -3
  565. package/styles/components-beta/select/select.min.css +0 -1
  566. package/styles/core/core.css +0 -1731
  567. package/styles/core/core.min.css +0 -2
  568. package/styles/core/jkl/_colors.scss +0 -26
  569. package/styles/core/jkl/_helpers.scss +0 -26
  570. package/styles/core/jkl/legacy/_index.scss +0 -2
  571. package/styles/core/theme/_index.scss +0 -10
  572. package/styles/core/theme/_old-vars.scss +0 -21
  573. package/styles/core/theme/_shape.scss +0 -12
  574. package/styles/core/theme/_spacing.scss +0 -64
  575. package/styles/core/theme/_typography.scss +0 -38
  576. package/styles/core/utility/_paragraphs.scss +0 -29
  577. package/styles/fonts/_index.scss +0 -1
  578. package/styles/fonts/webfonts.css +0 -115
  579. package/styles/fonts/webfonts.min.css +0 -1
  580. package/styles/fonts/webfonts.scss +0 -145
  581. package/styles/styles.min.css +0 -3
  582. /package/build/cjs/{components-beta → components/beta}/description-list/DescriptionList.d.cts +0 -0
  583. /package/build/cjs/{components-beta → components/beta}/description-list/DescriptionListItem.d.cts +0 -0
  584. /package/build/cjs/{components-beta → components/beta}/description-list/index.cjs +0 -0
  585. /package/build/cjs/{components-beta → components/beta}/description-list/index.cjs.map +0 -0
  586. /package/build/cjs/{components-beta → components/beta}/description-list/types.cjs +0 -0
  587. /package/build/cjs/{components-beta → components/beta}/description-list/types.cjs.map +0 -0
  588. /package/build/cjs/{components-beta → components/beta}/description-list/types.d.cts +0 -0
  589. /package/build/cjs/{components-beta → components/beta}/nav-link/NavLink.d.cts +0 -0
  590. /package/build/cjs/{components-beta → components/beta}/nav-link/index.cjs +0 -0
  591. /package/build/cjs/{components-beta → components/beta}/nav-link/index.cjs.map +0 -0
  592. /package/build/cjs/{components-beta → components/beta}/nav-link/types.cjs +0 -0
  593. /package/build/cjs/{components-beta → components/beta}/nav-link/types.cjs.map +0 -0
  594. /package/build/cjs/{components-beta → components/beta}/select/Select.d.cts +0 -0
  595. /package/build/cjs/{components-beta → components/beta}/select/index.cjs +0 -0
  596. /package/build/cjs/{components-beta → components/beta}/select/index.cjs.map +0 -0
  597. /package/build/cjs/{components-beta → components/beta}/select/types.cjs +0 -0
  598. /package/build/cjs/{components-beta → components/beta}/select/types.cjs.map +0 -0
  599. /package/build/cjs/{core → utilities}/types.cjs +0 -0
  600. /package/build/cjs/{core → utilities}/types.cjs.map +0 -0
  601. /package/build/es/{components-beta → components/beta}/description-list/DescriptionList.d.ts +0 -0
  602. /package/build/es/{components-beta → components/beta}/description-list/DescriptionListItem.d.ts +0 -0
  603. /package/build/es/{components-beta → components/beta}/description-list/index.js +0 -0
  604. /package/build/es/{components-beta → components/beta}/description-list/index.js.map +0 -0
  605. /package/build/es/{components-beta → components/beta}/description-list/types.d.ts +0 -0
  606. /package/build/es/{components-beta → components/beta}/description-list/types.js +0 -0
  607. /package/build/es/{components-beta → components/beta}/description-list/types.js.map +0 -0
  608. /package/build/es/{components-beta → components/beta}/nav-link/NavLink.d.ts +0 -0
  609. /package/build/es/{components-beta → components/beta}/nav-link/index.js +0 -0
  610. /package/build/es/{components-beta → components/beta}/nav-link/index.js.map +0 -0
  611. /package/build/es/{components-beta → components/beta}/nav-link/types.js +0 -0
  612. /package/build/es/{components-beta → components/beta}/nav-link/types.js.map +0 -0
  613. /package/build/es/{components-beta → components/beta}/select/Select.d.ts +0 -0
  614. /package/build/es/{components-beta → components/beta}/select/index.js +0 -0
  615. /package/build/es/{components-beta → components/beta}/select/index.js.map +0 -0
  616. /package/build/es/{components-beta → components/beta}/select/types.js +0 -0
  617. /package/build/es/{components-beta → components/beta}/select/types.js.map +0 -0
  618. /package/build/es/{core → utilities}/types.js +0 -0
  619. /package/build/es/{core → utilities}/types.js.map +0 -0
  620. /package/styles/{core/_layers.scss → _layers.scss} +0 -0
  621. /package/styles/{core/core.scss → base.scss} +0 -0
  622. /package/styles/{components-beta → components/beta}/description-list/_index.scss +0 -0
  623. /package/styles/{components-beta → components/beta}/nav-link/_index.scss +0 -0
  624. /package/styles/{core/global → global}/_index.scss +0 -0
  625. /package/styles/{core/jkl → jkl}/_convert.scss +0 -0
  626. /package/styles/{core/jkl → jkl}/_navigation.scss +0 -0
  627. /package/styles/{core/jkl → jkl}/_responsive-units.scss +0 -0
  628. /package/styles/{core/jkl → jkl}/_screenreader.scss +0 -0
  629. /package/styles/{core/jkl → jkl}/_screens.scss +0 -0
  630. /package/styles/{core/jkl → jkl}/_shadows.scss +0 -0
  631. /package/styles/{core/jkl → jkl}/_underline.scss +0 -0
  632. /package/styles/{core/jkl → jkl}/_z-index.scss +0 -0
  633. /package/styles/{core/resets → resets}/_index.scss +0 -0
  634. /package/styles/{core/resets → resets}/_normalize.scss +0 -0
  635. /package/styles/{core/resets → resets}/_reset.scss +0 -0
  636. /package/styles/{core/utility → utility}/_index.scss +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sources":["../../../../src/components/datepicker/DatePicker.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport dayjs from \"dayjs\";\nimport React, {\n type ChangeEvent,\n type FocusEvent,\n type KeyboardEvent,\n type MouseEvent,\n forwardRef,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { IconButton } from \"../icon-button/IconButton.js\";\nimport { CalendarIcon } from \"../icon/icons/CalendarIcon.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport Popover from \"../popover/Popover.js\";\nimport { BaseTextInput } from \"../text-input/BaseTextInput.js\";\nimport { Calendar } from \"./internal/Calendar.js\";\nimport { type DateInfo, getInitialDate } from \"./internal/utils.js\";\nimport type { DatePickerProps, DateValidationError } from \"./types.js\";\nimport { formatInput, parseDateString } from \"./utils.js\";\nimport { isWithinLowerBound, isWithinUpperBound } from \"./validation.js\";\n\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(\n (props, forwardedInputRef) => {\n const {\n \"data-testautoid\": testAutoId,\n id,\n className = \"\",\n label = \"Velg dato\",\n labelProps,\n defaultValue,\n defaultShow = false,\n value,\n disableBeforeDate: disableBefore,\n disableAfterDate: disableAfter,\n yearsToShow,\n name,\n helpLabel,\n errorLabel,\n invalid,\n days,\n months,\n monthLabel,\n yearLabel,\n placeholder = \"dd.mm.åååå\",\n width = \"11.25rem\",\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n action,\n showCalendarLabel = \"Åpne kalender\",\n hideCalendarLabel = \"Lukk kalender\",\n supportLabelProps,\n tooltip,\n textInputProps,\n description,\n ...rest\n } = props;\n\n if (process.env.NODE_ENV !== \"production\" && value && defaultValue) {\n console.warn(\n \"DatePicker må enten være controlled eller uncontrolled. Hvis du bruker defaultValue og value sammen vil defaultValue bli ignorert.\",\n );\n }\n /// Input state\n\n const disableBeforeDate = parseDateString(disableBefore);\n const minDate = disableBeforeDate\n ? dayjs(disableBeforeDate).startOf(\"day\").toDate()\n : undefined;\n const disableAfterDate = parseDateString(disableAfter);\n const maxDate = disableAfterDate\n ? dayjs(disableAfterDate).startOf(\"day\").toDate()\n : undefined;\n\n const [date, setDate] = useState(\n getInitialDate(value, defaultValue, minDate, maxDate),\n );\n const [error, setError] = useState<DateValidationError | null>(null);\n\n /// Calendar state\n\n const [showCalendar, setShowCalendar] = useState(defaultShow);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n const datepickerRef = useRef<HTMLDivElement>(null);\n\n /// Input events\n\n const iconButtonRef = useRef<HTMLButtonElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Hjelper for å gjøre det enklere å både forwarde refen men også bruke den selv internt\n const unifiedInputRef = useCallback(\n (instance: HTMLInputElement | null) => {\n inputRef.current = instance;\n if (forwardedInputRef) {\n if (typeof forwardedInputRef === \"function\") {\n forwardedInputRef(instance);\n } else {\n forwardedInputRef.current = instance;\n }\n }\n },\n [forwardedInputRef],\n );\n\n const handleFocus = useCallback(\n (e: FocusEvent<HTMLInputElement>) => {\n if (!onFocus || !datepickerRef.current) {\n return;\n }\n\n const nextFocusIsInside = datepickerRef.current.contains(\n e.relatedTarget as Node,\n );\n if (!nextFocusIsInside) {\n onFocus(e, date, { error, value: e.target.value });\n }\n },\n [onFocus, date, error],\n );\n\n const handleBlur = useCallback(\n (e: FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e, date, { error, value: e.target.value });\n }\n },\n [onBlur, date, error],\n );\n\n const handleKeyDownAction = useCallback(\n (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === \"Escape\") {\n setShowCalendar(false);\n e.preventDefault();\n e.stopPropagation();\n }\n\n if (action?.onKeyDown) {\n action.onKeyDown(e);\n }\n },\n [action],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n let nextDate: Date | null = null;\n let nextError: DateValidationError | null = null;\n\n if (e.target.value) {\n const val = parseDateString(e.target.value);\n if (!val) {\n nextError = \"WRONG_FORMAT\";\n } else if (minDate && !isWithinLowerBound(val, minDate)) {\n nextError = \"OUTSIDE_LOWER_BOUND\";\n } else if (maxDate && !isWithinUpperBound(val, maxDate)) {\n nextError = \"OUTSIDE_UPPER_BOUND\";\n } else {\n setShowCalendar(false);\n }\n nextDate = val || null;\n }\n\n setError(nextError);\n setDate(nextDate);\n\n if (onChange) {\n onChange(e, nextDate, {\n error: nextError,\n value: e.target.value,\n });\n }\n },\n [onChange, minDate, maxDate],\n );\n\n /// Calendar events\n\n const clickCalendar = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n flushSync(() => {\n setShowCalendar(!showCalendar);\n });\n\n const calendarEl = calendarRef.current;\n const button =\n calendarEl &&\n (calendarEl.querySelector(\n '[aria-pressed=\"true\"]',\n ) as HTMLButtonElement);\n // Make sure the popover-modal is correctly positioned before focusing a button\n // so we avoid accidentally scrolling to the top of the page\n window.requestAnimationFrame(() => button?.focus());\n\n if (action?.onClick) {\n action.onClick(e);\n }\n },\n [showCalendar, action],\n );\n\n const handleClickCalendarDay = useCallback(\n ({ date }: DateInfo) => {\n setShowCalendar(false);\n setDate(date);\n\n if (inputRef.current) {\n const node = inputRef.current;\n\n node.value = formatInput(date);\n\n // Simulér et change-event så APIet blir så likt som mulig en endring av inputfeltet\n const event = document.createEvent(\"HTMLEvents\");\n event.initEvent(\"input\", true, false);\n node.dispatchEvent(event);\n\n node.focus();\n\n if (onChange) {\n // Det er ikke helt sant at dette er et React.SyntheticEvent, men it's fine – probably?\n // Den har tingene man kan forvente, men hvis du gjør serdeles fancy ting med events\n // så kan det hende du må utvide denne for å dekke behovet ditt.\n onChange(\n event as unknown as ChangeEvent<HTMLInputElement>,\n date,\n {\n error: null,\n value: node.value,\n },\n );\n }\n }\n },\n [onChange],\n );\n\n const handleTabOutsideCalendar = useCallback((e: KeyboardEvent) => {\n e.preventDefault();\n setShowCalendar(false);\n iconButtonRef.current?.focus();\n }, []);\n\n return (\n <InputGroup\n id={id}\n className={clsx(\"jkl-datepicker\", className)}\n {...rest}\n ref={datepickerRef}\n label={label}\n labelProps={labelProps}\n helpLabel={helpLabel}\n errorLabel={errorLabel}\n supportLabelProps={supportLabelProps}\n tooltip={tooltip}\n description={description}\n render={(inputProps) => (\n <BaseTextInput\n data-focused={showCalendar ? \"true\" : undefined}\n ref={unifiedInputRef}\n data-testid=\"jkl-datepicker__input\"\n data-testautoid={testAutoId}\n className=\"jkl-datepicker__input\"\n name={name}\n defaultValue={defaultValue}\n value={value}\n type=\"text\"\n placeholder={placeholder}\n width={width}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n actionButton={\n <Popover\n positionReference={inputRef}\n open={showCalendar}\n onOpenChange={() =>\n setShowCalendar(!showCalendar)\n }\n offset={8}\n >\n <Popover.Trigger\n {...action}\n data-testid=\"jkl-datepicker__trigger\"\n className=\"jkl-text-input-action-button\"\n title={\n showCalendar\n ? hideCalendarLabel\n : showCalendarLabel\n }\n tabIndex={0}\n onClick={clickCalendar}\n onKeyDown={handleKeyDownAction}\n asChild\n >\n <IconButton>\n <CalendarIcon />\n </IconButton>\n </Popover.Trigger>\n <Popover.Content initialFocus={-1} padding={24}>\n <Calendar\n ref={calendarRef}\n date={date}\n minDate={minDate}\n maxDate={maxDate}\n days={days}\n months={months}\n monthLabel={monthLabel}\n yearLabel={yearLabel}\n yearsToShow={yearsToShow}\n onDateSelected={handleClickCalendarDay}\n onTabOutside={handleTabOutsideCalendar}\n />\n </Popover.Content>\n </Popover>\n }\n {...textInputProps}\n {...inputProps}\n aria-invalid={invalid || !!errorLabel}\n />\n )}\n />\n );\n },\n);\n\nDatePicker.displayName = \"DatePicker\";\n"],"names":["DatePicker","forwardRef","props","forwardedInputRef","testAutoId","id","className","label","labelProps","defaultValue","defaultShow","value","disableBeforeDate","disableBefore","disableAfterDate","disableAfter","yearsToShow","name","helpLabel","errorLabel","invalid","days","months","monthLabel","yearLabel","placeholder","width","onChange","onBlur","onFocus","onKeyDown","action","showCalendarLabel","hideCalendarLabel","supportLabelProps","tooltip","textInputProps","description","rest","process","env","NODE_ENV","console","warn","parseDateString","minDate","dayjs","startOf","toDate","maxDate","date","setDate","useState","getInitialDate","error","setError","showCalendar","setShowCalendar","calendarRef","useRef","datepickerRef","iconButtonRef","inputRef","unifiedInputRef","useCallback","instance","current","handleFocus","e","contains","relatedTarget","target","handleBlur","handleKeyDownAction","key","preventDefault","stopPropagation","handleChange","nextDate","nextError","val","isWithinLowerBound","isWithinUpperBound","clickCalendar","flushSync","calendarEl","button","querySelector","window","requestAnimationFrame","focus","onClick","handleClickCalendarDay","node","formatInput","event","document","createEvent","initEvent","dispatchEvent","handleTabOutsideCalendar","jsx","InputGroup","clsx","ref","render","inputProps","BaseTextInput","type","actionButton","jsxs","Popover","positionReference","open","onOpenChange","offset","children","Trigger","title","tabIndex","asChild","IconButton","CalendarIcon","Content","initialFocus","padding","Calendar","onDateSelected","onTabOutside","displayName"],"mappings":"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"}
1
+ {"version":3,"file":"DatePicker.js","sources":["../../../../src/components/datepicker/DatePicker.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport dayjs from \"dayjs\";\nimport React, {\n type ChangeEvent,\n type FocusEvent,\n type KeyboardEvent,\n type MouseEvent,\n forwardRef,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { formatDateString } from \"../../utilities/formatters/date/formatDate.js\";\nimport { IconButton } from \"../icon-button/IconButton.js\";\nimport { CalendarIcon } from \"../icon/icons/CalendarIcon.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport Popover from \"../popover/Popover.js\";\nimport { BaseTextInput } from \"../text-input/BaseTextInput.js\";\nimport { Calendar } from \"./internal/Calendar.js\";\nimport { type DateInfo, getInitialDate } from \"./internal/utils.js\";\nimport type { DatePickerProps, DateValidationError } from \"./types.js\";\nimport { formatInput, parseDateString } from \"./utils.js\";\nimport { isWithinLowerBound, isWithinUpperBound } from \"./validation.js\";\n\nconst setInputValue = (input: HTMLInputElement, value: string) => {\n const nativeSetter = Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n \"value\",\n )?.set;\n\n if (nativeSetter) {\n nativeSetter.call(input, value);\n } else {\n input.value = value;\n }\n};\n\nconst normalizeInputValue = (\n rawValue: string,\n shouldStripAutoFormatting: boolean,\n) => {\n const digits = rawValue.replace(/\\D/g, \"\");\n const partialCompactDate = formatDateString(digits, {\n partial: true,\n });\n const rawValueWithoutTrailingPunctuation = rawValue.replace(/\\D+$/, \"\");\n const compactDateCandidate =\n digits.length === 8 ? formatDateString(digits) : rawValue;\n const validCompactDate = parseDateString(compactDateCandidate)\n ? compactDateCandidate\n : null;\n const shouldRemoveFormatting =\n shouldStripAutoFormatting &&\n rawValue !== digits &&\n rawValueWithoutTrailingPunctuation === partialCompactDate &&\n parseDateString(rawValue) === undefined &&\n validCompactDate === null;\n\n return validCompactDate ?? (shouldRemoveFormatting ? digits : rawValue);\n};\n\nconst getInputValidationState = ({\n value,\n minDate,\n maxDate,\n}: {\n value: string;\n minDate?: Date;\n maxDate?: Date;\n}): { date: Date | null; error: DateValidationError | null } => {\n if (!value) {\n return { date: null, error: null };\n }\n\n const parsedDate = parseDateString(value);\n\n if (!parsedDate) {\n return { date: null, error: \"WRONG_FORMAT\" };\n }\n\n if (minDate && !isWithinLowerBound(parsedDate, minDate)) {\n return { date: parsedDate, error: \"OUTSIDE_LOWER_BOUND\" };\n }\n\n if (maxDate && !isWithinUpperBound(parsedDate, maxDate)) {\n return { date: parsedDate, error: \"OUTSIDE_UPPER_BOUND\" };\n }\n\n return { date: parsedDate, error: null };\n};\n\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(\n (props, forwardedInputRef) => {\n const {\n \"data-testautoid\": testAutoId,\n id,\n className = \"\",\n label = \"Velg dato\",\n labelProps,\n defaultValue,\n defaultShow = false,\n value,\n disableBeforeDate: disableBefore,\n disableAfterDate: disableAfter,\n yearsToShow,\n name,\n helpLabel,\n errorLabel,\n invalid,\n days,\n months,\n monthLabel,\n yearLabel,\n placeholder = \"dd.mm.åååå\",\n width = \"11.25rem\",\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n action,\n showCalendarLabel = \"Åpne kalender\",\n hideCalendarLabel = \"Lukk kalender\",\n supportLabelProps,\n tooltip,\n textInputProps,\n description,\n ...rest\n } = props;\n\n if (process.env.NODE_ENV !== \"production\" && value && defaultValue) {\n console.warn(\n \"DatePicker må enten være controlled eller uncontrolled. Hvis du bruker defaultValue og value sammen vil defaultValue bli ignorert.\",\n );\n }\n /// Input state\n\n const disableBeforeDate = parseDateString(disableBefore);\n const minDate = disableBeforeDate\n ? dayjs(disableBeforeDate).startOf(\"day\").toDate()\n : undefined;\n const disableAfterDate = parseDateString(disableAfter);\n const maxDate = disableAfterDate\n ? dayjs(disableAfterDate).startOf(\"day\").toDate()\n : undefined;\n\n const [date, setDate] = useState(\n getInitialDate(value, defaultValue, minDate, maxDate),\n );\n const [error, setError] = useState<DateValidationError | null>(null);\n\n /// Calendar state\n\n const [showCalendar, setShowCalendar] = useState(defaultShow);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n const datepickerRef = useRef<HTMLDivElement>(null);\n\n /// Input events\n\n const iconButtonRef = useRef<HTMLButtonElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const didAutoFormatCompactInputRef = useRef(false);\n\n // Hjelper for å gjøre det enklere å både forwarde refen men også bruke den selv internt\n const unifiedInputRef = useCallback(\n (instance: HTMLInputElement | null) => {\n inputRef.current = instance;\n if (forwardedInputRef) {\n if (typeof forwardedInputRef === \"function\") {\n forwardedInputRef(instance);\n } else {\n forwardedInputRef.current = instance;\n }\n }\n },\n [forwardedInputRef],\n );\n\n const handleFocus = useCallback(\n (e: FocusEvent<HTMLInputElement>) => {\n if (!onFocus || !datepickerRef.current) {\n return;\n }\n\n const nextFocusIsInside = datepickerRef.current.contains(\n e.relatedTarget as Node,\n );\n if (!nextFocusIsInside) {\n onFocus(e, date, { error, value: e.target.value });\n }\n },\n [onFocus, date, error],\n );\n\n const handleBlur = useCallback(\n (e: FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e, date, { error, value: e.target.value });\n }\n },\n [onBlur, date, error],\n );\n\n const handleKeyDownAction = useCallback(\n (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === \"Escape\") {\n setShowCalendar(false);\n e.preventDefault();\n e.stopPropagation();\n }\n\n if (action?.onKeyDown) {\n action.onKeyDown(e);\n }\n },\n [action],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const rawValue = e.currentTarget.value;\n const formattedValue = normalizeInputValue(\n rawValue,\n didAutoFormatCompactInputRef.current,\n );\n\n if (formattedValue !== rawValue) {\n setInputValue(e.currentTarget, formattedValue);\n }\n\n const digits = rawValue.replace(/\\D/g, \"\");\n didAutoFormatCompactInputRef.current =\n rawValue === digits &&\n formattedValue === formatDateString(digits) &&\n formattedValue !== rawValue &&\n parseDateString(formattedValue) !== undefined;\n\n const { date: nextDate, error: nextError } =\n getInputValidationState({\n value: formattedValue,\n minDate,\n maxDate,\n });\n\n if (nextDate && !nextError) {\n setShowCalendar(false);\n }\n\n setError(nextError);\n setDate(nextDate);\n\n if (onChange) {\n onChange(e, nextDate, {\n error: nextError,\n value: formattedValue,\n });\n }\n },\n [onChange, minDate, maxDate],\n );\n\n /// Calendar events\n\n const clickCalendar = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n flushSync(() => {\n setShowCalendar(!showCalendar);\n });\n\n const calendarEl = calendarRef.current;\n const button =\n calendarEl &&\n (calendarEl.querySelector(\n '[aria-pressed=\"true\"]',\n ) as HTMLButtonElement);\n // Make sure the popover-modal is correctly positioned before focusing a button\n // so we avoid accidentally scrolling to the top of the page\n window.requestAnimationFrame(() => button?.focus());\n\n if (action?.onClick) {\n action.onClick(e);\n }\n },\n [showCalendar, action],\n );\n\n const handleClickCalendarDay = useCallback(\n ({ date }: DateInfo) => {\n setShowCalendar(false);\n setDate(date);\n\n if (inputRef.current) {\n const node = inputRef.current;\n\n didAutoFormatCompactInputRef.current = false;\n node.value = formatInput(date);\n\n // Simulér et change-event så APIet blir så likt som mulig en endring av inputfeltet\n const event = document.createEvent(\"HTMLEvents\");\n event.initEvent(\"input\", true, false);\n node.dispatchEvent(event);\n\n node.focus();\n\n if (onChange) {\n // Det er ikke helt sant at dette er et React.SyntheticEvent, men it's fine – probably?\n // Den har tingene man kan forvente, men hvis du gjør serdeles fancy ting med events\n // så kan det hende du må utvide denne for å dekke behovet ditt.\n onChange(\n event as unknown as ChangeEvent<HTMLInputElement>,\n date,\n {\n error: null,\n value: node.value,\n },\n );\n }\n }\n },\n [onChange],\n );\n\n const handleTabOutsideCalendar = useCallback((e: KeyboardEvent) => {\n e.preventDefault();\n setShowCalendar(false);\n iconButtonRef.current?.focus();\n }, []);\n\n return (\n <InputGroup\n id={id}\n className={clsx(\"jkl-datepicker\", className)}\n {...rest}\n ref={datepickerRef}\n label={label}\n labelProps={labelProps}\n helpLabel={helpLabel}\n errorLabel={errorLabel}\n supportLabelProps={supportLabelProps}\n tooltip={tooltip}\n description={description}\n render={(inputProps) => (\n <BaseTextInput\n data-focused={showCalendar ? \"true\" : undefined}\n ref={unifiedInputRef}\n data-testid=\"jkl-datepicker__input\"\n data-testautoid={testAutoId}\n className=\"jkl-datepicker__input\"\n name={name}\n defaultValue={defaultValue}\n value={value}\n type=\"text\"\n placeholder={placeholder}\n width={width}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n actionButton={\n <Popover\n positionReference={inputRef}\n open={showCalendar}\n onOpenChange={() =>\n setShowCalendar(!showCalendar)\n }\n offset={8}\n >\n <Popover.Trigger\n {...action}\n data-testid=\"jkl-datepicker__trigger\"\n className=\"jkl-text-input-action-button\"\n title={\n showCalendar\n ? hideCalendarLabel\n : showCalendarLabel\n }\n tabIndex={0}\n onClick={clickCalendar}\n onKeyDown={handleKeyDownAction}\n asChild\n >\n <IconButton>\n <CalendarIcon />\n </IconButton>\n </Popover.Trigger>\n <Popover.Content initialFocus={-1} padding={24}>\n <Calendar\n ref={calendarRef}\n date={date}\n minDate={minDate}\n maxDate={maxDate}\n days={days}\n months={months}\n monthLabel={monthLabel}\n yearLabel={yearLabel}\n yearsToShow={yearsToShow}\n onDateSelected={handleClickCalendarDay}\n onTabOutside={handleTabOutsideCalendar}\n />\n </Popover.Content>\n </Popover>\n }\n {...textInputProps}\n {...inputProps}\n aria-invalid={invalid || !!errorLabel}\n />\n )}\n />\n );\n },\n);\n\nDatePicker.displayName = \"DatePicker\";\n"],"names":["DatePicker","forwardRef","props","forwardedInputRef","testAutoId","id","className","label","labelProps","defaultValue","defaultShow","value","disableBeforeDate","disableBefore","disableAfterDate","disableAfter","yearsToShow","name","helpLabel","errorLabel","invalid","days","months","monthLabel","yearLabel","placeholder","width","onChange","onBlur","onFocus","onKeyDown","action","showCalendarLabel","hideCalendarLabel","supportLabelProps","tooltip","textInputProps","description","rest","process","env","NODE_ENV","console","warn","parseDateString","minDate","dayjs","startOf","toDate","maxDate","date","setDate","useState","getInitialDate","error","setError","showCalendar","setShowCalendar","calendarRef","useRef","datepickerRef","iconButtonRef","inputRef","didAutoFormatCompactInputRef","unifiedInputRef","useCallback","instance","current","handleFocus","e","contains","relatedTarget","target","handleBlur","handleKeyDownAction","key","preventDefault","stopPropagation","handleChange","rawValue","currentTarget","formattedValue","shouldStripAutoFormatting","digits","replace","partialCompactDate","formatDateString","partial","rawValueWithoutTrailingPunctuation","compactDateCandidate","length","validCompactDate","shouldRemoveFormatting","normalizeInputValue","input","nativeSetter","Object","getOwnPropertyDescriptor","HTMLInputElement","prototype","set","call","setInputValue","nextDate","nextError","parsedDate","isWithinLowerBound","isWithinUpperBound","getInputValidationState","clickCalendar","flushSync","calendarEl","button","querySelector","window","requestAnimationFrame","focus","onClick","handleClickCalendarDay","node","formatInput","event","document","createEvent","initEvent","dispatchEvent","handleTabOutsideCalendar","jsx","InputGroup","clsx","ref","render","inputProps","BaseTextInput","type","actionButton","jsxs","Popover","positionReference","open","onOpenChange","offset","children","Trigger","title","tabIndex","asChild","IconButton","CalendarIcon","Content","initialFocus","padding","Calendar","onDateSelected","onTabOutside","displayName"],"mappings":"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"}
@@ -1,5 +1,5 @@
1
1
  import { ButtonHTMLAttributes, ChangeEvent, ComponentProps, FocusEvent, KeyboardEvent } from 'react';
2
- import { DataTestAutoId } from '../../core/types.js';
2
+ import { DataTestAutoId } from '../../utilities/types.js';
3
3
  import { InputGroupProps, LabelProps } from '../input-group/types.js';
4
4
  export type DateValidationError = "WRONG_FORMAT" | "OUTSIDE_LOWER_BOUND" | "OUTSIDE_UPPER_BOUND";
5
5
  export type DatePickerChangeEventHandler = (e: ChangeEvent<HTMLInputElement>, date: Date | null, meta: DatePickerMetadata) => void;
@@ -1,5 +1,5 @@
1
1
  export { DescriptionList, DescriptionTerm, DescriptionDetail, } from './DescriptionList.js';
2
2
  export type { DescriptionListProps, DescriptionTermProps, DescriptionDetailProps, } from './types.js';
3
- export { DescriptionList as BETA_DescriptionList } from '../../components-beta/description-list/DescriptionList.js';
4
- export { DescriptionListItem as BETA_DescriptionListItem } from '../../components-beta/description-list/DescriptionListItem.js';
5
- export type { DescriptionListProps as BETA_DescriptionListProps } from '../../components-beta/description-list/types.js';
3
+ export { DescriptionList as BETA_DescriptionList } from '../beta/description-list/DescriptionList.jsx';
4
+ export { DescriptionListItem as BETA_DescriptionListItem } from '../beta/description-list/DescriptionListItem.jsx';
5
+ export type { DescriptionListProps as BETA_DescriptionListProps } from '../beta/description-list/types.js';
@@ -1,2 +1,2 @@
1
- import{DescriptionDetail as i,DescriptionList as s,DescriptionTerm as t}from"./DescriptionList.js";import{DescriptionList as e}from"../../components-beta/description-list/DescriptionList.js";import{DescriptionListItem as o}from"../../components-beta/description-list/DescriptionListItem.js";export{e as BETA_DescriptionList,o as BETA_DescriptionListItem,i as DescriptionDetail,s as DescriptionList,t as DescriptionTerm};
1
+ import{DescriptionDetail as i,DescriptionList as s,DescriptionTerm as t}from"./DescriptionList.js";import{DescriptionList as e}from"../beta/description-list/DescriptionList.js";import{DescriptionListItem as r}from"../beta/description-list/DescriptionListItem.js";export{e as BETA_DescriptionList,r as BETA_DescriptionListItem,i as DescriptionDetail,s as DescriptionList,t as DescriptionTerm};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { WithChildren } from '../../core/types.js';
1
+ import { WithChildren } from '../../utilities/types.js';
2
2
  export interface DescriptionListProps extends WithChildren {
3
3
  className?: string;
4
4
  separators?: boolean;
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{c as a}from"../../../clsx-BeLtu-UY.js";import n,{useState as r,useRef as s,useImperativeHandle as o,useEffect as i}from"react";import{ExpandablePanelContent as l}from"./ExpandablePanelContent.js";import{ExpanderContext as d}from"./context.js";import{Expander as p}from"./Expander.js";const c=Object.assign(n.forwardRef(function(n,l){const{children:p,as:c="details",variant:m="fill",open:x,defaultOpen:f,onOpenChange:u,className:j,...v}=n,[E,b]=r(f||!1),[g,h]=r(!1),[k,C]=r(0),N=s();o(l,()=>N.current,[]);const P=c,_=typeof x<"u",w=_?x:E;return i(()=>{const e=e=>{b("open"===e.newState)},t=N.current;return t?.addEventListener("toggle",e),()=>t?.removeEventListener("toggle",e)},[]),e("div",{className:"jkl-expandable__wrapper",children:[t("div",{ref:e=>e?.setAttribute("inert","true"),className:"jkl-expandable__focus-container",style:{height:k}}),t(P,{ref:N,"data-testid":"jkl-expand-section",className:a("jkl-expandable",`jkl-expandable--${m}`,j),open:"details"===c?w||g:void 0,"data-visible-content":w||g,...v,children:t(d.Provider,{value:{open:w,onToggle:()=>{_||b(e=>(u?.(!e),!e))},onTransitionEnd:h,onTransitionStart:e=>{e&&h(!0)},setExpanderHeight:C},children:p})})]})}),{Content:l,Header:p});export{c as ExpandablePanel};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{c as a}from"../../../clsx-BeLtu-UY.js";import n,{useState as r,useRef as s,useImperativeHandle as o,useEffect as i}from"react";import{ExpandablePanelContent as l}from"./ExpandablePanelContent.js";import{Expander as d}from"./Expander.js";import{ExpanderContext as p}from"./context.js";const c=Object.assign(n.forwardRef(function(n,l){const{children:d,as:c="details",variant:m="fill",open:x,defaultOpen:f,onOpenChange:u,className:j,...v}=n,[E,b]=r(f||!1),[g,h]=r(!1),[k,C]=r(0),N=s();o(l,()=>N.current,[]);const P=c,_=typeof x<"u",w=_?x:E;return i(()=>{const e=e=>{b("open"===e.newState)},t=N.current;return t?.addEventListener("toggle",e),()=>t?.removeEventListener("toggle",e)},[]),e("div",{className:"jkl-expandable__wrapper",children:[t("div",{ref:e=>e?.setAttribute("inert","true"),className:"jkl-expandable__focus-container",style:{height:k}}),t(P,{ref:N,"data-testid":"jkl-expand-section",className:a("jkl-expandable",`jkl-expandable--${m}`,j),open:"details"===c?w||g:void 0,"data-visible-content":w||g,...v,children:t(p.Provider,{value:{open:w,onToggle:()=>{_?u?.(!w):b(e=>(u?.(!e),!e))},onTransitionEnd:h,onTransitionStart:e=>{e&&h(!0)},setExpanderHeight:C},children:d})})]})}),{Content:l,Header:d});export{c as ExpandablePanel};
2
2
  //# sourceMappingURL=ExpandablePanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandablePanel.js","sources":["../../../../src/components/expander/ExpandablePanel.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport type { PolymorphicRef } from \"../../utilities/polymorphism/polymorphism.js\";\nimport { ExpandablePanelContent } from \"./ExpandablePanelContent.js\";\nimport { ExpanderContext } from \"./context.js\";\nimport type {\n ExpandablePanelComponent,\n ExpandablePanelProps,\n} from \"./types.js\";\nimport { Expander } from \"./Expander.jsx\";\n\nexport const ExpandablePanel = Object.assign(\n React.forwardRef(function ExpandablePanel<\n ElementType extends React.ElementType = \"details\",\n >(\n props: ExpandablePanelProps<ElementType>,\n ref?: PolymorphicRef<ElementType>,\n ) {\n const {\n children,\n as = \"details\",\n variant = \"fill\",\n open: controlledOpen,\n defaultOpen,\n onOpenChange,\n className,\n ...rest\n } = props;\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(\n defaultOpen || false,\n );\n const [contentIsVisible, setContentIsVisible] = useState(false);\n const [expanderHeight, setExpanderHeight] = useState(0);\n\n const internalRef = useRef<HTMLDetailsElement>();\n useImperativeHandle(ref, () => internalRef.current, []);\n\n const El = as;\n const isControlled = typeof controlledOpen !== \"undefined\";\n const isOpen = isControlled ? controlledOpen : uncontrolledOpen;\n\n const setVisibleIfOpening = (isOpening: boolean) => {\n if (isOpening) {\n setContentIsVisible(true);\n }\n };\n\n const syncUncontrolledState = () => {\n if (isControlled) {\n return;\n }\n setUncontrolledOpen((previousValue) => {\n onOpenChange?.(!previousValue);\n return !previousValue;\n });\n };\n\n useEffect(() => {\n const callback = (e: ToggleEvent & { newState: string }) => {\n setUncontrolledOpen(e.newState === \"open\");\n };\n\n const element = internalRef.current;\n\n element?.addEventListener(\"toggle\", callback as EventListener);\n\n return () =>\n element?.removeEventListener(\n \"toggle\",\n callback as EventListener,\n );\n }, []);\n\n return (\n <div className=\"jkl-expandable__wrapper\">\n <div\n /*\n Setter `inert` manuelt for å støtte både React 18 og 19.\n\n Dette unngår typefeil i React 18 og advarsler i React 19.\n Se: https://github.com/WICG/inert/issues/58\n */\n ref={(node) => node?.setAttribute(\"inert\", \"true\")}\n className=\"jkl-expandable__focus-container\"\n style={{ height: expanderHeight }}\n />\n <El\n ref={internalRef}\n data-testid={\"jkl-expand-section\"}\n className={clsx(\n \"jkl-expandable\",\n `jkl-expandable--${variant}`,\n className,\n )}\n open={\n /* for the animation to work in Safari we must ensure that\n * the element is open *before* the transition starts */\n as === \"details\"\n ? isOpen || contentIsVisible\n : undefined\n }\n /* this attribute is used for styling purposes */\n data-visible-content={isOpen || contentIsVisible}\n {...rest}\n >\n <ExpanderContext.Provider\n value={{\n open: isOpen,\n onToggle: syncUncontrolledState,\n onTransitionEnd: setContentIsVisible,\n onTransitionStart: setVisibleIfOpening,\n setExpanderHeight,\n }}\n >\n {children}\n </ExpanderContext.Provider>\n </El>\n </div>\n );\n }),\n { Content: ExpandablePanelContent, Header: Expander },\n) as ExpandablePanelComponent;\n"],"names":["ExpandablePanel","Object","assign","React","forwardRef","props","ref","children","as","variant","open","controlledOpen","defaultOpen","onOpenChange","className","rest","uncontrolledOpen","setUncontrolledOpen","useState","contentIsVisible","setContentIsVisible","expanderHeight","setExpanderHeight","internalRef","useRef","useImperativeHandle","current","El","isControlled","isOpen","useEffect","callback","e","newState","element","addEventListener","removeEventListener","jsxs","jsx","node","setAttribute","style","height","clsx","ExpanderContext","Provider","value","onToggle","previousValue","onTransitionEnd","onTransitionStart","isOpening","Content","ExpandablePanelContent","Header","Expander"],"mappings":"qVAWO,MAAMA,EAAkBC,OAAOC,OAClCC,EAAMC,WAAW,SAGbC,EACAC,GAEA,MACIC,SAAAA,EACAC,GAAAA,EAAK,UACLC,QAAAA,EAAU,OACVC,KAAMC,EACNC,YAAAA,EACAC,aAAAA,EACAC,UAAAA,KACGC,GACHV,GAEGW,EAAkBC,GAAuBC,EAC5CN,IAAe,IAEZO,EAAkBC,GAAuBF,GAAS,IAClDG,EAAgBC,GAAqBJ,EAAS,GAE/CK,EAAcC,IACpBC,EAAoBnB,EAAK,IAAMiB,EAAYG,QAAS,IAEpD,MAAMC,EAAKnB,EACLoB,SAAsBjB,EAAmB,IACzCkB,EAASD,EAAejB,EAAiBK,EAkB/C,OAAAc,EAAU,KACN,MAAMC,EAAYC,IACdf,EAAmC,SAAfe,EAAEC,WAGpBC,EAAUX,EAAYG,QAE5B,OAAAQ,GAASC,iBAAiB,SAAUJ,GAE7B,IACHG,GAASE,oBACL,SACAL,IAET,IAGCM,EAAC,MAAA,CAAIvB,UAAU,0BACXP,SAAA,CAAA+B,EAAC,MAAA,CAOGhC,IAAMiC,GAASA,GAAMC,aAAa,QAAS,QAC3C1B,UAAU,kCACV2B,MAAO,CAAEC,OAAQrB,KAErBiB,EAACX,EAAA,CACGrB,IAAKiB,EACL,cAAa,qBACbT,UAAW6B,EACP,iBACA,mBAAmBlC,IACnBK,GAEJJ,KAGW,YAAPF,EACMqB,GAAUV,OACV,EAGV,uBAAsBU,GAAUV,KAC5BJ,EAEJR,SAAA+B,EAACM,EAAgBC,SAAhB,CACGC,MAAO,CACHpC,KAAMmB,EACNkB,SA7DU,KACtBnB,GAGJX,EAAqB+B,IACjBnC,KAAgBmC,IACRA,KAwDIC,gBAAiB7B,EACjB8B,kBArESC,IACrBA,GACA/B,GAAoB,IAoERE,kBAAAA,GAGHf,SAAAA,QAKrB,GACA,CAAE6C,QAASC,EAAwBC,OAAQC"}
1
+ {"version":3,"file":"ExpandablePanel.js","sources":["../../../../src/components/expander/ExpandablePanel.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport type { PolymorphicRef } from \"../../utilities/polymorphism/polymorphism.js\";\nimport { ExpandablePanelContent } from \"./ExpandablePanelContent.js\";\nimport { Expander } from \"./Expander.jsx\";\nimport { ExpanderContext } from \"./context.js\";\nimport type {\n ExpandablePanelComponent,\n ExpandablePanelProps,\n} from \"./types.js\";\n\nexport const ExpandablePanel = Object.assign(\n React.forwardRef(function ExpandablePanel<\n ElementType extends React.ElementType = \"details\",\n >(\n props: ExpandablePanelProps<ElementType>,\n ref?: PolymorphicRef<ElementType>,\n ) {\n const {\n children,\n as = \"details\",\n variant = \"fill\",\n open: controlledOpen,\n defaultOpen,\n onOpenChange,\n className,\n ...rest\n } = props;\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(\n defaultOpen || false,\n );\n const [contentIsVisible, setContentIsVisible] = useState(false);\n const [expanderHeight, setExpanderHeight] = useState(0);\n\n const internalRef = useRef<HTMLDetailsElement>();\n useImperativeHandle(ref, () => internalRef.current, []);\n\n const El = as;\n const isControlled = typeof controlledOpen !== \"undefined\";\n const isOpen = isControlled ? controlledOpen : uncontrolledOpen;\n\n const setVisibleIfOpening = (isOpening: boolean) => {\n if (isOpening) {\n setContentIsVisible(true);\n }\n };\n\n const syncUncontrolledState = () => {\n if (isControlled) {\n onOpenChange?.(!isOpen);\n return;\n }\n setUncontrolledOpen((previousValue) => {\n onOpenChange?.(!previousValue);\n return !previousValue;\n });\n };\n\n useEffect(() => {\n const callback = (e: ToggleEvent & { newState: string }) => {\n setUncontrolledOpen(e.newState === \"open\");\n };\n\n const element = internalRef.current;\n\n element?.addEventListener(\"toggle\", callback as EventListener);\n\n return () =>\n element?.removeEventListener(\n \"toggle\",\n callback as EventListener,\n );\n }, []);\n\n return (\n <div className=\"jkl-expandable__wrapper\">\n <div\n /*\n Setter `inert` manuelt for å støtte både React 18 og 19.\n\n Dette unngår typefeil i React 18 og advarsler i React 19.\n Se: https://github.com/WICG/inert/issues/58\n */\n ref={(node) => node?.setAttribute(\"inert\", \"true\")}\n className=\"jkl-expandable__focus-container\"\n style={{ height: expanderHeight }}\n />\n <El\n ref={internalRef}\n data-testid={\"jkl-expand-section\"}\n className={clsx(\n \"jkl-expandable\",\n `jkl-expandable--${variant}`,\n className,\n )}\n open={\n /* for the animation to work in Safari we must ensure that\n * the element is open *before* the transition starts */\n as === \"details\"\n ? isOpen || contentIsVisible\n : undefined\n }\n /* this attribute is used for styling purposes */\n data-visible-content={isOpen || contentIsVisible}\n {...rest}\n >\n <ExpanderContext.Provider\n value={{\n open: isOpen,\n onToggle: syncUncontrolledState,\n onTransitionEnd: setContentIsVisible,\n onTransitionStart: setVisibleIfOpening,\n setExpanderHeight,\n }}\n >\n {children}\n </ExpanderContext.Provider>\n </El>\n </div>\n );\n }),\n { Content: ExpandablePanelContent, Header: Expander },\n) as ExpandablePanelComponent;\n"],"names":["ExpandablePanel","Object","assign","React","forwardRef","props","ref","children","as","variant","open","controlledOpen","defaultOpen","onOpenChange","className","rest","uncontrolledOpen","setUncontrolledOpen","useState","contentIsVisible","setContentIsVisible","expanderHeight","setExpanderHeight","internalRef","useRef","useImperativeHandle","current","El","isControlled","isOpen","useEffect","callback","e","newState","element","addEventListener","removeEventListener","jsxs","jsx","node","setAttribute","style","height","clsx","ExpanderContext","Provider","value","onToggle","previousValue","onTransitionEnd","onTransitionStart","isOpening","Content","ExpandablePanelContent","Header","Expander"],"mappings":"qVAWO,MAAMA,EAAkBC,OAAOC,OAClCC,EAAMC,WAAW,SAGbC,EACAC,GAEA,MACIC,SAAAA,EACAC,GAAAA,EAAK,UACLC,QAAAA,EAAU,OACVC,KAAMC,EACNC,YAAAA,EACAC,aAAAA,EACAC,UAAAA,KACGC,GACHV,GAEGW,EAAkBC,GAAuBC,EAC5CN,IAAe,IAEZO,EAAkBC,GAAuBF,GAAS,IAClDG,EAAgBC,GAAqBJ,EAAS,GAE/CK,EAAcC,IACpBC,EAAoBnB,EAAK,IAAMiB,EAAYG,QAAS,IAEpD,MAAMC,EAAKnB,EACLoB,SAAsBjB,EAAmB,IACzCkB,EAASD,EAAejB,EAAiBK,EAmB/C,OAAAc,EAAU,KACN,MAAMC,EAAYC,IACdf,EAAmC,SAAfe,EAAEC,WAGpBC,EAAUX,EAAYG,QAE5B,OAAAQ,GAASC,iBAAiB,SAAUJ,GAE7B,IACHG,GAASE,oBACL,SACAL,IAET,IAGCM,EAAC,MAAA,CAAIvB,UAAU,0BACXP,SAAA,CAAA+B,EAAC,MAAA,CAOGhC,IAAMiC,GAASA,GAAMC,aAAa,QAAS,QAC3C1B,UAAU,kCACV2B,MAAO,CAAEC,OAAQrB,KAErBiB,EAACX,EAAA,CACGrB,IAAKiB,EACL,cAAa,qBACbT,UAAW6B,EACP,iBACA,mBAAmBlC,IACnBK,GAEJJ,KAGW,YAAPF,EACMqB,GAAUV,OACV,EAGV,uBAAsBU,GAAUV,KAC5BJ,EAEJR,SAAA+B,EAACM,EAAgBC,SAAhB,CACGC,MAAO,CACHpC,KAAMmB,EACNkB,SA9DU,KACtBnB,EACAf,KAAgBgB,GAGpBZ,EAAqB+B,IACjBnC,KAAgBmC,IACRA,KAwDIC,gBAAiB7B,EACjB8B,kBAtESC,IACrBA,GACA/B,GAAoB,IAqERE,kBAAAA,GAGHf,SAAAA,QAKrB,GACA,CAAE6C,QAASC,EAAwBC,OAAQC"}
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { WithChildren } from '../../core/types.js';
2
+ import { WithChildren } from '../../utilities/types.js';
3
3
  import { BaseTextAreaProps } from '../text-area/types.js';
4
4
  type FeedbackContext = {
5
5
  feedbackSubmitted: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"feedbackContext.js","sources":["../../../../src/components/feedback/feedbackContext.tsx"],"sourcesContent":["import React, { createContext, type FC, useContext } from \"react\";\nimport type { WithChildren } from \"../../core/types.js\";\nimport type { BaseTextAreaProps } from \"../text-area/types.js\";\n\ntype FeedbackContext = {\n feedbackSubmitted: boolean;\n followupStarted: boolean;\n followupSubmitted: boolean;\n contactSubmitted: boolean;\n landmarkLabel?: string;\n setFeedbackSubmitted: (state: boolean) => void;\n setFollowupStarted: (state: boolean) => void;\n setFollowupSubmitted: (state: boolean) => void;\n setContactSubmitted: (state: boolean) => void;\n} & Pick<BaseTextAreaProps, \"counter\">;\n\nconst initialState: FeedbackContext = {\n feedbackSubmitted: false,\n followupStarted: false,\n followupSubmitted: false,\n contactSubmitted: false,\n setFeedbackSubmitted: () => null,\n setFollowupStarted: () => null,\n setFollowupSubmitted: () => null,\n setContactSubmitted: () => null,\n};\n\nconst feedbackContext = createContext(initialState);\n\nexport const useFeedbackContext = (): FeedbackContext =>\n useContext(feedbackContext);\n\ninterface FeedbackContextProviderProps extends WithChildren {\n value: FeedbackContext;\n}\n\nexport const FeedbackContextProvider: FC<FeedbackContextProviderProps> = ({\n value,\n children,\n}) => (\n <feedbackContext.Provider value={value}>\n {children}\n </feedbackContext.Provider>\n);\n"],"names":["feedbackContext","createContext","feedbackSubmitted","followupStarted","followupSubmitted","contactSubmitted","setFeedbackSubmitted","setFollowupStarted","setFollowupSubmitted","setContactSubmitted","useFeedbackContext","useContext","FeedbackContextProvider","value","children","jsx","Provider"],"mappings":"8FAgBA,MAWMA,EAAkBC,EAXc,CAClCC,mBAAmB,EACnBC,iBAAiB,EACjBC,mBAAmB,EACnBC,kBAAkB,EAClBC,qBAAsB,IAAM,KAC5BC,mBAAoB,IAAM,KAC1BC,qBAAsB,IAAM,KAC5BC,oBAAqB,IAAM,OAKlBC,EAAqB,IAC9BC,EAAWX,GAMFY,EAA4D,EACrEC,MAAAA,EACAC,SAAAA,KAEAC,EAACf,EAAgBgB,SAAhB,CAAyBH,MAAAA,EACrBC,SAAAA"}
1
+ {"version":3,"file":"feedbackContext.js","sources":["../../../../src/components/feedback/feedbackContext.tsx"],"sourcesContent":["import React, { createContext, type FC, useContext } from \"react\";\nimport type { WithChildren } from \"../../utilities/types.js\";\nimport type { BaseTextAreaProps } from \"../text-area/types.js\";\n\ntype FeedbackContext = {\n feedbackSubmitted: boolean;\n followupStarted: boolean;\n followupSubmitted: boolean;\n contactSubmitted: boolean;\n landmarkLabel?: string;\n setFeedbackSubmitted: (state: boolean) => void;\n setFollowupStarted: (state: boolean) => void;\n setFollowupSubmitted: (state: boolean) => void;\n setContactSubmitted: (state: boolean) => void;\n} & Pick<BaseTextAreaProps, \"counter\">;\n\nconst initialState: FeedbackContext = {\n feedbackSubmitted: false,\n followupStarted: false,\n followupSubmitted: false,\n contactSubmitted: false,\n setFeedbackSubmitted: () => null,\n setFollowupStarted: () => null,\n setFollowupSubmitted: () => null,\n setContactSubmitted: () => null,\n};\n\nconst feedbackContext = createContext(initialState);\n\nexport const useFeedbackContext = (): FeedbackContext =>\n useContext(feedbackContext);\n\ninterface FeedbackContextProviderProps extends WithChildren {\n value: FeedbackContext;\n}\n\nexport const FeedbackContextProvider: FC<FeedbackContextProviderProps> = ({\n value,\n children,\n}) => (\n <feedbackContext.Provider value={value}>\n {children}\n </feedbackContext.Provider>\n);\n"],"names":["feedbackContext","createContext","feedbackSubmitted","followupStarted","followupSubmitted","contactSubmitted","setFeedbackSubmitted","setFollowupStarted","setFollowupSubmitted","setContactSubmitted","useFeedbackContext","useContext","FeedbackContextProvider","value","children","jsx","Provider"],"mappings":"8FAgBA,MAWMA,EAAkBC,EAXc,CAClCC,mBAAmB,EACnBC,iBAAiB,EACjBC,mBAAmB,EACnBC,kBAAkB,EAClBC,qBAAsB,IAAM,KAC5BC,mBAAoB,IAAM,KAC1BC,qBAAsB,IAAM,KAC5BC,oBAAqB,IAAM,OAKlBC,EAAqB,IAC9BC,EAAWX,GAMFY,EAA4D,EACrEC,MAAAA,EACAC,SAAAA,KAEAC,EAACf,EAAgBgB,SAAhB,CAAyBH,MAAAA,EACrBC,SAAAA"}
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { WithChildren } from '../../../core/types.js';
2
+ import { WithChildren } from '../../../utilities/types.js';
3
3
  import { FollowupState } from '../types.js';
4
4
  export declare const useFollowUpContext: () => FollowupState | undefined;
5
5
  interface FollowupContextProviderProps extends WithChildren {
@@ -1 +1 @@
1
- {"version":3,"file":"followupContext.js","sources":["../../../../../src/components/feedback/followup/followupContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { FollowupState } from \"../types.js\";\n\nconst followUpContext = createContext<FollowupState | undefined>(undefined);\n\nexport const useFollowUpContext = (): FollowupState | undefined =>\n useContext(followUpContext);\n\ninterface FollowupContextProviderProps extends WithChildren {\n state: FollowupState;\n}\n\nexport const FollowUpProvider: React.FC<FollowupContextProviderProps> = ({\n state,\n children,\n}) => (\n <followUpContext.Provider value={state}>\n {children}\n </followUpContext.Provider>\n);\n"],"names":["followUpContext","createContext","useFollowUpContext","useContext","FollowUpProvider","state","children","Provider","value"],"mappings":"8FAIA,MAAMA,EAAkBC,OAAyC,GAEpDC,EAAqB,IAC9BC,EAAWH,GAMFI,EAA2D,EACpEC,MAAAA,EACAC,SAAAA,OAECN,EAAgBO,SAAhB,CAAyBC,MAAOH,EAC5BC,SAAAA"}
1
+ {"version":3,"file":"followupContext.js","sources":["../../../../../src/components/feedback/followup/followupContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../utilities/types.js\";\nimport type { FollowupState } from \"../types.js\";\n\nconst followUpContext = createContext<FollowupState | undefined>(undefined);\n\nexport const useFollowUpContext = (): FollowupState | undefined =>\n useContext(followUpContext);\n\ninterface FollowupContextProviderProps extends WithChildren {\n state: FollowupState;\n}\n\nexport const FollowUpProvider: React.FC<FollowupContextProviderProps> = ({\n state,\n children,\n}) => (\n <followUpContext.Provider value={state}>\n {children}\n </followUpContext.Provider>\n);\n"],"names":["followUpContext","createContext","useFollowUpContext","useContext","FollowUpProvider","state","children","Provider","value"],"mappings":"8FAIA,MAAMA,EAAkBC,OAAyC,GAEpDC,EAAqB,IAC9BC,EAAWH,GAMFI,EAA2D,EACpEC,MAAAA,EACAC,SAAAA,OAECN,EAAgBO,SAAhB,CAAyBC,MAAOH,EAC5BC,SAAAA"}
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { WithChildren } from '../../../core/types.js';
2
+ import { WithChildren } from '../../../utilities/types.js';
3
3
  import { FeedbackState } from '../types.js';
4
4
  export declare const useMainQuestionContext: () => FeedbackState | undefined;
5
5
  interface Props extends WithChildren {
@@ -1 +1 @@
1
- {"version":3,"file":"mainQuestionContext.js","sources":["../../../../../src/components/feedback/main-question/mainQuestionContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { FeedbackState } from \"../types.js\";\n\nconst mainQuestionContext = createContext<FeedbackState | undefined>(undefined);\n\nexport const useMainQuestionContext = (): FeedbackState | undefined =>\n useContext(mainQuestionContext);\n\ninterface Props extends WithChildren {\n state: FeedbackState;\n}\n\nexport const MainQuestionContextProvider: React.FC<Props> = ({\n state,\n children,\n}) => (\n <mainQuestionContext.Provider value={state}>\n {children}\n </mainQuestionContext.Provider>\n);\n"],"names":["mainQuestionContext","createContext","useMainQuestionContext","useContext","MainQuestionContextProvider","state","children","Provider","value"],"mappings":"8FAIA,MAAMA,EAAsBC,OAAyC,GAExDC,EAAyB,IAClCC,EAAWH,GAMFI,EAA+C,EACxDC,MAAAA,EACAC,SAAAA,OAECN,EAAoBO,SAApB,CAA6BC,MAAOH,EAChCC,SAAAA"}
1
+ {"version":3,"file":"mainQuestionContext.js","sources":["../../../../../src/components/feedback/main-question/mainQuestionContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../utilities/types.js\";\nimport type { FeedbackState } from \"../types.js\";\n\nconst mainQuestionContext = createContext<FeedbackState | undefined>(undefined);\n\nexport const useMainQuestionContext = (): FeedbackState | undefined =>\n useContext(mainQuestionContext);\n\ninterface Props extends WithChildren {\n state: FeedbackState;\n}\n\nexport const MainQuestionContextProvider: React.FC<Props> = ({\n state,\n children,\n}) => (\n <mainQuestionContext.Provider value={state}>\n {children}\n </mainQuestionContext.Provider>\n);\n"],"names":["mainQuestionContext","createContext","useMainQuestionContext","useContext","MainQuestionContextProvider","state","children","Provider","value"],"mappings":"8FAIA,MAAMA,EAAsBC,OAAyC,GAExDC,EAAyB,IAClCC,EAAWH,GAMFI,EAA+C,EACxDC,MAAAA,EACAC,SAAAA,OAECN,EAAoBO,SAApB,CAA6BC,MAAOH,EAChCC,SAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"smileyUtils.js","sources":["../../../../../src/components/feedback/questions/smileyUtils.tsx"],"sourcesContent":["import React, { type FC } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { FeedbackOption } from \"../types.js\";\n\nexport const defaultOptions: FeedbackOption<number>[] = [\n {\n label: \"Veldig misfornøyd\",\n value: 1,\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Litt misfornøyd\",\n value: 2,\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Midt på treet\",\n value: 3,\n textAreaLabel:\n \"Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Ganske fornøyd\",\n value: 4,\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Veldig fornøyd\",\n value: 5,\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n];\n\nconst Smiley: FC<WithChildren> = ({ children }) => (\n <svg\n className=\"jkl-feedback-smiley-option__icon\"\n aria-hidden\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"20\" cy=\"20\" r=\"19\" stroke=\"currentColor\" strokeWidth=\"2\" />\n {children}\n </svg>\n);\n\nconst VeldigSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 30C10 24.4772 14.4772 20 20 20C25.5228 20 30 24.4772 30 30\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M10 13.9865H16.6667\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <path\n d=\"M23.3333 13.9865H29.9999\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n </Smiley>\n);\n\nconst LittSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 28.75C10 28.75 13.75 23.3334 20 23.3334C26.25 23.3334 30 28.75 30 28.75\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst NoytralSmiley = () => (\n <Smiley>\n <path\n d=\"M9.15283 25.6986H30.8477\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst LittGladSmiley = () => (\n <Smiley>\n <path\n d=\"M10 23.3334C10 23.3334 12.9167 30 20 30C27.0833 30 30 23.3334 30 23.3334\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst VeldigGladSmiley = () => (\n <Smiley>\n <path\n d=\"M30 21C30 26.5228 25.5228 31 20 31C14.4772 31 10 26.5228 10 21\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M24 14.5H29\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nexport const getSmiley = (value: number) => {\n switch (value) {\n case 1:\n return <VeldigSurSmiley />;\n case 2:\n return <LittSurSmiley />;\n case 3:\n return <NoytralSmiley />;\n case 4:\n return <LittGladSmiley />;\n case 5:\n return <VeldigGladSmiley />;\n\n default:\n return <NoytralSmiley />;\n }\n};\n"],"names":["defaultOptions","label","value","textAreaLabel","Smiley","children","jsxs","className","viewBox","fill","xmlns","jsx","cx","cy","r","stroke","strokeWidth","VeldigSurSmiley","d","LittSurSmiley","NoytralSmiley","LittGladSmiley","VeldigGladSmiley","getSmiley"],"mappings":"gEAIO,MAAMA,EAA2C,CACpD,CACIC,MAAO,oBACPC,MAAO,EACPC,cACI,sFAER,CACIF,MAAO,kBACPC,MAAO,EACPC,cACI,sFAER,CACIF,MAAO,gBACPC,MAAO,EACPC,cACI,wEAER,CACIF,MAAO,iBACPC,MAAO,EACPC,cACI,+DAER,CACIF,MAAO,iBACPC,MAAO,EACPC,cACI,gEAINC,EAA2B,EAAGC,SAAAA,KAChCC,EAAC,MAAA,CACGC,UAAU,mCACV,eAAW,EACXC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENL,SAAA,CAAAM,EAAC,SAAA,CAAOC,GAAG,KAAKC,GAAG,KAAKC,EAAE,KAAKC,OAAO,eAAeC,YAAY,MAChEX,KAIHY,EAAkB,IACpBX,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,iEACFH,OAAO,eACPC,YAAY,QAEf,OAAA,CAAKE,EAAE,sBAAsBH,OAAO,eAAeC,YAAY,MAChEL,EAAC,OAAA,CACGO,EAAE,2BACFH,OAAO,eACPC,YAAY,SAKlBG,EAAgB,IAClBb,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,8EACFH,OAAO,eACPC,YAAY,MAEhBL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3CW,EAAgB,IAClBd,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,2BACFH,OAAO,eACPC,YAAY,MAEhBL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3CY,EAAiB,IACnBf,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,2EACFH,OAAO,eACPC,YAAY,MAEhBL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3Ca,EAAmB,IACrBhB,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,iEACFH,OAAO,eACPC,YAAY,QAEf,OAAA,CAAKE,EAAE,cAAcH,OAAO,eAAeC,YAAY,MACxDL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAIpCc,EAAarB,IACtB,OAAQA,GACJ,KAAK,EACD,SAAQe,EAAA,IACZ,KAAK,EACD,SAAQE,EAAA,IACZ,KAAK,EAOL,QACI,SAAQC,EAAA,IANZ,KAAK,EACD,SAAQC,EAAA,IACZ,KAAK,EACD,SAAQC,EAAA"}
1
+ {"version":3,"file":"smileyUtils.js","sources":["../../../../../src/components/feedback/questions/smileyUtils.tsx"],"sourcesContent":["import React, { type FC } from \"react\";\nimport type { WithChildren } from \"../../../utilities/types.js\";\nimport type { FeedbackOption } from \"../types.js\";\n\nexport const defaultOptions: FeedbackOption<number>[] = [\n {\n label: \"Veldig misfornøyd\",\n value: 1,\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Litt misfornøyd\",\n value: 2,\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Midt på treet\",\n value: 3,\n textAreaLabel:\n \"Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Ganske fornøyd\",\n value: 4,\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Veldig fornøyd\",\n value: 5,\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n];\n\nconst Smiley: FC<WithChildren> = ({ children }) => (\n <svg\n className=\"jkl-feedback-smiley-option__icon\"\n aria-hidden\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"20\" cy=\"20\" r=\"19\" stroke=\"currentColor\" strokeWidth=\"2\" />\n {children}\n </svg>\n);\n\nconst VeldigSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 30C10 24.4772 14.4772 20 20 20C25.5228 20 30 24.4772 30 30\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M10 13.9865H16.6667\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <path\n d=\"M23.3333 13.9865H29.9999\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n </Smiley>\n);\n\nconst LittSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 28.75C10 28.75 13.75 23.3334 20 23.3334C26.25 23.3334 30 28.75 30 28.75\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst NoytralSmiley = () => (\n <Smiley>\n <path\n d=\"M9.15283 25.6986H30.8477\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst LittGladSmiley = () => (\n <Smiley>\n <path\n d=\"M10 23.3334C10 23.3334 12.9167 30 20 30C27.0833 30 30 23.3334 30 23.3334\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst VeldigGladSmiley = () => (\n <Smiley>\n <path\n d=\"M30 21C30 26.5228 25.5228 31 20 31C14.4772 31 10 26.5228 10 21\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M24 14.5H29\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nexport const getSmiley = (value: number) => {\n switch (value) {\n case 1:\n return <VeldigSurSmiley />;\n case 2:\n return <LittSurSmiley />;\n case 3:\n return <NoytralSmiley />;\n case 4:\n return <LittGladSmiley />;\n case 5:\n return <VeldigGladSmiley />;\n\n default:\n return <NoytralSmiley />;\n }\n};\n"],"names":["defaultOptions","label","value","textAreaLabel","Smiley","children","jsxs","className","viewBox","fill","xmlns","jsx","cx","cy","r","stroke","strokeWidth","VeldigSurSmiley","d","LittSurSmiley","NoytralSmiley","LittGladSmiley","VeldigGladSmiley","getSmiley"],"mappings":"gEAIO,MAAMA,EAA2C,CACpD,CACIC,MAAO,oBACPC,MAAO,EACPC,cACI,sFAER,CACIF,MAAO,kBACPC,MAAO,EACPC,cACI,sFAER,CACIF,MAAO,gBACPC,MAAO,EACPC,cACI,wEAER,CACIF,MAAO,iBACPC,MAAO,EACPC,cACI,+DAER,CACIF,MAAO,iBACPC,MAAO,EACPC,cACI,gEAINC,EAA2B,EAAGC,SAAAA,KAChCC,EAAC,MAAA,CACGC,UAAU,mCACV,eAAW,EACXC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENL,SAAA,CAAAM,EAAC,SAAA,CAAOC,GAAG,KAAKC,GAAG,KAAKC,EAAE,KAAKC,OAAO,eAAeC,YAAY,MAChEX,KAIHY,EAAkB,IACpBX,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,iEACFH,OAAO,eACPC,YAAY,QAEf,OAAA,CAAKE,EAAE,sBAAsBH,OAAO,eAAeC,YAAY,MAChEL,EAAC,OAAA,CACGO,EAAE,2BACFH,OAAO,eACPC,YAAY,SAKlBG,EAAgB,IAClBb,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,8EACFH,OAAO,eACPC,YAAY,MAEhBL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3CW,EAAgB,IAClBd,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,2BACFH,OAAO,eACPC,YAAY,MAEhBL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3CY,EAAiB,IACnBf,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,2EACFH,OAAO,eACPC,YAAY,MAEhBL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3Ca,EAAmB,IACrBhB,EAACF,EAAA,CACGC,SAAA,CAAAM,EAAC,OAAA,CACGO,EAAE,iEACFH,OAAO,eACPC,YAAY,QAEf,OAAA,CAAKE,EAAE,cAAcH,OAAO,eAAeC,YAAY,MACxDL,EAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAIpCc,EAAarB,IACtB,OAAQA,GACJ,KAAK,EACD,SAAQe,EAAA,IACZ,KAAK,EACD,SAAQE,EAAA,IACZ,KAAK,EAOL,QACI,SAAQC,EAAA,IANZ,KAAK,EACD,SAAQC,EAAA,IACZ,KAAK,EACD,SAAQC,EAAA"}
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { WithChildren } from '../../../core/types.js';
2
+ import { WithChildren } from '../../../utilities/types.js';
3
3
  interface DropzoneProps extends WithChildren {
4
4
  }
5
5
  export declare const Dropzone: React.ForwardRefExoticComponent<DropzoneProps & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.js","sources":["../../../../../src/components/file-input/internal/Dropzone.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useState } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { UploadedFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFileInputFiles } from \"./validateFileInputFiles.js\";\n\ninterface DropzoneProps extends WithChildren {}\n\nexport const Dropzone = forwardRef<HTMLDivElement, DropzoneProps>(\n (props, ref) => {\n const { children, ...rest } = props;\n const [onDragClassName, setOnDragClassName] = useState<string>(\"\");\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>\n Dropzone must be placed inside a FileInputContextProvider.\n </p>\n );\n }\n const { maxSizeBytes, accept, onChange } = context;\n\n return (\n <div\n {...rest}\n ref={ref}\n className={clsx(\"jkl-file-input__dropzone\", onDragClassName)}\n onDragEnter={(e) => {\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDragOver={(e) => {\n /* Prevent browser from opening file in a new tab */\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDrop={(e) => {\n e.preventDefault();\n setOnDragClassName(\"\");\n\n if (e.dataTransfer.files) {\n onChange(\n e,\n [...e.dataTransfer.files].map<UploadedFile>(\n (file) => ({\n file,\n state: undefined,\n validation: validateFileInputFiles(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n onDragLeave={(e) => {\n setOnDragClassName(\"\");\n e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nDropzone.displayName = \"Dropzone\";\n"],"names":["Dropzone","forwardRef","props","ref","children","rest","onDragClassName","setOnDragClassName","useState","context","useFileInputContext","jsx","maxSizeBytes","accept","onChange","className","clsx","onDragEnter","e","preventDefault","onDragOver","onDrop","dataTransfer","files","map","file","state","validation","validateFileInputFiles","uploadProgress","onDragLeave","displayName"],"mappings":"2QASO,MAAMA,EAAWC,EACpB,CAACC,EAAOC,KACJ,MAAQC,SAAAA,KAAaC,GAASH,GACvBI,EAAiBC,GAAsBC,EAAiB,IAEzDC,EAAUC,IAChB,IAAKD,EACD,OACIE,EAAC,KAAEP,SAAA,+DAKX,MAAQQ,aAAAA,EAAcC,OAAAA,EAAQC,SAAAA,GAAaL,EAE3C,OACIE,EAAC,MAAA,IACON,EACJF,IAAAA,EACAY,UAAWC,EAAK,2BAA4BV,GAC5CW,YAAcC,IACVX,EAAmB,mCACnBW,EAAEC,kBAENC,WAAaF,IAETX,EAAmB,mCACnBW,EAAEC,kBAENE,OAASH,IACLA,EAAEC,iBACFZ,EAAmB,IAEfW,EAAEI,aAAaC,OACfT,EACII,EACA,IAAIA,EAAEI,aAAaC,OAAOC,IACrBC,IAAAA,CACGA,KAAAA,EACAC,WAAO,EACPC,WAAYC,EACRH,EACAZ,EACAD,GAEJiB,eAAgB,OAMpCC,YAAcZ,IACVX,EAAmB,IACnBW,EAAEC,kBAGLf,SAAAA,MAMjBJ,EAAS+B,YAAc"}
1
+ {"version":3,"file":"Dropzone.js","sources":["../../../../../src/components/file-input/internal/Dropzone.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useState } from \"react\";\nimport type { WithChildren } from \"../../../utilities/types.js\";\nimport type { UploadedFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFileInputFiles } from \"./validateFileInputFiles.js\";\n\ninterface DropzoneProps extends WithChildren {}\n\nexport const Dropzone = forwardRef<HTMLDivElement, DropzoneProps>(\n (props, ref) => {\n const { children, ...rest } = props;\n const [onDragClassName, setOnDragClassName] = useState<string>(\"\");\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>\n Dropzone must be placed inside a FileInputContextProvider.\n </p>\n );\n }\n const { maxSizeBytes, accept, onChange } = context;\n\n return (\n <div\n {...rest}\n ref={ref}\n className={clsx(\"jkl-file-input__dropzone\", onDragClassName)}\n onDragEnter={(e) => {\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDragOver={(e) => {\n /* Prevent browser from opening file in a new tab */\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDrop={(e) => {\n e.preventDefault();\n setOnDragClassName(\"\");\n\n if (e.dataTransfer.files) {\n onChange(\n e,\n [...e.dataTransfer.files].map<UploadedFile>(\n (file) => ({\n file,\n state: undefined,\n validation: validateFileInputFiles(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n onDragLeave={(e) => {\n setOnDragClassName(\"\");\n e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nDropzone.displayName = \"Dropzone\";\n"],"names":["Dropzone","forwardRef","props","ref","children","rest","onDragClassName","setOnDragClassName","useState","context","useFileInputContext","jsx","maxSizeBytes","accept","onChange","className","clsx","onDragEnter","e","preventDefault","onDragOver","onDrop","dataTransfer","files","map","file","state","validation","validateFileInputFiles","uploadProgress","onDragLeave","displayName"],"mappings":"2QASO,MAAMA,EAAWC,EACpB,CAACC,EAAOC,KACJ,MAAQC,SAAAA,KAAaC,GAASH,GACvBI,EAAiBC,GAAsBC,EAAiB,IAEzDC,EAAUC,IAChB,IAAKD,EACD,OACIE,EAAC,KAAEP,SAAA,+DAKX,MAAQQ,aAAAA,EAAcC,OAAAA,EAAQC,SAAAA,GAAaL,EAE3C,OACIE,EAAC,MAAA,IACON,EACJF,IAAAA,EACAY,UAAWC,EAAK,2BAA4BV,GAC5CW,YAAcC,IACVX,EAAmB,mCACnBW,EAAEC,kBAENC,WAAaF,IAETX,EAAmB,mCACnBW,EAAEC,kBAENE,OAASH,IACLA,EAAEC,iBACFZ,EAAmB,IAEfW,EAAEI,aAAaC,OACfT,EACII,EACA,IAAIA,EAAEI,aAAaC,OAAOC,IACrBC,IAAAA,CACGA,KAAAA,EACAC,WAAO,EACPC,WAAYC,EACRH,EACAZ,EACAD,GAEJiB,eAAgB,OAMpCC,YAAcZ,IACVX,EAAmB,IACnBW,EAAEC,kBAGLf,SAAAA,MAMjBJ,EAAS+B,YAAc"}
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { WithChildren } from '../../../core/types.js';
2
+ import { WithChildren } from '../../../utilities/types.js';
3
3
  import { UploadedFile } from '../types.js';
4
4
  type FileInputContext = {
5
5
  accept?: "image/*" | ".pdf" | "image/*,.pdf" | HTMLInputElement["accept"];
@@ -1 +1 @@
1
- {"version":3,"file":"fileInputContext.js","sources":["../../../../../src/components/file-input/internal/fileInputContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { UploadedFile } from \"../types.js\";\n\ntype FileInputContext = {\n accept?: \"image/*\" | \".pdf\" | \"image/*,.pdf\" | HTMLInputElement[\"accept\"];\n maxSizeBytes?: number;\n files: UploadedFile[];\n onChange: (\n e:\n | React.ChangeEvent<HTMLInputElement>\n | React.DragEvent<HTMLDivElement>,\n files: UploadedFile[],\n ) => void;\n};\n\nconst fileInputContext = createContext<FileInputContext | null>(null);\n\nexport const useFileInputContext = (): FileInputContext | null =>\n useContext(fileInputContext);\n\nexport interface FileInputContextProviderProps extends WithChildren {\n context: FileInputContext;\n}\n\nexport const FileInputContextProvider: React.FC<\n FileInputContextProviderProps\n> = ({ context, children }) => (\n <fileInputContext.Provider value={context}>\n {children}\n </fileInputContext.Provider>\n);\n"],"names":["fileInputContext","createContext","useFileInputContext","useContext","FileInputContextProvider","context","children","jsx","Provider","value"],"mappings":"8FAgBA,MAAMA,EAAmBC,EAAuC,MAEnDC,EAAsB,IAC/BC,EAAWH,GAMFI,EAET,EAAGC,QAAAA,EAASC,SAAAA,KACZC,EAACP,EAAiBQ,SAAjB,CAA0BC,MAAOJ,EAC7BC,SAAAA"}
1
+ {"version":3,"file":"fileInputContext.js","sources":["../../../../../src/components/file-input/internal/fileInputContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../utilities/types.js\";\nimport type { UploadedFile } from \"../types.js\";\n\ntype FileInputContext = {\n accept?: \"image/*\" | \".pdf\" | \"image/*,.pdf\" | HTMLInputElement[\"accept\"];\n maxSizeBytes?: number;\n files: UploadedFile[];\n onChange: (\n e:\n | React.ChangeEvent<HTMLInputElement>\n | React.DragEvent<HTMLDivElement>,\n files: UploadedFile[],\n ) => void;\n};\n\nconst fileInputContext = createContext<FileInputContext | null>(null);\n\nexport const useFileInputContext = (): FileInputContext | null =>\n useContext(fileInputContext);\n\nexport interface FileInputContextProviderProps extends WithChildren {\n context: FileInputContext;\n}\n\nexport const FileInputContextProvider: React.FC<\n FileInputContextProviderProps\n> = ({ context, children }) => (\n <fileInputContext.Provider value={context}>\n {children}\n </fileInputContext.Provider>\n);\n"],"names":["fileInputContext","createContext","useFileInputContext","useContext","FileInputContextProvider","context","children","jsx","Provider","value"],"mappings":"8FAgBA,MAAMA,EAAmBC,EAAuC,MAEnDC,EAAsB,IAC/BC,EAAWH,GAMFI,EAET,EAAGC,QAAAA,EAASC,SAAAA,KACZC,EAACP,EAAiBQ,SAAjB,CAA0BC,MAAOJ,EAC7BC,SAAAA"}
@@ -1,5 +1,5 @@
1
1
  import { default as React, CSSProperties } from 'react';
2
- import { WithChildren } from '../../../../core/types.js';
2
+ import { WithChildren } from '../../../../utilities/types.js';
3
3
  interface IconsExampleGridProps extends WithChildren {
4
4
  columns: "two" | "four";
5
5
  style?: CSSProperties;
@@ -1,10 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  import { InputProps } from './types.js';
3
- export declare const InputGroup: React.ForwardRefExoticComponent<import('../../index.js').WithOptionalChildren & import('../../index.js').DataTestAutoId & {
3
+ export declare const InputGroup: React.ForwardRefExoticComponent<import('../../utilities/types.js').WithOptionalChildren & import('../../utilities/types.js').DataTestAutoId & {
4
4
  id?: string;
5
5
  className?: string;
6
6
  "data-testid"?: string;
7
- "data-size"?: import('../../core/types.js').Size;
7
+ "data-size"?: import('../../utilities/types.js').Size;
8
8
  errorLabel?: React.ReactNode;
9
9
  helpLabel?: React.ReactNode;
10
10
  inline?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, FieldsetHTMLAttributes, ReactNode } from 'react';
2
- import { DataTestAutoId, Size, WithChildren, WithOptionalChildren } from '../../core/types.js';
2
+ import { DataTestAutoId, Size, WithChildren, WithOptionalChildren } from '../../utilities/types.js';
3
3
  export interface FieldGroupProps extends DataTestAutoId, FieldsetHTMLAttributes<HTMLFieldSetElement> {
4
4
  legend: string;
5
5
  labelProps?: Omit<LabelProps, "children">;
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { LinkElementType, LinkProps } from './types.js';
3
- type LinkComponent = <ElementType extends LinkElementType = "a">(props: LinkProps<ElementType>) => React.ReactElement | null;
2
+ import { LinkProps } from './types.js';
3
+ type LinkComponent = <ElementType extends React.ElementType = "a">(props: LinkProps<ElementType>) => React.ReactElement | null;
4
4
  export declare const Link: LinkComponent;
5
5
  export {};
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as a}from"react/jsx-runtime";import{c as r}from"../../../clsx-BeLtu-UY.js";import s,{useId as n}from"react";const t=s.forwardRef(function(s,t){const{external:i=!1,className:l="",children:c,as:o="a",...d}=s,k="string"==typeof o&&"a"!==o?"a":o,m=n();return e(k,{ref:t,className:r("jkl-link",l,{"jkl-link--external":i}),"aria-describedby":i?m:void 0,...d,children:[a("span",{className:"jkl-link__content",children:c}),(i||"_blank"===d.target)&&a("span",{hidden:!0,id:m,children:"Ekstern lenke"})]})});export{t as Link};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import{c as s}from"../../../clsx-BeLtu-UY.js";import a,{useId as n}from"react";const i=a.forwardRef(function(a,i){const{external:l=!1,className:t="",children:c,as:o="a",...d}=a,k=o,m=n();return e(k,{ref:i,className:s("jkl-link",t,{"jkl-link--external":l}),"aria-describedby":l?m:void 0,...d,children:[r("span",{className:"jkl-link__content",children:c}),(l||"_blank"===d.target)&&r("span",{hidden:!0,id:m,children:"Ekstern lenke"})]})});export{i as Link};
2
2
  //# sourceMappingURL=Link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sources":["../../../../src/components/link/Link.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport React, { useId } from \"react\";\nimport type { PolymorphicRef } from \"../../utilities/polymorphism/polymorphism.js\";\nimport type { LinkElementType, LinkProps } from \"./types.js\";\n\ntype LinkComponent = <ElementType extends LinkElementType = \"a\">(\n props: LinkProps<ElementType>,\n) => React.ReactElement | null;\n\nexport const Link = React.forwardRef(function Link<\n ElementType extends LinkElementType = \"a\",\n>(props: LinkProps<ElementType>, ref?: PolymorphicRef<ElementType>) {\n const {\n external = false,\n className = \"\",\n children,\n as = \"a\",\n ...rest\n } = props;\n const Component = typeof as === \"string\" && as !== \"a\" ? \"a\" : as;\n\n const srId = useId();\n\n return (\n <Component\n ref={ref}\n className={clsx(\"jkl-link\", className, {\n \"jkl-link--external\": external,\n })}\n aria-describedby={external ? srId : undefined}\n {...rest}\n >\n <span className=\"jkl-link__content\">{children}</span>\n {(external || rest.target === \"_blank\") && (\n <span hidden={true} id={srId}>\n Ekstern lenke\n </span>\n )}\n </Component>\n );\n}) as LinkComponent;\n"],"names":["Link","React","forwardRef","props","ref","external","className","children","as","rest","Component","srId","useId","jsxs","clsx","jsx","target","hidden","id"],"mappings":"iIASO,MAAMA,EAAOC,EAAMC,WAAW,SAEnCC,EAA+BC,GAC7B,MACIC,SAAAA,GAAW,EACXC,UAAAA,EAAY,GACZC,SAAAA,EACAC,GAAAA,EAAK,OACFC,GACHN,EACEO,EAA0B,iBAAPF,GAA0B,MAAPA,EAAa,IAAMA,EAEzDG,EAAOC,IAEb,OACIC,EAACH,EAAA,CACGN,IAAAA,EACAE,UAAWQ,EAAK,WAAYR,EAAW,CACnC,qBAAsBD,IAE1B,mBAAkBA,EAAWM,OAAO,KAChCF,EAEJF,SAAA,CAAAQ,EAAC,OAAA,CAAKT,UAAU,oBAAqBC,SAAAA,KACnCF,GAA4B,WAAhBI,EAAKO,SACfD,EAAC,QAAKE,QAAQ,EAAMC,GAAIP,EAAMJ,SAAA,oBAM9C"}
1
+ {"version":3,"file":"Link.js","sources":["../../../../src/components/link/Link.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport React, { useId } from \"react\";\nimport type { PolymorphicRef } from \"../../utilities/polymorphism/polymorphism.js\";\nimport type { LinkProps } from \"./types.js\";\n\ntype LinkComponent = <ElementType extends React.ElementType = \"a\">(\n props: LinkProps<ElementType>,\n) => React.ReactElement | null;\n\nexport const Link = React.forwardRef(function Link<\n ElementType extends React.ElementType = \"a\",\n>(props: LinkProps<ElementType>, ref?: PolymorphicRef<ElementType>) {\n const {\n external = false,\n className = \"\",\n children,\n as = \"a\",\n ...rest\n } = props;\n const Component = as;\n\n const srId = useId();\n\n return (\n <Component\n ref={ref}\n className={clsx(\"jkl-link\", className, {\n \"jkl-link--external\": external,\n })}\n aria-describedby={external ? srId : undefined}\n {...rest}\n >\n <span className=\"jkl-link__content\">{children}</span>\n {(external || rest.target === \"_blank\") && (\n <span hidden={true} id={srId}>\n Ekstern lenke\n </span>\n )}\n </Component>\n );\n}) as LinkComponent;\n"],"names":["Link","React","forwardRef","props","ref","external","className","children","as","rest","Component","srId","useId","jsxs","clsx","jsx","target","hidden","id"],"mappings":"iIASO,MAAMA,EAAOC,EAAMC,WAAW,SAEnCC,EAA+BC,GAC7B,MACIC,SAAAA,GAAW,EACXC,UAAAA,EAAY,GACZC,SAAAA,EACAC,GAAAA,EAAK,OACFC,GACHN,EACEO,EAAYF,EAEZG,EAAOC,IAEb,OACIC,EAACH,EAAA,CACGN,IAAAA,EACAE,UAAWQ,EAAK,WAAYR,EAAW,CACnC,qBAAsBD,IAE1B,mBAAkBA,EAAWM,OAAO,KAChCF,EAEJF,SAAA,CAAAQ,EAAC,OAAA,CAAKT,UAAU,oBAAqBC,SAAAA,KACnCF,GAA4B,WAAhBI,EAAKO,SACfD,EAAC,QAAKE,QAAQ,EAAMC,GAAIP,EAAMJ,SAAA,oBAM9C"}
@@ -1,7 +1,4 @@
1
1
  import { PolymorphicPropsWithRef } from '../../utilities/polymorphism/polymorphism.js';
2
- type LinkComponentElementType = Exclude<React.ElementType, keyof React.JSX.IntrinsicElements>;
3
- export type LinkElementType = "a" | LinkComponentElementType;
4
- export type LinkProps<ElementType extends LinkElementType = "a"> = PolymorphicPropsWithRef<ElementType, {
2
+ export type LinkProps<ElementType extends React.ElementType> = PolymorphicPropsWithRef<ElementType, {
5
3
  external?: boolean;
6
4
  }>;
7
- export {};
@@ -2,5 +2,5 @@ import { default as React } from 'react';
2
2
  import { LinkListProps } from './types.js';
3
3
  export declare const LinkList: {
4
4
  ({ label, hideLabel, className, ...rest }: LinkListProps): React.JSX.Element;
5
- Link: React.ForwardRefExoticComponent<Omit<import('../../index.js').PolymorphicPropsWithRef<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
5
+ Link: React.ForwardRefExoticComponent<Omit<import('../../utilities/index.js').PolymorphicPropsWithRef<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { WithChildren } from '../../core/types.js';
2
+ import { WithChildren } from '../../utilities/types.js';
3
3
  export interface ListItemProps extends WithChildren {
4
4
  className?: string;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","sources":["../../../../src/components/list/ListItem.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { type FC } from \"react\";\nimport type { WithChildren } from \"../../core/types.js\";\n\nexport interface ListItemProps extends WithChildren {\n className?: string;\n}\n\ntype ValidListItems = \"normal\" | \"check\" | \"cross\";\n\nfunction makeListItem(listItemType: ValidListItems): FC<ListItemProps> {\n const ListItem: FC<ListItemProps> = ({ className, children, ...rest }) => {\n return (\n <li\n className={clsx(\"jkl-list__item\", className, {\n \"jkl-list__item--iconed\": listItemType !== \"normal\",\n \"jkl-list__item--check\": listItemType === \"check\",\n \"jkl-list__item--cross\": listItemType === \"cross\",\n })}\n data-testid=\"jkl-list-item\"\n {...rest}\n >\n {children}\n </li>\n );\n };\n return ListItem;\n}\n\nexport const ListItem = makeListItem(\"normal\");\nListItem.displayName = \"ListItem\";\nexport const CrossListItem = makeListItem(\"cross\");\nCrossListItem.displayName = \"CrossListItem\";\nexport const CheckListItem = makeListItem(\"check\");\nCheckListItem.displayName = \"CheckListItem\";\n"],"names":["makeListItem","listItemType","className","children","rest","jsx","clsx","ListItem","displayName","CrossListItem","CheckListItem"],"mappings":"oGAUA,SAASA,EAAaC,GAgBlB,MAfoC,EAAGC,UAAAA,EAAWC,SAAAA,KAAaC,KAEvDC,EAAC,KAAA,CACGH,UAAWI,EAAK,iBAAkBJ,EAAW,CACzC,yBAA2C,WAAjBD,EAC1B,wBAA0C,UAAjBA,EACzB,wBAA0C,UAAjBA,IAE7B,cAAY,mBACRG,EAEHD,SAAAA,GAKjB,CAEO,MAAMI,EAAWP,EAAa,UACrCO,EAASC,YAAc,WAChB,MAAMC,EAAgBT,EAAa,SAC1CS,EAAcD,YAAc,gBACrB,MAAME,EAAgBV,EAAa,SAC1CU,EAAcF,YAAc"}
1
+ {"version":3,"file":"ListItem.js","sources":["../../../../src/components/list/ListItem.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { type FC } from \"react\";\nimport type { WithChildren } from \"../../utilities/types.js\";\n\nexport interface ListItemProps extends WithChildren {\n className?: string;\n}\n\ntype ValidListItems = \"normal\" | \"check\" | \"cross\";\n\nfunction makeListItem(listItemType: ValidListItems): FC<ListItemProps> {\n const ListItem: FC<ListItemProps> = ({ className, children, ...rest }) => {\n return (\n <li\n className={clsx(\"jkl-list__item\", className, {\n \"jkl-list__item--iconed\": listItemType !== \"normal\",\n \"jkl-list__item--check\": listItemType === \"check\",\n \"jkl-list__item--cross\": listItemType === \"cross\",\n })}\n data-testid=\"jkl-list-item\"\n {...rest}\n >\n {children}\n </li>\n );\n };\n return ListItem;\n}\n\nexport const ListItem = makeListItem(\"normal\");\nListItem.displayName = \"ListItem\";\nexport const CrossListItem = makeListItem(\"cross\");\nCrossListItem.displayName = \"CrossListItem\";\nexport const CheckListItem = makeListItem(\"check\");\nCheckListItem.displayName = \"CheckListItem\";\n"],"names":["makeListItem","listItemType","className","children","rest","jsx","clsx","ListItem","displayName","CrossListItem","CheckListItem"],"mappings":"oGAUA,SAASA,EAAaC,GAgBlB,MAfoC,EAAGC,UAAAA,EAAWC,SAAAA,KAAaC,KAEvDC,EAAC,KAAA,CACGH,UAAWI,EAAK,iBAAkBJ,EAAW,CACzC,yBAA2C,WAAjBD,EAC1B,wBAA0C,UAAjBA,EACzB,wBAA0C,UAAjBA,IAE7B,cAAY,mBACRG,EAEHD,SAAAA,GAKjB,CAEO,MAAMI,EAAWP,EAAa,UACrCO,EAASC,YAAc,WAChB,MAAMC,EAAgBT,EAAa,SAC1CS,EAAcD,YAAc,gBACrB,MAAME,EAAgBV,EAAa,SAC1CU,EAAcF,YAAc"}
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from 'react';
2
- import { WithChildren } from '../../core/types.js';
2
+ import { WithChildren } from '../../utilities/types.js';
3
3
  export interface LogoProps {
4
4
  className?: string;
5
5
  id?: string;
@@ -1,8 +1,8 @@
1
1
  import { Placement } from '@floating-ui/react';
2
2
  import { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
3
- import { DataTestAutoId, WithChildren } from '../../core/types.js';
4
3
  import { SwipeChangeHandler } from '../../hooks/useSwipeGesture/useSwipeGesture.js';
5
4
  import { PolymorphicPropsWithRef } from '../../utilities/polymorphism/polymorphism.js';
5
+ import { DataTestAutoId, WithChildren } from '../../utilities/types.js';
6
6
  export interface MenuProps extends DataTestAutoId, WithChildren, Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
7
7
  className?: string;
8
8
  /**
@@ -1,17 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  import { IconButtonProps } from '../icon-button/types.js';
3
- import { BaseModalProps, ModalProps } from './types.js';
3
+ import { BaseModalProps, ModalContainerProps, ModalProps } from './types.js';
4
4
  /**
5
5
  * Ment å brukes med `useModal`.
6
6
  */
7
- export declare const ModalContainer: React.ForwardRefExoticComponent<Omit<{
8
- id: string;
9
- ref: (node: React.ReactNode | HTMLElement) => void;
10
- role: string;
11
- 'aria-modal': boolean;
12
- 'aria-hidden': boolean;
13
- 'aria-labelledby': string;
14
- } & BaseModalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export declare const ModalContainer: React.ForwardRefExoticComponent<Omit<ModalContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
8
  /**
16
9
  * Ment å brukes med `useModal`.
17
10
  */
@@ -1,2 +1,2 @@
1
- import{jsx as a}from"react/jsx-runtime";import{c as s}from"../../../clsx-BeLtu-UY.js";import{forwardRef as l}from"react";import{IconButton as o}from"../icon-button/IconButton.js";import{CloseIcon as e}from"../icon/icons/CloseIcon.js";const d=l(({className:l,...o},e)=>a("div",{className:s("jkl-modal-container",l),...o,ref:e,"data-portal":!0}));d.displayName="ModalContainer";const t=l(({className:l,transparent:o,...e},d)=>a("div",{className:s("jkl-modal-overlay",l,{"jkl-modal-overlay--transparent":o}),...e,ref:d}));t.displayName="ModalOverlay";const m=l(({className:l,component:o,padding:e,style:d,...t},m)=>a(o||"div",{className:s("jkl jkl-modal",l),style:{"--jkl-modal-padding":e?`var(--jkl-spacing-${e})`:void 0,...d},...t,ref:m}));m.displayName="Modal";const c=l(({className:l,...o},e)=>a("div",{className:s("jkl-modal-header",l),...o,ref:e}));c.displayName="ModalHeader";const r=l(({className:l,...o},e)=>a("p",{className:s("jkl-modal-title",l),...o,ref:e}));r.displayName="ModalTitle";const n=l(({className:l,...d},t)=>a(o,{className:s("jkl-modal-close",l),"data-testautoid":"jkl-modal-close",...d,ref:t,children:a(e,{variant:"medium"})}));n.displayName="ModalCloseButton";const i=l(({className:l,...o},e)=>a("div",{className:s("jkl-modal-body",l),...o,ref:e}));i.displayName="ModalBody";const N=l(({className:l,...o},e)=>a("div",{className:s("jkl-modal-actions",l),...o,ref:e}));N.displayName="ModalActions";export{m as Modal,N as ModalActions,i as ModalBody,n as ModalCloseButton,d as ModalContainer,c as ModalHeader,t as ModalOverlay,r as ModalTitle};
1
+ import{jsx as a}from"react/jsx-runtime";import{c as l}from"../../../clsx-BeLtu-UY.js";import{forwardRef as o}from"react";import{IconButton as s}from"../icon-button/IconButton.js";import{CloseIcon as e}from"../icon/icons/CloseIcon.js";const d=o(({className:o,placement:s="center",slideIn:e,...d},t)=>a("div",{className:l("jkl-modal-container",`jkl-modal-container--placement-${s}`,{"jkl-modal-container--slide-in":e},o),...d,ref:t,"data-portal":!0}));d.displayName="ModalContainer";const t=o(({className:o,transparent:s,...e},d)=>a("div",{className:l("jkl-modal-overlay",o,{"jkl-modal-overlay--transparent":s}),...e,ref:d}));t.displayName="ModalOverlay";const m=o(({className:o,component:s,padding:e,style:d,...t},m)=>a(s||"div",{className:l("jkl jkl-modal",o),style:{"--modal-padding":e?`var(--jkl-spacing-${e})`:void 0,...d},...t,ref:m}));m.displayName="Modal";const n=o(({className:o,...s},e)=>a("div",{className:l("jkl-modal-header",o),...s,ref:e}));n.displayName="ModalHeader";const c=o(({className:o,...s},e)=>a("p",{className:l("jkl-modal-title",o),...s,ref:e}));c.displayName="ModalTitle";const i=o(({className:o,...d},t)=>a(s,{className:l("jkl-modal-close",o),"data-testautoid":"jkl-modal-close",...d,ref:t,children:a(e,{variant:"medium"})}));i.displayName="ModalCloseButton";const r=o(({className:o,...s},e)=>a("div",{className:l("jkl-modal-body",o),...s,ref:e}));r.displayName="ModalBody";const p=o(({className:o,...s},e)=>a("div",{className:l("jkl-modal-actions",o),...s,ref:e}));p.displayName="ModalActions";export{m as Modal,p as ModalActions,r as ModalBody,i as ModalCloseButton,d as ModalContainer,n as ModalHeader,t as ModalOverlay,c as ModalTitle};
2
2
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { IconButton } from \"../icon-button/IconButton.js\";\nimport type { IconButtonProps } from \"../icon-button/types.js\";\nimport { CloseIcon } from \"../icon/icons/CloseIcon.js\";\nimport type {\n BaseModalProps,\n ModalConfig,\n ModalOverlayProps,\n ModalProps,\n} from \"./types.js\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalContainer = forwardRef<\n HTMLDivElement,\n ModalConfig[\"container\"] & BaseModalProps\n>(({ className, ...rest }, ref) => {\n // TODO: 'data-portal' fjernes når modalen tar i bruk Popover komponenten. Issue: https://github.com/fremtind/jokul/issues/4356\n return (\n <div\n className={clsx(\"jkl-modal-container\", className)}\n {...rest}\n ref={ref}\n data-portal\n />\n );\n});\nModalContainer.displayName = \"ModalContainer\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalOverlay = forwardRef<HTMLDivElement, ModalOverlayProps>(\n ({ className, transparent, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-overlay\", className, {\n \"jkl-modal-overlay--transparent\": transparent,\n })}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalOverlay.displayName = \"ModalOverlay\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const Modal = forwardRef<HTMLElement, ModalConfig[\"modal\"] & ModalProps>(\n ({ className, component, padding, style, ...rest }, ref) => {\n const C = component || \"div\";\n return (\n <C\n className={clsx(\"jkl jkl-modal\", className)}\n style={\n {\n \"--jkl-modal-padding\": padding\n ? `var(--jkl-spacing-${padding})`\n : undefined,\n ...style,\n } as React.CSSProperties\n }\n {...rest}\n ref={ref}\n />\n );\n },\n);\nModal.displayName = \"Modal\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalHeader = forwardRef<HTMLDivElement, BaseModalProps>(\n ({ className, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-header\", className)}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalHeader.displayName = \"ModalHeader\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalTitle = forwardRef<\n HTMLParagraphElement,\n ModalConfig[\"title\"] & BaseModalProps\n>(({ className, ...rest }, ref) => (\n <p className={clsx(\"jkl-modal-title\", className)} {...rest} ref={ref} />\n));\nModalTitle.displayName = \"ModalTitle\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalCloseButton = forwardRef<\n HTMLButtonElement,\n Omit<ModalConfig[\"closeButton\"], \"onClick\"> &\n BaseModalProps &\n IconButtonProps\n>(({ className, ...rest }, ref) => (\n <IconButton\n className={clsx(\"jkl-modal-close\", className)}\n data-testautoid=\"jkl-modal-close\"\n {...rest}\n ref={ref}\n >\n <CloseIcon variant=\"medium\" />\n </IconButton>\n));\nModalCloseButton.displayName = \"ModalCloseButton\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalBody = forwardRef<HTMLDivElement, BaseModalProps>(\n ({ className, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-body\", className)}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalBody.displayName = \"ModalBody\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalActions = forwardRef<HTMLDivElement, BaseModalProps>(\n ({ className, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-actions\", className)}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalActions.displayName = \"ModalActions\";\n"],"names":["ModalContainer","forwardRef","className","rest","ref","jsx","clsx","displayName","ModalOverlay","transparent","Modal","component","padding","style","ModalHeader","ModalTitle","ModalCloseButton","IconButton","children","CloseIcon","variant","ModalBody","ModalActions"],"mappings":"0OAeO,MAAMA,EAAiBC,EAG5B,EAAGC,UAAAA,KAAcC,GAAQC,IAGnBC,EAAC,MAAA,CACGH,UAAWI,EAAK,sBAAuBJ,MACnCC,EACJC,IAAAA,EACA,eAAW,KAIvBJ,EAAeO,YAAc,iBAKtB,MAAMC,EAAeP,EACxB,EAAGC,UAAAA,EAAWO,YAAAA,KAAgBN,GAAQC,IAClCC,EAAC,MAAA,CACGH,UAAWI,EAAK,oBAAqBJ,EAAW,CAC5C,iCAAkCO,OAElCN,EACJC,IAAAA,KAIZI,EAAaD,YAAc,eAKpB,MAAMG,EAAQT,EACjB,EAAGC,UAAAA,EAAWS,UAAAA,EAAWC,QAAAA,EAASC,MAAAA,KAAUV,GAAQC,IAG5CC,EAFMM,GAAa,MAElB,CACGT,UAAWI,EAAK,gBAAiBJ,GACjCW,MACI,CACI,sBAAuBD,EACjB,qBAAqBA,UACrB,KACHC,MAGPV,EACJC,IAAAA,KAKhBM,EAAMH,YAAc,QAKb,MAAMO,EAAcb,EACvB,EAAGC,UAAAA,KAAcC,GAAQC,IACrBC,EAAC,MAAA,CACGH,UAAWI,EAAK,mBAAoBJ,MAChCC,EACJC,IAAAA,KAIZU,EAAYP,YAAc,cAKnB,MAAMQ,EAAad,EAGxB,EAAGC,UAAAA,KAAcC,GAAQC,MACtB,IAAA,CAAEF,UAAWI,EAAK,kBAAmBJ,MAAgBC,EAAMC,IAAAA,KAEhEW,EAAWR,YAAc,aAKlB,MAAMS,EAAmBf,EAK9B,EAAGC,UAAAA,KAAcC,GAAQC,IACvBC,EAACY,EAAA,CACGf,UAAWI,EAAK,kBAAmBJ,GACnC,kBAAgB,qBACZC,EACJC,IAAAA,EAEAc,SAAAb,EAACc,EAAA,CAAUC,QAAQ,cAG3BJ,EAAiBT,YAAc,mBAKxB,MAAMc,EAAYpB,EACrB,EAAGC,UAAAA,KAAcC,GAAQC,IACrBC,EAAC,MAAA,CACGH,UAAWI,EAAK,iBAAkBJ,MAC9BC,EACJC,IAAAA,KAIZiB,EAAUd,YAAc,YAKjB,MAAMe,EAAerB,EACxB,EAAGC,UAAAA,KAAcC,GAAQC,IACrBC,EAAC,MAAA,CACGH,UAAWI,EAAK,oBAAqBJ,MACjCC,EACJC,IAAAA,KAIZkB,EAAaf,YAAc"}
1
+ {"version":3,"file":"Modal.js","sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { IconButton } from \"../icon-button/IconButton.js\";\nimport type { IconButtonProps } from \"../icon-button/types.js\";\nimport { CloseIcon } from \"../icon/icons/CloseIcon.js\";\nimport type {\n BaseModalProps,\n ModalConfig,\n ModalContainerProps,\n ModalOverlayProps,\n ModalProps,\n} from \"./types.js\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalContainer = forwardRef<HTMLDivElement, ModalContainerProps>(\n ({ className, placement = \"center\", slideIn, ...rest }, ref) => {\n // TODO: 'data-portal' fjernes når modalen tar i bruk Popover komponenten. Issue: https://github.com/fremtind/jokul/issues/4356\n return (\n <div\n className={clsx(\n \"jkl-modal-container\",\n `jkl-modal-container--placement-${placement}`,\n { \"jkl-modal-container--slide-in\": slideIn },\n className,\n )}\n {...rest}\n ref={ref}\n data-portal\n />\n );\n },\n);\nModalContainer.displayName = \"ModalContainer\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalOverlay = forwardRef<HTMLDivElement, ModalOverlayProps>(\n ({ className, transparent, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-overlay\", className, {\n \"jkl-modal-overlay--transparent\": transparent,\n })}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalOverlay.displayName = \"ModalOverlay\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const Modal = forwardRef<HTMLElement, ModalConfig[\"modal\"] & ModalProps>(\n ({ className, component, padding, style, ...rest }, ref) => {\n const C = component || \"div\";\n return (\n <C\n className={clsx(\"jkl jkl-modal\", className)}\n style={\n {\n \"--modal-padding\": padding\n ? `var(--jkl-spacing-${padding})`\n : undefined,\n ...style,\n } as React.CSSProperties\n }\n {...rest}\n ref={ref}\n />\n );\n },\n);\nModal.displayName = \"Modal\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalHeader = forwardRef<HTMLDivElement, BaseModalProps>(\n ({ className, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-header\", className)}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalHeader.displayName = \"ModalHeader\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalTitle = forwardRef<\n HTMLParagraphElement,\n ModalConfig[\"title\"] & BaseModalProps\n>(({ className, ...rest }, ref) => (\n <p className={clsx(\"jkl-modal-title\", className)} {...rest} ref={ref} />\n));\nModalTitle.displayName = \"ModalTitle\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalCloseButton = forwardRef<\n HTMLButtonElement,\n Omit<ModalConfig[\"closeButton\"], \"onClick\"> &\n BaseModalProps &\n IconButtonProps\n>(({ className, ...rest }, ref) => (\n <IconButton\n className={clsx(\"jkl-modal-close\", className)}\n data-testautoid=\"jkl-modal-close\"\n {...rest}\n ref={ref}\n >\n <CloseIcon variant=\"medium\" />\n </IconButton>\n));\nModalCloseButton.displayName = \"ModalCloseButton\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalBody = forwardRef<HTMLDivElement, BaseModalProps>(\n ({ className, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-body\", className)}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalBody.displayName = \"ModalBody\";\n\n/**\n * Ment å brukes med `useModal`.\n */\nexport const ModalActions = forwardRef<HTMLDivElement, BaseModalProps>(\n ({ className, ...rest }, ref) => (\n <div\n className={clsx(\"jkl-modal-actions\", className)}\n {...rest}\n ref={ref}\n />\n ),\n);\nModalActions.displayName = \"ModalActions\";\n"],"names":["ModalContainer","forwardRef","className","placement","slideIn","rest","ref","jsx","clsx","displayName","ModalOverlay","transparent","Modal","component","padding","style","ModalHeader","ModalTitle","ModalCloseButton","IconButton","children","CloseIcon","variant","ModalBody","ModalActions"],"mappings":"0OAgBO,MAAMA,EAAiBC,EAC1B,EAAGC,UAAAA,EAAWC,UAAAA,EAAY,SAAUC,QAAAA,KAAYC,GAAQC,IAGhDC,EAAC,MAAA,CACGL,UAAWM,EACP,sBACA,kCAAkCL,IAClC,CAAE,gCAAiCC,GACnCF,MAEAG,EACJC,IAAAA,EACA,eAAW,KAK3BN,EAAeS,YAAc,iBAKtB,MAAMC,EAAeT,EACxB,EAAGC,UAAAA,EAAWS,YAAAA,KAAgBN,GAAQC,IAClCC,EAAC,MAAA,CACGL,UAAWM,EAAK,oBAAqBN,EAAW,CAC5C,iCAAkCS,OAElCN,EACJC,IAAAA,KAIZI,EAAaD,YAAc,eAKpB,MAAMG,EAAQX,EACjB,EAAGC,UAAAA,EAAWW,UAAAA,EAAWC,QAAAA,EAASC,MAAAA,KAAUV,GAAQC,IAG5CC,EAFMM,GAAa,MAElB,CACGX,UAAWM,EAAK,gBAAiBN,GACjCa,MACI,CACI,kBAAmBD,EACb,qBAAqBA,UACrB,KACHC,MAGPV,EACJC,IAAAA,KAKhBM,EAAMH,YAAc,QAKb,MAAMO,EAAcf,EACvB,EAAGC,UAAAA,KAAcG,GAAQC,IACrBC,EAAC,MAAA,CACGL,UAAWM,EAAK,mBAAoBN,MAChCG,EACJC,IAAAA,KAIZU,EAAYP,YAAc,cAKnB,MAAMQ,EAAahB,EAGxB,EAAGC,UAAAA,KAAcG,GAAQC,MACtB,IAAA,CAAEJ,UAAWM,EAAK,kBAAmBN,MAAgBG,EAAMC,IAAAA,KAEhEW,EAAWR,YAAc,aAKlB,MAAMS,EAAmBjB,EAK9B,EAAGC,UAAAA,KAAcG,GAAQC,IACvBC,EAACY,EAAA,CACGjB,UAAWM,EAAK,kBAAmBN,GACnC,kBAAgB,qBACZG,EACJC,IAAAA,EAEAc,SAAAb,EAACc,EAAA,CAAUC,QAAQ,cAG3BJ,EAAiBT,YAAc,mBAKxB,MAAMc,EAAYtB,EACrB,EAAGC,UAAAA,KAAcG,GAAQC,IACrBC,EAAC,MAAA,CACGL,UAAWM,EAAK,iBAAkBN,MAC9BG,EACJC,IAAAA,KAIZiB,EAAUd,YAAc,YAKjB,MAAMe,EAAevB,EACxB,EAAGC,UAAAA,KAAcG,GAAQC,IACrBC,EAAC,MAAA,CACGL,UAAWM,EAAK,oBAAqBN,MACjCG,EACJC,IAAAA,KAIZkB,EAAaf,YAAc"}
@@ -1,3 +1,3 @@
1
1
  export { ModalContainer, ModalOverlay, Modal, ModalHeader, ModalTitle, ModalCloseButton, ModalBody, ModalActions, } from './Modal.js';
2
2
  export { useModal, type ModalInstance } from './useModal.js';
3
- export type { ModalProps, BaseModalProps, ModalOverlayProps, UseModalOptions, ModalConfig, } from './types.js';
3
+ export type { ModalProps, BaseModalProps, ModalContainerProps, ModalOverlayProps, UseModalOptions, ModalConfig, ModalPlacement, } from './types.js';
@@ -1,5 +1,6 @@
1
1
  import { A11yDialogConfig, A11yDialogProps } from 'react-a11y-dialog';
2
- import { WithOptionalChildren } from '../../core/types.js';
2
+ import { WithOptionalChildren } from '../../utilities/types.js';
3
+ export type ModalPlacement = "center" | "left" | "bottom" | "right";
3
4
  export interface UseModalOptions extends Omit<A11yDialogProps, "id" | "closeButtonPosition"> {
4
5
  id?: string;
5
6
  /**
@@ -34,9 +35,26 @@ export interface ModalProps extends WithOptionalChildren {
34
35
  padding?: 16 | 24 | 40;
35
36
  }
36
37
  export type BaseModalProps = Omit<ModalProps, "padding" | "component">;
38
+ export type ModalContainerProps = ModalConfig["container"] & BaseModalProps & {
39
+ /**
40
+ * Plassering og animasjon styres av containeren, siden det er den som
41
+ * håndterer viewport-layout og `aria-hidden`-tilstand.
42
+ *
43
+ * @default "center"
44
+ */
45
+ placement?: ModalPlacement;
46
+ /**
47
+ * Slå på enkel slide-in-animasjon når modalen vises.
48
+ *
49
+ * @default false
50
+ */
51
+ slideIn?: boolean;
52
+ };
37
53
  export type ModalOverlayProps = ModalConfig["overlay"] & BaseModalProps & {
38
54
  /**
39
55
  * Rendre uten bakgrunnsfarge, men med click target for å lukke modalen ved klikk utenfor.
56
+ *
57
+ * @default false
40
58
  */
41
59
  transparent?: boolean;
42
60
  };