@bccampus/ui-components 0.3.0 → 0.4.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.
@@ -0,0 +1,151 @@
1
+ import { JSX } from 'react/jsx-runtime';
2
+ import { KeyboardEventHandler } from 'react';
3
+ import { MouseEventHandler } from 'react';
4
+ import { PreinitializedMapStore } from 'nanostores';
5
+ import { PreinitializedWritableAtom } from 'nanostores';
6
+ import { ReactNode } from 'react';
7
+
8
+ export declare function CompositeComponent<T extends object>({ renderItem, className, itemClassName, ref, id, ...props }: CompositeProps<T>): JSX.Element;
9
+
10
+ export declare function CompositeComponentContext<T extends object>({ data, children, ...compositeOptions }: CompositeComponentContextProps<T>): JSX.Element;
11
+
12
+ declare interface CompositeComponentContextProps<T extends object> extends CompositeOptions {
13
+ data: T[];
14
+ children: React.ReactNode;
15
+ }
16
+
17
+ export declare function CompositeComponentItem<T extends object>({ id, className, item, mouseEventHandler, keyboardEventHandler, render, }: CompositeItemProps<T>): JSX.Element;
18
+
19
+ declare class CompositeData<T extends object> implements Iterable<CompositeDataItem<T>> {
20
+ #private;
21
+ lookup: Map<CompositeItemKey, CompositeDataItem<T>>;
22
+ firstFocusableItem: CompositeDataItem<T> | null;
23
+ focusedItem: PreinitializedWritableAtom<CompositeDataItem<T> | null>;
24
+ disabledKeys: PreinitializedWritableAtom<Set<CompositeItemKey>>;
25
+ selectedKeys: PreinitializedWritableAtom<Set<CompositeItemKey>>;
26
+ root: CompositeDataItem<T>;
27
+ constructor(items: T[], options?: CompositeOptions);
28
+ [Symbol.iterator](): Iterator<CompositeDataItem<T>>;
29
+ toJSON(): T[];
30
+ init(items: T[]): void;
31
+ isFocusable(itemAtom: CompositeDataItem<T>): boolean;
32
+ getFirstFocusableItem(): CompositeDataItem<T> | undefined;
33
+ item(key: CompositeItemKey): CompositeDataItem<T> | undefined;
34
+ descendants(itemKey: CompositeItemKey): CompositeDataItem<T>[] | undefined;
35
+ ancestors(itemKey: CompositeItemKey): CompositeDataItem<T>[] | undefined;
36
+ focus(itemKey: CompositeItemKey): void;
37
+ focus(item: CompositeDataItem<T>): void;
38
+ toggleSelect(itemKey: CompositeItemKey, recursive?: boolean): void;
39
+ toggleSelect(item: CompositeDataItem<T>, recursive?: boolean): void;
40
+ select(itemKey: CompositeItemKey, recursive?: boolean): void;
41
+ select(item: CompositeDataItem<T>, recursive?: boolean): void;
42
+ deselect(itemKey: CompositeItemKey, recursive?: boolean): void;
43
+ deselect(item: CompositeDataItem<T>, recursive?: boolean): void;
44
+ disable(itemKey: CompositeItemKey, recursive?: boolean): void;
45
+ disable(item: CompositeDataItem<T>, recursive?: boolean): void;
46
+ enable(itemKey: CompositeItemKey, recursive?: boolean): void;
47
+ enable(item: CompositeDataItem<T>, recursive?: boolean): void;
48
+ updateItem(key: CompositeItemKey, data: Partial<T> | ((item: T) => Partial<T>)): void;
49
+ }
50
+
51
+ declare class CompositeDataItem<T extends object> implements Iterable<CompositeDataItem<T>> {
52
+ #private;
53
+ parent: CompositeDataItem<T> | null;
54
+ children?: CompositeDataItem<T>[];
55
+ level: number;
56
+ data: PreinitializedMapStore<T>;
57
+ state: PreinitializedMapStore<CompositeDataItemState>;
58
+ pointers: {
59
+ left?: CompositeItemKey;
60
+ right?: CompositeItemKey;
61
+ up?: CompositeItemKey;
62
+ down?: CompositeItemKey;
63
+ };
64
+ childrenProp: string;
65
+ constructor(item: T, options: CompositeDataItemOptions<T>, parent: CompositeDataItem<T> | null);
66
+ get key(): CompositeItemKey;
67
+ [Symbol.iterator](): Iterator<CompositeDataItem<T>>;
68
+ toJSON(): T;
69
+ descendants(): CompositeDataItem<T>[];
70
+ ancestors(): CompositeDataItem<T>[];
71
+ toggleSelect(recursive?: boolean): void;
72
+ select(recursive?: boolean): CompositeItemKey[];
73
+ deselect(recursive?: boolean): CompositeItemKey[];
74
+ disable(recursive?: boolean): CompositeItemKey[];
75
+ enable(recursive?: boolean): CompositeItemKey[];
76
+ }
77
+
78
+ export declare type CompositeDataItemOptions<T> = CompositeDataPropGetters<T> & {
79
+ initialState?: CompositeDataItemState;
80
+ itemChildrenProp: string;
81
+ };
82
+
83
+ export declare interface CompositeDataItemState {
84
+ focused: boolean;
85
+ selected: boolean;
86
+ disabled: boolean;
87
+ }
88
+
89
+ export declare type CompositeDataOptions<T> = Required<CompositeOptions> & CompositeDataPropGetters<T>;
90
+
91
+ declare interface CompositeDataPropGetters<T> {
92
+ getItemKey: (item: T) => CompositeItemKey;
93
+ getItemChildren: (item: T) => T[] | undefined;
94
+ }
95
+
96
+ export declare interface CompositeFocusProvider {
97
+ setPointers: () => void;
98
+ goFirst: () => void;
99
+ goLast: () => void;
100
+ goUp: () => void;
101
+ goDown: () => void;
102
+ goLeft: () => void;
103
+ goRight: () => void;
104
+ }
105
+
106
+ export declare interface CompositeHandle {
107
+ focusUp: () => void;
108
+ focusDown: () => void;
109
+ select: () => void;
110
+ }
111
+
112
+ export declare interface CompositeItemEventHandlers {
113
+ mouseEventHandler?: MouseEventHandler<HTMLElement>;
114
+ keyboardEventHandler?: KeyboardEventHandler<HTMLElement>;
115
+ }
116
+
117
+ export declare type CompositeItemKey = string | number;
118
+
119
+ export declare interface CompositeItemProps<T extends object> {
120
+ id: string;
121
+ className?: string;
122
+ item: CompositeDataItem<T>;
123
+ mouseEventHandler?: (itemAtom: CompositeDataItem<T>) => void;
124
+ keyboardEventHandler?: (itemAtom: CompositeDataItem<T>) => void;
125
+ remove?: () => void;
126
+ render: CompositeItemRenderFn<T>;
127
+ }
128
+
129
+ export declare type CompositeItemRenderFn<T extends object> = (item: {
130
+ data: T;
131
+ level: number;
132
+ key: CompositeItemKey;
133
+ }, state: CompositeDataItemState, eventHandlers: CompositeItemEventHandlers) => ReactNode;
134
+
135
+ export declare interface CompositeOptions {
136
+ disabledKeys?: CompositeItemKey[];
137
+ selectedKeys?: CompositeItemKey[];
138
+ itemKeyProp?: string;
139
+ itemChildrenProp?: string;
140
+ }
141
+
142
+ export declare interface CompositeProps<T extends object> extends React.ComponentPropsWithoutRef<"div"> {
143
+ renderItem: CompositeItemRenderFn<T>;
144
+ className?: string;
145
+ itemClassName?: string;
146
+ ref?: React.Ref<CompositeHandle>;
147
+ }
148
+
149
+ export declare function useCompositeContext<T extends object>(): CompositeData<T>;
150
+
151
+ export { }
@@ -0,0 +1,472 @@
1
+ import { jsx as b, jsxs as q } from "react/jsx-runtime";
2
+ import { useMemo as w, createContext as L, useContext as N, useRef as E, useCallback as p, useSyncExternalStore as $, useId as M, useImperativeHandle as A } from "react";
3
+ const O = (o, t) => {
4
+ const e = { ...o };
5
+ return t.forEach((s) => {
6
+ const n = s.split("."), l = n.pop();
7
+ if (l) {
8
+ const i = n.reduce((r, d) => r && d in r ? r[d] : void 0, e);
9
+ i && l in i && delete i[l];
10
+ }
11
+ }), e;
12
+ };
13
+ let R = Symbol("clean"), c = [], f = 0;
14
+ const g = 4;
15
+ let K = (o) => {
16
+ let t = [], e = {
17
+ get() {
18
+ return e.lc || e.listen(() => {
19
+ })(), e.value;
20
+ },
21
+ lc: 0,
22
+ listen(s) {
23
+ return e.lc = t.push(s), () => {
24
+ for (let l = f + g; l < c.length; )
25
+ c[l] === s ? c.splice(l, g) : l += g;
26
+ let n = t.indexOf(s);
27
+ ~n && (t.splice(n, 1), --e.lc || e.off());
28
+ };
29
+ },
30
+ notify(s, n) {
31
+ let l = !c.length;
32
+ for (let i of t)
33
+ c.push(i, e.value, s, n);
34
+ if (l) {
35
+ for (f = 0; f < c.length; f += g)
36
+ c[f](
37
+ c[f + 1],
38
+ c[f + 2],
39
+ c[f + 3]
40
+ );
41
+ c.length = 0;
42
+ }
43
+ },
44
+ /* It will be called on last listener unsubscribing.
45
+ We will redefine it in onMount and onStop. */
46
+ off() {
47
+ },
48
+ set(s) {
49
+ let n = e.value;
50
+ n !== s && (e.value = s, e.notify(n));
51
+ },
52
+ subscribe(s) {
53
+ let n = e.listen(s);
54
+ return s(e.value), n;
55
+ },
56
+ value: o
57
+ };
58
+ return process.env.NODE_ENV !== "production" && (e[R] = () => {
59
+ t = [], e.lc = 0, e.off();
60
+ }), e;
61
+ };
62
+ function U(o, t, e) {
63
+ let s = new Set(t).add(void 0);
64
+ return o.listen((n, l, i) => {
65
+ s.has(i) && e(n, l, i);
66
+ });
67
+ }
68
+ let S = (o = {}) => {
69
+ let t = K(o);
70
+ return t.setKey = function(e, s) {
71
+ let n = t.value;
72
+ typeof s > "u" && e in t.value ? (t.value = { ...t.value }, delete t.value[e], t.notify(n, e)) : t.value[e] !== s && (t.value = {
73
+ ...t.value,
74
+ [e]: s
75
+ }, t.notify(n, e));
76
+ }, t;
77
+ };
78
+ class u {
79
+ #e;
80
+ parent = null;
81
+ children;
82
+ level;
83
+ data;
84
+ state;
85
+ pointers;
86
+ childrenProp;
87
+ constructor(t, e, s) {
88
+ this.#e = e.getItemKey(t), this.data = S(O(t, [e.itemChildrenProp])), this.state = S({
89
+ focused: !1,
90
+ selected: !1,
91
+ disabled: !1,
92
+ ...e.initialState
93
+ }), this.pointers = {}, this.parent = s, this.level = s ? s.level + 1 : 0, this.childrenProp = e.itemChildrenProp;
94
+ const n = e.getItemChildren(t);
95
+ n && (this.children = n.map((l) => new u(l, e, this)));
96
+ }
97
+ get key() {
98
+ return this.#e;
99
+ }
100
+ *[Symbol.iterator]() {
101
+ if (this.key !== "ALL" && (yield this), this.children)
102
+ for (const t of this.children)
103
+ for (const e of t) yield e;
104
+ }
105
+ toJSON() {
106
+ const t = { ...this.data.get() };
107
+ if (this.children) {
108
+ t[this.childrenProp] = [];
109
+ for (const e of this.children)
110
+ t[this.childrenProp].push(e.toJSON());
111
+ }
112
+ return t;
113
+ }
114
+ descendants() {
115
+ if (!this.children) return [];
116
+ const t = [];
117
+ return this.children.forEach(
118
+ (e) => {
119
+ t.push(e);
120
+ const s = e.descendants();
121
+ s && t.push(...s);
122
+ }
123
+ ), t;
124
+ }
125
+ ancestors() {
126
+ const t = [];
127
+ let e = this.parent;
128
+ for (; e; )
129
+ t.push(e), e = e.parent;
130
+ return t;
131
+ }
132
+ toggleSelect(t = !1) {
133
+ this.state.get().selected ? this.deselect(t) : this.select(t);
134
+ }
135
+ select(t = !1) {
136
+ if (this.state.setKey("selected", !0), t && this.children) {
137
+ const e = this.children.map((s) => s.select(!0)).flat();
138
+ return [this.key, ...e];
139
+ }
140
+ return [this.key];
141
+ }
142
+ deselect(t = !1) {
143
+ if (this.state.setKey("selected", !1), t && this.children) {
144
+ const e = this.children.map((s) => s.deselect(!0)).flat();
145
+ return [this.key, ...e];
146
+ }
147
+ return [this.key];
148
+ }
149
+ disable(t = !1) {
150
+ if (this.state.setKey("disabled", !0), t && this.children) {
151
+ const e = this.children.map((s) => s.disable(!0)).flat();
152
+ return [this.key, ...e];
153
+ }
154
+ return [this.key];
155
+ }
156
+ enable(t = !1) {
157
+ if (this.state.setKey("disabled", !1), t && this.children) {
158
+ const e = this.children.map((s) => s.enable(!0)).flat();
159
+ return [this.key, ...e];
160
+ }
161
+ return [this.key];
162
+ }
163
+ }
164
+ const j = /* @__PURE__ */ new Set(["ctrl", "shift", "alt", "meta"]), C = {
165
+ " ": "space"
166
+ };
167
+ function J(o, t) {
168
+ if (o.size !== t.size) return !1;
169
+ for (const e of t)
170
+ if (!o.has(e)) return !1;
171
+ return !0;
172
+ }
173
+ function Q(o) {
174
+ const t = [];
175
+ for (const [e, s] of Object.entries(o)) {
176
+ const n = e.toLowerCase().trim().split(/\s*\+\s*/);
177
+ n.length === 1 && j.has(n[0]) ? console.error(`[useKeyboardEvent] \`${e}\`: A key sequence cannot be only a modifier key.`) : n.includes("") ? console.error(`[useKeyboardEvent] \`${e}\`: Unknown key defined in the sequence.`) : t.push({
178
+ sequence: new Set(n),
179
+ handler: s
180
+ });
181
+ }
182
+ return t;
183
+ }
184
+ const v = {
185
+ eventKeyProp: "key"
186
+ };
187
+ function z(o, t = v) {
188
+ const e = { ...t, ...v }, s = Q(o);
189
+ return (n) => {
190
+ const l = /* @__PURE__ */ new Set(), i = n[e.eventKeyProp];
191
+ n.ctrlKey && l.add("ctrl"), n.shiftKey && l.add("shift"), n.altKey && l.add("alt"), n.metaKey && l.add("meta"), C[i] ? l.add(C[i]) : l.add(i.toLowerCase());
192
+ const r = s.find((d) => J(l, d.sequence));
193
+ r && (n.preventDefault(), n.stopPropagation(), r.handler(n));
194
+ };
195
+ }
196
+ function T(o, t) {
197
+ return w(() => z(o, t), [o, t]);
198
+ }
199
+ function I(o, t) {
200
+ const e = new Set(o);
201
+ for (const s of t)
202
+ e.add(s);
203
+ return e;
204
+ }
205
+ function Y(o, t) {
206
+ const e = new Set(o);
207
+ for (const s of t)
208
+ e.delete(s);
209
+ return e;
210
+ }
211
+ class G {
212
+ #e;
213
+ lookup = /* @__PURE__ */ new Map();
214
+ firstFocusableItem;
215
+ focusedItem = K(null);
216
+ disabledKeys = K(/* @__PURE__ */ new Set());
217
+ selectedKeys = K(/* @__PURE__ */ new Set());
218
+ root;
219
+ constructor(t, e) {
220
+ this.#e = {
221
+ itemKeyProp: "key",
222
+ itemChildrenProp: "children",
223
+ disabledKeys: [],
224
+ selectedKeys: [],
225
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
+ getItemKey: (s) => s[this.#e.itemKeyProp],
227
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
228
+ getItemChildren: (s) => s[this.#e.itemChildrenProp] ? s[this.#e.itemChildrenProp] : void 0,
229
+ ...e
230
+ }, this.init(t);
231
+ }
232
+ *[Symbol.iterator]() {
233
+ if (this.root.children)
234
+ for (const t of this.root.children)
235
+ yield t;
236
+ }
237
+ toJSON() {
238
+ return this.root.toJSON()[this.#e.itemChildrenProp];
239
+ }
240
+ init(t) {
241
+ this.root = new u(
242
+ { [this.#e.itemKeyProp]: "ALL", [this.#e.itemChildrenProp]: t },
243
+ this.#e,
244
+ null
245
+ ), this.lookup = new Map([...this.root].map((s) => [s.key, s])), this.#e.disabledKeys.forEach((s) => this.disable(s)), this.#e.selectedKeys.forEach((s) => this.select(s)), this.firstFocusableItem = this.getFirstFocusableItem() ?? null, this.firstFocusableItem && (this.firstFocusableItem.state.setKey("focused", !0), this.focusedItem.set(this.firstFocusableItem));
246
+ const e = [...this.lookup];
247
+ for (let s = 0; s < e.length; s++) {
248
+ const [n, l] = e[s];
249
+ if (this.isFocusable(l) && s < e.length - 1) {
250
+ let i = s === e.length - 1 ? 0 : s + 1;
251
+ for (; i < e.length && !this.isFocusable(e[i][1]); )
252
+ i = (i + 1) % e.length;
253
+ l.pointers.down = e[i][0], e[i][1].pointers.up = n;
254
+ }
255
+ }
256
+ }
257
+ isFocusable(t) {
258
+ return !t.state.get().disabled;
259
+ }
260
+ getFirstFocusableItem() {
261
+ let t = this.lookup.values().next();
262
+ for (; t.value && !this.isFocusable(t.value); )
263
+ t = this.lookup.values().next();
264
+ return t.value;
265
+ }
266
+ item(t) {
267
+ return this.lookup.get(t);
268
+ }
269
+ descendants(t) {
270
+ const e = this.lookup.get(t);
271
+ if (e)
272
+ return e.descendants();
273
+ }
274
+ ancestors(t) {
275
+ const e = this.lookup.get(t);
276
+ if (e)
277
+ return e.ancestors();
278
+ }
279
+ focus(t) {
280
+ const e = t instanceof u ? t : this.lookup.get(t);
281
+ if (e) {
282
+ if (this.focusedItem.get()) {
283
+ if (e.key === this.focusedItem.get()?.key) return;
284
+ this.focusedItem.get().state.setKey("focused", !1);
285
+ }
286
+ e.state.setKey("focused", !0), this.focusedItem.set(e);
287
+ }
288
+ }
289
+ toggleSelect(t, e = !1) {
290
+ const s = t instanceof u ? t : this.lookup.get(t);
291
+ s && (s.state.get().selected ? this.deselect(s, e) : this.select(s, e));
292
+ }
293
+ select(t, e = !1) {
294
+ const s = t instanceof u ? t : this.lookup.get(t);
295
+ if (!s) return;
296
+ const n = s.select(e);
297
+ this.selectedKeys.set(I(this.selectedKeys.get(), n));
298
+ }
299
+ deselect(t, e = !1) {
300
+ const s = t instanceof u ? t : this.lookup.get(t);
301
+ if (!s) return;
302
+ const n = s.deselect(e);
303
+ this.selectedKeys.set(Y(this.selectedKeys.get(), n));
304
+ }
305
+ disable(t, e = !1) {
306
+ const s = t instanceof u ? t : this.lookup.get(t);
307
+ if (!s) return;
308
+ const n = s.disable(e);
309
+ this.disabledKeys.set(I(this.selectedKeys.get(), n));
310
+ }
311
+ enable(t, e = !1) {
312
+ const s = t instanceof u ? t : this.lookup.get(t);
313
+ if (!s) return;
314
+ const n = s.enable(e);
315
+ this.disabledKeys.set(I(this.selectedKeys.get(), n));
316
+ }
317
+ updateItem(t, e) {
318
+ const s = this.lookup.get(t);
319
+ if (s) {
320
+ const n = {
321
+ ...s.data.get(),
322
+ ...typeof e == "function" ? e(s.data.get()) : e
323
+ }, l = this.#e.getItemKey(n);
324
+ if (s.key !== l) throw "Item key cannot be updated!";
325
+ this.#t(t), s.data.set(n);
326
+ }
327
+ }
328
+ #t(t) {
329
+ this.selectedKeys.get().has(t) && this.selectedKeys.set(/* @__PURE__ */ new Set([...this.selectedKeys.get()]));
330
+ }
331
+ }
332
+ const P = L(void 0);
333
+ function H() {
334
+ const o = N(P);
335
+ if (!o)
336
+ throw new Error("No CompositeDataContext has been set, use CompositeDataContext to provide a context");
337
+ return o;
338
+ }
339
+ function X({
340
+ data: o,
341
+ children: t,
342
+ ...e
343
+ }) {
344
+ const s = w(() => new G(o, e), [o, e]);
345
+ return /* @__PURE__ */ b(P, { value: s, children: t });
346
+ }
347
+ let k = (o, t) => (e) => {
348
+ o.current !== e && (o.current = e, t());
349
+ };
350
+ function x(o, { keys: t, deps: e = [o, t] } = {}) {
351
+ let s = E();
352
+ s.current = o.get();
353
+ let n = p((i) => (k(s, i)(o.value), t?.length > 0 ? U(o, t, k(s, i)) : o.listen(k(s, i))), e), l = () => s.current;
354
+ return $(n, l, l);
355
+ }
356
+ function D({
357
+ id: o,
358
+ className: t,
359
+ item: e,
360
+ mouseEventHandler: s,
361
+ keyboardEventHandler: n,
362
+ render: l
363
+ }) {
364
+ const i = x(e.data), r = x(e.state), d = w(() => r.disabled ? {} : {
365
+ mouseEventHandler: () => s?.(e),
366
+ keyboardEventHandler: () => n?.(e)
367
+ }, [r.disabled, e, n, s]);
368
+ return /* @__PURE__ */ q(
369
+ "div",
370
+ {
371
+ id: o,
372
+ role: "option",
373
+ "aria-disabled": r.disabled,
374
+ "data-key": e.key,
375
+ tabIndex: r.disabled ? void 0 : r.focused ? 0 : -1,
376
+ className: t,
377
+ children: [
378
+ l({ data: i, key: e.key, level: e.level }, r, d),
379
+ e.children && e.children.length > 0 && [...e.children].map((a) => /* @__PURE__ */ b(
380
+ D,
381
+ {
382
+ id: `${o}-${e.key}`,
383
+ item: a,
384
+ render: l,
385
+ className: t,
386
+ mouseEventHandler: s,
387
+ keyboardEventHandler: n
388
+ },
389
+ a.key
390
+ ))
391
+ ]
392
+ }
393
+ );
394
+ }
395
+ function V(o) {
396
+ return o ?? M();
397
+ }
398
+ function Z({
399
+ renderItem: o,
400
+ className: t,
401
+ itemClassName: e,
402
+ ref: s,
403
+ id: n,
404
+ ...l
405
+ }) {
406
+ const i = H(), r = E(null), d = V(n), a = p(
407
+ (h) => {
408
+ i.focus(h);
409
+ },
410
+ [i]
411
+ ), y = p(() => {
412
+ i.focusedItem.get()?.pointers.down && a(i.focusedItem.get().pointers.down);
413
+ }, [i, a]), m = p(() => {
414
+ i.focusedItem.get()?.pointers.up && a(i.focusedItem.get().pointers.up);
415
+ }, [i, a]), F = T({
416
+ ArrowUp: m,
417
+ ArrowLeft: m,
418
+ ArrowDown: y,
419
+ ArrowRight: y,
420
+ Space: () => {
421
+ i.focusedItem.get() && i.toggleSelect(i.focusedItem.get());
422
+ }
423
+ }), _ = p(
424
+ (h) => {
425
+ a(h.key), i.toggleSelect(h);
426
+ },
427
+ [i, a]
428
+ );
429
+ return A(
430
+ s,
431
+ () => ({
432
+ focusDown() {
433
+ y();
434
+ },
435
+ focusUp() {
436
+ m();
437
+ },
438
+ select() {
439
+ i.focusedItem.get() && i.toggleSelect(i.focusedItem.get());
440
+ }
441
+ }),
442
+ [i, y, m]
443
+ ), /* @__PURE__ */ b(
444
+ "div",
445
+ {
446
+ ref: r,
447
+ id: d,
448
+ className: t,
449
+ tabIndex: -1,
450
+ role: "listbox",
451
+ onKeyDown: F,
452
+ ...l,
453
+ children: [...i].map((h) => /* @__PURE__ */ b(
454
+ D,
455
+ {
456
+ className: e,
457
+ id: `${d}-${h.key}`,
458
+ item: h,
459
+ render: o,
460
+ mouseEventHandler: _
461
+ },
462
+ h.key
463
+ ))
464
+ }
465
+ );
466
+ }
467
+ export {
468
+ Z as CompositeComponent,
469
+ X as CompositeComponentContext,
470
+ D as CompositeComponentItem,
471
+ H as useCompositeContext
472
+ };