@cscfi/csc-ui 4.0.0-rc.4 → 4.0.0-rc.5
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/dist/csc-ui.js +12582 -11967
- package/dist/custom-elements.json +127 -23
- package/dist/docs/c-button/usage.md +60 -6
- package/dist/docs/c-color-picker/usage.md +2 -1
- package/dist/docs/c-date-picker/usage.md +2 -1
- package/dist/docs/c-file-upload/usage.md +3 -3
- package/dist/docs/c-otp-input/usage.md +4 -1
- package/dist/docs/c-radio-group/usage.md +3 -1
- package/dist/docs/c-slider/usage.md +2 -2
- package/dist/docs/c-text-field/usage.md +53 -1
- package/dist/styles/css/tailwind-theme.css +6 -0
- package/dist/styles/css/tokens.css +95 -88
- package/dist/vscode.css-custom-data.json +2 -2
- package/dist/vscode.html-custom-data.json +62 -14
- package/dist/web-types.json +84 -28
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +2 -1
- package/dist-types/components/c-button/CButton.vue.d.ts +3 -1
- package/dist-types/components/c-button/injectButtonStyles.d.ts +1 -0
- package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +8 -0
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +3 -3
- package/dist-types/components/c-color-picker/CColorPicker.vue.d.ts +2 -1
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +2 -1
- package/dist-types/components/c-number-field/CNumberField.vue.d.ts +2 -1
- package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +7 -0
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +8 -0
- package/dist-types/components/c-select/CSelect.vue.d.ts +2 -1
- package/dist-types/components/c-slider/CSlider.vue.d.ts +2 -3
- package/dist-types/components/c-switch/CSwitch.vue.d.ts +8 -0
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +3 -2
- package/dist-types/components/c-text-field/injectTextFieldStyles.d.ts +1 -0
- package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +2 -1
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +1 -1
- package/dist-types/registry.d.ts +7 -0
- package/dist-types/shared/defineElement.d.ts +5 -1
- package/dist-types/shared/implicitSubmission.d.ts +31 -0
- package/dist-types/shared/useElementInternals.d.ts +7 -0
- package/dist-types/shared/useFormAssociation.d.ts +88 -0
- package/dist-types/shared/useHostStates.d.ts +5 -4
- package/dist-types/shared/useTypedField.d.ts +7 -0
- package/dist-types/shared/valueEvents.d.ts +6 -0
- package/dist-types/tag-name-map.d.ts +50 -21
- package/package.json +3 -2
|
@@ -41,6 +41,12 @@ interface COtpInputProps {
|
|
|
41
41
|
* Number of digits in the code, one box each
|
|
42
42
|
*/
|
|
43
43
|
length?: number;
|
|
44
|
+
/**
|
|
45
|
+
* The name the code submits under in a native `<form>`, as typed so far
|
|
46
|
+
*
|
|
47
|
+
* @freeform
|
|
48
|
+
*/
|
|
49
|
+
name?: string;
|
|
44
50
|
/**
|
|
45
51
|
* Set as required — shows the required marker on the label
|
|
46
52
|
*/
|
|
@@ -63,6 +69,7 @@ declare const __VLS_base: import("vue").DefineComponent<COtpInputProps, {
|
|
|
63
69
|
label: string;
|
|
64
70
|
invalid: boolean;
|
|
65
71
|
length: number;
|
|
72
|
+
name: string;
|
|
66
73
|
value: string;
|
|
67
74
|
hideDetails: boolean;
|
|
68
75
|
hideMessage: boolean;
|
|
@@ -41,6 +41,13 @@ interface CRadioGroupProps {
|
|
|
41
41
|
* @freeform
|
|
42
42
|
*/
|
|
43
43
|
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The name the picked radio's value submits under in a native `<form>`;
|
|
46
|
+
* nothing submits while no radio is picked
|
|
47
|
+
*
|
|
48
|
+
* @freeform
|
|
49
|
+
*/
|
|
50
|
+
name?: string;
|
|
44
51
|
/**
|
|
45
52
|
* Set as required
|
|
46
53
|
*/
|
|
@@ -62,6 +69,7 @@ declare const __VLS_base: import("vue").DefineComponent<CRadioGroupProps, {
|
|
|
62
69
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CRadioGroupProps> & Readonly<{}>, {
|
|
63
70
|
label: string;
|
|
64
71
|
invalid: boolean;
|
|
72
|
+
name: string;
|
|
65
73
|
value: null | string;
|
|
66
74
|
inline: boolean;
|
|
67
75
|
hideDetails: boolean;
|
|
@@ -26,8 +26,7 @@ interface CSliderProps {
|
|
|
26
26
|
/** The smallest value. */
|
|
27
27
|
min?: number;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
* form-associated, so it does not submit with a `<form>`.
|
|
29
|
+
* The name the value submits under in a native `<form>`
|
|
31
30
|
*
|
|
32
31
|
* @freeform
|
|
33
32
|
*/
|
|
@@ -62,8 +61,8 @@ declare const __VLS_export: import("vue").DefineComponent<CSliderProps, {
|
|
|
62
61
|
disabled: boolean;
|
|
63
62
|
max: number;
|
|
64
63
|
min: number;
|
|
65
|
-
disableTooltip: boolean;
|
|
66
64
|
labels: boolean;
|
|
65
|
+
disableTooltip: boolean;
|
|
67
66
|
segments: number;
|
|
68
67
|
tickLabels: boolean;
|
|
69
68
|
ticks: boolean;
|
|
@@ -26,6 +26,13 @@ interface CSwitchProps {
|
|
|
26
26
|
* saved. The switch ignores toggles meanwhile and is announced as busy
|
|
27
27
|
*/
|
|
28
28
|
loading?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The name the switch submits under in a native `<form>` while it is on:
|
|
31
|
+
* its `true-value`, or `on` when that is `true`
|
|
32
|
+
*
|
|
33
|
+
* @freeform
|
|
34
|
+
*/
|
|
35
|
+
name?: string;
|
|
29
36
|
/**
|
|
30
37
|
* Set as required — shows the required marker on the label
|
|
31
38
|
*/
|
|
@@ -49,6 +56,7 @@ declare const __VLS_base: import("vue").DefineComponent<CSwitchProps, {
|
|
|
49
56
|
focus: (options?: FocusOptions) => void;
|
|
50
57
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CSwitchProps> & Readonly<{}>, {
|
|
51
58
|
label: string;
|
|
59
|
+
name: string;
|
|
52
60
|
value: string | number | boolean;
|
|
53
61
|
disabled: boolean;
|
|
54
62
|
loading: boolean;
|
|
@@ -97,8 +97,7 @@ interface CTextFieldProps {
|
|
|
97
97
|
*/
|
|
98
98
|
min?: null | number;
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
101
|
-
* does not submit with a `<form>`.
|
|
100
|
+
* The name the text submits under in a native `<form>`
|
|
102
101
|
*
|
|
103
102
|
* @freeform
|
|
104
103
|
*/
|
|
@@ -194,6 +193,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTextF
|
|
|
194
193
|
trimWhitespace: boolean;
|
|
195
194
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
196
195
|
pre?: (props: {}) => any;
|
|
196
|
+
} & {
|
|
197
|
+
default?: (props: {}) => any;
|
|
197
198
|
} & {
|
|
198
199
|
post?: (props: {}) => any;
|
|
199
200
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ensureTextFieldStyles: () => void;
|
|
@@ -131,7 +131,8 @@ interface CTimePickerProps {
|
|
|
131
131
|
*/
|
|
132
132
|
minuteStep?: number;
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
134
|
+
* The name the time submits under in a native `<form>`, as its ISO text;
|
|
135
|
+
* a `range` as one ISO 8601 interval, `start/end`
|
|
135
136
|
*
|
|
136
137
|
* @freeform
|
|
137
138
|
*/
|
package/dist-types/registry.d.ts
CHANGED
|
@@ -5,5 +5,12 @@
|
|
|
5
5
|
* conformance suites enrol every tag from it.
|
|
6
6
|
*/
|
|
7
7
|
export declare const components: ReadonlyArray<readonly [string, unknown]>;
|
|
8
|
+
/**
|
|
9
|
+
* The tags whose elements take part in a native `<form>` (ADR-0084): every
|
|
10
|
+
* value control that is a form field — not c-file-upload, whose upload
|
|
11
|
+
* function carries its files, nor c-tabs, c-accordion, c-modal and
|
|
12
|
+
* c-pagination — and the buttons, without a value.
|
|
13
|
+
*/
|
|
14
|
+
export declare const formAssociatedTags: ReadonlySet<string>;
|
|
8
15
|
/** Every tag `defineCustomElements()` registers, internal ones included. */
|
|
9
16
|
export declare const registeredTags: ReadonlyArray<string>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type Component } from 'vue';
|
|
2
2
|
export declare const hyphenate: (key: string) => string;
|
|
3
|
+
export interface DefineElementOptions {
|
|
4
|
+
/** Take part in a native `<form>` (ADR-0084). */
|
|
5
|
+
formAssociated?: boolean;
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* Register a Vue SFC as a custom element under `tag`, with the shared Tailwind
|
|
5
9
|
* utility stylesheet applied to its shadow root alongside the SFC's own styles.
|
|
@@ -18,4 +22,4 @@ export declare const hyphenate: (key: string) => string;
|
|
|
18
22
|
* No-op if `tag` is already defined — the docs may have registered the Stencil
|
|
19
23
|
* version first, or this function may be called twice.
|
|
20
24
|
*/
|
|
21
|
-
export declare function defineElement(tag: string, component: Component): void;
|
|
25
|
+
export declare function defineElement(tag: string, component: Component, { formAssociated }?: DefineElementOptions): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implicit submission (ADR-0084): Enter in a single-line text field submits
|
|
3
|
+
* its form, by the browser's rule — with `<c-button type="submit">` counted as
|
|
4
|
+
* a submit button, which the browser's own rule cannot see (its native button
|
|
5
|
+
* lives in a shadow root), and the csc-ui text fields counted as the fields
|
|
6
|
+
* that block a form without a button from submitting.
|
|
7
|
+
*
|
|
8
|
+
* The browser does none of this for a field whose input lives in a shadow
|
|
9
|
+
* root, so each text-entry field calls `submitOnEnter` from its own keydown.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Submit `form` as Enter in one of its text fields would: click its first
|
|
13
|
+
* submit button — through the button, so a disabled or loading one does
|
|
14
|
+
* nothing — or, without one, submit when it has only one text field.
|
|
15
|
+
*/
|
|
16
|
+
export declare const submitImplicitly: (form: HTMLFormElement) => void;
|
|
17
|
+
/**
|
|
18
|
+
* A text field's keydown: a plain Enter submits `form` once the event has
|
|
19
|
+
* finished dispatching, unless the page cancelled it, as the browser's own
|
|
20
|
+
* implicit submission is the keydown's default action.
|
|
21
|
+
*/
|
|
22
|
+
export declare const submitOnEnter: (event: KeyboardEvent, form: HTMLFormElement | null) => void;
|
|
23
|
+
/**
|
|
24
|
+
* The keydown of a page's own input inside a csc-ui field (c-text-field's
|
|
25
|
+
* slotted input, ADR-0083): the browser runs its own implicit submission
|
|
26
|
+
* there, blind to `<c-button type="submit">`, so a plain Enter that the page
|
|
27
|
+
* has not cancelled by the end of its dispatch is cancelled here and
|
|
28
|
+
* submitted by this rule instead. A listener that stops the event first
|
|
29
|
+
* leaves the browser's own submission in place.
|
|
30
|
+
*/
|
|
31
|
+
export declare const submitOnEnterInstead: (event: KeyboardEvent, form: HTMLFormElement | null) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single path to the host's internals — custom states (`useHostStates`,
|
|
3
|
+
* ADR-0035) and form association (`useFormAssociation`, ADR-0084) both go
|
|
4
|
+
* through it. `null` where internals are unavailable (SSR, an ancient
|
|
5
|
+
* browser): callers degrade to a silent no-op.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useElementInternals: () => ElementInternals | null;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Form association (ADR-0084): a value control takes part in a native
|
|
4
|
+
* `<form>` the way a built-in control does — its value submits under its
|
|
5
|
+
* `name`, `form.reset()` returns it to its authored default, a disabled
|
|
6
|
+
* `<fieldset>` disables it, and a validating form checks it.
|
|
7
|
+
*
|
|
8
|
+
* The element class is form-associated (`defineElement`'s `formAssociated`);
|
|
9
|
+
* the browser calls its form callbacks, which land here through
|
|
10
|
+
* `formCallbacks`. Everything degrades to a silent no-op where the element is
|
|
11
|
+
* not form-associated or internals are unavailable (SSR).
|
|
12
|
+
*/
|
|
13
|
+
/** The `value` and `checked` attributes as authored, before any upgrade. */
|
|
14
|
+
export interface AuthoredDefaults {
|
|
15
|
+
checked: boolean;
|
|
16
|
+
value: null | string;
|
|
17
|
+
}
|
|
18
|
+
export interface FormAssociation {
|
|
19
|
+
/** The form owner, or `null`. */
|
|
20
|
+
form(): HTMLFormElement | null;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the element is disabled from outside: a disabled `<fieldset>`
|
|
23
|
+
* around it, or a `disabled` attribute on the host.
|
|
24
|
+
*/
|
|
25
|
+
formDisabled: Readonly<Ref<boolean>>;
|
|
26
|
+
}
|
|
27
|
+
export interface FormAssociationOptions {
|
|
28
|
+
/** The entry name; nothing submits without one. */
|
|
29
|
+
name(): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Return the control to `authored` on `form.reset()`, through the model
|
|
32
|
+
* path (`emitModelInput`), so a bound model follows (ADR-0084).
|
|
33
|
+
*/
|
|
34
|
+
reset(authored: AuthoredDefaults): void;
|
|
35
|
+
/** The failed check now, or `null` when the control passes. */
|
|
36
|
+
validity?(): FormValidity | null;
|
|
37
|
+
/** The entry value now; read only while the control has a name. */
|
|
38
|
+
value(): FormEntryValue;
|
|
39
|
+
}
|
|
40
|
+
/** What a control submits: one entry, one per value, or nothing. */
|
|
41
|
+
export type FormEntryValue = null | readonly string[] | string;
|
|
42
|
+
/** A failed check: the flags, the bubble's text and the control it points at. */
|
|
43
|
+
export interface FormValidity {
|
|
44
|
+
anchor?: HTMLElement | null;
|
|
45
|
+
flags: ValidityStateFlags;
|
|
46
|
+
message: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The browser's form callbacks, as `defineElement` forwards them, and the
|
|
50
|
+
* authored-default capture it runs on connect.
|
|
51
|
+
*/
|
|
52
|
+
export declare const formCallbacks: {
|
|
53
|
+
/**
|
|
54
|
+
* Keep the authored `value` and `checked` before the element first
|
|
55
|
+
* upgrades: Vue's custom element writes every string, number or `true` prop
|
|
56
|
+
* back to its attribute (`_setProp`), so after that the attribute follows
|
|
57
|
+
* the value and no longer says what the markup — or a server render — set.
|
|
58
|
+
* A value bound as a property is not an attribute yet at this point.
|
|
59
|
+
*/
|
|
60
|
+
captureAuthored(host: HTMLElement): void;
|
|
61
|
+
disabled(host: HTMLElement, on: boolean): void;
|
|
62
|
+
reset(host: HTMLElement): void;
|
|
63
|
+
};
|
|
64
|
+
/** A constraint as a detached native control would hold it. */
|
|
65
|
+
export type NativeConstraint = 'select' | Partial<Pick<HTMLInputElement, 'max' | 'min' | 'name' | 'pattern' | 'required' | 'type' | 'value'>>;
|
|
66
|
+
/**
|
|
67
|
+
* The browser's own wording for a failed check, in its UI language, read off
|
|
68
|
+
* a detached native control holding the same constraint — so a csc-ui field's
|
|
69
|
+
* bubble reads as a native field's would: `{ required: true }` for a missing
|
|
70
|
+
* value, `{ pattern: 'a', value: 'b' }` for a format, `{ type: 'number', min:
|
|
71
|
+
* '5', value: '3' }` for a range, `'select'` for a list.
|
|
72
|
+
*/
|
|
73
|
+
export declare const nativeMessage: (constraint: NativeConstraint) => string;
|
|
74
|
+
/** The wording of a malformed value: a mask, a code, an unreadable date. */
|
|
75
|
+
export declare const formatMessage: () => string;
|
|
76
|
+
/**
|
|
77
|
+
* A native control's own failed check — `required`, a `type="email"`, `min` /
|
|
78
|
+
* `max` / `step` — as the host reports it, pointing at that control. `null`
|
|
79
|
+
* while it passes.
|
|
80
|
+
*/
|
|
81
|
+
export declare const validityOf: (control: HTMLInputElement | HTMLTextAreaElement | null | undefined) => FormValidity | null;
|
|
82
|
+
/**
|
|
83
|
+
* The form side of a value control. Call once from the component's setup;
|
|
84
|
+
* it hands the form what `value()` returns under `name()`, reports
|
|
85
|
+
* `validity()` (the browser skips a disabled element's), and runs `reset` on
|
|
86
|
+
* a form reset.
|
|
87
|
+
*/
|
|
88
|
+
export declare const useFormAssociation: (options: FormAssociationOptions) => FormAssociation;
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
* Each exposed state name is public API — curated like parts, documented with
|
|
18
18
|
* a `@cssstate` docblock tag so it lands in the manifest.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `states` are unavailable (SSR,
|
|
23
|
-
* still renders and behaves, only the `:state()` selector surface
|
|
20
|
+
* The internals come from `useElementInternals`, which owns the element's one
|
|
21
|
+
* `attachInternals()` call. Everything degrades to a silent no-op where
|
|
22
|
+
* internals or `states` are unavailable (SSR, an ancient browser) — the
|
|
23
|
+
* component still renders and behaves, only the `:state()` selector surface
|
|
24
|
+
* is absent.
|
|
24
25
|
*/
|
|
25
26
|
export declare const useHostStates: () => ((name: string, on: boolean) => void);
|
|
@@ -39,12 +39,16 @@ export interface UseTypedFieldOptions {
|
|
|
39
39
|
codec: TypedFieldCodec;
|
|
40
40
|
/** The custom element host: the model events dispatch from it. */
|
|
41
41
|
host: HTMLElement | null;
|
|
42
|
+
/** Whether the panel is open: Enter in the field then submits no form. */
|
|
43
|
+
isOpen: () => boolean;
|
|
42
44
|
/** The field label (props.label). */
|
|
43
45
|
label: () => string;
|
|
44
46
|
/** Whether the label rests on top of the field (the resolved app default). */
|
|
45
47
|
labelOnTop: Readonly<Ref<boolean>>;
|
|
46
48
|
/** The typing mask derived from `pattern`; without one, typing is free. */
|
|
47
49
|
mask?: Readonly<Ref<MaskSlot[]>>;
|
|
50
|
+
/** The name the value submits under in a native `<form>` (props.name). */
|
|
51
|
+
name: () => string | undefined;
|
|
48
52
|
/** The end inputs' accessible names under `range`. */
|
|
49
53
|
names: () => {
|
|
50
54
|
end: string;
|
|
@@ -60,6 +64,8 @@ export interface UseTypedFieldOptions {
|
|
|
60
64
|
placeholder: () => string;
|
|
61
65
|
/** Whether the field holds a start and an end. */
|
|
62
66
|
range: Readonly<Ref<boolean>>;
|
|
67
|
+
/** Whether the form demands an answer (props.required). */
|
|
68
|
+
required: () => boolean;
|
|
63
69
|
/** What a committed range with its start after its end becomes: swapped, or kept as typed. */
|
|
64
70
|
reversed: 'keep' | 'swap';
|
|
65
71
|
/** The host's `value` prop. */
|
|
@@ -84,6 +90,7 @@ export declare const useTypedField: (options: UseTypedFieldOptions) => {
|
|
|
84
90
|
endText: Ref<string, string>;
|
|
85
91
|
field: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
|
|
86
92
|
focused: Ref<boolean, boolean>;
|
|
93
|
+
formDisabled: Readonly<Ref<boolean, boolean>>;
|
|
87
94
|
hasContent: import("vue").ComputedRef<boolean>;
|
|
88
95
|
hasText: import("vue").ComputedRef<boolean>;
|
|
89
96
|
inputLabel: (end: TypedFieldEnd) => string | undefined;
|
|
@@ -32,6 +32,12 @@ export declare const seedModelValue: (host: HTMLElement | null, value: unknown)
|
|
|
32
32
|
* native range input fires `input` per move and `change` on release.
|
|
33
33
|
*/
|
|
34
34
|
export declare const emitModelInput: (host: HTMLElement | null, value: unknown) => void;
|
|
35
|
+
/**
|
|
36
|
+
* A change a page's own input inside the control reports itself
|
|
37
|
+
* (c-text-field's slotted input, ADR-0083): its native `input` and `change`
|
|
38
|
+
* already bubble through the host, so only `update:value` joins them.
|
|
39
|
+
*/
|
|
40
|
+
export declare const emitModelUpdate: (host: HTMLElement | null, value: unknown) => void;
|
|
35
41
|
/** The `change` that commits what `emitModelInput` reported. */
|
|
36
42
|
export declare const emitModelSettled: (host: HTMLElement | null, value: unknown) => void;
|
|
37
43
|
/**
|
|
@@ -189,7 +189,10 @@ export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'd
|
|
|
189
189
|
* a DOM property
|
|
190
190
|
*/
|
|
191
191
|
multiple?: boolean;
|
|
192
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* The name the picked value submits under in a native `<form>` — one entry
|
|
194
|
+
* per value with `multiple`
|
|
195
|
+
*/
|
|
193
196
|
name?: string;
|
|
194
197
|
/** Placeholder for the in-panel search input */
|
|
195
198
|
placeholder?: string;
|
|
@@ -360,7 +363,7 @@ export interface CButtonGroupElementEventMap {
|
|
|
360
363
|
'update:value': CustomEvent<CButtonGroupValue>;
|
|
361
364
|
}
|
|
362
365
|
/** A button group is a segmented control: a compact group of choices rendered as plain `c-button` children, where activating a button takes effect immediately (switching a view, picking a billing period). Selection is exclusive by default; set `multiple` to let several buttons be active at once. Give the group a `label` when it acts as a form field so the choice it represents is named for every user. */
|
|
363
|
-
export interface CButtonGroupElement extends Omit<HTMLElement, 'disabled' | 'label' | 'mandatory' | 'multiple' | 'required' | 'size' | 'value'> {
|
|
366
|
+
export interface CButtonGroupElement extends Omit<HTMLElement, 'disabled' | 'label' | 'mandatory' | 'multiple' | 'name' | 'required' | 'size' | 'value'> {
|
|
364
367
|
/** Disable the whole group — every slotted c-button is disabled and the selection can no longer be changed. */
|
|
365
368
|
disabled?: boolean;
|
|
366
369
|
/** Label of the button group, shown above the buttons */
|
|
@@ -378,6 +381,11 @@ export interface CButtonGroupElement extends Omit<HTMLElement, 'disabled' | 'lab
|
|
|
378
381
|
* form — bind `value` as a DOM property (`:value.prop` in Vue).
|
|
379
382
|
*/
|
|
380
383
|
multiple?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* The name the active button's value submits under in a native `<form>` —
|
|
386
|
+
* one entry per active button with `multiple`, nothing while none is active
|
|
387
|
+
*/
|
|
388
|
+
name?: string;
|
|
381
389
|
/** Set as required — shows the required marker on the label */
|
|
382
390
|
required?: boolean;
|
|
383
391
|
/** Size of the buttons */
|
|
@@ -509,8 +517,8 @@ export interface CCheckboxElement extends Omit<HTMLElement, 'checked' | 'disable
|
|
|
509
517
|
*/
|
|
510
518
|
label?: string;
|
|
511
519
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
520
|
+
* The name the checkbox submits under in a native `<form>` while it is
|
|
521
|
+
* checked: its `true-value`, or `on` when that is `true`
|
|
514
522
|
*/
|
|
515
523
|
name?: string;
|
|
516
524
|
/** Set as required — shows the required marker on the label */
|
|
@@ -599,7 +607,10 @@ export interface CColorPickerElement extends Omit<HTMLElement, 'alpha' | 'cleara
|
|
|
599
607
|
label?: string;
|
|
600
608
|
/** Label on top of the field */
|
|
601
609
|
labelOnTop?: boolean;
|
|
602
|
-
/**
|
|
610
|
+
/**
|
|
611
|
+
* The name the colour submits under in a native `<form>`, in the
|
|
612
|
+
* picker's notation
|
|
613
|
+
*/
|
|
603
614
|
name?: string;
|
|
604
615
|
/** Placeholder of the input; an example of the notation when empty */
|
|
605
616
|
placeholder?: string;
|
|
@@ -829,7 +840,10 @@ export interface CDatePickerElement extends Omit<HTMLElement, 'clearable' | 'dis
|
|
|
829
840
|
* bounds the calendar's navigation
|
|
830
841
|
*/
|
|
831
842
|
min?: string;
|
|
832
|
-
/**
|
|
843
|
+
/**
|
|
844
|
+
* The name the date submits under in a native `<form>`, as its ISO text;
|
|
845
|
+
* a `range` as one ISO 8601 interval, `start/end`
|
|
846
|
+
*/
|
|
833
847
|
name?: string;
|
|
834
848
|
/** Placeholder of the input; the `format` pattern when empty */
|
|
835
849
|
placeholder?: string;
|
|
@@ -1390,7 +1404,10 @@ export interface CNumberFieldElement extends Omit<HTMLElement, 'decimals' | 'dec
|
|
|
1390
1404
|
max?: null | number;
|
|
1391
1405
|
/** The smallest number in range; a smaller one is kept and reported as out of range. At `0` or above, the minus key is ignored */
|
|
1392
1406
|
min?: null | number;
|
|
1393
|
-
/**
|
|
1407
|
+
/**
|
|
1408
|
+
* The name the number submits under in a native `<form>`, written as a
|
|
1409
|
+
* plain JS number (`1234.5`)
|
|
1410
|
+
*/
|
|
1394
1411
|
name?: string;
|
|
1395
1412
|
/** Placeholder of the input */
|
|
1396
1413
|
placeholder?: string;
|
|
@@ -1455,7 +1472,7 @@ export interface COtpInputElementEventMap {
|
|
|
1455
1472
|
'update:value': CustomEvent<string>;
|
|
1456
1473
|
}
|
|
1457
1474
|
/** A one-time-code field: a row of single-digit boxes, filled in order as the user types or pastes a code, under a group label and above a hint or error message. */
|
|
1458
|
-
export interface COtpInputElement extends Omit<HTMLElement, 'autofocus' | 'errorMessage' | 'hideDetails' | 'hideMessage' | 'hint' | 'invalid' | 'label' | 'length' | 'required' | 'value'> {
|
|
1475
|
+
export interface COtpInputElement extends Omit<HTMLElement, 'autofocus' | 'errorMessage' | 'hideDetails' | 'hideMessage' | 'hint' | 'invalid' | 'label' | 'length' | 'name' | 'required' | 'value'> {
|
|
1459
1476
|
/** Focus the first digit when the field mounts. */
|
|
1460
1477
|
autofocus?: boolean;
|
|
1461
1478
|
/** Error message shown in place of the hint while the input is invalid */
|
|
@@ -1482,6 +1499,8 @@ export interface COtpInputElement extends Omit<HTMLElement, 'autofocus' | 'error
|
|
|
1482
1499
|
label?: string;
|
|
1483
1500
|
/** Number of digits in the code, one box each */
|
|
1484
1501
|
length?: number;
|
|
1502
|
+
/** The name the code submits under in a native `<form>`, as typed so far */
|
|
1503
|
+
name?: string;
|
|
1485
1504
|
/** Set as required — shows the required marker on the label */
|
|
1486
1505
|
required?: boolean;
|
|
1487
1506
|
/**
|
|
@@ -1648,7 +1667,7 @@ export interface CRadioGroupElementEventMap {
|
|
|
1648
1667
|
'update:value': CustomEvent<string>;
|
|
1649
1668
|
}
|
|
1650
1669
|
/** A radio group is a set of mutually exclusive choices where exactly one can be selected, authored as slotted `c-radio` children. Give the group a `label` so the choice it represents is named for every user, and a `hint` describing how to answer. */
|
|
1651
|
-
export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'errorMessage' | 'hideDetails' | 'hideMessage' | 'hint' | 'inline' | 'invalid' | 'label' | 'required' | 'value'> {
|
|
1670
|
+
export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'errorMessage' | 'hideDetails' | 'hideMessage' | 'hint' | 'inline' | 'invalid' | 'label' | 'name' | 'required' | 'value'> {
|
|
1652
1671
|
/** Disable the radio group */
|
|
1653
1672
|
disabled?: boolean;
|
|
1654
1673
|
/** Error message shown in place of the hint while the group is invalid */
|
|
@@ -1675,6 +1694,11 @@ export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'erro
|
|
|
1675
1694
|
invalid?: boolean;
|
|
1676
1695
|
/** Label of the radio group */
|
|
1677
1696
|
label?: string;
|
|
1697
|
+
/**
|
|
1698
|
+
* The name the picked radio's value submits under in a native `<form>`;
|
|
1699
|
+
* nothing submits while no radio is picked
|
|
1700
|
+
*/
|
|
1701
|
+
name?: string;
|
|
1678
1702
|
/** Set as required */
|
|
1679
1703
|
required?: boolean;
|
|
1680
1704
|
/**
|
|
@@ -1760,7 +1784,10 @@ export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disable
|
|
|
1760
1784
|
* Arrays have no attribute form — bind `value` as a DOM property
|
|
1761
1785
|
*/
|
|
1762
1786
|
multiple?: boolean;
|
|
1763
|
-
/**
|
|
1787
|
+
/**
|
|
1788
|
+
* The name the picked value submits under in a native `<form>` — one entry
|
|
1789
|
+
* per value with `multiple`
|
|
1790
|
+
*/
|
|
1764
1791
|
name?: string;
|
|
1765
1792
|
/** Display the option as selection (only with <c-option> elements) */
|
|
1766
1793
|
optionAsSelection?: boolean;
|
|
@@ -1920,10 +1947,7 @@ export interface CSliderElement extends Omit<HTMLElement, 'disabled' | 'disableT
|
|
|
1920
1947
|
max?: number;
|
|
1921
1948
|
/** The smallest value. */
|
|
1922
1949
|
min?: number;
|
|
1923
|
-
/**
|
|
1924
|
-
* `name` of the inner range input. The component is not
|
|
1925
|
-
* form-associated, so it does not submit with a `<form>`.
|
|
1926
|
-
*/
|
|
1950
|
+
/** The name the value submits under in a native `<form>` */
|
|
1927
1951
|
name?: string;
|
|
1928
1952
|
/** Number of segments the tick marks divide the track into. */
|
|
1929
1953
|
segments?: number;
|
|
@@ -2047,7 +2071,7 @@ export interface CSwitchElementEventMap {
|
|
|
2047
2071
|
'update:value': CustomEvent<boolean | number | string>;
|
|
2048
2072
|
}
|
|
2049
2073
|
/** A toggle for a binary setting that takes effect immediately: a native switch control with a label. */
|
|
2050
|
-
export interface CSwitchElement extends Omit<HTMLElement, 'checked' | 'disabled' | 'falseValue' | 'label' | 'loading' | 'required' | 'trueValue' | 'value'> {
|
|
2074
|
+
export interface CSwitchElement extends Omit<HTMLElement, 'checked' | 'disabled' | 'falseValue' | 'label' | 'loading' | 'name' | 'required' | 'trueValue' | 'value'> {
|
|
2051
2075
|
/**
|
|
2052
2076
|
* Whether the switch is on: the boolean view of `value`. Setting it sets
|
|
2053
2077
|
* `value` to `trueValue` or `falseValue`; reading it reports whether
|
|
@@ -2069,6 +2093,11 @@ export interface CSwitchElement extends Omit<HTMLElement, 'checked' | 'disabled'
|
|
|
2069
2093
|
* saved. The switch ignores toggles meanwhile and is announced as busy
|
|
2070
2094
|
*/
|
|
2071
2095
|
loading?: boolean;
|
|
2096
|
+
/**
|
|
2097
|
+
* The name the switch submits under in a native `<form>` while it is on:
|
|
2098
|
+
* its `true-value`, or `on` when that is `true`
|
|
2099
|
+
*/
|
|
2100
|
+
name?: string;
|
|
2072
2101
|
/** Set as required — shows the required marker on the label */
|
|
2073
2102
|
required?: boolean;
|
|
2074
2103
|
/** The value when the switch is on */
|
|
@@ -2308,10 +2337,7 @@ export interface CTextFieldElement extends Omit<HTMLElement, 'autocapitalize' |
|
|
|
2308
2337
|
max?: null | number;
|
|
2309
2338
|
/** Smallest value of a `type="number"` field, as the native `min` attribute */
|
|
2310
2339
|
min?: null | number;
|
|
2311
|
-
/**
|
|
2312
|
-
* `name` of the inner input. The component is not form-associated, so it
|
|
2313
|
-
* does not submit with a `<form>`.
|
|
2314
|
-
*/
|
|
2340
|
+
/** The name the text submits under in a native `<form>` */
|
|
2315
2341
|
name?: string;
|
|
2316
2342
|
/**
|
|
2317
2343
|
* Placeholder of the input. Beside a floating `label` it shows only while
|
|
@@ -2436,7 +2462,10 @@ export interface CTimePickerElement extends Omit<HTMLElement, 'clearable' | 'dis
|
|
|
2436
2462
|
* the step
|
|
2437
2463
|
*/
|
|
2438
2464
|
minuteStep?: number;
|
|
2439
|
-
/**
|
|
2465
|
+
/**
|
|
2466
|
+
* The name the time submits under in a native `<form>`, as its ISO text;
|
|
2467
|
+
* a `range` as one ISO 8601 interval, `start/end`
|
|
2468
|
+
*/
|
|
2440
2469
|
name?: string;
|
|
2441
2470
|
/** Placeholder of the input; the `format` pattern when empty */
|
|
2442
2471
|
placeholder?: string;
|
|
@@ -2661,7 +2690,7 @@ export interface CTreeSelectElement extends Omit<HTMLElement, 'allowBranch' | 'c
|
|
|
2661
2690
|
* form — bind as a DOM property
|
|
2662
2691
|
*/
|
|
2663
2692
|
levelLabels?: string[];
|
|
2664
|
-
/**
|
|
2693
|
+
/** The name the picked value submits under in a native `<form>` */
|
|
2665
2694
|
name?: string;
|
|
2666
2695
|
/** Placeholder for the search input inside the panel */
|
|
2667
2696
|
placeholder?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cscfi/csc-ui",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.5",
|
|
4
4
|
"description": "The CSC Design System's components as native custom elements: one set of c-* tags for plain HTML, Vue, React and Angular.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/csc-ui.js",
|
|
@@ -74,12 +74,13 @@
|
|
|
74
74
|
"chart:generate": "node scripts/generate-chart-data.mjs",
|
|
75
75
|
"lint:chart": "node scripts/check-chart-parity.mjs",
|
|
76
76
|
"lint:focus": "node scripts/check-focus-rings.mjs",
|
|
77
|
+
"lint:tint": "node scripts/check-tint-ink.mjs",
|
|
77
78
|
"lint:engines": "node scripts/check-engine-skips.mjs",
|
|
78
79
|
"test": "pnpm run style-dictionary:build && vitest run",
|
|
79
80
|
"test:watch": "vitest",
|
|
80
81
|
"test:browser": "vitest run --project browser",
|
|
81
82
|
"test:node": "vitest run --project node",
|
|
82
83
|
"test:update": "pnpm run style-dictionary:build && vitest run --project browser --update",
|
|
83
|
-
"lint:guards": "pnpm run lint:tokens && pnpm run lint:a11y && pnpm run lint:ramp && pnpm run lint:chart && pnpm run lint:focus && pnpm run lint:engines"
|
|
84
|
+
"lint:guards": "pnpm run lint:tokens && pnpm run lint:a11y && pnpm run lint:ramp && pnpm run lint:chart && pnpm run lint:focus && pnpm run lint:tint && pnpm run lint:engines"
|
|
84
85
|
}
|
|
85
86
|
}
|