@oslokommune/punkt-react 17.1.3 → 18.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 (77) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/backlink/BackLink.d.ts +3 -0
  3. package/dist/components/breadcrumbs/Breadcrumbs.d.ts +3 -0
  4. package/dist/components/calendar/types.d.ts +14 -12
  5. package/dist/components/checkbox/Checkbox.d.ts +5 -0
  6. package/dist/components/combobox/types.d.ts +5 -0
  7. package/dist/components/consent/strings.d.ts +1 -85
  8. package/dist/components/datepicker/DateTags.d.ts +2 -2
  9. package/dist/components/datepicker/types.d.ts +6 -3
  10. package/dist/components/fileupload/DropZone.d.ts +3 -0
  11. package/dist/components/fileupload/FileUpload.d.ts +3 -0
  12. package/dist/components/header/types.d.ts +5 -0
  13. package/dist/components/index.d.ts +4 -0
  14. package/dist/components/inputwrapper/InputWrapper.d.ts +6 -0
  15. package/dist/components/radio/RadioButton.d.ts +5 -0
  16. package/dist/components/searchinput/SearchInput.d.ts +4 -0
  17. package/dist/components/select/Select.d.ts +3 -0
  18. package/dist/components/strings/PktStringsProvider.d.ts +21 -0
  19. package/dist/components/strings/strings-override.test.d.ts +1 -0
  20. package/dist/components/tag/Tag.d.ts +3 -0
  21. package/dist/components/textarea/Textarea.d.ts +3 -0
  22. package/dist/components/textinput/Textinput.d.ts +3 -0
  23. package/dist/components/timepicker/types.d.ts +3 -2
  24. package/dist/components/timepicker/useTimepickerState.d.ts +9 -1
  25. package/dist/punkt-react.cjs +1 -1
  26. package/dist/punkt-react.js +2969 -2749
  27. package/dist/shared-strings/consent.d.ts +71 -0
  28. package/dist/shared-strings/format.d.ts +21 -0
  29. package/dist/shared-strings/index.d.ts +14 -0
  30. package/dist/shared-strings/nb.d.ts +118 -0
  31. package/dist/shared-strings/resolve.d.ts +12 -0
  32. package/dist/shared-strings/store.d.ts +27 -0
  33. package/dist/shared-strings/types.d.ts +29 -0
  34. package/dist/shared-types/fileupload.d.ts +0 -27
  35. package/dist/shared-types/index.d.ts +1 -2
  36. package/dist/shared-utils/combobox/index.d.ts +1 -0
  37. package/dist/shared-utils/combobox/input-utils.d.ts +2 -1
  38. package/dist/shared-utils/combobox/messages.d.ts +7 -0
  39. package/dist/shared-utils/combobox/option-utils.d.ts +2 -1
  40. package/dist/shared-utils/combobox/selection-manager.d.ts +3 -2
  41. package/package.json +4 -4
  42. package/src/components/backlink/BackLink.tsx +11 -2
  43. package/src/components/breadcrumbs/Breadcrumbs.tsx +8 -2
  44. package/src/components/calendar/Calendar.core.test.tsx +7 -5
  45. package/src/components/calendar/types.ts +14 -34
  46. package/src/components/calendar/useCalendarState.ts +16 -2
  47. package/src/components/checkbox/Checkbox.tsx +20 -4
  48. package/src/components/combobox/Combobox.tsx +1 -0
  49. package/src/components/combobox/Listbox.tsx +4 -2
  50. package/src/components/combobox/types.ts +6 -0
  51. package/src/components/combobox/useComboboxState.ts +15 -8
  52. package/src/components/consent/strings.ts +1 -125
  53. package/src/components/datepicker/DateTags.tsx +4 -3
  54. package/src/components/datepicker/Datepicker.accessibility.test.tsx +2 -2
  55. package/src/components/datepicker/Datepicker.tsx +1 -0
  56. package/src/components/datepicker/DatepickerInputs.tsx +6 -6
  57. package/src/components/datepicker/types.ts +6 -3
  58. package/src/components/datepicker/useDatepickerState.ts +4 -5
  59. package/src/components/fileupload/DropZone.tsx +20 -15
  60. package/src/components/fileupload/FileUpload.test.tsx +37 -0
  61. package/src/components/fileupload/FileUpload.tsx +41 -8
  62. package/src/components/header/HeaderGlobal.tsx +5 -2
  63. package/src/components/header/HeaderService.tsx +12 -7
  64. package/src/components/header/types.ts +6 -0
  65. package/src/components/index.ts +10 -0
  66. package/src/components/inputwrapper/InputWrapper.tsx +28 -6
  67. package/src/components/radio/RadioButton.tsx +18 -2
  68. package/src/components/searchinput/SearchInput.tsx +13 -3
  69. package/src/components/select/Select.tsx +5 -0
  70. package/src/components/strings/PktStringsProvider.tsx +38 -0
  71. package/src/components/strings/strings-override.test.tsx +130 -0
  72. package/src/components/tag/Tag.tsx +13 -2
  73. package/src/components/textarea/Textarea.tsx +5 -0
  74. package/src/components/textinput/Textinput.tsx +5 -0
  75. package/src/components/timepicker/Timepicker.tsx +1 -0
  76. package/src/components/timepicker/types.ts +3 -2
  77. package/src/components/timepicker/useTimepickerState.ts +20 -22
package/CHANGELOG.md CHANGED
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [18.0.0](https://github.com/oslokommune/punkt/compare/17.1.3...18.0.0) (2026-08-27)
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+ * Ny `shared-strings` og metoder for å overstyre strenger i komponenter (#3610). BREAKING CHANGE: **`strings`-propertyen på Elements** betyr nå "delvis overstyring" i stedet for "hele no.json".
12
+
13
+
14
+ ### Features
15
+ Ingen
16
+
17
+ ### Bug Fixes
18
+ Ingen
19
+
20
+ ### Chores
21
+ Ingen
22
+
23
+ ---
24
+
25
+
8
26
  ## [17.1.3](https://github.com/oslokommune/punkt/compare/17.1.2...17.1.3) (2026-08-25)
9
27
 
10
28
  ### ⚠ BREAKING CHANGES
@@ -1,5 +1,8 @@
1
1
  import { AnchorHTMLAttributes, ReactNode, Ref } from 'react';
2
+ import { TPktStringsOverride } from '../../shared-strings';
2
3
  export interface IPktBackLink extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
4
+ /** Overstyrer tekster for denne komponenten. */
5
+ strings?: TPktStringsOverride;
3
6
  href?: string;
4
7
  text?: string;
5
8
  ariaLabel?: string;
@@ -1,9 +1,12 @@
1
1
  import { AnchorHTMLAttributes, ReactNode } from 'react';
2
+ import { TPktStringsOverride } from '../../shared-strings';
2
3
  export interface IBreadcrumbs {
3
4
  text: string;
4
5
  href: string;
5
6
  }
6
7
  export interface IPktBreadcrumbs extends AnchorHTMLAttributes<HTMLAnchorElement> {
8
+ /** Overstyrer tekster for denne komponenten. */
9
+ strings?: TPktStringsOverride;
7
10
  breadcrumbs: IBreadcrumbs[];
8
11
  navigationType?: 'router' | 'anchor';
9
12
  renderLink?: (args: {
@@ -1,14 +1,15 @@
1
1
  import { IDateConstraints, TDateRangeMap } from '../../shared-types/calendar';
2
- export declare const DEFAULT_STRINGS: Required<IPktCalendarStrings>;
2
+ import { TPktStringsOverride } from '../../shared-strings';
3
+ /** Datonavn og navigasjonstekster slik kalender-underkomponentene forventer dem. */
3
4
  export interface IPktCalendarStrings {
4
- month?: string;
5
- year?: string;
6
- days?: string[];
7
- daysShort?: string[];
8
- months?: string[];
9
- week?: string;
10
- prevMonth?: string;
11
- nextMonth?: string;
5
+ month: string;
6
+ year: string;
7
+ days: string[];
8
+ daysShort: string[];
9
+ months: string[];
10
+ week: string;
11
+ prevMonth: string;
12
+ nextMonth: string;
12
13
  }
13
14
  export interface PktCalendarHandle {
14
15
  handleDateSelect: (selectedDate: Date | null) => void;
@@ -31,7 +32,8 @@ export interface IPktCalendar {
31
32
  withcontrols?: boolean;
32
33
  currentmonth?: Date | string | null;
33
34
  today?: string;
34
- strings?: IPktCalendarStrings;
35
+ /** Overstyrer tekster for denne komponenten. */
36
+ strings?: TPktStringsOverride;
35
37
  onDateSelected?: (selected: string[]) => void;
36
38
  onClose?: () => void;
37
39
  id?: string;
@@ -48,7 +50,7 @@ export type TDayViewData = {
48
50
  };
49
51
  export interface ICalendarState {
50
52
  componentId: string;
51
- strings: Required<IPktCalendarStrings>;
53
+ strings: IPktCalendarStrings;
52
54
  year: number;
53
55
  month: number;
54
56
  activeSelected: string[];
@@ -92,7 +94,7 @@ export interface ICalendarState {
92
94
  }
93
95
  export interface ICalendarNavProps {
94
96
  componentId: string;
95
- strings: Required<IPktCalendarStrings>;
97
+ strings: IPktCalendarStrings;
96
98
  year: number;
97
99
  month: number;
98
100
  earliest: string | null;
@@ -1,4 +1,5 @@
1
1
  import { ChangeEventHandler, InputHTMLAttributes, ReactNode } from 'react';
2
+ import { TPktStringsOverride } from '../../shared-strings';
2
3
  export interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement> {
3
4
  id: string;
4
5
  hasTile?: boolean;
@@ -14,9 +15,13 @@ export interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement> {
14
15
  hideLabel?: boolean;
15
16
  labelPosition?: 'right' | 'left';
16
17
  optionalTag?: boolean;
18
+ /** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
17
19
  optionalText?: string;
18
20
  requiredTag?: boolean;
21
+ /** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
19
22
  requiredText?: string;
23
+ /** Overstyrer tekster for denne komponenten. */
24
+ strings?: TPktStringsOverride;
20
25
  tagText?: string | null;
21
26
  onChange?: ChangeEventHandler<HTMLInputElement>;
22
27
  }
@@ -1,3 +1,4 @@
1
+ import { TPktStringsOverride } from '../../shared-strings';
1
2
  import { ChangeEvent, ChangeEventHandler, FocusEvent, KeyboardEvent, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent, ReactNode, RefObject } from 'react';
2
3
  import { IPktComboboxOption, TPktComboboxDisplayValue, TPktComboboxTagPlacement } from '../../shared-types/combobox';
3
4
  export interface IPktCombobox {
@@ -33,6 +34,8 @@ export interface IPktCombobox {
33
34
  useWrapper?: boolean;
34
35
  inline?: boolean;
35
36
  counter?: boolean;
37
+ /** Overstyrer tekster for denne komponenten. */
38
+ strings?: TPktStringsOverride;
36
39
  hasFieldset?: boolean;
37
40
  inputSize?: 'small' | 'medium' | 'xsmall';
38
41
  onChange?: ChangeEventHandler<HTMLInputElement>;
@@ -41,6 +44,8 @@ export interface IPktCombobox {
41
44
  children?: ReactNode;
42
45
  }
43
46
  export interface IComboboxState {
47
+ /** Tekstoverstyring sendt inn på komponenten. */
48
+ strings?: TPktStringsOverride;
44
49
  id: string;
45
50
  inputId: string;
46
51
  listboxId: string;
@@ -1,85 +1 @@
1
- export declare const consentStrings: {
2
- i18n: {
3
- nb: {
4
- contentPresentation: {
5
- title: string;
6
- description: string[];
7
- buttons: {
8
- accept: string;
9
- reject: string;
10
- settings: string;
11
- };
12
- };
13
- contentSettings: {
14
- title: string;
15
- description: string[];
16
- buttons: {
17
- back: string;
18
- save: string;
19
- };
20
- };
21
- };
22
- en: {
23
- contentPresentation: {
24
- title: string;
25
- description: string[];
26
- buttons: {
27
- accept: string;
28
- reject: string;
29
- settings: string;
30
- };
31
- };
32
- contentSettings: {
33
- title: string;
34
- description: string[];
35
- buttons: {
36
- back: string;
37
- save: string;
38
- };
39
- };
40
- };
41
- };
42
- cookies: ({
43
- name: string;
44
- defaultValue: null;
45
- i18n: {
46
- nb: {
47
- title: string;
48
- description: string;
49
- buttons: {
50
- yes: string;
51
- no: string;
52
- };
53
- };
54
- en: {
55
- title: string;
56
- description: string;
57
- buttons: {
58
- yes: string;
59
- no: string;
60
- };
61
- };
62
- };
63
- } | {
64
- name: string;
65
- defaultValue: boolean;
66
- i18n: {
67
- nb: {
68
- title: string;
69
- description: string;
70
- buttons: {
71
- yes: string;
72
- no: string;
73
- };
74
- };
75
- en: {
76
- title: string;
77
- description: string;
78
- buttons: {
79
- yes: string;
80
- no: string;
81
- };
82
- };
83
- };
84
- })[];
85
- };
1
+ export { consentStrings } from '../../shared-strings/consent';
@@ -1,9 +1,9 @@
1
- import { IDatepickerStrings } from '../../shared-types/datepicker';
1
+ import { TPktStringsOverride } from '../../shared-strings';
2
2
  interface DateTagsProps {
3
3
  dates: string[];
4
4
  dateformat: string;
5
5
  idBase: string;
6
- strings?: IDatepickerStrings;
6
+ strings?: TPktStringsOverride;
7
7
  onDateRemoved: (date: string) => void;
8
8
  }
9
9
  export declare const DateTags: ({ dates, dateformat, idBase, strings, onDateRemoved, }: DateTagsProps) => import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
+ import { TPktStrings, TPktStringsOverride } from '../../shared-strings';
1
2
  import { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react';
2
- import { IDatepickerStrings } from '../../shared-types/datepicker';
3
3
  import { TPktInputSize } from '../../shared-types/size';
4
4
  export interface IPktDatepicker extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
5
5
  id: string;
@@ -35,7 +35,8 @@ export interface IPktDatepicker extends Omit<InputHTMLAttributes<HTMLInputElemen
35
35
  requiredText?: string;
36
36
  tagText?: string;
37
37
  useWrapper?: boolean;
38
- strings?: IDatepickerStrings;
38
+ /** Overstyrer tekster for denne komponenten. */
39
+ strings?: TPktStringsOverride;
39
40
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
40
41
  onValueChange?: (values: string[]) => void;
41
42
  className?: string;
@@ -82,7 +83,9 @@ export interface IDatepickerState {
82
83
  today?: string;
83
84
  inputType: string;
84
85
  isIOSDevice: boolean;
85
- strings: IDatepickerStrings;
86
+ strings: Pick<TPktStrings, 'generic' | 'datepicker' | 'validation'>;
87
+ /** Rå tekstoverstyring, til videresending til underkomponenter. */
88
+ stringsOverride?: TPktStringsOverride;
86
89
  inputClasses: string;
87
90
  buttonClasses: string;
88
91
  rangeLabelClasses: string;
@@ -1,5 +1,6 @@
1
1
  import { InputHTMLAttributes } from 'react';
2
2
  import { TFileItemList, TUploadStrategy } from './types';
3
+ import { TPktStringsOverride } from '../../shared-strings';
3
4
  /**
4
5
  * Props for the internal `DropZone` building block.
5
6
  *
@@ -9,6 +10,8 @@ import { TFileItemList, TUploadStrategy } from './types';
9
10
  * - optionally rendering hidden inputs with file IDs when `uploadStrategy="custom"`
10
11
  */
11
12
  interface IDropZoneProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'checked' | 'size' | 'type' | 'value' | 'onChange' | 'width'> {
13
+ /** Overstyrer tekster for denne komponenten. */
14
+ strings?: TPktStringsOverride;
12
15
  /** Called with `FileItem`s created from dropped/selected files. */
13
16
  onFilesAdded?: (files: TFileItemList) => void;
14
17
  /** Used for the native input `id` and related label/ARIA wiring. */
@@ -1,6 +1,7 @@
1
1
  import { FC, HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
2
2
  import { ItemRenderers } from './QueueDisplay';
3
3
  import { FileItem, TFileItemList, TFileTransfer, TFileValidateDetail, TItemRenderer, TQueueItemOperation, TUploadStrategy } from './types';
4
+ import { TPktStringsOverride } from '../../shared-strings';
4
5
  export { formatFileSize, parseFileSize } from '../../shared-utils/fileupload';
5
6
  /**
6
7
  * Shared props for `PktFileUpload` (both `form` and `custom` strategies).
@@ -76,6 +77,8 @@ interface IBaseFileUploadProps extends Omit<InputHTMLAttributes<HTMLInputElement
76
77
  tagText?: string | null;
77
78
  /** Marks the upload as required. Native validation is used in `form`; submit validation in `custom`. */
78
79
  required?: boolean;
80
+ /** Overstyrer tekster for denne komponenten. */
81
+ strings?: TPktStringsOverride;
79
82
  /** Enable image preview modal (only applies to thumbnail renderer). */
80
83
  enableImagePreview?: boolean;
81
84
  }
@@ -1,5 +1,6 @@
1
1
  import { MouseEvent, ReactNode } from 'react';
2
2
  import { THeaderMenu, THeaderPosition, THeaderScrollBehavior, TLogOutButtonPlacement, TSlotMenuVariant, THeaderFooterApi, THeaderMenuLocale, IPktHeaderGlobal as ISharedPktHeaderGlobal } from '../../shared-types';
3
+ import { TPktStringsOverride } from '../../shared-strings';
3
4
  export type { THeaderMenu, THeaderPosition, THeaderScrollBehavior, TLogOutButtonPlacement, TSlotMenuVariant, THeaderFooterApi, THeaderMenuLocale, };
4
5
  /** Which header variant `<PktHeader>` renders. */
5
6
  export type THeaderType = 'service' | 'global';
@@ -29,6 +30,8 @@ export interface UserMenuFooterItem {
29
30
  target: string | (() => void);
30
31
  }
31
32
  export interface IPktHeader {
33
+ /** Overstyrer tekster for denne komponenten. */
34
+ strings?: TPktStringsOverride;
32
35
  children?: ReactNode;
33
36
  /** Additional CSS class name(s) to apply to the header */
34
37
  className?: string;
@@ -102,6 +105,8 @@ export interface IPktHeader {
102
105
  * (in shared-types) with React-specific callbacks and DOM props.
103
106
  */
104
107
  export interface IPktHeaderGlobal extends ISharedPktHeaderGlobal {
108
+ /** Overstyrer tekster for denne komponenten. */
109
+ strings?: TPktStringsOverride;
105
110
  /** Additional CSS class name(s) to apply to the header */
106
111
  className?: string;
107
112
  /** Set dark mode on the header */
@@ -52,3 +52,7 @@ export { PktTextinput } from './textinput/Textinput';
52
52
  export { PktTimepicker } from './timepicker/Timepicker';
53
53
  export * from './interfaces';
54
54
  export * from './types';
55
+ export { PktStringsProvider } from './strings/PktStringsProvider';
56
+ export type { IPktStringsProvider } from './strings/PktStringsProvider';
57
+ export { getPktStrings, nb as pktStringsNb, resetPktStrings, setPktStrings, subscribePktStrings, } from '../shared-strings';
58
+ export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride } from '../shared-strings';
@@ -1,16 +1,20 @@
1
1
  import { ReactNode, RefAttributes } from 'react';
2
+ import { TPktStringsOverride } from '../../shared-strings';
2
3
  export interface IPktInputWrapper extends RefAttributes<HTMLElement> {
3
4
  forId: string;
4
5
  label: string;
5
6
  helptext?: string | ReactNode;
6
7
  helptextDropdown?: string | ReactNode;
8
+ /** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
7
9
  helptextDropdownButton?: string;
8
10
  counter?: boolean;
9
11
  counterCurrent?: number;
10
12
  counterMaxLength?: number;
11
13
  optionalTag?: boolean;
14
+ /** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
12
15
  optionalText?: string;
13
16
  requiredTag?: boolean;
17
+ /** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
14
18
  requiredText?: string;
15
19
  tagText?: string | null;
16
20
  hasError?: boolean;
@@ -25,5 +29,7 @@ export interface IPktInputWrapper extends RefAttributes<HTMLElement> {
25
29
  role?: string;
26
30
  counterPosition?: 'top' | 'bottom';
27
31
  size?: 'small' | 'medium' | 'xsmall';
32
+ /** Overstyrer tekster for denne komponenten. */
33
+ strings?: TPktStringsOverride;
28
34
  }
29
35
  export declare const PktInputWrapper: import('react').ForwardRefExoticComponent<Omit<IPktInputWrapper, "ref"> & RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,5 @@
1
1
  import { ChangeEventHandler, InputHTMLAttributes, ReactNode } from 'react';
2
+ import { TPktStringsOverride } from '../../shared-strings';
2
3
  export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement> {
3
4
  id: string;
4
5
  name: string;
@@ -11,9 +12,13 @@ export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement> {
11
12
  hasError?: boolean;
12
13
  value?: string;
13
14
  optionalTag?: boolean;
15
+ /** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
14
16
  optionalText?: string;
15
17
  requiredTag?: boolean;
18
+ /** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
16
19
  requiredText?: string;
20
+ /** Overstyrer tekster for denne komponenten. */
21
+ strings?: TPktStringsOverride;
17
22
  tagText?: string | null;
18
23
  onChange?: ChangeEventHandler<HTMLInputElement>;
19
24
  }
@@ -1,5 +1,6 @@
1
1
  import { ChangeEvent, HTMLProps, ReactNode } from 'react';
2
2
  import { IPktSearchInputSuggestion } from '../../shared-types/searchinput';
3
+ import { TPktStringsOverride } from '../../shared-strings';
3
4
  /**
4
5
  * React suggestion item: portable fields from {@link IPktSearchInputSuggestion}
5
6
  * plus optional rich content and per-row handler.
@@ -10,6 +11,8 @@ export type PktSearchInputSuggestion = Omit<IPktSearchInputSuggestion, 'title' |
10
11
  onClick?: () => void;
11
12
  };
12
13
  interface ISearch extends HTMLProps<HTMLInputElement> {
14
+ /** Overstyrer tekster for denne komponenten. */
15
+ strings?: TPktStringsOverride;
13
16
  appearance?: 'local' | 'local-with-button' | 'global';
14
17
  inputSize?: 'small' | 'medium' | 'xsmall';
15
18
  disabled?: boolean;
@@ -17,6 +20,7 @@ interface ISearch extends HTMLProps<HTMLInputElement> {
17
20
  id: string;
18
21
  label?: string;
19
22
  name?: string;
23
+ /** @deprecated Bruk `strings={{ searchinput: { placeholder: '…' } }}` eller `setPktStrings()`. */
20
24
  placeholder?: string;
21
25
  suggestions?: PktSearchInputSuggestion[];
22
26
  value?: string | undefined;
@@ -1,6 +1,9 @@
1
1
  import { ReactNode, SelectHTMLAttributes } from 'react';
2
+ import { TPktStringsOverride } from '../../shared-strings';
2
3
  export type { IPktSelectOption, TSelectOption } from '../../shared-types/select';
3
4
  export interface IPktSelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
5
+ /** Overstyrer tekster for denne komponenten. */
6
+ strings?: TPktStringsOverride;
4
7
  ariaDescribedby?: string;
5
8
  ariaLabelledby?: string;
6
9
  children?: ReactNode | ReactNode[];
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ import { TPktStringsOverride } from '../../shared-strings';
3
+ export declare const PktStringsContext: import('react').Context<TPktStringsOverride | undefined>;
4
+ export interface IPktStringsProvider {
5
+ /** Tekstene som skal gjelde for dette undertreet. */
6
+ strings: TPktStringsOverride;
7
+ children?: ReactNode;
8
+ }
9
+ /**
10
+ * Overstyrer Punkt-tekster for et undertre.
11
+ *
12
+ * Providere kan nestes — en indre provider merges oppå den ytre, og en `strings`-prop
13
+ * på en enkelt komponent vinner uansett over begge.
14
+ *
15
+ * ```tsx
16
+ * <PktStringsProvider strings={{ forms: { optional: 'Kan stå tomt' } }}>
17
+ * <PktTextinput id="navn" name="navn" label="Navn" />
18
+ * </PktStringsProvider>
19
+ * ```
20
+ */
21
+ export declare const PktStringsProvider: ({ strings, children }: IPktStringsProvider) => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,9 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
2
  import { TTagSkin } from '../../shared-types';
3
+ import { TPktStringsOverride } from '../../shared-strings';
3
4
  interface BasePktTagProps {
5
+ /** Overstyrer tekster for denne komponenten. */
6
+ strings?: TPktStringsOverride;
4
7
  skin?: TTagSkin;
5
8
  textStyle?: 'normal-text' | 'thin-text';
6
9
  size?: 'small' | 'medium' | 'large';
@@ -1,6 +1,9 @@
1
1
  import { ChangeEventHandler, ReactNode, TextareaHTMLAttributes } from 'react';
2
2
  import { TPktInputSize } from '../../shared-types/size';
3
+ import { TPktStringsOverride } from '../../shared-strings';
3
4
  export interface IPktTextarea extends TextareaHTMLAttributes<HTMLTextAreaElement> {
5
+ /** Overstyrer tekster for denne komponenten. */
6
+ strings?: TPktStringsOverride;
4
7
  id: string;
5
8
  ariaDescribedby?: string;
6
9
  ariaLabelledby?: string;
@@ -1,5 +1,8 @@
1
1
  import { ChangeEventHandler, InputHTMLAttributes, ReactNode } from 'react';
2
+ import { TPktStringsOverride } from '../../shared-strings';
2
3
  export interface IPktTextinput extends InputHTMLAttributes<HTMLInputElement> {
4
+ /** Overstyrer tekster for denne komponenten. */
5
+ strings?: TPktStringsOverride;
3
6
  id: string;
4
7
  ariaDescribedby?: string;
5
8
  ariaLabelledby?: string;
@@ -1,6 +1,6 @@
1
+ import { TPktStringsOverride } from '../../shared-strings';
1
2
  import { ChangeEvent, FocusEvent, InputHTMLAttributes, ReactNode } from 'react';
2
3
  import { TPktInputSize } from '../../shared-types/size';
3
- import { ITimepickerStrings } from '../../shared-types/timepicker';
4
4
  /**
5
5
  * Props for {@link PktTimepicker}: a React time picker with `HH:MM`, aligned with Elements `pkt-timepicker`.
6
6
  *
@@ -67,7 +67,8 @@ export interface IPktTimepicker extends Omit<InputHTMLAttributes<HTMLInputElemen
67
67
  /** Passed through to InputWrapper as `aria-describedby`. */
68
68
  ariaDescribedby?: string;
69
69
  /** Copy for hours, minutes, buttons, and popup. */
70
- strings?: ITimepickerStrings;
70
+ /** Overstyrer tekster for denne komponenten. */
71
+ strings?: TPktStringsOverride;
71
72
  /** Change event from the hidden input (`e.target.value` is `HH:MM`). In React, `onChange` already fires on input. */
72
73
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
73
74
  /** Callback with the committed `HH:MM` string. */
@@ -6,7 +6,15 @@ export declare function useTimepickerState(props: IPktTimepicker, ref: React.For
6
6
  containerRef: import('react').RefObject<HTMLDivElement | null>;
7
7
  outerClasses: string;
8
8
  inputSize: TPktInputSize;
9
- strings: import('../../shared-types').ITimepickerStrings;
9
+ strings: {
10
+ hours: string;
11
+ minutes: string;
12
+ openPicker: string;
13
+ prevTime: string;
14
+ nextTime: string;
15
+ selectTime: string;
16
+ };
17
+ stringsOverride: import('../../shared-strings').TPktStringsOverride | undefined;
10
18
  label: string;
11
19
  disabled: boolean;
12
20
  required: boolean;