@oslokommune/punkt-elements 18.1.0 → 18.2.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 (36) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/base-elements/element.d.ts +6 -1
  3. package/dist/base-elements/input-element.d.ts +2 -1
  4. package/dist/components/alert/alert.d.ts +3 -2
  5. package/dist/components/breadcrumbs/breadcrumbs.d.ts +1 -1
  6. package/dist/components/calendar/calendar.d.ts +2 -1
  7. package/dist/components/combobox/combobox-base.d.ts +2 -1
  8. package/dist/components/combobox/combobox.d.ts +2 -1
  9. package/dist/components/datepicker/date-tags.d.ts +2 -1
  10. package/dist/components/datepicker/datepicker.d.ts +2 -1
  11. package/dist/components/header/types.d.ts +3 -2
  12. package/dist/components/helptext/helptext.d.ts +2 -1
  13. package/dist/components/input-wrapper/input-wrapper.d.ts +2 -1
  14. package/dist/components/listbox/listbox.d.ts +3 -2
  15. package/dist/components/tag/tag.d.ts +2 -1
  16. package/dist/components/timepicker/timepicker.d.ts +2 -1
  17. package/dist/shared-strings/types.d.ts +10 -4
  18. package/dist/shared-types/backlink.d.ts +1 -1
  19. package/dist/shared-types/breadcrumbs.d.ts +1 -1
  20. package/dist/shared-types/fileupload.d.ts +1 -1
  21. package/dist/shared-types/form-field.d.ts +7 -6
  22. package/dist/shared-types/searchinput.d.ts +2 -1
  23. package/package.json +2 -2
  24. package/src/components/alert/alert.ts +3 -3
  25. package/src/components/breadcrumbs/breadcrumbs.ts +1 -1
  26. package/src/components/calendar/calendar.ts +2 -1
  27. package/src/components/combobox/combobox-base.ts +2 -1
  28. package/src/components/combobox/combobox.ts +2 -1
  29. package/src/components/datepicker/date-tags.ts +2 -1
  30. package/src/components/datepicker/datepicker.ts +3 -1
  31. package/src/components/header/types.ts +6 -4
  32. package/src/components/helptext/helptext.ts +2 -1
  33. package/src/components/input-wrapper/input-wrapper.ts +3 -2
  34. package/src/components/listbox/listbox.ts +3 -2
  35. package/src/components/tag/tag.ts +2 -2
  36. package/src/components/timepicker/timepicker.ts +3 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [18.2.0](https://github.com/oslokommune/punkt/compare/18.1.0...18.2.0) (2026-09-01)
9
+
10
+ ### ⚠ BREAKING CHANGES
11
+ Ingen
12
+
13
+ ### Features
14
+ Ingen
15
+
16
+ ### Bug Fixes
17
+ Ingen
18
+
19
+ ### Chores
20
+ Ingen
21
+
22
+ ---
23
+
24
+
8
25
  ## [18.1.0](https://github.com/oslokommune/punkt/compare/18.0.0...18.1.0) (2026-08-31)
9
26
 
10
27
  ### ⚠ BREAKING CHANGES
@@ -3,6 +3,11 @@ import { ElementProps } from '../types/typeUtils';
3
3
  import { PktStringsController } from '../controllers/strings-controller';
4
4
  import { TPktStringsOverride } from '../shared-strings';
5
5
  type Props = ElementProps<PktElement, 'strings' | 'role'>;
6
+ /**
7
+ * `strings` on `$props` comes from `T` when the component includes `IPktStringsProps<NS>`.
8
+ * Unmigrated components keep the full catalogue from the base class.
9
+ */
10
+ type PropsFor<T> = T & Omit<Props, 'strings'> & ('strings' extends keyof T ? unknown : Pick<Props, 'strings'>);
6
11
  /**
7
12
  * Base class for Punkt shadow DOM elements
8
13
  * @extends LitElement
@@ -24,7 +29,7 @@ export declare class PktShadowElement<T = {}> extends LitElement {
24
29
  /**
25
30
  * Here to support prop typing in Vue
26
31
  */
27
- $props: T & Props;
32
+ $props: PropsFor<T>;
28
33
  /**
29
34
  * Add support for Hot Module Reloading in dev mode
30
35
  */
@@ -2,6 +2,7 @@ import { PropertyValues } from 'lit';
2
2
  import { Booleanish } from '../shared-types';
3
3
  import { ElementProps } from '../types/typeUtils';
4
4
  import { PktOptionsSlotController } from '../controllers/pkt-options-controller';
5
+ import { IPktStringsProps } from '../shared-strings';
5
6
  import { PktElementWithSlot } from './element-with-slot';
6
7
  /**
7
8
  * Base interface for input options used in select, combobox, etc.
@@ -13,7 +14,7 @@ export interface PktInputOption {
13
14
  disabled?: boolean;
14
15
  hidden?: boolean;
15
16
  }
16
- type Props = ElementProps<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | 'ariaDescribedby' | 'ariaLabelledby' | 'name' | 'pattern' | 'placeholder' | 'id' | 'counter' | 'hasError' | 'hasFieldset' | 'inline' | 'optionalTag' | 'requiredTag' | 'skipForwardTestid' | 'useWrapper' | 'fullwidth' | 'counterMaxLength' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'label' | 'optionalText' | 'requiredText' | 'tagText' | 'inputSize' | 'dataTestid'>;
17
+ type Props = ElementProps<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | 'ariaDescribedby' | 'ariaLabelledby' | 'name' | 'pattern' | 'placeholder' | 'id' | 'counter' | 'hasError' | 'hasFieldset' | 'inline' | 'optionalTag' | 'requiredTag' | 'skipForwardTestid' | 'useWrapper' | 'fullwidth' | 'counterMaxLength' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'label' | 'optionalText' | 'requiredText' | 'tagText' | 'inputSize' | 'dataTestid'> & IPktStringsProps<'forms' | 'validation'>;
17
18
  /**
18
19
  * Base class for all Punkt input elements
19
20
  * @extends PktElementWithSlot
@@ -1,8 +1,9 @@
1
1
  import { PropertyValues } from 'lit';
2
2
  import { PktElementWithSlot } from '../../base-elements/element-with-slot';
3
3
  import { TAriaLive, TAlertSkin, TAlertSize } from '../../shared-types';
4
+ import { IPktStringsProps } from '../../shared-strings';
4
5
  export type { TAlertSkin };
5
- export interface IPktAlert {
6
+ export interface IPktAlert extends IPktStringsProps<'alert' | 'generic'> {
6
7
  skin?: TAlertSkin;
7
8
  closeAlert?: boolean;
8
9
  title?: string;
@@ -15,7 +16,7 @@ export interface IPktAlert {
15
16
  role?: string;
16
17
  size?: TAlertSize;
17
18
  }
18
- export declare class PktAlert extends PktElementWithSlot implements IPktAlert {
19
+ export declare class PktAlert extends PktElementWithSlot<IPktAlert> implements IPktAlert {
19
20
  constructor();
20
21
  compact: boolean;
21
22
  title: string;
@@ -6,7 +6,7 @@ export type { IBreadcrumb };
6
6
  export type IBreadcrumbItem = IBreadcrumb;
7
7
  export interface IPktBreadcrumbs extends IPktBreadcrumbsBase {
8
8
  }
9
- export declare class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
9
+ export declare class PktBreadcrumbs extends PktElement<IPktBreadcrumbs> implements IPktBreadcrumbs {
10
10
  breadcrumbs: IBreadcrumb[];
11
11
  private handleLinkClick;
12
12
  render(): typeof nothing | import('lit-html').TemplateResult<1>;
@@ -1,6 +1,7 @@
1
1
  import { PropertyValues, TemplateResult } from 'lit';
2
2
  import { PktElement } from '../../base-elements/element';
3
- export declare class PktCalendar extends PktElement {
3
+ import { IPktStringsProps } from '../../shared-strings';
4
+ export declare class PktCalendar extends PktElement<IPktStringsProps<'dates' | 'calendar'>> {
4
5
  selected: string | string[];
5
6
  multiple: boolean;
6
7
  maxMultiple: number;
@@ -1,13 +1,14 @@
1
1
  import { Ref } from 'lit/directives/ref.js';
2
2
  import { PktInputElement } from '../../base-elements/input-element';
3
3
  import { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
4
+ import { IPktStringsProps } from '../../shared-strings';
4
5
  import { default as PktListbox } from '../listbox';
5
6
  import { TComboboxMessageKey } from '../../shared-utils/combobox';
6
7
  /**
7
8
  * Base class for PktCombobox.
8
9
  * Declares all reactive properties, state, refs, and simple helpers.
9
10
  */
10
- export declare class ComboboxBase extends PktInputElement {
11
+ export declare class ComboboxBase extends PktInputElement<IPktStringsProps<'combobox' | 'listbox'>> {
11
12
  constructor();
12
13
  value: string | string[];
13
14
  options: IPktComboboxOption[];
@@ -1,8 +1,9 @@
1
1
  import { PropertyValues } from 'lit';
2
2
  import { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
3
3
  import { ComboboxHandlers } from './combobox-handlers';
4
+ import { IPktStringsProps } from '../../shared-strings';
4
5
  export type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
5
- export interface IPktCombobox {
6
+ export interface IPktCombobox extends IPktStringsProps<'combobox' | 'listbox'> {
6
7
  allowUserInput?: boolean;
7
8
  typeahead?: boolean;
8
9
  disabled?: boolean;
@@ -1,4 +1,5 @@
1
1
  import { PktElement } from '../../base-elements/element';
2
+ import { IPktStringsProps } from '../../shared-strings';
2
3
  type TYear = `${number}${number}${number}${number}`;
3
4
  type TMonth = `${number}${number}`;
4
5
  type TDay = `${number}${number}`;
@@ -10,7 +11,7 @@ export type TISODate = `${TYear}-${TMonth}-${TDay}`;
10
11
  * Følger denne unicode-standarden:
11
12
  * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
12
13
  */
13
- export declare class PktDateTags extends PktElement {
14
+ export declare class PktDateTags extends PktElement<IPktStringsProps<'datepicker'>> {
14
15
  dates: TISODate[];
15
16
  dateformat: string;
16
17
  className: string;
@@ -7,7 +7,8 @@ import { PktDatepickerSingle } from './datepicker-single';
7
7
  import { PktDatepickerRange } from './datepicker-range';
8
8
  import { PktDatepickerMultiple } from './datepicker-multiple';
9
9
  import { ElementProps } from '../../types/typeUtils';
10
- type Props = ElementProps<PktDatepicker, 'label' | 'dateformat' | 'multiple' | 'maxlength' | 'range' | 'showRangeLabels' | 'min' | 'max' | 'weeknumbers' | 'withcontrols' | 'excludedates' | 'excludeweekdays' | 'currentmonth' | 'calendarOpen' | 'timezone'>;
10
+ import { IPktStringsProps } from '../../shared-strings';
11
+ type Props = ElementProps<PktDatepicker, 'label' | 'dateformat' | 'multiple' | 'maxlength' | 'range' | 'showRangeLabels' | 'min' | 'max' | 'weeknumbers' | 'withcontrols' | 'excludedates' | 'excludeweekdays' | 'currentmonth' | 'calendarOpen' | 'timezone'> & IPktStringsProps<'generic' | 'datepicker' | 'dates' | 'calendar'>;
11
12
  export declare class PktDatepicker extends PktInputElement<Props> {
12
13
  /**
13
14
  * Element attributes and properties
@@ -1,5 +1,6 @@
1
1
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
2
2
  import { booleanishConverter, Booleanish, User as SharedUser, Representing as SharedRepresenting, UserMenuItem as SharedUserMenuItem, TInternalMenuItem as SharedTInternalMenuItem, TSlotMenuVariant, THeaderMenu, TLogOutButtonPlacement, THeaderPosition, THeaderScrollBehavior, THeaderFooterApi, THeaderMenuLocale, IPktHeaderGlobal as ISharedPktHeaderGlobal } from '../../shared-types';
3
+ import { IPktStringsProps } from '../../shared-strings';
3
4
  export type { Booleanish, TSlotMenuVariant, THeaderMenu, TLogOutButtonPlacement, THeaderPosition, THeaderScrollBehavior, THeaderFooterApi, THeaderMenuLocale, };
4
5
  /** Which header variant `<pkt-header>` renders. */
5
6
  export type THeaderType = 'service' | 'global';
@@ -17,7 +18,7 @@ export declare const convertUserMenuItem: (item: UserMenuItem) => TInternalMenuI
17
18
  /**
18
19
  * Interface for the Header component props
19
20
  */
20
- export interface IPktHeader {
21
+ export interface IPktHeader extends IPktStringsProps<'header'> {
21
22
  /** Hide the Oslo logo */
22
23
  hideLogo?: Booleanish;
23
24
  /** Logo link URL */
@@ -73,7 +74,7 @@ export interface IPktHeader {
73
74
  * `userMenu` icons as `PktIconName`, and adding the Lit-only `hasLogOut`
74
75
  * signal.
75
76
  */
76
- export interface IPktHeaderGlobal extends Omit<ISharedPktHeaderGlobal, 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu'> {
77
+ export interface IPktHeaderGlobal extends Omit<ISharedPktHeaderGlobal, 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu'>, IPktStringsProps<'header'> {
77
78
  /** Show the search field. Default: true */
78
79
  showSearch?: Booleanish;
79
80
  /** Show the contact link (from the payload's `header.contact`). Default: true */
@@ -1,5 +1,6 @@
1
1
  import { PktElementWithSlot } from '../../base-elements/element-with-slot';
2
- export declare class PktHelptext extends PktElementWithSlot {
2
+ import { IPktStringsProps } from '../../shared-strings';
3
+ export declare class PktHelptext extends PktElementWithSlot<IPktStringsProps<'forms'>> {
3
4
  forId: string;
4
5
  helptext: string;
5
6
  helptextDropdown: string;
@@ -1,11 +1,12 @@
1
1
  import { PktElementWithSlot } from '../../base-elements/element-with-slot';
2
+ import { IPktStringsProps } from '../../shared-strings';
2
3
  import { PropertyValues } from 'lit';
3
4
  import { ElementProps } from '../../types/typeUtils';
4
5
  import { Booleanish } from '../../shared-types';
5
6
  import { FocusModalityController } from '../../controllers/focus-modality-controller';
6
7
  type TCounterPosition = 'top' | 'bottom';
7
8
  type TInputWrapperSize = 'small' | 'medium' | 'xsmall';
8
- type Props = ElementProps<PktInputWrapper, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'tagText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'ariaDescribedby' | 'hasFieldset' | 'useWrapper' | 'role'>;
9
+ type Props = ElementProps<PktInputWrapper, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'tagText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'ariaDescribedby' | 'hasFieldset' | 'useWrapper' | 'role'> & IPktStringsProps<'forms' | 'validation'>;
9
10
  export declare class PktInputWrapper extends PktElementWithSlot<Props> {
10
11
  /**
11
12
  * Element attributes
@@ -1,12 +1,13 @@
1
1
  import { PropertyValues } from 'lit';
2
2
  import { PktElement } from '../../base-elements/element';
3
3
  import { IPktComboboxOption } from '../../shared-types/combobox';
4
+ import { IPktStringsProps } from '../../shared-strings';
4
5
  declare global {
5
6
  interface HTMLElementTagNameMap {
6
7
  'pkt-listbox': PktListbox;
7
8
  }
8
9
  }
9
- export interface IPktListbox {
10
+ export interface IPktListbox extends IPktStringsProps<'listbox'> {
10
11
  options: IPktComboboxOption[];
11
12
  isOpen: boolean;
12
13
  disabled: boolean;
@@ -20,7 +21,7 @@ export interface IPktListbox {
20
21
  maxLength: number;
21
22
  userMessage: string | null;
22
23
  }
23
- export declare class PktListbox extends PktElement implements IPktListbox {
24
+ export declare class PktListbox extends PktElement<IPktListbox> implements IPktListbox {
24
25
  id: string;
25
26
  label: string | null;
26
27
  options: IPktComboboxOption[];
@@ -3,9 +3,10 @@ import { PktElementWithSlot } from '../../base-elements/element-with-slot';
3
3
  import { TPktSize } from '../../types/size';
4
4
  import { IAriaAttributes, THTMLButtonType } from '../../shared-types';
5
5
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
6
+ import { IPktStringsProps } from '../../shared-strings';
6
7
  export type TTagSkin = 'blue' | 'blue-dark' | 'blue-light' | 'green' | 'red' | 'yellow' | 'beige' | 'gray' | 'grey';
7
8
  export type TTagType = THTMLButtonType;
8
- export interface IPktTag {
9
+ export interface IPktTag extends IPktStringsProps<'tag'> {
9
10
  closeTag?: boolean;
10
11
  size?: TPktSize;
11
12
  skin?: TTagSkin;
@@ -2,8 +2,9 @@ import { PropertyValues } from 'lit';
2
2
  import { Ref } from 'lit/directives/ref.js';
3
3
  import { PktInputElement } from '../../base-elements/input-element';
4
4
  import { ElementProps } from '../../types/typeUtils';
5
+ import { IPktStringsProps } from '../../shared-strings';
5
6
  import { TPktInputSize } from '../../shared-types/size';
6
- type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'>;
7
+ type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'> & IPktStringsProps<'timepicker'>;
7
8
  export interface IPktTimepicker {
8
9
  value?: string;
9
10
  min?: string;
@@ -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-elements",
3
- "version": "18.1.0",
3
+ "version": "18.2.0",
4
4
  "description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -83,5 +83,5 @@
83
83
  "engines": {
84
84
  "node": "^22.19.0 || ^24.0.0 || ^26.0.0"
85
85
  },
86
- "gitHead": "087459aca13f8ff3a34afc42f8e1cd73900d4896"
86
+ "gitHead": "3e850f524f546977081c875a222256fb2e63eb5a"
87
87
  }
@@ -5,7 +5,7 @@ import { PktElementWithSlot } from '@/base-elements/element-with-slot'
5
5
  import { slotContent } from '@/directives/slot-content'
6
6
  import type { TAriaLive, TAlertSkin, TAlertSize } from 'shared-types'
7
7
  import { updateClassAttribute } from '@/utils/classutils'
8
- import { formatString } from 'shared-strings'
8
+ import { formatString, type IPktStringsProps } from 'shared-strings'
9
9
  import specs from 'componentSpecs/alert.spec'
10
10
 
11
11
  import '@/components/icon'
@@ -13,7 +13,7 @@ import '@/components/button'
13
13
 
14
14
  export type { TAlertSkin }
15
15
 
16
- export interface IPktAlert {
16
+ export interface IPktAlert extends IPktStringsProps<'alert' | 'generic'> {
17
17
  skin?: TAlertSkin
18
18
  closeAlert?: boolean
19
19
  title?: string
@@ -26,7 +26,7 @@ export interface IPktAlert {
26
26
  role?: string
27
27
  size?: TAlertSize
28
28
  }
29
- export class PktAlert extends PktElementWithSlot implements IPktAlert {
29
+ export class PktAlert extends PktElementWithSlot<IPktAlert> implements IPktAlert {
30
30
  constructor() {
31
31
  super()
32
32
  this._isClosed = false
@@ -12,7 +12,7 @@ export type IBreadcrumbItem = IBreadcrumb
12
12
 
13
13
  export interface IPktBreadcrumbs extends IPktBreadcrumbsBase {}
14
14
 
15
- export class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
15
+ export class PktBreadcrumbs extends PktElement<IPktBreadcrumbs> implements IPktBreadcrumbs {
16
16
  @property({ type: Array }) breadcrumbs: IBreadcrumb[] = []
17
17
 
18
18
  private handleLinkClick(event: MouseEvent, item: IBreadcrumb, index: number) {
@@ -11,6 +11,7 @@ import {
11
11
  } from 'shared-utils/date-utils'
12
12
  import { html, nothing, PropertyValues, TemplateResult } from 'lit'
13
13
  import { PktElement } from '@/base-elements/element'
14
+ import type { IPktStringsProps } from 'shared-strings'
14
15
  import converters from '../../helpers/converters'
15
16
  import specs from 'componentSpecs/calendar.json'
16
17
  import '@/components/icon'
@@ -54,7 +55,7 @@ type TDayViewData = {
54
55
  tabindex: string
55
56
  }
56
57
 
57
- export class PktCalendar extends PktElement {
58
+ export class PktCalendar extends PktElement<IPktStringsProps<'dates' | 'calendar'>> {
58
59
  // Selection properties
59
60
  @property({ converter: converters.csvToArray })
60
61
  selected: string | string[] = []
@@ -6,6 +6,7 @@ import { isMaxSelectionReached } from 'shared-utils/combobox/option-utils'
6
6
  import specs from 'componentSpecs/combobox.json'
7
7
 
8
8
  import type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types'
9
+ import type { IPktStringsProps } from 'shared-strings'
9
10
  import PktListbox from '../listbox'
10
11
  import type { TComboboxMessageKey } from 'shared-utils/combobox'
11
12
 
@@ -13,7 +14,7 @@ import type { TComboboxMessageKey } from 'shared-utils/combobox'
13
14
  * Base class for PktCombobox.
14
15
  * Declares all reactive properties, state, refs, and simple helpers.
15
16
  */
16
- export class ComboboxBase extends PktInputElement {
17
+ export class ComboboxBase extends PktInputElement<IPktStringsProps<'combobox' | 'listbox'>> {
17
18
  constructor() {
18
19
  super()
19
20
  this.optionsController = new PktOptionsSlotController(this)
@@ -15,6 +15,7 @@ import { getSingleValueForInput } from 'shared-utils/combobox/input-utils'
15
15
  import { slotUtils, optionStateUtils } from './combobox-utils'
16
16
  import { slotContent } from '@/directives/slot-content'
17
17
  import { ComboboxHandlers } from './combobox-handlers'
18
+ import type { IPktStringsProps } from 'shared-strings'
18
19
 
19
20
  import '../input-wrapper'
20
21
  import '../icon'
@@ -24,7 +25,7 @@ import '../listbox'
24
25
  // Re-export types for backward compatibility
25
26
  export type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types'
26
27
 
27
- export interface IPktCombobox {
28
+ export interface IPktCombobox extends IPktStringsProps<'combobox' | 'listbox'> {
28
29
  allowUserInput?: boolean
29
30
  typeahead?: boolean
30
31
  disabled?: boolean
@@ -8,6 +8,7 @@ import '@/components/tag'
8
8
  import { fromISOtoLocal } from 'shared-utils/date-utils'
9
9
  import { uuidish } from 'shared-utils/utils'
10
10
  import { sortDateStrings } from 'shared-utils/date-utils'
11
+ import type { IPktStringsProps } from 'shared-strings'
11
12
 
12
13
  type TYear = `${number}${number}${number}${number}`
13
14
  type TMonth = `${number}${number}`
@@ -22,7 +23,7 @@ export type TISODate = `${TYear}-${TMonth}-${TDay}`
22
23
  * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
23
24
  */
24
25
 
25
- export class PktDateTags extends PktElement {
26
+ export class PktDateTags extends PktElement<IPktStringsProps<'datepicker'>> {
26
27
  @property({ type: Array }) dates: TISODate[] = []
27
28
  @property({ type: String }) dateformat: string = 'dd.MM.yyyy' // se kommentar over
28
29
  @property({ type: String, attribute: 'class' }) className: string = 'pkt-datepicker__tags'
@@ -31,6 +31,7 @@ import { PktDatepickerSingle } from './datepicker-single'
31
31
  import { PktDatepickerRange } from './datepicker-range'
32
32
  import { PktDatepickerMultiple } from './datepicker-multiple'
33
33
  import { ElementProps } from '@/types/typeUtils'
34
+ import type { IPktStringsProps } from 'shared-strings'
34
35
 
35
36
  type Props = ElementProps<
36
37
  PktDatepicker,
@@ -49,7 +50,8 @@ type Props = ElementProps<
49
50
  | 'currentmonth'
50
51
  | 'calendarOpen'
51
52
  | 'timezone'
52
- >
53
+ > &
54
+ IPktStringsProps<'generic' | 'datepicker' | 'dates' | 'calendar'>
53
55
 
54
56
  export class PktDatepicker extends PktInputElement<Props> {
55
57
  /**
@@ -16,6 +16,7 @@ import type {
16
16
  THeaderMenuLocale,
17
17
  IPktHeaderGlobal as ISharedPktHeaderGlobal,
18
18
  } from 'shared-types'
19
+ import type { IPktStringsProps } from 'shared-strings'
19
20
 
20
21
  export type {
21
22
  Booleanish,
@@ -51,7 +52,7 @@ export const convertUserMenuItem = (item: UserMenuItem): TInternalMenuItem => {
51
52
  /**
52
53
  * Interface for the Header component props
53
54
  */
54
- export interface IPktHeader {
55
+ export interface IPktHeader extends IPktStringsProps<'header'> {
55
56
  /** Hide the Oslo logo */
56
57
  hideLogo?: Booleanish
57
58
  /** Logo link URL */
@@ -110,9 +111,10 @@ export interface IPktHeader {
110
111
  */
111
112
  export interface IPktHeaderGlobal
112
113
  extends Omit<
113
- ISharedPktHeaderGlobal,
114
- 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu'
115
- > {
114
+ ISharedPktHeaderGlobal,
115
+ 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu'
116
+ >,
117
+ IPktStringsProps<'header'> {
116
118
  /** Show the search field. Default: true */
117
119
  showSearch?: Booleanish
118
120
  /** Show the contact link (from the payload's `header.contact`). Default: true */
@@ -4,10 +4,11 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js'
4
4
  import { classMap } from 'lit/directives/class-map.js'
5
5
  import { customElement, property, state } from 'lit/decorators.js'
6
6
  import { uuidish } from 'shared-utils/utils'
7
+ import type { IPktStringsProps } from 'shared-strings'
7
8
  import '@/components/icon'
8
9
  import { slotContent } from '@/directives/slot-content'
9
10
 
10
- export class PktHelptext extends PktElementWithSlot {
11
+ export class PktHelptext extends PktElementWithSlot<IPktStringsProps<'forms'>> {
11
12
  @property({ type: String, reflect: true })
12
13
  forId: string = uuidish()
13
14
 
@@ -1,7 +1,7 @@
1
1
  import { PktElementWithSlot } from '@/base-elements/element-with-slot'
2
2
  import { slotContent } from '@/directives/slot-content'
3
3
  import { counterStatusId, isCounterExceeded } from 'shared-utils/forms/described-by'
4
- import { formatString } from 'shared-strings'
4
+ import { formatString, type IPktStringsProps } from 'shared-strings'
5
5
  import { ifDefined } from 'lit/directives/if-defined.js'
6
6
  import { html, nothing, PropertyValues } from 'lit'
7
7
  import { unsafeHTML } from 'lit/directives/unsafe-html.js'
@@ -40,7 +40,8 @@ type Props = ElementProps<
40
40
  | 'hasFieldset'
41
41
  | 'useWrapper'
42
42
  | 'role'
43
- >
43
+ > &
44
+ IPktStringsProps<'forms' | 'validation'>
44
45
 
45
46
  export class PktInputWrapper extends PktElementWithSlot<Props> {
46
47
  /**
@@ -5,6 +5,7 @@ import { PktElement } from '@/base-elements/element'
5
5
  import { repeat } from 'lit/directives/repeat.js'
6
6
  import { classMap } from 'lit/directives/class-map.js'
7
7
  import type { IPktComboboxOption } from 'shared-types/combobox'
8
+ import type { IPktStringsProps } from 'shared-strings'
8
9
  import { uuidish } from 'shared-utils/utils'
9
10
  import { filterOptionsBySearch } from 'shared-utils/combobox/option-utils'
10
11
  import {
@@ -28,7 +29,7 @@ declare global {
28
29
  }
29
30
  }
30
31
 
31
- export interface IPktListbox {
32
+ export interface IPktListbox extends IPktStringsProps<'listbox'> {
32
33
  options: IPktComboboxOption[]
33
34
  isOpen: boolean
34
35
  disabled: boolean
@@ -43,7 +44,7 @@ export interface IPktListbox {
43
44
  userMessage: string | null
44
45
  }
45
46
 
46
- export class PktListbox extends PktElement implements IPktListbox {
47
+ export class PktListbox extends PktElement<IPktListbox> implements IPktListbox {
47
48
  @property({ type: String }) id: string = uuidish()
48
49
  @property({ type: String }) label: string | null = null
49
50
  @property({ type: Array }) options: IPktComboboxOption[] = []
@@ -10,7 +10,7 @@ import '@/components/icon'
10
10
  import type { IAriaAttributes, THTMLButtonType } from 'shared-types'
11
11
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
12
12
  import { ifDefined } from 'lit/directives/if-defined.js'
13
- import { formatString } from 'shared-strings'
13
+ import { formatString, type IPktStringsProps } from 'shared-strings'
14
14
 
15
15
  export type TTagSkin =
16
16
  | 'blue'
@@ -24,7 +24,7 @@ export type TTagSkin =
24
24
  | 'grey'
25
25
  export type TTagType = THTMLButtonType
26
26
 
27
- export interface IPktTag {
27
+ export interface IPktTag extends IPktStringsProps<'tag'> {
28
28
  closeTag?: boolean
29
29
  size?: TPktSize
30
30
  skin?: TTagSkin
@@ -6,7 +6,7 @@ import { classMap } from 'lit/directives/class-map.js'
6
6
  import { PktInputElement } from '@/base-elements/input-element'
7
7
  import { slotContent } from '@/directives/slot-content'
8
8
  import { ElementProps } from '@/types/typeUtils'
9
- import { formatString } from 'shared-strings'
9
+ import { formatString, type IPktStringsProps } from 'shared-strings'
10
10
  import { isValidTimeString, timeToMinutes } from 'shared-utils/timepicker/time-utils'
11
11
  import { getMinuteStep, getHourOptions, getMinuteOptions } from 'shared-utils/timepicker/options'
12
12
  import { stepTime } from 'shared-utils/timepicker/stepper'
@@ -14,7 +14,8 @@ import '@/components/icon'
14
14
  import '@/components/input-wrapper'
15
15
  import { TPktInputSize } from 'shared-types/size'
16
16
 
17
- type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'>
17
+ type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'> &
18
+ IPktStringsProps<'timepicker'>
18
19
 
19
20
  export interface IPktTimepicker {
20
21
  value?: string