@oslokommune/punkt-react 19.15.6 → 19.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/components/accordion/Accordion.js +28 -0
  4. package/dist/components/accordion/AccordionItem.js +60 -0
  5. package/dist/components/alert/Alert.js +76 -0
  6. package/dist/components/backlink/BackLink.js +35 -0
  7. package/dist/components/breadcrumbs/Breadcrumbs.js +67 -0
  8. package/dist/components/button/Button.js +54 -0
  9. package/dist/components/calendar/Calendar.js +49 -0
  10. package/dist/components/calendar/CalendarGrid.js +99 -0
  11. package/dist/components/calendar/CalendarNav.js +89 -0
  12. package/dist/components/calendar/calendar-utils.js +44 -0
  13. package/dist/components/calendar/useCalendarState.js +214 -0
  14. package/dist/components/card/Card.js +99 -0
  15. package/dist/components/checkbox/Checkbox.js +101 -0
  16. package/dist/components/checkboxgroup/CheckboxGroup.js +88 -0
  17. package/dist/components/checkboxgroup/CheckboxGroupContext.js +5 -0
  18. package/dist/components/combobox/Combobox.js +65 -0
  19. package/dist/components/combobox/ComboboxInput.js +87 -0
  20. package/dist/components/combobox/ComboboxTags.js +82 -0
  21. package/dist/components/combobox/Listbox.js +136 -0
  22. package/dist/components/combobox/useComboboxState.js +577 -0
  23. package/dist/components/consent/Consent.js +110 -0
  24. package/dist/components/datepicker/DateTags.js +28 -0
  25. package/dist/components/datepicker/Datepicker.js +79 -0
  26. package/dist/components/datepicker/DatepickerInputs.js +149 -0
  27. package/dist/components/datepicker/DatepickerPopup.js +41 -0
  28. package/dist/components/datepicker/useDatepickerState.js +243 -0
  29. package/dist/components/fileupload/DropZone.js +131 -0
  30. package/dist/components/fileupload/FileUpload.js +223 -0
  31. package/dist/components/fileupload/FileUploadContext.d.ts +2 -0
  32. package/dist/components/fileupload/FileUploadContext.js +6 -0
  33. package/dist/components/fileupload/QueueDisplay.js +67 -0
  34. package/dist/components/fileupload/QueueItemContent.js +88 -0
  35. package/dist/components/fileupload/Subcomponents.js +265 -0
  36. package/dist/components/fileupload/Truncate.js +22 -0
  37. package/dist/components/fileupload/extensions/Comments.js +128 -0
  38. package/dist/components/fileupload/extensions/Remove.js +9 -0
  39. package/dist/components/fileupload/extensions/Rename.js +66 -0
  40. package/dist/components/fileupload/hooks/useFileAttributes.js +25 -0
  41. package/dist/components/fileupload/hooks/useImageObjectUrl.js +15 -0
  42. package/dist/components/fileupload/hooks/useImagePreview.js +24 -0
  43. package/dist/components/fileupload/hooks/useOperationState.js +31 -0
  44. package/dist/components/fileupload/hooks/useRequiredFormValidation.js +23 -0
  45. package/dist/components/fileupload/types.d.ts +0 -1
  46. package/dist/components/fileupload/types.js +12 -0
  47. package/dist/components/footer/Footer.js +134 -0
  48. package/dist/components/footer/FooterGlobal.js +105 -0
  49. package/dist/components/footerSimple/FooterSimple.js +87 -0
  50. package/dist/components/header/Header.js +15 -0
  51. package/dist/components/header/HeaderGlobal.js +286 -0
  52. package/dist/components/header/HeaderService.js +281 -0
  53. package/dist/components/header-menu/HeaderMenu.js +197 -0
  54. package/dist/components/headerUserMenu/UserMenu.js +134 -0
  55. package/dist/components/heading/Heading.js +37 -0
  56. package/dist/components/helptext/Helptext.js +50 -0
  57. package/dist/components/icon/Icon.d.ts +6 -0
  58. package/dist/components/icon/Icon.js +69 -0
  59. package/dist/components/input/Input.js +23 -0
  60. package/dist/components/inputwrapper/InputWrapper.js +128 -0
  61. package/dist/components/link/Link.js +34 -0
  62. package/dist/components/linkcard/LinkCard.js +38 -0
  63. package/dist/components/loader/Loader.js +47 -0
  64. package/dist/components/messagebox/Messagebox.js +50 -0
  65. package/dist/components/modal/Modal.js +89 -0
  66. package/dist/components/progressbar/Progressbar.js +62 -0
  67. package/dist/components/radio/RadioButton.js +85 -0
  68. package/dist/components/radiogroup/RadioGroup.js +70 -0
  69. package/dist/components/radiogroup/RadioGroupContext.js +5 -0
  70. package/dist/components/searchinput/SearchInput.js +102 -0
  71. package/dist/components/select/Select.js +56 -0
  72. package/dist/components/stepper/Step.js +78 -0
  73. package/dist/components/stepper/Stepper.js +21 -0
  74. package/dist/components/strings/PktStringsProvider.js +21 -0
  75. package/dist/components/table/Table.js +19 -0
  76. package/dist/components/table/TableBody.js +13 -0
  77. package/dist/components/table/TableDataCell.js +14 -0
  78. package/dist/components/table/TableHeader.js +12 -0
  79. package/dist/components/table/TableHeaderCell.js +12 -0
  80. package/dist/components/table/TableRow.js +12 -0
  81. package/dist/components/tabs/TabItem.js +60 -0
  82. package/dist/components/tabs/Tabs.js +90 -0
  83. package/dist/components/tag/Tag.js +76 -0
  84. package/dist/components/textarea/Textarea.js +74 -0
  85. package/dist/components/textinput/Textinput.js +106 -0
  86. package/dist/components/timepicker/Timepicker.js +224 -0
  87. package/dist/components/timepicker/useTimepickerState.js +483 -0
  88. package/dist/hooks/useElementWidth.js +23 -0
  89. package/dist/hooks/useFocusModality.js +28 -0
  90. package/dist/hooks/useGeneratedId.js +8 -0
  91. package/dist/hooks/useHeaderChrome.js +36 -0
  92. package/dist/hooks/useOptionGroupField.js +70 -0
  93. package/dist/hooks/useOwnerForm.js +15 -0
  94. package/dist/hooks/usePktStrings.js +16 -0
  95. package/dist/hooks/useScrollLock.js +12 -0
  96. package/dist/node_modules/@date-fns/tz/date/index.js +57 -0
  97. package/dist/node_modules/@date-fns/tz/date/mini.js +75 -0
  98. package/dist/node_modules/@date-fns/tz/index.js +6 -0
  99. package/dist/node_modules/@date-fns/tz/tz/index.js +1 -0
  100. package/dist/node_modules/@date-fns/tz/tzName/index.js +10 -0
  101. package/dist/node_modules/@date-fns/tz/tzOffset/index.js +22 -0
  102. package/dist/node_modules/classnames/index.js +32 -0
  103. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +6 -0
  104. package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  105. package/dist/node_modules/date-fns/_lib/format/formatters.js +389 -0
  106. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +43 -0
  107. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +38 -0
  108. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +8 -0
  109. package/dist/node_modules/date-fns/_lib/normalizeDates.js +8 -0
  110. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +11 -0
  111. package/dist/node_modules/date-fns/_lib/protectedTokens.js +23 -0
  112. package/dist/node_modules/date-fns/addDays.js +9 -0
  113. package/dist/node_modules/date-fns/constants.js +10 -0
  114. package/dist/node_modules/date-fns/constructFrom.js +7 -0
  115. package/dist/node_modules/date-fns/differenceInCalendarDays.js +11 -0
  116. package/dist/node_modules/date-fns/eachDayOfInterval.js +15 -0
  117. package/dist/node_modules/date-fns/endOfDay.js +8 -0
  118. package/dist/node_modules/date-fns/format.js +59 -0
  119. package/dist/node_modules/date-fns/getDayOfYear.js +10 -0
  120. package/dist/node_modules/date-fns/getISODay.js +8 -0
  121. package/dist/node_modules/date-fns/getISOWeek.js +11 -0
  122. package/dist/node_modules/date-fns/getISOWeekYear.js +14 -0
  123. package/dist/node_modules/date-fns/getWeek.js +11 -0
  124. package/dist/node_modules/date-fns/getWeekYear.js +15 -0
  125. package/dist/node_modules/date-fns/isDate.js +6 -0
  126. package/dist/node_modules/date-fns/isValid.js +8 -0
  127. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
  128. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +17 -0
  129. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +22 -0
  130. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +18 -0
  131. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +69 -0
  132. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +32 -0
  133. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
  134. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +202 -0
  135. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +124 -0
  136. package/dist/node_modules/date-fns/locale/en-US.js +20 -0
  137. package/dist/node_modules/date-fns/startOfDay.js +8 -0
  138. package/dist/node_modules/date-fns/startOfISOWeek.js +10 -0
  139. package/dist/node_modules/date-fns/startOfISOWeekYear.js +10 -0
  140. package/dist/node_modules/date-fns/startOfWeek.js +9 -0
  141. package/dist/node_modules/date-fns/startOfWeekYear.js +11 -0
  142. package/dist/node_modules/date-fns/startOfYear.js +8 -0
  143. package/dist/node_modules/date-fns/toDate.js +7 -0
  144. package/dist/punkt-react.cjs +1 -1
  145. package/dist/punkt-react.js +55 -9388
  146. package/dist/shared-strings/consent.js +113 -0
  147. package/dist/shared-strings/format.js +18 -0
  148. package/dist/shared-strings/nb.js +201 -0
  149. package/dist/shared-strings/resolve.js +40 -0
  150. package/dist/shared-strings/store.js +35 -0
  151. package/dist/shared-types/accordion.js +4 -0
  152. package/dist/shared-types/calendar.js +12 -0
  153. package/dist/shared-types/card.js +15 -0
  154. package/dist/shared-types/checkbox.js +15 -0
  155. package/dist/shared-types/combobox.js +19 -0
  156. package/dist/shared-types/consent.js +8 -0
  157. package/dist/shared-types/footer.js +4 -0
  158. package/dist/shared-types/header-footer.js +4 -0
  159. package/dist/shared-types/icon.js +7 -0
  160. package/dist/shared-types/messagebox.js +8 -0
  161. package/dist/shared-types/option-group.js +14 -0
  162. package/dist/shared-types/radiobutton.js +11 -0
  163. package/dist/shared-types/select.js +14 -0
  164. package/dist/shared-types/table.js +8 -0
  165. package/dist/shared-utils/calendar/calendar-grid.js +19 -0
  166. package/dist/shared-utils/calendar/date-validation.js +19 -0
  167. package/dist/shared-utils/calendar/keyboard-navigation.js +26 -0
  168. package/dist/shared-utils/calendar/selection-manager.js +52 -0
  169. package/dist/shared-utils/combobox/input-utils.js +39 -0
  170. package/dist/shared-utils/combobox/keyboard-navigation.js +41 -0
  171. package/dist/shared-utils/combobox/option-utils.js +48 -0
  172. package/dist/shared-utils/date-utils.js +71 -0
  173. package/dist/shared-utils/datepicker-utils.js +32 -0
  174. package/dist/shared-utils/device-utils.js +7 -0
  175. package/dist/shared-utils/fileupload/announcements.js +21 -0
  176. package/dist/shared-utils/fileupload/filename.js +8 -0
  177. package/dist/shared-utils/fileupload/focus-trap.js +2 -0
  178. package/dist/shared-utils/fileupload/formats.js +29 -0
  179. package/dist/shared-utils/fileupload/index.js +11 -0
  180. package/dist/shared-utils/fileupload/navigation.js +6 -0
  181. package/dist/shared-utils/fileupload/size.js +25 -0
  182. package/dist/shared-utils/fileupload/transfers.js +23 -0
  183. package/dist/shared-utils/fileupload/truncate.js +9 -0
  184. package/dist/shared-utils/fileupload/validation.js +32 -0
  185. package/dist/shared-utils/focus-trap/index.js +60 -0
  186. package/dist/shared-utils/forms/described-by.js +7 -0
  187. package/dist/shared-utils/header-footer/external-domain.js +30 -0
  188. package/dist/shared-utils/header-footer/fetch-header-footer-data.js +29 -0
  189. package/dist/shared-utils/header-footer/icon-map.js +55 -0
  190. package/dist/shared-utils/header-footer/select-megamenu.js +7 -0
  191. package/dist/shared-utils/scroll-lock/index.js +21 -0
  192. package/dist/shared-utils/timepicker/options.js +10 -0
  193. package/dist/shared-utils/timepicker/stepper.js +10 -0
  194. package/dist/shared-utils/timepicker/time-utils.js +7 -0
  195. package/dist/shared-utils/value-utils.js +12 -0
  196. package/dist/utils/nativeInputValue.js +6 -0
  197. package/dist/utils/stableKeys.js +13 -0
  198. package/dist/utils/stringutils.js +7 -0
  199. package/package.json +3 -2
  200. package/src/components/checkbox/Checkbox.tsx +2 -0
  201. package/src/components/combobox/types.ts +0 -2
  202. package/src/components/fileupload/FileUpload.tsx +3 -1
  203. package/src/components/fileupload/FileUploadContext.ts +7 -0
  204. package/src/components/fileupload/QueueDisplay.tsx +3 -3
  205. package/src/components/fileupload/Subcomponents.tsx +2 -7
  206. package/src/components/fileupload/extensions/Comments.tsx +2 -1
  207. package/src/components/fileupload/extensions/Rename.tsx +2 -1
  208. package/src/components/fileupload/types.ts +1 -2
  209. package/src/components/header/Header.test.tsx +0 -7
  210. package/src/components/header/Header.tsx +0 -2
  211. package/src/components/heading/Heading.tsx +0 -2
  212. package/src/components/hydration.test.tsx +61 -15
  213. package/src/components/icon/Icon.test.tsx +0 -7
  214. package/src/components/icon/Icon.tsx +7 -0
  215. package/src/components/input/Input.tsx +0 -2
  216. package/src/components/link/Link.tsx +0 -2
  217. package/src/components/radio/RadioButton.tsx +2 -0
  218. package/src/components/server-components.test.ts +69 -0
  219. package/src/components/stepper/Step.tsx +0 -2
  220. package/src/components/stepper/Stepper.tsx +0 -2
  221. package/src/components/strings/PktStringsProvider.tsx +2 -0
  222. package/src/components/table/Table.tsx +0 -2
  223. package/src/components/table/TableBody.tsx +1 -3
  224. package/src/components/table/TableDataCell.tsx +0 -2
  225. package/src/components/table/TableHeader.tsx +0 -2
  226. package/src/components/table/TableHeaderCell.tsx +0 -2
  227. package/src/components/table/TableRow.tsx +0 -2
  228. package/dist/components/accordion/Accordion.test.d.ts +0 -0
  229. package/dist/components/alert/Alert.test.d.ts +0 -0
  230. package/dist/components/backlink/BackLink.test.d.ts +0 -0
  231. package/dist/components/breadcrumbs/Breadcrumbs.test.d.ts +0 -1
  232. package/dist/components/button/Button.test.d.ts +0 -0
  233. package/dist/components/calendar/Calendar.accessibility.test.d.ts +0 -0
  234. package/dist/components/calendar/Calendar.constraints.test.d.ts +0 -0
  235. package/dist/components/calendar/Calendar.core.test.d.ts +0 -0
  236. package/dist/components/calendar/Calendar.interaction.test.d.ts +0 -0
  237. package/dist/components/calendar/Calendar.selection.test.d.ts +0 -0
  238. package/dist/components/card/Card.test.d.ts +0 -0
  239. package/dist/components/checkbox/Checkbox.test.d.ts +0 -0
  240. package/dist/components/checkboxgroup/CheckboxGroup.forms.test.d.ts +0 -0
  241. package/dist/components/checkboxgroup/CheckboxGroup.test.d.ts +0 -0
  242. package/dist/components/combobox/Combobox.accessibility.test.d.ts +0 -0
  243. package/dist/components/combobox/Combobox.core.test.d.ts +0 -0
  244. package/dist/components/combobox/Combobox.interaction.test.d.ts +0 -0
  245. package/dist/components/combobox/Combobox.preselection.test.d.ts +0 -0
  246. package/dist/components/combobox/Combobox.selection.test.d.ts +0 -0
  247. package/dist/components/consent/Consent.test.d.ts +0 -0
  248. package/dist/components/datepicker/Datepicker.accessibility.test.d.ts +0 -0
  249. package/dist/components/datepicker/Datepicker.core.test.d.ts +0 -0
  250. package/dist/components/datepicker/Datepicker.input.test.d.ts +0 -0
  251. package/dist/components/datepicker/Datepicker.selection.test.d.ts +0 -0
  252. package/dist/components/datepicker/Datepicker.validation.test.d.ts +0 -0
  253. package/dist/components/fileupload/FileUpload.test.d.ts +0 -0
  254. package/dist/components/fileupload/QueueDisplay.test.d.ts +0 -0
  255. package/dist/components/fileupload/Truncate.test.d.ts +0 -0
  256. package/dist/components/footer/Footer.accessibility.test.d.ts +0 -0
  257. package/dist/components/footer/Footer.test.d.ts +0 -1
  258. package/dist/components/footerSimple/FooterSimple.test.d.ts +0 -1
  259. package/dist/components/formAttribute.test.d.ts +0 -1
  260. package/dist/components/header/Header.test.d.ts +0 -0
  261. package/dist/components/header/HeaderGlobal.accessibility.test.d.ts +0 -0
  262. package/dist/components/header/HeaderGlobal.test.d.ts +0 -0
  263. package/dist/components/header/HeaderService.accessibility.test.d.ts +0 -0
  264. package/dist/components/header/HeaderService.test.d.ts +0 -0
  265. package/dist/components/header-menu/HeaderMenu.test.d.ts +0 -0
  266. package/dist/components/headerUserMenu/UserMenu.test.d.ts +0 -0
  267. package/dist/components/heading/Heading.test.d.ts +0 -0
  268. package/dist/components/helptext/Helptext.test.d.ts +0 -0
  269. package/dist/components/helptext/helptextAssociation.test.d.ts +0 -1
  270. package/dist/components/hydration.test.d.ts +0 -1
  271. package/dist/components/icon/Icon.test.d.ts +0 -9
  272. package/dist/components/inputwrapper/InputWrapper.test.d.ts +0 -0
  273. package/dist/components/link/Link.test.d.ts +0 -1
  274. package/dist/components/linkcard/LinkCard.test.d.ts +0 -0
  275. package/dist/components/loader/Loader.test.d.ts +0 -0
  276. package/dist/components/messagebox/Messagebox.test.d.ts +0 -1
  277. package/dist/components/modal/Modal.test.d.ts +0 -0
  278. package/dist/components/progressbar/Progressbar.test.d.ts +0 -0
  279. package/dist/components/radio/RadioButton.test.d.ts +0 -0
  280. package/dist/components/radiogroup/RadioGroup.forms.test.d.ts +0 -0
  281. package/dist/components/radiogroup/RadioGroup.test.d.ts +0 -0
  282. package/dist/components/searchinput/SearchInput.test.d.ts +0 -0
  283. package/dist/components/select/Select.test.d.ts +0 -0
  284. package/dist/components/ssr.test.d.ts +0 -1
  285. package/dist/components/stepper/Stepper.test.d.ts +0 -0
  286. package/dist/components/strings/strings-override.test.d.ts +0 -1
  287. package/dist/components/table/Table.test.d.ts +0 -0
  288. package/dist/components/tabs/Tabs.test.d.ts +0 -0
  289. package/dist/components/tag/Tag.test.d.ts +0 -0
  290. package/dist/components/textarea/Textarea.test.d.ts +0 -0
  291. package/dist/components/textinput/Textinput.test.d.ts +0 -0
  292. package/dist/components/timepicker/Timepicker.test.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,36 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [19.16.1](https://github.com/oslokommune/punkt/compare/19.16.0...19.16.1) (2026-10-19)
9
+
10
+ ### Bug Fixes
11
+ * Header får riktig mobilvisning med SSR (#3766). - På mobil krasjer ikke lenger hydreringen av PktHeaderService, og siden
12
+ slipper å bygges på nytt i nettleseren
13
+ - PktHeaderGlobal blir ikke lenger stående med desktop-utseende på mobil
14
+ - Ingen endring for apper uten serverrendering
15
+
16
+ ---
17
+
18
+
19
+ ## [19.16.0](https://github.com/oslokommune/punkt/compare/19.15.6...19.16.0) (2026-10-19)
20
+
21
+ ### Features
22
+ * Tree-shaking er tilbake i React! (#3765). Siden vi ikke lenger trenger å støtte web components i React er det på
23
+ tide å få tilbake tree-shaking og støtte for server components.
24
+
25
+ - Du får bare med komponentene du faktisk bruker. Én knapp er nå ca. 4
26
+ KB, ikke nesten 200 KB
27
+ - Funker i Server Components i Next.js. Komponenter som tabell,
28
+ overskrift og lenke rendres på serveren
29
+ - Next.js med webpack (standard i Next 15): legg til `experimental: {
30
+ optimizePackageImports: ['@oslokommune/punkt-react'] }` i `next.config`,
31
+ ellers blir alle komponentene med når du importerer fra en Server
32
+ Component. Turbopack og Pages Router trenger ikke dette
33
+ - Ingenting endres i hvordan du importerer eller bruker komponentene
34
+
35
+ ---
36
+
37
+
8
38
  ## [19.15.6](https://github.com/oslokommune/punkt/compare/19.15.5...19.15.6) (2026-10-19)
9
39
 
10
40
  ### Bug Fixes
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
3
+ if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
4
+ get: ((e) => i[e]).bind(null, d),
5
+ enumerable: !(s = n(i, d)) || s.enumerable
6
+ });
7
+ return e;
8
+ }, c = (n, r, o) => (o = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
9
+ value: n,
10
+ enumerable: !0
11
+ }) : o, n));
12
+ //#endregion
13
+ export { o as __commonJSMin, c as __toESM };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { createContext as e, forwardRef as t, useContext as n } from "react";
3
+ import { jsx as r } from "react/jsx-runtime";
4
+ //#region src/components/accordion/Accordion.tsx
5
+ var i = e({}), a = () => n(i), o = t(({ compact: e = !1, skin: t = "borderless", ariaLabelledBy: n, children: a, name: o, className: s }, c) => {
6
+ let l = [
7
+ "pkt-accordion",
8
+ e && "pkt-accordion--compact",
9
+ t && `pkt-accordion--${t}`,
10
+ s
11
+ ].filter(Boolean).join(" ");
12
+ return /* @__PURE__ */ r(i.Provider, {
13
+ value: {
14
+ name: o,
15
+ skin: t
16
+ },
17
+ children: /* @__PURE__ */ r("div", {
18
+ ref: c,
19
+ className: l,
20
+ "data-testid": "pkt-accordion",
21
+ "aria-labelledby": n || void 0,
22
+ children: a
23
+ })
24
+ });
25
+ });
26
+ o.displayName = "PktAccordion";
27
+ //#endregion
28
+ export { o as PktAccordion, a as useAccordionContext };
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { useAccordionContext as e } from "./Accordion.js";
3
+ import { ACCORDION_LIGHT_ONLY_SKINS as t } from "../../shared-types/accordion.js";
4
+ import { PktIcon as n } from "../icon/Icon.js";
5
+ import { forwardRef as r, useState as i } from "react";
6
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ //#region src/components/accordion/AccordionItem.tsx
8
+ var c = r(({ defaultOpen: r = !1, id: c, title: l, skin: u, compact: d = !1, isOpen: f, children: p, name: m, className: h, onClick: g, onToggle: _ }, v) => {
9
+ let [y, b] = i(r), { name: x, skin: S } = e(), C = m || x, w = u || S, T = f === void 0 ? y : f, E = (e) => {
10
+ let t = e.currentTarget.open;
11
+ t !== T && (f === void 0 && b(t), _?.(e));
12
+ }, D = (e) => {
13
+ setTimeout(() => {
14
+ g?.(e);
15
+ }, 0);
16
+ }, O = [
17
+ "pkt-accordion-item",
18
+ d && "pkt-accordion-item--compact",
19
+ u && `pkt-accordion-item--${u}`,
20
+ h
21
+ ].filter(Boolean).join(" ");
22
+ return /* @__PURE__ */ s("details", {
23
+ ref: v,
24
+ className: O,
25
+ id: c,
26
+ open: T,
27
+ onClick: D,
28
+ name: C,
29
+ onToggle: E,
30
+ "data-mode": w && t.includes(w) ? "light" : void 0,
31
+ children: [/* @__PURE__ */ s("summary", {
32
+ className: "pkt-accordion-item__title",
33
+ id: `pkt-accordion-item-summary-${c}`,
34
+ children: [l, w === "plus-minus" ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(n, {
35
+ name: "plus-sign",
36
+ className: "pkt-accordion-item__icon pkt-accordion-item__icon--plus",
37
+ "aria-hidden": "true"
38
+ }), /* @__PURE__ */ o(n, {
39
+ name: "minus-sign",
40
+ className: "pkt-accordion-item__icon pkt-accordion-item__icon--minus",
41
+ "aria-hidden": "true"
42
+ })] }) : /* @__PURE__ */ o(n, {
43
+ name: "chevron-thin-down",
44
+ className: "pkt-accordion-item__icon",
45
+ "aria-hidden": "true"
46
+ })]
47
+ }), /* @__PURE__ */ o("div", {
48
+ className: "pkt-accordion-item__content",
49
+ id: `pkt-accordion-item__content-${c}`,
50
+ role: "region",
51
+ children: /* @__PURE__ */ o("div", {
52
+ className: "pkt-accordion-item__content-inner",
53
+ children: p
54
+ })
55
+ })]
56
+ });
57
+ });
58
+ c.displayName = "PktAccordionItem";
59
+ //#endregion
60
+ export { c as PktAccordionItem };
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
+ import { require_classnames as t } from "../../node_modules/classnames/index.js";
4
+ import { PktIcon as n } from "../icon/Icon.js";
5
+ import { formatString as r } from "../../shared-strings/format.js";
6
+ import { PktButton as i } from "../button/Button.js";
7
+ import { usePktStrings as a } from "../../hooks/usePktStrings.js";
8
+ import { useCallback as o, useState as s } from "react";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
10
+ //#region src/components/alert/Alert.tsx
11
+ var u = /* @__PURE__ */ e(t(), 1), d = ({ children: e, closeAlert: t, compact: d, size: f = d ? "small" : "medium", title: p, date: m, ariaLive: h, "aria-live": g = "polite", role: _ = "status", skin: v = "info", className: y, strings: b, ...x }) => {
12
+ let [S, C] = s(!1), w = a(["generic", "alert"], b), T = {
13
+ "pkt-alert": !0,
14
+ [`pkt-alert--${f}`]: f,
15
+ [`pkt-alert--${v}`]: v,
16
+ "pkt-hide": S
17
+ }, E = {
18
+ "pkt-alert__grid": !0,
19
+ "pkt-alert__noTitle": !p,
20
+ "pkt-alert__noDate": !m
21
+ }, D = o(() => {
22
+ C(!0), x.onClose && x.onClose(new CustomEvent("close", {
23
+ detail: { origin: event },
24
+ bubbles: !0,
25
+ composed: !0
26
+ }));
27
+ }, [x.onClose, C]), O = h || g;
28
+ return /* @__PURE__ */ c("div", {
29
+ ...x,
30
+ "aria-live": O,
31
+ role: _,
32
+ className: (0, u.default)(T, y),
33
+ children: /* @__PURE__ */ l("div", {
34
+ className: (0, u.default)(E),
35
+ children: [
36
+ /* @__PURE__ */ c(n, {
37
+ className: "pkt-alert__icon",
38
+ "aria-hidden": "true",
39
+ name: v === "info" ? "alert-information" : `alert-${v}`
40
+ }),
41
+ t && /* @__PURE__ */ c("div", {
42
+ className: "pkt-alert__close",
43
+ children: /* @__PURE__ */ c(i, {
44
+ tabIndex: 0,
45
+ "aria-label": w.generic.close,
46
+ size: f,
47
+ type: "button",
48
+ skin: "tertiary",
49
+ iconName: "close",
50
+ variant: "icon-only",
51
+ onClick: D,
52
+ children: /* @__PURE__ */ c("span", {
53
+ className: "sr-only",
54
+ children: w.generic.close
55
+ })
56
+ })
57
+ }),
58
+ p && /* @__PURE__ */ c("div", {
59
+ className: "pkt-alert__title",
60
+ children: p
61
+ }),
62
+ /* @__PURE__ */ c("div", {
63
+ className: "pkt-alert__text",
64
+ children: e
65
+ }),
66
+ m && /* @__PURE__ */ c("div", {
67
+ className: "pkt-alert__date",
68
+ children: r(w.alert.lastUpdated, { date: m })
69
+ })
70
+ ]
71
+ })
72
+ });
73
+ };
74
+ d.displayName = "PktAlert";
75
+ //#endregion
76
+ export { d as PktAlert };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { PktIcon as e } from "../icon/Icon.js";
3
+ import { usePktStrings as t } from "../../hooks/usePktStrings.js";
4
+ import { forwardRef as n } from "react";
5
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/components/backlink/BackLink.tsx
7
+ var o = n(({ href: n = "/", text: o = "Forsiden", ariaLabel: s, renderLink: c, className: l, strings: u, ...d }, f) => {
8
+ let p = /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i(e, {
9
+ className: "pkt-back-link__icon pkt-icon pkt-link__icon",
10
+ name: "chevron-thin-left",
11
+ "aria-hidden": "true"
12
+ }), /* @__PURE__ */ i("span", {
13
+ className: "pkt-back-link__text",
14
+ children: o
15
+ })] }), m = c || (({ href: e, className: t, children: n, props: r }) => /* @__PURE__ */ i("a", {
16
+ href: e,
17
+ className: t,
18
+ ...r,
19
+ children: n
20
+ })), h = t(["backlink"], u), g = ["pkt-back-link", l].filter(Boolean).join(" ");
21
+ return /* @__PURE__ */ i("nav", {
22
+ className: g,
23
+ "aria-label": s ?? h.backlink.label,
24
+ ref: f,
25
+ children: m({
26
+ href: n,
27
+ className: "pkt-link pkt-link--icon-left",
28
+ children: p,
29
+ props: d
30
+ })
31
+ });
32
+ });
33
+ o.displayName = "PktBackLink";
34
+ //#endregion
35
+ export { o as PktBackLink };
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import { PktIcon as e } from "../icon/Icon.js";
3
+ import { usePktStrings as t } from "../../hooks/usePktStrings.js";
4
+ import { withStableKeys as n } from "../../utils/stableKeys.js";
5
+ import { forwardRef as r } from "react";
6
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import { Link as s } from "react-router-dom";
8
+ //#region src/components/breadcrumbs/Breadcrumbs.tsx
9
+ var c = r(({ breadcrumbs: r, navigationType: c, renderLink: l, className: u, strings: d, ...f }, p) => {
10
+ let m = r, h = m[m.length - 2], g = t(["breadcrumbs"], d), _ = [u, "pkt-breadcrumbs"].filter(Boolean).join(" "), v = l || (c === "router" ? ({ href: e, className: t, children: n, props: r }) => /* @__PURE__ */ a(s, {
11
+ to: e,
12
+ className: t,
13
+ ...r,
14
+ children: n
15
+ }) : ({ href: e, className: t, children: n, props: r }) => /* @__PURE__ */ a("a", {
16
+ href: e,
17
+ className: t,
18
+ ...r,
19
+ children: n
20
+ }));
21
+ return /* @__PURE__ */ o("nav", {
22
+ ref: p,
23
+ "aria-label": g.breadcrumbs.ariaLabel,
24
+ className: _,
25
+ children: [/* @__PURE__ */ a("ol", {
26
+ className: "pkt-breadcrumbs__list pkt-breadcrumbs--desktop",
27
+ children: n(m, (e) => `${e.href}|${e.text}`).map(({ item: t, key: n }, r) => /* @__PURE__ */ a("li", {
28
+ className: "pkt-breadcrumbs__item",
29
+ children: r === m.length - 1 ? /* @__PURE__ */ a("span", {
30
+ className: "pkt-breadcrumbs__label",
31
+ "aria-current": "true",
32
+ children: /* @__PURE__ */ a("span", {
33
+ className: "pkt-breadcrumbs__text",
34
+ children: t.text
35
+ })
36
+ }) : v({
37
+ href: t.href,
38
+ className: "pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",
39
+ children: /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(e, {
40
+ className: "pkt-icon pkt-breadcrumbs__icon pkt-link__icon",
41
+ name: "chevron-thin-right",
42
+ "aria-hidden": "true"
43
+ }), /* @__PURE__ */ a("span", {
44
+ className: "pkt-breadcrumbs__text",
45
+ children: t.text
46
+ })] }),
47
+ props: f
48
+ })
49
+ }, n))
50
+ }), h && v({
51
+ href: h.href,
52
+ className: "pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",
53
+ children: /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(e, {
54
+ className: "pkt-back-link__icon pkt-icon pkt-link__icon",
55
+ name: "chevron-thin-left",
56
+ "aria-hidden": "true"
57
+ }), /* @__PURE__ */ a("span", {
58
+ className: "pkt-breadcrumbs__text",
59
+ children: h.text
60
+ })] }),
61
+ props: f
62
+ })]
63
+ });
64
+ });
65
+ c.displayName = "PktBreadcrumbs";
66
+ //#endregion
67
+ export { c as PktBreadcrumbs };
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { ANIMATION_DEFAULT_PATH as e } from "../../shared-types/icon.js";
3
+ import { PktIcon as t } from "../icon/Icon.js";
4
+ import { forwardRef as n } from "react";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ //#region src/components/button/Button.tsx
7
+ typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/");
8
+ var a = n(({ children: n, className: a, iconName: o = "user", secondIconName: s = "user", iconPath: c, secondIconPath: l, size: u = "medium", fullWidth: d = !1, fullWidthOnMobile: f = !1, skin: p = "primary", type: m = "button", variant: h = "label-only", state: g, color: _, isLoading: v = void 0, disabled: y = void 0, loadingAnimationPath: b = typeof window < "u" ? window.pktAnimationPath : e, ...x }, S) => {
9
+ let C = [
10
+ a,
11
+ "pkt-btn",
12
+ u && `pkt-btn--${u}`,
13
+ d && "pkt-btn--full",
14
+ f && "pkt-btn--full-small",
15
+ p && `pkt-btn--${p}`,
16
+ h && `pkt-btn--${h}`,
17
+ _ && `pkt-btn--${_}`,
18
+ g && `pkt-btn--${g}`,
19
+ v && "pkt-btn--isLoading"
20
+ ].filter(Boolean).join(" ");
21
+ return /* @__PURE__ */ i("button", {
22
+ ...x,
23
+ "aria-busy": v || void 0,
24
+ "aria-disabled": y || void 0,
25
+ disabled: y,
26
+ className: C,
27
+ type: m,
28
+ ref: S,
29
+ children: [
30
+ v && /* @__PURE__ */ r(t, {
31
+ className: "pkt-btn__icon pkt-btn__spinner",
32
+ name: "spinner-blue",
33
+ path: b
34
+ }),
35
+ h !== "label-only" && /* @__PURE__ */ r(t, {
36
+ className: "pkt-btn__icon",
37
+ name: o,
38
+ ...c && { path: c }
39
+ }),
40
+ /* @__PURE__ */ r("span", {
41
+ className: "pkt-btn__text",
42
+ children: n
43
+ }),
44
+ h === "icons-right-and-left" && /* @__PURE__ */ r(t, {
45
+ className: "pkt-btn__icon",
46
+ name: s,
47
+ ...l && { path: l }
48
+ })
49
+ ]
50
+ });
51
+ });
52
+ a.displayName = "PktButton";
53
+ //#endregion
54
+ export { a as PktButton };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { useCalendarState as e } from "./useCalendarState.js";
3
+ import { CalendarNav as t } from "./CalendarNav.js";
4
+ import { CalendarGrid as n } from "./CalendarGrid.js";
5
+ import { forwardRef as r, useImperativeHandle as i } from "react";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ //#region src/components/calendar/Calendar.tsx
8
+ var s = r((r, s) => {
9
+ let c = e(r);
10
+ return i(s, () => ({
11
+ handleDateSelect: c.handleDateSelect,
12
+ addToSelected: c.addToSelected,
13
+ removeFromSelected: c.removeFromSelected,
14
+ toggleSelected: c.toggleSelectedDate,
15
+ focusOnCurrentDate: c.focusOnCurrentDate,
16
+ close: c.close
17
+ }), [
18
+ c.handleDateSelect,
19
+ c.addToSelected,
20
+ c.removeFromSelected,
21
+ c.toggleSelectedDate,
22
+ c.focusOnCurrentDate,
23
+ c.close
24
+ ]), /* @__PURE__ */ o("div", {
25
+ ref: c.calendarRef,
26
+ className: [
27
+ "pkt-calendar",
28
+ c.weeknumbers && "pkt-cal-weeknumbers",
29
+ c.className
30
+ ].filter(Boolean).join(" "),
31
+ onBlur: c.handleFocusOut,
32
+ onKeyDown: c.handleKeydown,
33
+ children: [/* @__PURE__ */ a(t, {
34
+ componentId: c.componentId,
35
+ strings: c.strings,
36
+ year: c.year,
37
+ month: c.month,
38
+ earliest: c.earliest,
39
+ latest: c.latest,
40
+ withcontrols: c.withcontrols,
41
+ prevMonth: c.prevMonth,
42
+ nextMonth: c.nextMonth,
43
+ changeMonth: c.changeMonth
44
+ }), /* @__PURE__ */ a(n, { state: c })]
45
+ });
46
+ });
47
+ s.displayName = "PktCalendar";
48
+ //#endregion
49
+ export { s as PktCalendar };
@@ -0,0 +1,99 @@
1
+ import { calculateCalendarDimensions as e, getCellType as t } from "../../shared-utils/calendar/calendar-grid.js";
2
+ import { getDayButtonClasses as n, getDayCellClasses as r, getDayViewData as i } from "./calendar-utils.js";
3
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
+ //#region src/components/calendar/CalendarGrid.tsx
5
+ var s = ({ state: s }) => {
6
+ let { strings: c, year: l, month: u, activeSelected: d, focusedDate: f, inRange: p, rangeHovered: m, range: h, multiple: g, weeknumbers: _, selectableDatesRef: v, tabIndexSetRef: y, handleDateSelect: b, handleRangeHover: x, isExcluded: S, isDayDisabled: C, setFocusedDate: w, todayDate: T } = s, E = {
7
+ year: l,
8
+ month: u,
9
+ activeSelected: d,
10
+ focusedDate: f,
11
+ tabIndexSetRef: y,
12
+ isDayDisabled: C
13
+ }, D = {
14
+ range: h,
15
+ activeSelected: d,
16
+ rangeHovered: m,
17
+ inRange: p,
18
+ isExcluded: S
19
+ }, O = () => {
20
+ let e = [];
21
+ _ && e.push(/* @__PURE__ */ a("th", { children: /* @__PURE__ */ a("div", {
22
+ className: "pkt-calendar__week-number",
23
+ children: c.week
24
+ }) }, "week-header"));
25
+ for (let t = 0; t < c.daysShort.length; t++) e.push(/* @__PURE__ */ a("th", { children: /* @__PURE__ */ a("div", {
26
+ className: "pkt-calendar__day-name",
27
+ "aria-label": c.days[t],
28
+ children: c.daysShort[t]
29
+ }) }, `day-${t}`));
30
+ return /* @__PURE__ */ a("tr", {
31
+ className: "pkt-cal-week-row",
32
+ children: e
33
+ });
34
+ }, k = (e, t) => {
35
+ let o = i(e, t, E), { currentDate: s, currentDateISO: c, isSelected: l, isDisabled: u, ariaLabel: d, tabindex: f } = o;
36
+ v.current.push({
37
+ currentDateISO: c,
38
+ isDisabled: u,
39
+ tabindex: f
40
+ });
41
+ let p = r(o, D), m = n(o, D);
42
+ return /* @__PURE__ */ a("td", {
43
+ className: p,
44
+ children: /* @__PURE__ */ a("button", {
45
+ type: "button",
46
+ "aria-pressed": l ? "true" : "false",
47
+ disabled: u,
48
+ className: `pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${m}`,
49
+ onMouseOver: () => h && !S(s) && x(s),
50
+ onFocus: () => {
51
+ h && !S(s) && x(s), w(c);
52
+ },
53
+ "aria-label": d,
54
+ tabIndex: parseInt(f),
55
+ "data-disabled": u ? "disabled" : void 0,
56
+ "data-date": c,
57
+ onKeyDown: (e) => {
58
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), b(s));
59
+ },
60
+ onClick: (e) => {
61
+ u || (e.preventDefault(), b(s));
62
+ },
63
+ children: /* @__PURE__ */ a("span", {
64
+ className: "pkt-btn__text pkt-txt-14-light",
65
+ children: e
66
+ })
67
+ })
68
+ }, c);
69
+ }, A = (e) => /* @__PURE__ */ a("td", { className: "pkt-cal-other" }, e);
70
+ return /* @__PURE__ */ o("table", {
71
+ className: "pkt-cal-days pkt-txt-12-medium pkt-calendar__body",
72
+ role: "grid",
73
+ "aria-multiselectable": h || g || void 0,
74
+ children: [/* @__PURE__ */ a("thead", { children: O() }), /* @__PURE__ */ a("tbody", { children: (() => {
75
+ let n = T, r = e(l, u);
76
+ v.current = [], y.current = 0;
77
+ let i = 1, o = r.initialWeek, s = [];
78
+ for (let e = 0; e < r.numRows; e++) {
79
+ let c = [];
80
+ _ && c.push(/* @__PURE__ */ a("td", {
81
+ className: "pkt-cal-week",
82
+ children: o
83
+ }, `week-${o}`)), o++;
84
+ for (let a = 0; a < 7; a++) {
85
+ let o = t(e, a, i, r);
86
+ o === "current-month" ? (c.push(k(i, n)), i++) : (c.push(A(`${o}-${e}-${a}`)), o === "next-month" && i++);
87
+ }
88
+ s.push(/* @__PURE__ */ a("tr", {
89
+ className: "pkt-cal-week-row",
90
+ role: "row",
91
+ children: c
92
+ }, `row-${e}`));
93
+ }
94
+ return s;
95
+ })() })]
96
+ });
97
+ };
98
+ //#endregion
99
+ export { s as CalendarGrid };
@@ -0,0 +1,89 @@
1
+ import { PktIcon as e } from "../icon/Icon.js";
2
+ import { isNextMonthAllowed as t, isPrevMonthAllowed as n } from "../../shared-utils/calendar/date-validation.js";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ //#region src/components/calendar/CalendarNav.tsx
5
+ var a = ({ componentId: a, strings: o, year: s, month: c, earliest: l, latest: u, withcontrols: d, prevMonth: f, nextMonth: p, changeMonth: m }) => {
6
+ let h = (a) => {
7
+ let d = a === "prev", m = d ? n(s, c, l) : t(s, c, u), h = d ? o.prevMonth : o.nextMonth, g = d ? "chevron-thin-left" : "chevron-thin-right", _ = d ? "pkt-calendar__prev-month" : "pkt-calendar__next-month", v = d ? f : p;
8
+ return /* @__PURE__ */ r("div", { children: /* @__PURE__ */ i("button", {
9
+ type: "button",
10
+ "aria-label": h,
11
+ onClick: () => m && v(),
12
+ onKeyDown: (e) => {
13
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), m && v());
14
+ },
15
+ className: [
16
+ "pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",
17
+ _,
18
+ !m && "pkt-invisible"
19
+ ].filter(Boolean).join(" "),
20
+ "data-disabled": m ? void 0 : "disabled",
21
+ "aria-disabled": !m || void 0,
22
+ tabIndex: m ? 0 : -1,
23
+ children: [/* @__PURE__ */ r(e, {
24
+ className: "pkt-btn__icon",
25
+ name: g
26
+ }), /* @__PURE__ */ r("span", {
27
+ className: "pkt-btn__text",
28
+ children: h
29
+ })]
30
+ }) });
31
+ };
32
+ return /* @__PURE__ */ i("nav", {
33
+ className: "pkt-cal-month-nav",
34
+ children: [
35
+ h("prev"),
36
+ d ? /* @__PURE__ */ i("div", {
37
+ className: "pkt-cal-month-picker",
38
+ children: [
39
+ /* @__PURE__ */ r("label", {
40
+ htmlFor: `${a}-monthnav`,
41
+ className: "pkt-hide",
42
+ children: o.month
43
+ }),
44
+ /* @__PURE__ */ r("select", {
45
+ "aria-label": o.month,
46
+ className: "pkt-input pkt-input-compact",
47
+ id: `${a}-monthnav`,
48
+ value: c,
49
+ onChange: (e) => {
50
+ e.stopPropagation(), m(s, parseInt(e.target.value));
51
+ },
52
+ children: o.months.map((e, t) => /* @__PURE__ */ r("option", {
53
+ value: t,
54
+ children: e
55
+ }, t))
56
+ }),
57
+ /* @__PURE__ */ r("label", {
58
+ htmlFor: `${a}-yearnav`,
59
+ className: "pkt-hide",
60
+ children: o.year
61
+ }),
62
+ /* @__PURE__ */ r("input", {
63
+ "aria-label": o.year,
64
+ className: "pkt-input pkt-cal-input-year pkt-input-compact",
65
+ id: `${a}-yearnav`,
66
+ type: "number",
67
+ size: 4,
68
+ placeholder: "0000",
69
+ value: s,
70
+ onChange: (e) => {
71
+ e.stopPropagation(), m(parseInt(e.target.value), c);
72
+ }
73
+ })
74
+ ]
75
+ }) : /* @__PURE__ */ i("div", {
76
+ className: "pkt-txt-16-medium pkt-calendar__month-title",
77
+ "aria-live": "polite",
78
+ children: [
79
+ o.months[c],
80
+ " ",
81
+ s
82
+ ]
83
+ }),
84
+ h("next")
85
+ ]
86
+ });
87
+ };
88
+ //#endregion
89
+ export { a as CalendarNav };
@@ -0,0 +1,44 @@
1
+ import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
2
+ import { require_classnames as t } from "../../node_modules/classnames/index.js";
3
+ import { formatISODate as n, formatReadableDate as r, newDateYMD as i } from "../../shared-utils/date-utils.js";
4
+ //#region src/components/calendar/calendar-utils.ts
5
+ var a = /* @__PURE__ */ e(t(), 1);
6
+ function o(e, t, a) {
7
+ let o = i(a.year, a.month, e), s = n(o), c = s === n(t), l = a.activeSelected.includes(s), u = a.isDayDisabled(o, l), d;
8
+ return a.focusedDate ? d = a.focusedDate === s && !u ? "0" : "-1" : !u && a.tabIndexSetRef.current === 0 ? (a.tabIndexSetRef.current = e, d = "0") : d = a.tabIndexSetRef.current === e ? "0" : "-1", {
9
+ currentDate: o,
10
+ currentDateISO: s,
11
+ isToday: c,
12
+ isSelected: l,
13
+ isDisabled: u,
14
+ ariaLabel: r(o),
15
+ tabindex: d
16
+ };
17
+ }
18
+ function s(e, t) {
19
+ let { currentDateISO: r, isToday: i, isSelected: o } = e, s = t.range && (t.activeSelected.length === 2 || t.rangeHovered !== null) && r === t.activeSelected[0], c = t.range && t.activeSelected.length === 2 && r === t.activeSelected[1];
20
+ return (0, a.default)({
21
+ "pkt-cal-today": i,
22
+ "pkt-cal-selected": o,
23
+ "pkt-cal-in-range": t.inRange[r],
24
+ "pkt-cal-excluded": t.isExcluded(e.currentDate),
25
+ "pkt-cal-in-range-first": s,
26
+ "pkt-cal-in-range-last": c,
27
+ "pkt-cal-range-hover": t.rangeHovered !== null && r === n(t.rangeHovered)
28
+ });
29
+ }
30
+ function c(e, t) {
31
+ let { currentDateISO: r, isToday: i, isSelected: o, isDisabled: s } = e, c = t.range && (t.activeSelected.length === 2 || t.rangeHovered !== null) && r === t.activeSelected[0], l = t.range && t.activeSelected.length === 2 && r === t.activeSelected[1];
32
+ return (0, a.default)({
33
+ "pkt-calendar__date": !0,
34
+ "pkt-calendar__date--today": i,
35
+ "pkt-calendar__date--selected": o,
36
+ "pkt-calendar__date--disabled": s,
37
+ "pkt-calendar__date--in-range": t.inRange[r],
38
+ "pkt-calendar__date--in-range-hover": t.rangeHovered !== null && r === n(t.rangeHovered),
39
+ "pkt-calendar__date--range-start": c,
40
+ "pkt-calendar__date--range-end": l
41
+ });
42
+ }
43
+ //#endregion
44
+ export { c as getDayButtonClasses, s as getDayCellClasses, o as getDayViewData };