@cscfi/csc-ui 4.0.0-alpha.12 → 4.0.0-alpha.14
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 +7754 -6741
- package/dist/custom-elements.json +672 -7
- package/dist/docs/c-autocomplete/usage.md +38 -6
- package/dist/docs/c-select/usage.md +36 -3
- package/dist/docs/c-tree-select/usage.md +133 -0
- package/dist/styles/css/tokens.css +2 -1
- package/dist/vscode.css-custom-data.json +61 -0
- package/dist/vscode.html-custom-data.json +100 -4
- package/dist/web-types.json +367 -7
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +14 -0
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +22 -5
- package/dist-types/components/c-select/CSelect.vue.d.ts +13 -0
- package/dist-types/components/c-tree-select/CTreeSelect.vue.d.ts +247 -0
- package/dist-types/index.d.ts +1 -0
- package/dist-types/shared/selectAll.d.ts +29 -0
- package/dist-types/shared/useAnchoredPanel.d.ts +72 -0
- package/dist-types/shared/useStatusAnnouncer.d.ts +33 -0
- package/dist-types/tag-name-map.d.ts +136 -6
- package/package.json +1 -1
|
@@ -0,0 +1,247 @@
|
|
|
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
|
+
hideDetails?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Hint text for the field
|
|
64
|
+
*
|
|
65
|
+
* @freeform
|
|
66
|
+
*/
|
|
67
|
+
hint?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Id of the element
|
|
70
|
+
*
|
|
71
|
+
* @freeform
|
|
72
|
+
*/
|
|
73
|
+
hostId?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The tree to pick from. Arrays have no attribute form — bind as a DOM
|
|
76
|
+
* property (`:items.prop` in Vue)
|
|
77
|
+
*/
|
|
78
|
+
items?: CTreeSelectItem[];
|
|
79
|
+
/**
|
|
80
|
+
* Items per page before the list scrolls
|
|
81
|
+
*/
|
|
82
|
+
itemsPerPage?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Element label
|
|
85
|
+
*
|
|
86
|
+
* @freeform
|
|
87
|
+
*/
|
|
88
|
+
label?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Label on top of the field
|
|
91
|
+
*/
|
|
92
|
+
labelOnTop?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Names of the levels, top level first, shown in the panel header; a
|
|
95
|
+
* missing entry falls back to `texts.level(n)`. Arrays have no attribute
|
|
96
|
+
* form — bind as a DOM property
|
|
97
|
+
*/
|
|
98
|
+
levelLabels?: string[];
|
|
99
|
+
/**
|
|
100
|
+
* Input field name
|
|
101
|
+
*
|
|
102
|
+
* @freeform
|
|
103
|
+
*/
|
|
104
|
+
name?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Placeholder for the search input inside the panel
|
|
107
|
+
*
|
|
108
|
+
* @freeform
|
|
109
|
+
*/
|
|
110
|
+
placeholder?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Set the field as required
|
|
113
|
+
*/
|
|
114
|
+
required?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Emit the committed item with its path as a `CTreeSelectSelection` instead
|
|
117
|
+
* of its value
|
|
118
|
+
*/
|
|
119
|
+
returnObject?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Shadow variant
|
|
122
|
+
*/
|
|
123
|
+
shadow?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Field height: the 44px default or the 36px `small` box
|
|
126
|
+
*/
|
|
127
|
+
size?: CFieldSize;
|
|
128
|
+
/**
|
|
129
|
+
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
130
|
+
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
131
|
+
*/
|
|
132
|
+
texts?: CTreeSelectTexts;
|
|
133
|
+
/**
|
|
134
|
+
* Set the validity of the field
|
|
135
|
+
*/
|
|
136
|
+
valid?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Selected value: the committed item's value, or the `CTreeSelectSelection`
|
|
139
|
+
* with `return-object`; `null` when nothing is selected
|
|
140
|
+
*/
|
|
141
|
+
value?: CTreeSelectValue;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The committed item as emitted with `return-object`: a fresh object — never
|
|
145
|
+
* the `items` entry itself — with its ancestors root-first and without
|
|
146
|
+
* `children`.
|
|
147
|
+
*/
|
|
148
|
+
export interface CTreeSelectSelection {
|
|
149
|
+
/** The committed item's code, when it has one. */
|
|
150
|
+
code?: string;
|
|
151
|
+
/** The committed item's label. */
|
|
152
|
+
name: string;
|
|
153
|
+
/** The committed item's ancestors, root-first. */
|
|
154
|
+
path: Array<{
|
|
155
|
+
code?: string;
|
|
156
|
+
name: string;
|
|
157
|
+
value: number | string;
|
|
158
|
+
}>;
|
|
159
|
+
/** The committed item's value. */
|
|
160
|
+
value: number | string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* UI texts of `c-tree-select`, shallow-merged over the English defaults.
|
|
164
|
+
* Static labels are strings; interpolated ones are functions.
|
|
165
|
+
*/
|
|
166
|
+
export interface CTreeSelectTexts {
|
|
167
|
+
/** Accessible label of the breadcrumb navigation in the panel. */
|
|
168
|
+
breadcrumb?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Label of the "Browse instead" control shown in the header while a query
|
|
171
|
+
* is typed.
|
|
172
|
+
*/
|
|
173
|
+
browse?: string;
|
|
174
|
+
/** Meta text on a branch row; receives its number of children. */
|
|
175
|
+
children?: (count: number) => string;
|
|
176
|
+
/**
|
|
177
|
+
* Header text in browse mode; receives the label of the level being
|
|
178
|
+
* listed.
|
|
179
|
+
*/
|
|
180
|
+
choose?: (levelLabel: string) => string;
|
|
181
|
+
/** Accessible label of the clear button. */
|
|
182
|
+
clearSelection?: string;
|
|
183
|
+
/** Accessible label of the search input inside the panel. */
|
|
184
|
+
filterOptions?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Header text of a level whose rows are all leaves in an unevenly deep
|
|
187
|
+
* tree (an evenly deep tree shows the step counter instead).
|
|
188
|
+
*/
|
|
189
|
+
final?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Default label of level `n` (1 = the top level) when `level-labels` gives
|
|
192
|
+
* none.
|
|
193
|
+
*/
|
|
194
|
+
level?: (n: number) => string;
|
|
195
|
+
/** Header text in search mode; receives the number of matches. */
|
|
196
|
+
matches?: (count: number) => string;
|
|
197
|
+
/** Text of the row shown when nothing is listed. */
|
|
198
|
+
noResults?: string;
|
|
199
|
+
/** Label of the root crumb. */
|
|
200
|
+
root?: string;
|
|
201
|
+
/** Placeholder of the search input when the `placeholder` prop is empty. */
|
|
202
|
+
searchPlaceholder?: string;
|
|
203
|
+
/**
|
|
204
|
+
* Label of the pinned select-branch row; receives the current branch's
|
|
205
|
+
* name.
|
|
206
|
+
*/
|
|
207
|
+
select?: (name: string) => string;
|
|
208
|
+
/**
|
|
209
|
+
* Header step counter shown while the tree is evenly deep (every leaf at
|
|
210
|
+
* one level); receives the step and the total number of levels.
|
|
211
|
+
*/
|
|
212
|
+
step?: (n: number, total: number) => string;
|
|
213
|
+
/** Accessible label of the chevron button that opens and closes the panel. */
|
|
214
|
+
toggleOptions?: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Selection value of `c-tree-select`: the committed item's value — or a
|
|
218
|
+
* {@link CTreeSelectSelection} with `return-object` — and `null` when
|
|
219
|
+
* cleared.
|
|
220
|
+
*/
|
|
221
|
+
export type CTreeSelectValue = CTreeSelectSelection | null | number | string;
|
|
222
|
+
declare const _default: typeof __VLS_export;
|
|
223
|
+
export default _default;
|
|
224
|
+
declare const __VLS_export: import("vue").DefineComponent<CTreeSelectProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CTreeSelectProps> & Readonly<{}>, {
|
|
225
|
+
label: string;
|
|
226
|
+
filter: CTreeSelectFilter;
|
|
227
|
+
value: CTreeSelectValue;
|
|
228
|
+
name: string;
|
|
229
|
+
clearable: boolean;
|
|
230
|
+
disabled: boolean;
|
|
231
|
+
errorMessage: string;
|
|
232
|
+
hideDetails: boolean;
|
|
233
|
+
hint: string;
|
|
234
|
+
hostId: string;
|
|
235
|
+
items: CTreeSelectItem[];
|
|
236
|
+
itemsPerPage: number;
|
|
237
|
+
labelOnTop: boolean;
|
|
238
|
+
placeholder: string;
|
|
239
|
+
required: boolean;
|
|
240
|
+
returnObject: boolean;
|
|
241
|
+
shadow: boolean;
|
|
242
|
+
size: CFieldSize;
|
|
243
|
+
texts: CTreeSelectTexts;
|
|
244
|
+
valid: boolean;
|
|
245
|
+
allowBranch: boolean;
|
|
246
|
+
levelLabels: string[];
|
|
247
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type { CTextFieldAutocapitalize, CTextFieldProps, CTextFieldType, } from
|
|
|
20
20
|
export type { CToastProps } from './components/c-toast/CToast.vue';
|
|
21
21
|
export type { CToastsHorizontal, CToastsProps, CToastsVertical, } from './components/c-toasts/CToasts.vue';
|
|
22
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';
|
|
23
24
|
export type * from './tag-name-map';
|
|
24
25
|
export { applyTheme, resetTheme, themeToCss } from './theme/applyTheme';
|
|
25
26
|
export type { Family, ThemeSeeds } from './theme/applyTheme';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The select-all row (CONTEXT.md, ADR-0046): the selection maths `c-select`
|
|
3
|
+
* and `c-autocomplete` share in `multiple` mode.
|
|
4
|
+
*
|
|
5
|
+
* `listed` is the enabled options currently in the list, in list order —
|
|
6
|
+
* every option in c-select, the current matches in c-autocomplete; callers
|
|
7
|
+
* filter disabled options out first. Duplicate option values collapse in the
|
|
8
|
+
* Set maths, exactly as they do when a single row is toggled.
|
|
9
|
+
*/
|
|
10
|
+
/** `c-select` ↔ `c-dropdown` `index` contract: the select-all row is highlighted. */
|
|
11
|
+
export declare const SELECT_ALL_INDEX = -1;
|
|
12
|
+
export type SelectAllState = 'all' | 'none' | 'some';
|
|
13
|
+
export interface SelectAllListedOption {
|
|
14
|
+
label: string;
|
|
15
|
+
value: number | string;
|
|
16
|
+
}
|
|
17
|
+
/** What the row's indicator shows: none, some (indeterminate) or all listed selected. */
|
|
18
|
+
export declare const selectAllState: (listed: readonly (number | string)[], selected: ReadonlySet<number | string>) => SelectAllState;
|
|
19
|
+
/**
|
|
20
|
+
* The next selection after the row is activated. Every listed option already
|
|
21
|
+
* selected → drop the listed values (the others keep their order); otherwise
|
|
22
|
+
* append the unselected listed options in list order (selection order,
|
|
23
|
+
* ADR-0044). `added` / `removed` let a caller keep per-value bookkeeping.
|
|
24
|
+
*/
|
|
25
|
+
export declare const toggleAllValues: <T>(current: readonly T[], listed: readonly SelectAllListedOption[], valueOf: (v: T) => number | string, make: (o: SelectAllListedOption) => T) => {
|
|
26
|
+
added: SelectAllListedOption[];
|
|
27
|
+
next: T[];
|
|
28
|
+
removed: (number | string)[];
|
|
29
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anchored field panel (CONTEXT.md "Autocomplete", "Tree select", "Top
|
|
3
|
+
* layer"; ADR-0008, ADR-0009, ADR-0047): the lifecycle shared by the
|
|
4
|
+
* value-selection fields that keep a readonly value field in place and open a
|
|
5
|
+
* native popover panel anchored under it — `c-autocomplete` and
|
|
6
|
+
* `c-tree-select`.
|
|
7
|
+
*
|
|
8
|
+
* What it owns:
|
|
9
|
+
* - the anchor. CSS anchor names are tree-scoped, so the consumer wraps its
|
|
10
|
+
* value field in a shadow-DOM box carrying `anchor-name`; `anchorStyle`
|
|
11
|
+
* supplies that declaration and `panelStyle` the matching
|
|
12
|
+
* `position-anchor` / `position-area` plus the panel width pinned to the
|
|
13
|
+
* anchor's rect on open;
|
|
14
|
+
* - the message pull-back. The anchor wrapper spans the whole inner
|
|
15
|
+
* `c-input`, INCLUDING its hint / error message area (reserved unless
|
|
16
|
+
* `hide-details` is set). The panel must sit flush under the field
|
|
17
|
+
* itself, so the `[part='message']` height is measured on open and pulled
|
|
18
|
+
* back with a negative block-start margin;
|
|
19
|
+
* - open / close through `showPopover()` / `hidePopover()` on a
|
|
20
|
+
* `popover="manual"` panel, with the native `toggle` event as the single
|
|
21
|
+
* source of truth for `isOpen` (browser-initiated closes included);
|
|
22
|
+
* - light dismiss: a capture-phase document `pointerdown` listener that
|
|
23
|
+
* closes unless the composed path includes the host;
|
|
24
|
+
* - focus return to the value field on `close(true)`;
|
|
25
|
+
* - the OddBird anchor polyfill kick-off on open (Firefox).
|
|
26
|
+
*
|
|
27
|
+
* What stays in the consumer: the `@position-try --c-field-panel-above` /
|
|
28
|
+
* `--c-field-panel-above-left` flip rules and `position-try-fallbacks` —
|
|
29
|
+
* per-shadow-root escape-hatch CSS (ADR-0007; each element type has its own
|
|
30
|
+
* adopted sheet, so the block is copy-identical in every consumer) — and the
|
|
31
|
+
* open sequence (peek cap, focus, highlight seed, announcement), run from
|
|
32
|
+
* `onOpened` synchronously inside the `toggle` handler.
|
|
33
|
+
*/
|
|
34
|
+
import { type ComputedRef, type MaybeRefOrGetter, type Ref } from 'vue';
|
|
35
|
+
/**
|
|
36
|
+
* The `anchor-name` every anchored field panel uses. Anchor names are
|
|
37
|
+
* tree-scoped, so one name serves every consumer's shadow root.
|
|
38
|
+
*/
|
|
39
|
+
export declare const FIELD_PANEL_ANCHOR = "--c-field-panel-anchor";
|
|
40
|
+
export interface AnchoredPanel {
|
|
41
|
+
/** Inline style for the anchor wrapper: `anchor-name: --c-field-panel-anchor`. */
|
|
42
|
+
anchorStyle: string;
|
|
43
|
+
/** Hide the panel; `returnFocus` moves focus to `returnFocusTo` once the `toggle` event confirms the close. */
|
|
44
|
+
close(returnFocus?: boolean): void;
|
|
45
|
+
/** Open state — written only by the native `toggle` event (single source of truth, browser-initiated closes included). */
|
|
46
|
+
isOpen: Readonly<Ref<boolean>>;
|
|
47
|
+
/** Bind as the panel's `@toggle` handler. */
|
|
48
|
+
onToggle(event: Event): void;
|
|
49
|
+
/** Measure the anchor width and the field's message height, then `showPopover()`. */
|
|
50
|
+
open(): void;
|
|
51
|
+
/** Inline style for the panel: `position-anchor`, `position-area: bottom span-right`, `inset: auto`, the pinned width and the message pull-back. */
|
|
52
|
+
panelStyle: ComputedRef<string>;
|
|
53
|
+
}
|
|
54
|
+
export interface UseAnchoredPanelOptions {
|
|
55
|
+
/** Shadow-DOM wrapper around the value field; carries `anchor-name`, and its rect pins the panel width. */
|
|
56
|
+
anchor: Readonly<Ref<HTMLElement | null>>;
|
|
57
|
+
/** `open()` is a no-op while this returns true (the field's `disabled`). */
|
|
58
|
+
disabled?: () => boolean;
|
|
59
|
+
/** The inner `c-input` host: its `[part='message']` height is pulled back so the panel sits flush under the field box. */
|
|
60
|
+
field: Readonly<Ref<HTMLElement | null>>;
|
|
61
|
+
/** The custom element host: light dismiss keeps pointerdowns whose composed path includes it; its shadow root is what the anchor polyfill runs against. */
|
|
62
|
+
host: HTMLElement | null;
|
|
63
|
+
/** Runs inside the native `toggle` handler once closed, before focus returns. */
|
|
64
|
+
onClosed?: () => void;
|
|
65
|
+
/** Runs inside the native `toggle` handler once open, after the polyfill kick-off and the dismiss listener — the consumer's open sequence goes here. */
|
|
66
|
+
onOpened?: () => void;
|
|
67
|
+
/** The `popover="manual"` panel element. */
|
|
68
|
+
panel: Readonly<Ref<HTMLElement | null>>;
|
|
69
|
+
/** Receives focus when the panel closes via `close(true)`. */
|
|
70
|
+
returnFocusTo: MaybeRefOrGetter<HTMLElement | null | undefined>;
|
|
71
|
+
}
|
|
72
|
+
export declare const useAnchoredPanel: (options: UseAnchoredPanelOptions) => AnchoredPanel;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debounced polite live region for a component's status text — the
|
|
3
|
+
* announcer behind the visually hidden `aria-live="polite" aria-atomic="true"`
|
|
4
|
+
* region a value-selection field renders (`c-autocomplete`, `c-tree-select`).
|
|
5
|
+
*
|
|
6
|
+
* The 1400 ms debounce is the cadence every list panel in the library uses
|
|
7
|
+
* (`c-dropdown` / `c-select` keep their own copies for now — `set()` is the
|
|
8
|
+
* seam for a later refit): a screen reader must not hear every keystroke's
|
|
9
|
+
* intermediate count, only where the user came to rest. `announce()` takes a
|
|
10
|
+
* *compose* thunk rather than a string on purpose — it runs when the timer
|
|
11
|
+
* fires, so it reads the state current *then* (a fetch landing during the
|
|
12
|
+
* debounce is announced correctly).
|
|
13
|
+
*
|
|
14
|
+
* The region itself stays a template snippet in the consumer: it has no
|
|
15
|
+
* `part` and no slot, so a shared SFC would add an analyzer-scanned import
|
|
16
|
+
* and a child instance for no contract gain.
|
|
17
|
+
*/
|
|
18
|
+
import { type Ref } from 'vue';
|
|
19
|
+
export interface StatusAnnouncer {
|
|
20
|
+
/** Schedule an announcement. `compose` runs when the debounce fires, so it reads the state current *then*; every call restarts the timer. */
|
|
21
|
+
announce(compose: () => string): void;
|
|
22
|
+
/** Drop a pending announcement (also runs on unmount). */
|
|
23
|
+
cancel(): void;
|
|
24
|
+
/** Write immediately, dropping any pending announcement. */
|
|
25
|
+
set(text: string): void;
|
|
26
|
+
/** The live text; bind as the content of the `aria-live="polite" aria-atomic="true"` region. */
|
|
27
|
+
text: Readonly<Ref<string>>;
|
|
28
|
+
}
|
|
29
|
+
export interface UseStatusAnnouncerOptions {
|
|
30
|
+
/** Debounce before a scheduled announcement lands, in ms. Default 1400. */
|
|
31
|
+
delay?: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const useStatusAnnouncer: ({ delay, }?: UseStatusAnnouncerOptions) => StatusAnnouncer;
|
|
@@ -12,9 +12,16 @@ import type { CButtonGroupValue } from './components/c-button-group/CButtonGroup
|
|
|
12
12
|
import type { CDataTableCellContent, CDataTableColumn, CDataTableExpandedContext, CDataTableRow, CDataTableSort, CDataTableTexts } from './components/c-data-table/CDataTable.vue';
|
|
13
13
|
import type { CPaginationOptions } from './components/c-pagination/CPagination.vue';
|
|
14
14
|
import type { CSelectTexts, CSelectValue } from './components/c-select/CSelect.vue';
|
|
15
|
+
import type { CTreeSelectFilter, CTreeSelectItem, CTreeSelectTexts, CTreeSelectValue } from './components/c-tree-select/CTreeSelect.vue';
|
|
15
16
|
import type { CSelectItem, CToastMessage } from './types';
|
|
16
17
|
type AccordionPrimitive = number | string;
|
|
17
18
|
type AccordionValue = AccordionPrimitive | AccordionPrimitive[] | null;
|
|
19
|
+
interface CDropdownSelectAllRow {
|
|
20
|
+
label: string;
|
|
21
|
+
selected: number;
|
|
22
|
+
state: 'all' | 'none' | 'some';
|
|
23
|
+
total: number;
|
|
24
|
+
}
|
|
18
25
|
type DropdownItem = {
|
|
19
26
|
disabled?: boolean | string;
|
|
20
27
|
name: string;
|
|
@@ -150,7 +157,7 @@ export interface CAutocompleteElementEventMap {
|
|
|
150
157
|
'update:value': CustomEvent<CAutocompleteValue>;
|
|
151
158
|
}
|
|
152
159
|
/** A filterable value-selection component: a readonly value field that opens a popover panel with a search input above the matching options. */
|
|
153
|
-
export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'external' | 'filter' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'maxTags' | 'multiple' | 'name' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
|
|
160
|
+
export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'external' | 'filter' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'maxTags' | 'multiple' | 'name' | 'placeholder' | 'required' | 'returnObject' | 'selectAll' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
|
|
154
161
|
/** Make the selected value clearable */
|
|
155
162
|
clearable?: boolean;
|
|
156
163
|
/** Disable the input */
|
|
@@ -203,6 +210,14 @@ export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'd
|
|
|
203
210
|
required?: boolean;
|
|
204
211
|
/** Return object instead of value */
|
|
205
212
|
returnObject?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* In `multiple` mode, pin a select-all row at the top of the list. Its
|
|
215
|
+
* checkbox shows whether none, some or all enabled options currently listed
|
|
216
|
+
* — the matches while a query is typed, the given `items` with `external` —
|
|
217
|
+
* are selected; activating it selects them all, or, when all are selected,
|
|
218
|
+
* unselects them. Ignored in single mode
|
|
219
|
+
*/
|
|
220
|
+
selectAll?: boolean;
|
|
206
221
|
/** Shadow variant */
|
|
207
222
|
shadow?: boolean;
|
|
208
223
|
/** Field height: the 44px default or the 36px `small` box */
|
|
@@ -516,13 +531,18 @@ export interface CDropdownElementEventMap {
|
|
|
516
531
|
name: string;
|
|
517
532
|
value: number | string;
|
|
518
533
|
}>;
|
|
534
|
+
/**
|
|
535
|
+
* Fired when the select-all row is activated; the parent (c-select) toggles
|
|
536
|
+
* every listed enabled option.
|
|
537
|
+
*/
|
|
538
|
+
selectall: CustomEvent<void>;
|
|
519
539
|
}
|
|
520
|
-
export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' | 'hostId' | 'index' | 'items' | 'itemsPerPage' | 'multiple' | 'parent' | 'selected' | 'type'> {
|
|
540
|
+
export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' | 'hostId' | 'index' | 'items' | 'itemsPerPage' | 'multiple' | 'parent' | 'selectAllRow' | 'selected' | 'type'> {
|
|
521
541
|
/** Whether items are <c-option> elements or plain objects */
|
|
522
542
|
dropdownItemType?: 'item' | 'option';
|
|
523
543
|
/** Id used to build option/announce element ids */
|
|
524
544
|
hostId?: string;
|
|
525
|
-
/** Current highlighted index */
|
|
545
|
+
/** Current highlighted index; `-1` (`SELECT_ALL_INDEX`) is the select-all row */
|
|
526
546
|
index?: null | number;
|
|
527
547
|
/** Dropdown options: a NodeList of <c-option> or an array of items */
|
|
528
548
|
items?: ArrayLike<DropdownItem>;
|
|
@@ -536,8 +556,14 @@ export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' |
|
|
|
536
556
|
/** Dropdown parent (the c-select / c-autocomplete host element) */
|
|
537
557
|
parent?: HTMLElement | null;
|
|
538
558
|
/**
|
|
539
|
-
*
|
|
540
|
-
*
|
|
559
|
+
* The select-all row in `multiple` mode, as the parent computes it (label,
|
|
560
|
+
* tri-state, counts for the live region); `null` renders no row
|
|
561
|
+
*/
|
|
562
|
+
selectAllRow?: CDropdownSelectAllRow | null;
|
|
563
|
+
/**
|
|
564
|
+
* Values of the currently selected items — the picked values in `multiple`
|
|
565
|
+
* mode, the single value otherwise; drives each row's `aria-selected`, its
|
|
566
|
+
* indicator and the single-mode selected-row check
|
|
541
567
|
*/
|
|
542
568
|
selected?: (number | string)[];
|
|
543
569
|
/** Parent type — drives autocomplete-only behaviour (highlight, messages) */
|
|
@@ -1091,7 +1117,7 @@ export interface CSelectElementEventMap {
|
|
|
1091
1117
|
'update:value': CustomEvent<CSelectValue>;
|
|
1092
1118
|
}
|
|
1093
1119
|
/** A value-selection field: a readonly field that opens a listbox of options — slotted `c-option` elements or an `items` array — and holds the picked value, emitting the value events that back `v-model`. */
|
|
1094
|
-
export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'maxTags' | 'multiple' | 'name' | 'optionAsSelection' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
|
|
1120
|
+
export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | 'maxTags' | 'multiple' | 'name' | 'optionAsSelection' | 'placeholder' | 'required' | 'returnObject' | 'selectAll' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
|
|
1095
1121
|
/** Make the selected value clearable */
|
|
1096
1122
|
clearable?: boolean;
|
|
1097
1123
|
/** Disable the input */
|
|
@@ -1138,6 +1164,13 @@ export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disable
|
|
|
1138
1164
|
required?: boolean;
|
|
1139
1165
|
/** Return object instead of value */
|
|
1140
1166
|
returnObject?: boolean;
|
|
1167
|
+
/**
|
|
1168
|
+
* In `multiple` mode, pin a select-all row at the top of the list. Its
|
|
1169
|
+
* checkbox shows whether none, some or all enabled options are selected;
|
|
1170
|
+
* activating it selects every enabled option — or, when all are selected,
|
|
1171
|
+
* unselects them. Ignored in single mode
|
|
1172
|
+
*/
|
|
1173
|
+
selectAll?: boolean;
|
|
1141
1174
|
/** Shadow variant */
|
|
1142
1175
|
shadow?: boolean;
|
|
1143
1176
|
/** Field height: the 44px default or the 36px `small` box */
|
|
@@ -1677,6 +1710,102 @@ export interface CTooltipElement extends Omit<HTMLElement, 'delay' | 'distance'
|
|
|
1677
1710
|
removeEventListener<K extends keyof CTooltipElementEventMap>(type: K, listener: (this: CTooltipElement, ev: CTooltipElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1678
1711
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1679
1712
|
}
|
|
1713
|
+
/** Events dispatched by `<c-tree-select>`. */
|
|
1714
|
+
export interface CTreeSelectElementEventMap {
|
|
1715
|
+
/**
|
|
1716
|
+
* Fired when the selection changes — an item is committed or the selection
|
|
1717
|
+
* is cleared — carrying the new value: the item's value, the
|
|
1718
|
+
* `CTreeSelectSelection` with `return-object`, or `null` when cleared.
|
|
1719
|
+
*/
|
|
1720
|
+
change: CustomEvent<CTreeSelectValue>;
|
|
1721
|
+
/**
|
|
1722
|
+
* Fired whenever the query changes — on every keystroke in the search
|
|
1723
|
+
* input, and with an empty string when the panel opens. Carries the query
|
|
1724
|
+
* string.
|
|
1725
|
+
*/
|
|
1726
|
+
'change:query': CustomEvent<string>;
|
|
1727
|
+
/**
|
|
1728
|
+
* Native bubbling input event dispatched alongside every value change so a
|
|
1729
|
+
* plain `v-model` stays in sync. Carries no detail.
|
|
1730
|
+
*/
|
|
1731
|
+
input: CustomEvent<void>;
|
|
1732
|
+
/** Fired alongside `change` with the same detail — the `v-model` contract. */
|
|
1733
|
+
'update:value': CustomEvent<CTreeSelectValue>;
|
|
1734
|
+
}
|
|
1735
|
+
/** A hierarchical value-selection component: a readonly value field that opens a panel for browsing a tree one level at a time, or searching it as a whole, to commit one item. */
|
|
1736
|
+
export interface CTreeSelectElement extends Omit<HTMLElement, 'allowBranch' | 'clearable' | 'disabled' | 'errorMessage' | 'filter' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'levelLabels' | 'name' | 'placeholder' | 'required' | 'returnObject' | 'shadow' | 'size' | 'texts' | 'valid' | 'value'> {
|
|
1737
|
+
/**
|
|
1738
|
+
* Let a branch be committed as the value: a pinned select-branch row heads
|
|
1739
|
+
* every level below the root, and matching branches are listed as search
|
|
1740
|
+
* results
|
|
1741
|
+
*/
|
|
1742
|
+
allowBranch?: boolean;
|
|
1743
|
+
/** Make the selected value clearable */
|
|
1744
|
+
clearable?: boolean;
|
|
1745
|
+
/** Disable the field */
|
|
1746
|
+
disabled?: boolean;
|
|
1747
|
+
/** Error message shown in place of the hint while the field is invalid */
|
|
1748
|
+
errorMessage?: string;
|
|
1749
|
+
/**
|
|
1750
|
+
* Custom search predicate; receives the item, the query and the item's
|
|
1751
|
+
* ancestors. Functions have no attribute form — bind as a DOM property
|
|
1752
|
+
*/
|
|
1753
|
+
filter?: CTreeSelectFilter;
|
|
1754
|
+
/** Hide the hint and error messages */
|
|
1755
|
+
hideDetails?: boolean;
|
|
1756
|
+
/** Hint text for the field */
|
|
1757
|
+
hint?: string;
|
|
1758
|
+
/** Id of the element */
|
|
1759
|
+
hostId?: string;
|
|
1760
|
+
/**
|
|
1761
|
+
* The tree to pick from. Arrays have no attribute form — bind as a DOM
|
|
1762
|
+
* property (`:items.prop` in Vue)
|
|
1763
|
+
*/
|
|
1764
|
+
items?: CTreeSelectItem[];
|
|
1765
|
+
/** Items per page before the list scrolls */
|
|
1766
|
+
itemsPerPage?: number;
|
|
1767
|
+
/** Element label */
|
|
1768
|
+
label?: string;
|
|
1769
|
+
/** Label on top of the field */
|
|
1770
|
+
labelOnTop?: boolean;
|
|
1771
|
+
/**
|
|
1772
|
+
* Names of the levels, top level first, shown in the panel header; a
|
|
1773
|
+
* missing entry falls back to `texts.level(n)`. Arrays have no attribute
|
|
1774
|
+
* form — bind as a DOM property
|
|
1775
|
+
*/
|
|
1776
|
+
levelLabels?: string[];
|
|
1777
|
+
/** Input field name */
|
|
1778
|
+
name?: string;
|
|
1779
|
+
/** Placeholder for the search input inside the panel */
|
|
1780
|
+
placeholder?: string;
|
|
1781
|
+
/** Set the field as required */
|
|
1782
|
+
required?: boolean;
|
|
1783
|
+
/**
|
|
1784
|
+
* Emit the committed item with its path as a `CTreeSelectSelection` instead
|
|
1785
|
+
* of its value
|
|
1786
|
+
*/
|
|
1787
|
+
returnObject?: boolean;
|
|
1788
|
+
/** Shadow variant */
|
|
1789
|
+
shadow?: boolean;
|
|
1790
|
+
/** Field height: the 44px default or the 36px `small` box */
|
|
1791
|
+
size?: 'default' | 'small';
|
|
1792
|
+
/**
|
|
1793
|
+
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
1794
|
+
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
1795
|
+
*/
|
|
1796
|
+
texts?: CTreeSelectTexts;
|
|
1797
|
+
/** Set the validity of the field */
|
|
1798
|
+
valid?: boolean;
|
|
1799
|
+
/**
|
|
1800
|
+
* Selected value: the committed item's value, or the `CTreeSelectSelection`
|
|
1801
|
+
* with `return-object`; `null` when nothing is selected
|
|
1802
|
+
*/
|
|
1803
|
+
value?: CTreeSelectValue;
|
|
1804
|
+
addEventListener<K extends keyof CTreeSelectElementEventMap>(type: K, listener: (this: CTreeSelectElement, ev: CTreeSelectElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
1805
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1806
|
+
removeEventListener<K extends keyof CTreeSelectElementEventMap>(type: K, listener: (this: CTreeSelectElement, ev: CTreeSelectElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
|
|
1807
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1808
|
+
}
|
|
1680
1809
|
declare global {
|
|
1681
1810
|
interface HTMLElementTagNameMap {
|
|
1682
1811
|
'c-accordion': CAccordionElement;
|
|
@@ -1750,6 +1879,7 @@ declare global {
|
|
|
1750
1879
|
'c-toasts': CToastsElement;
|
|
1751
1880
|
'c-toolbar': CToolbarElement;
|
|
1752
1881
|
'c-tooltip': CTooltipElement;
|
|
1882
|
+
'c-tree-select': CTreeSelectElement;
|
|
1753
1883
|
}
|
|
1754
1884
|
}
|
|
1755
1885
|
export {};
|
package/package.json
CHANGED