@destyler/combobox 0.0.7-beta.5 → 0.0.7-beta.9
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/index.d.ts +389 -380
- package/dist/index.js +1401 -0
- package/package.json +15 -20
- package/dist/index.cjs +0 -1475
- package/dist/index.d.cts +0 -419
- package/dist/index.d.mts +0 -419
- package/dist/index.mjs +0 -1470
package/dist/index.d.ts
CHANGED
|
@@ -1,419 +1,428 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { CollectionItem, CollectionOptions, ListCollection } from
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from '@zag-js/dismissable';
|
|
9
|
-
import { PositioningOptions, Placement } from '@zag-js/popper';
|
|
10
|
-
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
1
|
+
import * as _destyler_anatomy0 from "@destyler/anatomy";
|
|
2
|
+
import { CollectionItem, CollectionItem as CollectionItem$1, CollectionOptions, CollectionOptions as CollectionOptions$1, ListCollection } from "@destyler/collection";
|
|
3
|
+
import * as _destyler_xstate0 from "@destyler/xstate";
|
|
4
|
+
import { AnyEventObject, Machine, XSend, XState } from "@destyler/xstate";
|
|
5
|
+
import { Placement, PositioningOptions } from "@destyler/popper";
|
|
6
|
+
import { FocusOutsideEvent, InteractOutsideEvent, InteractOutsideHandlers, PointerDownOutsideEvent } from "@destyler/dismissable";
|
|
7
|
+
import { CommonProperties, DirectionProperty, NormalizeProps, PropTypes, RequiredBy } from "@destyler/types";
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
//#region src/anatomy.d.ts
|
|
10
|
+
declare const anatomy: _destyler_anatomy0.AnatomyInstance<"root" | "clearTrigger" | "content" | "control" | "input" | "item" | "itemGroup" | "itemGroupLabel" | "itemIndicator" | "itemText" | "label" | "list" | "positioner" | "trigger">;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/collection.d.ts
|
|
13
|
+
declare function collection<T extends CollectionItem$1>(options: CollectionOptions$1<T>): ListCollection<T>;
|
|
15
14
|
declare namespace collection {
|
|
16
|
-
|
|
15
|
+
var empty: () => ListCollection<CollectionItem$1>;
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/types.d.ts
|
|
19
19
|
interface ValueChangeDetails<T extends CollectionItem = CollectionItem> {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
value: string[];
|
|
21
|
+
items: T[];
|
|
22
22
|
}
|
|
23
23
|
interface HighlightChangeDetails<T extends CollectionItem = CollectionItem> {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
highlightedValue: string | null;
|
|
25
|
+
highlightedItem: T | null;
|
|
26
26
|
}
|
|
27
27
|
interface InputValueChangeDetails {
|
|
28
|
-
|
|
28
|
+
inputValue: string;
|
|
29
29
|
}
|
|
30
30
|
interface OpenChangeDetails {
|
|
31
|
-
|
|
31
|
+
open: boolean;
|
|
32
32
|
}
|
|
33
33
|
interface ScrollToIndexDetails {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
index: number;
|
|
35
|
+
immediate?: boolean | undefined;
|
|
36
|
+
}
|
|
37
|
+
interface NavigateDetails {
|
|
38
|
+
value: string | null;
|
|
39
|
+
node: HTMLAnchorElement;
|
|
36
40
|
}
|
|
37
41
|
interface IntlTranslations {
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
triggerLabel?: string | undefined;
|
|
43
|
+
clearTriggerLabel?: string | undefined;
|
|
40
44
|
}
|
|
41
45
|
type ElementIds = Partial<{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
root: string;
|
|
47
|
+
label: string;
|
|
48
|
+
control: string;
|
|
49
|
+
input: string;
|
|
50
|
+
content: string;
|
|
51
|
+
trigger: string;
|
|
52
|
+
clearTrigger: string;
|
|
53
|
+
item: (id: string, index?: number) => string;
|
|
54
|
+
positioner: string;
|
|
55
|
+
itemGroup: (id: string | number) => string;
|
|
56
|
+
itemGroupLabel: (id: string | number) => string;
|
|
53
57
|
}>;
|
|
54
58
|
interface PublicContext<T extends CollectionItem = CollectionItem> extends DirectionProperty, CommonProperties, InteractOutsideHandlers {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Whether the combobox is open
|
|
61
|
+
*/
|
|
62
|
+
'open'?: boolean | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the combobox open state is controlled by the user
|
|
65
|
+
*/
|
|
66
|
+
'open.controlled'?: boolean | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* The ids of the elements in the combobox. Useful for composition.
|
|
69
|
+
*/
|
|
70
|
+
'ids'?: ElementIds | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* The current value of the combobox's input
|
|
73
|
+
*/
|
|
74
|
+
'inputValue': string;
|
|
75
|
+
/**
|
|
76
|
+
* The `name` attribute of the combobox's input. Useful for form submission
|
|
77
|
+
*/
|
|
78
|
+
'name'?: string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The associate form of the combobox.
|
|
81
|
+
*/
|
|
82
|
+
'form'?: string | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the combobox is disabled
|
|
85
|
+
*/
|
|
86
|
+
'disabled'?: boolean | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Whether the combobox is readonly. This puts the combobox in a "non-editable" mode
|
|
89
|
+
* but the user can still interact with it
|
|
90
|
+
*/
|
|
91
|
+
'readOnly'?: boolean | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the combobox is invalid
|
|
94
|
+
*/
|
|
95
|
+
'invalid'?: boolean | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the combobox is required
|
|
98
|
+
*/
|
|
99
|
+
'required'?: boolean | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* The placeholder text of the combobox's input
|
|
102
|
+
*/
|
|
103
|
+
'placeholder'?: string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* The active item's id. Used to set the `aria-activedescendant` attribute
|
|
106
|
+
*/
|
|
107
|
+
'highlightedValue': string | null;
|
|
108
|
+
/**
|
|
109
|
+
* The keys of the selected items
|
|
110
|
+
*/
|
|
111
|
+
'value': string[];
|
|
112
|
+
/**
|
|
113
|
+
* Defines the auto-completion behavior of the combobox.
|
|
114
|
+
*
|
|
115
|
+
* - `autohighlight`: The first focused item is highlighted as the user types
|
|
116
|
+
* - `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated
|
|
117
|
+
*
|
|
118
|
+
* @default "none"
|
|
119
|
+
*/
|
|
120
|
+
'inputBehavior': 'autohighlight' | 'autocomplete' | 'none';
|
|
121
|
+
/**
|
|
122
|
+
* The behavior of the combobox input when an item is selected
|
|
123
|
+
*
|
|
124
|
+
* - `replace`: The selected item string is set as the input value
|
|
125
|
+
* - `clear`: The input value is cleared
|
|
126
|
+
* - `preserve`: The input value is preserved
|
|
127
|
+
*
|
|
128
|
+
* @default "replace"
|
|
129
|
+
*/
|
|
130
|
+
'selectionBehavior': 'clear' | 'replace' | 'preserve';
|
|
131
|
+
/**
|
|
132
|
+
* Whether to autofocus the input on mount
|
|
133
|
+
*/
|
|
134
|
+
'autoFocus'?: boolean | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Whether to open the combobox popup on initial click on the input
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
'openOnClick'?: boolean | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Whether to show the combobox when the input value changes
|
|
142
|
+
* @default true
|
|
143
|
+
*/
|
|
144
|
+
'openOnChange'?: boolean | ((details: InputValueChangeDetails) => boolean) | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Whether to allow typing custom values in the input
|
|
147
|
+
*/
|
|
148
|
+
'allowCustomValue'?: boolean | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Whether to loop the keyboard navigation through the items
|
|
151
|
+
* @default true
|
|
152
|
+
*/
|
|
153
|
+
'loopFocus'?: boolean | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* The positioning options to dynamically position the menu
|
|
156
|
+
*/
|
|
157
|
+
'positioning': PositioningOptions;
|
|
158
|
+
/**
|
|
159
|
+
* Function called when the input's value changes
|
|
160
|
+
*/
|
|
161
|
+
'onInputValueChange'?: ((details: InputValueChangeDetails) => void) | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Function called when a new item is selected
|
|
164
|
+
*/
|
|
165
|
+
'onValueChange'?: ((details: ValueChangeDetails<T>) => void) | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* Function called when an item is highlighted using the pointer
|
|
168
|
+
* or keyboard navigation.
|
|
169
|
+
*/
|
|
170
|
+
'onHighlightChange'?: ((details: HighlightChangeDetails<T>) => void) | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Function called when the popup is opened
|
|
173
|
+
*/
|
|
174
|
+
'onOpenChange'?: ((details: OpenChangeDetails) => void) | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
177
|
+
*/
|
|
178
|
+
'translations': IntlTranslations;
|
|
179
|
+
/**
|
|
180
|
+
* The collection of items
|
|
181
|
+
*/
|
|
182
|
+
'collection': ListCollection<any>;
|
|
183
|
+
/**
|
|
184
|
+
* Whether to allow multiple selection.
|
|
185
|
+
*
|
|
186
|
+
* **Good to know:** When `multiple` is `true`, the `selectionBehavior` is automatically set to `clear`.
|
|
187
|
+
* It is recommended to render the selected items in a separate container.
|
|
188
|
+
*/
|
|
189
|
+
'multiple'?: boolean | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Whether to close the combobox when an item is selected.
|
|
192
|
+
*/
|
|
193
|
+
'closeOnSelect'?: boolean | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* Whether to open the combobox on arrow key press
|
|
196
|
+
* @default true
|
|
197
|
+
*/
|
|
198
|
+
'openOnKeyPress': boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Function to scroll to a specific index
|
|
201
|
+
*/
|
|
202
|
+
'scrollToIndexFn'?: ((details: ScrollToIndexDetails) => void) | undefined;
|
|
203
|
+
/**
|
|
204
|
+
* Whether the combobox is a composed with other composite widgets like tabs
|
|
205
|
+
* @default true
|
|
206
|
+
*/
|
|
207
|
+
'composite': boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Whether to disable registering this a dismissable layer
|
|
210
|
+
*/
|
|
211
|
+
'disableLayer'?: boolean | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Function to navigate to the selected item
|
|
214
|
+
*/
|
|
215
|
+
'navigate': (details: NavigateDetails) => void;
|
|
208
216
|
}
|
|
209
217
|
type UserDefinedContext<T extends CollectionItem = CollectionItem> = RequiredBy<PublicContext<T>, 'id' | 'collection'>;
|
|
210
218
|
type ComputedContext = Readonly<{
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
219
|
+
/**
|
|
220
|
+
* @computed
|
|
221
|
+
* Whether the input's value is empty
|
|
222
|
+
*/
|
|
223
|
+
isInputValueEmpty: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* @computed
|
|
226
|
+
* Whether the combobox is interactive
|
|
227
|
+
*/
|
|
228
|
+
isInteractive: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* @computed
|
|
231
|
+
*/
|
|
232
|
+
autoComplete: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* @computed
|
|
235
|
+
*/
|
|
236
|
+
autoHighlight: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* @computed
|
|
239
|
+
* Whether there's a selected option
|
|
240
|
+
*/
|
|
241
|
+
hasSelectedItems: boolean;
|
|
234
242
|
}>;
|
|
235
243
|
interface PrivateContext<T extends CollectionItem = CollectionItem> {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
interface MachineContext extends PublicContext, PrivateContext, ComputedContext {
|
|
244
|
+
/**
|
|
245
|
+
* @internal
|
|
246
|
+
* The placement of the combobox popover.
|
|
247
|
+
*/
|
|
248
|
+
currentPlacement?: Placement | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* The highlighted item
|
|
251
|
+
*/
|
|
252
|
+
highlightedItem: T | null;
|
|
253
|
+
/**
|
|
254
|
+
* @internal
|
|
255
|
+
* The selected items
|
|
256
|
+
*/
|
|
257
|
+
selectedItems: T[];
|
|
258
|
+
/**
|
|
259
|
+
* @internal
|
|
260
|
+
* The display value of the combobox (based on the selected items)
|
|
261
|
+
*/
|
|
262
|
+
valueAsString: string;
|
|
257
263
|
}
|
|
264
|
+
interface MachineContext extends PublicContext, PrivateContext, ComputedContext {}
|
|
258
265
|
interface MachineState {
|
|
259
|
-
|
|
260
|
-
|
|
266
|
+
value: 'idle' | 'focused' | 'suggesting' | 'interacting';
|
|
267
|
+
tags: 'open' | 'focused' | 'idle' | 'closed';
|
|
261
268
|
}
|
|
262
|
-
type State =
|
|
263
|
-
type Send =
|
|
264
|
-
type Service = Machine<MachineContext, MachineState,
|
|
269
|
+
type State = XState<MachineContext, MachineState>;
|
|
270
|
+
type Send = XSend<AnyEventObject>;
|
|
271
|
+
type Service = Machine<MachineContext, MachineState, AnyEventObject>;
|
|
265
272
|
interface TriggerProps {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
273
|
+
/**
|
|
274
|
+
* Whether the trigger is focusable
|
|
275
|
+
*/
|
|
276
|
+
focusable?: boolean | undefined;
|
|
270
277
|
}
|
|
271
278
|
interface ItemProps {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
/**
|
|
280
|
+
* Whether hovering outside should clear the highlighted state
|
|
281
|
+
*/
|
|
282
|
+
persistFocus?: boolean | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* The item to render
|
|
285
|
+
*/
|
|
286
|
+
item: CollectionItem;
|
|
280
287
|
}
|
|
281
288
|
interface ItemState {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
289
|
+
/**
|
|
290
|
+
* The value of the item
|
|
291
|
+
*/
|
|
292
|
+
value: string;
|
|
293
|
+
/**
|
|
294
|
+
* Whether the item is disabled
|
|
295
|
+
*/
|
|
296
|
+
disabled: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* Whether the item is selected
|
|
299
|
+
*/
|
|
300
|
+
selected: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Whether the item is highlighted via pointer or keyboard navigation
|
|
303
|
+
*/
|
|
304
|
+
highlighted: boolean;
|
|
298
305
|
}
|
|
299
306
|
interface ItemGroupProps {
|
|
300
|
-
|
|
307
|
+
id: string;
|
|
301
308
|
}
|
|
302
309
|
interface ItemGroupLabelProps {
|
|
303
|
-
|
|
310
|
+
htmlFor: string;
|
|
304
311
|
}
|
|
305
312
|
interface MachineApi<T extends PropTypes = PropTypes, V extends CollectionItem = CollectionItem> {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Whether the combobox is focused
|
|
315
|
+
*/
|
|
316
|
+
focused: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Whether the combobox is open
|
|
319
|
+
*/
|
|
320
|
+
open: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* The value of the combobox input
|
|
323
|
+
*/
|
|
324
|
+
inputValue: string;
|
|
325
|
+
/**
|
|
326
|
+
* The value of the highlighted item
|
|
327
|
+
*/
|
|
328
|
+
highlightedValue: string | null;
|
|
329
|
+
/**
|
|
330
|
+
* The highlighted item
|
|
331
|
+
*/
|
|
332
|
+
highlightedItem: V | null;
|
|
333
|
+
/**
|
|
334
|
+
* The value of the combobox input
|
|
335
|
+
*/
|
|
336
|
+
setHighlightValue: (value: string) => void;
|
|
337
|
+
/**
|
|
338
|
+
* Function to sync the selected items with the value.
|
|
339
|
+
* Useful when `value` is updated from async sources.
|
|
340
|
+
*/
|
|
341
|
+
syncSelectedItems: () => void;
|
|
342
|
+
/**
|
|
343
|
+
* The selected items
|
|
344
|
+
*/
|
|
345
|
+
selectedItems: V[];
|
|
346
|
+
/**
|
|
347
|
+
* Whether there's a selected item
|
|
348
|
+
*/
|
|
349
|
+
hasSelectedItems: boolean;
|
|
350
|
+
/**
|
|
351
|
+
* The selected item keys
|
|
352
|
+
*/
|
|
353
|
+
value: string[];
|
|
354
|
+
/**
|
|
355
|
+
* The string representation of the selected items
|
|
356
|
+
*/
|
|
357
|
+
valueAsString: string;
|
|
358
|
+
/**
|
|
359
|
+
* Function to select a value
|
|
360
|
+
*/
|
|
361
|
+
selectValue: (value: string) => void;
|
|
362
|
+
/**
|
|
363
|
+
* Function to set the value of the combobox
|
|
364
|
+
*/
|
|
365
|
+
setValue: (value: string[]) => void;
|
|
366
|
+
/**
|
|
367
|
+
* Function to clear the value of the combobox
|
|
368
|
+
*/
|
|
369
|
+
clearValue: (value?: string) => void;
|
|
370
|
+
/**
|
|
371
|
+
* Function to focus on the combobox input
|
|
372
|
+
*/
|
|
373
|
+
focus: () => void;
|
|
374
|
+
/**
|
|
375
|
+
* Function to set the input value of the combobox
|
|
376
|
+
*/
|
|
377
|
+
setInputValue: (value: string) => void;
|
|
378
|
+
/**
|
|
379
|
+
* Returns the state of a combobox item
|
|
380
|
+
*/
|
|
381
|
+
getItemState: (props: ItemProps) => ItemState;
|
|
382
|
+
/**
|
|
383
|
+
* Function to open or close the combobox
|
|
384
|
+
*/
|
|
385
|
+
setOpen: (open: boolean) => void;
|
|
386
|
+
/**
|
|
387
|
+
* Function to toggle the combobox
|
|
388
|
+
*/
|
|
389
|
+
collection: ListCollection<V>;
|
|
390
|
+
/**
|
|
391
|
+
* Function to set the collection of items
|
|
392
|
+
*/
|
|
393
|
+
setCollection: (collection: ListCollection<V>) => void;
|
|
394
|
+
/**
|
|
395
|
+
* Function to set the positioning options
|
|
396
|
+
*/
|
|
397
|
+
reposition: (options?: Partial<PositioningOptions>) => void;
|
|
398
|
+
/**
|
|
399
|
+
* Whether the combobox allows multiple selections
|
|
400
|
+
*/
|
|
401
|
+
multiple: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Whether the combobox is disabled
|
|
404
|
+
*/
|
|
405
|
+
disabled: boolean;
|
|
406
|
+
getRootProps: () => T['element'];
|
|
407
|
+
getLabelProps: () => T['label'];
|
|
408
|
+
getControlProps: () => T['element'];
|
|
409
|
+
getPositionerProps: () => T['element'];
|
|
410
|
+
getInputProps: () => T['input'];
|
|
411
|
+
getContentProps: () => T['element'];
|
|
412
|
+
getTriggerProps: (props?: TriggerProps) => T['button'];
|
|
413
|
+
getClearTriggerProps: () => T['button'];
|
|
414
|
+
getListProps: () => T['element'];
|
|
415
|
+
getItemProps: (props: ItemProps) => T['element'];
|
|
416
|
+
getItemTextProps: (props: ItemProps) => T['element'];
|
|
417
|
+
getItemIndicatorProps: (props: ItemProps) => T['element'];
|
|
418
|
+
getItemGroupProps: (props: ItemGroupProps) => T['element'];
|
|
419
|
+
getItemGroupLabelProps: (props: ItemGroupLabelProps) => T['element'];
|
|
413
420
|
}
|
|
414
|
-
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/connect.d.ts
|
|
415
423
|
declare function connect<T extends PropTypes, V extends CollectionItem>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T, V>;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/machine.d.ts
|
|
426
|
+
declare function machine<T extends CollectionItem>(userContext: UserDefinedContext<T>): _destyler_xstate0.Machine<MachineContext, MachineState, _destyler_xstate0.AnyEventObject>;
|
|
427
|
+
//#endregion
|
|
428
|
+
export { type MachineApi as Api, type CollectionItem, type CollectionOptions, type UserDefinedContext as Context, type ElementIds, type FocusOutsideEvent, type HighlightChangeDetails, type InputValueChangeDetails, type InteractOutsideEvent, type IntlTranslations, type ItemGroupLabelProps, type ItemGroupProps, type ItemProps, type ItemState, type OpenChangeDetails, type Placement, type PointerDownOutsideEvent, type PositioningOptions, type ScrollToIndexDetails, type Service, type TriggerProps, type ValueChangeDetails, anatomy, collection, connect, machine };
|