@oslokommune/punkt-react 18.1.0 → 18.3.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 (44) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/components/alert/Alert.d.ts +1 -1
  3. package/dist/components/calendar/types.d.ts +2 -4
  4. package/dist/components/checkbox/Checkbox.d.ts +2 -4
  5. package/dist/components/combobox/types.d.ts +3 -5
  6. package/dist/components/datepicker/DateTags.d.ts +2 -3
  7. package/dist/components/datepicker/types.d.ts +4 -5
  8. package/dist/components/fileupload/DropZone.d.ts +2 -4
  9. package/dist/components/header/types.d.ts +3 -7
  10. package/dist/components/inputwrapper/InputWrapper.d.ts +2 -4
  11. package/dist/components/radio/RadioButton.d.ts +2 -4
  12. package/dist/components/searchinput/SearchInput.d.ts +2 -4
  13. package/dist/components/select/Select.d.ts +2 -4
  14. package/dist/components/tag/Tag.d.ts +2 -4
  15. package/dist/components/textarea/Textarea.d.ts +2 -4
  16. package/dist/components/textinput/Textinput.d.ts +2 -4
  17. package/dist/components/timepicker/types.d.ts +2 -5
  18. package/dist/components/timepicker/useTimepickerState.d.ts +1 -1
  19. package/dist/punkt-react.cjs +1 -1
  20. package/dist/punkt-react.js +6 -6
  21. package/dist/shared-strings/types.d.ts +10 -4
  22. package/dist/shared-types/backlink.d.ts +1 -1
  23. package/dist/shared-types/breadcrumbs.d.ts +1 -1
  24. package/dist/shared-types/fileupload.d.ts +1 -1
  25. package/dist/shared-types/form-field.d.ts +7 -6
  26. package/dist/shared-types/searchinput.d.ts +2 -1
  27. package/package.json +3 -3
  28. package/src/components/alert/Alert.tsx +1 -1
  29. package/src/components/calendar/types.ts +2 -6
  30. package/src/components/checkbox/Checkbox.tsx +2 -4
  31. package/src/components/combobox/types.ts +3 -5
  32. package/src/components/datepicker/DateTags.tsx +2 -4
  33. package/src/components/datepicker/types.ts +6 -7
  34. package/src/components/fileupload/DropZone.tsx +3 -4
  35. package/src/components/header/types.ts +3 -8
  36. package/src/components/inputwrapper/InputWrapper.tsx +2 -4
  37. package/src/components/radio/RadioButton.tsx +2 -4
  38. package/src/components/searchinput/SearchInput.tsx +2 -5
  39. package/src/components/select/Select.tsx +3 -4
  40. package/src/components/stepper/Step.tsx +1 -1
  41. package/src/components/tag/Tag.tsx +2 -5
  42. package/src/components/textarea/Textarea.tsx +3 -4
  43. package/src/components/textinput/Textinput.tsx +3 -4
  44. package/src/components/timepicker/types.ts +2 -6
@@ -62,7 +62,7 @@ var M = /* @__PURE__ */ O((/* @__PURE__ */ E(((e, t) => {
62
62
  return n;
63
63
  }) : window.classNames = n;
64
64
  })();
65
- })))(), 1), N = "https://punkt-cdn.oslo.kommune.no/18.1/icons/";
65
+ })))(), 1), N = "https://punkt-cdn.oslo.kommune.no/18.3/icons/";
66
66
  typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || N);
67
67
  var P = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", ee = {}, te = 2, ne = 1500, F = typeof Storage < "u" && typeof sessionStorage < "u", re = typeof window < "u" ? d : c, ie = (e, t) => !e || !F ? "" : sessionStorage.getItem(t + e + ".svg") ?? "", ae = (e) => window.pktFetch(e).then((t) => {
68
68
  if (!t.ok) throw Error("Missing icon: " + e);
@@ -526,7 +526,7 @@ var ge = {
526
526
  };
527
527
  //#endregion
528
528
  //#region src/components/button/Button.tsx
529
- typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.1/animations/");
529
+ typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.3/animations/");
530
530
  var Y = i(({ children: e, className: t, iconName: n = "user", secondIconName: r = "user", iconPath: i, secondIconPath: a, size: o = "medium", fullWidth: s = !1, fullWidthOnMobile: c = !1, skin: l = "primary", type: u = "button", variant: d = "label-only", state: f, color: p, isLoading: m = void 0, disabled: h = void 0, loadingAnimationPath: g = window.pktAnimationPath, ...y }, b) => {
531
531
  let x = [
532
532
  t,
@@ -7074,7 +7074,7 @@ var co = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
7074
7074
  co.displayName = "PktSearchInput";
7075
7075
  //#endregion
7076
7076
  //#region src/components/header/HeaderGlobal.tsx
7077
- var lo = "https://punkt-cdn.oslo.kommune.no/18.1/logos/";
7077
+ var lo = "https://punkt-cdn.oslo.kommune.no/18.3/logos/";
7078
7078
  typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || lo);
7079
7079
  var uo = "pkt-header-global-menu", fo = "pkt-header-global-menu-toggle", po = "pkt-header-global-search-panel", mo = "pkt-header-global-search-toggle", ho = i(({ className: e, "data-mode": t, dataUrl: n, data: r, locale: i = "nb-NO", logoLink: a = ga, logoClick: s, logoPath: l = typeof window < "u" ? window.pktLogoPath : lo, showSearch: u = !0, searchPlaceholder: h, onSearch: y, showContact: b = !0, user: x, userMenu: S, representing: C, canChangeRepresentation: w = !1, changeRepresentation: T, logOutButtonPlacement: E = "none", logOut: D, position: O = "fixed", scrollBehavior: k = "hide", mobileBreakpoint: A = 768, tabletBreakpoint: j = 1024, onDataLoaded: N, onDataError: P, strings: ee }, te) => {
7080
7080
  let ne = k === "hide", [F, re] = m("none"), [ie, ae] = m(void 0), [oe, se] = m(!1), I = p(N), R = p(P);
@@ -7431,7 +7431,7 @@ var go = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
7431
7431
  go.displayName = "PktTextinput";
7432
7432
  //#endregion
7433
7433
  //#region src/components/header/HeaderService.tsx
7434
- var _o = "https://punkt-cdn.oslo.kommune.no/18.1/logos/";
7434
+ var _o = "https://punkt-cdn.oslo.kommune.no/18.3/logos/";
7435
7435
  typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || _o);
7436
7436
  var vo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n, className: r, compact: i = !1, "data-mode": a, logOutButtonPlacement: s = "none", logOut: l, openedMenu: u, showSearch: d = !1, onSearch: h, onSearchChange: y, searchValue: b, searchPlaceholder: x, representing: S, serviceLink: C, serviceClick: w, serviceName: T, user: E, userMenu: D, userMenuFooter: O, userOptions: k, canChangeRepresentation: A = !1, changeRepresentation: j, hideLogo: N = !1, logoLink: P = ga, logoClick: ee, logoPath: te = typeof window < "u" ? window.pktLogoPath : _o, position: ne = "fixed", scrollBehavior: F = "hide", slotMenuVariant: re = "icon-only", slotMenuText: ie = "Meny", strings: ae }, oe) => {
7437
7437
  let se = F === "hide";
@@ -7778,7 +7778,7 @@ var wo = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab:
7778
7778
  };
7779
7779
  //#endregion
7780
7780
  //#region src/components/loader/Loader.tsx
7781
- wo.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.1/animations/");
7781
+ wo.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.3/animations/");
7782
7782
  var To = (e) => {
7783
7783
  switch (e) {
7784
7784
  case "blue": return "spinner-blue";
@@ -7972,7 +7972,7 @@ var Ao = /* @__PURE__ */ _("svg", {
7972
7972
  cx: "12",
7973
7973
  cy: "12",
7974
7974
  r: "7",
7975
- style: { fill: "var(--pkt-color-grays-grey-200, #CCC)" }
7975
+ style: { fill: "var(--pkt-color-brand-neutrals-300, #CCC)" }
7976
7976
  })
7977
7977
  }), jo = /* @__PURE__ */ v("svg", {
7978
7978
  xmlns: "http://www.w3.org/2000/svg",
@@ -28,11 +28,17 @@ export type TPktStringsOverride<NS extends TPktStringsNamespace = TPktStringsNam
28
28
  /** Verdier som kan settes inn i en `{plassholder}`. */
29
29
  export type TPktStringParams = Record<string, string | number>;
30
30
  /**
31
- * `strings`-propen som alle Punkt-komponenter som viser katalogtekst skal ha.
32
- * Elements har den `PktShadowElement`; React-interfaces extender denne slicen.
31
+ * `strings`-propen for komponenter som viser katalogtekst.
32
+ * Send namespace-unionen komponenten faktisk leser, ellers tillates hele katalogen:
33
33
  *
34
- * TODO: Consider adding a type parameter for the namespace, so that the strings object can be narrowed to the namespace.
35
- * f.eks. ÌPktFileUploadProps<'fileupload'|'forms'> for å kunne sette tekster for felt i skjema og valideringsmeldinger.
34
+ * ```ts
35
+ * export type IPktFileUploadBase = IFormFieldCommonProps<'forms' | 'fileupload'> & {
36
+ * name: string
37
+ * }
38
+ * ```
39
+ *
40
+ * React-interfaces extender slicen. Elements har `strings` på `PktShadowElement`
41
+ * (hele katalogen i runtime); `$props` smalnes via komponentens `T`.
36
42
  */
37
43
  export type IPktStringsProps<NS extends TPktStringsNamespace = TPktStringsNamespace> = {
38
44
  /** Overstyrer tekster for denne komponenten. */
@@ -7,7 +7,7 @@
7
7
  import type { IPktStringsProps } from '../shared-strings';
8
8
  import type { TRenderLink } from './render-link';
9
9
  /** Shared backlink props for React, Elements, and typed specs. */
10
- export type IPktBackLinkBase = IPktStringsProps & {
10
+ export type IPktBackLinkBase = IPktStringsProps<'backlink'> & {
11
11
  href?: string;
12
12
  text?: string;
13
13
  /** @deprecated Bruk `strings={{ backlink: { label: '…' } }}` eller `setPktStrings()`. */
@@ -19,7 +19,7 @@ export type IBreadcrumbItem = IBreadcrumb;
19
19
  /** @deprecated Use `IBreadcrumb` — former React export name (singular type, plural alias). */
20
20
  export type IBreadcrumbs = IBreadcrumb;
21
21
  /** Shared breadcrumbs props for React, Elements, and typed specs. */
22
- export type IPktBreadcrumbsBase = IPktStringsProps & {
22
+ export type IPktBreadcrumbsBase = IPktStringsProps<'breadcrumbs'> & {
23
23
  breadcrumbs: IBreadcrumb[];
24
24
  };
25
25
  /** Documented props for typed component specs. */
@@ -58,7 +58,7 @@ export interface IFilesChangedDetail {
58
58
  * @remarks React widens `helptext`, `helptextDropdown`, `itemRenderer`, and `extraOperations`
59
59
  * in `FileUpload.tsx`. Elements adds `id`, `accept`, and uses events instead of some callbacks.
60
60
  */
61
- export interface IPktFileUploadBase extends IFormFieldCommonProps {
61
+ export interface IPktFileUploadBase extends IFormFieldCommonProps<'forms' | 'fileupload'> {
62
62
  /** Field name. Used for native input (`form`) or hidden ID inputs (`custom`). */
63
63
  name: string;
64
64
  required?: boolean;
@@ -5,10 +5,10 @@
5
5
  * Compose slices into `IFormFieldCommonProps`, then extend with component-specific props.
6
6
  *
7
7
  * @example
8
- * IPktInputWrapperBase = IFormFieldCommonProps & { forId, counter, … }
9
- * IPktFileUploadBase = IFormFieldCommonProps & { name, uploadStrategy, … }
8
+ * IPktInputWrapperBase = IFormFieldCommonProps<'forms' | 'validation'> & { forId, counter, … }
9
+ * IPktFileUploadBase = IFormFieldCommonProps<'forms' | 'fileupload'> & { name, uploadStrategy, … }
10
10
  */
11
- import type { IPktStringsProps } from '../shared-strings';
11
+ import type { IPktStringsProps, TPktStringsNamespace } from '../shared-strings';
12
12
  /** Expandable helptext props used by pkt-input-wrapper and several form controls. */
13
13
  export type IHelptextProps = {
14
14
  helptext?: string;
@@ -38,8 +38,9 @@ export type IFormFieldErrorProps = {
38
38
  };
39
39
  /**
40
40
  * Shared form-field props — helptext, tags, label, error state, and `strings`.
41
- * Input-wrapper adds wrapper-only props (forId, counter, inline, …) on top of this.
41
+ * `NS` defaults to `'forms'` (optional/required/read more). Pass extra namespaces
42
+ * when the component also reads other catalogue slices (e.g. FileUpload).
42
43
  */
43
- export type IFormFieldCommonProps = IHelptextProps & ITagOptionalRequiredProps & IFormFieldLabelProps & IFormFieldErrorProps & IPktStringsProps;
44
+ export type IFormFieldCommonProps<NS extends TPktStringsNamespace = 'forms'> = IHelptextProps & ITagOptionalRequiredProps & IFormFieldLabelProps & IFormFieldErrorProps & IPktStringsProps<NS>;
44
45
  /** Keys from `IFormFieldCommonProps` — reuse in `I*SpecProps` Pick unions across form components. */
45
- export type TFormFieldCommonSpecKeys = keyof IFormFieldCommonProps;
46
+ export type TFormFieldCommonSpecKeys = keyof IFormFieldCommonProps<'forms'>;
@@ -5,6 +5,7 @@
5
5
  * stay aligned. React extends suggestions with `ReactNode` and optional
6
6
  * `onClick` in the component layer — see `@oslokommune/punkt-react`.
7
7
  */
8
+ import type { IPktStringsProps } from '../shared-strings';
8
9
  import type { TPktInputSize } from './size';
9
10
  export type TPktSearchInputAppearance = 'local' | 'local-with-button' | 'global';
10
11
  export type TPktSearchInputMethod = 'get' | 'post' | 'dialog';
@@ -27,7 +28,7 @@ export interface IPktSearchInputSuggestion {
27
28
  * Public props for the web component (Elements). React mirrors these and adds
28
29
  * callback props in its wrapper.
29
30
  */
30
- export interface IPktSearchInput {
31
+ export interface IPktSearchInput extends IPktStringsProps<'searchinput'> {
31
32
  appearance?: TPktSearchInputAppearance;
32
33
  inputSize?: TPktInputSize;
33
34
  disabled?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "18.1.0",
3
+ "version": "18.3.0",
4
4
  "description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -45,7 +45,7 @@
45
45
  "@eslint/eslintrc": "^3.3.5",
46
46
  "@eslint/js": "^10.0.1",
47
47
  "@oslokommune/punkt-assets": "^18.0.0",
48
- "@oslokommune/punkt-css": "^18.0.0",
48
+ "@oslokommune/punkt-css": "^18.3.0",
49
49
  "@testing-library/jest-dom": "^6.9.1",
50
50
  "@testing-library/react": "^16.3.2",
51
51
  "@testing-library/user-event": "^14.6.1",
@@ -102,5 +102,5 @@
102
102
  "url": "https://github.com/oslokommune/punkt/issues"
103
103
  },
104
104
  "license": "MIT",
105
- "gitHead": "087459aca13f8ff3a34afc42f8e1cd73900d4896"
105
+ "gitHead": "72a1389ecb1c277a463dfe5d2c020d96dd4c7ded"
106
106
  }
@@ -10,7 +10,7 @@ import { PktIcon } from '../icon/Icon'
10
10
  import { usePktStrings } from '../../hooks/usePktStrings'
11
11
 
12
12
  export interface IPktAlert
13
- extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, IPktStringsProps {
13
+ extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, IPktStringsProps<'alert' | 'generic'> {
14
14
  skin?: TAlertSkin
15
15
  closeAlert?: boolean
16
16
  title?: ReactNode
@@ -1,6 +1,6 @@
1
1
  import type { IDateConstraints, TDateRangeMap } from 'shared-types/calendar'
2
2
 
3
- import type { TPktStringsOverride } from 'shared-strings'
3
+ import type { IPktStringsProps } from 'shared-strings'
4
4
 
5
5
  /** Datonavn og navigasjonstekster slik kalender-underkomponentene forventer dem. */
6
6
  export interface IPktCalendarStrings {
@@ -23,7 +23,7 @@ export interface PktCalendarHandle {
23
23
  close: () => void
24
24
  }
25
25
 
26
- export interface IPktCalendar {
26
+ export interface IPktCalendar extends IPktStringsProps<'dates' | 'calendar'> {
27
27
  // Selection
28
28
  selected?: string[]
29
29
  multiple?: boolean
@@ -42,10 +42,6 @@ export interface IPktCalendar {
42
42
  currentmonth?: Date | string | null
43
43
  today?: string
44
44
 
45
- // Localization
46
- /** Overstyrer tekster for denne komponenten. */
47
- strings?: TPktStringsOverride
48
-
49
45
  // Callbacks
50
46
  onDateSelected?: (selected: string[]) => void
51
47
  onClose?: () => void
@@ -9,9 +9,9 @@ import {
9
9
  useRef,
10
10
  } from 'react'
11
11
  import { usePktStrings } from '../../hooks/usePktStrings'
12
- import type { TPktStringsOverride } from 'shared-strings'
12
+ import type { IPktStringsProps } from 'shared-strings'
13
13
 
14
- export interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement> {
14
+ export interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement>, IPktStringsProps<'forms'> {
15
15
  id: string
16
16
  hasTile?: boolean
17
17
  disabled?: boolean
@@ -31,8 +31,6 @@ export interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement> {
31
31
  requiredTag?: boolean
32
32
  /** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
33
33
  requiredText?: string
34
- /** Overstyrer tekster for denne komponenten. */
35
- strings?: TPktStringsOverride
36
34
  tagText?: string | null
37
35
  onChange?: ChangeEventHandler<HTMLInputElement>
38
36
  }
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
 
3
- import type { TPktStringsOverride } from 'shared-strings'
3
+ import type { IPktStringsProps, TPktStringsOverride } from 'shared-strings'
4
4
 
5
5
  import type {
6
6
  ChangeEvent,
@@ -14,7 +14,7 @@ import type {
14
14
  } from 'react'
15
15
  import type { IPktComboboxOption, TPktComboboxDisplayValue, TPktComboboxTagPlacement } from 'shared-types/combobox'
16
16
 
17
- export interface IPktCombobox {
17
+ export interface IPktCombobox extends IPktStringsProps<'combobox' | 'listbox' | 'forms' | 'validation'> {
18
18
  // Values & options
19
19
  value?: string | string[]
20
20
  defaultValue?: string | string[]
@@ -54,8 +54,6 @@ export interface IPktCombobox {
54
54
  useWrapper?: boolean
55
55
  inline?: boolean
56
56
  counter?: boolean
57
- /** Overstyrer tekster for denne komponenten. */
58
- strings?: TPktStringsOverride
59
57
  hasFieldset?: boolean
60
58
  inputSize?: 'small' | 'medium' | 'xsmall'
61
59
 
@@ -70,7 +68,7 @@ export interface IPktCombobox {
70
68
 
71
69
  export interface IComboboxState {
72
70
  /** Tekstoverstyring sendt inn på komponenten. */
73
- strings?: TPktStringsOverride
71
+ strings?: TPktStringsOverride<'combobox' | 'listbox' | 'forms' | 'validation'>
74
72
  // Identity
75
73
  id: string
76
74
  inputId: string
@@ -3,16 +3,14 @@
3
3
  import { sortDateStrings, fromISOtoLocal } from 'shared-utils/date-utils'
4
4
  import { PktTag } from '../tag/Tag'
5
5
  import { usePktStrings } from '../../hooks/usePktStrings'
6
- import type { TPktStringsOverride } from 'shared-strings'
6
+ import type { IPktStringsProps } from 'shared-strings'
7
7
 
8
- interface DateTagsProps {
8
+ interface DateTagsProps extends IPktStringsProps<'datepicker'> {
9
9
  dates: string[]
10
10
  dateformat: string
11
11
  idBase: string
12
- strings?: TPktStringsOverride
13
12
  onDateRemoved: (date: string) => void
14
13
  }
15
-
16
14
  export const DateTags = ({
17
15
  dates,
18
16
  dateformat,
@@ -1,8 +1,11 @@
1
- import type { TPktStrings, TPktStringsOverride } from 'shared-strings'
1
+ import type { TPktStrings, IPktStringsProps, TPktStringsOverride } from 'shared-strings'
2
2
  import type { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react'
3
3
  import type { TPktInputSize } from 'shared-types/size'
4
4
 
5
- export interface IPktDatepicker extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
5
+ export type TDatepickerStrings = 'generic' | 'datepicker' | 'validation' | 'forms' | 'dates' | 'calendar'
6
+
7
+ export interface IPktDatepicker
8
+ extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'>, IPktStringsProps<TDatepickerStrings> {
6
9
  id: string
7
10
  label: string
8
11
  ariaDescribedby?: string
@@ -41,10 +44,6 @@ export interface IPktDatepicker extends Omit<InputHTMLAttributes<HTMLInputElemen
41
44
  tagText?: string
42
45
  useWrapper?: boolean
43
46
 
44
- // Localization
45
- /** Overstyrer tekster for denne komponenten. */
46
- strings?: TPktStringsOverride
47
-
48
47
  // Events
49
48
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void
50
49
  onValueChange?: (values: string[]) => void
@@ -106,7 +105,7 @@ export interface IDatepickerState {
106
105
  isIOSDevice: boolean
107
106
  strings: Pick<TPktStrings, 'generic' | 'datepicker' | 'validation'>
108
107
  /** Rå tekstoverstyring, til videresending til underkomponenter. */
109
- stringsOverride?: TPktStringsOverride
108
+ stringsOverride?: TPktStringsOverride<TDatepickerStrings>
110
109
  inputClasses: string
111
110
  buttonClasses: string
112
111
  rangeLabelClasses: string
@@ -16,7 +16,7 @@ import {
16
16
  import { PktIcon } from '../icon/Icon'
17
17
  import { FileItem, TFileItemList, TUploadStrategy } from './types'
18
18
  import { usePktStrings } from '../../hooks/usePktStrings'
19
- import type { TPktStringsOverride } from 'shared-strings'
19
+ import type { IPktStringsProps } from 'shared-strings'
20
20
 
21
21
  /**
22
22
  * Props for the internal `DropZone` building block.
@@ -27,9 +27,8 @@ import type { TPktStringsOverride } from 'shared-strings'
27
27
  * - optionally rendering hidden inputs with file IDs when `uploadStrategy="custom"`
28
28
  */
29
29
  interface IDropZoneProps
30
- extends Omit<InputHTMLAttributes<HTMLInputElement>, 'checked' | 'size' | 'type' | 'value' | 'onChange' | 'width'> {
31
- /** Overstyrer tekster for denne komponenten. */
32
- strings?: TPktStringsOverride
30
+ extends Omit<InputHTMLAttributes<HTMLInputElement>, 'checked' | 'size' | 'type' | 'value' | 'onChange' | 'width'>,
31
+ IPktStringsProps<'fileupload'> {
33
32
  /** Called with `FileItem`s created from dropped/selected files. */
34
33
  onFilesAdded?: (files: TFileItemList) => void
35
34
  /** Used for the native input `id` and related label/ARIA wiring. */
@@ -9,7 +9,7 @@ import type {
9
9
  THeaderMenuLocale,
10
10
  IPktHeaderGlobal as ISharedPktHeaderGlobal,
11
11
  } from 'shared-types'
12
- import type { TPktStringsOverride } from 'shared-strings'
12
+ import type { IPktStringsProps } from 'shared-strings'
13
13
 
14
14
  export type {
15
15
  THeaderMenu,
@@ -53,10 +53,7 @@ export interface UserMenuFooterItem {
53
53
  target: string | (() => void)
54
54
  }
55
55
 
56
- export interface IPktHeader {
57
- /** Overstyrer tekster for denne komponenten. */
58
- strings?: TPktStringsOverride
59
-
56
+ export interface IPktHeader extends IPktStringsProps<'header'> {
60
57
  children?: ReactNode
61
58
  /** Additional CSS class name(s) to apply to the header */
62
59
  className?: string
@@ -130,9 +127,7 @@ export interface IPktHeader {
130
127
  * Extends the framework-agnostic {@link ISharedPktHeaderGlobal} base
131
128
  * (in shared-types) with React-specific callbacks and DOM props.
132
129
  */
133
- export interface IPktHeaderGlobal extends ISharedPktHeaderGlobal {
134
- /** Overstyrer tekster for denne komponenten. */
135
- strings?: TPktStringsOverride
130
+ export interface IPktHeaderGlobal extends ISharedPktHeaderGlobal, IPktStringsProps<'header'> {
136
131
  /** Additional CSS class name(s) to apply to the header */
137
132
  className?: string
138
133
  /** Set dark mode on the header */
@@ -4,12 +4,12 @@ import { ForwardedRef, forwardRef, type ReactNode, RefAttributes } from 'react'
4
4
 
5
5
  import { useFocusModality } from '../../hooks/useFocusModality'
6
6
  import { usePktStrings } from '../../hooks/usePktStrings'
7
- import { formatString, type TPktStringsOverride } from 'shared-strings'
7
+ import { formatString, type IPktStringsProps } from 'shared-strings'
8
8
  import { counterStatusId, isCounterExceeded } from 'shared-utils/forms/described-by'
9
9
  import { PktAlert } from '../alert/Alert'
10
10
  import { PktHelptext } from '../helptext/Helptext'
11
11
 
12
- export interface IPktInputWrapper extends RefAttributes<HTMLElement> {
12
+ export interface IPktInputWrapper extends RefAttributes<HTMLElement>, IPktStringsProps<'forms' | 'validation'> {
13
13
  forId: string
14
14
  label: string
15
15
  helptext?: string | ReactNode
@@ -38,8 +38,6 @@ export interface IPktInputWrapper extends RefAttributes<HTMLElement> {
38
38
  role?: string
39
39
  counterPosition?: 'top' | 'bottom'
40
40
  size?: 'small' | 'medium' | 'xsmall'
41
- /** Overstyrer tekster for denne komponenten. */
42
- strings?: TPktStringsOverride
43
41
  }
44
42
 
45
43
  export const PktInputWrapper = forwardRef(
@@ -7,9 +7,9 @@ import {
7
7
  ReactNode,
8
8
  } from 'react'
9
9
  import { usePktStrings } from '../../hooks/usePktStrings'
10
- import type { TPktStringsOverride } from 'shared-strings'
10
+ import type { IPktStringsProps } from 'shared-strings'
11
11
 
12
- export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement> {
12
+ export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement>, IPktStringsProps<'forms'> {
13
13
  id: string
14
14
  name: string
15
15
  label: string
@@ -26,8 +26,6 @@ export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement> {
26
26
  requiredTag?: boolean
27
27
  /** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
28
28
  requiredText?: string
29
- /** Overstyrer tekster for denne komponenten. */
30
- strings?: TPktStringsOverride
31
29
  tagText?: string | null
32
30
  onChange?: ChangeEventHandler<HTMLInputElement>
33
31
  }
@@ -7,7 +7,7 @@ import type { IPktSearchInputSuggestion } from 'shared-types/searchinput'
7
7
  import { useFocusModality } from '../../hooks/useFocusModality'
8
8
  import { PktButton } from '../button/Button'
9
9
  import { usePktStrings } from '../../hooks/usePktStrings'
10
- import type { TPktStringsOverride } from 'shared-strings'
10
+ import type { IPktStringsProps } from 'shared-strings'
11
11
 
12
12
  /**
13
13
  * React suggestion item: portable fields from {@link IPktSearchInputSuggestion}
@@ -19,10 +19,7 @@ export type PktSearchInputSuggestion = Omit<IPktSearchInputSuggestion, 'title' |
19
19
  onClick?: () => void
20
20
  }
21
21
 
22
- interface ISearch extends HTMLProps<HTMLInputElement> {
23
- /** Overstyrer tekster for denne komponenten. */
24
- strings?: TPktStringsOverride
25
-
22
+ interface ISearch extends HTMLProps<HTMLInputElement>, IPktStringsProps<'searchinput'> {
26
23
  appearance?: 'local' | 'local-with-button' | 'global'
27
24
  inputSize?: 'small' | 'medium' | 'xsmall'
28
25
  disabled?: boolean
@@ -4,13 +4,12 @@ import { ForwardedRef, forwardRef, ReactNode, SelectHTMLAttributes } from 'react
4
4
 
5
5
  import { PktInputWrapper } from '../inputwrapper/InputWrapper'
6
6
  import { describedByIds } from 'shared-utils/forms/described-by'
7
- import type { TPktStringsOverride } from 'shared-strings'
7
+ import type { IPktStringsProps } from 'shared-strings'
8
8
 
9
9
  export type { IPktSelectOption, TSelectOption } from 'shared-types/select'
10
10
 
11
- export interface IPktSelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
12
- /** Overstyrer tekster for denne komponenten. */
13
- strings?: TPktStringsOverride
11
+ export interface IPktSelectProps
12
+ extends SelectHTMLAttributes<HTMLSelectElement>, IPktStringsProps<'forms' | 'validation'> {
14
13
  ariaDescribedby?: string
15
14
  ariaLabelledby?: string
16
15
  children?: ReactNode | ReactNode[]
@@ -26,7 +26,7 @@ export interface IPktStep {
26
26
 
27
27
  const incompleteStepSVG = (
28
28
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
29
- <circle cx="12" cy="12" r="7" style={{ fill: 'var(--pkt-color-grays-grey-200, #CCC)' }} />
29
+ <circle cx="12" cy="12" r="7" style={{ fill: 'var(--pkt-color-brand-neutrals-300, #CCC)' }} />
30
30
  </svg>
31
31
  )
32
32
 
@@ -18,12 +18,9 @@ import type { TTagSkin } from 'shared-types'
18
18
 
19
19
  import { PktIcon } from '../icon/Icon'
20
20
  import { usePktStrings } from '../../hooks/usePktStrings'
21
- import { formatString, type TPktStringsOverride } from 'shared-strings'
22
-
23
- interface BasePktTagProps {
24
- /** Overstyrer tekster for denne komponenten. */
25
- strings?: TPktStringsOverride
21
+ import { formatString, type IPktStringsProps } from 'shared-strings'
26
22
 
23
+ interface BasePktTagProps extends IPktStringsProps<'tag'> {
27
24
  skin?: TTagSkin
28
25
  textStyle?: 'normal-text' | 'thin-text'
29
26
  size?: 'small' | 'medium' | 'large'
@@ -14,11 +14,10 @@ import {
14
14
  import { PktInputWrapper } from '../inputwrapper/InputWrapper'
15
15
  import { TPktInputSize } from 'shared-types/size'
16
16
  import { describedByIds } from 'shared-utils/forms/described-by'
17
- import type { TPktStringsOverride } from 'shared-strings'
17
+ import type { IPktStringsProps } from 'shared-strings'
18
18
 
19
- export interface IPktTextarea extends TextareaHTMLAttributes<HTMLTextAreaElement> {
20
- /** Overstyrer tekster for denne komponenten. */
21
- strings?: TPktStringsOverride
19
+ export interface IPktTextarea
20
+ extends TextareaHTMLAttributes<HTMLTextAreaElement>, IPktStringsProps<'forms' | 'validation'> {
22
21
  id: string
23
22
  ariaDescribedby?: string
24
23
  ariaLabelledby?: string
@@ -14,11 +14,10 @@ import {
14
14
  import { PktIcon } from '../icon/Icon'
15
15
  import { PktInputWrapper } from '../inputwrapper/InputWrapper'
16
16
  import { describedByIds } from 'shared-utils/forms/described-by'
17
- import type { TPktStringsOverride } from 'shared-strings'
17
+ import type { IPktStringsProps } from 'shared-strings'
18
18
 
19
- export interface IPktTextinput extends InputHTMLAttributes<HTMLInputElement> {
20
- /** Overstyrer tekster for denne komponenten. */
21
- strings?: TPktStringsOverride
19
+ export interface IPktTextinput
20
+ extends InputHTMLAttributes<HTMLInputElement>, IPktStringsProps<'forms' | 'validation'> {
22
21
  id: string
23
22
  ariaDescribedby?: string
24
23
  ariaLabelledby?: string
@@ -1,4 +1,4 @@
1
- import type { TPktStringsOverride } from 'shared-strings'
1
+ import type { IPktStringsProps } from 'shared-strings'
2
2
  import type { ChangeEvent, FocusEvent, InputHTMLAttributes, ReactNode } from 'react'
3
3
  import { TPktInputSize } from 'shared-types/size'
4
4
 
@@ -11,7 +11,7 @@ import { TPktInputSize } from 'shared-types/size'
11
11
  export interface IPktTimepicker extends Omit<
12
12
  InputHTMLAttributes<HTMLInputElement>,
13
13
  'value' | 'onChange' | 'onInput' | 'min' | 'max' | 'step' | 'onFocus' | 'onBlur'
14
- > {
14
+ >, IPktStringsProps<'timepicker' | 'forms' | 'validation'> {
15
15
  /** Unique id; used for hour, minute, popup, and hidden input ids. */
16
16
  id: string
17
17
 
@@ -94,10 +94,6 @@ export interface IPktTimepicker extends Omit<
94
94
  /** Passed through to InputWrapper as `aria-describedby`. */
95
95
  ariaDescribedby?: string
96
96
 
97
- /** Copy for hours, minutes, buttons, and popup. */
98
- /** Overstyrer tekster for denne komponenten. */
99
- strings?: TPktStringsOverride
100
-
101
97
  /** Change event from the hidden input (`e.target.value` is `HH:MM`). In React, `onChange` already fires on input. */
102
98
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void
103
99