@cscfi/csc-ui 4.0.0-alpha.14 → 4.0.0-alpha.16
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 +7427 -7139
- package/dist/custom-elements.json +264 -56
- package/dist/docs/c-autocomplete/usage.md +25 -2
- package/dist/docs/c-button-group/usage.md +1 -1
- package/dist/docs/c-select/usage.md +25 -2
- package/dist/docs/c-tree-select/usage.md +25 -2
- package/dist/vscode.css-custom-data.json +48 -0
- package/dist/vscode.html-custom-data.json +14 -4
- package/dist/web-types.json +83 -15
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +32 -8
- package/dist-types/components/c-button/CButton.vue.d.ts +1 -1
- package/dist-types/components/c-button-group/CButtonGroup.vue.d.ts +1 -1
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +1 -1
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +5 -1
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +24 -10
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +1 -1
- package/dist-types/components/c-input/CInput.vue.d.ts +2 -2
- package/dist-types/components/c-otp-input/COtpInput.vue.d.ts +1 -1
- package/dist-types/components/c-pagination/CPagination.vue.d.ts +1 -1
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +1 -1
- package/dist-types/components/c-select/CSelect.vue.d.ts +32 -8
- package/dist-types/components/c-switch/CSwitch.vue.d.ts +1 -1
- package/dist-types/components/c-tag/CTag.vue.d.ts +1 -1
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +11 -4
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +17 -3
- package/dist-types/index.d.ts +2 -0
- package/dist-types/shared/FormLabel.vue.d.ts +1 -1
- package/dist-types/shared/PanelHeadingRow.vue.d.ts +13 -0
- package/dist-types/shared/appDefaults.d.ts +75 -0
- package/dist-types/shared/defineElement.d.ts +1 -0
- package/dist-types/shared/lightDismiss.d.ts +35 -0
- package/dist-types/shared/modalStack.d.ts +4 -3
- package/dist-types/shared/pageLock.d.ts +26 -0
- package/dist-types/shared/popoverChain.d.ts +9 -6
- package/dist-types/shared/useAnchoredPanel.d.ts +34 -13
- package/dist-types/shared/useNarrowViewport.d.ts +19 -0
- package/dist-types/shared/visualViewport.d.ts +51 -0
- package/dist-types/tag-name-map.d.ts +36 -7
- package/package.json +13 -4
|
@@ -44,7 +44,11 @@ export interface CAutocompleteProps {
|
|
|
44
44
|
external?: boolean;
|
|
45
45
|
/** Custom filter predicate; receives a normalized option + the query. Ignored when `external` is set */
|
|
46
46
|
filter?: CAutocompleteFilter;
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Hide the hint and error messages
|
|
49
|
+
*
|
|
50
|
+
* @defaultable false
|
|
51
|
+
*/
|
|
48
52
|
hideDetails?: boolean;
|
|
49
53
|
/**
|
|
50
54
|
* Hint text for the input
|
|
@@ -60,7 +64,11 @@ export interface CAutocompleteProps {
|
|
|
60
64
|
hostId?: string;
|
|
61
65
|
/** Dropdown items (when not using <c-option> elements) */
|
|
62
66
|
items?: CAutocompleteItem[];
|
|
63
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Items per page before the list scrolls
|
|
69
|
+
*
|
|
70
|
+
* @defaultable 6
|
|
71
|
+
*/
|
|
64
72
|
itemsPerPage?: number;
|
|
65
73
|
/**
|
|
66
74
|
* Element label
|
|
@@ -68,7 +76,11 @@ export interface CAutocompleteProps {
|
|
|
68
76
|
* @freeform
|
|
69
77
|
*/
|
|
70
78
|
label?: string;
|
|
71
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Label on top of the input
|
|
81
|
+
*
|
|
82
|
+
* @defaultable false
|
|
83
|
+
*/
|
|
72
84
|
labelOnTop?: boolean;
|
|
73
85
|
/** Show loading state */
|
|
74
86
|
loading?: boolean;
|
|
@@ -110,13 +122,23 @@ export interface CAutocompleteProps {
|
|
|
110
122
|
* unselects them. Ignored in single mode
|
|
111
123
|
*/
|
|
112
124
|
selectAll?: boolean;
|
|
113
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Shadow variant
|
|
127
|
+
*
|
|
128
|
+
* @defaultable false
|
|
129
|
+
*/
|
|
114
130
|
shadow?: boolean;
|
|
115
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Field height: the 44px default or the 36px `small` box
|
|
133
|
+
*
|
|
134
|
+
* @defaultable 'default'
|
|
135
|
+
*/
|
|
116
136
|
size?: CFieldSize;
|
|
117
137
|
/**
|
|
118
138
|
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
119
139
|
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
140
|
+
*
|
|
141
|
+
* @defaultable {}
|
|
120
142
|
*/
|
|
121
143
|
texts?: CAutocompleteTexts;
|
|
122
144
|
/** Set the validity of the input */
|
|
@@ -135,6 +157,8 @@ export interface CAutocompleteProps {
|
|
|
135
157
|
export interface CAutocompleteTexts {
|
|
136
158
|
/** Accessible label of the clear button. */
|
|
137
159
|
clearSelection?: string;
|
|
160
|
+
/** Accessible label of the close button in the fullscreen panel (narrow viewports). */
|
|
161
|
+
closePanel?: string;
|
|
138
162
|
/** Accessible label of the search input inside the panel. */
|
|
139
163
|
filterOptions?: string;
|
|
140
164
|
/** Text of the loading row shown while `loading` with nothing to list. */
|
|
@@ -180,8 +204,10 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CAutoc
|
|
|
180
204
|
value: CAutocompleteValue;
|
|
181
205
|
name: string;
|
|
182
206
|
multiple: boolean;
|
|
183
|
-
|
|
207
|
+
required: boolean;
|
|
184
208
|
disabled: boolean;
|
|
209
|
+
size: CFieldSize;
|
|
210
|
+
clearable: boolean;
|
|
185
211
|
errorMessage: string;
|
|
186
212
|
external: boolean;
|
|
187
213
|
hideDetails: boolean;
|
|
@@ -193,11 +219,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CAutoc
|
|
|
193
219
|
loading: boolean;
|
|
194
220
|
maxTags: number;
|
|
195
221
|
placeholder: string;
|
|
196
|
-
required: boolean;
|
|
197
222
|
returnObject: boolean;
|
|
198
223
|
selectAll: boolean;
|
|
199
224
|
shadow: boolean;
|
|
200
|
-
size: CFieldSize;
|
|
201
225
|
texts: CAutocompleteTexts;
|
|
202
226
|
valid: boolean;
|
|
203
227
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
@@ -120,9 +120,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CButto
|
|
|
120
120
|
value: number | string;
|
|
121
121
|
type: CButtonType;
|
|
122
122
|
disabled: boolean;
|
|
123
|
+
size: CButtonSize;
|
|
123
124
|
hostId: string;
|
|
124
125
|
loading: boolean;
|
|
125
|
-
size: CButtonSize;
|
|
126
126
|
active: boolean;
|
|
127
127
|
danger: boolean;
|
|
128
128
|
fit: boolean;
|
|
@@ -53,8 +53,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CButto
|
|
|
53
53
|
value: CButtonGroupValue;
|
|
54
54
|
mandatory: boolean;
|
|
55
55
|
multiple: boolean;
|
|
56
|
-
disabled: boolean;
|
|
57
56
|
required: boolean;
|
|
57
|
+
disabled: boolean;
|
|
58
58
|
size: CButtonGroupSize;
|
|
59
59
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
60
60
|
default?: (props: {}) => any;
|
|
@@ -97,12 +97,12 @@ type __VLS_Slots = {} & {
|
|
|
97
97
|
declare const __VLS_base: import("vue").DefineComponent<CCheckboxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CCheckboxProps> & Readonly<{}>, {
|
|
98
98
|
label: string;
|
|
99
99
|
value: boolean | number | string;
|
|
100
|
+
required: boolean;
|
|
100
101
|
disabled: boolean;
|
|
101
102
|
errorMessage: string;
|
|
102
103
|
hideDetails: boolean;
|
|
103
104
|
hint: string;
|
|
104
105
|
hostId: string;
|
|
105
|
-
required: boolean;
|
|
106
106
|
valid: boolean;
|
|
107
107
|
checked: boolean;
|
|
108
108
|
falseValue: boolean | number | string;
|
|
@@ -147,7 +147,11 @@ export interface CDataTableProps {
|
|
|
147
147
|
stickyFooter?: boolean;
|
|
148
148
|
/** Keep the header row visible while the table scrolls vertically. */
|
|
149
149
|
stickyHeader?: boolean;
|
|
150
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* UI text overrides (i18n), merged over the English defaults.
|
|
152
|
+
*
|
|
153
|
+
* @defaultable {}
|
|
154
|
+
*/
|
|
151
155
|
texts?: CDataTableTexts;
|
|
152
156
|
}
|
|
153
157
|
/** A single data row — the consumer's own plain domain object. */
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
type CDropdownItemType = 'item' | 'option';
|
|
2
2
|
type CDropdownParentType = 'autocomplete' | 'select';
|
|
3
3
|
interface CDropdownProps {
|
|
4
|
+
/**
|
|
5
|
+
* Accessible label of the fullscreen panel's close button (narrow viewports)
|
|
6
|
+
*
|
|
7
|
+
* @freeform
|
|
8
|
+
*/
|
|
9
|
+
closeLabel?: string;
|
|
4
10
|
/** Whether items are <c-option> elements or plain objects */
|
|
5
11
|
dropdownItemType?: CDropdownItemType;
|
|
6
12
|
/**
|
|
@@ -15,6 +21,12 @@ interface CDropdownProps {
|
|
|
15
21
|
items?: ArrayLike<DropdownItem>;
|
|
16
22
|
/** Items per page before adding scroll */
|
|
17
23
|
itemsPerPage?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The parent field's label, shown as the fullscreen panel's heading (narrow viewports)
|
|
26
|
+
*
|
|
27
|
+
* @freeform
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
18
30
|
/**
|
|
19
31
|
* Multi-select mode: rows toggle instead of committing, each carries a
|
|
20
32
|
* decorative checkbox indicator, and the listbox is `aria-multiselectable`
|
|
@@ -36,13 +48,6 @@ interface CDropdownProps {
|
|
|
36
48
|
/** Parent type — drives autocomplete-only behaviour (highlight, messages) */
|
|
37
49
|
type?: CDropdownParentType;
|
|
38
50
|
}
|
|
39
|
-
type DropdownItem = {
|
|
40
|
-
disabled?: boolean | string;
|
|
41
|
-
name: string;
|
|
42
|
-
outerHTML?: string;
|
|
43
|
-
selected?: boolean;
|
|
44
|
-
value: number | string;
|
|
45
|
-
};
|
|
46
51
|
/**
|
|
47
52
|
* The select-all row as the parent computes it (ADR-0046): the label, the
|
|
48
53
|
* indicator's tri-state and the counts the live region speaks.
|
|
@@ -53,13 +58,20 @@ interface CDropdownSelectAllRow {
|
|
|
53
58
|
state: 'all' | 'none' | 'some';
|
|
54
59
|
total: number;
|
|
55
60
|
}
|
|
56
|
-
|
|
61
|
+
type DropdownItem = {
|
|
62
|
+
disabled?: boolean | string;
|
|
63
|
+
name: string;
|
|
64
|
+
outerHTML?: string;
|
|
65
|
+
selected?: boolean;
|
|
66
|
+
value: number | string;
|
|
67
|
+
};
|
|
68
|
+
declare var __VLS_1: {}, __VLS_10: {}, __VLS_27: {};
|
|
57
69
|
type __VLS_Slots = {} & {
|
|
58
70
|
default?: (props: typeof __VLS_1) => any;
|
|
59
71
|
} & {
|
|
60
|
-
'input-top'?: (props: typeof
|
|
72
|
+
'input-top'?: (props: typeof __VLS_10) => any;
|
|
61
73
|
} & {
|
|
62
|
-
'input-bottom'?: (props: typeof
|
|
74
|
+
'input-bottom'?: (props: typeof __VLS_27) => any;
|
|
63
75
|
};
|
|
64
76
|
declare const __VLS_base: import("vue").DefineComponent<CDropdownProps, {
|
|
65
77
|
close: () => void;
|
|
@@ -69,12 +81,14 @@ declare const __VLS_base: import("vue").DefineComponent<CDropdownProps, {
|
|
|
69
81
|
setStatusText: (text: string) => void;
|
|
70
82
|
updateList: (reset?: boolean) => void;
|
|
71
83
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CDropdownProps> & Readonly<{}>, {
|
|
84
|
+
label: string;
|
|
72
85
|
type: CDropdownParentType;
|
|
73
86
|
multiple: boolean;
|
|
74
87
|
hostId: string;
|
|
75
88
|
items: ArrayLike<DropdownItem>;
|
|
76
89
|
itemsPerPage: number;
|
|
77
90
|
selected: (number | string)[];
|
|
91
|
+
closeLabel: string;
|
|
78
92
|
dropdownItemType: CDropdownItemType;
|
|
79
93
|
index: null | number;
|
|
80
94
|
parent: HTMLElement | null;
|
|
@@ -73,8 +73,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CIconB
|
|
|
73
73
|
text: boolean;
|
|
74
74
|
outlined: boolean;
|
|
75
75
|
disabled: boolean;
|
|
76
|
-
loading: boolean;
|
|
77
76
|
size: CIconButtonSize;
|
|
77
|
+
loading: boolean;
|
|
78
78
|
danger: boolean;
|
|
79
79
|
ghost: boolean;
|
|
80
80
|
inverted: boolean;
|
|
@@ -81,14 +81,14 @@ type __VLS_Slots = {} & {
|
|
|
81
81
|
};
|
|
82
82
|
declare const __VLS_base: import("vue").DefineComponent<CInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CInputProps> & Readonly<{}>, {
|
|
83
83
|
label: string;
|
|
84
|
+
required: boolean;
|
|
84
85
|
disabled: boolean;
|
|
86
|
+
size: CFieldSize;
|
|
85
87
|
errorMessage: string;
|
|
86
88
|
hideDetails: boolean;
|
|
87
89
|
hint: string;
|
|
88
90
|
labelOnTop: boolean;
|
|
89
|
-
required: boolean;
|
|
90
91
|
shadow: boolean;
|
|
91
|
-
size: CFieldSize;
|
|
92
92
|
valid: boolean;
|
|
93
93
|
active: boolean;
|
|
94
94
|
filled: boolean;
|
|
@@ -69,10 +69,10 @@ declare const __VLS_base: import("vue").DefineComponent<COtpInputProps, {}, {},
|
|
|
69
69
|
label: string;
|
|
70
70
|
length: number;
|
|
71
71
|
value: string;
|
|
72
|
+
required: boolean;
|
|
72
73
|
errorMessage: string;
|
|
73
74
|
hideDetails: boolean;
|
|
74
75
|
hint: string;
|
|
75
|
-
required: boolean;
|
|
76
76
|
valid: boolean;
|
|
77
77
|
elementId: string;
|
|
78
78
|
hasAutofocus: boolean;
|
|
@@ -50,8 +50,8 @@ declare const _default: typeof __VLS_export;
|
|
|
50
50
|
export default _default;
|
|
51
51
|
declare const __VLS_export: import("vue").DefineComponent<CPaginationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CPaginationProps> & Readonly<{}>, {
|
|
52
52
|
value: CPaginationOptions;
|
|
53
|
-
hideDetails: boolean;
|
|
54
53
|
size: CPaginationSize;
|
|
54
|
+
hideDetails: boolean;
|
|
55
55
|
hideRange: boolean;
|
|
56
56
|
simple: boolean;
|
|
57
57
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -52,11 +52,11 @@ type __VLS_Slots = {} & {
|
|
|
52
52
|
declare const __VLS_base: import("vue").DefineComponent<CRadioGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CRadioGroupProps> & Readonly<{}>, {
|
|
53
53
|
label: string;
|
|
54
54
|
value: null | string;
|
|
55
|
+
required: boolean;
|
|
55
56
|
disabled: boolean;
|
|
56
57
|
errorMessage: string;
|
|
57
58
|
hideDetails: boolean;
|
|
58
59
|
hint: string;
|
|
59
|
-
required: boolean;
|
|
60
60
|
valid: boolean;
|
|
61
61
|
inline: boolean;
|
|
62
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -10,7 +10,11 @@ export interface CSelectProps {
|
|
|
10
10
|
* @freeform
|
|
11
11
|
*/
|
|
12
12
|
errorMessage?: string;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Hide the hint and error messages
|
|
15
|
+
*
|
|
16
|
+
* @defaultable false
|
|
17
|
+
*/
|
|
14
18
|
hideDetails?: boolean;
|
|
15
19
|
/**
|
|
16
20
|
* Hint text for the input
|
|
@@ -26,7 +30,11 @@ export interface CSelectProps {
|
|
|
26
30
|
hostId?: string;
|
|
27
31
|
/** Dropdown items (when not using <c-option> elements) */
|
|
28
32
|
items?: CSelectItem[];
|
|
29
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Items per page before adding scroll
|
|
35
|
+
*
|
|
36
|
+
* @defaultable 6
|
|
37
|
+
*/
|
|
30
38
|
itemsPerPage?: number;
|
|
31
39
|
/**
|
|
32
40
|
* Element label
|
|
@@ -34,7 +42,11 @@ export interface CSelectProps {
|
|
|
34
42
|
* @freeform
|
|
35
43
|
*/
|
|
36
44
|
label?: string;
|
|
37
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Label on top of the input
|
|
47
|
+
*
|
|
48
|
+
* @defaultable false
|
|
49
|
+
*/
|
|
38
50
|
labelOnTop?: boolean;
|
|
39
51
|
/** Show loading state */
|
|
40
52
|
loading?: boolean;
|
|
@@ -77,13 +89,23 @@ export interface CSelectProps {
|
|
|
77
89
|
* unselects them. Ignored in single mode
|
|
78
90
|
*/
|
|
79
91
|
selectAll?: boolean;
|
|
80
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Shadow variant
|
|
94
|
+
*
|
|
95
|
+
* @defaultable false
|
|
96
|
+
*/
|
|
81
97
|
shadow?: boolean;
|
|
82
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Field height: the 44px default or the 36px `small` box
|
|
100
|
+
*
|
|
101
|
+
* @defaultable 'default'
|
|
102
|
+
*/
|
|
83
103
|
size?: CFieldSize;
|
|
84
104
|
/**
|
|
85
105
|
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
86
106
|
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
107
|
+
*
|
|
108
|
+
* @defaultable {}
|
|
87
109
|
*/
|
|
88
110
|
texts?: CSelectTexts;
|
|
89
111
|
/** Set the validity of the input */
|
|
@@ -101,6 +123,8 @@ export interface CSelectProps {
|
|
|
101
123
|
export interface CSelectTexts {
|
|
102
124
|
/** Accessible label of the clear button. */
|
|
103
125
|
clearSelection?: string;
|
|
126
|
+
/** Accessible label of the close button in the fullscreen panel (narrow viewports). */
|
|
127
|
+
closePanel?: string;
|
|
104
128
|
/**
|
|
105
129
|
* Text of the overflow tag when `max-tags` folds the selection; receives the
|
|
106
130
|
* number of hidden tags.
|
|
@@ -137,8 +161,10 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CSelec
|
|
|
137
161
|
value: CSelectValue;
|
|
138
162
|
name: string;
|
|
139
163
|
multiple: boolean;
|
|
140
|
-
|
|
164
|
+
required: boolean;
|
|
141
165
|
disabled: boolean;
|
|
166
|
+
size: CFieldSize;
|
|
167
|
+
clearable: boolean;
|
|
142
168
|
errorMessage: string;
|
|
143
169
|
hideDetails: boolean;
|
|
144
170
|
hint: string;
|
|
@@ -149,11 +175,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CSelec
|
|
|
149
175
|
loading: boolean;
|
|
150
176
|
maxTags: number;
|
|
151
177
|
placeholder: string;
|
|
152
|
-
required: boolean;
|
|
153
178
|
returnObject: boolean;
|
|
154
179
|
selectAll: boolean;
|
|
155
180
|
shadow: boolean;
|
|
156
|
-
size: CFieldSize;
|
|
157
181
|
texts: CSelectTexts;
|
|
158
182
|
valid: boolean;
|
|
159
183
|
optionAsSelection: boolean;
|
|
@@ -62,10 +62,10 @@ type __VLS_Slots = {} & {
|
|
|
62
62
|
declare const __VLS_base: import("vue").DefineComponent<CSwitchProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CSwitchProps> & Readonly<{}>, {
|
|
63
63
|
label: string;
|
|
64
64
|
value: boolean | number | string;
|
|
65
|
+
required: boolean;
|
|
65
66
|
disabled: boolean;
|
|
66
67
|
hostId: string;
|
|
67
68
|
loading: boolean;
|
|
68
|
-
required: boolean;
|
|
69
69
|
checked: boolean;
|
|
70
70
|
falseValue: boolean | number | string;
|
|
71
71
|
trueValue: boolean | number | string;
|
|
@@ -47,9 +47,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTagPr
|
|
|
47
47
|
flat: boolean;
|
|
48
48
|
size: CTagSize;
|
|
49
49
|
active: boolean;
|
|
50
|
+
closeLabel: string;
|
|
50
51
|
badge: null | number | string;
|
|
51
52
|
closeable: boolean;
|
|
52
|
-
closeLabel: string;
|
|
53
53
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
54
54
|
default?: (props: {}) => any;
|
|
55
55
|
}>;
|
|
@@ -40,6 +40,7 @@ export interface CTextFieldProps {
|
|
|
40
40
|
* Hide the hint and error messages
|
|
41
41
|
*
|
|
42
42
|
* @seeded from csc-ui — verify
|
|
43
|
+
* @defaultable false
|
|
43
44
|
*/
|
|
44
45
|
hideDetails?: boolean;
|
|
45
46
|
/**
|
|
@@ -67,6 +68,7 @@ export interface CTextFieldProps {
|
|
|
67
68
|
* Label on top of the input
|
|
68
69
|
*
|
|
69
70
|
* @seeded from csc-ui — verify
|
|
71
|
+
* @defaultable false
|
|
70
72
|
*/
|
|
71
73
|
labelOnTop?: boolean;
|
|
72
74
|
/**
|
|
@@ -117,9 +119,14 @@ export interface CTextFieldProps {
|
|
|
117
119
|
* Shadow variant of the input
|
|
118
120
|
*
|
|
119
121
|
* @seeded from csc-ui — verify
|
|
122
|
+
* @defaultable false
|
|
120
123
|
*/
|
|
121
124
|
shadow?: boolean;
|
|
122
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Field height: the 44px default or the 36px `small` box (single-line fields)
|
|
127
|
+
*
|
|
128
|
+
* @defaultable 'default'
|
|
129
|
+
*/
|
|
123
130
|
size?: CFieldSize;
|
|
124
131
|
/**
|
|
125
132
|
* Step size on a numeric input
|
|
@@ -166,17 +173,17 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTextF
|
|
|
166
173
|
value: string;
|
|
167
174
|
type: CTextFieldType;
|
|
168
175
|
name: string;
|
|
169
|
-
|
|
176
|
+
required: boolean;
|
|
170
177
|
disabled: boolean;
|
|
178
|
+
size: CFieldSize;
|
|
179
|
+
autocorrect: boolean;
|
|
171
180
|
errorMessage: string;
|
|
172
181
|
hideDetails: boolean;
|
|
173
182
|
hint: string;
|
|
174
183
|
hostId: string;
|
|
175
184
|
labelOnTop: boolean;
|
|
176
185
|
placeholder: string;
|
|
177
|
-
required: boolean;
|
|
178
186
|
shadow: boolean;
|
|
179
|
-
size: CFieldSize;
|
|
180
187
|
valid: boolean;
|
|
181
188
|
max: null | number;
|
|
182
189
|
min: null | number;
|
|
@@ -57,6 +57,8 @@ export interface CTreeSelectProps {
|
|
|
57
57
|
filter?: CTreeSelectFilter;
|
|
58
58
|
/**
|
|
59
59
|
* Hide the hint and error messages
|
|
60
|
+
*
|
|
61
|
+
* @defaultable false
|
|
60
62
|
*/
|
|
61
63
|
hideDetails?: boolean;
|
|
62
64
|
/**
|
|
@@ -78,6 +80,8 @@ export interface CTreeSelectProps {
|
|
|
78
80
|
items?: CTreeSelectItem[];
|
|
79
81
|
/**
|
|
80
82
|
* Items per page before the list scrolls
|
|
83
|
+
*
|
|
84
|
+
* @defaultable 6
|
|
81
85
|
*/
|
|
82
86
|
itemsPerPage?: number;
|
|
83
87
|
/**
|
|
@@ -88,6 +92,8 @@ export interface CTreeSelectProps {
|
|
|
88
92
|
label?: string;
|
|
89
93
|
/**
|
|
90
94
|
* Label on top of the field
|
|
95
|
+
*
|
|
96
|
+
* @defaultable false
|
|
91
97
|
*/
|
|
92
98
|
labelOnTop?: boolean;
|
|
93
99
|
/**
|
|
@@ -119,15 +125,21 @@ export interface CTreeSelectProps {
|
|
|
119
125
|
returnObject?: boolean;
|
|
120
126
|
/**
|
|
121
127
|
* Shadow variant
|
|
128
|
+
*
|
|
129
|
+
* @defaultable false
|
|
122
130
|
*/
|
|
123
131
|
shadow?: boolean;
|
|
124
132
|
/**
|
|
125
133
|
* Field height: the 44px default or the 36px `small` box
|
|
134
|
+
*
|
|
135
|
+
* @defaultable 'default'
|
|
126
136
|
*/
|
|
127
137
|
size?: CFieldSize;
|
|
128
138
|
/**
|
|
129
139
|
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
130
140
|
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
141
|
+
*
|
|
142
|
+
* @defaultable {}
|
|
131
143
|
*/
|
|
132
144
|
texts?: CTreeSelectTexts;
|
|
133
145
|
/**
|
|
@@ -180,6 +192,8 @@ export interface CTreeSelectTexts {
|
|
|
180
192
|
choose?: (levelLabel: string) => string;
|
|
181
193
|
/** Accessible label of the clear button. */
|
|
182
194
|
clearSelection?: string;
|
|
195
|
+
/** Accessible label of the close button in the fullscreen panel (narrow viewports). */
|
|
196
|
+
closePanel?: string;
|
|
183
197
|
/** Accessible label of the search input inside the panel. */
|
|
184
198
|
filterOptions?: string;
|
|
185
199
|
/**
|
|
@@ -226,8 +240,10 @@ declare const __VLS_export: import("vue").DefineComponent<CTreeSelectProps, {},
|
|
|
226
240
|
filter: CTreeSelectFilter;
|
|
227
241
|
value: CTreeSelectValue;
|
|
228
242
|
name: string;
|
|
229
|
-
|
|
243
|
+
required: boolean;
|
|
230
244
|
disabled: boolean;
|
|
245
|
+
size: CFieldSize;
|
|
246
|
+
clearable: boolean;
|
|
231
247
|
errorMessage: string;
|
|
232
248
|
hideDetails: boolean;
|
|
233
249
|
hint: string;
|
|
@@ -236,10 +252,8 @@ declare const __VLS_export: import("vue").DefineComponent<CTreeSelectProps, {},
|
|
|
236
252
|
itemsPerPage: number;
|
|
237
253
|
labelOnTop: boolean;
|
|
238
254
|
placeholder: string;
|
|
239
|
-
required: boolean;
|
|
240
255
|
returnObject: boolean;
|
|
241
256
|
shadow: boolean;
|
|
242
|
-
size: CFieldSize;
|
|
243
257
|
texts: CTreeSelectTexts;
|
|
244
258
|
valid: boolean;
|
|
245
259
|
allowBranch: boolean;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export type { CTreeSelectFilter, CTreeSelectItem, CTreeSelectProps, CTreeSelectS
|
|
|
24
24
|
export type * from './tag-name-map';
|
|
25
25
|
export { applyTheme, resetTheme, themeToCss } from './theme/applyTheme';
|
|
26
26
|
export type { Family, ThemeSeeds } from './theme/applyTheme';
|
|
27
|
+
export { applyDefaults, DEFAULTABLE_PROPS, resetDefaults, } from './shared/appDefaults';
|
|
28
|
+
export type { AppDefaults, DefaultableTag } from './shared/appDefaults';
|
|
27
29
|
export { chartAnatomy, chartAnatomyHex, chartSlots, chartSlotsHex, } from './theme/chart-data';
|
|
28
30
|
export type { ChartAnatomy, ChartSlots } from './theme/chart-data';
|
|
29
31
|
export { DEFAULT_SEEDS, FAMILIES } from './theme/ramp.js';
|
|
@@ -20,9 +20,9 @@ declare const __VLS_base: import("vue").DefineComponent<FormLabelProps, {}, {},
|
|
|
20
20
|
label: string;
|
|
21
21
|
part: string;
|
|
22
22
|
required: boolean;
|
|
23
|
-
tag: "div" | "label" | "span";
|
|
24
23
|
htmlFor: string;
|
|
25
24
|
labelId: string;
|
|
25
|
+
tag: "div" | "label" | "span";
|
|
26
26
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
27
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
28
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Accessible label of the close button. */
|
|
3
|
+
closeLabel: string;
|
|
4
|
+
/** The field's label, shown as the panel heading. */
|
|
5
|
+
heading: string;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
close: () => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onClose?: (() => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-wide prop defaults (ADR-0048).
|
|
3
|
+
*
|
|
4
|
+
* A consumer sets a *defaultable* prop once for every instance of a tag —
|
|
5
|
+
* `labelOnTop` on every text field, one `texts` translation per list field —
|
|
6
|
+
* instead of repeating it per instance:
|
|
7
|
+
*
|
|
8
|
+
* applyDefaults({ 'c-text-field': { labelOnTop: true } });
|
|
9
|
+
*
|
|
10
|
+
* Only props tagged `@defaultable <built-in>` in their SFC take part; the
|
|
11
|
+
* analyzer derives the `AppDefaults` type and the `DEFAULTABLE_PROPS`
|
|
12
|
+
* allow-list from those tags (src/tag-name-map.ts). Each such prop declares
|
|
13
|
+
* `undefined` in `withDefaults` — so "unset" is observable — and resolves
|
|
14
|
+
* through `useAppDefault` below, in this order:
|
|
15
|
+
*
|
|
16
|
+
* host attribute → own property (non-nullish) → app default → built-in
|
|
17
|
+
*
|
|
18
|
+
* Why the host attribute comes first — two Vue `defineCustomElement` quirks:
|
|
19
|
+
* 1. A Boolean prop supplied via *attribute* (`<c-select hide-details>`)
|
|
20
|
+
* has been observed to reset to its default on the wrapper's re-render
|
|
21
|
+
* (it re-renders on every value change): the host attribute persists,
|
|
22
|
+
* but the prop flips. The attribute is the stable signal.
|
|
23
|
+
* 2. Binding `hide-details` to a nested `c-input` in a template is mangled
|
|
24
|
+
* on update — the key matches c-input's declared prop, so Vue treats it
|
|
25
|
+
* as a property, and the reset above reflects back out and removes the
|
|
26
|
+
* attribute. Wrappers therefore forward it through a plain
|
|
27
|
+
* `data-hide-details` attribute (no declared-prop collision, so Vue
|
|
28
|
+
* patches it reliably) that c-input reads back.
|
|
29
|
+
* Property writes reflect to attributes as well (`el.size = 'small'` writes
|
|
30
|
+
* `size="small"`, `el.labelOnTop = false` removes the attribute), so one
|
|
31
|
+
* attribute-first order is sound for Booleans, strings and numbers alike.
|
|
32
|
+
*
|
|
33
|
+
* The registry is a module-level `reactive()` object and every resolved
|
|
34
|
+
* computed depends on it, so a later `applyDefaults()` re-renders mounted
|
|
35
|
+
* elements (runtime language switching). Not provide/inject: the library
|
|
36
|
+
* coordinates through module singletons (modalStack, popoverChain,
|
|
37
|
+
* applyTheme), and a per-element app context would not be live for trees
|
|
38
|
+
* that are already mounted.
|
|
39
|
+
*/
|
|
40
|
+
import { type ComputedRef } from 'vue';
|
|
41
|
+
import { type AppDefaults } from '../tag-name-map';
|
|
42
|
+
export type { AppDefaults } from '../tag-name-map';
|
|
43
|
+
export { DEFAULTABLE_PROPS } from '../tag-name-map';
|
|
44
|
+
/** A tag with at least one defaultable prop. */
|
|
45
|
+
export type DefaultableTag = keyof AppDefaults;
|
|
46
|
+
type Bucket<T extends DefaultableTag> = NonNullable<AppDefaults[T]>;
|
|
47
|
+
/** The value a resolved prop takes: the element member type, made required. */
|
|
48
|
+
type Resolved<T extends DefaultableTag, K extends keyof Bucket<T>> = Required<NonNullable<Bucket<T>[K]>>;
|
|
49
|
+
/**
|
|
50
|
+
* Set app-wide defaults. Merges with previously applied defaults tag by tag;
|
|
51
|
+
* a key set to `undefined` clears that key. An object prop (`texts`) is stored
|
|
52
|
+
* whole and merged key by key with the built-in and per-instance texts at each
|
|
53
|
+
* element. Live: mounted elements re-render. No-op outside the browser — a
|
|
54
|
+
* module-level registry must not leak across server requests, and custom
|
|
55
|
+
* elements never render on the server.
|
|
56
|
+
*/
|
|
57
|
+
export declare function applyDefaults(defaults: AppDefaults): void;
|
|
58
|
+
/** Clear the app-wide defaults of the given tags, or of every tag when omitted. */
|
|
59
|
+
export declare function resetDefaults(tags?: DefaultableTag[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Per-instance resolver for defaultable props. Call once in setup, then one
|
|
62
|
+
* line per prop:
|
|
63
|
+
*
|
|
64
|
+
* const appDefault = useAppDefault('c-text-field', props);
|
|
65
|
+
* const labelOnTopResolved = appDefault('labelOnTop', false);
|
|
66
|
+
*
|
|
67
|
+
* Scalars: host attribute → own property (non-nullish) → app default →
|
|
68
|
+
* built-in, with Boolean coercion applied *after* the layer is chosen
|
|
69
|
+
* (`coerceBoolean(undefined)` is `false` and would swallow the fallthrough).
|
|
70
|
+
* Objects (`texts`): per-key merge, built-in ← app default ← own.
|
|
71
|
+
*
|
|
72
|
+
* A nullish own value counts as "unset" (Vue itself treats `null` as an
|
|
73
|
+
* explicit value; here it falls through to the app default).
|
|
74
|
+
*/
|
|
75
|
+
export declare const useAppDefault: <T extends DefaultableTag>(tag: T, props: object) => <K extends keyof Bucket<T> & string>(key: K, builtIn: Resolved<T, K>) => ComputedRef<Resolved<T, K>>;
|