@wrdagency/blockout 1.0.13 → 1.0.17

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.
Files changed (107) hide show
  1. package/dist/assets/index2.css +1 -1
  2. package/dist/assets/index8.css +1 -1
  3. package/dist/assets/style10.css +1 -1
  4. package/dist/assets/style2.css +1 -1
  5. package/dist/assets/style21.css +1 -1
  6. package/dist/assets/style3.css +1 -1
  7. package/dist/assets/style4.css +1 -1
  8. package/dist/assets/style5.css +1 -1
  9. package/dist/assets/style6.css +1 -1
  10. package/dist/assets/style7.css +1 -1
  11. package/dist/assets/style8.css +1 -1
  12. package/dist/assets/style9.css +1 -1
  13. package/dist/combobox-popover-DcwyOnhG.js +650 -0
  14. package/dist/components/avatar/index.d.ts +4 -2
  15. package/dist/components/avatar/index.js +24 -19
  16. package/dist/components/breadcrumbs/index.js +2 -2
  17. package/dist/components/button/button.js +2 -2
  18. package/dist/components/button/icon.js +1 -1
  19. package/dist/components/controls/base-popover-control/index.js +1 -1
  20. package/dist/components/controls/checkbox-control/index.js +1 -1
  21. package/dist/components/controls/choice-control/choice.js +1 -1
  22. package/dist/components/controls/choice-control/index.js +1 -1
  23. package/dist/components/controls/date-control/index.js +1 -1
  24. package/dist/components/controls/list-control/item.js +1 -1
  25. package/dist/components/controls/recurrence-control/index.js +1 -1
  26. package/dist/components/controls/select-control/props.d.ts +4 -3
  27. package/dist/components/controls/select-control/select.d.ts +1 -1
  28. package/dist/components/controls/select-control/select.js +55 -51
  29. package/dist/components/controls/tag-control/ariakit-experimental.js +17 -17
  30. package/dist/components/controls/tag-control/index.js +9 -9
  31. package/dist/components/controls/tag-control/props.js +1 -1
  32. package/dist/components/controls/toggle-control/index.js +1 -1
  33. package/dist/components/controls/toggle-group-control/index.js +1 -1
  34. package/dist/components/data-form/status.js +1 -1
  35. package/dist/components/data-form/submit.js +1 -1
  36. package/dist/components/data-view/data/filter.js +2 -2
  37. package/dist/components/data-view/index.js +1 -1
  38. package/dist/components/data-view/layouts/grid/group.js +2 -2
  39. package/dist/components/data-view/layouts/grid/item.js +2 -2
  40. package/dist/components/data-view/layouts/kanban/group.js +2 -2
  41. package/dist/components/data-view/layouts/kanban/item.js +2 -2
  42. package/dist/components/data-view/layouts/kanban/root.js +1 -1
  43. package/dist/components/data-view/layouts/list/group.js +2 -2
  44. package/dist/components/data-view/layouts/list/item.js +2 -2
  45. package/dist/components/data-view/layouts/table/empty.js +2 -2
  46. package/dist/components/data-view/layouts/table/group.js +3 -3
  47. package/dist/components/data-view/layouts/table/item.js +3 -3
  48. package/dist/components/data-view/layouts/table/root.js +2 -2
  49. package/dist/components/data-view/parts/body/empty.js +1 -1
  50. package/dist/components/data-view/parts/body/index.js +4 -4
  51. package/dist/components/data-view/parts/controls/index.js +2 -2
  52. package/dist/components/data-view/parts/controls/search.js +2 -2
  53. package/dist/components/data-view/parts/filters/chip.js +1 -1
  54. package/dist/components/data-view/parts/filters/editor.js +1 -1
  55. package/dist/components/data-view/parts/footer/actions.js +2 -2
  56. package/dist/components/data-view/parts/footer/index.js +2 -2
  57. package/dist/components/data-view/parts/footer/selection.js +2 -2
  58. package/dist/components/data-view/parts/view-control/index.js +2 -2
  59. package/dist/components/data-view/root.js +2 -2
  60. package/dist/components/data-view/slots/group/checkbox.js +3 -3
  61. package/dist/components/data-view/slots/group/context.js +1 -1
  62. package/dist/components/data-view/slots/group/icon.js +1 -1
  63. package/dist/components/data-view/slots/group/index.js +1 -1
  64. package/dist/components/data-view/slots/group/label.js +1 -1
  65. package/dist/components/data-view/slots/index.js +3 -3
  66. package/dist/components/data-view/slots/item/actions.js +1 -1
  67. package/dist/components/data-view/slots/item/checkbox.js +2 -2
  68. package/dist/components/data-view/slots/item/depth.js +3 -3
  69. package/dist/components/data-view/slots/item/description.js +1 -1
  70. package/dist/components/data-view/slots/item/index.js +1 -1
  71. package/dist/components/data-view/slots/item/properties.js +2 -2
  72. package/dist/components/data-view/slots/item/relations.js +4 -4
  73. package/dist/components/data-view/slots/item/tags.js +1 -1
  74. package/dist/components/data-view/slots/item/thumbnail.js +1 -1
  75. package/dist/components/data-view/slots/item/title.js +3 -3
  76. package/dist/components/data-view/slots/item/util.js +2 -2
  77. package/dist/components/data-view/slots/property/field/editable.js +2 -2
  78. package/dist/components/data-view/slots/property/field/index.js +1 -1
  79. package/dist/components/data-view/slots/property/field/static.js +1 -1
  80. package/dist/components/data-view/slots/property/index.js +1 -1
  81. package/dist/components/data-view/slots/property/label.js +1 -1
  82. package/dist/components/data-view/slots/root/checkbox.js +2 -2
  83. package/dist/components/data-view/slots/root/index.js +1 -1
  84. package/dist/components/index.js +1 -1
  85. package/dist/components/progress/index.js +1 -1
  86. package/dist/components/shell/pane.js +20 -15
  87. package/dist/components/tag/tag.js +1 -1
  88. package/dist/components/window/index.js +2 -2
  89. package/dist/{filter-DAMRLXNe.js → filter-BqYmWg3n.js} +1 -1
  90. package/dist/{index-CoFfLb68.js → index-BdzBM_aG.js} +1 -1
  91. package/dist/{index-CPOlz97j.js → index-BrUAPkzm.js} +3 -3
  92. package/dist/{index-ClExU5xD.js → index-CWkR83hZ.js} +2 -2
  93. package/dist/index.js +1 -1
  94. package/dist/primitives/colourway/index.js +1 -1
  95. package/dist/primitives/icon-label/index.d.ts +3 -1
  96. package/dist/primitives/icon-label/index.js +18 -13
  97. package/dist/primitives/link/index.js +1 -1
  98. package/dist/primitives/nav-link/index.js +1 -1
  99. package/dist/primitives/resizable/index.js +1 -1
  100. package/dist/primitives/tooltip/index.js +1 -1
  101. package/dist/primitives/truncate/index.js +1 -1
  102. package/dist/primitives/typography/heading.js +1 -1
  103. package/dist/primitives/typography/paragraph.js +1 -1
  104. package/dist/tag-remove-CVXLunYF.js +447 -0
  105. package/package.json +1 -1
  106. package/dist/MAXQOH4L-DBaf8WKp.js +0 -564
  107. package/dist/tag-remove-BVa8oSsq.js +0 -533
@@ -1,564 +0,0 @@
1
- import { u as Ge } from "./5JTVDSTH-DcfjjEya.js";
2
- import { a as Je } from "./WMYDSCNQ-D4CU76mX.js";
3
- import { a as Qe, C as Xe, b as Oe, c as Ye, d as Ze, e as ye, u as et, f as tt } from "./S43UC3DV-CiBKpqp8.js";
4
- import { I as ot, S as nt, V as k, T as te, U as $, a1 as rt, x as st, a7 as ut, m as N, o as y, W as Ie, f as ae, c as ie, a as ce, _ as de, i as fe, a8 as lt, a9 as at, y as Ve, aa as se, ab as it, e as H, B as ct, b as ue, j as L, G as dt, q as Ee, n as we, a0 as ft, a4 as mt, $ as vt, K as pt, s as bt, O as Ct, P as St, k as gt, l as Ae, ac as xt, r as Vt } from "./LMDWO4NN-CIZvvtic.js";
5
- import { h as le } from "./PFRGBC2K-B9ko--FF.js";
6
- import { m as ht, p as Pt, t as Ot, c as yt, s as X, e as W, g as It, b as Et, d as oe, u as wt } from "./YV4JVR4I-w1-dnslS.js";
7
- import { createContext as ke, useRef as z, useState as Le, useEffect as Y, useMemo as At, useCallback as kt, useContext as Lt } from "react";
8
- import { e as _t, C as Tt } from "./P7GR5CS5-5PtDURPc.js";
9
- import { c as Kt, a as Dt } from "./O2PQ2652-D2GSkoLq.js";
10
- import { c as Rt, d as Mt, b as Bt } from "./4CMBR7SL-ChJnawVl.js";
11
- import { jsx as Z } from "react/jsx-runtime";
12
- import { u as Ft } from "./UQQRIHDV-BBkcyl82.js";
13
- import { u as Ht } from "./6VRAQV3D-DK_p41oq.js";
14
- import { i as Nt } from "./KFH4SEIX-BFT9WmYk.js";
15
- var xo = ke(null), Vo = ke(
16
- null
17
- ), ne = ot(
18
- [Tt],
19
- [_t]
20
- ), Ut = ne.useContext, ho = ne.useProviderContext, Po = ne.ContextProvider, Oo = ne.ScopedContextProvider, jt = st() && ut();
21
- function qt(o = {}) {
22
- var n = o, {
23
- tag: r
24
- } = n, e = nt(n, [
25
- "tag"
26
- ]);
27
- const c = ht(e.store, Pt(r, ["value", "rtl"]));
28
- Ot(e, c);
29
- const d = r == null ? void 0 : r.getState(), u = c == null ? void 0 : c.getState(), T = k(
30
- e.activeId,
31
- u == null ? void 0 : u.activeId,
32
- e.defaultActiveId,
33
- null
34
- ), w = Rt(te($({}, e), {
35
- activeId: T,
36
- includesBaseElement: k(
37
- e.includesBaseElement,
38
- u == null ? void 0 : u.includesBaseElement,
39
- !0
40
- ),
41
- orientation: k(
42
- e.orientation,
43
- u == null ? void 0 : u.orientation,
44
- "vertical"
45
- ),
46
- focusLoop: k(e.focusLoop, u == null ? void 0 : u.focusLoop, !0),
47
- focusWrap: k(e.focusWrap, u == null ? void 0 : u.focusWrap, !0),
48
- virtualFocus: k(
49
- e.virtualFocus,
50
- u == null ? void 0 : u.virtualFocus,
51
- !0
52
- )
53
- })), I = Kt(te($({}, e), {
54
- placement: k(
55
- e.placement,
56
- u == null ? void 0 : u.placement,
57
- "bottom-start"
58
- )
59
- })), K = k(
60
- e.value,
61
- u == null ? void 0 : u.value,
62
- e.defaultValue,
63
- ""
64
- ), O = k(
65
- e.selectedValue,
66
- u == null ? void 0 : u.selectedValue,
67
- d == null ? void 0 : d.values,
68
- e.defaultSelectedValue,
69
- ""
70
- ), f = Array.isArray(O), _ = te($($({}, w.getState()), I.getState()), {
71
- value: K,
72
- selectedValue: O,
73
- resetValueOnSelect: k(
74
- e.resetValueOnSelect,
75
- u == null ? void 0 : u.resetValueOnSelect,
76
- f
77
- ),
78
- resetValueOnHide: k(
79
- e.resetValueOnHide,
80
- u == null ? void 0 : u.resetValueOnHide,
81
- f && !r
82
- ),
83
- activeValue: u == null ? void 0 : u.activeValue
84
- }), l = yt(_, w, I, c);
85
- return jt && X(
86
- l,
87
- () => W(l, ["virtualFocus"], () => {
88
- l.setState("virtualFocus", !1);
89
- })
90
- ), X(l, () => {
91
- if (r)
92
- return rt(
93
- W(l, ["selectedValue"], (i) => {
94
- Array.isArray(i.selectedValue) && r.setValues(i.selectedValue);
95
- }),
96
- W(r, ["values"], (i) => {
97
- l.setState("selectedValue", i.values);
98
- })
99
- );
100
- }), X(
101
- l,
102
- () => W(l, ["resetValueOnHide", "mounted"], (i) => {
103
- i.resetValueOnHide && (i.mounted || l.setState("value", K));
104
- })
105
- ), X(
106
- l,
107
- () => W(l, ["open"], (i) => {
108
- i.open || (l.setState("activeId", T), l.setState("moves", 0));
109
- })
110
- ), X(
111
- l,
112
- () => W(l, ["moves", "activeId"], (i, A) => {
113
- i.moves === A.moves && l.setState("activeValue", void 0);
114
- })
115
- ), X(
116
- l,
117
- () => It(l, ["moves", "renderedItems"], (i, A) => {
118
- if (i.moves === A.moves) return;
119
- const { activeId: V } = l.getState(), m = w.item(V);
120
- l.setState("activeValue", m == null ? void 0 : m.value);
121
- })
122
- ), te($($($({}, I), w), l), {
123
- tag: r,
124
- setValue: (i) => l.setState("value", i),
125
- resetValue: () => l.setState("value", _.value),
126
- setSelectedValue: (i) => l.setState("selectedValue", i)
127
- });
128
- }
129
- function $t(o) {
130
- const n = Ut();
131
- return o = N(y({}, o), {
132
- tag: o.tag !== void 0 ? o.tag : n
133
- }), Mt(o);
134
- }
135
- function Wt(o, n, r) {
136
- return Ie(n, [r.tag]), oe(o, r, "value", "setValue"), oe(o, r, "selectedValue", "setSelectedValue"), oe(o, r, "resetValueOnHide"), oe(o, r, "resetValueOnSelect"), Object.assign(
137
- Bt(
138
- Dt(o, n, r),
139
- n,
140
- r
141
- ),
142
- { tag: r.tag }
143
- );
144
- }
145
- function zt(o = {}) {
146
- o = $t(o);
147
- const [n, r] = Et(qt, o);
148
- return Wt(n, r, o);
149
- }
150
- var Gt = "input";
151
- function he(o, n, r) {
152
- if (!r) return !1;
153
- const e = o.find((c) => !c.disabled && c.value);
154
- return (e == null ? void 0 : e.value) === n;
155
- }
156
- function Pe(o, n) {
157
- return !n || o == null ? !1 : (o = pt(o), n.length > o.length && n.toLowerCase().indexOf(o.toLowerCase()) === 0);
158
- }
159
- function Jt(o) {
160
- return o.type === "input";
161
- }
162
- function Qt(o) {
163
- return o === "inline" || o === "list" || o === "both" || o === "none";
164
- }
165
- function Xt(o) {
166
- const n = o.find((r) => {
167
- var e;
168
- return r.disabled ? !1 : ((e = r.element) == null ? void 0 : e.getAttribute("role")) !== "tab";
169
- });
170
- return n == null ? void 0 : n.id;
171
- }
172
- var Yt = ie(
173
- function(n) {
174
- var r = n, {
175
- store: e,
176
- focusable: c = !0,
177
- autoSelect: d = !1,
178
- getAutoSelectId: u,
179
- setValueOnChange: T,
180
- showMinLength: w = 0,
181
- showOnChange: I,
182
- showOnMouseDown: K,
183
- showOnClick: O = K,
184
- showOnKeyDown: f,
185
- showOnKeyPress: _ = f,
186
- blurActiveItemOnClick: l,
187
- setValueOnClick: i = !0,
188
- moveOnKeyPress: A = !0,
189
- autoComplete: V = "list"
190
- } = r, m = de(r, [
191
- "store",
192
- "focusable",
193
- "autoSelect",
194
- "getAutoSelectId",
195
- "setValueOnChange",
196
- "showMinLength",
197
- "showOnChange",
198
- "showOnMouseDown",
199
- "showOnClick",
200
- "showOnKeyDown",
201
- "showOnKeyPress",
202
- "blurActiveItemOnClick",
203
- "setValueOnClick",
204
- "moveOnKeyPress",
205
- "autoComplete"
206
- ]);
207
- const G = Qe();
208
- e = e || G, fe(
209
- e,
210
- process.env.NODE_ENV !== "production" && "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component."
211
- );
212
- const D = z(null), [J, h] = lt(), C = z(!1), M = z(!1), P = e.useState(
213
- (t) => t.virtualFocus && d
214
- ), x = V === "inline" || V === "both", [U, Q] = Le(x);
215
- at(() => {
216
- x && Q(!0);
217
- }, [x]);
218
- const s = e.useState("value"), b = z();
219
- Y(() => W(e, ["selectedValue", "activeId"], (t, a) => {
220
- b.current = a.selectedValue;
221
- }), []);
222
- const S = e.useState((t) => {
223
- var a;
224
- if (x && U && !(t.activeValue && Array.isArray(t.selectedValue) && (t.selectedValue.includes(t.activeValue) || (a = b.current) != null && a.includes(t.activeValue))))
225
- return t.activeValue;
226
- }), j = e.useState("renderedItems"), B = e.useState("open"), F = e.useState("contentElement"), ee = At(() => {
227
- if (!x || !U) return s;
228
- if (he(
229
- j,
230
- S,
231
- P
232
- )) {
233
- if (Pe(s, S)) {
234
- const a = (S == null ? void 0 : S.slice(s.length)) || "";
235
- return s + a;
236
- }
237
- return s;
238
- }
239
- return S || s;
240
- }, [x, U, j, S, P, s]);
241
- Y(() => {
242
- const t = D.current;
243
- if (!t) return;
244
- const a = () => Q(!0);
245
- return t.addEventListener("combobox-item-move", a), () => {
246
- t.removeEventListener("combobox-item-move", a);
247
- };
248
- }, []), Y(() => {
249
- if (!x || !U || !S || !he(
250
- j,
251
- S,
252
- P
253
- ) || !Pe(s, S)) return;
254
- let a = it;
255
- return queueMicrotask(() => {
256
- const v = D.current;
257
- if (!v) return;
258
- const { start: p, end: E } = Ve(v), R = s.length, g = S.length;
259
- se(v, R, g), a = () => {
260
- if (!le(v)) return;
261
- const { start: q, end: ze } = Ve(v);
262
- q === R && ze === g && se(v, p, E);
263
- };
264
- }), () => a();
265
- }, [
266
- J,
267
- x,
268
- U,
269
- S,
270
- j,
271
- P,
272
- s
273
- ]);
274
- const _e = z(null), me = H(u), ve = z(null);
275
- Y(() => {
276
- if (!B || !F) return;
277
- const t = ct(F);
278
- if (!t) return;
279
- _e.current = t;
280
- const a = () => {
281
- C.current = !1;
282
- }, v = () => {
283
- if (!e || !C.current) return;
284
- const { activeId: E } = e.getState();
285
- E !== null && E !== ve.current && (C.current = !1);
286
- }, p = { passive: !0, capture: !0 };
287
- return t.addEventListener("wheel", a, p), t.addEventListener("touchmove", a, p), t.addEventListener("scroll", v, p), () => {
288
- t.removeEventListener("wheel", a, !0), t.removeEventListener("touchmove", a, !0), t.removeEventListener("scroll", v, !0);
289
- };
290
- }, [B, F, e]), ue(() => {
291
- s && (M.current || (C.current = !0));
292
- }, [s]), ue(() => {
293
- P !== "always" && B || (C.current = B);
294
- }, [P, B]);
295
- const pe = e.useState("resetValueOnSelect");
296
- Ie(() => {
297
- var t, a;
298
- const v = C.current;
299
- if (!e || !B || !v && !pe) return;
300
- const { baseElement: p, contentElement: E, activeId: R } = e.getState();
301
- if (!(p && !le(p))) {
302
- if (E != null && E.hasAttribute("data-placing")) {
303
- const g = new MutationObserver(h);
304
- return g.observe(E, { attributeFilter: ["data-placing"] }), () => g.disconnect();
305
- }
306
- if (P && v) {
307
- const g = me(j), q = g !== void 0 ? g : (t = Xt(j)) != null ? t : e.first();
308
- ve.current = q, e.move(q ?? null);
309
- } else {
310
- const g = (a = e.item(R || e.first())) == null ? void 0 : a.element;
311
- g && "scrollIntoView" in g && g.scrollIntoView({ block: "nearest", inline: "nearest" });
312
- }
313
- }
314
- }, [
315
- e,
316
- B,
317
- J,
318
- s,
319
- P,
320
- pe,
321
- me,
322
- j
323
- ]), Y(() => {
324
- if (!x) return;
325
- const t = D.current;
326
- if (!t) return;
327
- const a = [t, F].filter(
328
- (p) => !!p
329
- ), v = (p) => {
330
- a.every((E) => vt(p, E)) && (e == null || e.setValue(ee));
331
- };
332
- for (const p of a)
333
- p.addEventListener("focusout", v);
334
- return () => {
335
- for (const p of a)
336
- p.removeEventListener("focusout", v);
337
- };
338
- }, [x, F, e, ee]);
339
- const re = (t) => t.currentTarget.value.length >= w, be = m.onChange, Te = L(I ?? re), Ke = L(
340
- // If the combobox is combined with tags, the value will be set by the tag
341
- // input component.
342
- T ?? !e.tag
343
- ), De = H((t) => {
344
- if (be == null || be(t), t.defaultPrevented || !e) return;
345
- const a = t.currentTarget, { value: v, selectionStart: p, selectionEnd: E } = a, R = t.nativeEvent;
346
- if (C.current = !0, Jt(R) && (R.isComposing && (C.current = !1, M.current = !0), x)) {
347
- const g = R.inputType === "insertText" || R.inputType === "insertCompositionText", q = p === v.length;
348
- Q(g && q);
349
- }
350
- if (Ke(t)) {
351
- const g = v === e.getState().value;
352
- e.setValue(v), queueMicrotask(() => {
353
- se(a, p, E);
354
- }), x && P && g && h();
355
- }
356
- Te(t) && e.show(), (!P || !C.current) && e.setActiveId(null);
357
- }), Ce = m.onCompositionEnd, Re = H((t) => {
358
- C.current = !0, M.current = !1, Ce == null || Ce(t), !t.defaultPrevented && P && h();
359
- }), Se = m.onMouseDown, Me = L(
360
- l ?? (() => !!(e != null && e.getState().includesBaseElement))
361
- ), Be = L(i), Fe = L(O ?? re), He = H((t) => {
362
- Se == null || Se(t), !t.defaultPrevented && (t.button || t.ctrlKey || e && (Me(t) && e.setActiveId(null), Be(t) && e.setValue(ee), Fe(t) && dt(t.currentTarget, "mouseup", e.show)));
363
- }), ge = m.onKeyDown, Ne = L(_ ?? re), Ue = H((t) => {
364
- if (ge == null || ge(t), t.repeat || (C.current = !1), t.defaultPrevented || t.ctrlKey || t.altKey || t.shiftKey || t.metaKey || !e) return;
365
- const { open: a } = e.getState();
366
- a || (t.key === "ArrowUp" || t.key === "ArrowDown") && Ne(t) && (t.preventDefault(), e.show());
367
- }), xe = m.onBlur, je = H((t) => {
368
- C.current = !1, xe == null || xe(t), t.defaultPrevented;
369
- }), qe = Ee(m.id), $e = Qt(V) ? V : void 0, We = e.useState((t) => t.activeId === null);
370
- return m = N(y({
371
- id: qe,
372
- role: "combobox",
373
- "aria-autocomplete": $e,
374
- "aria-haspopup": ft(F, "listbox"),
375
- "aria-expanded": B,
376
- "aria-controls": F == null ? void 0 : F.id,
377
- "data-active-item": We || void 0,
378
- value: ee
379
- }, m), {
380
- ref: we(D, m.ref),
381
- onChange: De,
382
- onCompositionEnd: Re,
383
- onMouseDown: He,
384
- onKeyDown: Ue,
385
- onBlur: je
386
- }), m = Ge(N(y({
387
- store: e,
388
- focusable: c
389
- }, m), {
390
- // Enable inline autocomplete when the user moves from the combobox input
391
- // to an item.
392
- moveOnKeyPress: (t) => mt(A, t) ? !1 : (x && Q(!0), !0)
393
- })), m = Je(y({ store: e }, m)), y({ autoComplete: "off" }, m);
394
- }
395
- ), yo = ae(function(n) {
396
- const r = Yt(n);
397
- return ce(Gt, r);
398
- });
399
- function Io(o = {}) {
400
- const n = zt(o);
401
- return /* @__PURE__ */ Z(Xe, { value: n, children: o.children });
402
- }
403
- var Zt = "div";
404
- function eo(o, n) {
405
- if (n != null)
406
- return o == null ? !1 : Array.isArray(o) ? o.includes(n) : o === n;
407
- }
408
- function to(o) {
409
- var n;
410
- return (n = {
411
- menu: "menuitem",
412
- listbox: "option",
413
- tree: "treeitem"
414
- }[o]) != null ? n : "option";
415
- }
416
- var oo = ie(
417
- function(n) {
418
- var r = n, {
419
- store: e,
420
- value: c,
421
- hideOnClick: d,
422
- setValueOnClick: u,
423
- selectValueOnClick: T = !0,
424
- resetValueOnSelect: w,
425
- focusOnHover: I = !1,
426
- moveOnKeyPress: K = !0,
427
- getItem: O
428
- } = r, f = de(r, [
429
- "store",
430
- "value",
431
- "hideOnClick",
432
- "setValueOnClick",
433
- "selectValueOnClick",
434
- "resetValueOnSelect",
435
- "focusOnHover",
436
- "moveOnKeyPress",
437
- "getItem"
438
- ]), _;
439
- const l = Oe();
440
- e = e || l, fe(
441
- e,
442
- process.env.NODE_ENV !== "production" && "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component."
443
- );
444
- const { resetValueOnSelectState: i, multiSelectable: A, selected: V } = wt(e, {
445
- resetValueOnSelectState: "resetValueOnSelect",
446
- multiSelectable(s) {
447
- return Array.isArray(s.selectedValue);
448
- },
449
- selected(s) {
450
- return eo(s.selectedValue, c);
451
- }
452
- }), m = kt(
453
- (s) => {
454
- const b = N(y({}, s), { value: c });
455
- return O ? O(b) : b;
456
- },
457
- [c, O]
458
- );
459
- u = u ?? !A, d = d ?? (c != null && !A);
460
- const G = f.onClick, D = L(u), J = L(T), h = L(
461
- (_ = w ?? i) != null ? _ : A
462
- ), C = L(d), M = H((s) => {
463
- G == null || G(s), !s.defaultPrevented && (Ct(s) || St(s) || (c != null && (J(s) && (h(s) && (e == null || e.resetValue()), e == null || e.setSelectedValue((b) => Array.isArray(b) ? b.includes(c) ? b.filter((S) => S !== c) : [...b, c] : c)), D(s) && (e == null || e.setValue(c))), C(s) && (e == null || e.hide())));
464
- }), P = f.onKeyDown, x = H((s) => {
465
- if (P == null || P(s), s.defaultPrevented) return;
466
- const b = e == null ? void 0 : e.getState().baseElement;
467
- if (!b || le(b)) return;
468
- (s.key.length === 1 || s.key === "Backspace" || s.key === "Delete") && (queueMicrotask(() => b.focus()), gt(b) && (e == null || e.setValue(b.value)));
469
- });
470
- A && V != null && (f = y({
471
- "aria-selected": V
472
- }, f)), f = Ae(
473
- f,
474
- (s) => /* @__PURE__ */ Z(Ye.Provider, { value: c, children: /* @__PURE__ */ Z(Ze.Provider, { value: V ?? !1, children: s }) }),
475
- [c, V]
476
- );
477
- const U = Lt(ye);
478
- f = N(y({
479
- role: to(U),
480
- children: c
481
- }, f), {
482
- onClick: M,
483
- onKeyDown: x
484
- });
485
- const Q = L(K);
486
- return f = Ht(N(y({
487
- store: e
488
- }, f), {
489
- getItem: m,
490
- // Dispatch a custom event on the combobox input when moving to an item
491
- // with the keyboard so the Combobox component can enable inline
492
- // autocompletion.
493
- moveOnKeyPress: (s) => {
494
- if (!Q(s)) return !1;
495
- const b = new Event("combobox-item-move"), S = e == null ? void 0 : e.getState().baseElement;
496
- return S == null || S.dispatchEvent(b), !0;
497
- }
498
- })), f = Ft(y({ store: e, focusOnHover: I }, f)), f;
499
- }
500
- ), Eo = bt(
501
- ae(function(n) {
502
- const r = oo(n);
503
- return ce(Zt, r);
504
- })
505
- ), no = "div", ro = ie(
506
- function(n) {
507
- var r = n, { store: e, alwaysVisible: c } = r, d = de(r, ["store", "alwaysVisible"]);
508
- const u = Oe(!0), T = et();
509
- e = e || T;
510
- const w = !!e && e === u;
511
- fe(
512
- e,
513
- process.env.NODE_ENV !== "production" && "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component."
514
- );
515
- const I = z(null), K = Ee(d.id), O = e.useState("mounted"), f = Nt(O, d.hidden, c), _ = f ? N(y({}, d.style), { display: "none" }) : d.style, l = e.useState(
516
- (h) => Array.isArray(h.selectedValue)
517
- ), i = xt(I, "role", d.role), V = (i === "listbox" || i === "tree" || i === "grid") && l || void 0, [m, G] = Le(!1), D = e.useState("contentElement");
518
- ue(() => {
519
- if (!O) return;
520
- const h = I.current;
521
- if (!h || D !== h) return;
522
- const C = () => {
523
- G(!!h.querySelector("[role='listbox']"));
524
- }, M = new MutationObserver(C);
525
- return M.observe(h, {
526
- subtree: !0,
527
- childList: !0,
528
- attributeFilter: ["role"]
529
- }), C(), () => M.disconnect();
530
- }, [O, D]), m || (d = y({
531
- role: "listbox",
532
- "aria-multiselectable": V
533
- }, d)), d = Ae(
534
- d,
535
- (h) => /* @__PURE__ */ Z(tt, { value: e, children: /* @__PURE__ */ Z(ye.Provider, { value: i, children: h }) }),
536
- [e, i]
537
- );
538
- const J = K && (!u || !w) ? e.setContentElement : null;
539
- return d = N(y({
540
- id: K,
541
- hidden: f
542
- }, d), {
543
- ref: we(J, I, d.ref),
544
- style: _
545
- }), Vt(d);
546
- }
547
- ), wo = ae(function(n) {
548
- const r = ro(n);
549
- return ce(no, r);
550
- });
551
- export {
552
- Io as C,
553
- xo as T,
554
- yo as a,
555
- wo as b,
556
- Eo as c,
557
- Ut as d,
558
- Vo as e,
559
- ho as f,
560
- Oo as g,
561
- Po as h,
562
- zt as i,
563
- ro as u
564
- };