@zag-js/combobox 0.49.0 → 0.51.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.
@@ -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
- highligtedItem: T | null
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
- * The underling `aria-haspopup` attribute to use for the combobox
202
- * - `listbox`: The combobox has a listbox popup (default)
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
- popup: "listbox" | "dialog"
212
+ composite: boolean
206
213
  /**
207
- * Whether to register this combobox as a dismissable layer
214
+ * Whether to disable registering this a dismissable layer
208
215
  */
209
- dismissable: boolean
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
- highlightValue(value: string): void
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
- triggerProps: T["button"]
420
+ getTriggerProps(props?: TriggerProps): T["button"]
411
421
  clearTriggerProps: T["button"]
412
422
  listProps: T["element"]
413
423
  getItemProps(props: ItemProps): T["element"]
package/src/index.ts CHANGED
@@ -21,5 +21,6 @@ export type {
21
21
  PositioningOptions,
22
22
  ScrollToIndexDetails,
23
23
  SelectionValueDetails,
24
+ TriggerProps,
24
25
  ValueChangeDetails,
25
26
  } from "./combobox.types"