@cscfi/csc-ui 4.0.0-alpha.27 → 4.0.0-alpha.29
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 +10570 -9366
- package/dist/custom-elements.json +822 -9
- package/dist/docs/c-date-picker/usage.md +86 -3
- package/dist/docs/c-number-field/usage.md +39 -9
- package/dist/docs/c-time-picker/usage.md +170 -0
- package/dist/styles/css/tailwind-theme.css +1 -0
- package/dist/styles/css/tokens.css +8 -0
- package/dist/vscode.css-custom-data.json +82 -0
- package/dist/vscode.html-custom-data.json +114 -3
- package/dist/web-types.json +401 -8
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +40 -5
- package/dist-types/components/c-date-picker/dates.d.ts +31 -2
- package/dist-types/components/c-number-field/CNumberField.vue.d.ts +21 -0
- package/dist-types/components/c-number-field/numbers.d.ts +16 -0
- package/dist-types/components/c-slider/CSlider.vue.d.ts +1 -1
- package/dist-types/components/c-time-picker/CTimePicker.vue.d.ts +210 -0
- package/dist-types/components/c-time-picker/times.d.ts +82 -0
- package/dist-types/index.d.ts +3 -2
- package/dist-types/shared/TypedField.vue.d.ts +46 -0
- package/dist-types/shared/inputMask.d.ts +9 -0
- package/dist-types/shared/useTypedField.d.ts +103 -0
- package/dist-types/tag-name-map.d.ts +125 -11
- package/package.json +1 -1
|
@@ -13,8 +13,10 @@ import type { CAutocompleteFilter, CAutocompleteItem, CAutocompleteTexts, CAutoc
|
|
|
13
13
|
import type { CButtonGroupValue } from './components/c-button-group/CButtonGroup.vue';
|
|
14
14
|
import type { CDataTableCellContent, CDataTableColumn, CDataTableExpandedContext, CDataTableRow, CDataTableSort, CDataTableTexts } from './components/c-data-table/CDataTable.vue';
|
|
15
15
|
import type { CDatePickerDisabledDate, CDatePickerText, CDatePickerTexts, CDatePickerValue } from './components/c-date-picker/CDatePicker.vue';
|
|
16
|
+
import type { CNumberFieldTexts } from './components/c-number-field/CNumberField.vue';
|
|
16
17
|
import type { CPaginationOptions } from './components/c-pagination/CPagination.vue';
|
|
17
18
|
import type { CSelectTexts, CSelectValue } from './components/c-select/CSelect.vue';
|
|
19
|
+
import type { CTimePickerText, CTimePickerTexts, CTimePickerValue } from './components/c-time-picker/CTimePicker.vue';
|
|
18
20
|
import type { CTreeSelectFilter, CTreeSelectItem, CTreeSelectTexts, CTreeSelectValue } from './components/c-tree-select/CTreeSelect.vue';
|
|
19
21
|
import type { CSelectItem, CToastMessage } from './types';
|
|
20
22
|
type AccordionPrimitive = number | string;
|
|
@@ -543,7 +545,7 @@ export interface CDatePickerElementEventMap {
|
|
|
543
545
|
'update:value': CustomEvent<CDatePickerValue>;
|
|
544
546
|
}
|
|
545
547
|
/** A date field that takes a typed date, or opens a calendar panel for picking one, or a start and end date under `range`. */
|
|
546
|
-
export interface CDatePickerElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'disabledDates' | 'errorMessage' | 'firstDayOfWeek' | 'format' | 'hideDetails' | 'hint' | 'hostId' | 'isDateDisabled' | 'label' | 'labelOnTop' | 'max' | 'min' | 'name' | 'placeholder' | 'range' | 'required' | 'shadow' | 'showWeekNumbers' | 'size' | 'texts' | 'valid' | 'value'> {
|
|
548
|
+
export interface CDatePickerElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'disabledDates' | 'errorMessage' | 'firstDayOfWeek' | 'format' | 'hideDetails' | 'hint' | 'hostId' | 'isDateDisabled' | 'label' | 'labelOnTop' | 'max' | 'min' | 'name' | 'placeholder' | 'range' | 'required' | 'shadow' | 'showToday' | 'showWeekNumbers' | 'size' | 'texts' | 'type' | 'valid' | 'value'> {
|
|
547
549
|
/** Make the value clearable */
|
|
548
550
|
clearable?: boolean;
|
|
549
551
|
/** Disable the field */
|
|
@@ -603,6 +605,11 @@ export interface CDatePickerElement extends Omit<HTMLElement, 'clearable' | 'dis
|
|
|
603
605
|
required?: boolean;
|
|
604
606
|
/** Shadow variant */
|
|
605
607
|
shadow?: boolean;
|
|
608
|
+
/**
|
|
609
|
+
* Show a Today button under the calendar that picks today ("This month"
|
|
610
|
+
* under `type="month"`)
|
|
611
|
+
*/
|
|
612
|
+
showToday?: boolean;
|
|
606
613
|
/**
|
|
607
614
|
* Show ISO 8601 week numbers beside the calendar rows (meaningful with a
|
|
608
615
|
* Monday week start)
|
|
@@ -616,11 +623,16 @@ export interface CDatePickerElement extends Omit<HTMLElement, 'clearable' | 'dis
|
|
|
616
623
|
* bind as a DOM property
|
|
617
624
|
*/
|
|
618
625
|
texts?: CDatePickerTexts;
|
|
626
|
+
/**
|
|
627
|
+
* What the field picks: a calendar date, or a year and a month
|
|
628
|
+
* (`'YYYY-MM'`)
|
|
629
|
+
*/
|
|
630
|
+
type?: 'date' | 'month';
|
|
619
631
|
/** Set the validity of the field */
|
|
620
632
|
valid?: boolean;
|
|
621
633
|
/**
|
|
622
|
-
* The date as an ISO `YYYY-MM-DD` string
|
|
623
|
-
* `range`; `null` when empty
|
|
634
|
+
* The date as an ISO `YYYY-MM-DD` string (an ISO `YYYY-MM` month under
|
|
635
|
+
* `type="month"`), or `{ start, end }` under `range`; `null` when empty
|
|
624
636
|
*/
|
|
625
637
|
value?: CDatePickerValue;
|
|
626
638
|
/** Whether the committed text names no date that can be picked — the value is then `null` (CONTEXT.md "Bad input"). */
|
|
@@ -991,8 +1003,8 @@ export interface CNavigationButtonElement extends HTMLElement {
|
|
|
991
1003
|
/** Events dispatched by `<c-number-field>`. */
|
|
992
1004
|
export interface CNumberFieldElementEventMap {
|
|
993
1005
|
/**
|
|
994
|
-
* Fired whenever typing changes the number, carrying it — `null`
|
|
995
|
-
* field holds no digit. Not fired when only the text changes (a group
|
|
1006
|
+
* Fired whenever typing or a step changes the number, carrying it — `null`
|
|
1007
|
+
* once the field holds no digit. Not fired when only the text changes (a group
|
|
996
1008
|
* separator, a trailing decimal separator) or when `value` is set.
|
|
997
1009
|
*/
|
|
998
1010
|
change: CustomEvent<null | number>;
|
|
@@ -1005,7 +1017,7 @@ export interface CNumberFieldElementEventMap {
|
|
|
1005
1017
|
'update:value': CustomEvent<null | number>;
|
|
1006
1018
|
}
|
|
1007
1019
|
/** A field for a number — an integer, or one with decimals — shown with thousands separators as it is typed. */
|
|
1008
|
-
export interface CNumberFieldElement extends Omit<HTMLElement, 'decimals' | 'decimalSeparator' | 'disabled' | 'errorMessage' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'hint' | 'hostId' | 'label' | 'labelOnTop' | 'max' | 'min' | 'name' | 'placeholder' | 'readonly' | 'required' | 'shadow' | 'size' | 'valid' | 'value'> {
|
|
1020
|
+
export interface CNumberFieldElement extends Omit<HTMLElement, 'decimals' | 'decimalSeparator' | 'disabled' | 'errorMessage' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'hint' | 'hostId' | 'label' | 'labelOnTop' | 'max' | 'min' | 'name' | 'placeholder' | 'readonly' | 'required' | 'shadow' | 'size' | 'step' | 'texts' | 'valid' | 'value'> {
|
|
1009
1021
|
/** The most fraction digits the field takes; `0` makes it an integer field */
|
|
1010
1022
|
decimals?: number;
|
|
1011
1023
|
/** The decimal separator. Empty follows the page's `lang` (`,` for `fi`, `.` for `en`) */
|
|
@@ -1044,6 +1056,10 @@ export interface CNumberFieldElement extends Omit<HTMLElement, 'decimals' | 'dec
|
|
|
1044
1056
|
shadow?: boolean;
|
|
1045
1057
|
/** Field height: the 52px default (the shared control height) or the 36px `small` box */
|
|
1046
1058
|
size?: 'default' | 'small';
|
|
1059
|
+
/** The spacing of the grid the step buttons and arrow keys move along, counted from `min` (or `0`) */
|
|
1060
|
+
step?: number;
|
|
1061
|
+
/** UI text overrides (i18n), merged over the English defaults. Objects have no attribute form — bind as a DOM property */
|
|
1062
|
+
texts?: CNumberFieldTexts;
|
|
1047
1063
|
/** Set the validity of the field */
|
|
1048
1064
|
valid?: boolean;
|
|
1049
1065
|
/** The number, or `null` when the field is empty. A string is read as the number it spells, and `''` as empty — what an attribute, or a plain `v-model` holding `null`, writes; the field always emits a number or `null` */
|
|
@@ -1831,6 +1847,101 @@ export interface CTextFieldElement extends Omit<HTMLElement, 'autocomplete' | 'a
|
|
|
1831
1847
|
removeEventListener<K extends keyof CTextFieldElementEventMap>(type: K, listener: (this: CTextFieldElement, ev: CTextFieldElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1832
1848
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1833
1849
|
}
|
|
1850
|
+
/** Events dispatched by `<c-time-picker>`. */
|
|
1851
|
+
export interface CTimePickerElementEventMap {
|
|
1852
|
+
/**
|
|
1853
|
+
* Fired when the value changes — a row is picked or moved to in a column,
|
|
1854
|
+
* typed text is committed, or the field is cleared — carrying the new
|
|
1855
|
+
* value: an ISO `HH:mm` time, `{ start, end }` under `range`, or `null`.
|
|
1856
|
+
*/
|
|
1857
|
+
change: CustomEvent<CTimePickerValue>;
|
|
1858
|
+
/**
|
|
1859
|
+
* Fired on every commit of typed text (Enter or leaving the input) with the
|
|
1860
|
+
* text as typed — `{ start, end }` under `range`. Read `badInput` to tell
|
|
1861
|
+
* whether it named a time that can be picked.
|
|
1862
|
+
*/
|
|
1863
|
+
'change:text': CustomEvent<CTimePickerText>;
|
|
1864
|
+
/**
|
|
1865
|
+
* Native bubbling input event dispatched alongside every value change so a
|
|
1866
|
+
* plain `v-model` stays in sync. Carries no detail.
|
|
1867
|
+
*/
|
|
1868
|
+
input: CustomEvent<void>;
|
|
1869
|
+
/** Fired alongside `change` with the same detail — the `v-model` contract. */
|
|
1870
|
+
'update:value': CustomEvent<CTimePickerValue>;
|
|
1871
|
+
}
|
|
1872
|
+
/** A time field that takes a typed time, or opens hour and minute columns for picking one, or a start and end time under `range`. */
|
|
1873
|
+
export interface CTimePickerElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'format' | 'hideDetails' | 'hint' | 'hostId' | 'label' | 'labelOnTop' | 'max' | 'min' | 'minuteStep' | 'name' | 'placeholder' | 'range' | 'required' | 'shadow' | 'showNow' | 'size' | 'texts' | 'valid' | 'value'> {
|
|
1874
|
+
/** Make the value clearable */
|
|
1875
|
+
clearable?: boolean;
|
|
1876
|
+
/** Disable the field */
|
|
1877
|
+
disabled?: boolean;
|
|
1878
|
+
/** Error message shown in place of the hint while the field is invalid */
|
|
1879
|
+
errorMessage?: string;
|
|
1880
|
+
/**
|
|
1881
|
+
* How times are shown and read from typing: a pattern of the tokens `H`,
|
|
1882
|
+
* `HH` (24-hour), `h`, `hh` (12-hour, with the period `a`) and `mm` with
|
|
1883
|
+
* any separators, e.g. `HH:mm` or `h:mm a`
|
|
1884
|
+
*/
|
|
1885
|
+
format?: string;
|
|
1886
|
+
/** Hide the hint and error messages */
|
|
1887
|
+
hideDetails?: boolean;
|
|
1888
|
+
/** Hint text for the field */
|
|
1889
|
+
hint?: string;
|
|
1890
|
+
/** Id of the element */
|
|
1891
|
+
hostId?: string;
|
|
1892
|
+
/** Element label */
|
|
1893
|
+
label?: string;
|
|
1894
|
+
/** Label on top of the field */
|
|
1895
|
+
labelOnTop?: boolean;
|
|
1896
|
+
/** The latest time that can be picked or typed, as an ISO `HH:mm` time */
|
|
1897
|
+
max?: string;
|
|
1898
|
+
/**
|
|
1899
|
+
* The earliest time that can be picked or typed, as an ISO `HH:mm` time;
|
|
1900
|
+
* a `min` after `max` is invalid and both are ignored
|
|
1901
|
+
*/
|
|
1902
|
+
min?: string;
|
|
1903
|
+
/**
|
|
1904
|
+
* Minutes between the minute column's rows; typed times need not fall on
|
|
1905
|
+
* the step
|
|
1906
|
+
*/
|
|
1907
|
+
minuteStep?: number;
|
|
1908
|
+
/** Input field name */
|
|
1909
|
+
name?: string;
|
|
1910
|
+
/** Placeholder of the input; the `format` pattern when empty */
|
|
1911
|
+
placeholder?: string;
|
|
1912
|
+
/**
|
|
1913
|
+
* Pick a range: the value becomes `{ start, end }` and the field holds two
|
|
1914
|
+
* inputs
|
|
1915
|
+
*/
|
|
1916
|
+
range?: boolean;
|
|
1917
|
+
/** Set the field as required */
|
|
1918
|
+
required?: boolean;
|
|
1919
|
+
/** Shadow variant */
|
|
1920
|
+
shadow?: boolean;
|
|
1921
|
+
/** Show a Now button under the columns that commits the current time */
|
|
1922
|
+
showNow?: boolean;
|
|
1923
|
+
/** Field height: the 52px default (the shared control height) or the 36px `small` box */
|
|
1924
|
+
size?: 'default' | 'small';
|
|
1925
|
+
/**
|
|
1926
|
+
* UI text overrides (i18n), merged over the AM/PM texts `Intl` gives for
|
|
1927
|
+
* the page's `lang` and the English defaults. Objects have no attribute
|
|
1928
|
+
* form — bind as a DOM property
|
|
1929
|
+
*/
|
|
1930
|
+
texts?: CTimePickerTexts;
|
|
1931
|
+
/** Set the validity of the field */
|
|
1932
|
+
valid?: boolean;
|
|
1933
|
+
/**
|
|
1934
|
+
* The time as an ISO `HH:mm` string on a 24-hour clock, or `{ start, end }`
|
|
1935
|
+
* under `range`; `null` when empty
|
|
1936
|
+
*/
|
|
1937
|
+
value?: CTimePickerValue;
|
|
1938
|
+
/** Whether the committed text names no time that can be picked — the value is then `null` (CONTEXT.md "Bad input"). */
|
|
1939
|
+
readonly badInput: boolean;
|
|
1940
|
+
addEventListener<K extends keyof CTimePickerElementEventMap>(type: K, listener: (this: CTimePickerElement, ev: CTimePickerElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
1941
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1942
|
+
removeEventListener<K extends keyof CTimePickerElementEventMap>(type: K, listener: (this: CTimePickerElement, ev: CTimePickerElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1943
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1944
|
+
}
|
|
1834
1945
|
/** Events dispatched by `<c-toast>`. */
|
|
1835
1946
|
export interface CToastElementEventMap {
|
|
1836
1947
|
/**
|
|
@@ -2019,24 +2130,26 @@ export interface CTreeSelectElement extends Omit<HTMLElement, 'allowBranch' | 'c
|
|
|
2019
2130
|
export interface AppDefaults {
|
|
2020
2131
|
'c-autocomplete'?: Partial<Pick<CAutocompleteElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
2021
2132
|
'c-data-table'?: Partial<Pick<CDataTableElement, 'texts'>>;
|
|
2022
|
-
'c-date-picker'?: Partial<Pick<CDatePickerElement, 'firstDayOfWeek' | 'format' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'showWeekNumbers' | 'size' | 'texts'>>;
|
|
2023
|
-
'c-number-field'?: Partial<Pick<CNumberFieldElement, 'decimalSeparator' | 'decimals' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'size'>>;
|
|
2133
|
+
'c-date-picker'?: Partial<Pick<CDatePickerElement, 'firstDayOfWeek' | 'format' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'showToday' | 'showWeekNumbers' | 'size' | 'texts'>>;
|
|
2134
|
+
'c-number-field'?: Partial<Pick<CNumberFieldElement, 'decimalSeparator' | 'decimals' | 'fixedDecimals' | 'groupSeparator' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'size' | 'step' | 'texts'>>;
|
|
2024
2135
|
'c-select'?: Partial<Pick<CSelectElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
2025
2136
|
'c-text-field'?: Partial<Pick<CTextFieldElement, 'hideDetails' | 'labelOnTop' | 'shadow' | 'size'>>;
|
|
2137
|
+
'c-time-picker'?: Partial<Pick<CTimePickerElement, 'format' | 'hideDetails' | 'labelOnTop' | 'shadow' | 'showNow' | 'size' | 'texts'>>;
|
|
2026
2138
|
'c-tree-select'?: Partial<Pick<CTreeSelectElement, 'hideDetails' | 'itemsPerPage' | 'labelOnTop' | 'shadow' | 'size' | 'texts'>>;
|
|
2027
2139
|
}
|
|
2028
2140
|
/** Runtime allow-list behind `applyDefaults()` validation — the same data as `AppDefaults`. */
|
|
2029
2141
|
export declare const DEFAULTABLE_PROPS: {
|
|
2030
2142
|
readonly 'c-autocomplete': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
2031
2143
|
readonly 'c-data-table': readonly ["texts"];
|
|
2032
|
-
readonly 'c-date-picker': readonly ["firstDayOfWeek", "format", "hideDetails", "labelOnTop", "shadow", "showWeekNumbers", "size", "texts"];
|
|
2033
|
-
readonly 'c-number-field': readonly ["decimalSeparator", "decimals", "fixedDecimals", "groupSeparator", "hideDetails", "labelOnTop", "shadow", "size"];
|
|
2144
|
+
readonly 'c-date-picker': readonly ["firstDayOfWeek", "format", "hideDetails", "labelOnTop", "shadow", "showToday", "showWeekNumbers", "size", "texts"];
|
|
2145
|
+
readonly 'c-number-field': readonly ["decimalSeparator", "decimals", "fixedDecimals", "groupSeparator", "hideDetails", "labelOnTop", "shadow", "size", "step", "texts"];
|
|
2034
2146
|
readonly 'c-select': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
2035
2147
|
readonly 'c-text-field': readonly ["hideDetails", "labelOnTop", "shadow", "size"];
|
|
2148
|
+
readonly 'c-time-picker': readonly ["format", "hideDetails", "labelOnTop", "shadow", "showNow", "size", "texts"];
|
|
2036
2149
|
readonly 'c-tree-select': readonly ["hideDetails", "itemsPerPage", "labelOnTop", "shadow", "size", "texts"];
|
|
2037
2150
|
};
|
|
2038
2151
|
/** Tags dispatching the v-model contract event `update:value` — the value controls (CONTEXT.md). */
|
|
2039
|
-
export declare const VALUE_TAGS: readonly ["c-accordion", "c-autocomplete", "c-button-group", "c-checkbox", "c-date-picker", "c-modal", "c-number-field", "c-otp-input", "c-pagination", "c-radio-group", "c-select", "c-slider", "c-switch", "c-tabs", "c-text-field", "c-tree-select"];
|
|
2152
|
+
export declare const VALUE_TAGS: readonly ["c-accordion", "c-autocomplete", "c-button-group", "c-checkbox", "c-date-picker", "c-modal", "c-number-field", "c-otp-input", "c-pagination", "c-radio-group", "c-select", "c-slider", "c-switch", "c-tabs", "c-text-field", "c-time-picker", "c-tree-select"];
|
|
2040
2153
|
declare global {
|
|
2041
2154
|
interface HTMLElementTagNameMap {
|
|
2042
2155
|
'c-accordion': CAccordionElement;
|
|
@@ -2108,6 +2221,7 @@ declare global {
|
|
|
2108
2221
|
'c-tag': CTagElement;
|
|
2109
2222
|
'c-tags': CTagsElement;
|
|
2110
2223
|
'c-text-field': CTextFieldElement;
|
|
2224
|
+
'c-time-picker': CTimePickerElement;
|
|
2111
2225
|
'c-toast': CToastElement;
|
|
2112
2226
|
'c-toasts': CToastsElement;
|
|
2113
2227
|
'c-toolbar': CToolbarElement;
|
package/package.json
CHANGED