@oslokommune/punkt-elements 19.12.2 → 19.13.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.
- package/CHANGELOG.md +8 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/select.d.ts +9 -3
- package/dist/components/select/select.test.d.ts +2 -1
- package/dist/shared-types/index.d.ts +2 -1
- package/dist/shared-types/select.d.ts +57 -0
- package/package.json +2 -2
- package/src/components/index.ts +1 -1
- package/src/components/select/index.ts +1 -0
- package/src/components/select/select.test.ts +2 -1
- package/src/components/select/select.ts +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [19.13.0](https://github.com/oslokommune/punkt/compare/19.12.3...19.13.0) (2026-10-14)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
* typesikre select (#3727).
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
|
|
8
16
|
## [19.12.2](https://github.com/oslokommune/punkt/compare/19.12.1...19.12.2) (2026-10-13)
|
|
9
17
|
|
|
10
18
|
### Bug Fixes
|
|
@@ -45,7 +45,7 @@ export type { IPktCombobox, IPktComboboxAttributes, IPktComboboxOption, TPktComb
|
|
|
45
45
|
export type { IPktHeading, TPktHeadingSize, TPktHeadingLevel } from './heading';
|
|
46
46
|
export type { TTagSkin, TTagType } from './tag';
|
|
47
47
|
export type { IPktTabs, IPktTabItem, TSkin as TTabItemSkin } from './tabs';
|
|
48
|
-
export type { IPktSelectOption, TSelectOption } from './select';
|
|
48
|
+
export type { IPktSelect, IPktSelectOption, TSelectOption } from './select';
|
|
49
49
|
export type { IPktBackLink } from './backlink';
|
|
50
50
|
export type { IPktBreadcrumbs, IBreadcrumb, IBreadcrumbItem } from './breadcrumbs';
|
|
51
51
|
export type { IPktLoader, TPktLoaderVariant } from './loader';
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { Ref } from 'lit/directives/ref.js';
|
|
3
3
|
import { PktOptionsInputElement } from '../../base-elements/options-input-element';
|
|
4
|
-
import { TSelectOption } from '../../shared-types/select';
|
|
4
|
+
import { IPktSelectBase, TSelectOption } from '../../shared-types/select';
|
|
5
|
+
import { Booleanish } from '../../shared-types';
|
|
5
6
|
export type { TSelectOption } from '../../shared-types/select';
|
|
6
|
-
export interface IPktSelect {
|
|
7
|
+
export interface IPktSelect extends Omit<IPktSelectBase, 'form' | 'label' | 'ariaDescribedby' | 'ariaLabelledby' | 'helptextDropdownButton' | 'useWrapper'> {
|
|
7
8
|
options: TSelectOption[];
|
|
8
|
-
|
|
9
|
+
label?: string | null;
|
|
10
|
+
ariaDescribedby?: string | null;
|
|
11
|
+
ariaLabelledby?: string | null;
|
|
12
|
+
/** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
|
|
13
|
+
helptextDropdownButton?: string | null;
|
|
14
|
+
useWrapper?: Booleanish;
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
2
|
import { IPktSelect } from './select';
|
|
3
|
+
import { Booleanish } from '../../shared-types';
|
|
3
4
|
export interface SelectTestConfig extends Partial<IPktSelect>, BaseTestConfig {
|
|
4
5
|
id?: string;
|
|
5
6
|
label?: string;
|
|
@@ -13,7 +14,7 @@ export interface SelectTestConfig extends Partial<IPktSelect>, BaseTestConfig {
|
|
|
13
14
|
'aria-describedby'?: string | null;
|
|
14
15
|
counter?: boolean;
|
|
15
16
|
inline?: boolean;
|
|
16
|
-
useWrapper?:
|
|
17
|
+
useWrapper?: Booleanish;
|
|
17
18
|
'input-size'?: string;
|
|
18
19
|
}
|
|
19
20
|
export declare const createSelectTest: (config?: SelectTestConfig) => Promise<{
|
|
@@ -50,7 +50,8 @@ export { defaultTimepickerStrings } from './timepicker';
|
|
|
50
50
|
export type { TProgressbarRole, TProgressbarSkin, TProgressbarStatusPlacement, TProgressbarStatusType, TProgressbarTitlePosition, } from './progressbar';
|
|
51
51
|
export { COMBOBOX_TAG_SKINS, COMBOBOX_DISPLAY_VALUES, COMBOBOX_TAG_PLACEMENTS, COMBOBOX_DEFAULTS, } from './combobox';
|
|
52
52
|
export type { IPktComboboxOption, TPktComboboxTagSkin, TPktComboboxDisplayValue, TPktComboboxTagPlacement, IPktComboboxBase, IComboboxSpecProps, } from './combobox';
|
|
53
|
-
export
|
|
53
|
+
export { SELECT_DEFAULTS } from './select';
|
|
54
|
+
export type { IPktSelectOption, TSelectOption, IPktSelectBase, ISelectSpecProps } from './select';
|
|
54
55
|
export type { TPktSearchInputAppearance, TPktSearchInputMethod, IPktSearchInputSuggestion, IPktSearchInput, } from './searchinput';
|
|
55
56
|
export { UPLOAD_STRATEGIES, FILE_UPLOAD_ITEM_RENDERERS, PREVIEW_UPLOAD_STATUS } from './fileupload';
|
|
56
57
|
export type { TUploadStrategy as TFileUploadStrategy, TFileUploadItemRenderer, TPreviewUploadStatus, TFilesChangedReason, TFileValidator, TTransferProgress, IFileItem, IFileTransfer, IFileValidateDetail, ITransferCancelledDetail, IFilesChangedDetail, IFileUploadSpecProps, IPktFileUploadBase, } from './fileupload';
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* select.ts
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for pkt-select.
|
|
5
|
+
* Used by React, Elements, and typed component specs.
|
|
6
|
+
*/
|
|
7
|
+
import type { IPktStringsProps } from '../shared-strings';
|
|
8
|
+
import type { IFormFieldErrorProps, IFormFieldLabelProps, IHelptextProps, ITagOptionalRequiredProps } from './form-field';
|
|
9
|
+
import type { TPktInputSize } from './size';
|
|
1
10
|
/**
|
|
2
11
|
* Shape of a single option in a `<pkt-select>` / `<PktSelect>` component.
|
|
3
12
|
* Lives in shared-types so both `@oslokommune/punkt-elements` and
|
|
@@ -11,3 +20,51 @@ export interface IPktSelectOption {
|
|
|
11
20
|
hidden?: boolean;
|
|
12
21
|
}
|
|
13
22
|
export type TSelectOption = IPktSelectOption;
|
|
23
|
+
/**
|
|
24
|
+
* Select props shared by React, Elements, and typed component specs.
|
|
25
|
+
*
|
|
26
|
+
* @remarks React requires `id` and `label`, widens `helptext`, `helptextDropdown` and
|
|
27
|
+
* `errorMessage` to `ReactNode`, keeps the native `<select>` type for `value` (string, number
|
|
28
|
+
* or string array) and omits `options`. Elements widens `label`, `ariaDescribedby`, `ariaLabelledby`
|
|
29
|
+
* and `helptextDropdownButton` to `| null` (Lit uses `null` for an unset attribute),
|
|
30
|
+
* `useWrapper` to `Booleanish`, and omits `form`, which is a getter returning the associated
|
|
31
|
+
* `HTMLFormElement`, not the form id.
|
|
32
|
+
*
|
|
33
|
+
* `hasFieldset` is tri-state: `null` means the component derives the value (always `false`
|
|
34
|
+
* for select).
|
|
35
|
+
*/
|
|
36
|
+
export interface IPktSelectBase extends IFormFieldLabelProps, IHelptextProps, IFormFieldErrorProps, ITagOptionalRequiredProps, IPktStringsProps<'forms' | 'validation'> {
|
|
37
|
+
id?: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
form?: string;
|
|
40
|
+
value?: string;
|
|
41
|
+
options?: IPktSelectOption[];
|
|
42
|
+
required?: boolean;
|
|
43
|
+
ariaDescribedby?: string;
|
|
44
|
+
ariaLabelledby?: string;
|
|
45
|
+
inline?: boolean;
|
|
46
|
+
fullwidth?: boolean;
|
|
47
|
+
useWrapper?: boolean;
|
|
48
|
+
hasFieldset?: boolean | null;
|
|
49
|
+
inputSize?: TPktInputSize;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Documented Select props (subset of `IPktSelectBase`).
|
|
53
|
+
* Used for typed component specs in documentation.
|
|
54
|
+
*/
|
|
55
|
+
export type ISelectSpecProps = Pick<IPktSelectBase, 'label' | 'required' | 'requiredTag' | 'requiredText' | 'optionalTag' | 'optionalText' | 'tagText' | 'hasError' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'name' | 'form' | 'id' | 'value' | 'options' | 'disabled' | 'inline' | 'useWrapper' | 'fullwidth' | 'ariaDescribedby' | 'ariaLabelledby' | 'inputSize' | 'hasFieldset'>;
|
|
56
|
+
/**
|
|
57
|
+
* Default values for pkt-select. Single source of truth for both frameworks.
|
|
58
|
+
* `hasFieldset` is intentionally absent — `null` lets the component derive it.
|
|
59
|
+
*/
|
|
60
|
+
export declare const SELECT_DEFAULTS: {
|
|
61
|
+
readonly disabled: false;
|
|
62
|
+
readonly required: false;
|
|
63
|
+
readonly hasError: false;
|
|
64
|
+
readonly requiredTag: false;
|
|
65
|
+
readonly optionalTag: false;
|
|
66
|
+
readonly inline: false;
|
|
67
|
+
readonly fullwidth: false;
|
|
68
|
+
readonly useWrapper: true;
|
|
69
|
+
readonly inputSize: 'medium';
|
|
70
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.13.0",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, designsystem for Oslo kommune",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo kommune",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"engines": {
|
|
85
85
|
"node": "^22.19.0 || ^24.0.0 || ^26.0.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "d8c349f200dd685cc1911a6baf5ce43012cee404"
|
|
88
88
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -95,7 +95,7 @@ export type { TTagSkin, TTagType } from '@/components/tag'
|
|
|
95
95
|
|
|
96
96
|
export type { IPktTabs, IPktTabItem, TSkin as TTabItemSkin } from '@/components/tabs'
|
|
97
97
|
|
|
98
|
-
export type { IPktSelectOption, TSelectOption } from '@/components/select'
|
|
98
|
+
export type { IPktSelect, IPktSelectOption, TSelectOption } from '@/components/select'
|
|
99
99
|
|
|
100
100
|
export type { IPktBackLink } from '@/components/backlink'
|
|
101
101
|
|
|
@@ -4,6 +4,7 @@ import { vi } from 'vitest'
|
|
|
4
4
|
import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
|
|
5
5
|
import { CustomElementFor } from '../../tests/component-registry'
|
|
6
6
|
import { type IPktSelect, type TSelectOption } from './select'
|
|
7
|
+
import type { Booleanish } from 'shared-types'
|
|
7
8
|
import './select'
|
|
8
9
|
import { PktInputWrapper } from '@/components/input-wrapper/input-wrapper'
|
|
9
10
|
|
|
@@ -20,7 +21,7 @@ export interface SelectTestConfig extends Partial<IPktSelect>, BaseTestConfig {
|
|
|
20
21
|
'aria-describedby'?: string | null
|
|
21
22
|
counter?: boolean
|
|
22
23
|
inline?: boolean
|
|
23
|
-
useWrapper?:
|
|
24
|
+
useWrapper?: Booleanish
|
|
24
25
|
'input-size'?: string
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -5,15 +5,24 @@ import { ifDefined } from 'lit/directives/if-defined.js'
|
|
|
5
5
|
import { PktOptionsInputElement } from '@/base-elements/options-input-element'
|
|
6
6
|
import { PktOptionsSlotController } from '@/controllers/pkt-options-controller'
|
|
7
7
|
import { forwardSlots } from '@/directives/slot-content'
|
|
8
|
-
import type { TSelectOption } from 'shared-types/select'
|
|
8
|
+
import type { IPktSelectBase, TSelectOption } from 'shared-types/select'
|
|
9
|
+
import type { Booleanish } from 'shared-types'
|
|
9
10
|
import '@/components/input-wrapper'
|
|
10
11
|
import { describedByIds } from 'shared-utils/forms/described-by'
|
|
11
12
|
|
|
12
13
|
export type { TSelectOption } from 'shared-types/select'
|
|
13
14
|
|
|
14
|
-
export interface IPktSelect
|
|
15
|
+
export interface IPktSelect extends Omit<
|
|
16
|
+
IPktSelectBase,
|
|
17
|
+
'form' | 'label' | 'ariaDescribedby' | 'ariaLabelledby' | 'helptextDropdownButton' | 'useWrapper'
|
|
18
|
+
> {
|
|
15
19
|
options: TSelectOption[]
|
|
16
|
-
|
|
20
|
+
label?: string | null
|
|
21
|
+
ariaDescribedby?: string | null
|
|
22
|
+
ariaLabelledby?: string | null
|
|
23
|
+
/** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
|
|
24
|
+
helptextDropdownButton?: string | null
|
|
25
|
+
useWrapper?: Booleanish
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
/**
|