@oslokommune/punkt-react 19.19.1 → 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +3 -2
  3. package/dist/components/card/Card.js +77 -70
  4. package/dist/components/checkbox/Checkbox.js +1 -1
  5. package/dist/components/inputwrapper/InputWrapper.js +1 -1
  6. package/dist/components/link/Link.d.ts +0 -1
  7. package/dist/components/link/Link.js +10 -12
  8. package/dist/components/linkcard/LinkCard.d.ts +1 -1
  9. package/dist/components/linkcard/LinkCard.js +23 -20
  10. package/dist/components/messagebox/Messagebox.js +29 -28
  11. package/dist/components/progressbar/Progressbar.d.ts +2 -16
  12. package/dist/components/progressbar/Progressbar.js +49 -42
  13. package/dist/components/radio/RadioButton.js +1 -1
  14. package/dist/components/tag/Tag.d.ts +2 -1
  15. package/dist/components/tag/Tag.js +37 -35
  16. package/dist/punkt-react.cjs +1 -1
  17. package/dist/shared-strings/nb.d.ts +3 -0
  18. package/dist/shared-strings/nb.js +1 -0
  19. package/dist/shared-types/card.d.ts +5 -17
  20. package/dist/shared-types/card.js +9 -8
  21. package/dist/shared-types/combobox.d.ts +3 -3
  22. package/dist/shared-types/icon.d.ts +2 -2
  23. package/dist/shared-types/icon.js +1 -1
  24. package/dist/shared-types/index.d.ts +11 -9
  25. package/dist/shared-types/index.js +17 -15
  26. package/dist/shared-types/linkcard.d.ts +7 -4
  27. package/dist/shared-types/linkcard.js +9 -0
  28. package/dist/shared-types/messagebox.d.ts +4 -2
  29. package/dist/shared-types/messagebox.js +8 -3
  30. package/dist/shared-types/progressbar.d.ts +82 -5
  31. package/dist/shared-types/progressbar.js +14 -0
  32. package/dist/shared-types/skin.d.ts +8 -2
  33. package/package.json +4 -4
  34. package/src/components/button/Button.test.tsx +1 -1
  35. package/src/components/card/Card.test.tsx +78 -43
  36. package/src/components/card/Card.tsx +17 -24
  37. package/src/components/checkbox/Checkbox.tsx +1 -1
  38. package/src/components/inputwrapper/InputWrapper.tsx +1 -1
  39. package/src/components/link/Link.test.tsx +9 -21
  40. package/src/components/link/Link.tsx +0 -4
  41. package/src/components/linkcard/LinkCard.test.tsx +20 -9
  42. package/src/components/linkcard/LinkCard.tsx +5 -11
  43. package/src/components/messagebox/Messagebox.test.tsx +10 -1
  44. package/src/components/messagebox/Messagebox.tsx +11 -2
  45. package/src/components/progressbar/Progressbar.test.tsx +25 -0
  46. package/src/components/progressbar/Progressbar.tsx +30 -40
  47. package/src/components/radio/RadioButton.tsx +1 -1
  48. package/src/components/tag/Tag.test.tsx +21 -0
  49. package/src/components/tag/Tag.tsx +6 -2
@@ -80,6 +80,9 @@ export declare const nb: {
80
80
  tag: {
81
81
  remove: string;
82
82
  };
83
+ progressbar: {
84
+ fraction: string;
85
+ };
83
86
  header: {
84
87
  search: string;
85
88
  menu: string;
@@ -109,6 +109,7 @@ var e = {
109
109
  tagsLabelOther: "merkelapper"
110
110
  },
111
111
  tag: { remove: "Klikk for å fjerne {label}" },
112
+ progressbar: { fraction: "{current} av {total}" },
112
113
  header: {
113
114
  search: "Søk",
114
115
  menu: "Meny",
@@ -8,14 +8,10 @@ import type { THeadingLevel } from './heading';
8
8
  import type { TLayout } from './layout';
9
9
  import type { TTagSkin } from './skin';
10
10
  /** Card skin variants — shared runtime source for types, specs, and Preview. */
11
- export declare const CARD_SKINS: readonly ['outlined', 'outlined-beige', 'gray', 'blue', 'beige', 'green'];
11
+ export declare const CARD_SKINS: readonly ['gray', 'outlined', 'transparent', 'white', 'blue', 'green', 'beige'];
12
12
  export type TCardSkin = (typeof CARD_SKINS)[number];
13
- /** Card padding variants — shared runtime source for types, specs, and Preview. */
14
- export declare const CARD_PADDINGS: readonly ['none', 'default'];
15
- export type TCardPadding = (typeof CARD_PADDINGS)[number];
16
- /** Card image shape variants — shared runtime source for types, specs, and Preview. */
17
- export declare const CARD_IMAGE_SHAPES: readonly ['square', 'round'];
18
- export type TCardImageShape = (typeof CARD_IMAGE_SHAPES)[number];
13
+ /** Skins without a dark variant. The card gets `data-mode="light"` and stays in light mode. */
14
+ export declare const CARD_LIGHT_ONLY_SKINS: readonly TCardSkin[];
19
15
  /** Card image aspect-ratio overrides — shared runtime source for types, specs, and Preview. */
20
16
  export declare const CARD_IMAGE_ASPECTS: readonly ['auto', '1-1', '4-3', '3-2', '16-9', '19-10'];
21
17
  export type TCardImageAspect = (typeof CARD_IMAGE_ASPECTS)[number];
@@ -49,14 +45,10 @@ export interface IPktCardBase {
49
45
  heading?: string;
50
46
  headingLevel?: THeadingLevel;
51
47
  image?: ICardImage;
52
- imageShape?: TCardImageShape;
53
48
  imageAspect?: TCardImageAspect;
54
- restrictImageHeight?: boolean;
55
49
  clickCardLink?: string | null;
56
50
  openLinkInNewTab?: boolean;
57
- borderOnHover?: boolean;
58
51
  zoom?: boolean;
59
- padding?: TCardPadding;
60
52
  skin?: TCardSkin;
61
53
  subheading?: string;
62
54
  tagPosition?: TCardTagPosition;
@@ -68,19 +60,15 @@ export interface IPktCardBase {
68
60
  * shared between React and Elements — there are no reactOnly/elementsOnly
69
61
  * props or events on this component.
70
62
  */
71
- export type ICardSpecProps = Pick<IPktCardBase, 'ariaLabel' | 'metaLead' | 'metaTrail' | 'layout' | 'heading' | 'headingLevel' | 'image' | 'imageShape' | 'imageAspect' | 'restrictImageHeight' | 'clickCardLink' | 'openLinkInNewTab' | 'borderOnHover' | 'zoom' | 'padding' | 'skin' | 'subheading' | 'tagPosition' | 'tags'>;
63
+ export type ICardSpecProps = Pick<IPktCardBase, 'ariaLabel' | 'metaLead' | 'metaTrail' | 'layout' | 'heading' | 'headingLevel' | 'image' | 'imageAspect' | 'clickCardLink' | 'openLinkInNewTab' | 'zoom' | 'skin' | 'subheading' | 'tagPosition' | 'tags'>;
72
64
  /**
73
65
  * Default values for pkt-card. Single source of truth for both frameworks
74
66
  */
75
67
  export declare const CARD_DEFAULTS: {
76
68
  readonly headingLevel: 3;
77
69
  readonly layout: 'vertical';
78
- readonly skin: 'outlined';
79
- readonly padding: 'default';
70
+ readonly skin: 'gray';
80
71
  readonly tagPosition: 'top';
81
72
  readonly openLinkInNewTab: false;
82
- readonly borderOnHover: true;
83
73
  readonly zoom: false;
84
- readonly imageShape: 'square';
85
- readonly restrictImageHeight: false;
86
74
  };
@@ -1,15 +1,16 @@
1
1
  //#region ../../shared-types/card.ts
2
- var e = {
2
+ var e = [
3
+ "white",
4
+ "blue",
5
+ "green",
6
+ "beige"
7
+ ], t = {
3
8
  headingLevel: 3,
4
9
  layout: "vertical",
5
- skin: "outlined",
6
- padding: "default",
10
+ skin: "gray",
7
11
  tagPosition: "top",
8
12
  openLinkInNewTab: !1,
9
- borderOnHover: !0,
10
- zoom: !1,
11
- imageShape: "square",
12
- restrictImageHeight: !1
13
+ zoom: !1
13
14
  };
14
15
  //#endregion
15
- export { e as CARD_DEFAULTS };
16
+ export { t as CARD_DEFAULTS, e as CARD_LIGHT_ONLY_SKINS };
@@ -5,14 +5,14 @@
5
5
  * Used by both Elements and React implementations,
6
6
  * the shared combobox helper functions, and typed component specs.
7
7
  */
8
+ import { type TTagSkin } from './skin';
8
9
  import type { IFormFieldErrorProps, IFormFieldLabelProps, IHelptextProps, ITagOptionalRequiredProps } from './form-field';
9
10
  import type { TPktInputSize } from './size';
10
11
  /**
11
12
  * Tag skin colors available for combobox option tags.
12
- * Matches the TTagSkin values from the tag component.
13
13
  */
14
- export declare const COMBOBOX_TAG_SKINS: readonly ['blue', 'blue-dark', 'blue-light', 'green', 'red', 'yellow', 'beige', 'gray', 'grey'];
15
- export type TPktComboboxTagSkin = (typeof COMBOBOX_TAG_SKINS)[number];
14
+ export declare const COMBOBOX_TAG_SKINS: readonly ["gray", "gray-light", "blue-dark", "blue", "blue-light", "blue-pale", "green", "green-light", "red", "red-light", "yellow", "yellow-light", "beige", "beige-light"];
15
+ export type TPktComboboxTagSkin = TTagSkin;
16
16
  /**
17
17
  * Represents a single option in a combobox or listbox.
18
18
  */
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { Booleanish } from './booleanish';
8
8
  /** Default CDN path for icons. Overridden globally by `window.pktIconPath`. */
9
- export declare const ICON_DEFAULT_PATH = "https://punkt-cdn.oslo.kommune.no/latest/icons/";
9
+ export declare const ICON_DEFAULT_PATH = "https://cdn.ikoner.oslo.kommune.no/icons/";
10
10
  /** Default CDN path for loading animations. Overridden globally by `window.pktAnimationPath`. */
11
11
  export declare const ANIMATION_DEFAULT_PATH = "https://punkt-cdn.oslo.kommune.no/latest/animations/";
12
12
  /** Icon size modifier classes — shared runtime source for types, specs, and Preview. */
@@ -37,5 +37,5 @@ export type IIconSpecProps = Pick<IPktIconBase, 'name' | 'path' | 'ariaHidden' |
37
37
  */
38
38
  export declare const ICON_DEFAULTS: {
39
39
  readonly name: '';
40
- readonly path: "https://punkt-cdn.oslo.kommune.no/latest/icons/";
40
+ readonly path: "https://cdn.ikoner.oslo.kommune.no/icons/";
41
41
  };
@@ -1,5 +1,5 @@
1
1
  //#region ../../shared-types/icon.ts
2
- var e = "https://punkt-cdn.oslo.kommune.no/latest/icons/", t = "https://punkt-cdn.oslo.kommune.no/latest/animations/", n = {
2
+ var e = "https://cdn.ikoner.oslo.kommune.no/icons/", t = "https://punkt-cdn.oslo.kommune.no/latest/animations/", n = {
3
3
  name: "",
4
4
  path: e
5
5
  };
@@ -11,8 +11,8 @@ export { HEADER_MENU_LOCALES, DEFAULT_HEADER_FOOTER_URL, DEFAULT_HEADER_LOGO_LIN
11
11
  export type { THeaderMenuLocale, IHeaderMenuLink, IHeaderMenuIconLink, IHeaderMenuButton, IHeaderMenuServices, IHeaderMenuSection, IMegaMenu, IHeaderFooter, IHeaderFooterLocaleData, THeaderFooterApi, IPktHeaderMenu, IPktHeaderGlobal, } from './header-footer';
12
12
  export type { IPktFooterLink, IPktFooterColumn, IPktFooterSocialLink, IPktFooterBase, IPktFooterProps, IPktFooterSimpleProps, IFooterSimpleSpecProps, IFooterSpecProps, } from './footer';
13
13
  export { DEFAULT_FOOTER_PERSONVERN_URL, DEFAULT_FOOTER_TILGJENGELIGHET_URL } from './footer';
14
- export { CARD_SKINS, CARD_PADDINGS, CARD_IMAGE_SHAPES, CARD_IMAGE_ASPECTS, CARD_TAG_POSITIONS, CARD_TAG_SKIN_OPTIONS, CARD_DEFAULTS, } from './card';
15
- export type { TCardSkin, TCardPadding, TCardImageShape, TCardImageAspect, TCardTagPosition, ICardTag, ICardImage, IPktCardBase, ICardSpecProps, } from './card';
14
+ export { CARD_SKINS, CARD_LIGHT_ONLY_SKINS, CARD_IMAGE_ASPECTS, CARD_TAG_POSITIONS, CARD_TAG_SKIN_OPTIONS, CARD_DEFAULTS, } from './card';
15
+ export type { TCardSkin, TCardImageAspect, TCardTagPosition, ICardTag, ICardImage, IPktCardBase, ICardSpecProps, } from './card';
16
16
  export { CHECKBOX_LABEL_POSITIONS, CHECKBOX_DEFAULTS } from './checkbox';
17
17
  export type { TCheckboxLabelPosition, IPktCheckboxBase, ICheckboxSpecProps } from './checkbox';
18
18
  export { RADIOBUTTON_DEFAULTS } from './radiobutton';
@@ -33,8 +33,8 @@ export type { TAccordionSkin, IPktAccordionBase, IPktAccordionItemBase, IAccordi
33
33
  export { BUTTON_SIZES, BUTTON_SKINS, BUTTON_COLORS, BUTTON_VARIANTS, BUTTON_STATES } from './button';
34
34
  export type { TPktButtonSize, TPktButtonSkin, TPktButtonColor, TPktButtonVariant, TPktButtonState, IPktButtonBase, IButtonSpecProps, } from './button';
35
35
  export type { IPktBackLinkBase, IBacklinkSpecProps } from './backlink';
36
- export { LINKCARD_SKINS } from './linkcard';
37
- export type { TLinkCardSkin, IPktLinkCardBase, ILinkcardSpecProps } from './linkcard';
36
+ export { LINKCARD_SKINS, LINKCARD_LIGHT_ONLY_SKINS } from './linkcard';
37
+ export type { TLinkCardSkin, TDeprecatedLinkCardSkin, IPktLinkCardBase, ILinkcardSpecProps, } from './linkcard';
38
38
  export { BREADCRUMBS_NAVIGATION_TYPES } from './breadcrumbs';
39
39
  export type { TBreadcrumbsNavigationType, IBreadcrumb, IBreadcrumbItem, IBreadcrumbs, IPktBreadcrumbsBase, IBreadcrumbsSpecProps, } from './breadcrumbs';
40
40
  export type { IRenderLink, TRenderLink } from './render-link';
@@ -46,17 +46,19 @@ export type { IPktTextareaBase, ITextareaSpecProps } from './textarea';
46
46
  export { TEXTINPUT_DEFAULTS, TEXTINPUT_TYPES } from './textinput';
47
47
  export type { TPktTextinputType, IPktTextinputBase, ITextinputSpecProps } from './textinput';
48
48
  export type { TPktCounterPosition, IPktInputWrapperBase, IInputWrapperSpecProps, } from './input-wrapper';
49
- export type { TTagSkin } from './skin';
50
- export { MESSAGEBOX_SKINS, MESSAGEBOX_DEFAULTS } from './messagebox';
51
- export type { TMessageboxSkin, IPktMessageboxBase, IMessageboxSpecProps } from './messagebox';
49
+ export { TAG_SKINS, TAG_STATES } from './skin';
50
+ export type { TMessageboxSkin, TTagSkin, TTagState } from './skin';
51
+ export { MESSAGEBOX_SKINS, MESSAGEBOX_LIGHT_ONLY_SKINS, MESSAGEBOX_DEFAULTS } from './messagebox';
52
+ export type { IPktMessageboxBase, IMessageboxSpecProps } from './messagebox';
52
53
  export { CALENDAR_DEFAULTS } from './calendar';
53
54
  export type { IPktCalendarBase, ICalendarSpecProps, IDateConstraints, ICalendarGridDimensions, IGridCellPosition, TDateRangeMap, ISelectionState, ISelectionOptions, } from './calendar';
54
55
  export type { IDatepickerStrings } from './datepicker';
55
56
  export { defaultSingleStrings, defaultRangeStrings } from './datepicker';
56
57
  export type { ITimepickerStrings } from './timepicker';
57
58
  export { defaultTimepickerStrings } from './timepicker';
58
- export type { TProgressbarRole, TProgressbarSkin, TProgressbarStatusPlacement, TProgressbarStatusType, TProgressbarTitlePosition, } from './progressbar';
59
- export { COMBOBOX_TAG_SKINS, COMBOBOX_DISPLAY_VALUES, COMBOBOX_TAG_PLACEMENTS, COMBOBOX_DEFAULTS, } from './combobox';
59
+ export { PROGRESSBAR_DEFAULTS, PROGRESSBAR_ROLES, PROGRESSBAR_SKINS, PROGRESSBAR_STATUS_PLACEMENTS, PROGRESSBAR_STATUS_TYPES, PROGRESSBAR_TITLE_POSITIONS, } from './progressbar';
60
+ export type { IPktProgressbarBase, IProgressbarSpecProps, TProgressbarRole, TProgressbarSkin, TProgressbarStatusPlacement, TProgressbarStatusType, TProgressbarTitlePosition, } from './progressbar';
61
+ export { COMBOBOX_DISPLAY_VALUES, COMBOBOX_TAG_PLACEMENTS, COMBOBOX_DEFAULTS } from './combobox';
60
62
  export type { IPktComboboxOption, TPktComboboxTagSkin, TPktComboboxDisplayValue, TPktComboboxTagPlacement, IPktComboboxBase, IComboboxSpecProps, } from './combobox';
61
63
  export { SELECT_DEFAULTS } from './select';
62
64
  export type { IPktSelectOption, TSelectOption, IPktSelectBase, ISelectSpecProps } from './select';
@@ -1,20 +1,22 @@
1
1
  import "./size.js";
2
2
  import { DEFAULT_HEADER_FOOTER_URL as e, DEFAULT_HEADER_LOGO_LINK as t } from "./header-footer.js";
3
3
  import { DEFAULT_FOOTER_PERSONVERN_URL as n, DEFAULT_FOOTER_TILGJENGELIGHET_URL as r } from "./footer.js";
4
- import { CARD_DEFAULTS as i } from "./card.js";
5
- import { CHECKBOX_DEFAULTS as a } from "./checkbox.js";
6
- import { RADIOBUTTON_DEFAULTS as o } from "./radiobutton.js";
7
- import { OPTION_GROUP_DEFAULTS as s } from "./option-group.js";
8
- import { CONSENT_DEFAULTS as c } from "./consent.js";
9
- import { ANIMATION_DEFAULT_PATH as l, ICON_DEFAULTS as u } from "./icon.js";
10
- import { LOADER_DEFAULTS as d } from "./loader.js";
11
- import { ACCORDION_LIGHT_ONLY_SKINS as f } from "./accordion.js";
12
- import { INPUT_WRAPPER_DEFAULTS as p } from "./input-wrapper.js";
13
- import { TEXTAREA_DEFAULTS as m } from "./textarea.js";
14
- import { TEXTINPUT_DEFAULTS as h } from "./textinput.js";
15
- import { MESSAGEBOX_DEFAULTS as g } from "./messagebox.js";
4
+ import { CARD_DEFAULTS as i, CARD_LIGHT_ONLY_SKINS as a } from "./card.js";
5
+ import { CHECKBOX_DEFAULTS as o } from "./checkbox.js";
6
+ import { RADIOBUTTON_DEFAULTS as s } from "./radiobutton.js";
7
+ import { OPTION_GROUP_DEFAULTS as c } from "./option-group.js";
8
+ import { CONSENT_DEFAULTS as l } from "./consent.js";
9
+ import { ANIMATION_DEFAULT_PATH as u, ICON_DEFAULTS as d } from "./icon.js";
10
+ import { LOADER_DEFAULTS as f } from "./loader.js";
11
+ import { ACCORDION_LIGHT_ONLY_SKINS as p } from "./accordion.js";
12
+ import { LINKCARD_LIGHT_ONLY_SKINS as m } from "./linkcard.js";
13
+ import { INPUT_WRAPPER_DEFAULTS as h } from "./input-wrapper.js";
14
+ import { TEXTAREA_DEFAULTS as g } from "./textarea.js";
15
+ import { TEXTINPUT_DEFAULTS as _ } from "./textinput.js";
16
+ import { MESSAGEBOX_DEFAULTS as v, MESSAGEBOX_LIGHT_ONLY_SKINS as y } from "./messagebox.js";
16
17
  import "./calendar.js";
18
+ import { PROGRESSBAR_DEFAULTS as b } from "./progressbar.js";
17
19
  import "./combobox.js";
18
- import { SELECT_DEFAULTS as _ } from "./select.js";
19
- import { TABLE_DEFAULTS as v } from "./table.js";
20
- export { f as ACCORDION_LIGHT_ONLY_SKINS, l as ANIMATION_DEFAULT_PATH, i as CARD_DEFAULTS, a as CHECKBOX_DEFAULTS, c as CONSENT_DEFAULTS, n as DEFAULT_FOOTER_PERSONVERN_URL, r as DEFAULT_FOOTER_TILGJENGELIGHET_URL, e as DEFAULT_HEADER_FOOTER_URL, t as DEFAULT_HEADER_LOGO_LINK, u as ICON_DEFAULTS, p as INPUT_WRAPPER_DEFAULTS, d as LOADER_DEFAULTS, g as MESSAGEBOX_DEFAULTS, s as OPTION_GROUP_DEFAULTS, o as RADIOBUTTON_DEFAULTS, _ as SELECT_DEFAULTS, v as TABLE_DEFAULTS, m as TEXTAREA_DEFAULTS, h as TEXTINPUT_DEFAULTS };
20
+ import { SELECT_DEFAULTS as x } from "./select.js";
21
+ import { TABLE_DEFAULTS as S } from "./table.js";
22
+ export { p as ACCORDION_LIGHT_ONLY_SKINS, u as ANIMATION_DEFAULT_PATH, i as CARD_DEFAULTS, a as CARD_LIGHT_ONLY_SKINS, o as CHECKBOX_DEFAULTS, l as CONSENT_DEFAULTS, n as DEFAULT_FOOTER_PERSONVERN_URL, r as DEFAULT_FOOTER_TILGJENGELIGHET_URL, e as DEFAULT_HEADER_FOOTER_URL, t as DEFAULT_HEADER_LOGO_LINK, d as ICON_DEFAULTS, h as INPUT_WRAPPER_DEFAULTS, m as LINKCARD_LIGHT_ONLY_SKINS, f as LOADER_DEFAULTS, v as MESSAGEBOX_DEFAULTS, y as MESSAGEBOX_LIGHT_ONLY_SKINS, c as OPTION_GROUP_DEFAULTS, b as PROGRESSBAR_DEFAULTS, s as RADIOBUTTON_DEFAULTS, x as SELECT_DEFAULTS, S as TABLE_DEFAULTS, g as TEXTAREA_DEFAULTS, _ as TEXTINPUT_DEFAULTS };
@@ -6,8 +6,12 @@
6
6
  */
7
7
  import type { IPktStringsProps } from '../shared-strings';
8
8
  /** LinkCard skin variants — shared runtime source for types, specs, and Preview. */
9
- export declare const LINKCARD_SKINS: readonly ['normal', 'no-padding', 'blue', 'beige', 'green', 'gray', 'beige-outline', 'gray-outline'];
10
- export type TLinkCardSkin = (typeof LINKCARD_SKINS)[number];
9
+ export declare const LINKCARD_SKINS: readonly ['gray', 'outlined', 'transparent', 'white', 'blue', 'green', 'beige'];
10
+ /** @deprecated Old names that still work: `normal` is `transparent`, `gray-outline` is `outlined`. */
11
+ export type TDeprecatedLinkCardSkin = 'normal' | 'gray-outline';
12
+ export type TLinkCardSkin = (typeof LINKCARD_SKINS)[number] | TDeprecatedLinkCardSkin;
13
+ /** Skins without a dark variant. The link card gets `data-mode="light"` and stays in light mode. */
14
+ export declare const LINKCARD_LIGHT_ONLY_SKINS: readonly TLinkCardSkin[];
11
15
  /** Shared LinkCard props for React, Elements, and typed specs. */
12
16
  export type IPktLinkCardBase = IPktStringsProps<'linkcard'> & {
13
17
  title?: string;
@@ -15,10 +19,9 @@ export type IPktLinkCardBase = IPktStringsProps<'linkcard'> & {
15
19
  skin?: TLinkCardSkin;
16
20
  iconName?: string;
17
21
  openInNewTab?: boolean;
18
- external?: boolean;
19
22
  };
20
23
  /**
21
24
  * Documented LinkCard props (subset of `IPktLinkCardBase`).
22
25
  * Used for typed component specs in documentation.
23
26
  */
24
- export type ILinkcardSpecProps = Pick<IPktLinkCardBase, 'title' | 'href' | 'skin' | 'iconName' | 'openInNewTab' | 'external'>;
27
+ export type ILinkcardSpecProps = Pick<IPktLinkCardBase, 'title' | 'href' | 'skin' | 'iconName' | 'openInNewTab'>;
@@ -0,0 +1,9 @@
1
+ //#region ../../shared-types/linkcard.ts
2
+ var e = [
3
+ "white",
4
+ "blue",
5
+ "green",
6
+ "beige"
7
+ ];
8
+ //#endregion
9
+ export { e as LINKCARD_LIGHT_ONLY_SKINS };
@@ -5,8 +5,10 @@
5
5
  * Used by React, Elements, and typed component specs.
6
6
  */
7
7
  /** Messagebox skin variants — shared runtime source for types, specs, and Preview. */
8
- export declare const MESSAGEBOX_SKINS: readonly ['beige', 'blue', 'red', 'green'];
8
+ export declare const MESSAGEBOX_SKINS: readonly ['gray', 'beige', 'blue', 'red', 'green'];
9
9
  export type TMessageboxSkin = (typeof MESSAGEBOX_SKINS)[number];
10
+ /** Skins without a dark variant. The messagebox gets `data-mode="light"` and stays in light mode. */
11
+ export declare const MESSAGEBOX_LIGHT_ONLY_SKINS: readonly TMessageboxSkin[];
10
12
  /**
11
13
  * Messagebox props shared by React and Elements.
12
14
  *
@@ -26,7 +28,7 @@ export interface IPktMessageboxBase {
26
28
  export type IMessageboxSpecProps = Pick<IPktMessageboxBase, 'title' | 'skin' | 'compact' | 'closable'>;
27
29
  /** Default values for pkt-messagebox. Single source of truth for both frameworks. */
28
30
  export declare const MESSAGEBOX_DEFAULTS: {
29
- readonly skin: 'beige';
31
+ readonly skin: 'gray';
30
32
  readonly compact: false;
31
33
  readonly closable: false;
32
34
  };
@@ -1,8 +1,13 @@
1
1
  //#region ../../shared-types/messagebox.ts
2
- var e = {
3
- skin: "beige",
2
+ var e = [
3
+ "beige",
4
+ "blue",
5
+ "red",
6
+ "green"
7
+ ], t = {
8
+ skin: "gray",
4
9
  compact: !1,
5
10
  closable: !1
6
11
  };
7
12
  //#endregion
8
- export { e as MESSAGEBOX_DEFAULTS };
13
+ export { t as MESSAGEBOX_DEFAULTS, e as MESSAGEBOX_LIGHT_ONLY_SKINS };
@@ -1,5 +1,82 @@
1
- export type TProgressbarRole = 'progressbar' | 'meter';
2
- export type TProgressbarSkin = 'dark-blue' | 'light-blue' | 'green' | 'red';
3
- export type TProgressbarStatusPlacement = 'center' | 'left' | 'following';
4
- export type TProgressbarStatusType = 'none' | 'percentage' | 'fraction';
5
- export type TProgressbarTitlePosition = 'left' | 'center';
1
+ /**
2
+ * progressbar.ts
3
+ *
4
+ * Shared types and defaults for Progressbar, used by both React and Elements.
5
+ *
6
+ * The value lists are `as const` arrays rather than plain union types. That way
7
+ * the values also exist at runtime, so the component spec and Preview can use
8
+ * them directly (`type: [...PROGRESSBAR_SKINS]`) instead of repeating them.
9
+ * The types are derived from the arrays, so there is a single source.
10
+ */
11
+ import type { IPktStringsProps } from '../shared-strings';
12
+ import type { TAriaLive } from './aria';
13
+ /** Element role: `progressbar` for progress, `meter` for measuring a value. */
14
+ export declare const PROGRESSBAR_ROLES: readonly ['progressbar', 'meter'];
15
+ export type TProgressbarRole = (typeof PROGRESSBAR_ROLES)[number];
16
+ /** Color of the progress bar. */
17
+ export declare const PROGRESSBAR_SKINS: readonly ['dark-blue', 'light-blue', 'green', 'red'];
18
+ export type TProgressbarSkin = (typeof PROGRESSBAR_SKINS)[number];
19
+ /** Where the status text is placed relative to the bar. */
20
+ export declare const PROGRESSBAR_STATUS_PLACEMENTS: readonly ['left', 'following', 'center'];
21
+ export type TProgressbarStatusPlacement = (typeof PROGRESSBAR_STATUS_PLACEMENTS)[number];
22
+ /** How status is shown: none, percentage ("40%") or fraction ("4 av 10"). */
23
+ export declare const PROGRESSBAR_STATUS_TYPES: readonly ['none', 'percentage', 'fraction'];
24
+ export type TProgressbarStatusType = (typeof PROGRESSBAR_STATUS_TYPES)[number];
25
+ /** Alignment of the title above the bar. */
26
+ export declare const PROGRESSBAR_TITLE_POSITIONS: readonly ['left', 'center'];
27
+ export type TProgressbarTitlePosition = (typeof PROGRESSBAR_TITLE_POSITIONS)[number];
28
+ /**
29
+ * Framework-agnostic props for Progressbar.
30
+ *
31
+ * Contains no React or Lit types, so both packages can build on it:
32
+ * React extends it with `HTMLAttributes` and `ref`, Elements uses it as is.
33
+ */
34
+ export interface IPktProgressbarBase extends IPktStringsProps<'progressbar'> {
35
+ /** Accessible name. When set, `aria-labelledby` is not used. */
36
+ ariaLabel?: string | null;
37
+ /** Id of the element that labels the bar. Falls back to the title. */
38
+ ariaLabelledby?: string | null;
39
+ /** How assertively screen readers announce changes. */
40
+ ariaLive?: TAriaLive;
41
+ /** Custom text value. With `statusType="fraction"`, "X av Y" is generated when empty. */
42
+ ariaValueText?: string | null;
43
+ id?: string;
44
+ role?: TProgressbarRole;
45
+ skin?: TProgressbarSkin;
46
+ statusPlacement?: TProgressbarStatusPlacement;
47
+ statusType?: TProgressbarStatusType;
48
+ title?: string | null;
49
+ titlePosition?: TProgressbarTitlePosition;
50
+ /** Current value. Required, since the bar is meaningless without it. */
51
+ valueCurrent: number;
52
+ valueMax?: number;
53
+ valueMin?: number;
54
+ }
55
+ /**
56
+ * Props documented in the component spec (docs and Preview).
57
+ * The spec file is type-checked against this, so a prop that doesn't exist on
58
+ * `IPktProgressbarBase` is a compile error.
59
+ */
60
+ export type IProgressbarSpecProps = Pick<IPktProgressbarBase, 'skin' | 'title' | 'valueMin' | 'valueMax' | 'ariaLabel' | 'ariaLabelledby' | 'ariaValueText' | 'valueCurrent' | 'statusType' | 'statusPlacement' | 'id' | 'titlePosition' | 'role' | 'ariaLive'>;
61
+ /**
62
+ * Default values, shared by React and Elements.
63
+ *
64
+ * These used to be hardcoded in each package and in the JSON spec, and they had
65
+ * drifted apart (the spec said `statusType: 'percentage'`, the components `'none'`).
66
+ * Both components and the spec now read from here.
67
+ *
68
+ * `title` and `id` are left out on purpose: React and Elements handle them
69
+ * differently (Elements generates the id in the property initializer, React
70
+ * via `useGeneratedId`).
71
+ */
72
+ export declare const PROGRESSBAR_DEFAULTS: {
73
+ readonly ariaLive: 'polite';
74
+ readonly role: 'progressbar';
75
+ readonly skin: 'dark-blue';
76
+ readonly statusPlacement: 'following';
77
+ readonly statusType: 'none';
78
+ readonly titlePosition: 'left';
79
+ readonly valueCurrent: 0;
80
+ readonly valueMax: 100;
81
+ readonly valueMin: 0;
82
+ };
@@ -0,0 +1,14 @@
1
+ //#region ../../shared-types/progressbar.ts
2
+ var e = {
3
+ ariaLive: "polite",
4
+ role: "progressbar",
5
+ skin: "dark-blue",
6
+ statusPlacement: "following",
7
+ statusType: "none",
8
+ titlePosition: "left",
9
+ valueCurrent: 0,
10
+ valueMax: 100,
11
+ valueMin: 0
12
+ };
13
+ //#endregion
14
+ export { e as PROGRESSBAR_DEFAULTS };
@@ -10,6 +10,12 @@ export { ACCORDION_SKINS, type TAccordionSkin } from './accordion';
10
10
  export { CARD_SKINS, type TCardSkin } from './card';
11
11
  export { MESSAGEBOX_SKINS, type TMessageboxSkin } from './messagebox';
12
12
  /**
13
- * Tag component skin variants
13
+ * Tag component skin variants — shared runtime source for types, specs and demo pages.
14
14
  */
15
- export type TTagSkin = 'blue' | 'blue-light' | 'blue-dark' | 'green' | 'red' | 'beige' | 'yellow' | 'grey' | 'gray';
15
+ export declare const TAG_SKINS: readonly ['gray', 'gray-light', 'blue-dark', 'blue', 'blue-light', 'blue-pale', 'green', 'green-light', 'red', 'red-light', 'yellow', 'yellow-light', 'beige', 'beige-light'];
16
+ export type TTagSkin = (typeof TAG_SKINS)[number];
17
+ /**
18
+ * Forces a tag into a visual state without the user interacting with it.
19
+ */
20
+ export declare const TAG_STATES: readonly ['hover', 'focus', 'active'];
21
+ export type TTagState = (typeof TAG_STATES)[number];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "19.19.1",
3
+ "version": "20.0.0",
4
4
  "description": "React komponentbibliotek til Punkt, designsystem for Oslo kommune",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo kommune",
@@ -42,8 +42,8 @@
42
42
  "@eslint/compat": "^2.1.0",
43
43
  "@eslint/eslintrc": "^3.3.5",
44
44
  "@eslint/js": "^10.0.1",
45
- "@oslokommune/punkt-assets": "^19.19.0",
46
- "@oslokommune/punkt-css": "^19.19.0",
45
+ "@oslokommune/punkt-assets": "^20.0.0",
46
+ "@oslokommune/punkt-css": "^20.0.0",
47
47
  "@testing-library/jest-dom": "^7.0.1",
48
48
  "@testing-library/react": "^16.3.2",
49
49
  "@testing-library/user-event": "^14.6.1",
@@ -103,5 +103,5 @@
103
103
  "url": "https://github.com/oslokommune/punkt/issues"
104
104
  },
105
105
  "license": "MIT",
106
- "gitHead": "8373ea76c93221f22496eb298b2382b41bef53ab"
106
+ "gitHead": "8a73041756098b52bdb8e9f6448bb1a96184e3c9"
107
107
  }
@@ -153,7 +153,7 @@ describe('PktButton icon paths', () => {
153
153
 
154
154
  const icon = document.querySelector('.pkt-btn__icon:not(.pkt-btn__spinner)') as HTMLElement & { path?: string }
155
155
  // When not provided, path uses PktIcon's default
156
- expect(icon?.dataset.path).toBe('https://punkt-cdn.oslo.kommune.no/latest/icons/')
156
+ expect(icon?.dataset.path).toBe('https://cdn.ikoner.oslo.kommune.no/icons/')
157
157
  })
158
158
 
159
159
  test('passes secondIconPath to second PktIcon when provided', () => {