@oslokommune/punkt-react 19.18.2 → 19.18.5

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 (37) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/components/accordion/AccordionItem.js +1 -0
  3. package/dist/components/button/Button.js +1 -0
  4. package/dist/components/card/Card.js +1 -0
  5. package/dist/components/checkbox/Checkbox.js +1 -0
  6. package/dist/components/checkboxgroup/CheckboxGroup.js +1 -0
  7. package/dist/components/consent/Consent.js +1 -0
  8. package/dist/components/footer/Footer.js +1 -0
  9. package/dist/components/footerSimple/FooterSimple.js +1 -0
  10. package/dist/components/header/HeaderGlobal.js +1 -0
  11. package/dist/components/header/HeaderService.js +1 -0
  12. package/dist/components/header-menu/HeaderMenu.js +1 -0
  13. package/dist/components/icon/Icon.js +1 -0
  14. package/dist/components/inputwrapper/InputWrapper.js +1 -0
  15. package/dist/components/loader/Loader.d.ts +4 -32
  16. package/dist/components/loader/Loader.js +29 -27
  17. package/dist/components/messagebox/Messagebox.js +1 -0
  18. package/dist/components/modal/Modal.d.ts +2 -1
  19. package/dist/components/radio/RadioButton.js +1 -0
  20. package/dist/components/radiogroup/RadioGroup.js +1 -0
  21. package/dist/components/select/Select.js +1 -0
  22. package/dist/components/table/Table.js +1 -0
  23. package/dist/components/tag/Tag.d.ts +2 -2
  24. package/dist/components/textarea/Textarea.js +1 -0
  25. package/dist/components/timepicker/useTimepickerState.d.ts +1 -1
  26. package/dist/punkt-react.cjs +1 -1
  27. package/dist/shared-types/heading.d.ts +2 -1
  28. package/dist/shared-types/index.d.ts +4 -2
  29. package/dist/shared-types/index.js +19 -0
  30. package/dist/shared-types/loader.d.ts +48 -0
  31. package/dist/shared-types/loader.js +11 -0
  32. package/dist/shared-types/size.d.ts +4 -12
  33. package/dist/shared-types/size.js +9 -0
  34. package/package.json +2 -2
  35. package/src/components/loader/Loader.tsx +16 -39
  36. package/src/components/modal/Modal.tsx +2 -1
  37. package/src/components/tag/Tag.tsx +2 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [19.19.0](https://github.com/oslokommune/punkt/compare/19.18.4...19.19.0) (2026-10-22)
9
+
10
+ ---
11
+
12
+
13
+ ## [19.18.3](https://github.com/oslokommune/punkt/compare/19.18.2...19.18.3) (2026-10-20)
14
+
15
+ ---
16
+
17
+
8
18
  ## [19.18.2](https://github.com/oslokommune/punkt/compare/19.18.1...19.18.2) (2026-10-20)
9
19
 
10
20
  ### Bug Fixes
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { useAccordionContext as e } from "./Accordion.js";
3
3
  import { ACCORDION_LIGHT_ONLY_SKINS as t } from "../../shared-types/accordion.js";
4
+ import "../../shared-types/index.js";
4
5
  import { PktIcon as n } from "../icon/Icon.js";
5
6
  import { forwardRef as r, useState as i } from "react";
6
7
  import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { ANIMATION_DEFAULT_PATH as e } from "../../shared-types/icon.js";
3
+ import "../../shared-types/index.js";
3
4
  import { PktIcon as t } from "../icon/Icon.js";
4
5
  import { forwardRef as n } from "react";
5
6
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { CARD_DEFAULTS as t } from "../../shared-types/card.js";
4
+ import "../../shared-types/index.js";
4
5
  import { require_classnames as n } from "../../node_modules/classnames/index.js";
5
6
  import { plural as r } from "../../shared-strings/format.js";
6
7
  import { usePktStrings as i } from "../../hooks/usePktStrings.js";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { CHECKBOX_DEFAULTS as e } from "../../shared-types/checkbox.js";
3
+ import "../../shared-types/index.js";
3
4
  import { usePktStrings as t } from "../../hooks/usePktStrings.js";
4
5
  import { useGeneratedId as n } from "../../hooks/useGeneratedId.js";
5
6
  import { useCheckboxGroupContext as ee } from "../checkboxgroup/CheckboxGroupContext.js";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { OPTION_GROUP_DEFAULTS as e } from "../../shared-types/option-group.js";
3
+ import "../../shared-types/index.js";
3
4
  import { usePktStrings as t } from "../../hooks/usePktStrings.js";
4
5
  import { useGeneratedId as n } from "../../hooks/useGeneratedId.js";
5
6
  import { CheckboxGroupContext as r } from "./CheckboxGroupContext.js";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { CONSENT_DEFAULTS as e } from "../../shared-types/consent.js";
3
+ import "../../shared-types/index.js";
3
4
  import { consentStrings as t } from "../../shared-strings/consent.js";
4
5
  import { PktButton as n } from "../button/Button.js";
5
6
  import { forwardRef as r, useEffect as i, useRef as a } from "react";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import "../../shared-types/footer.js";
3
+ import "../../shared-types/index.js";
3
4
  import { PktIcon as e } from "../icon/Icon.js";
4
5
  import { PktConsent as t } from "../consent/Consent.js";
5
6
  import { getLinkDomainLabel as n } from "../../shared-utils/header-footer/external-domain.js";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import "../../shared-types/footer.js";
3
+ import "../../shared-types/index.js";
3
4
  import { PktIcon as e } from "../icon/Icon.js";
4
5
  import { PktConsent as t } from "../consent/Consent.js";
5
6
  import { getLinkDomainLabel as n } from "../../shared-utils/header-footer/external-domain.js";
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { DEFAULT_HEADER_LOGO_LINK as t } from "../../shared-types/header-footer.js";
4
+ import "../../shared-types/index.js";
4
5
  import { require_classnames as n } from "../../node_modules/classnames/index.js";
5
6
  import { PktIcon as r } from "../icon/Icon.js";
6
7
  import { PktButton as i } from "../button/Button.js";
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { DEFAULT_HEADER_LOGO_LINK as t } from "../../shared-types/header-footer.js";
4
+ import "../../shared-types/index.js";
4
5
  import { require_classnames as n } from "../../node_modules/classnames/index.js";
5
6
  import { PktIcon as r } from "../icon/Icon.js";
6
7
  import { PktButton as i } from "../button/Button.js";
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { PktAccordion as e } from "../accordion/Accordion.js";
3
3
  import { DEFAULT_HEADER_FOOTER_URL as t } from "../../shared-types/header-footer.js";
4
+ import "../../shared-types/index.js";
4
5
  import { PktIcon as n } from "../icon/Icon.js";
5
6
  import { PktAccordionItem as r } from "../accordion/AccordionItem.js";
6
7
  import { usePktStrings as i } from "../../hooks/usePktStrings.js";
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { ICON_DEFAULTS as t } from "../../shared-types/icon.js";
4
+ import "../../shared-types/index.js";
4
5
  import { require_classnames as n } from "../../node_modules/classnames/index.js";
5
6
  import { forwardRef as r, useEffect as i, useLayoutEffect as a, useRef as o } from "react";
6
7
  import { jsx as s } from "react/jsx-runtime";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { INPUT_WRAPPER_DEFAULTS as e } from "../../shared-types/input-wrapper.js";
3
+ import "../../shared-types/index.js";
3
4
  import { formatString as t } from "../../shared-strings/format.js";
4
5
  import { usePktStrings as n } from "../../hooks/usePktStrings.js";
5
6
  import { PktAlert as r } from "../alert/Alert.js";
@@ -1,41 +1,13 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
+ import { IPktLoaderBase, TPktLoaderVariant, TPktSizeBase } from '../../shared-types';
2
3
  declare global {
3
4
  interface Window {
4
5
  pktAnimationPath?: string;
5
6
  }
6
7
  }
7
- export type TPktLoaderVariant = 'blue' | 'rainbow' | 'shapes';
8
- export type TPktLoaderSize = 'small' | 'medium' | 'large';
9
- export interface IPktLoader extends HTMLAttributes<HTMLDivElement> {
10
- /**
11
- * Tid i millisekunder før loader vises. Nyttig når lastetiden kan være
12
- * så kort at loader ikke trengs.
13
- */
14
- delay?: number;
15
- /**
16
- * Vises loader inline eller som blokk.
17
- */
18
- inline?: boolean;
19
- /**
20
- * Styrer om loader eller barnenoder vises. Når `false` vises barnenoder.
21
- */
22
- isLoading?: boolean;
23
- /**
24
- * Meldingstekst som vises sammen med loader.
25
- */
26
- message?: string | null;
27
- /**
28
- * Størrelse på loader. Standard er "medium".
29
- */
30
- size?: TPktLoaderSize;
31
- /**
32
- * Loader-variant. Standard er "rainbow". "shapes" er Oslo-bølgene, "blue" en blå spinner.
33
- */
34
- variant?: TPktLoaderVariant;
35
- /**
36
- * Overstyrer stien til loader-animasjoner.
37
- */
38
- loadingAnimationPath?: string;
8
+ export type { TPktLoaderVariant };
9
+ export type TPktLoaderSize = TPktSizeBase;
10
+ export interface IPktLoader extends IPktLoaderBase, HTMLAttributes<HTMLDivElement> {
39
11
  children?: ReactNode;
40
12
  }
41
13
  export declare const PktLoader: import('react').ForwardRefExoticComponent<IPktLoader & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,47 +1,49 @@
1
1
  "use client";
2
2
  import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { ANIMATION_DEFAULT_PATH as t } from "../../shared-types/icon.js";
4
- import { require_classnames as n } from "../../node_modules/classnames/index.js";
5
- import { PktIcon as r } from "../icon/Icon.js";
6
- import { forwardRef as i, useEffect as a, useState as o } from "react";
7
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
4
+ import { LOADER_DEFAULTS as n } from "../../shared-types/loader.js";
5
+ import "../../shared-types/index.js";
6
+ import { require_classnames as r } from "../../node_modules/classnames/index.js";
7
+ import { PktIcon as i } from "../icon/Icon.js";
8
+ import { forwardRef as a, useEffect as o, useState as s } from "react";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
10
  //#region src/components/loader/Loader.tsx
9
- var l = /* @__PURE__ */ e(n(), 1);
11
+ var u = /* @__PURE__ */ e(r(), 1);
10
12
  typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/");
11
- var u = (e) => {
13
+ var d = (e) => {
12
14
  switch (e) {
13
15
  case "blue": return "spinner-blue";
14
16
  case "rainbow": return "spinner";
15
17
  default: return "loader";
16
18
  }
17
- }, d = i(function({ delay: e = 0, inline: n = !1, isLoading: i = !0, message: d = null, size: f = "medium", variant: p = "rainbow", loadingAnimationPath: m = typeof window < "u" ? window.pktAnimationPath : t, className: h, children: g, ..._ }, v) {
18
- let [y, b] = o(!1), [x, S] = o(e);
19
- e !== x && (S(e), b(!1)), a(() => {
19
+ }, f = a(function({ delay: e = n.delay, inline: r = n.inline, isLoading: a = n.isLoading, message: f = n.message, size: p = n.size, variant: m = n.variant, loadingAnimationPath: h = typeof window < "u" ? window.pktAnimationPath : t, className: g, children: _, ...v }, y) {
20
+ let [b, x] = s(!1), [S, C] = s(e);
21
+ e !== S && (C(e), x(!1)), o(() => {
20
22
  if (e <= 0) return;
21
- let t = setTimeout(() => b(!0), e);
23
+ let t = setTimeout(() => x(!0), e);
22
24
  return () => clearTimeout(t);
23
25
  }, [e]);
24
- let C = e <= 0 || y, w = (0, l.default)("pkt-loader", n ? "pkt-loader--inline" : "pkt-loader--box", `pkt-loader--${f}`, h);
25
- return /* @__PURE__ */ c("div", {
26
- ..._,
27
- ref: v,
26
+ let w = e <= 0 || b, T = (0, u.default)("pkt-loader", r ? "pkt-loader--inline" : "pkt-loader--box", `pkt-loader--${p}`, g);
27
+ return /* @__PURE__ */ l("div", {
28
+ ...v,
29
+ ref: y,
28
30
  role: "status",
29
31
  "aria-live": "polite",
30
- "aria-busy": i ? "true" : "false",
31
- className: w,
32
- children: [i && C && /* @__PURE__ */ c("div", {
32
+ "aria-busy": a ? "true" : "false",
33
+ className: T,
34
+ children: [a && w && /* @__PURE__ */ l("div", {
33
35
  className: "pkt-loader__spinner",
34
- children: [/* @__PURE__ */ s(r, {
35
- name: u(p),
36
- path: m,
37
- className: `pkt-loader__svg pkt-loader__${p}`
38
- }), d && /* @__PURE__ */ s("p", { children: d })]
39
- }), /* @__PURE__ */ s("div", {
40
- className: (0, l.default)("pkt-contents", i && "pkt-hide"),
41
- children: g
36
+ children: [/* @__PURE__ */ c(i, {
37
+ name: d(m),
38
+ path: h,
39
+ className: `pkt-loader__svg pkt-loader__${m}`
40
+ }), f && /* @__PURE__ */ c("p", { children: f })]
41
+ }), /* @__PURE__ */ c("div", {
42
+ className: (0, u.default)("pkt-contents", a && "pkt-hide"),
43
+ children: _
42
44
  })]
43
45
  });
44
46
  });
45
- d.displayName = "PktLoader";
47
+ f.displayName = "PktLoader";
46
48
  //#endregion
47
- export { d as PktLoader };
49
+ export { f as PktLoader };
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { MESSAGEBOX_DEFAULTS as t } from "../../shared-types/messagebox.js";
4
+ import "../../shared-types/index.js";
4
5
  import { require_classnames as n } from "../../node_modules/classnames/index.js";
5
6
  import { PktIcon as r } from "../icon/Icon.js";
6
7
  import { usePktStrings as i } from "../../hooks/usePktStrings.js";
@@ -1,4 +1,5 @@
1
1
  import { HTMLAttributes, ReactNode, Ref } from 'react';
2
+ import { TPktSizeBase } from '../../shared-types';
2
3
  import { IPktStringsProps } from '../../shared-strings';
3
4
  export interface IPktModal extends Omit<HTMLAttributes<HTMLDialogElement>, 'onClose' | 'open'>, IPktStringsProps<'generic'> {
4
5
  open?: boolean;
@@ -7,7 +8,7 @@ export interface IPktModal extends Omit<HTMLAttributes<HTMLDialogElement>, 'onCl
7
8
  headingIconPath?: string;
8
9
  hideCloseButton?: boolean;
9
10
  closeOnBackdropClick?: boolean;
10
- size?: 'small' | 'medium' | 'large' | 'fit-content';
11
+ size?: TPktSizeBase | 'fit-content';
11
12
  removePadding?: boolean;
12
13
  closeButtonSkin?: 'blue' | 'yellow-filled';
13
14
  variant?: 'dialog' | 'drawer';
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { RADIOBUTTON_DEFAULTS as e } from "../../shared-types/radiobutton.js";
3
+ import "../../shared-types/index.js";
3
4
  import { usePktStrings as t } from "../../hooks/usePktStrings.js";
4
5
  import { useGeneratedId as n } from "../../hooks/useGeneratedId.js";
5
6
  import { useRadioGroupContext as r } from "../radiogroup/RadioGroupContext.js";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { OPTION_GROUP_DEFAULTS as e } from "../../shared-types/option-group.js";
3
+ import "../../shared-types/index.js";
3
4
  import { useGeneratedId as t } from "../../hooks/useGeneratedId.js";
4
5
  import { useOptionGroupField as n } from "../../hooks/useOptionGroupField.js";
5
6
  import { PktInputWrapper as r } from "../inputwrapper/InputWrapper.js";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { SELECT_DEFAULTS as e } from "../../shared-types/select.js";
3
+ import "../../shared-types/index.js";
3
4
  import { useGeneratedId as t } from "../../hooks/useGeneratedId.js";
4
5
  import { describedByIds as n } from "../../shared-utils/forms/described-by.js";
5
6
  import { PktInputWrapper as r } from "../inputwrapper/InputWrapper.js";
@@ -1,5 +1,6 @@
1
1
  import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { TABLE_DEFAULTS as t } from "../../shared-types/table.js";
3
+ import "../../shared-types/index.js";
3
4
  import { require_classnames as n } from "../../node_modules/classnames/index.js";
4
5
  import { jsx as r } from "react/jsx-runtime";
5
6
  //#region src/components/table/Table.tsx
@@ -1,10 +1,10 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- import { TTagSkin } from '../../shared-types';
2
+ import { TPktSizeBase, TTagSkin } from '../../shared-types';
3
3
  import { IPktStringsProps } from '../../shared-strings';
4
4
  interface BasePktTagProps extends IPktStringsProps<'tag'> {
5
5
  skin?: TTagSkin;
6
6
  textStyle?: 'normal-text' | 'thin-text';
7
- size?: 'small' | 'medium' | 'large';
7
+ size?: TPktSizeBase;
8
8
  closeTag?: boolean;
9
9
  iconName?: string;
10
10
  ariaLabel?: string;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { TEXTAREA_DEFAULTS as e } from "../../shared-types/textarea.js";
3
+ import "../../shared-types/index.js";
3
4
  import { useGeneratedId as t } from "../../hooks/useGeneratedId.js";
4
5
  import { describedByIds as n } from "../../shared-utils/forms/described-by.js";
5
6
  import { PktInputWrapper as r } from "../inputwrapper/InputWrapper.js";
@@ -4,7 +4,7 @@ export declare function useTimepickerState(props: IPktTimepicker, ref: React.For
4
4
  id: string;
5
5
  containerRef: import('react').RefObject<HTMLDivElement | null>;
6
6
  outerClasses: string;
7
- inputSize: "medium" | "small" | "xsmall";
7
+ inputSize: "small" | "medium" | "xsmall";
8
8
  strings: {
9
9
  hours: string;
10
10
  minutes: string;