@cscfi/csc-ui 4.0.0-rc.4 → 4.0.0-rc.6
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 +11345 -10712
- package/dist/custom-elements.json +145 -23
- package/dist/docs/c-button/usage.md +63 -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-icon-button/usage.md +1 -0
- 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 +63 -15
- package/dist/web-types.json +85 -29
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +2 -1
- package/dist-types/components/c-button/CButton.vue.d.ts +6 -2
- 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-icon-button/CIconButton.vue.d.ts +3 -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 +61 -21
- package/package.json +3 -2
|
@@ -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;
|
|
@@ -342,6 +345,12 @@ export interface CButtonElement extends Omit<HTMLElement, 'active' | 'appearance
|
|
|
342
345
|
* for a destructive action.
|
|
343
346
|
*/
|
|
344
347
|
variant?: 'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
|
|
348
|
+
/**
|
|
349
|
+
* Focus its button — its link under `href`, or the slotted button — as
|
|
350
|
+
* `focus()` does on a native button: the element renders no box of its own to
|
|
351
|
+
* take it.
|
|
352
|
+
*/
|
|
353
|
+
focus(options?: FocusOptions): void;
|
|
345
354
|
}
|
|
346
355
|
/** Events dispatched by `<c-button-group>`. */
|
|
347
356
|
export interface CButtonGroupElementEventMap {
|
|
@@ -360,7 +369,7 @@ export interface CButtonGroupElementEventMap {
|
|
|
360
369
|
'update:value': CustomEvent<CButtonGroupValue>;
|
|
361
370
|
}
|
|
362
371
|
/** 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'> {
|
|
372
|
+
export interface CButtonGroupElement extends Omit<HTMLElement, 'disabled' | 'label' | 'mandatory' | 'multiple' | 'name' | 'required' | 'size' | 'value'> {
|
|
364
373
|
/** Disable the whole group — every slotted c-button is disabled and the selection can no longer be changed. */
|
|
365
374
|
disabled?: boolean;
|
|
366
375
|
/** Label of the button group, shown above the buttons */
|
|
@@ -378,6 +387,11 @@ export interface CButtonGroupElement extends Omit<HTMLElement, 'disabled' | 'lab
|
|
|
378
387
|
* form — bind `value` as a DOM property (`:value.prop` in Vue).
|
|
379
388
|
*/
|
|
380
389
|
multiple?: boolean;
|
|
390
|
+
/**
|
|
391
|
+
* The name the active button's value submits under in a native `<form>` —
|
|
392
|
+
* one entry per active button with `multiple`, nothing while none is active
|
|
393
|
+
*/
|
|
394
|
+
name?: string;
|
|
381
395
|
/** Set as required — shows the required marker on the label */
|
|
382
396
|
required?: boolean;
|
|
383
397
|
/** Size of the buttons */
|
|
@@ -509,8 +523,8 @@ export interface CCheckboxElement extends Omit<HTMLElement, 'checked' | 'disable
|
|
|
509
523
|
*/
|
|
510
524
|
label?: string;
|
|
511
525
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
526
|
+
* The name the checkbox submits under in a native `<form>` while it is
|
|
527
|
+
* checked: its `true-value`, or `on` when that is `true`
|
|
514
528
|
*/
|
|
515
529
|
name?: string;
|
|
516
530
|
/** Set as required — shows the required marker on the label */
|
|
@@ -599,7 +613,10 @@ export interface CColorPickerElement extends Omit<HTMLElement, 'alpha' | 'cleara
|
|
|
599
613
|
label?: string;
|
|
600
614
|
/** Label on top of the field */
|
|
601
615
|
labelOnTop?: boolean;
|
|
602
|
-
/**
|
|
616
|
+
/**
|
|
617
|
+
* The name the colour submits under in a native `<form>`, in the
|
|
618
|
+
* picker's notation
|
|
619
|
+
*/
|
|
603
620
|
name?: string;
|
|
604
621
|
/** Placeholder of the input; an example of the notation when empty */
|
|
605
622
|
placeholder?: string;
|
|
@@ -829,7 +846,10 @@ export interface CDatePickerElement extends Omit<HTMLElement, 'clearable' | 'dis
|
|
|
829
846
|
* bounds the calendar's navigation
|
|
830
847
|
*/
|
|
831
848
|
min?: string;
|
|
832
|
-
/**
|
|
849
|
+
/**
|
|
850
|
+
* The name the date submits under in a native `<form>`, as its ISO text;
|
|
851
|
+
* a `range` as one ISO 8601 interval, `start/end`
|
|
852
|
+
*/
|
|
833
853
|
name?: string;
|
|
834
854
|
/** Placeholder of the input; the `format` pattern when empty */
|
|
835
855
|
placeholder?: string;
|
|
@@ -1042,6 +1062,11 @@ export interface CIconButtonElement extends Omit<HTMLElement, 'appearance' | 'ba
|
|
|
1042
1062
|
* for a destructive action.
|
|
1043
1063
|
*/
|
|
1044
1064
|
variant?: 'danger' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
|
|
1065
|
+
/**
|
|
1066
|
+
* Focus its button, as `focus()` does on a native button: the element renders
|
|
1067
|
+
* no box of its own to take it.
|
|
1068
|
+
*/
|
|
1069
|
+
focus(options?: FocusOptions): void;
|
|
1045
1070
|
}
|
|
1046
1071
|
/** A text link to another page or resource: a native `<a>` in the link colour, with an optional underline. */
|
|
1047
1072
|
export interface CLinkElement extends Omit<HTMLElement, 'href' | 'target' | 'underline'> {
|
|
@@ -1390,7 +1415,10 @@ export interface CNumberFieldElement extends Omit<HTMLElement, 'decimals' | 'dec
|
|
|
1390
1415
|
max?: null | number;
|
|
1391
1416
|
/** 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
1417
|
min?: null | number;
|
|
1393
|
-
/**
|
|
1418
|
+
/**
|
|
1419
|
+
* The name the number submits under in a native `<form>`, written as a
|
|
1420
|
+
* plain JS number (`1234.5`)
|
|
1421
|
+
*/
|
|
1394
1422
|
name?: string;
|
|
1395
1423
|
/** Placeholder of the input */
|
|
1396
1424
|
placeholder?: string;
|
|
@@ -1455,7 +1483,7 @@ export interface COtpInputElementEventMap {
|
|
|
1455
1483
|
'update:value': CustomEvent<string>;
|
|
1456
1484
|
}
|
|
1457
1485
|
/** 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'> {
|
|
1486
|
+
export interface COtpInputElement extends Omit<HTMLElement, 'autofocus' | 'errorMessage' | 'hideDetails' | 'hideMessage' | 'hint' | 'invalid' | 'label' | 'length' | 'name' | 'required' | 'value'> {
|
|
1459
1487
|
/** Focus the first digit when the field mounts. */
|
|
1460
1488
|
autofocus?: boolean;
|
|
1461
1489
|
/** Error message shown in place of the hint while the input is invalid */
|
|
@@ -1482,6 +1510,8 @@ export interface COtpInputElement extends Omit<HTMLElement, 'autofocus' | 'error
|
|
|
1482
1510
|
label?: string;
|
|
1483
1511
|
/** Number of digits in the code, one box each */
|
|
1484
1512
|
length?: number;
|
|
1513
|
+
/** The name the code submits under in a native `<form>`, as typed so far */
|
|
1514
|
+
name?: string;
|
|
1485
1515
|
/** Set as required — shows the required marker on the label */
|
|
1486
1516
|
required?: boolean;
|
|
1487
1517
|
/**
|
|
@@ -1648,7 +1678,7 @@ export interface CRadioGroupElementEventMap {
|
|
|
1648
1678
|
'update:value': CustomEvent<string>;
|
|
1649
1679
|
}
|
|
1650
1680
|
/** 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'> {
|
|
1681
|
+
export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'errorMessage' | 'hideDetails' | 'hideMessage' | 'hint' | 'inline' | 'invalid' | 'label' | 'name' | 'required' | 'value'> {
|
|
1652
1682
|
/** Disable the radio group */
|
|
1653
1683
|
disabled?: boolean;
|
|
1654
1684
|
/** Error message shown in place of the hint while the group is invalid */
|
|
@@ -1675,6 +1705,11 @@ export interface CRadioGroupElement extends Omit<HTMLElement, 'disabled' | 'erro
|
|
|
1675
1705
|
invalid?: boolean;
|
|
1676
1706
|
/** Label of the radio group */
|
|
1677
1707
|
label?: string;
|
|
1708
|
+
/**
|
|
1709
|
+
* The name the picked radio's value submits under in a native `<form>`;
|
|
1710
|
+
* nothing submits while no radio is picked
|
|
1711
|
+
*/
|
|
1712
|
+
name?: string;
|
|
1678
1713
|
/** Set as required */
|
|
1679
1714
|
required?: boolean;
|
|
1680
1715
|
/**
|
|
@@ -1760,7 +1795,10 @@ export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disable
|
|
|
1760
1795
|
* Arrays have no attribute form — bind `value` as a DOM property
|
|
1761
1796
|
*/
|
|
1762
1797
|
multiple?: boolean;
|
|
1763
|
-
/**
|
|
1798
|
+
/**
|
|
1799
|
+
* The name the picked value submits under in a native `<form>` — one entry
|
|
1800
|
+
* per value with `multiple`
|
|
1801
|
+
*/
|
|
1764
1802
|
name?: string;
|
|
1765
1803
|
/** Display the option as selection (only with <c-option> elements) */
|
|
1766
1804
|
optionAsSelection?: boolean;
|
|
@@ -1920,10 +1958,7 @@ export interface CSliderElement extends Omit<HTMLElement, 'disabled' | 'disableT
|
|
|
1920
1958
|
max?: number;
|
|
1921
1959
|
/** The smallest value. */
|
|
1922
1960
|
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
|
-
*/
|
|
1961
|
+
/** The name the value submits under in a native `<form>` */
|
|
1927
1962
|
name?: string;
|
|
1928
1963
|
/** Number of segments the tick marks divide the track into. */
|
|
1929
1964
|
segments?: number;
|
|
@@ -2047,7 +2082,7 @@ export interface CSwitchElementEventMap {
|
|
|
2047
2082
|
'update:value': CustomEvent<boolean | number | string>;
|
|
2048
2083
|
}
|
|
2049
2084
|
/** 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'> {
|
|
2085
|
+
export interface CSwitchElement extends Omit<HTMLElement, 'checked' | 'disabled' | 'falseValue' | 'label' | 'loading' | 'name' | 'required' | 'trueValue' | 'value'> {
|
|
2051
2086
|
/**
|
|
2052
2087
|
* Whether the switch is on: the boolean view of `value`. Setting it sets
|
|
2053
2088
|
* `value` to `trueValue` or `falseValue`; reading it reports whether
|
|
@@ -2069,6 +2104,11 @@ export interface CSwitchElement extends Omit<HTMLElement, 'checked' | 'disabled'
|
|
|
2069
2104
|
* saved. The switch ignores toggles meanwhile and is announced as busy
|
|
2070
2105
|
*/
|
|
2071
2106
|
loading?: boolean;
|
|
2107
|
+
/**
|
|
2108
|
+
* The name the switch submits under in a native `<form>` while it is on:
|
|
2109
|
+
* its `true-value`, or `on` when that is `true`
|
|
2110
|
+
*/
|
|
2111
|
+
name?: string;
|
|
2072
2112
|
/** Set as required — shows the required marker on the label */
|
|
2073
2113
|
required?: boolean;
|
|
2074
2114
|
/** The value when the switch is on */
|
|
@@ -2308,10 +2348,7 @@ export interface CTextFieldElement extends Omit<HTMLElement, 'autocapitalize' |
|
|
|
2308
2348
|
max?: null | number;
|
|
2309
2349
|
/** Smallest value of a `type="number"` field, as the native `min` attribute */
|
|
2310
2350
|
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
|
-
*/
|
|
2351
|
+
/** The name the text submits under in a native `<form>` */
|
|
2315
2352
|
name?: string;
|
|
2316
2353
|
/**
|
|
2317
2354
|
* Placeholder of the input. Beside a floating `label` it shows only while
|
|
@@ -2436,7 +2473,10 @@ export interface CTimePickerElement extends Omit<HTMLElement, 'clearable' | 'dis
|
|
|
2436
2473
|
* the step
|
|
2437
2474
|
*/
|
|
2438
2475
|
minuteStep?: number;
|
|
2439
|
-
/**
|
|
2476
|
+
/**
|
|
2477
|
+
* The name the time submits under in a native `<form>`, as its ISO text;
|
|
2478
|
+
* a `range` as one ISO 8601 interval, `start/end`
|
|
2479
|
+
*/
|
|
2440
2480
|
name?: string;
|
|
2441
2481
|
/** Placeholder of the input; the `format` pattern when empty */
|
|
2442
2482
|
placeholder?: string;
|
|
@@ -2661,7 +2701,7 @@ export interface CTreeSelectElement extends Omit<HTMLElement, 'allowBranch' | 'c
|
|
|
2661
2701
|
* form — bind as a DOM property
|
|
2662
2702
|
*/
|
|
2663
2703
|
levelLabels?: string[];
|
|
2664
|
-
/**
|
|
2704
|
+
/** The name the picked value submits under in a native `<form>` */
|
|
2665
2705
|
name?: string;
|
|
2666
2706
|
/** Placeholder for the search input inside the panel */
|
|
2667
2707
|
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.6",
|
|
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
|
}
|