@bento/listbox 0.2.1 → 0.2.2

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.cts CHANGED
@@ -1,19 +1,20 @@
1
- import React, { ReactNode } from 'react';
2
- import { Slots } from '@bento/slots';
3
- import { LinkDOMProps, HoverEvents, Key } from '@react-types/shared';
4
- import { SelectionBehavior, ListState, Orientation } from 'react-stately';
5
- import { AriaListBoxProps } from '@react-types/listbox';
6
- export { Collection } from '@react-aria/collections';
1
+ import React, { ReactNode } from "react";
2
+ import { Slots } from "@bento/slots";
3
+ import { HoverEvents, Key, LinkDOMProps } from "@react-types/shared";
4
+ import { ListState, Orientation, SelectionBehavior } from "react-stately";
5
+ import { Collection as AriaCollection } from "@react-aria/collections";
6
+ import { AriaListBoxProps } from "@react-types/listbox";
7
7
 
8
+ //#region src/header.d.ts
8
9
  /**
9
10
  * Props for the Header component.
10
11
  * @interface HeaderProps
11
12
  */
12
13
  interface HeaderProps extends Slots, React.ComponentProps<'header'> {
13
- /**
14
- * The children of the header.
15
- */
16
- readonly children?: React.ReactNode;
14
+ /**
15
+ * The children of the header.
16
+ */
17
+ readonly children?: React.ReactNode;
17
18
  }
18
19
  /**
19
20
  * Context value structure for Header components.
@@ -21,10 +22,10 @@ interface HeaderProps extends Slots, React.ComponentProps<'header'> {
21
22
  * @interface HeaderContextValue
22
23
  */
23
24
  interface HeaderContextValue extends React.HTMLAttributes<HTMLElement> {
24
- /**
25
- * Reference to the header element for forwarding.
26
- */
27
- readonly ref?: React.RefObject<HTMLDivElement>;
25
+ /**
26
+ * Reference to the header element for forwarding.
27
+ */
28
+ readonly ref?: React.RefObject<HTMLDivElement | null>;
28
29
  }
29
30
  /**
30
31
  * React context for providing header-related attributes and refs to Header components.
@@ -52,52 +53,53 @@ declare const HeaderContext: React.Context<HeaderContextValue>;
52
53
  * @public
53
54
  */
54
55
  declare const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLElement>>;
55
-
56
+ //#endregion
57
+ //#region src/listbox-item.d.ts
56
58
  /**
57
59
  * Render props provided to ListBoxItem render functions.
58
60
  * @interface ListBoxItemRenderProps
59
61
  */
60
62
  interface ListBoxItemRenderProps {
61
- /**
62
- * Whether the item is currently hovered.
63
- * @selector [data-hovered]
64
- */
65
- readonly isHovered: boolean;
66
- /**
67
- * Whether the item is currently pressed.
68
- * @selector [data-pressed]
69
- */
70
- readonly isPressed: boolean;
71
- /**
72
- * Whether the item is currently selected.
73
- * @selector [data-selected]
74
- */
75
- readonly isSelected: boolean;
76
- /**
77
- * Whether the item is currently focused.
78
- * @selector [data-focused]
79
- */
80
- readonly isFocused: boolean;
81
- /**
82
- * Whether the item is currently keyboard focused.
83
- * @selector [data-focus-visible]
84
- */
85
- readonly isFocusVisible: boolean;
86
- /**
87
- * Whether the item is disabled.
88
- * @selector [data-disabled]
89
- */
90
- readonly isDisabled: boolean;
91
- /**
92
- * The type of selection that is allowed in the collection.
93
- * @selector [data-selection-mode="none | single | multiple"]
94
- */
95
- readonly selectionMode: 'none' | 'single' | 'multiple';
96
- /**
97
- * The selection behavior for the collection.
98
- * @selector [data-selection-behavior="toggle | replace"]
99
- */
100
- readonly selectionBehavior: 'toggle' | 'replace';
63
+ /**
64
+ * Whether the item is currently hovered.
65
+ * @selector [data-hovered]
66
+ */
67
+ readonly isHovered: boolean;
68
+ /**
69
+ * Whether the item is currently pressed.
70
+ * @selector [data-pressed]
71
+ */
72
+ readonly isPressed: boolean;
73
+ /**
74
+ * Whether the item is currently selected.
75
+ * @selector [data-selected]
76
+ */
77
+ readonly isSelected: boolean;
78
+ /**
79
+ * Whether the item is currently focused.
80
+ * @selector [data-focused]
81
+ */
82
+ readonly isFocused: boolean;
83
+ /**
84
+ * Whether the item is currently keyboard focused.
85
+ * @selector [data-focus-visible]
86
+ */
87
+ readonly isFocusVisible: boolean;
88
+ /**
89
+ * Whether the item is disabled.
90
+ * @selector [data-disabled]
91
+ */
92
+ readonly isDisabled: boolean;
93
+ /**
94
+ * The type of selection that is allowed in the collection.
95
+ * @selector [data-selection-mode="none | single | multiple"]
96
+ */
97
+ readonly selectionMode: 'none' | 'single' | 'multiple';
98
+ /**
99
+ * The selection behavior for the collection.
100
+ * @selector [data-selection-behavior="toggle | replace"]
101
+ */
102
+ readonly selectionBehavior: 'toggle' | 'replace';
101
103
  }
102
104
  /**
103
105
  * Props for the ListBoxItem component.
@@ -105,25 +107,25 @@ interface ListBoxItemRenderProps {
105
107
  * @template T The type of the item value
106
108
  */
107
109
  interface ListBoxItemProps<T = object> extends LinkDOMProps, HoverEvents, Omit<React.HTMLAttributes<HTMLElement>, keyof LinkDOMProps | keyof HoverEvents | 'id' | 'children'> {
108
- /** The unique id of the item. If not provided, React Aria will auto-generate one. */
109
- readonly id?: Key;
110
- /** The object value that this item represents. When using dynamic collections, this is set automatically. */
111
- readonly value?: T;
112
- /** A string representation of the item's contents, used for features like typeahead. If not provided, React Aria will derive it from children automatically. */
113
- readonly textValue?: string;
114
- /**
115
- * Handler that is called when a user performs an action on the item. The exact user event depends on the
116
- * collection's `selectionBehavior` prop and the interaction modality.
117
- */
118
- readonly onAction?: () => void;
119
- /** The contents of the item. Can be a render function that receives render props. */
120
- readonly children?: ReactNode | ((values: ListBoxItemRenderProps) => ReactNode);
121
- /**
122
- * A slot name for the component. Used by Bento's slot system.
123
- */
124
- readonly slot?: string;
125
- /** Whether the item is disabled. */
126
- readonly isDisabled?: boolean;
110
+ /** The unique id of the item. If not provided, React Aria will auto-generate one. */
111
+ readonly id?: Key;
112
+ /** The object value that this item represents. When using dynamic collections, this is set automatically. */
113
+ readonly value?: T;
114
+ /** A string representation of the item's contents, used for features like typeahead. If not provided, React Aria will derive it from children automatically. */
115
+ readonly textValue?: string;
116
+ /**
117
+ * Handler that is called when a user performs an action on the item. The exact user event depends on the
118
+ * collection's `selectionBehavior` prop and the interaction modality.
119
+ */
120
+ readonly onAction?: () => void;
121
+ /** The contents of the item. Can be a render function that receives render props. */
122
+ readonly children?: ReactNode | ((values: ListBoxItemRenderProps) => ReactNode);
123
+ /**
124
+ * A slot name for the component. Used by Bento's slot system.
125
+ */
126
+ readonly slot?: string;
127
+ /** Whether the item is disabled. */
128
+ readonly isDisabled?: boolean;
127
129
  }
128
130
  /**
129
131
  * A single item within a ListBox component.
@@ -137,46 +139,47 @@ interface ListBoxItemProps<T = object> extends LinkDOMProps, HoverEvents, Omit<R
137
139
  * ```
138
140
  * @public
139
141
  */
140
- declare const ListBoxItem: <T extends object>(props: ListBoxItemProps<T> & React.RefAttributes<T>) => React.ReactElement | null;
141
-
142
+ declare const ListBoxItem: <T extends object>(props: ListBoxItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
143
+ //#endregion
144
+ //#region src/listbox.d.ts
142
145
  /**
143
146
  * Render props provided to ListBox render functions and empty state renderers.
144
147
  * @interface ListBoxRenderProps
145
148
  */
146
149
  interface ListBoxRenderProps {
147
- /**
148
- * Whether the listbox has no items and should display its empty state.
149
- * @selector [data-empty]
150
- */
151
- readonly isEmpty: boolean;
152
- /**
153
- * Whether the listbox is currently focused.
154
- * @selector [data-focused]
155
- */
156
- readonly isFocused: boolean;
157
- /**
158
- * Whether the listbox is currently keyboard focused.
159
- * @selector [data-focus-visible]
160
- */
161
- readonly isFocusVisible: boolean;
162
- /**
163
- * Whether the listbox is currently the active drop target.
164
- * @selector [data-drop-target]
165
- */
166
- readonly isDropTarget: boolean;
167
- /**
168
- * Whether the items are arranged in a stack or grid.
169
- * @selector [data-layout="stack | grid"]
170
- */
171
- readonly layout?: 'stack' | 'grid';
172
- /**
173
- * State of the listbox.
174
- */
175
- readonly state: ListState<unknown>;
176
- /**
177
- * The items array when using dynamic collections.
178
- */
179
- readonly items?: Iterable<unknown>;
150
+ /**
151
+ * Whether the listbox has no items and should display its empty state.
152
+ * @selector [data-empty]
153
+ */
154
+ readonly isEmpty: boolean;
155
+ /**
156
+ * Whether the listbox is currently focused.
157
+ * @selector [data-focused]
158
+ */
159
+ readonly isFocused: boolean;
160
+ /**
161
+ * Whether the listbox is currently keyboard focused.
162
+ * @selector [data-focus-visible]
163
+ */
164
+ readonly isFocusVisible: boolean;
165
+ /**
166
+ * Whether the listbox is currently the active drop target.
167
+ * @selector [data-drop-target]
168
+ */
169
+ readonly isDropTarget: boolean;
170
+ /**
171
+ * Whether the items are arranged in a stack or grid.
172
+ * @selector [data-layout="stack | grid"]
173
+ */
174
+ readonly layout?: 'stack' | 'grid';
175
+ /**
176
+ * State of the listbox.
177
+ */
178
+ readonly state: ListState<unknown>;
179
+ /**
180
+ * The items array when using dynamic collections.
181
+ */
182
+ readonly items?: Iterable<unknown>;
180
183
  }
181
184
  /**
182
185
  * Props for the ListBox component.
@@ -184,30 +187,30 @@ interface ListBoxRenderProps {
184
187
  * @template T The type of items in the collection
185
188
  */
186
189
  interface ListBoxProps<T> extends Omit<AriaListBoxProps<T>, 'label' | 'children'>, Omit<React.ComponentProps<'div'>, keyof AriaListBoxProps<T> | 'children'>, Slots {
187
- /**
188
- * How multiple selection should behave in the collection.
189
- */
190
- readonly selectionBehavior?: SelectionBehavior;
191
- /**
192
- * Provides content to display when there are no items in the list.
193
- */
194
- readonly renderEmptyState?: (props: ListBoxRenderProps) => React.ReactNode;
195
- /**
196
- * Whether the items are arranged in a stack layout.
197
- * @default 'stack'
198
- */
199
- readonly layout?: 'stack';
200
- /**
201
- * The primary orientation of the items. Usually this is the direction that the collection scrolls.
202
- * @default 'vertical'
203
- */
204
- readonly orientation?: Orientation;
205
- /**
206
- * Static children or render function for the ListBox.
207
- * When items prop is provided, children receives individual items for React Aria compatibility.
208
- * When no items prop is provided, children receives Bento render props { isEmpty, isFocused, state, etc. }.
209
- */
210
- readonly children?: React.ReactNode | ((item: T) => React.ReactNode) | ((props: ListBoxRenderProps) => React.ReactNode);
190
+ /**
191
+ * How multiple selection should behave in the collection.
192
+ */
193
+ readonly selectionBehavior?: SelectionBehavior;
194
+ /**
195
+ * Provides content to display when there are no items in the list.
196
+ */
197
+ readonly renderEmptyState?: (props: ListBoxRenderProps) => React.ReactNode;
198
+ /**
199
+ * Whether the items are arranged in a stack layout.
200
+ * @default 'stack'
201
+ */
202
+ readonly layout?: 'stack';
203
+ /**
204
+ * The primary orientation of the items. Usually this is the direction that the collection scrolls.
205
+ * @default 'vertical'
206
+ */
207
+ readonly orientation?: Orientation;
208
+ /**
209
+ * Static children or render function for the ListBox.
210
+ * When items prop is provided, children receives individual items for React Aria compatibility.
211
+ * When no items prop is provided, children receives Bento render props { isEmpty, isFocused, state, etc. }.
212
+ */
213
+ readonly children?: React.ReactNode | ((item: T) => React.ReactNode) | ((props: ListBoxRenderProps) => React.ReactNode);
211
214
  }
212
215
  /**
213
216
  * A complete ListBox component providing accessible selection lists with keyboard navigation.
@@ -224,25 +227,26 @@ interface ListBoxProps<T> extends Omit<AriaListBoxProps<T>, 'label' | 'children'
224
227
  * ```
225
228
  * @public
226
229
  */
227
- declare const ListBox: React.MemoExoticComponent<React.ComponentType<ListBoxProps<unknown> & Slots>>;
228
-
230
+ declare const ListBox: React.MemoExoticComponent<React.ComponentType<any>>;
231
+ //#endregion
232
+ //#region src/listbox-section.d.ts
229
233
  /**
230
234
  * Props for the ListBoxSection component.
231
235
  * @interface ListBoxSectionProps
232
236
  */
233
237
  interface ListBoxSectionProps extends Omit<React.ComponentProps<'section'>, 'title'> {
234
- /**
235
- * A slot name for the component. Used by Bento's slot system.
236
- */
237
- readonly slot?: string;
238
- /**
239
- * The title of the section.
240
- */
241
- readonly title?: React.ReactNode;
242
- /**
243
- * The children of the section.
244
- */
245
- readonly children?: React.ReactNode;
238
+ /**
239
+ * A slot name for the component. Used by Bento's slot system.
240
+ */
241
+ readonly slot?: string;
242
+ /**
243
+ * The title of the section.
244
+ */
245
+ readonly title?: React.ReactNode;
246
+ /**
247
+ * The children of the section.
248
+ */
249
+ readonly children?: React.ReactNode;
246
250
  }
247
251
  /**
248
252
  * A section component for organizing related items within a ListBox.
@@ -258,7 +262,8 @@ interface ListBoxSectionProps extends Omit<React.ComponentProps<'section'>, 'tit
258
262
  * @public
259
263
  */
260
264
  declare const ListBoxSection: <_T extends object>(props: ListBoxSectionProps & {
261
- children?: React.ReactNode;
262
- }) => React.ReactElement;
263
-
264
- export { Header, HeaderContext, type HeaderProps, ListBox, ListBoxItem, type ListBoxItemProps, type ListBoxItemRenderProps, type ListBoxProps, type ListBoxRenderProps, ListBoxSection, type ListBoxSectionProps };
265
+ children?: React.ReactNode;
266
+ }) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
267
+ //#endregion
268
+ export { AriaCollection as Collection, Header, HeaderContext, type HeaderProps, ListBox, ListBoxItem, type ListBoxItemProps, type ListBoxItemRenderProps, type ListBoxProps, type ListBoxRenderProps, ListBoxSection, type ListBoxSectionProps };
269
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/header.tsx","../src/listbox-item.tsx","../src/listbox.tsx","../src/listbox-section.tsx"],"mappings":";;;;;;;;;;;;UAUiB,WAAA,SAAoB,KAAA,EAAO,KAAA,CAAM,cAAA;;AAAlD;;WAIW,QAAA,GAAW,KAAA,CAAM,SAAA;AAAA;;;;;;UAQlB,kBAAA,SAA2B,KAAA,CAAM,cAAA,CAAe,WAAA;EAZR;;;EAAA,SAgBvC,GAAA,GAAM,KAAA,CAAM,SAAA,CAAU,cAAA;AAAA;AAZI;AACpC;;;;AADoC,cA8BxB,aAAA,EAAa,KAAA,CAAA,OAAA,CAAA,kBAAA;;;;;;;;;;;;;AAlBqB;AAkB/C;;;;;;cAsFa,MAAA,EAAuB,KAAA,CAAM,yBAAA,CAA0B,WAAA,GAAc,KAAA,CAAM,aAAA,CAAc,WAAA;;;;;;;UC9FrF,sBAAA;;AD1BjB;;;WC+BW,SAAA;ED/B0B;;;;EAAA,SCoC1B,SAAA;EDpCiC;;;;EAAA,SCyCjC,UAAA;EDrC0B;AAAA;AACpC;;EADoC,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,KAAuB,KAAA,CAAM,SAAA;EFqDA;;;;EAAA,SEhDxD,MAAA;EFgDuE;;;;EAAA,SE3CvE,WAAA,GAAc,WAAA;;;;ADnDzB;;WCyDW,QAAA,GACL,KAAA,CAAM,SAAA,KACJ,IAAA,EAAM,CAAA,KAAM,KAAA,CAAM,SAAA,MAClB,KAAA,EAAO,kBAAA,KAAuB,KAAA,CAAM,SAAA;AAAA;ADpBhB;AAQ5B;;;;;;;;;;;;;;AAR4B,cC+jBf,OAAA,EAAO,KAAA,CAAA,mBAAA,CAAA,KAAA,CAAA,aAAA;;;;;;;UC3nBH,mBAAA,SAA4B,IAAA,CAAK,KAAA,CAAM,cAAA;;AHNxD;;WGUW,IAAA;EHNW;;;EAAA,SGUX,KAAA,GAAQ,KAAA,CAAM,SAAA;EHduC;;;EAAA,SGkBrD,QAAA,GAAW,KAAA,CAAM,SAAA;AAAA;;;;;;AHgBF;AAsF1B;;;;;;;cGuCa,cAAA,sBACX,KAAA,EAAO,mBAAA;EAAwB,QAAA,GAAS,KAAA,CAAA,SAAA;AAAA,MAAmB,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA"}
@@ -0,0 +1,269 @@
1
+ import React, { ReactNode } from "react";
2
+ import { Collection as AriaCollection } from "@react-aria/collections";
3
+ import { Slots } from "@bento/slots";
4
+ import { ListState, Orientation, SelectionBehavior } from "react-stately";
5
+ import { HoverEvents, Key, LinkDOMProps } from "@react-types/shared";
6
+ import { AriaListBoxProps } from "@react-types/listbox";
7
+
8
+ //#region src/header.d.ts
9
+ /**
10
+ * Props for the Header component.
11
+ * @interface HeaderProps
12
+ */
13
+ interface HeaderProps extends Slots, React.ComponentProps<'header'> {
14
+ /**
15
+ * The children of the header.
16
+ */
17
+ readonly children?: React.ReactNode;
18
+ }
19
+ /**
20
+ * Context value structure for Header components.
21
+ * Extends HTML attributes to support all standard header element properties.
22
+ * @interface HeaderContextValue
23
+ */
24
+ interface HeaderContextValue extends React.HTMLAttributes<HTMLElement> {
25
+ /**
26
+ * Reference to the header element for forwarding.
27
+ */
28
+ readonly ref?: React.RefObject<HTMLDivElement | null>;
29
+ }
30
+ /**
31
+ * React context for providing header-related attributes and refs to Header components.
32
+ * Used internally by ListBoxSection to pass heading props to Header elements.
33
+ * @public
34
+ */
35
+ declare const HeaderContext: React.Context<HeaderContextValue>;
36
+ /**
37
+ * A Header component for section headings within a ListBox.
38
+ * Provides semantic header structure with proper accessibility attributes
39
+ * and integrates with React Aria's collection system for automatic handling.
40
+ *
41
+ * This is the main public interface for creating headers in ListBox sections.
42
+ * It automatically receives heading props from the parent ListBoxSection via HeaderContext.
43
+ *
44
+ * @component
45
+ * @example
46
+ * ```tsx
47
+ * <ListBoxSection>
48
+ * <Header>Fruits</Header>
49
+ * <ListBoxItem>Apple</ListBoxItem>
50
+ * <ListBoxItem>Banana</ListBoxItem>
51
+ * </ListBoxSection>
52
+ * ```
53
+ * @public
54
+ */
55
+ declare const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLElement>>;
56
+ //#endregion
57
+ //#region src/listbox-item.d.ts
58
+ /**
59
+ * Render props provided to ListBoxItem render functions.
60
+ * @interface ListBoxItemRenderProps
61
+ */
62
+ interface ListBoxItemRenderProps {
63
+ /**
64
+ * Whether the item is currently hovered.
65
+ * @selector [data-hovered]
66
+ */
67
+ readonly isHovered: boolean;
68
+ /**
69
+ * Whether the item is currently pressed.
70
+ * @selector [data-pressed]
71
+ */
72
+ readonly isPressed: boolean;
73
+ /**
74
+ * Whether the item is currently selected.
75
+ * @selector [data-selected]
76
+ */
77
+ readonly isSelected: boolean;
78
+ /**
79
+ * Whether the item is currently focused.
80
+ * @selector [data-focused]
81
+ */
82
+ readonly isFocused: boolean;
83
+ /**
84
+ * Whether the item is currently keyboard focused.
85
+ * @selector [data-focus-visible]
86
+ */
87
+ readonly isFocusVisible: boolean;
88
+ /**
89
+ * Whether the item is disabled.
90
+ * @selector [data-disabled]
91
+ */
92
+ readonly isDisabled: boolean;
93
+ /**
94
+ * The type of selection that is allowed in the collection.
95
+ * @selector [data-selection-mode="none | single | multiple"]
96
+ */
97
+ readonly selectionMode: 'none' | 'single' | 'multiple';
98
+ /**
99
+ * The selection behavior for the collection.
100
+ * @selector [data-selection-behavior="toggle | replace"]
101
+ */
102
+ readonly selectionBehavior: 'toggle' | 'replace';
103
+ }
104
+ /**
105
+ * Props for the ListBoxItem component.
106
+ * @interface ListBoxItemProps
107
+ * @template T The type of the item value
108
+ */
109
+ interface ListBoxItemProps<T = object> extends LinkDOMProps, HoverEvents, Omit<React.HTMLAttributes<HTMLElement>, keyof LinkDOMProps | keyof HoverEvents | 'id' | 'children'> {
110
+ /** The unique id of the item. If not provided, React Aria will auto-generate one. */
111
+ readonly id?: Key;
112
+ /** The object value that this item represents. When using dynamic collections, this is set automatically. */
113
+ readonly value?: T;
114
+ /** A string representation of the item's contents, used for features like typeahead. If not provided, React Aria will derive it from children automatically. */
115
+ readonly textValue?: string;
116
+ /**
117
+ * Handler that is called when a user performs an action on the item. The exact user event depends on the
118
+ * collection's `selectionBehavior` prop and the interaction modality.
119
+ */
120
+ readonly onAction?: () => void;
121
+ /** The contents of the item. Can be a render function that receives render props. */
122
+ readonly children?: ReactNode | ((values: ListBoxItemRenderProps) => ReactNode);
123
+ /**
124
+ * A slot name for the component. Used by Bento's slot system.
125
+ */
126
+ readonly slot?: string;
127
+ /** Whether the item is disabled. */
128
+ readonly isDisabled?: boolean;
129
+ }
130
+ /**
131
+ * A single item within a ListBox component.
132
+ * Handles user interactions, accessibility, and state management for individual options.
133
+ *
134
+ * @component
135
+ * @template T The type of the item value
136
+ * @example
137
+ * ```tsx
138
+ * <ListBoxItem>Simple option</ListBoxItem>
139
+ * ```
140
+ * @public
141
+ */
142
+ declare const ListBoxItem: <T extends object>(props: ListBoxItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
143
+ //#endregion
144
+ //#region src/listbox.d.ts
145
+ /**
146
+ * Render props provided to ListBox render functions and empty state renderers.
147
+ * @interface ListBoxRenderProps
148
+ */
149
+ interface ListBoxRenderProps {
150
+ /**
151
+ * Whether the listbox has no items and should display its empty state.
152
+ * @selector [data-empty]
153
+ */
154
+ readonly isEmpty: boolean;
155
+ /**
156
+ * Whether the listbox is currently focused.
157
+ * @selector [data-focused]
158
+ */
159
+ readonly isFocused: boolean;
160
+ /**
161
+ * Whether the listbox is currently keyboard focused.
162
+ * @selector [data-focus-visible]
163
+ */
164
+ readonly isFocusVisible: boolean;
165
+ /**
166
+ * Whether the listbox is currently the active drop target.
167
+ * @selector [data-drop-target]
168
+ */
169
+ readonly isDropTarget: boolean;
170
+ /**
171
+ * Whether the items are arranged in a stack or grid.
172
+ * @selector [data-layout="stack | grid"]
173
+ */
174
+ readonly layout?: 'stack' | 'grid';
175
+ /**
176
+ * State of the listbox.
177
+ */
178
+ readonly state: ListState<unknown>;
179
+ /**
180
+ * The items array when using dynamic collections.
181
+ */
182
+ readonly items?: Iterable<unknown>;
183
+ }
184
+ /**
185
+ * Props for the ListBox component.
186
+ * @interface ListBoxProps
187
+ * @template T The type of items in the collection
188
+ */
189
+ interface ListBoxProps<T> extends Omit<AriaListBoxProps<T>, 'label' | 'children'>, Omit<React.ComponentProps<'div'>, keyof AriaListBoxProps<T> | 'children'>, Slots {
190
+ /**
191
+ * How multiple selection should behave in the collection.
192
+ */
193
+ readonly selectionBehavior?: SelectionBehavior;
194
+ /**
195
+ * Provides content to display when there are no items in the list.
196
+ */
197
+ readonly renderEmptyState?: (props: ListBoxRenderProps) => React.ReactNode;
198
+ /**
199
+ * Whether the items are arranged in a stack layout.
200
+ * @default 'stack'
201
+ */
202
+ readonly layout?: 'stack';
203
+ /**
204
+ * The primary orientation of the items. Usually this is the direction that the collection scrolls.
205
+ * @default 'vertical'
206
+ */
207
+ readonly orientation?: Orientation;
208
+ /**
209
+ * Static children or render function for the ListBox.
210
+ * When items prop is provided, children receives individual items for React Aria compatibility.
211
+ * When no items prop is provided, children receives Bento render props { isEmpty, isFocused, state, etc. }.
212
+ */
213
+ readonly children?: React.ReactNode | ((item: T) => React.ReactNode) | ((props: ListBoxRenderProps) => React.ReactNode);
214
+ }
215
+ /**
216
+ * A complete ListBox component providing accessible selection lists with keyboard navigation.
217
+ * Supports both static children and dynamic collections, with single/multiple selection modes.
218
+ * Built on React Aria with full ARIA compliance and keyboard accessibility.
219
+ *
220
+ * @component
221
+ * @example
222
+ * ```tsx
223
+ * <ListBox aria-label="Fruits" selectionMode="single">
224
+ * <ListBoxItem id="apple" textValue="Apple">Apple</ListBoxItem>
225
+ * <ListBoxItem id="banana" textValue="Banana">Banana</ListBoxItem>
226
+ * </ListBox>
227
+ * ```
228
+ * @public
229
+ */
230
+ declare const ListBox: React.MemoExoticComponent<React.ComponentType<any>>;
231
+ //#endregion
232
+ //#region src/listbox-section.d.ts
233
+ /**
234
+ * Props for the ListBoxSection component.
235
+ * @interface ListBoxSectionProps
236
+ */
237
+ interface ListBoxSectionProps extends Omit<React.ComponentProps<'section'>, 'title'> {
238
+ /**
239
+ * A slot name for the component. Used by Bento's slot system.
240
+ */
241
+ readonly slot?: string;
242
+ /**
243
+ * The title of the section.
244
+ */
245
+ readonly title?: React.ReactNode;
246
+ /**
247
+ * The children of the section.
248
+ */
249
+ readonly children?: React.ReactNode;
250
+ }
251
+ /**
252
+ * A section component for organizing related items within a ListBox.
253
+ *
254
+ * @component
255
+ * @example
256
+ * ```tsx
257
+ * <ListBoxSection title="Fruits">
258
+ * <ListBoxItem>Apple</ListBoxItem>
259
+ * <ListBoxItem>Banana</ListBoxItem>
260
+ * </ListBoxSection>
261
+ * ```
262
+ * @public
263
+ */
264
+ declare const ListBoxSection: <_T extends object>(props: ListBoxSectionProps & {
265
+ children?: React.ReactNode;
266
+ }) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
267
+ //#endregion
268
+ export { AriaCollection as Collection, Header, HeaderContext, type HeaderProps, ListBox, ListBoxItem, type ListBoxItemProps, type ListBoxItemRenderProps, type ListBoxProps, type ListBoxRenderProps, ListBoxSection, type ListBoxSectionProps };
269
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/header.tsx","../src/listbox-item.tsx","../src/listbox.tsx","../src/listbox-section.tsx"],"mappings":";;;;;;;;;;;;UAUiB,WAAA,SAAoB,KAAA,EAAO,KAAA,CAAM,cAAA;;AAAlD;;WAIW,QAAA,GAAW,KAAA,CAAM,SAAA;AAAA;;;;;;UAQlB,kBAAA,SAA2B,KAAA,CAAM,cAAA,CAAe,WAAA;EAZR;;;EAAA,SAgBvC,GAAA,GAAM,KAAA,CAAM,SAAA,CAAU,cAAA;AAAA;AAZI;AACpC;;;;AADoC,cA8BxB,aAAA,EAAa,KAAA,CAAA,OAAA,CAAA,kBAAA;;;;;;;;;;;;;AAlBqB;AAkB/C;;;;;;cAsFa,MAAA,EAAuB,KAAA,CAAM,yBAAA,CAA0B,WAAA,GAAc,KAAA,CAAM,aAAA,CAAc,WAAA;;;;;;;UC9FrF,sBAAA;;AD1BjB;;;WC+BW,SAAA;ED/B0B;;;;EAAA,SCoC1B,SAAA;EDpCiC;;;;EAAA,SCyCjC,UAAA;EDrC0B;AAAA;AACpC;;EADoC,SC0C1B,SAAA;EDlC+C;;;;EAAA,SCuC/C,cAAA;EDvC8C;;;;EAAA,SC4C9C,UAAA;EDxCM;;;;EAAA,SC6CN,aAAA;ED3BE;;;;EAAA,SCgCF,iBAAA;AAAA;;;ADhCe;AAsF1B;;UC9CiB,gBAAA,qBACP,YAAA,EACN,WAAA,EACA,IAAA,CAAK,KAAA,CAAM,cAAA,CAAe,WAAA,SAAoB,YAAA,SAAqB,WAAA;ED2CH;EAAA,SCzCzD,EAAA,GAAK,GAAA;EDyCkE;EAAA,SCvCvE,KAAA,GAAQ,CAAA;EDuCgD;EAAA,SCrCxD,SAAA;EDqCyB;;;;EAAA,SChCzB,QAAA;EDgC2F;EAAA,SC9B3F,QAAA,GAAW,SA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