@zag-js/combobox 0.49.0 → 0.50.0
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.mts +24 -15
- package/dist/index.d.ts +24 -15
- package/dist/index.js +229 -214
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -225
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
- package/src/combobox.connect.ts +81 -78
- package/src/combobox.dom.ts +13 -6
- package/src/combobox.machine.ts +125 -137
- package/src/combobox.props.ts +2 -2
- package/src/combobox.types.ts +23 -13
- package/src/index.ts +1 -0
package/src/combobox.types.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface ValueChangeDetails<T extends CollectionItem = CollectionItem> {
|
|
|
15
15
|
|
|
16
16
|
export interface HighlightChangeDetails<T extends CollectionItem = CollectionItem> {
|
|
17
17
|
highlightedValue: string | null
|
|
18
|
-
|
|
18
|
+
highlightedItem: T | null
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface InputValueChangeDetails {
|
|
@@ -118,6 +118,8 @@ interface PublicContext<T extends CollectionItem = CollectionItem>
|
|
|
118
118
|
*
|
|
119
119
|
* - `autohighlight`: The first focused item is highlighted as the user types
|
|
120
120
|
* - `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated
|
|
121
|
+
*
|
|
122
|
+
* @default "none"
|
|
121
123
|
*/
|
|
122
124
|
inputBehavior: "autohighlight" | "autocomplete" | "none"
|
|
123
125
|
/**
|
|
@@ -126,6 +128,8 @@ interface PublicContext<T extends CollectionItem = CollectionItem>
|
|
|
126
128
|
* - `replace`: The selected item string is set as the input value
|
|
127
129
|
* - `clear`: The input value is cleared
|
|
128
130
|
* - `preserve`: The input value is preserved
|
|
131
|
+
*
|
|
132
|
+
* @default "replace"
|
|
129
133
|
*/
|
|
130
134
|
selectionBehavior: "clear" | "replace" | "preserve"
|
|
131
135
|
/**
|
|
@@ -134,10 +138,12 @@ interface PublicContext<T extends CollectionItem = CollectionItem>
|
|
|
134
138
|
autoFocus?: boolean
|
|
135
139
|
/**
|
|
136
140
|
* Whether to open the combobox popup on initial click on the input
|
|
141
|
+
* @default false
|
|
137
142
|
*/
|
|
138
143
|
openOnClick?: boolean
|
|
139
144
|
/**
|
|
140
145
|
* Whether to show the combobox when the input value changes
|
|
146
|
+
* @default true
|
|
141
147
|
*/
|
|
142
148
|
openOnChange?: boolean | ((details: InputValueChangeDetails) => boolean)
|
|
143
149
|
/**
|
|
@@ -146,6 +152,7 @@ interface PublicContext<T extends CollectionItem = CollectionItem>
|
|
|
146
152
|
allowCustomValue?: boolean
|
|
147
153
|
/**
|
|
148
154
|
* Whether to loop the keyboard navigation through the items
|
|
155
|
+
* @default true
|
|
149
156
|
*/
|
|
150
157
|
loopFocus?: boolean
|
|
151
158
|
/**
|
|
@@ -191,6 +198,7 @@ interface PublicContext<T extends CollectionItem = CollectionItem>
|
|
|
191
198
|
getSelectionValue?: (details: SelectionValueDetails<T>) => string
|
|
192
199
|
/**
|
|
193
200
|
* Whether to open the combobox on arrow key press
|
|
201
|
+
* @default true
|
|
194
202
|
*/
|
|
195
203
|
openOnKeyPress: boolean
|
|
196
204
|
/**
|
|
@@ -198,15 +206,14 @@ interface PublicContext<T extends CollectionItem = CollectionItem>
|
|
|
198
206
|
*/
|
|
199
207
|
scrollToIndexFn?: (details: ScrollToIndexDetails) => void
|
|
200
208
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* - `dialog`: The combobox has a dialog popup. Useful when in select only mode
|
|
209
|
+
* Whether the combobox is a composed with other composite widgets like tabs
|
|
210
|
+
* @default true
|
|
204
211
|
*/
|
|
205
|
-
|
|
212
|
+
composite: boolean
|
|
206
213
|
/**
|
|
207
|
-
* Whether to
|
|
214
|
+
* Whether to disable registering this a dismissable layer
|
|
208
215
|
*/
|
|
209
|
-
|
|
216
|
+
disableLayer?: boolean
|
|
210
217
|
}
|
|
211
218
|
|
|
212
219
|
export type UserDefinedContext<T extends CollectionItem = CollectionItem> = RequiredBy<
|
|
@@ -277,6 +284,13 @@ export type Send = S.Send<S.AnyEventObject>
|
|
|
277
284
|
* Component API
|
|
278
285
|
* -----------------------------------------------------------------------------*/
|
|
279
286
|
|
|
287
|
+
export interface TriggerProps {
|
|
288
|
+
/**
|
|
289
|
+
* Whether the trigger is focusable
|
|
290
|
+
*/
|
|
291
|
+
focusable?: boolean
|
|
292
|
+
}
|
|
293
|
+
|
|
280
294
|
export interface ItemProps {
|
|
281
295
|
/**
|
|
282
296
|
* Whether hovering outside should clear the highlighted state
|
|
@@ -324,10 +338,6 @@ export interface MachineApi<T extends PropTypes = PropTypes, V extends Collectio
|
|
|
324
338
|
* Whether the combobox is open
|
|
325
339
|
*/
|
|
326
340
|
open: boolean
|
|
327
|
-
/**
|
|
328
|
-
* Whether the combobox input value is empty
|
|
329
|
-
*/
|
|
330
|
-
inputEmpty: boolean
|
|
331
341
|
/**
|
|
332
342
|
* The value of the combobox input
|
|
333
343
|
*/
|
|
@@ -343,7 +353,7 @@ export interface MachineApi<T extends PropTypes = PropTypes, V extends Collectio
|
|
|
343
353
|
/**
|
|
344
354
|
* The value of the combobox input
|
|
345
355
|
*/
|
|
346
|
-
|
|
356
|
+
setHighlightValue(value: string): void
|
|
347
357
|
/**
|
|
348
358
|
* The selected items
|
|
349
359
|
*/
|
|
@@ -407,7 +417,7 @@ export interface MachineApi<T extends PropTypes = PropTypes, V extends Collectio
|
|
|
407
417
|
positionerProps: T["element"]
|
|
408
418
|
inputProps: T["input"]
|
|
409
419
|
contentProps: T["element"]
|
|
410
|
-
|
|
420
|
+
getTriggerProps(props?: TriggerProps): T["button"]
|
|
411
421
|
clearTriggerProps: T["button"]
|
|
412
422
|
listProps: T["element"]
|
|
413
423
|
getItemProps(props: ItemProps): T["element"]
|