@cscfi/csc-ui 4.0.0-alpha.2 → 4.0.0-alpha.20
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 +10192 -7248
- package/dist/custom-elements.json +2278 -257
- package/dist/docs/c-alert/usage.md +24 -0
- package/dist/docs/c-autocomplete/usage.md +152 -0
- package/dist/docs/c-button-group/usage.md +14 -1
- package/dist/docs/c-checkbox/usage.md +53 -0
- package/dist/docs/c-main/usage.md +21 -1
- package/dist/docs/c-menu/usage.md +15 -0
- package/dist/docs/c-menu-item/usage.md +6 -0
- package/dist/docs/c-option-value/usage.md +1 -0
- package/dist/docs/c-popover/usage.md +33 -0
- package/dist/docs/c-progress-bar/usage.md +23 -0
- package/dist/docs/c-progress-circle/usage.md +25 -0
- package/dist/docs/c-radio/usage.md +45 -0
- package/dist/docs/c-radio-group/usage.md +67 -0
- package/dist/docs/c-select/usage.md +127 -0
- package/dist/docs/c-side-navigation/usage.md +21 -0
- package/dist/docs/c-spinner/usage.md +21 -0
- package/dist/docs/c-switch/usage.md +36 -0
- package/dist/docs/c-tab-buttons/usage.md +7 -0
- package/dist/docs/c-table/usage.md +14 -0
- package/dist/docs/c-toolbar/usage.md +17 -0
- package/dist/docs/c-tooltip/usage.md +30 -0
- package/dist/docs/c-tree-select/usage.md +156 -0
- package/dist/styles/css/tailwind-theme.css +32 -0
- package/dist/styles/css/tokens.css +707 -197
- package/dist/vscode.css-custom-data.json +286 -19
- package/dist/vscode.html-custom-data.json +334 -51
- package/dist/web-types.json +1200 -190
- package/dist-types/components/c-alert/CAlert.vue.d.ts +18 -4
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +118 -18
- 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 +3 -3
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +6 -2
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +48 -5
- package/dist-types/components/c-icon/CIcon.vue.d.ts +1 -1
- package/dist-types/components/c-icon-button/CIconButton.vue.d.ts +1 -1
- package/dist-types/components/c-input/CInput.vue.d.ts +6 -2
- package/dist-types/components/c-login-button/CLoginButton.vue.d.ts +4 -2
- package/dist-types/components/c-main/CMain.vue.d.ts +9 -2
- package/dist-types/components/c-menu/CMenu.vue.d.ts +14 -4
- package/dist-types/components/c-menu-item/CMenuItem.vue.d.ts +30 -3
- 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-popover/CPopover.vue.d.ts +43 -0
- package/dist-types/components/c-progress-circle/CProgressCircle.vue.d.ts +32 -0
- package/dist-types/components/c-radio/CRadio.vue.d.ts +7 -11
- package/dist-types/components/c-radio-group/CRadioGroup.vue.d.ts +9 -47
- package/dist-types/components/c-select/CSelect.vue.d.ts +115 -24
- package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +1 -1
- package/dist-types/components/c-spinner/CSpinner.vue.d.ts +1 -1
- package/dist-types/components/c-switch/CSwitch.vue.d.ts +1 -1
- package/dist-types/components/c-table/CTable.vue.d.ts +11 -1
- package/dist-types/components/c-table/injectTableStyles.d.ts +1 -0
- package/dist-types/components/c-tag/CTag.vue.d.ts +8 -1
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +15 -4
- package/dist-types/components/c-toolbar/CToolbar.vue.d.ts +10 -1
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +49 -0
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +261 -0
- package/dist-types/index.d.ts +14 -2
- package/dist-types/shared/FieldMessage.vue.d.ts +21 -0
- package/dist-types/shared/PanelHeadingRow.vue.d.ts +13 -0
- package/dist-types/shared/SelectionIndicator.vue.d.ts +21 -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/optionLabel.d.ts +18 -0
- package/dist-types/shared/pageLock.d.ts +26 -0
- package/dist-types/shared/peekCap.d.ts +35 -0
- package/dist-types/shared/popoverChain.d.ts +65 -0
- package/dist-types/shared/positionArea.d.ts +13 -0
- package/dist-types/shared/selectAll.d.ts +29 -0
- package/dist-types/shared/splitMatches.d.ts +18 -0
- package/dist-types/shared/useAnchoredPanel.d.ts +98 -0
- package/dist-types/shared/useDesignatedTrigger.d.ts +40 -0
- package/dist-types/shared/useHostStates.d.ts +25 -0
- package/dist-types/shared/useNarrowViewport.d.ts +19 -0
- package/dist-types/shared/useScrollStrip.d.ts +39 -0
- package/dist-types/shared/useStatusAnnouncer.d.ts +33 -0
- package/dist-types/shared/visualViewport.d.ts +51 -0
- package/dist-types/tag-name-map.d.ts +440 -51
- package/dist-types/theme/chart-data.d.ts +51 -0
- package/dist-types/theme/ramp.d.ts +38 -0
- package/dist-types/theme/themeMode.d.ts +51 -0
- package/dist-types/types.d.ts +13 -0
- package/package.json +19 -8
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import type { CFieldSize } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom search predicate for `c-tree-select`. Receives the item, the query
|
|
4
|
+
* and the item's ancestors root-first; return `true` to list the item. The
|
|
5
|
+
* default matches the query case-insensitively anywhere in the `name` or
|
|
6
|
+
* `code` of the item or of any of its ancestors.
|
|
7
|
+
*/
|
|
8
|
+
export type CTreeSelectFilter = (item: CTreeSelectItem, query: string, path: CTreeSelectItem[]) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* One item of a `c-tree-select` tree. An item with a non-empty `children`
|
|
11
|
+
* array is a branch; any other item is a leaf. Values must be unique across
|
|
12
|
+
* the whole tree.
|
|
13
|
+
*/
|
|
14
|
+
export interface CTreeSelectItem {
|
|
15
|
+
/** Child items; present and non-empty for a branch. */
|
|
16
|
+
children?: CTreeSelectItem[];
|
|
17
|
+
/**
|
|
18
|
+
* Short code shown before the name and matched by the search (a
|
|
19
|
+
* classification number, say).
|
|
20
|
+
*/
|
|
21
|
+
code?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Disable the item: a disabled branch cannot be entered, a disabled leaf
|
|
24
|
+
* cannot be committed.
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** The item's label. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** The item's value, unique across the tree. */
|
|
30
|
+
value: number | string;
|
|
31
|
+
}
|
|
32
|
+
export interface CTreeSelectProps {
|
|
33
|
+
/**
|
|
34
|
+
* Let a branch be committed as the value: a pinned select-branch row heads
|
|
35
|
+
* every level below the root, and matching branches are listed as search
|
|
36
|
+
* results
|
|
37
|
+
*/
|
|
38
|
+
allowBranch?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Make the selected value clearable
|
|
41
|
+
*/
|
|
42
|
+
clearable?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Disable the field
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Error message shown in place of the hint while the field is invalid
|
|
49
|
+
*
|
|
50
|
+
* @freeform
|
|
51
|
+
*/
|
|
52
|
+
errorMessage?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Custom search predicate; receives the item, the query and the item's
|
|
55
|
+
* ancestors. Functions have no attribute form — bind as a DOM property
|
|
56
|
+
*/
|
|
57
|
+
filter?: CTreeSelectFilter;
|
|
58
|
+
/**
|
|
59
|
+
* Hide the hint and error messages
|
|
60
|
+
*
|
|
61
|
+
* @defaultable false
|
|
62
|
+
*/
|
|
63
|
+
hideDetails?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Hint text for the field
|
|
66
|
+
*
|
|
67
|
+
* @freeform
|
|
68
|
+
*/
|
|
69
|
+
hint?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Id of the element
|
|
72
|
+
*
|
|
73
|
+
* @freeform
|
|
74
|
+
*/
|
|
75
|
+
hostId?: string;
|
|
76
|
+
/**
|
|
77
|
+
* The tree to pick from. Arrays have no attribute form — bind as a DOM
|
|
78
|
+
* property (`:items.prop` in Vue)
|
|
79
|
+
*/
|
|
80
|
+
items?: CTreeSelectItem[];
|
|
81
|
+
/**
|
|
82
|
+
* Items per page before the list scrolls
|
|
83
|
+
*
|
|
84
|
+
* @defaultable 6
|
|
85
|
+
*/
|
|
86
|
+
itemsPerPage?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Element label
|
|
89
|
+
*
|
|
90
|
+
* @freeform
|
|
91
|
+
*/
|
|
92
|
+
label?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Label on top of the field
|
|
95
|
+
*
|
|
96
|
+
* @defaultable false
|
|
97
|
+
*/
|
|
98
|
+
labelOnTop?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Names of the levels, top level first, shown in the panel header; a
|
|
101
|
+
* missing entry falls back to `texts.level(n)`. Arrays have no attribute
|
|
102
|
+
* form — bind as a DOM property
|
|
103
|
+
*/
|
|
104
|
+
levelLabels?: string[];
|
|
105
|
+
/**
|
|
106
|
+
* Input field name
|
|
107
|
+
*
|
|
108
|
+
* @freeform
|
|
109
|
+
*/
|
|
110
|
+
name?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Placeholder for the search input inside the panel
|
|
113
|
+
*
|
|
114
|
+
* @freeform
|
|
115
|
+
*/
|
|
116
|
+
placeholder?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Set the field as required
|
|
119
|
+
*/
|
|
120
|
+
required?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Emit the committed item with its path as a `CTreeSelectSelection` instead
|
|
123
|
+
* of its value
|
|
124
|
+
*/
|
|
125
|
+
returnObject?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Shadow variant
|
|
128
|
+
*
|
|
129
|
+
* @defaultable false
|
|
130
|
+
*/
|
|
131
|
+
shadow?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Field height: the 44px default or the 36px `small` box
|
|
134
|
+
*
|
|
135
|
+
* @defaultable 'default'
|
|
136
|
+
*/
|
|
137
|
+
size?: CFieldSize;
|
|
138
|
+
/**
|
|
139
|
+
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
140
|
+
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
141
|
+
*
|
|
142
|
+
* @defaultable {}
|
|
143
|
+
*/
|
|
144
|
+
texts?: CTreeSelectTexts;
|
|
145
|
+
/**
|
|
146
|
+
* Set the validity of the field
|
|
147
|
+
*/
|
|
148
|
+
valid?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Selected value: the committed item's value, or the `CTreeSelectSelection`
|
|
151
|
+
* with `return-object`; `null` when nothing is selected
|
|
152
|
+
*/
|
|
153
|
+
value?: CTreeSelectValue;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The committed item as emitted with `return-object`: a fresh object — never
|
|
157
|
+
* the `items` entry itself — with its ancestors root-first and without
|
|
158
|
+
* `children`.
|
|
159
|
+
*/
|
|
160
|
+
export interface CTreeSelectSelection {
|
|
161
|
+
/** The committed item's code, when it has one. */
|
|
162
|
+
code?: string;
|
|
163
|
+
/** The committed item's label. */
|
|
164
|
+
name: string;
|
|
165
|
+
/** The committed item's ancestors, root-first. */
|
|
166
|
+
path: Array<{
|
|
167
|
+
code?: string;
|
|
168
|
+
name: string;
|
|
169
|
+
value: number | string;
|
|
170
|
+
}>;
|
|
171
|
+
/** The committed item's value. */
|
|
172
|
+
value: number | string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* UI texts of `c-tree-select`, shallow-merged over the English defaults.
|
|
176
|
+
* Static labels are strings; interpolated ones are functions.
|
|
177
|
+
*/
|
|
178
|
+
export interface CTreeSelectTexts {
|
|
179
|
+
/** Accessible label of the breadcrumb navigation in the panel. */
|
|
180
|
+
breadcrumb?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Label of the "Browse instead" control shown in the header while a query
|
|
183
|
+
* is typed.
|
|
184
|
+
*/
|
|
185
|
+
browse?: string;
|
|
186
|
+
/** Meta text on a branch row; receives its number of children. */
|
|
187
|
+
children?: (count: number) => string;
|
|
188
|
+
/**
|
|
189
|
+
* Header text in browse mode; receives the label of the level being
|
|
190
|
+
* listed.
|
|
191
|
+
*/
|
|
192
|
+
choose?: (levelLabel: string) => string;
|
|
193
|
+
/** Accessible label of the clear button. */
|
|
194
|
+
clearSelection?: string;
|
|
195
|
+
/** Accessible label of the close button in the fullscreen panel (narrow viewports). */
|
|
196
|
+
closePanel?: string;
|
|
197
|
+
/** Accessible label of the search input inside the panel. */
|
|
198
|
+
filterOptions?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Header text of a level whose rows are all leaves in an unevenly deep
|
|
201
|
+
* tree (an evenly deep tree shows the step counter instead).
|
|
202
|
+
*/
|
|
203
|
+
final?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Default label of level `n` (1 = the top level) when `level-labels` gives
|
|
206
|
+
* none.
|
|
207
|
+
*/
|
|
208
|
+
level?: (n: number) => string;
|
|
209
|
+
/** Header text in search mode; receives the number of matches. */
|
|
210
|
+
matches?: (count: number) => string;
|
|
211
|
+
/** Text of the row shown when nothing is listed. */
|
|
212
|
+
noResults?: string;
|
|
213
|
+
/** Label of the root crumb. */
|
|
214
|
+
root?: string;
|
|
215
|
+
/** Placeholder of the search input when the `placeholder` prop is empty. */
|
|
216
|
+
searchPlaceholder?: string;
|
|
217
|
+
/**
|
|
218
|
+
* Label of the pinned select-branch row; receives the current branch's
|
|
219
|
+
* name.
|
|
220
|
+
*/
|
|
221
|
+
select?: (name: string) => string;
|
|
222
|
+
/**
|
|
223
|
+
* Header step counter shown while the tree is evenly deep (every leaf at
|
|
224
|
+
* one level); receives the step and the total number of levels.
|
|
225
|
+
*/
|
|
226
|
+
step?: (n: number, total: number) => string;
|
|
227
|
+
/** Accessible label of the chevron button that opens and closes the panel. */
|
|
228
|
+
toggleOptions?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Selection value of `c-tree-select`: the committed item's value — or a
|
|
232
|
+
* {@link CTreeSelectSelection} with `return-object` — and `null` when
|
|
233
|
+
* cleared.
|
|
234
|
+
*/
|
|
235
|
+
export type CTreeSelectValue = CTreeSelectSelection | null | number | string;
|
|
236
|
+
declare const _default: typeof __VLS_export;
|
|
237
|
+
export default _default;
|
|
238
|
+
declare const __VLS_export: import("vue").DefineComponent<CTreeSelectProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CTreeSelectProps> & Readonly<{}>, {
|
|
239
|
+
label: string;
|
|
240
|
+
filter: CTreeSelectFilter;
|
|
241
|
+
value: CTreeSelectValue;
|
|
242
|
+
name: string;
|
|
243
|
+
required: boolean;
|
|
244
|
+
disabled: boolean;
|
|
245
|
+
size: CFieldSize;
|
|
246
|
+
clearable: boolean;
|
|
247
|
+
errorMessage: string;
|
|
248
|
+
hideDetails: boolean;
|
|
249
|
+
hint: string;
|
|
250
|
+
hostId: string;
|
|
251
|
+
items: CTreeSelectItem[];
|
|
252
|
+
itemsPerPage: number;
|
|
253
|
+
labelOnTop: boolean;
|
|
254
|
+
placeholder: string;
|
|
255
|
+
returnObject: boolean;
|
|
256
|
+
shadow: boolean;
|
|
257
|
+
texts: CTreeSelectTexts;
|
|
258
|
+
valid: boolean;
|
|
259
|
+
allowBranch: boolean;
|
|
260
|
+
levelLabels: string[];
|
|
261
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { CAlertIconType, CAlertProps, CAlertType, } from './components/c-alert/CAlert.vue';
|
|
2
|
-
export type { CAutocompleteFilter, CAutocompleteItem, CAutocompleteOption, CAutocompleteProps, } from './components/c-autocomplete/CAutocomplete.vue';
|
|
2
|
+
export type { CAutocompleteFilter, CAutocompleteItem, CAutocompleteOption, CAutocompleteProps, CAutocompleteTexts, CAutocompleteValue, } from './components/c-autocomplete/CAutocomplete.vue';
|
|
3
3
|
export type { CButtonGroupProps, CButtonGroupSize, CButtonGroupValue, } from './components/c-button-group/CButtonGroup.vue';
|
|
4
4
|
export type { CButtonProps, CButtonSize, CButtonType, } from './components/c-button/CButton.vue';
|
|
5
5
|
export type { CCardActionsAlign, CCardActionsJustify, CCardActionsProps, } from './components/c-card-actions/CCardActions.vue';
|
|
@@ -8,6 +8,9 @@ export type { CIconButtonProps, CIconButtonSize, } from './components/c-icon-but
|
|
|
8
8
|
export type { CLoginCardActionsAlign, CLoginCardActionsJustify, CLoginCardActionsProps, } from './components/c-login-card-actions/CLoginCardActions.vue';
|
|
9
9
|
export type { CLoginCardBlendMode, CLoginCardProps, } from './components/c-login-card/CLoginCard.vue';
|
|
10
10
|
export type { CPaginationOptions, CPaginationProps, CPaginationSize, } from './components/c-pagination/CPagination.vue';
|
|
11
|
+
export type { CPopoverProps } from './components/c-popover/CPopover.vue';
|
|
12
|
+
export type { CProgressCircleProps } from './components/c-progress-circle/CProgressCircle.vue';
|
|
13
|
+
export type { CSelectProps, CSelectTexts, CSelectValue, } from './components/c-select/CSelect.vue';
|
|
11
14
|
export type { CStatusProps, CStatusType, } from './components/c-status/CStatus.vue';
|
|
12
15
|
export type { CTabButtonsProps, CTabButtonsSize, } from './components/c-tab-buttons/CTabButtons.vue';
|
|
13
16
|
export type { CTabsJustify, CTabsProps } from './components/c-tabs/CTabs.vue';
|
|
@@ -16,10 +19,19 @@ export type { CTagsProps, CTagsSize } from './components/c-tags/CTags.vue';
|
|
|
16
19
|
export type { CTextFieldAutocapitalize, CTextFieldProps, CTextFieldType, } from './components/c-text-field/CTextField.vue';
|
|
17
20
|
export type { CToastProps } from './components/c-toast/CToast.vue';
|
|
18
21
|
export type { CToastsHorizontal, CToastsProps, CToastsVertical, } from './components/c-toasts/CToasts.vue';
|
|
22
|
+
export type { CTooltipProps } from './components/c-tooltip/CTooltip.vue';
|
|
23
|
+
export type { CTreeSelectFilter, CTreeSelectItem, CTreeSelectProps, CTreeSelectSelection, CTreeSelectTexts, CTreeSelectValue, } from './components/c-tree-select/CTreeSelect.vue';
|
|
19
24
|
export type * from './tag-name-map';
|
|
20
25
|
export { applyTheme, resetTheme, themeToCss } from './theme/applyTheme';
|
|
21
26
|
export type { Family, ThemeSeeds } from './theme/applyTheme';
|
|
22
|
-
export
|
|
27
|
+
export { applyDefaults, DEFAULTABLE_PROPS, resetDefaults, } from './shared/appDefaults';
|
|
28
|
+
export type { AppDefaults, DefaultableTag } from './shared/appDefaults';
|
|
29
|
+
export { chartAnatomy, chartAnatomyHex, chartSlots, chartSlotsHex, } from './theme/chart-data';
|
|
30
|
+
export type { ChartAnatomy, ChartSlots } from './theme/chart-data';
|
|
31
|
+
export { DEFAULT_SEEDS, FAMILIES } from './theme/ramp.js';
|
|
32
|
+
export { observeThemeMode, themeMode } from './theme/themeMode';
|
|
33
|
+
export type { ThemeMode } from './theme/themeMode';
|
|
34
|
+
export type { CFieldSize, CPlacement, CSelectItem, CToastMessage, CToastType, } from './types';
|
|
23
35
|
export { h } from 'vue';
|
|
24
36
|
export type { VNode, VNodeChild } from 'vue';
|
|
25
37
|
/**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface FieldMessageProps {
|
|
2
|
+
/** Consumer-supplied text shown in place of the hint while invalid. */
|
|
3
|
+
errorMessage?: string;
|
|
4
|
+
/** Suppress the whole message area (no reserved height either). */
|
|
5
|
+
hideDetails?: boolean;
|
|
6
|
+
/** Neutral helper text shown while valid (or when no error message is supplied). */
|
|
7
|
+
hint?: string;
|
|
8
|
+
/** Part name stamped on the message area (`message` unless the host reserves it). */
|
|
9
|
+
part?: string;
|
|
10
|
+
/** Host control's validity; `false` switches to the error message when one is supplied. */
|
|
11
|
+
valid?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<FieldMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FieldMessageProps> & Readonly<{}>, {
|
|
14
|
+
part: string;
|
|
15
|
+
errorMessage: string;
|
|
16
|
+
hideDetails: boolean;
|
|
17
|
+
hint: string;
|
|
18
|
+
valid: boolean;
|
|
19
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -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,21 @@
|
|
|
1
|
+
interface SelectionIndicatorProps {
|
|
2
|
+
/** Fill the box and show the check glyph. */
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
/** Paint the disabled colour channel. */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
/** Paint the error colour channel (box unless disabled; mark always). */
|
|
7
|
+
error?: boolean;
|
|
8
|
+
/** Render the keyboard focus halo pseudo-element for the host to reveal. */
|
|
9
|
+
focusHalo?: boolean;
|
|
10
|
+
/** Fill the box and show the indeterminate bar (wins over `checked`). */
|
|
11
|
+
indeterminate?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<SelectionIndicatorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SelectionIndicatorProps> & Readonly<{}>, {
|
|
14
|
+
error: boolean;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
checked: boolean;
|
|
17
|
+
indeterminate: boolean;
|
|
18
|
+
focusHalo: boolean;
|
|
19
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
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>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light dismiss (CONTEXT.md "Light dismiss", ADR-0050): the platform's rule
|
|
3
|
+
* for closing a transient surface from the pointer, shared by every surface
|
|
4
|
+
* that implements dismissal itself — the anchored field panels
|
|
5
|
+
* (`useAnchoredPanel`), the popover chain and `c-menu`, all of which are
|
|
6
|
+
* `popover="manual"` and so get nothing from the browser.
|
|
7
|
+
*
|
|
8
|
+
* A native `popover="auto"` does not close on `pointerdown`: the browser
|
|
9
|
+
* remembers where the press landed and dismisses on the matching `pointerup`
|
|
10
|
+
* only when *both* fell outside. A touch scroll begins with a `pointerdown`
|
|
11
|
+
* and turns into `pointercancel`, never `pointerup`, so scrolling the page
|
|
12
|
+
* under an open surface leaves it open. The hand-rolled `pointerdown`
|
|
13
|
+
* listeners this module replaces closed the panel on the first touch of every
|
|
14
|
+
* scroll — the bug that made `c-tree-select` unusable on a phone.
|
|
15
|
+
*
|
|
16
|
+
* Listeners are capture-phase on `document`, like the ones they replace, so a
|
|
17
|
+
* consumer's `stopPropagation()` cannot hide an outside press from them.
|
|
18
|
+
*/
|
|
19
|
+
/** Detach the listeners `attachPointerPair` / `attachLightDismiss` installed. Idempotent. */
|
|
20
|
+
export type Detach = () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Report each completed primary-pointer press-and-release pair with both
|
|
23
|
+
* composed paths. A press that ends in `pointercancel` — a touch that became a
|
|
24
|
+
* scroll or a pan — is dropped, and a release with no press seen since attach
|
|
25
|
+
* (the gesture that opened the surface) is ignored.
|
|
26
|
+
*/
|
|
27
|
+
export declare const attachPointerPair: (onPair: (down: EventTarget[], up: EventTarget[]) => void) => Detach;
|
|
28
|
+
export interface LightDismissOptions {
|
|
29
|
+
/** True when a composed event path passes through the surface's own inside (host subtree, panel, designated trigger). */
|
|
30
|
+
isInside(path: EventTarget[]): boolean;
|
|
31
|
+
/** The press and its release both landed outside: close the surface. */
|
|
32
|
+
onDismiss(): void;
|
|
33
|
+
}
|
|
34
|
+
/** The single-surface case: dismiss when press and release both landed outside. */
|
|
35
|
+
export declare const attachLightDismiss: (options: LightDismissOptions) => Detach;
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
* below the toast band,
|
|
14
14
|
* - **backdrop visibility**: exactly one backdrop — the active modal's — is
|
|
15
15
|
* visible at a time,
|
|
16
|
-
* - **inertness
|
|
17
|
-
* `
|
|
18
|
-
* -
|
|
16
|
+
* - **inertness** and **scroll lock**, delegated to the shared page lock
|
|
17
|
+
* (`pageLock.ts`, ADR-0050): everything outside the active modal is
|
|
18
|
+
* `inert` except `c-toasts`, and the document stops scrolling while the
|
|
19
|
+
* stack is non-empty,
|
|
19
20
|
* - **Escape routing** to the active modal only, and
|
|
20
21
|
* - **focus restore** to the element focused when each modal opened.
|
|
21
22
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The label of a slotted `<c-option>` — what a value-selection field shows
|
|
3
|
+
* for the option in its row, its closed field and its tags, and what
|
|
4
|
+
* `c-autocomplete`'s filter matches (ADR-0045).
|
|
5
|
+
*
|
|
6
|
+
* Resolution chain:
|
|
7
|
+
* 1. the option's `name` (the property, else the attribute — the element may
|
|
8
|
+
* not be upgraded yet when a parent reads it during mount);
|
|
9
|
+
* 2. else the text of its first `<c-option-value>`, the label region: it
|
|
10
|
+
* lets an option carry richer content (a description, an icon) that is
|
|
11
|
+
* not part of the label;
|
|
12
|
+
* 3. else the option's whole text content.
|
|
13
|
+
*
|
|
14
|
+
* Trimmed; an empty `name` counts as absent. Callers keep their own last
|
|
15
|
+
* resort (the raw value) so a label is never blank.
|
|
16
|
+
*/
|
|
17
|
+
export declare const optionValueElement: (option: Element) => Element | null;
|
|
18
|
+
export declare const optionLabel: (option: HTMLElement) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page lock (ADR-0014, ADR-0050): library-owned modality for surfaces that
|
|
3
|
+
* must own the page without entering the browser's modal top layer — which
|
|
4
|
+
* would inert the toasts. While any holder is registered, everything outside
|
|
5
|
+
* the *active* holder's host is `inert` (a `c-toasts` anywhere stays
|
|
6
|
+
* interactive) and document scroll is locked.
|
|
7
|
+
*
|
|
8
|
+
* Holders form a stack; the most recently locked host is the active one. The
|
|
9
|
+
* modal stack pushes each opening `c-modal` here, and a **fullscreen panel**
|
|
10
|
+
* pushes its field's host — so a select opened inside a modal on a phone
|
|
11
|
+
* inerts the modal's other content along with the page, and closing it hands
|
|
12
|
+
* the page back to the modal. Consumer-set `inert` is never touched.
|
|
13
|
+
*/
|
|
14
|
+
/** True while `host` holds the lock (active or below another holder). */
|
|
15
|
+
export declare const isPageLockedBy: (host: HTMLElement) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Register `host` as the active holder: everything outside it goes inert and
|
|
18
|
+
* the document stops scrolling. Idempotent for a host already holding.
|
|
19
|
+
*/
|
|
20
|
+
export declare const lockPage: (host: HTMLElement) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Release `host` (idempotent). The next holder down, if any, becomes active
|
|
23
|
+
* and the inert set is re-derived for it; with no holder left the page is
|
|
24
|
+
* fully interactive and scrolls again.
|
|
25
|
+
*/
|
|
26
|
+
export declare const unlockPage: (host: HTMLElement) => void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The peek (CONTEXT.md, ADR-0043).
|
|
3
|
+
*
|
|
4
|
+
* A transient list panel — the menu and submenu panels, `c-dropdown`'s
|
|
5
|
+
* listbox, `c-autocomplete`'s options list — hides its scrollbar. In its
|
|
6
|
+
* place an overflowing list must end at an item row's midpoint: the
|
|
7
|
+
* half-visible row is the one cue that more rows follow. This module computes
|
|
8
|
+
* that cap from the real row boxes, so mixed-height menus (items, labels,
|
|
9
|
+
* dividers) and taller slotted option rows cut correctly.
|
|
10
|
+
*/
|
|
11
|
+
export interface PeekCapOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Upper bound for the list's `max-height`, in px. `Infinity` for none.
|
|
14
|
+
* `applyPeekCap` defaults it to the list's stylesheet `max-height`.
|
|
15
|
+
*/
|
|
16
|
+
ceiling?: number;
|
|
17
|
+
/** Full rows shown before the peek. `0` (or less): no row cap. */
|
|
18
|
+
itemsPerPage?: number;
|
|
19
|
+
/** Item rows in visual order — only these can be the peek row. */
|
|
20
|
+
rows: readonly HTMLElement[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The `max-height` (px) that ends `list` at a row midpoint, or `null` when
|
|
24
|
+
* the content fits and needs no cap. Rows are located relative to the list's
|
|
25
|
+
* scroll content (rect deltas plus `scrollTop`), so the result is independent
|
|
26
|
+
* of the panel's positioning scheme and of any cap currently applied.
|
|
27
|
+
*/
|
|
28
|
+
export declare const peekCap: (list: HTMLElement, { ceiling, itemsPerPage, rows }: PeekCapOptions) => null | number;
|
|
29
|
+
/**
|
|
30
|
+
* Write the peek cap as the list's inline `max-height` (cleared when no cap
|
|
31
|
+
* is needed). Without `ceiling` the list's stylesheet `max-height` (e.g.
|
|
32
|
+
* `max-h-[80vh]`, or a consumer's `::part()` override) is the ceiling; the
|
|
33
|
+
* inline value is cleared first so that stylesheet value is what gets read.
|
|
34
|
+
*/
|
|
35
|
+
export declare const applyPeekCap: (list: HTMLElement, options: PeekCapOptions) => void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Popover chain controller (CONTEXT.md "Popover chain", ADR-0038).
|
|
3
|
+
*
|
|
4
|
+
* The ordered set of currently open `c-popover`s, each logically nested in
|
|
5
|
+
* the one before it. This module is the single owner of popover dismissal:
|
|
6
|
+
*
|
|
7
|
+
* - **Escape** peels the innermost popover only, one per press. The listener
|
|
8
|
+
* is capture-phase and calls `preventDefault()`, so an enclosing
|
|
9
|
+
* `c-modal`'s bubble-phase controller sees the claimed key and does not
|
|
10
|
+
* close itself (ADR-0014). Known pre-existing limitation: a `c-menu` open
|
|
11
|
+
* inside a popover listens on its own host (bubble), i.e. *after* this
|
|
12
|
+
* capture listener — that Escape closes both, exactly as it did when each
|
|
13
|
+
* popover owned its own capture listener.
|
|
14
|
+
* - **Light dismiss** (CONTEXT.md, ADR-0050) closes every popover that does
|
|
15
|
+
* not *logically* contain the pointer gesture. A press and its release are
|
|
16
|
+
* paired (`lightDismiss.ts` — a press alone, the start of every touch
|
|
17
|
+
* scroll, closes nothing); from the innermost down, everything above the
|
|
18
|
+
* deepest member whose own inside (host subtree, panel, designated
|
|
19
|
+
* trigger) contains either composed path is closed. Containment is
|
|
20
|
+
* logical, not DOM ancestry — a popover whose host lives elsewhere still
|
|
21
|
+
* shields its ancestors, because ancestry is recorded in the chain itself,
|
|
22
|
+
* not re-derived from the DOM.
|
|
23
|
+
* - **Opening** a popover whose trigger sits inside an open member joins the
|
|
24
|
+
* chain below it; one whose trigger is elsewhere replaces the chain.
|
|
25
|
+
* Siblings therefore never coexist.
|
|
26
|
+
* - **Closing** any member (Escape, light dismiss, `open` prop, unmount)
|
|
27
|
+
* closes its descendants — no orphaned floating panels.
|
|
28
|
+
*
|
|
29
|
+
* Why a shared module: each popover's Escape listener is capture-phase on
|
|
30
|
+
* `document`, and `preventDefault()` does not stop other listeners — two
|
|
31
|
+
* independent popovers cannot see each other's claim, so one press closed
|
|
32
|
+
* them all. Coordination needs a single owner, mirroring `modalStack.ts`.
|
|
33
|
+
*/
|
|
34
|
+
export interface PopoverChainEntry {
|
|
35
|
+
/** Close this popover with no focus return (light dismiss / chain cleanup). */
|
|
36
|
+
close(): void;
|
|
37
|
+
/** True when `node` is inside this popover's own logical inside. */
|
|
38
|
+
containsNode(node: Node): boolean;
|
|
39
|
+
/** True when a composed event path passes through this popover's own inside. */
|
|
40
|
+
containsPath(path: EventTarget[]): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The node that chains this popover under an open ancestor: its designated
|
|
43
|
+
* trigger, else its slotted trigger, else its host.
|
|
44
|
+
*/
|
|
45
|
+
getAnchorNode(): Node | null;
|
|
46
|
+
/** Escape routed here — this popover is the innermost. Decides focus return. */
|
|
47
|
+
onEscape(): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Shadow-piercing containment: like `Node.contains` but hopping from a shadow
|
|
51
|
+
* root to its host, so content inside a descendant component's shadow root
|
|
52
|
+
* (and slotted light DOM) counts as inside.
|
|
53
|
+
*/
|
|
54
|
+
export declare const composedContains: (ancestor: Node, node: Node | null) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Register an opening popover. Resolves its chain parent from where its
|
|
57
|
+
* anchor node sits; members that would become siblings are closed first.
|
|
58
|
+
* Idempotent.
|
|
59
|
+
*/
|
|
60
|
+
export declare const enterChain: (entry: PopoverChainEntry) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Unregister a closing popover (idempotent) and close its descendants —
|
|
63
|
+
* whatever closed it, nothing may stay floating above it.
|
|
64
|
+
*/
|
|
65
|
+
export declare const leaveChain: (entry: PopoverChainEntry) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CPlacement } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* `CPlacement` → CSS `position-area`, shared by the anchor-positioned overlay
|
|
4
|
+
* components (`c-menu`, `c-tooltip`, `c-popover`; ADR-0008). Native flip/shift
|
|
5
|
+
* comes from each component's `position-try-fallbacks` escape-hatch rule.
|
|
6
|
+
*/
|
|
7
|
+
export declare const POSITION_AREA: Record<CPlacement, string>;
|
|
8
|
+
/**
|
|
9
|
+
* The logical axis of a placement's side — the axis the trigger→panel gap
|
|
10
|
+
* margin is applied on (both sides, so the gap survives the position-try
|
|
11
|
+
* flip fallbacks).
|
|
12
|
+
*/
|
|
13
|
+
export declare const placementAxis: (position: CPlacement) => "block" | "inline";
|