@oslokommune/punkt-react 19.15.5 → 19.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/CHANGELOG.md +27 -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.d.ts +1 -1
  67. package/dist/components/progressbar/Progressbar.js +62 -0
  68. package/dist/components/radio/RadioButton.js +85 -0
  69. package/dist/components/radiogroup/RadioGroup.js +70 -0
  70. package/dist/components/radiogroup/RadioGroupContext.js +5 -0
  71. package/dist/components/searchinput/SearchInput.js +102 -0
  72. package/dist/components/select/Select.js +56 -0
  73. package/dist/components/stepper/Step.js +78 -0
  74. package/dist/components/stepper/Stepper.js +21 -0
  75. package/dist/components/strings/PktStringsProvider.js +21 -0
  76. package/dist/components/table/Table.js +19 -0
  77. package/dist/components/table/TableBody.js +13 -0
  78. package/dist/components/table/TableDataCell.js +14 -0
  79. package/dist/components/table/TableHeader.js +12 -0
  80. package/dist/components/table/TableHeaderCell.js +12 -0
  81. package/dist/components/table/TableRow.js +12 -0
  82. package/dist/components/tabs/TabItem.js +60 -0
  83. package/dist/components/tabs/Tabs.js +90 -0
  84. package/dist/components/tag/Tag.js +76 -0
  85. package/dist/components/textarea/Textarea.js +74 -0
  86. package/dist/components/textinput/Textinput.js +106 -0
  87. package/dist/components/timepicker/Timepicker.js +224 -0
  88. package/dist/components/timepicker/useTimepickerState.js +483 -0
  89. package/dist/hooks/useElementWidth.js +23 -0
  90. package/dist/hooks/useFocusModality.js +28 -0
  91. package/dist/hooks/useGeneratedId.js +8 -0
  92. package/dist/hooks/useHeaderChrome.js +36 -0
  93. package/dist/hooks/useOptionGroupField.js +70 -0
  94. package/dist/hooks/useOwnerForm.js +15 -0
  95. package/dist/hooks/usePktStrings.js +16 -0
  96. package/dist/hooks/useScrollLock.js +12 -0
  97. package/dist/node_modules/@date-fns/tz/date/index.js +57 -0
  98. package/dist/node_modules/@date-fns/tz/date/mini.js +75 -0
  99. package/dist/node_modules/@date-fns/tz/index.js +6 -0
  100. package/dist/node_modules/@date-fns/tz/tz/index.js +1 -0
  101. package/dist/node_modules/@date-fns/tz/tzName/index.js +10 -0
  102. package/dist/node_modules/@date-fns/tz/tzOffset/index.js +22 -0
  103. package/dist/node_modules/classnames/index.js +32 -0
  104. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +6 -0
  105. package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  106. package/dist/node_modules/date-fns/_lib/format/formatters.js +389 -0
  107. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +43 -0
  108. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +38 -0
  109. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +8 -0
  110. package/dist/node_modules/date-fns/_lib/normalizeDates.js +8 -0
  111. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +11 -0
  112. package/dist/node_modules/date-fns/_lib/protectedTokens.js +23 -0
  113. package/dist/node_modules/date-fns/addDays.js +9 -0
  114. package/dist/node_modules/date-fns/constants.js +10 -0
  115. package/dist/node_modules/date-fns/constructFrom.js +7 -0
  116. package/dist/node_modules/date-fns/differenceInCalendarDays.js +11 -0
  117. package/dist/node_modules/date-fns/eachDayOfInterval.js +15 -0
  118. package/dist/node_modules/date-fns/endOfDay.js +8 -0
  119. package/dist/node_modules/date-fns/format.js +59 -0
  120. package/dist/node_modules/date-fns/getDayOfYear.js +10 -0
  121. package/dist/node_modules/date-fns/getISODay.js +8 -0
  122. package/dist/node_modules/date-fns/getISOWeek.js +11 -0
  123. package/dist/node_modules/date-fns/getISOWeekYear.js +14 -0
  124. package/dist/node_modules/date-fns/getWeek.js +11 -0
  125. package/dist/node_modules/date-fns/getWeekYear.js +15 -0
  126. package/dist/node_modules/date-fns/isDate.js +6 -0
  127. package/dist/node_modules/date-fns/isValid.js +8 -0
  128. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
  129. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +17 -0
  130. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +22 -0
  131. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +18 -0
  132. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +69 -0
  133. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +32 -0
  134. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
  135. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +202 -0
  136. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +124 -0
  137. package/dist/node_modules/date-fns/locale/en-US.js +20 -0
  138. package/dist/node_modules/date-fns/startOfDay.js +8 -0
  139. package/dist/node_modules/date-fns/startOfISOWeek.js +10 -0
  140. package/dist/node_modules/date-fns/startOfISOWeekYear.js +10 -0
  141. package/dist/node_modules/date-fns/startOfWeek.js +9 -0
  142. package/dist/node_modules/date-fns/startOfWeekYear.js +11 -0
  143. package/dist/node_modules/date-fns/startOfYear.js +8 -0
  144. package/dist/node_modules/date-fns/toDate.js +7 -0
  145. package/dist/punkt-react.cjs +1 -1
  146. package/dist/punkt-react.js +55 -9394
  147. package/dist/shared-strings/consent.js +113 -0
  148. package/dist/shared-strings/format.js +18 -0
  149. package/dist/shared-strings/nb.js +201 -0
  150. package/dist/shared-strings/resolve.js +40 -0
  151. package/dist/shared-strings/store.js +35 -0
  152. package/dist/shared-types/accordion.js +4 -0
  153. package/dist/shared-types/calendar.js +12 -0
  154. package/dist/shared-types/card.js +15 -0
  155. package/dist/shared-types/checkbox.js +15 -0
  156. package/dist/shared-types/combobox.js +19 -0
  157. package/dist/shared-types/consent.js +8 -0
  158. package/dist/shared-types/footer.js +4 -0
  159. package/dist/shared-types/header-footer.js +4 -0
  160. package/dist/shared-types/icon.js +7 -0
  161. package/dist/shared-types/messagebox.js +8 -0
  162. package/dist/shared-types/option-group.js +14 -0
  163. package/dist/shared-types/radiobutton.js +11 -0
  164. package/dist/shared-types/select.js +14 -0
  165. package/dist/shared-types/table.js +8 -0
  166. package/dist/shared-utils/calendar/calendar-grid.js +19 -0
  167. package/dist/shared-utils/calendar/date-validation.js +19 -0
  168. package/dist/shared-utils/calendar/keyboard-navigation.js +26 -0
  169. package/dist/shared-utils/calendar/selection-manager.js +52 -0
  170. package/dist/shared-utils/combobox/input-utils.js +39 -0
  171. package/dist/shared-utils/combobox/keyboard-navigation.js +41 -0
  172. package/dist/shared-utils/combobox/option-utils.js +48 -0
  173. package/dist/shared-utils/date-utils.js +71 -0
  174. package/dist/shared-utils/datepicker-utils.js +32 -0
  175. package/dist/shared-utils/device-utils.js +7 -0
  176. package/dist/shared-utils/fileupload/announcements.js +21 -0
  177. package/dist/shared-utils/fileupload/filename.js +8 -0
  178. package/dist/shared-utils/fileupload/focus-trap.js +2 -0
  179. package/dist/shared-utils/fileupload/formats.js +29 -0
  180. package/dist/shared-utils/fileupload/index.js +11 -0
  181. package/dist/shared-utils/fileupload/navigation.js +6 -0
  182. package/dist/shared-utils/fileupload/size.js +25 -0
  183. package/dist/shared-utils/fileupload/transfers.js +23 -0
  184. package/dist/shared-utils/fileupload/truncate.js +9 -0
  185. package/dist/shared-utils/fileupload/validation.js +32 -0
  186. package/dist/shared-utils/focus-trap/index.js +60 -0
  187. package/dist/shared-utils/forms/described-by.js +7 -0
  188. package/dist/shared-utils/header-footer/external-domain.js +30 -0
  189. package/dist/shared-utils/header-footer/fetch-header-footer-data.js +29 -0
  190. package/dist/shared-utils/header-footer/icon-map.js +55 -0
  191. package/dist/shared-utils/header-footer/select-megamenu.js +7 -0
  192. package/dist/shared-utils/scroll-lock/index.js +21 -0
  193. package/dist/shared-utils/timepicker/options.js +10 -0
  194. package/dist/shared-utils/timepicker/stepper.js +10 -0
  195. package/dist/shared-utils/timepicker/time-utils.js +7 -0
  196. package/dist/shared-utils/value-utils.js +12 -0
  197. package/dist/utils/nativeInputValue.js +6 -0
  198. package/dist/utils/stableKeys.js +13 -0
  199. package/dist/utils/stringutils.js +7 -0
  200. package/package.json +3 -2
  201. package/src/components/checkbox/Checkbox.tsx +2 -0
  202. package/src/components/combobox/types.ts +0 -2
  203. package/src/components/fileupload/FileUpload.tsx +3 -1
  204. package/src/components/fileupload/FileUploadContext.ts +7 -0
  205. package/src/components/fileupload/QueueDisplay.tsx +3 -3
  206. package/src/components/fileupload/Subcomponents.tsx +2 -7
  207. package/src/components/fileupload/extensions/Comments.tsx +2 -1
  208. package/src/components/fileupload/extensions/Rename.tsx +2 -1
  209. package/src/components/fileupload/types.ts +1 -2
  210. package/src/components/header/Header.test.tsx +0 -7
  211. package/src/components/header/Header.tsx +0 -2
  212. package/src/components/heading/Heading.tsx +0 -2
  213. package/src/components/helptext/Helptext.tsx +3 -4
  214. package/src/components/hydration.test.tsx +32 -0
  215. package/src/components/icon/Icon.test.tsx +0 -7
  216. package/src/components/icon/Icon.tsx +7 -0
  217. package/src/components/input/Input.tsx +0 -2
  218. package/src/components/inputwrapper/InputWrapper.tsx +3 -4
  219. package/src/components/link/Link.tsx +0 -2
  220. package/src/components/progressbar/Progressbar.test.tsx +8 -29
  221. package/src/components/progressbar/Progressbar.tsx +17 -12
  222. package/src/components/radio/RadioButton.tsx +2 -0
  223. package/src/components/searchinput/SearchInput.tsx +3 -4
  224. package/src/components/server-components.test.ts +69 -0
  225. package/src/components/ssr.test.tsx +3 -35
  226. package/src/components/stepper/Step.tsx +0 -2
  227. package/src/components/stepper/Stepper.tsx +0 -2
  228. package/src/components/strings/PktStringsProvider.tsx +2 -0
  229. package/src/components/table/Table.tsx +0 -2
  230. package/src/components/table/TableBody.tsx +1 -3
  231. package/src/components/table/TableDataCell.tsx +0 -2
  232. package/src/components/table/TableHeader.tsx +0 -2
  233. package/src/components/table/TableHeaderCell.tsx +0 -2
  234. package/src/components/table/TableRow.tsx +0 -2
  235. package/dist/components/accordion/Accordion.test.d.ts +0 -0
  236. package/dist/components/alert/Alert.test.d.ts +0 -0
  237. package/dist/components/backlink/BackLink.test.d.ts +0 -0
  238. package/dist/components/breadcrumbs/Breadcrumbs.test.d.ts +0 -1
  239. package/dist/components/button/Button.test.d.ts +0 -0
  240. package/dist/components/calendar/Calendar.accessibility.test.d.ts +0 -0
  241. package/dist/components/calendar/Calendar.constraints.test.d.ts +0 -0
  242. package/dist/components/calendar/Calendar.core.test.d.ts +0 -0
  243. package/dist/components/calendar/Calendar.interaction.test.d.ts +0 -0
  244. package/dist/components/calendar/Calendar.selection.test.d.ts +0 -0
  245. package/dist/components/card/Card.test.d.ts +0 -0
  246. package/dist/components/checkbox/Checkbox.test.d.ts +0 -0
  247. package/dist/components/checkboxgroup/CheckboxGroup.forms.test.d.ts +0 -0
  248. package/dist/components/checkboxgroup/CheckboxGroup.test.d.ts +0 -0
  249. package/dist/components/combobox/Combobox.accessibility.test.d.ts +0 -0
  250. package/dist/components/combobox/Combobox.core.test.d.ts +0 -0
  251. package/dist/components/combobox/Combobox.interaction.test.d.ts +0 -0
  252. package/dist/components/combobox/Combobox.preselection.test.d.ts +0 -0
  253. package/dist/components/combobox/Combobox.selection.test.d.ts +0 -0
  254. package/dist/components/consent/Consent.test.d.ts +0 -0
  255. package/dist/components/datepicker/Datepicker.accessibility.test.d.ts +0 -0
  256. package/dist/components/datepicker/Datepicker.core.test.d.ts +0 -0
  257. package/dist/components/datepicker/Datepicker.input.test.d.ts +0 -0
  258. package/dist/components/datepicker/Datepicker.selection.test.d.ts +0 -0
  259. package/dist/components/datepicker/Datepicker.validation.test.d.ts +0 -0
  260. package/dist/components/fileupload/FileUpload.test.d.ts +0 -0
  261. package/dist/components/fileupload/QueueDisplay.test.d.ts +0 -0
  262. package/dist/components/fileupload/Truncate.test.d.ts +0 -0
  263. package/dist/components/footer/Footer.accessibility.test.d.ts +0 -0
  264. package/dist/components/footer/Footer.test.d.ts +0 -1
  265. package/dist/components/footerSimple/FooterSimple.test.d.ts +0 -1
  266. package/dist/components/formAttribute.test.d.ts +0 -1
  267. package/dist/components/header/Header.test.d.ts +0 -0
  268. package/dist/components/header/HeaderGlobal.accessibility.test.d.ts +0 -0
  269. package/dist/components/header/HeaderGlobal.test.d.ts +0 -0
  270. package/dist/components/header/HeaderService.accessibility.test.d.ts +0 -0
  271. package/dist/components/header/HeaderService.test.d.ts +0 -0
  272. package/dist/components/header-menu/HeaderMenu.test.d.ts +0 -0
  273. package/dist/components/headerUserMenu/UserMenu.test.d.ts +0 -0
  274. package/dist/components/heading/Heading.test.d.ts +0 -0
  275. package/dist/components/helptext/Helptext.test.d.ts +0 -0
  276. package/dist/components/helptext/helptextAssociation.test.d.ts +0 -1
  277. package/dist/components/icon/Icon.test.d.ts +0 -9
  278. package/dist/components/inputwrapper/InputWrapper.test.d.ts +0 -0
  279. package/dist/components/link/Link.test.d.ts +0 -1
  280. package/dist/components/linkcard/LinkCard.test.d.ts +0 -0
  281. package/dist/components/loader/Loader.test.d.ts +0 -0
  282. package/dist/components/messagebox/Messagebox.test.d.ts +0 -1
  283. package/dist/components/modal/Modal.test.d.ts +0 -0
  284. package/dist/components/progressbar/Progressbar.test.d.ts +0 -0
  285. package/dist/components/radio/RadioButton.test.d.ts +0 -0
  286. package/dist/components/radiogroup/RadioGroup.forms.test.d.ts +0 -0
  287. package/dist/components/radiogroup/RadioGroup.test.d.ts +0 -0
  288. package/dist/components/searchinput/SearchInput.test.d.ts +0 -0
  289. package/dist/components/select/Select.test.d.ts +0 -0
  290. package/dist/components/ssr.test.d.ts +0 -1
  291. package/dist/components/stepper/Stepper.test.d.ts +0 -0
  292. package/dist/components/strings/strings-override.test.d.ts +0 -1
  293. package/dist/components/table/Table.test.d.ts +0 -0
  294. package/dist/components/tabs/Tabs.test.d.ts +0 -0
  295. package/dist/components/tag/Tag.test.d.ts +0 -0
  296. package/dist/components/textarea/Textarea.test.d.ts +0 -0
  297. package/dist/components/textinput/Textinput.test.d.ts +0 -0
  298. package/dist/components/timepicker/Timepicker.test.d.ts +0 -0
@@ -0,0 +1,197 @@
1
+ "use client";
2
+ import { PktAccordion as e } from "../accordion/Accordion.js";
3
+ import { DEFAULT_HEADER_FOOTER_URL as t } from "../../shared-types/header-footer.js";
4
+ import { PktIcon as n } from "../icon/Icon.js";
5
+ import { PktAccordionItem as r } from "../accordion/AccordionItem.js";
6
+ import { usePktStrings as i } from "../../hooks/usePktStrings.js";
7
+ import { deriveSocialIcon as a, mapOdsIcon as o } from "../../shared-utils/header-footer/icon-map.js";
8
+ import { selectLocaleData as s } from "../../shared-utils/header-footer/select-megamenu.js";
9
+ import { fetchHeaderFooterData as c } from "../../shared-utils/header-footer/fetch-header-footer-data.js";
10
+ import { useElementWidth as l } from "../../hooks/useElementWidth.js";
11
+ import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
12
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
13
+ //#region src/components/header-menu/HeaderMenu.tsx
14
+ var v = ({ dataUrl: e = t, data: n, locale: r = "nb-NO", open: a = !1, mobileBreakpoint: o = 768, className: v, onDataLoaded: y, onDataError: w, ref: E, strings: D, ...O }) => {
15
+ let k = i(["header"], D).header, [A, j] = m("loading"), [M, N] = m(void 0), P = n ? "ready" : A, F = p(y), I = p(w);
16
+ d(() => {
17
+ F.current = y;
18
+ }, [y]), d(() => {
19
+ I.current = w;
20
+ }, [w]);
21
+ let L = p(null), R = u((e) => {
22
+ L.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
23
+ }, [E]), z = l(L) < o;
24
+ d(() => {
25
+ n && F.current?.(n);
26
+ }, [n]), d(() => {
27
+ if (n) return;
28
+ let t = new AbortController();
29
+ return c(e, t.signal).then((e) => {
30
+ t.signal.aborted || (N(e), j("ready"), F.current?.(e));
31
+ }).catch((e) => {
32
+ e.name !== "AbortError" && (j("error"), I.current?.(e));
33
+ }), () => t.abort();
34
+ }, [n, e]);
35
+ let B = n ?? M, V = f(() => s(B, r), [B, r]), H = [
36
+ "pkt-header-menu",
37
+ a && "pkt-header-menu--open",
38
+ v
39
+ ].filter(Boolean).join(" ");
40
+ if (P === "loading") return /* @__PURE__ */ g("nav", {
41
+ ...O,
42
+ ref: R,
43
+ className: H,
44
+ "aria-busy": "true",
45
+ children: /* @__PURE__ */ g("p", {
46
+ className: "pkt-header-menu__loading",
47
+ children: k.menuLoading
48
+ })
49
+ });
50
+ if (P === "error" || !V) return /* @__PURE__ */ g("nav", {
51
+ ...O,
52
+ ref: R,
53
+ className: H,
54
+ "aria-hidden": !a,
55
+ children: /* @__PURE__ */ g("p", {
56
+ className: "pkt-header-menu__error",
57
+ children: k.menuLoadError
58
+ })
59
+ });
60
+ let { megamenu: U, i18n: W } = V, G = W?.navAriaLabel || "Hovedmeny";
61
+ return /* @__PURE__ */ _("nav", {
62
+ ...O,
63
+ ref: R,
64
+ className: H,
65
+ "aria-label": G,
66
+ children: [
67
+ z ? /* @__PURE__ */ g(b, {
68
+ services: U.services,
69
+ sections: U.sections
70
+ }) : /* @__PURE__ */ _(h, { children: [
71
+ /* @__PURE__ */ g(x, { services: U.services }),
72
+ /* @__PURE__ */ g(S, {
73
+ buttons: U.buttons,
74
+ mobile: !1
75
+ }),
76
+ /* @__PURE__ */ g(C, { sections: U.sections })
77
+ ] }),
78
+ /* @__PURE__ */ g(S, {
79
+ buttons: U.buttons,
80
+ mobile: !0
81
+ }),
82
+ /* @__PURE__ */ g(T, {
83
+ links: U.links,
84
+ some: U.some
85
+ })
86
+ ]
87
+ });
88
+ }, y = ({ services: e }) => /* @__PURE__ */ g("ul", {
89
+ className: "pkt-header-menu__services-list",
90
+ children: e.links.map((e) => /* @__PURE__ */ g("li", {
91
+ className: "pkt-header-menu__service",
92
+ children: /* @__PURE__ */ _("a", {
93
+ className: "pkt-header-menu__service-link",
94
+ href: e.url,
95
+ children: [/* @__PURE__ */ g(n, {
96
+ className: "pkt-header-menu__service-icon",
97
+ name: o(e.icon),
98
+ "aria-hidden": "true"
99
+ }), /* @__PURE__ */ g("span", {
100
+ className: "pkt-header-menu__service-text",
101
+ children: e.text
102
+ })]
103
+ })
104
+ }, e.url))
105
+ }), b = ({ services: t, sections: n }) => /* @__PURE__ */ g("div", {
106
+ className: "pkt-header-menu__sections",
107
+ children: /* @__PURE__ */ _(e, {
108
+ className: "pkt-header-menu__sections-inner",
109
+ skin: "plus-minus",
110
+ name: "header-menu-accordion",
111
+ children: [/* @__PURE__ */ g(r, {
112
+ className: "pkt-header-menu__section",
113
+ skin: "plus-minus",
114
+ id: "pkt-header-menu-services",
115
+ title: t.title,
116
+ children: /* @__PURE__ */ g(y, { services: t })
117
+ }), n.map((e, t) => /* @__PURE__ */ g(r, {
118
+ className: "pkt-header-menu__section",
119
+ skin: "plus-minus",
120
+ id: `pkt-header-menu-section-${t}`,
121
+ title: e.title,
122
+ children: /* @__PURE__ */ g(w, { links: e.links })
123
+ }, e.title))]
124
+ })
125
+ }), x = ({ services: e }) => /* @__PURE__ */ _("div", {
126
+ className: "pkt-header-menu__services",
127
+ children: [/* @__PURE__ */ g("h2", {
128
+ className: "pkt-header-menu__services-title",
129
+ children: e.title
130
+ }), /* @__PURE__ */ g(y, { services: e })]
131
+ }), S = ({ buttons: e, mobile: t }) => {
132
+ if (!e || e.length === 0) return null;
133
+ let r = ["pkt-header-menu__buttons", t && "pkt-header-menu__buttons--mobile"].filter(Boolean).join(" ");
134
+ return /* @__PURE__ */ g("div", {
135
+ className: r,
136
+ children: e.map((e) => /* @__PURE__ */ _("a", {
137
+ className: "pkt-btn pkt-btn--secondary pkt-btn--icon-right pkt-btn--small",
138
+ href: e.url,
139
+ children: [/* @__PURE__ */ g(n, {
140
+ className: "pkt-btn__icon",
141
+ name: e.iconName ? o(e.iconName) : "user",
142
+ "aria-hidden": "true"
143
+ }), /* @__PURE__ */ g("span", {
144
+ className: "pkt-btn__text",
145
+ children: e.text
146
+ })]
147
+ }, e.url))
148
+ });
149
+ }, C = ({ sections: e }) => !e || e.length === 0 ? null : /* @__PURE__ */ g("div", {
150
+ className: "pkt-header-menu__sections",
151
+ children: /* @__PURE__ */ g("div", {
152
+ className: "pkt-header-menu__sections-inner",
153
+ children: e.map((e) => /* @__PURE__ */ _("div", {
154
+ className: "pkt-header-menu__section",
155
+ children: [/* @__PURE__ */ g("h2", {
156
+ className: "pkt-header-menu__section-title",
157
+ children: e.title
158
+ }), /* @__PURE__ */ g(w, { links: e.links })]
159
+ }, e.title))
160
+ })
161
+ }), w = ({ links: e }) => /* @__PURE__ */ g("ul", {
162
+ className: "pkt-header-menu__section-list",
163
+ children: e.map((e) => /* @__PURE__ */ g("li", { children: /* @__PURE__ */ g("a", {
164
+ className: "pkt-header-menu__section-link",
165
+ href: e.url,
166
+ children: e.text
167
+ }) }, e.url))
168
+ }), T = ({ links: e, some: t }) => {
169
+ let n = e && e.length > 0, r = t && t.length > 0;
170
+ return !n && !r ? null : /* @__PURE__ */ _("div", {
171
+ className: "pkt-header-menu__footer",
172
+ children: [n && /* @__PURE__ */ g("ul", {
173
+ className: "pkt-header-menu__footer-list",
174
+ children: e.map((e) => /* @__PURE__ */ g("li", { children: /* @__PURE__ */ g("a", {
175
+ className: "pkt-header-menu__footer-link",
176
+ href: e.url,
177
+ children: e.text
178
+ }) }, e.url))
179
+ }), r && /* @__PURE__ */ g("ul", {
180
+ className: "pkt-header-menu__footer-list pkt-header-menu__footer-list--social",
181
+ children: t.map((e) => /* @__PURE__ */ g(E, { entry: e }, e.url))
182
+ })]
183
+ });
184
+ }, E = ({ entry: e }) => {
185
+ let t = a(e.url, e.text);
186
+ return /* @__PURE__ */ g("li", { children: /* @__PURE__ */ g("a", {
187
+ className: "pkt-header-menu__social-link",
188
+ href: e.url,
189
+ "aria-label": e.text,
190
+ children: t ? /* @__PURE__ */ g(n, {
191
+ name: t,
192
+ "aria-hidden": "true"
193
+ }) : /* @__PURE__ */ g("span", { children: e.text })
194
+ }) });
195
+ };
196
+ //#endregion
197
+ export { v as PktHeaderMenu };
@@ -0,0 +1,134 @@
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 { usePktStrings as i } from "../../hooks/usePktStrings.js";
7
+ import { withStableKeys as a } from "../../utils/stableKeys.js";
8
+ import { PktLink as o } from "../link/Link.js";
9
+ import { forwardRef as s } from "react";
10
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
11
+ //#region src/components/headerUserMenu/UserMenu.tsx
12
+ var u = /* @__PURE__ */ e(t(), 1), d = (e) => typeof e.target == "string" ? {
13
+ title: e.title,
14
+ iconName: e.iconName,
15
+ href: e.target
16
+ } : {
17
+ title: e.title,
18
+ iconName: e.iconName,
19
+ onClick: e.target
20
+ }, f = ({ item: e, className: t }) => "href" in e ? /* @__PURE__ */ c(o, {
21
+ iconName: e.iconName,
22
+ href: e.href,
23
+ className: (0, u.default)("pkt-user-menu__link", t),
24
+ children: e.title
25
+ }) : /* @__PURE__ */ l("button", {
26
+ className: (0, u.default)("pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left", t),
27
+ type: "button",
28
+ onClick: () => {
29
+ "onClick" in e && typeof e.onClick == "function" ? e.onClick() : console.error("UserMenuButton item is missing onClick handler or onClick is not a function:", e);
30
+ },
31
+ children: [e.iconName && /* @__PURE__ */ c(n, {
32
+ name: e.iconName,
33
+ className: "pkt-link__icon",
34
+ "aria-hidden": "true"
35
+ }), e.title]
36
+ }), p = ({ links: e }) => /* @__PURE__ */ c("ul", {
37
+ className: "pkt-user-menu__sublist",
38
+ children: a(e, (e) => `${"href" in e ? e.href : ""}|${e.title}`).map(({ item: e, key: t }) => /* @__PURE__ */ c("li", {
39
+ className: "pkt-user-menu__subitem",
40
+ children: /* @__PURE__ */ c(f, { item: e })
41
+ }, t))
42
+ }), m = s(({ strings: e, user: t, formattedLastLoggedIn: n, representing: a, userMenu: o, canChangeRepresentation: s, changeRepresentation: u, logoutOnClick: m }, h) => {
43
+ let g = i(["header"], e).header, _ = o?.map(d);
44
+ return /* @__PURE__ */ c("nav", {
45
+ className: "pkt-user-menu",
46
+ ref: h,
47
+ "aria-label": g.userMenuLabel,
48
+ children: /* @__PURE__ */ l("ul", {
49
+ className: "pkt-user-menu__list",
50
+ children: [
51
+ t && /* @__PURE__ */ l("li", {
52
+ className: "pkt-user-menu__item",
53
+ children: [
54
+ /* @__PURE__ */ c("div", {
55
+ className: "pkt-user-menu__label",
56
+ children: g.loggedInAs
57
+ }),
58
+ /* @__PURE__ */ c("div", {
59
+ className: "pkt-user-menu__name",
60
+ translate: "no",
61
+ children: t.name
62
+ }),
63
+ n && /* @__PURE__ */ l("div", {
64
+ className: "pkt-user-menu__last-logged-in",
65
+ children: [
66
+ g.lastLoggedIn,
67
+ " ",
68
+ /* @__PURE__ */ c("time", { children: n })
69
+ ]
70
+ })
71
+ ]
72
+ }),
73
+ _ && _.length > 0 && /* @__PURE__ */ c("li", {
74
+ className: "pkt-user-menu__item",
75
+ children: /* @__PURE__ */ c(p, { links: _ })
76
+ }),
77
+ a && /* @__PURE__ */ l("li", {
78
+ className: "pkt-user-menu__item",
79
+ children: [
80
+ /* @__PURE__ */ c("div", {
81
+ className: "pkt-user-menu__label",
82
+ children: g.representing
83
+ }),
84
+ /* @__PURE__ */ c("div", {
85
+ className: "pkt-user-menu__name",
86
+ translate: "no",
87
+ children: a.name
88
+ }),
89
+ a.orgNumber && /* @__PURE__ */ c("div", {
90
+ className: "pkt-user-menu__org-number",
91
+ children: r(g.orgNumber, { number: a.orgNumber })
92
+ }),
93
+ s && u && /* @__PURE__ */ c("ul", {
94
+ className: "pkt-user-menu__sublist mt-size-16",
95
+ children: /* @__PURE__ */ c("li", {
96
+ className: "pkt-user-menu__subitem",
97
+ children: /* @__PURE__ */ c(f, { item: {
98
+ title: g.changeRepresentation,
99
+ iconName: "cogwheel",
100
+ onClick: u
101
+ } })
102
+ })
103
+ })
104
+ ]
105
+ }),
106
+ !a && s && u && /* @__PURE__ */ c("li", {
107
+ className: "pkt-user-menu__item",
108
+ children: /* @__PURE__ */ c("ul", {
109
+ className: "pkt-user-menu__sublist",
110
+ children: /* @__PURE__ */ c("li", {
111
+ className: "pkt-user-menu__subitem",
112
+ children: /* @__PURE__ */ c(f, { item: {
113
+ title: g.changeRepresentation,
114
+ iconName: "cogwheel",
115
+ onClick: u
116
+ } })
117
+ })
118
+ })
119
+ }),
120
+ m && /* @__PURE__ */ c("li", {
121
+ className: "pkt-user-menu__item",
122
+ children: /* @__PURE__ */ c(f, { item: {
123
+ title: g.logOut,
124
+ iconName: "exit",
125
+ onClick: m
126
+ } })
127
+ })
128
+ ]
129
+ })
130
+ });
131
+ });
132
+ m.displayName = "PktHeaderUserMenu";
133
+ //#endregion
134
+ export { m as PktHeaderUserMenu };
@@ -0,0 +1,37 @@
1
+ import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
2
+ import { require_classnames as t } from "../../node_modules/classnames/index.js";
3
+ import { forwardRef as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region src/components/heading/Heading.tsx
6
+ var i = /* @__PURE__ */ e(t(), 1), a = (e) => {
7
+ switch (e) {
8
+ case 1: return "xlarge";
9
+ case 2: return "large";
10
+ case 3: return "medium";
11
+ case 4: return "small";
12
+ case 5:
13
+ case 6: return "xsmall";
14
+ default: return "medium";
15
+ }
16
+ }, o = (e) => {
17
+ switch (e) {
18
+ case 1:
19
+ case 2: return "regular";
20
+ case 3:
21
+ case 4:
22
+ case 5:
23
+ case 6: return "medium";
24
+ default: return "medium";
25
+ }
26
+ }, s = n(function({ level: e = 2, size: t, weight: n, visuallyHidden: s, align: c, className: l, children: u, ...d }, f) {
27
+ let p = t ?? a(e), m = n ?? o(e), h = (0, i.default)("pkt-heading", `pkt-heading--${p}`, `pkt-heading--fw-${m}`, c && `pkt-heading--${c}`, s && "pkt-sr-only", l), g = `h${e}`;
28
+ return /* @__PURE__ */ r(g, {
29
+ ...d,
30
+ ref: f,
31
+ className: h,
32
+ children: u
33
+ });
34
+ });
35
+ s.displayName = "PktHeading";
36
+ //#endregion
37
+ export { s as PktHeading };
@@ -0,0 +1,50 @@
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 { useGeneratedId as r } from "../../hooks/useGeneratedId.js";
6
+ import { forwardRef as i, useState as a } from "react";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ //#region src/components/helptext/Helptext.tsx
9
+ var c = /* @__PURE__ */ e(t(), 1), l = "Les mer <span class='pkt-sr-only'>om feltet</span>", u = (e) => e == null || e === "" ? null : typeof e == "string" ? /* @__PURE__ */ o("span", { dangerouslySetInnerHTML: { __html: e } }) : e, d = i(function({ helptext: e, helptextDropdown: t, helptextDropdownButton: i, forId: d, onToggleHelpText: f, className: p, children: m, ...h }, g) {
10
+ let [_, v] = a(!1), y = r(d), b = () => {
11
+ let e = !_;
12
+ v(e), f?.(e);
13
+ }, x = (0, c.default)("pkt-inputwrapper__helptext-container", !!(e || t || m) && "pkt-inputwrapper__has-helptext", p);
14
+ return /* @__PURE__ */ s("div", {
15
+ ...h,
16
+ ref: g,
17
+ className: x,
18
+ children: [/* @__PURE__ */ s("div", {
19
+ className: "pkt-inputwrapper__helptext",
20
+ id: `${y}-helptext`,
21
+ children: [m && /* @__PURE__ */ o("div", {
22
+ className: "pkt-contents",
23
+ children: m
24
+ }), u(e)]
25
+ }), t && /* @__PURE__ */ s("div", {
26
+ className: "pkt-inputwrapper__helptext-expandable",
27
+ children: [/* @__PURE__ */ s("button", {
28
+ type: "button",
29
+ className: "pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right",
30
+ "aria-expanded": _,
31
+ "aria-controls": `${y}-helptext-expandable`,
32
+ onClick: b,
33
+ children: [/* @__PURE__ */ o(n, {
34
+ className: "pkt-btn__icon",
35
+ name: _ ? "chevron-thin-up" : "chevron-thin-down"
36
+ }), /* @__PURE__ */ o("span", {
37
+ className: "pkt-btn__text",
38
+ dangerouslySetInnerHTML: { __html: i ?? l }
39
+ })]
40
+ }), /* @__PURE__ */ o("div", {
41
+ id: `${y}-helptext-expandable`,
42
+ className: (0, c.default)("pkt-inputwrapper__helptext", _ ? "pkt-inputwrapper__helptext-expandable-open" : "pkt-inputwrapper__helptext-expandable-closed"),
43
+ children: u(t)
44
+ })]
45
+ })]
46
+ });
47
+ });
48
+ d.displayName = "PktHelptext";
49
+ //#endregion
50
+ export { d as PktHelptext };
@@ -1,6 +1,12 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
3
3
  import { IPktIconBase } from '../../shared-types';
4
+ declare global {
5
+ interface Window {
6
+ pktFetch?: (url: string) => Promise<Pick<Response, 'ok' | 'text'>>;
7
+ pktIconPath?: string;
8
+ }
9
+ }
4
10
  interface IPktIcon extends Omit<IPktIconBase, 'name'>, HTMLAttributes<HTMLElement> {
5
11
  name?: PktIconName;
6
12
  }
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
+ import { ICON_DEFAULTS as t } from "../../shared-types/icon.js";
4
+ import { require_classnames as n } from "../../node_modules/classnames/index.js";
5
+ import { forwardRef as r, useEffect as i, useLayoutEffect as a, useRef as o } from "react";
6
+ import { jsx as s } from "react/jsx-runtime";
7
+ //#region src/components/icon/Icon.tsx
8
+ var c = /* @__PURE__ */ e(n(), 1);
9
+ typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || t.path);
10
+ var l = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", u = {}, d = 2, f = 1500, p = typeof Storage < "u" && typeof sessionStorage < "u", m = typeof window < "u" ? a : i, h = (e, t) => !e || !p ? "" : sessionStorage.getItem(t + e + ".svg") ?? "", g = (e) => window.pktFetch(e).then((t) => {
11
+ if (!t.ok) throw Error("Missing icon: " + e);
12
+ return t.text();
13
+ }), _ = async (e, t = d) => {
14
+ try {
15
+ return await g(e);
16
+ } catch {
17
+ return t > 0 ? (await new Promise((e) => setTimeout(e, f)), _(e, t - 1)) : (console.error("Failed to fetch icon: " + e), l);
18
+ }
19
+ }, v = async (e, t) => {
20
+ let n = t + e + ".svg";
21
+ return p && sessionStorage.getItem(n) ? sessionStorage.getItem(n) : n in u ? u[n] : typeof window < "u" && typeof window.pktFetch == "function" ? (u[n] = _(n).then((e) => (e !== l && p && sessionStorage.setItem(n, e), delete u[n], e)), u[n]) : l;
22
+ }, y = (e) => {
23
+ if (e !== void 0) return e === !0 || e === "true";
24
+ }, b = r(function({ name: e = t.name, path: n, className: r, ariaHidden: i, ariaLabel: a, "aria-hidden": u, "aria-label": d, ...f }, p) {
25
+ let g = n ?? (typeof window < "u" ? window.pktIconPath : t.path), _ = o(null), b = y(i) ?? y(u), x = a ?? d, S = b === void 0 ? !x : b, C = S ? void 0 : x || e;
26
+ m(() => {
27
+ let t = _.current;
28
+ if (!t) return;
29
+ let n = (e) => {
30
+ let t = e.querySelector("svg");
31
+ t && (t.setAttribute("aria-hidden", String(S)), C ? t.setAttribute("aria-label", C) : t.removeAttribute("aria-label"));
32
+ };
33
+ if (!e) {
34
+ t.innerHTML = "";
35
+ return;
36
+ }
37
+ let r = h(e, g);
38
+ if (r) {
39
+ t.innerHTML = r, n(t);
40
+ return;
41
+ }
42
+ let i = !1;
43
+ return v(e, g).then((e) => {
44
+ if (i) return;
45
+ let t = _.current;
46
+ t && (t.innerHTML = e || l, n(t));
47
+ }), () => {
48
+ i = !0;
49
+ };
50
+ }, [
51
+ e,
52
+ g,
53
+ S,
54
+ C
55
+ ]);
56
+ let w = (e) => {
57
+ _.current = e, typeof p == "function" ? p(e) : p && (p.current = e);
58
+ };
59
+ return /* @__PURE__ */ s("span", {
60
+ ...f,
61
+ ref: w,
62
+ className: (0, c.default)("pkt-icon", r),
63
+ ...e ? { name: e } : {},
64
+ "data-path": g
65
+ });
66
+ });
67
+ b.displayName = "PktIcon";
68
+ //#endregion
69
+ export { b as PktIcon };
@@ -0,0 +1,23 @@
1
+ import { forwardRef as e } from "react";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ //#region src/components/input/Input.tsx
4
+ var r = e(({ label: e, id: r, children: i, ...a }, o) => /* @__PURE__ */ n("div", {
5
+ className: "pkt-form-group",
6
+ children: [
7
+ /* @__PURE__ */ t("label", {
8
+ htmlFor: r,
9
+ className: "pkt-form-label",
10
+ children: e
11
+ }),
12
+ /* @__PURE__ */ t("input", {
13
+ className: "pkt-form-input",
14
+ id: r,
15
+ ...a,
16
+ ref: o
17
+ }),
18
+ i
19
+ ]
20
+ }));
21
+ r.displayName = "PktInput";
22
+ //#endregion
23
+ export { r as PktInput };
@@ -0,0 +1,128 @@
1
+ "use client";
2
+ import { formatString as e } from "../../shared-strings/format.js";
3
+ import { usePktStrings as t } from "../../hooks/usePktStrings.js";
4
+ import { PktAlert as n } from "../alert/Alert.js";
5
+ import { useGeneratedId as r } from "../../hooks/useGeneratedId.js";
6
+ import { useFocusModality as i } from "../../hooks/useFocusModality.js";
7
+ import { counterStatusId as a, isCounterExceeded as o } from "../../shared-utils/forms/described-by.js";
8
+ import { PktHelptext as s } from "../helptext/Helptext.js";
9
+ import { forwardRef as c } from "react";
10
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
11
+ //#region src/components/inputwrapper/InputWrapper.tsx
12
+ var f = c(({ id: c, forId: f, label: p, helptext: m, helptextDropdown: h, helptextDropdownButton: ee, counter: g, counterCurrent: _ = 0, counterMaxLength: v, optionalTag: y = !1, optionalText: b, requiredTag: x = !1, requiredText: S, tagText: C = null, hasError: w = !1, errorMessage: T, disabled: E = !1, inline: D = !1, ariaDescribedby: O, useWrapper: k = !0, children: A, className: j = "", hasFieldset: M = !1, layout: N = "vertical", role: P, counterPosition: F = "bottom", size: I = "medium", strings: L, onFocus: R, onBlur: z }, B) => {
13
+ let V = i(B), H = t(["forms", "validation"], L), U = r(f), W = [...new Set([O || (m ? `${U}-helptext` : ""), w && T ? `${U}-error` : ""].join(" ").split(" ").filter(Boolean))].join(" ") || void 0, G = !!g, K = G && F === "top", q = G && F === "bottom", J = [
14
+ "pkt-inputwrapper",
15
+ j,
16
+ w ? "pkt-inputwrapper--error" : "",
17
+ E ? "pkt-inputwrapper--disabled" : "",
18
+ D ? "pkt-inputwrapper--inline" : "",
19
+ I ? `pkt-inputwrapper--${I}` : ""
20
+ ].filter(Boolean).join(" "), Y = [
21
+ "pkt-tag",
22
+ "pkt-tag--small",
23
+ "pkt-tag--thin-text"
24
+ ].join(" "), X = o(_, v), Z = G ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ d("div", {
25
+ className: "pkt-input__counter",
26
+ "aria-hidden": "true",
27
+ children: [_, v ? `/${v}` : ""]
28
+ }), /* @__PURE__ */ u("div", {
29
+ className: "pkt-sr-only",
30
+ id: a(U),
31
+ "aria-live": "polite",
32
+ children: X ? e(H.validation.counterExceeded, {
33
+ current: _,
34
+ max: v ?? 0
35
+ }) : ""
36
+ })] }) : null, Q = () => /* @__PURE__ */ d(l, { children: [
37
+ C && /* @__PURE__ */ u("span", {
38
+ className: Y + " pkt-tag--gray",
39
+ children: C
40
+ }),
41
+ y && /* @__PURE__ */ u("span", {
42
+ className: Y + " pkt-tag--blue-light",
43
+ children: b ?? H.forms.optional
44
+ }),
45
+ x && /* @__PURE__ */ u("span", {
46
+ className: Y + " pkt-tag--beige",
47
+ children: S ?? H.forms.required
48
+ })
49
+ ] }), te = () => {
50
+ let e = /* @__PURE__ */ d(l, { children: [
51
+ p,
52
+ " ",
53
+ Q()
54
+ ] });
55
+ return !k && M ? /* @__PURE__ */ u("legend", {
56
+ className: "pkt-sr-only",
57
+ id: `${U}-label`,
58
+ children: p
59
+ }) : k ? M ? /* @__PURE__ */ u("legend", {
60
+ className: "pkt-inputwrapper__legend",
61
+ id: `${U}-label`,
62
+ children: e
63
+ }) : /* @__PURE__ */ u("label", {
64
+ className: "pkt-inputwrapper__label",
65
+ htmlFor: U,
66
+ id: `${U}-label`,
67
+ children: e
68
+ }) : /* @__PURE__ */ u("label", {
69
+ htmlFor: U,
70
+ className: "pkt-sr-only",
71
+ id: `${U}-label`,
72
+ children: p
73
+ });
74
+ }, ne = () => {
75
+ let e = k ? m : void 0;
76
+ return !e && !h ? null : /* @__PURE__ */ u(s, {
77
+ forId: U,
78
+ helptext: e,
79
+ helptextDropdown: h,
80
+ helptextDropdownButton: ee ?? H.forms.readMore
81
+ });
82
+ }, re = I === "medium" ? "small" : "xsmall", $ = /* @__PURE__ */ d(l, { children: [
83
+ te(),
84
+ ne(),
85
+ K && Z,
86
+ M || N === "horizontal" ? /* @__PURE__ */ u("div", {
87
+ className: N === "horizontal" ? "pkt-inputwrapper__options pkt-inputwrapper__options--horizontal" : "pkt-inputwrapper__options",
88
+ children: A
89
+ }) : A,
90
+ q && Z,
91
+ w && T && /* @__PURE__ */ u("div", {
92
+ className: "pkt-inputwrapper__alert-wrapper",
93
+ children: /* @__PURE__ */ u(n, {
94
+ skin: "error",
95
+ size: re,
96
+ "aria-live": "assertive",
97
+ role: "alert",
98
+ id: `${U}-error`,
99
+ children: T
100
+ })
101
+ })
102
+ ] });
103
+ return /* @__PURE__ */ u("div", {
104
+ id: c,
105
+ className: J,
106
+ role: P,
107
+ "aria-labelledby": P ? `${U}-label` : void 0,
108
+ ...V,
109
+ onFocus: (e) => {
110
+ V.onFocus(), R?.(e);
111
+ },
112
+ onBlur: (e) => {
113
+ V.onBlur(e), z?.(e);
114
+ },
115
+ children: M ? /* @__PURE__ */ u("fieldset", {
116
+ className: "pkt-inputwrapper__fieldset",
117
+ "aria-describedby": W,
118
+ disabled: E || void 0,
119
+ children: $
120
+ }) : /* @__PURE__ */ u("div", {
121
+ className: "pkt-inputwrapper__fieldset",
122
+ children: $
123
+ })
124
+ });
125
+ });
126
+ f.displayName = "PktInputWrapper";
127
+ //#endregion
128
+ export { f as PktInputWrapper };