@cscfi/csc-ui 4.0.0-alpha.11 → 4.0.0-alpha.12
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 +7297 -6845
- package/dist/custom-elements.json +259 -56
- package/dist/docs/c-autocomplete/usage.md +97 -0
- 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-select/usage.md +71 -0
- package/dist/vscode.css-custom-data.json +53 -0
- package/dist/vscode.html-custom-data.json +34 -19
- package/dist/web-types.json +153 -51
- package/dist-types/components/c-autocomplete/CAutocomplete.vue.d.ts +70 -11
- package/dist-types/components/c-checkbox/CCheckbox.vue.d.ts +2 -2
- package/dist-types/components/c-data-table/CDataTable.vue.d.ts +1 -1
- package/dist-types/components/c-dropdown/CDropdown.vue.d.ts +15 -3
- package/dist-types/components/c-input/CInput.vue.d.ts +1 -1
- package/dist-types/components/c-menu/CMenu.vue.d.ts +1 -1
- package/dist-types/components/c-popover/CPopover.vue.d.ts +1 -1
- package/dist-types/components/c-select/CSelect.vue.d.ts +68 -17
- package/dist-types/components/c-side-navigation/CSideNavigation.vue.d.ts +1 -1
- package/dist-types/components/c-tag/CTag.vue.d.ts +7 -0
- package/dist-types/components/c-text-field/CTextField.vue.d.ts +3 -3
- package/dist-types/components/c-tooltip/CTooltip.vue.d.ts +1 -1
- package/dist-types/index.d.ts +2 -1
- package/dist-types/shared/FormLabel.vue.d.ts +1 -1
- package/dist-types/shared/SelectionIndicator.vue.d.ts +21 -0
- package/dist-types/shared/optionLabel.d.ts +18 -0
- package/dist-types/shared/peekCap.d.ts +35 -0
- package/dist-types/shared/splitMatches.d.ts +18 -0
- package/dist-types/tag-name-map.d.ts +78 -17
- package/package.json +1 -1
|
@@ -15,25 +15,35 @@ interface CDropdownProps {
|
|
|
15
15
|
items?: ArrayLike<DropdownItem>;
|
|
16
16
|
/** Items per page before adding scroll */
|
|
17
17
|
itemsPerPage?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Multi-select mode: rows toggle instead of committing, each carries a
|
|
20
|
+
* decorative checkbox indicator, and the listbox is `aria-multiselectable`
|
|
21
|
+
*/
|
|
22
|
+
multiple?: boolean;
|
|
18
23
|
/** Dropdown parent (the c-select / c-autocomplete host element) */
|
|
19
24
|
parent?: HTMLElement | null;
|
|
25
|
+
/**
|
|
26
|
+
* Values of the currently selected items in `multiple` mode; drives each
|
|
27
|
+
* row's `aria-selected` and its indicator
|
|
28
|
+
*/
|
|
29
|
+
selected?: (number | string)[];
|
|
20
30
|
/** Parent type — drives autocomplete-only behaviour (highlight, messages) */
|
|
21
31
|
type?: CDropdownParentType;
|
|
22
32
|
}
|
|
23
33
|
type DropdownItem = {
|
|
24
|
-
disabled?: boolean;
|
|
34
|
+
disabled?: boolean | string;
|
|
25
35
|
name: string;
|
|
26
36
|
outerHTML?: string;
|
|
27
37
|
selected?: boolean;
|
|
28
38
|
value: number | string;
|
|
29
39
|
};
|
|
30
|
-
declare var __VLS_1: {}, __VLS_3: {},
|
|
40
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_15: {};
|
|
31
41
|
type __VLS_Slots = {} & {
|
|
32
42
|
default?: (props: typeof __VLS_1) => any;
|
|
33
43
|
} & {
|
|
34
44
|
'input-top'?: (props: typeof __VLS_3) => any;
|
|
35
45
|
} & {
|
|
36
|
-
'input-bottom'?: (props: typeof
|
|
46
|
+
'input-bottom'?: (props: typeof __VLS_15) => any;
|
|
37
47
|
};
|
|
38
48
|
declare const __VLS_base: import("vue").DefineComponent<CDropdownProps, {
|
|
39
49
|
close: () => void;
|
|
@@ -44,9 +54,11 @@ declare const __VLS_base: import("vue").DefineComponent<CDropdownProps, {
|
|
|
44
54
|
updateList: (reset?: boolean) => void;
|
|
45
55
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CDropdownProps> & Readonly<{}>, {
|
|
46
56
|
type: CDropdownParentType;
|
|
57
|
+
multiple: boolean;
|
|
47
58
|
hostId: string;
|
|
48
59
|
items: ArrayLike<DropdownItem>;
|
|
49
60
|
itemsPerPage: number;
|
|
61
|
+
selected: (number | string)[];
|
|
50
62
|
dropdownItemType: CDropdownItemType;
|
|
51
63
|
index: null | number;
|
|
52
64
|
parent: HTMLElement | null;
|
|
@@ -90,9 +90,9 @@ declare const __VLS_base: import("vue").DefineComponent<CInputProps, {}, {}, {},
|
|
|
90
90
|
shadow: boolean;
|
|
91
91
|
size: CFieldSize;
|
|
92
92
|
valid: boolean;
|
|
93
|
-
inputId: string;
|
|
94
93
|
active: boolean;
|
|
95
94
|
filled: boolean;
|
|
95
|
+
inputId: string;
|
|
96
96
|
isTextarea: boolean;
|
|
97
97
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
98
98
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -23,8 +23,8 @@ type __VLS_Slots = {} & {
|
|
|
23
23
|
default?: (props: typeof __VLS_3) => any;
|
|
24
24
|
};
|
|
25
25
|
declare const __VLS_base: import("vue").DefineComponent<CMenuProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CMenuProps> & Readonly<{}>, {
|
|
26
|
-
open: boolean;
|
|
27
26
|
distance: number | string;
|
|
27
|
+
open: boolean;
|
|
28
28
|
position: CPlacement;
|
|
29
29
|
trigger: HTMLElement | string;
|
|
30
30
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -27,8 +27,8 @@ declare const _default: typeof __VLS_export;
|
|
|
27
27
|
export default _default;
|
|
28
28
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CPopoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CPopoverProps> & Readonly<{}>, {
|
|
29
29
|
heading: string;
|
|
30
|
-
open: boolean;
|
|
31
30
|
distance: number | string;
|
|
31
|
+
open: boolean;
|
|
32
32
|
position: CPlacement;
|
|
33
33
|
trigger: HTMLElement | string;
|
|
34
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CFieldSize, CSelectItem } from '../../types';
|
|
2
|
-
interface CSelectProps {
|
|
2
|
+
export interface CSelectProps {
|
|
3
3
|
/** Make the selected value clearable */
|
|
4
4
|
clearable?: boolean;
|
|
5
5
|
/** Disable the input */
|
|
@@ -38,6 +38,20 @@ interface CSelectProps {
|
|
|
38
38
|
labelOnTop?: boolean;
|
|
39
39
|
/** Show loading state */
|
|
40
40
|
loading?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* In `multiple` mode, show at most this many selected-value tags and fold
|
|
43
|
+
* the rest into one "+N more" tag; `0` shows no tags and reads "N selected"
|
|
44
|
+
* instead; unset shows every tag
|
|
45
|
+
*/
|
|
46
|
+
maxTags?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Allow selecting several options: rows toggle and the list stays open,
|
|
49
|
+
* `value` becomes an array of the selected values (items with
|
|
50
|
+
* `return-object`) in the order they were picked, and the picks show as
|
|
51
|
+
* tags inside the field. `option-as-selection` is ignored in this mode.
|
|
52
|
+
* Arrays have no attribute form — bind `value` as a DOM property
|
|
53
|
+
*/
|
|
54
|
+
multiple?: boolean;
|
|
41
55
|
/**
|
|
42
56
|
* Input field name
|
|
43
57
|
*
|
|
@@ -60,25 +74,57 @@ interface CSelectProps {
|
|
|
60
74
|
shadow?: boolean;
|
|
61
75
|
/** Field height: the 44px default or the 36px `small` box */
|
|
62
76
|
size?: CFieldSize;
|
|
77
|
+
/**
|
|
78
|
+
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
79
|
+
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
80
|
+
*/
|
|
81
|
+
texts?: CSelectTexts;
|
|
63
82
|
/** Set the validity of the input */
|
|
64
83
|
valid?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Selected value: the option's value, or the whole item with
|
|
86
|
+
* `return-object`; an array of them in `multiple` mode
|
|
87
|
+
*/
|
|
88
|
+
value?: CSelectValue;
|
|
67
89
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
/**
|
|
91
|
+
* UI texts of `c-select`, shallow-merged over the English defaults. Static
|
|
92
|
+
* labels are strings; count- or label-interpolated ones are functions.
|
|
93
|
+
*/
|
|
94
|
+
export interface CSelectTexts {
|
|
95
|
+
/** Accessible label of the clear button. */
|
|
96
|
+
clearSelection?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Text of the overflow tag when `max-tags` folds the selection; receives the
|
|
99
|
+
* number of hidden tags.
|
|
100
|
+
*/
|
|
101
|
+
more?: (count: number) => string;
|
|
102
|
+
/** Accessible label of a tag's remove button; receives the option label. */
|
|
103
|
+
remove?: (label: string) => string;
|
|
104
|
+
/**
|
|
105
|
+
* Field text when `max-tags="0"` shows no tags; receives the selection
|
|
106
|
+
* count.
|
|
107
|
+
*/
|
|
108
|
+
selected?: (count: number) => string;
|
|
109
|
+
/** Accessible label of the chevron button that opens and closes the list. */
|
|
110
|
+
toggleOptions?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Selection value of `c-select`: the picked option's value — or the whole
|
|
114
|
+
* `{ name, value }` item with `return-object` — and `null` when nothing is
|
|
115
|
+
* selected. In `multiple` mode an array of them in the order they were
|
|
116
|
+
* picked, `[]` when empty.
|
|
117
|
+
*/
|
|
118
|
+
export type CSelectValue = (number | string)[] | CSelectItem | CSelectItem[] | null | number | string;
|
|
119
|
+
declare const _default: typeof __VLS_export;
|
|
120
|
+
export default _default;
|
|
121
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CSelectProps, {
|
|
77
122
|
reset: () => void;
|
|
78
123
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CSelectProps> & Readonly<{}>, {
|
|
79
124
|
label: string;
|
|
80
|
-
value:
|
|
125
|
+
value: CSelectValue;
|
|
81
126
|
name: string;
|
|
127
|
+
multiple: boolean;
|
|
82
128
|
clearable: boolean;
|
|
83
129
|
disabled: boolean;
|
|
84
130
|
errorMessage: string;
|
|
@@ -89,17 +135,22 @@ declare const __VLS_base: import("vue").DefineComponent<CSelectProps, {
|
|
|
89
135
|
itemsPerPage: number;
|
|
90
136
|
labelOnTop: boolean;
|
|
91
137
|
loading: boolean;
|
|
138
|
+
maxTags: number;
|
|
92
139
|
placeholder: string;
|
|
93
140
|
required: boolean;
|
|
94
141
|
returnObject: boolean;
|
|
95
142
|
shadow: boolean;
|
|
96
143
|
size: CFieldSize;
|
|
144
|
+
texts: CSelectTexts;
|
|
97
145
|
valid: boolean;
|
|
98
146
|
optionAsSelection: boolean;
|
|
99
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
147
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
148
|
+
pre?: (props: {}) => any;
|
|
149
|
+
} & {
|
|
150
|
+
default?: (props: {}) => any;
|
|
151
|
+
} & {
|
|
152
|
+
post?: (props: {}) => any;
|
|
153
|
+
}>;
|
|
103
154
|
type __VLS_WithSlots<T, S> = T & {
|
|
104
155
|
new (): {
|
|
105
156
|
$slots: S;
|
|
@@ -25,8 +25,8 @@ type __VLS_Slots = {} & {
|
|
|
25
25
|
bottom?: (props: typeof __VLS_16) => any;
|
|
26
26
|
};
|
|
27
27
|
declare const __VLS_base: import("vue").DefineComponent<CSideNavigationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CSideNavigationProps> & Readonly<{}>, {
|
|
28
|
-
mobile: boolean;
|
|
29
28
|
menuVisible: boolean;
|
|
29
|
+
mobile: boolean;
|
|
30
30
|
styles: null | Record<string, string>;
|
|
31
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
32
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -17,6 +17,12 @@ export interface CTagProps {
|
|
|
17
17
|
* @seeded from csc-ui — verify
|
|
18
18
|
*/
|
|
19
19
|
closeable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Accessible name of the close button rendered when `closeable`
|
|
22
|
+
*
|
|
23
|
+
* @freeform
|
|
24
|
+
*/
|
|
25
|
+
closeLabel?: string;
|
|
20
26
|
/**
|
|
21
27
|
* Remove the hover effect
|
|
22
28
|
*
|
|
@@ -43,6 +49,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTagPr
|
|
|
43
49
|
active: boolean;
|
|
44
50
|
badge: null | number | string;
|
|
45
51
|
closeable: boolean;
|
|
52
|
+
closeLabel: string;
|
|
46
53
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
47
54
|
default?: (props: {}) => any;
|
|
48
55
|
}>;
|
|
@@ -166,6 +166,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTextF
|
|
|
166
166
|
value: string;
|
|
167
167
|
type: CTextFieldType;
|
|
168
168
|
name: string;
|
|
169
|
+
autocorrect: boolean;
|
|
169
170
|
disabled: boolean;
|
|
170
171
|
errorMessage: string;
|
|
171
172
|
hideDetails: boolean;
|
|
@@ -177,13 +178,12 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTextF
|
|
|
177
178
|
shadow: boolean;
|
|
178
179
|
size: CFieldSize;
|
|
179
180
|
valid: boolean;
|
|
180
|
-
autocomplete: string;
|
|
181
|
-
readonly: boolean;
|
|
182
|
-
autocorrect: boolean;
|
|
183
181
|
max: null | number;
|
|
184
182
|
min: null | number;
|
|
185
183
|
step: null | number;
|
|
184
|
+
autocomplete: string;
|
|
186
185
|
automaticCapitalize: CTextFieldAutocapitalize;
|
|
186
|
+
readonly: boolean;
|
|
187
187
|
rows: number;
|
|
188
188
|
trimWhitespace: boolean;
|
|
189
189
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
@@ -32,8 +32,8 @@ declare const _default: typeof __VLS_export;
|
|
|
32
32
|
export default _default;
|
|
33
33
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CTooltipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CTooltipProps> & Readonly<{}>, {
|
|
34
34
|
text: string;
|
|
35
|
-
open: boolean;
|
|
36
35
|
distance: number | string;
|
|
36
|
+
open: boolean;
|
|
37
37
|
position: CPlacement;
|
|
38
38
|
trigger: HTMLElement | string;
|
|
39
39
|
delay: number | string;
|
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';
|
|
@@ -10,6 +10,7 @@ export type { CLoginCardBlendMode, CLoginCardProps, } from './components/c-login
|
|
|
10
10
|
export type { CPaginationOptions, CPaginationProps, CPaginationSize, } from './components/c-pagination/CPagination.vue';
|
|
11
11
|
export type { CPopoverProps } from './components/c-popover/CPopover.vue';
|
|
12
12
|
export type { CProgressCircleProps } from './components/c-progress-circle/CProgressCircle.vue';
|
|
13
|
+
export type { CSelectProps, CSelectTexts, CSelectValue, } from './components/c-select/CSelect.vue';
|
|
13
14
|
export type { CStatusProps, CStatusType, } from './components/c-status/CStatus.vue';
|
|
14
15
|
export type { CTabButtonsProps, CTabButtonsSize, } from './components/c-tab-buttons/CTabButtons.vue';
|
|
15
16
|
export type { CTabsJustify, CTabsProps } from './components/c-tabs/CTabs.vue';
|
|
@@ -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";
|
|
23
24
|
htmlFor: string;
|
|
24
25
|
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,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,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,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,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split a label into the runs that equal the query and the runs between them
|
|
3
|
+
* — the shape `c-autocomplete`'s match marking renders as text and
|
|
4
|
+
* `<mark part="match">` nodes (ADR-0045).
|
|
5
|
+
*
|
|
6
|
+
* The query is matched literally (regex metacharacters escaped — the 3.x
|
|
7
|
+
* implementation built an unescaped RegExp and threw on `c++` or `(`) and
|
|
8
|
+
* case-insensitively via the `i` flag on the original string, so indices never
|
|
9
|
+
* drift the way a lowercased `indexOf` can when case mapping changes a
|
|
10
|
+
* string's length. Every occurrence is marked, left to right, without
|
|
11
|
+
* overlap; adjacent occurrences yield adjacent marks. An empty query yields
|
|
12
|
+
* one plain run (or nothing for empty text).
|
|
13
|
+
*/
|
|
14
|
+
export interface MatchSegment {
|
|
15
|
+
match: boolean;
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const splitMatches: (text: string, query: string) => MatchSegment[];
|
|
@@ -7,15 +7,16 @@
|
|
|
7
7
|
* `document.createElement('c-button')` and `querySelector('c-button')`
|
|
8
8
|
* return the typed element.
|
|
9
9
|
*/
|
|
10
|
-
import type { CAutocompleteFilter, CAutocompleteItem } from './components/c-autocomplete/CAutocomplete.vue';
|
|
10
|
+
import type { CAutocompleteFilter, CAutocompleteItem, CAutocompleteTexts, CAutocompleteValue } from './components/c-autocomplete/CAutocomplete.vue';
|
|
11
11
|
import type { CButtonGroupValue } from './components/c-button-group/CButtonGroup.vue';
|
|
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
|
+
import type { CSelectTexts, CSelectValue } from './components/c-select/CSelect.vue';
|
|
14
15
|
import type { CSelectItem, CToastMessage } from './types';
|
|
15
16
|
type AccordionPrimitive = number | string;
|
|
16
17
|
type AccordionValue = AccordionPrimitive | AccordionPrimitive[] | null;
|
|
17
18
|
type DropdownItem = {
|
|
18
|
-
disabled?: boolean;
|
|
19
|
+
disabled?: boolean | string;
|
|
19
20
|
name: string;
|
|
20
21
|
outerHTML?: string;
|
|
21
22
|
selected?: boolean;
|
|
@@ -133,9 +134,10 @@ export interface CAutocompleteElementEventMap {
|
|
|
133
134
|
* Fired when the selected value changes (an option is committed or the
|
|
134
135
|
* selection is cleared), carrying the new value — the option's value, or
|
|
135
136
|
* the whole `{ name, value }` item when `return-object` is set; `null`
|
|
136
|
-
* when cleared.
|
|
137
|
+
* when cleared. In `multiple` mode the whole array of picked values, in
|
|
138
|
+
* pick order (`[]` when cleared).
|
|
137
139
|
*/
|
|
138
|
-
changeValue: CustomEvent<
|
|
140
|
+
changeValue: CustomEvent<CAutocompleteValue>;
|
|
139
141
|
/**
|
|
140
142
|
* Native bubbling input event dispatched alongside every value change so a
|
|
141
143
|
* plain `v-model` stays in sync. Carries no detail.
|
|
@@ -145,10 +147,10 @@ export interface CAutocompleteElementEventMap {
|
|
|
145
147
|
* Fired alongside `changeValue` with the same detail — the `v-model`
|
|
146
148
|
* contract.
|
|
147
149
|
*/
|
|
148
|
-
'update:value': CustomEvent<
|
|
150
|
+
'update:value': CustomEvent<CAutocompleteValue>;
|
|
149
151
|
}
|
|
150
152
|
/** A filterable value-selection component: a readonly value field that opens a popover panel with a search input above the matching options. */
|
|
151
|
-
export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'disabled' | 'errorMessage' | 'external' | 'filter' | 'hideDetails' | 'hint' | 'hostId' | 'items' | 'itemsPerPage' | 'label' | 'labelOnTop' | 'loading' | '
|
|
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'> {
|
|
152
154
|
/** Make the selected value clearable */
|
|
153
155
|
clearable?: boolean;
|
|
154
156
|
/** Disable the input */
|
|
@@ -179,10 +181,22 @@ export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'd
|
|
|
179
181
|
labelOnTop?: boolean;
|
|
180
182
|
/** Show loading state */
|
|
181
183
|
loading?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* In `multiple` mode, show at most this many selected-value tags and fold
|
|
186
|
+
* the rest into one "+N more" tag; `0` shows no tags and reads "N selected"
|
|
187
|
+
* instead; unset shows every tag
|
|
188
|
+
*/
|
|
189
|
+
maxTags?: number;
|
|
190
|
+
/**
|
|
191
|
+
* Allow selecting several options: rows toggle, the panel stays open and
|
|
192
|
+
* keeps its query, `value` becomes an array of the selected values (items
|
|
193
|
+
* with `return-object`) in the order they were picked, and the picks show
|
|
194
|
+
* as tags inside the field. Arrays have no attribute form — bind `value` as
|
|
195
|
+
* a DOM property
|
|
196
|
+
*/
|
|
197
|
+
multiple?: boolean;
|
|
182
198
|
/** Input field name */
|
|
183
199
|
name?: string;
|
|
184
|
-
/** Message shown when the query matches no options */
|
|
185
|
-
noResultsText?: string;
|
|
186
200
|
/** Placeholder for the in-panel search input */
|
|
187
201
|
placeholder?: string;
|
|
188
202
|
/** Set the autocomplete as required */
|
|
@@ -193,10 +207,18 @@ export interface CAutocompleteElement extends Omit<HTMLElement, 'clearable' | 'd
|
|
|
193
207
|
shadow?: boolean;
|
|
194
208
|
/** Field height: the 44px default or the 36px `small` box */
|
|
195
209
|
size?: 'default' | 'small';
|
|
210
|
+
/**
|
|
211
|
+
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
212
|
+
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
213
|
+
*/
|
|
214
|
+
texts?: CAutocompleteTexts;
|
|
196
215
|
/** Set the validity of the input */
|
|
197
216
|
valid?: boolean;
|
|
198
|
-
/**
|
|
199
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Selected value: the option's value, or the whole item with
|
|
219
|
+
* `return-object`; an array of them in `multiple` mode
|
|
220
|
+
*/
|
|
221
|
+
value?: CAutocompleteValue;
|
|
200
222
|
/** Reset autocomplete state */
|
|
201
223
|
reset(): void;
|
|
202
224
|
addEventListener<K extends keyof CAutocompleteElementEventMap>(type: K, listener: (this: CAutocompleteElement, ev: CAutocompleteElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -495,7 +517,7 @@ export interface CDropdownElementEventMap {
|
|
|
495
517
|
value: number | string;
|
|
496
518
|
}>;
|
|
497
519
|
}
|
|
498
|
-
export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' | 'hostId' | 'index' | 'items' | 'itemsPerPage' | 'parent' | 'type'> {
|
|
520
|
+
export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' | 'hostId' | 'index' | 'items' | 'itemsPerPage' | 'multiple' | 'parent' | 'selected' | 'type'> {
|
|
499
521
|
/** Whether items are <c-option> elements or plain objects */
|
|
500
522
|
dropdownItemType?: 'item' | 'option';
|
|
501
523
|
/** Id used to build option/announce element ids */
|
|
@@ -506,8 +528,18 @@ export interface CDropdownElement extends Omit<HTMLElement, 'dropdownItemType' |
|
|
|
506
528
|
items?: ArrayLike<DropdownItem>;
|
|
507
529
|
/** Items per page before adding scroll */
|
|
508
530
|
itemsPerPage?: number;
|
|
531
|
+
/**
|
|
532
|
+
* Multi-select mode: rows toggle instead of committing, each carries a
|
|
533
|
+
* decorative checkbox indicator, and the listbox is `aria-multiselectable`
|
|
534
|
+
*/
|
|
535
|
+
multiple?: boolean;
|
|
509
536
|
/** Dropdown parent (the c-select / c-autocomplete host element) */
|
|
510
537
|
parent?: HTMLElement | null;
|
|
538
|
+
/**
|
|
539
|
+
* Values of the currently selected items in `multiple` mode; drives each
|
|
540
|
+
* row's `aria-selected` and its indicator
|
|
541
|
+
*/
|
|
542
|
+
selected?: (number | string)[];
|
|
511
543
|
/** Parent type — drives autocomplete-only behaviour (highlight, messages) */
|
|
512
544
|
type?: 'autocomplete' | 'select';
|
|
513
545
|
/** Close dropdown */
|
|
@@ -703,6 +735,7 @@ export interface CMenuElementEventMap {
|
|
|
703
735
|
value: unknown;
|
|
704
736
|
}>;
|
|
705
737
|
}
|
|
738
|
+
/** A command menu: a transient panel of actions or navigation choices opened from a trigger (the WAI-ARIA menu-button pattern), authored declaratively with slotted `c-menu-item`, `c-menu-label` and `c-divider` elements. Activating an item fires a one-off `select` event and closes the menu; the menu holds no selected value — that is `c-select`'s job. */
|
|
706
739
|
export interface CMenuElement extends Omit<HTMLElement, 'distance' | 'open' | 'position' | 'trigger'> {
|
|
707
740
|
/** Distance from the trigger to the panel, in pixels. Defaults to `0`. */
|
|
708
741
|
distance?: number | string;
|
|
@@ -816,6 +849,7 @@ export interface COptionElement extends Omit<HTMLElement, 'disabled' | 'name' |
|
|
|
816
849
|
/** Option value */
|
|
817
850
|
value?: number | string;
|
|
818
851
|
}
|
|
852
|
+
/** The label region of a `c-option`: wraps the text that c-select and c-autocomplete use as the option's label — in the closed field, its tag and the autocomplete filter — so the option can carry a description or an icon beside its label, and the region in which c-autocomplete marks the runs equal to the query (`::part(match)`). */
|
|
819
853
|
export interface COptionValueElement extends HTMLElement {
|
|
820
854
|
}
|
|
821
855
|
/** Events dispatched by `<c-otp-input>`. */
|
|
@@ -1041,8 +1075,10 @@ export interface CSelectElementEventMap {
|
|
|
1041
1075
|
* Fired when the selection changes (an option is picked or the value is
|
|
1042
1076
|
* cleared), carrying the new value — the option's value, or the whole
|
|
1043
1077
|
* `{ name, value }` item when `return-object` is set; `null` when cleared.
|
|
1078
|
+
* In `multiple` mode the whole array of picked values, in pick order
|
|
1079
|
+
* (`[]` when cleared).
|
|
1044
1080
|
*/
|
|
1045
|
-
changeValue: CustomEvent<
|
|
1081
|
+
changeValue: CustomEvent<CSelectValue>;
|
|
1046
1082
|
/**
|
|
1047
1083
|
* Native bubbling input event dispatched alongside every value change so a
|
|
1048
1084
|
* plain `v-model` stays in sync. Carries no detail.
|
|
@@ -1052,9 +1088,10 @@ export interface CSelectElementEventMap {
|
|
|
1052
1088
|
* Fired alongside `changeValue` with the same detail — the `v-model`
|
|
1053
1089
|
* contract.
|
|
1054
1090
|
*/
|
|
1055
|
-
'update:value': CustomEvent<
|
|
1091
|
+
'update:value': CustomEvent<CSelectValue>;
|
|
1056
1092
|
}
|
|
1057
|
-
|
|
1093
|
+
/** 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'> {
|
|
1058
1095
|
/** Make the selected value clearable */
|
|
1059
1096
|
clearable?: boolean;
|
|
1060
1097
|
/** Disable the input */
|
|
@@ -1077,6 +1114,20 @@ export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disable
|
|
|
1077
1114
|
labelOnTop?: boolean;
|
|
1078
1115
|
/** Show loading state */
|
|
1079
1116
|
loading?: boolean;
|
|
1117
|
+
/**
|
|
1118
|
+
* In `multiple` mode, show at most this many selected-value tags and fold
|
|
1119
|
+
* the rest into one "+N more" tag; `0` shows no tags and reads "N selected"
|
|
1120
|
+
* instead; unset shows every tag
|
|
1121
|
+
*/
|
|
1122
|
+
maxTags?: number;
|
|
1123
|
+
/**
|
|
1124
|
+
* Allow selecting several options: rows toggle and the list stays open,
|
|
1125
|
+
* `value` becomes an array of the selected values (items with
|
|
1126
|
+
* `return-object`) in the order they were picked, and the picks show as
|
|
1127
|
+
* tags inside the field. `option-as-selection` is ignored in this mode.
|
|
1128
|
+
* Arrays have no attribute form — bind `value` as a DOM property
|
|
1129
|
+
*/
|
|
1130
|
+
multiple?: boolean;
|
|
1080
1131
|
/** Input field name */
|
|
1081
1132
|
name?: string;
|
|
1082
1133
|
/** Display the option as selection (only with <c-option> elements) */
|
|
@@ -1091,10 +1142,18 @@ export interface CSelectElement extends Omit<HTMLElement, 'clearable' | 'disable
|
|
|
1091
1142
|
shadow?: boolean;
|
|
1092
1143
|
/** Field height: the 44px default or the 36px `small` box */
|
|
1093
1144
|
size?: 'default' | 'small';
|
|
1145
|
+
/**
|
|
1146
|
+
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
1147
|
+
* no attribute form — bind as a DOM property (`:texts.prop` in Vue)
|
|
1148
|
+
*/
|
|
1149
|
+
texts?: CSelectTexts;
|
|
1094
1150
|
/** Set the validity of the input */
|
|
1095
1151
|
valid?: boolean;
|
|
1096
|
-
/**
|
|
1097
|
-
|
|
1152
|
+
/**
|
|
1153
|
+
* Selected value: the option's value, or the whole item with
|
|
1154
|
+
* `return-object`; an array of them in `multiple` mode
|
|
1155
|
+
*/
|
|
1156
|
+
value?: CSelectValue;
|
|
1098
1157
|
/** Reset select state */
|
|
1099
1158
|
reset(): void;
|
|
1100
1159
|
addEventListener<K extends keyof CSelectElementEventMap>(type: K, listener: (this: CSelectElement, ev: CSelectElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -1431,13 +1490,15 @@ export interface CTagElementEventMap {
|
|
|
1431
1490
|
/** Fired when the tag's close button is activated. */
|
|
1432
1491
|
close: CustomEvent<void>;
|
|
1433
1492
|
}
|
|
1434
|
-
export interface CTagElement extends Omit<HTMLElement, 'active' | 'badge' | 'closeable' | 'flat' | 'size'> {
|
|
1493
|
+
export interface CTagElement extends Omit<HTMLElement, 'active' | 'badge' | 'closeable' | 'closeLabel' | 'flat' | 'size'> {
|
|
1435
1494
|
/** Mark tag as active */
|
|
1436
1495
|
active?: boolean;
|
|
1437
1496
|
/** Display an optional badge at the start of the tag */
|
|
1438
1497
|
badge?: null | number | string;
|
|
1439
1498
|
/** Mark tag as closeable */
|
|
1440
1499
|
closeable?: boolean;
|
|
1500
|
+
/** Accessible name of the close button rendered when `closeable` */
|
|
1501
|
+
closeLabel?: string;
|
|
1441
1502
|
/** Remove the hover effect */
|
|
1442
1503
|
flat?: boolean;
|
|
1443
1504
|
/** Size of the tag */
|
package/package.json
CHANGED