anysystem-design 0.0.9 → 0.0.11
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/{combobox-BFmS_epO.js → combobox-CRHFa4aF.js} +74 -73
- package/dist/components/AutoComplete/AutoCompleteBase.js +19 -18
- package/dist/components/AutoComplete/AutoCompleteMultiple.js +29 -28
- package/dist/components/Checkbox/CheckboxBase.js +2 -2
- package/dist/components/Label/Label.d.ts +1 -0
- package/dist/components/Label/Label.js +19 -14
- package/dist/components/RadioGroup/RadioGroup.d.ts +16 -0
- package/dist/components/RadioGroup/RadioGroup.js +169 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/RadioGroup/index.js +4 -0
- package/dist/components/Selectbox/SelectboxBase.d.ts +0 -1
- package/dist/components/Selectbox/SelectboxBase.js +11 -10
- package/dist/components/Selectbox/SelectboxMultiple.js +11 -10
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +22 -20
- package/dist/index-DsW4uhBe.js +846 -0
- package/dist/index.css +1 -1
- package/dist/index.js +22 -20
- package/dist/{listbox-uFQRPSYb.js → listbox-CzAQRl_p.js} +69 -68
- package/dist/transition-B0bHCOYe.js +1723 -0
- package/package.json +1 -1
- package/dist/index-vZEwQcSd.js +0 -2538
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { s as $e, o as g, n as q,
|
|
1
|
+
import { s as $e, o as g, n as q, f as Ke, x as Ue, M as Re, W as re, K as qe, a as Ge, l as Je, T as Ye, u as Qe, e as te, z as Xe, j as Ze, b as le, d as et, y as de, m as tt, I as be, G as nt, $ as De, c as Fe, D as ge, q as ye, g as F, r as ot, _ as it } from "./index-DsW4uhBe.js";
|
|
2
2
|
import * as ie from "react";
|
|
3
|
-
import $, { useEffect as xe, useRef as N, createContext as Se, useReducer as
|
|
4
|
-
import { r as
|
|
3
|
+
import $, { useEffect as xe, useRef as N, createContext as Se, useReducer as st, createRef as rt, useCallback as Ce, useMemo as G, useId as pe, useContext as Ie, useState as lt, Fragment as ke } from "react";
|
|
4
|
+
import { r as Z } from "./index-DsprzSCj.js";
|
|
5
|
+
import { F as at, v as ut, f as ct, i as ce, y as dt, n as Ae, w as pt, T as ft, x as ht, R as mt, o as vt, h as bt, V as gt, m as xt, j as St, k as It, p as we, A as Ot, l as Me, t as Et, z as Tt, q as Rt, r as _, B as yt, s as _e } from "./transition-B0bHCOYe.js";
|
|
5
6
|
function oe(e, s, t) {
|
|
6
7
|
let n = t.initialDeps ?? [], o;
|
|
7
8
|
return () => {
|
|
@@ -49,7 +50,7 @@ const Ct = (e, s) => Math.abs(e - s) < 1, wt = (e, s, t) => {
|
|
|
49
50
|
for (let o = s; o <= t; o++)
|
|
50
51
|
n.push(o);
|
|
51
52
|
return n;
|
|
52
|
-
},
|
|
53
|
+
}, zt = (e, s) => {
|
|
53
54
|
const t = e.scrollElement;
|
|
54
55
|
if (!t)
|
|
55
56
|
return;
|
|
@@ -77,9 +78,9 @@ const Ct = (e, s) => Math.abs(e - s) < 1, wt = (e, s, t) => {
|
|
|
77
78
|
return l.observe(t, { box: "border-box" }), () => {
|
|
78
79
|
l.unobserve(t);
|
|
79
80
|
};
|
|
80
|
-
},
|
|
81
|
+
}, ze = {
|
|
81
82
|
passive: !0
|
|
82
|
-
},
|
|
83
|
+
}, Pt = typeof window > "u" ? !0 : "onscrollend" in window, $t = (e, s) => {
|
|
83
84
|
const t = e.scrollElement;
|
|
84
85
|
if (!t)
|
|
85
86
|
return;
|
|
@@ -87,7 +88,7 @@ const Ct = (e, s) => Math.abs(e - s) < 1, wt = (e, s, t) => {
|
|
|
87
88
|
if (!n)
|
|
88
89
|
return;
|
|
89
90
|
let o = 0;
|
|
90
|
-
const l =
|
|
91
|
+
const l = Pt ? () => {
|
|
91
92
|
} : wt(
|
|
92
93
|
n,
|
|
93
94
|
() => {
|
|
@@ -97,7 +98,7 @@ const Ct = (e, s) => Math.abs(e - s) < 1, wt = (e, s, t) => {
|
|
|
97
98
|
), r = (p) => () => {
|
|
98
99
|
o = t[e.options.horizontal ? "scrollLeft" : "scrollTop"], l(), s(o, p);
|
|
99
100
|
}, i = r(!0), a = r(!1);
|
|
100
|
-
return a(), t.addEventListener("scroll", i,
|
|
101
|
+
return a(), t.addEventListener("scroll", i, ze), t.addEventListener("scrollend", a, ze), () => {
|
|
101
102
|
t.removeEventListener("scroll", i), t.removeEventListener("scrollend", a);
|
|
102
103
|
};
|
|
103
104
|
}, Dt = (e, s, t) => {
|
|
@@ -459,7 +460,7 @@ function Nt(e) {
|
|
|
459
460
|
...e,
|
|
460
461
|
onChange: (o, l) => {
|
|
461
462
|
var r;
|
|
462
|
-
l ?
|
|
463
|
+
l ? Z.flushSync(s) : s(), (r = e.onChange) == null || r.call(e, o, l);
|
|
463
464
|
}
|
|
464
465
|
}, [n] = ie.useState(
|
|
465
466
|
() => new kt(t)
|
|
@@ -468,7 +469,7 @@ function Nt(e) {
|
|
|
468
469
|
}
|
|
469
470
|
function Vt(e) {
|
|
470
471
|
return Nt({
|
|
471
|
-
observeElementRect:
|
|
472
|
+
observeElementRect: zt,
|
|
472
473
|
observeElementOffset: $t,
|
|
473
474
|
scrollToFn: Ft,
|
|
474
475
|
...e
|
|
@@ -513,7 +514,7 @@ function Wt(e, { container: s, accept: t, walk: n }) {
|
|
|
513
514
|
for (; d.nextNode(); ) a(d.currentNode);
|
|
514
515
|
}, [s, e, o, l]);
|
|
515
516
|
}
|
|
516
|
-
function
|
|
517
|
+
function Pe(e, s) {
|
|
517
518
|
let t = N([]), n = g(e);
|
|
518
519
|
xe(() => {
|
|
519
520
|
let o = [...t.current];
|
|
@@ -529,18 +530,18 @@ function jt(e) {
|
|
|
529
530
|
}
|
|
530
531
|
typeof window < "u" && typeof document < "u" && (document.addEventListener("DOMContentLoaded", s), s());
|
|
531
532
|
}
|
|
532
|
-
let
|
|
533
|
+
let X = [];
|
|
533
534
|
jt(() => {
|
|
534
535
|
function e(s) {
|
|
535
|
-
if (!(s.target instanceof HTMLElement) || s.target === document.body ||
|
|
536
|
+
if (!(s.target instanceof HTMLElement) || s.target === document.body || X[0] === s.target) return;
|
|
536
537
|
let t = s.target;
|
|
537
|
-
t = t.closest(Ue),
|
|
538
|
+
t = t.closest(Ue), X.unshift(t ?? s.target), X = X.filter((n) => n != null && n.isConnected), X.splice(10);
|
|
538
539
|
}
|
|
539
540
|
window.addEventListener("click", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("focus", e, { capture: !0 }), document.body.addEventListener("click", e, { capture: !0 }), document.body.addEventListener("mousedown", e, { capture: !0 }), document.body.addEventListener("focus", e, { capture: !0 });
|
|
540
541
|
});
|
|
541
542
|
var Oe = ((e) => (e[e.Left = 0] = "Left", e[e.Right = 2] = "Right", e))(Oe || {}), Ht = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(Ht || {}), Kt = ((e) => (e[e.Single = 0] = "Single", e[e.Multi = 1] = "Multi", e))(Kt || {}), Ut = ((e) => (e[e.Pointer = 0] = "Pointer", e[e.Focus = 1] = "Focus", e[e.Other = 2] = "Other", e))(Ut || {}), qt = ((e) => (e[e.OpenCombobox = 0] = "OpenCombobox", e[e.CloseCombobox = 1] = "CloseCombobox", e[e.GoToOption = 2] = "GoToOption", e[e.SetTyping = 3] = "SetTyping", e[e.RegisterOption = 4] = "RegisterOption", e[e.UnregisterOption = 5] = "UnregisterOption", e[e.SetActivationTrigger = 6] = "SetActivationTrigger", e[e.UpdateVirtualConfiguration = 7] = "UpdateVirtualConfiguration", e))(qt || {});
|
|
542
543
|
function ve(e, s = (t) => t) {
|
|
543
|
-
let t = e.activeOptionIndex !== null ? e.options[e.activeOptionIndex] : null, n = s(e.options.slice()), o = n.length > 0 && n[0].dataRef.current.order !== null ? n.sort((r, i) => r.dataRef.current.order - i.dataRef.current.order) :
|
|
544
|
+
let t = e.activeOptionIndex !== null ? e.options[e.activeOptionIndex] : null, n = s(e.options.slice()), o = n.length > 0 && n[0].dataRef.current.order !== null ? n.sort((r, i) => r.dataRef.current.order - i.dataRef.current.order) : it(n, (r) => r.dataRef.current.domRef.current), l = t ? o.indexOf(t) : null;
|
|
544
545
|
return l === -1 && (l = null), { options: o, activeOptionIndex: l };
|
|
545
546
|
}
|
|
546
547
|
let Gt = { 1(e) {
|
|
@@ -560,7 +561,7 @@ let Gt = { 1(e) {
|
|
|
560
561
|
var t, n, o, l, r;
|
|
561
562
|
if ((t = e.dataRef.current) != null && t.disabled || (n = e.dataRef.current) != null && n.optionsRef.current && !((o = e.dataRef.current) != null && o.optionsPropsRef.current.static) && e.comboboxState === 1) return e;
|
|
562
563
|
if (e.virtual) {
|
|
563
|
-
let { options: d, disabled: c } = e.virtual, I = s.focus === _.Specific ? s.idx :
|
|
564
|
+
let { options: d, disabled: c } = e.virtual, I = s.focus === _.Specific ? s.idx : _e(s, { resolveItems: () => d, resolveActiveIndex: () => {
|
|
564
565
|
var S, x;
|
|
565
566
|
return (x = (S = e.activeOptionIndex) != null ? S : d.findIndex((h) => !c(h))) != null ? x : null;
|
|
566
567
|
}, resolveDisabled: c, resolveId() {
|
|
@@ -573,7 +574,7 @@ let Gt = { 1(e) {
|
|
|
573
574
|
let d = i.options.findIndex((c) => !c.dataRef.current.disabled);
|
|
574
575
|
d !== -1 && (i.activeOptionIndex = d);
|
|
575
576
|
}
|
|
576
|
-
let a = s.focus === _.Specific ? s.idx :
|
|
577
|
+
let a = s.focus === _.Specific ? s.idx : _e(s, { resolveItems: () => i.options, resolveActiveIndex: () => i.activeOptionIndex, resolveId: (d) => d.id, resolveDisabled: (d) => d.dataRef.current.disabled }), p = (r = s.trigger) != null ? r : 2;
|
|
577
578
|
return e.activeOptionIndex === a && e.activationTrigger === p ? e : { ...e, ...i, isTyping: !1, activeOptionIndex: a, activationTrigger: p, __demoMode: !1 };
|
|
578
579
|
}, 4: (e, s) => {
|
|
579
580
|
var t, n, o;
|
|
@@ -622,7 +623,7 @@ function Jt(e) {
|
|
|
622
623
|
}, getScrollElement() {
|
|
623
624
|
var p;
|
|
624
625
|
return (p = s.optionsRef.current) != null ? p : null;
|
|
625
|
-
}, overscan: 12 }), [r, i] =
|
|
626
|
+
}, overscan: 12 }), [r, i] = lt(0);
|
|
626
627
|
q(() => {
|
|
627
628
|
i((p) => p + 1);
|
|
628
629
|
}, [t]);
|
|
@@ -634,7 +635,7 @@ function Jt(e) {
|
|
|
634
635
|
}
|
|
635
636
|
} }, a.map((p) => {
|
|
636
637
|
var d;
|
|
637
|
-
return $.createElement(
|
|
638
|
+
return $.createElement(ke, { key: p.key }, $.cloneElement((d = e.children) == null ? void 0 : d.call(e, { ...e.slot, option: t[p.index] }), { key: `${r}-${p.key}`, "data-index": p.index, "aria-setsize": t.length, "aria-posinset": p.index + 1, style: { position: "absolute", top: 0, left: 0, transform: `translateY(${p.start}px)`, overflowAnchor: "none" } }));
|
|
638
639
|
})));
|
|
639
640
|
}
|
|
640
641
|
let se = Se(null);
|
|
@@ -650,10 +651,10 @@ function ne(e) {
|
|
|
650
651
|
function Yt(e, s) {
|
|
651
652
|
return te(s.type, Gt, e, s);
|
|
652
653
|
}
|
|
653
|
-
let Qt =
|
|
654
|
-
function
|
|
654
|
+
let Qt = ke;
|
|
655
|
+
function Xt(e, s) {
|
|
655
656
|
var t, n;
|
|
656
|
-
let o = Ge(), { value: l, defaultValue: r, onChange: i, form: a, name: p, by: d, disabled: c = o || !1, onClose: I, __demoMode: u = !1, multiple: S = !1, immediate: x = !1, virtual: h = null, nullable: R, ...D } = e, M = Je(r), [E = S ? [] : void 0, y] = Ye(l, i, M), [O, b] =
|
|
657
|
+
let o = Ge(), { value: l, defaultValue: r, onChange: i, form: a, name: p, by: d, disabled: c = o || !1, onClose: I, __demoMode: u = !1, multiple: S = !1, immediate: x = !1, virtual: h = null, nullable: R, ...D } = e, M = Je(r), [E = S ? [] : void 0, y] = Ye(l, i, M), [O, b] = st(Yt, { dataRef: rt(), comboboxState: u ? 0 : 1, isTyping: !1, options: [], virtual: h ? { options: h.options, disabled: (t = h.disabled) != null ? t : () => !1 } : null, activeOptionIndex: null, activationTrigger: 2, __demoMode: u }), V = N(!1), U = N({ static: !1, hold: !1 }), J = N(null), j = N(null), Y = N(null), k = Qe(d), C = g((v) => h ? d === null ? h.options.indexOf(v) : h.options.findIndex((T) => k(T, v)) : O.options.findIndex((T) => k(T.dataRef.current.value, v))), A = Ce((v) => te(m.mode, { 1: () => E.some((T) => k(T, v)), 0: () => k(E, v) }), [E]), Q = g((v) => O.activeOptionIndex === C(v)), m = G(() => ({ ...O, immediate: x, optionsPropsRef: U, inputRef: J, buttonRef: j, optionsRef: Y, value: E, defaultValue: M, disabled: c, mode: S ? 1 : 0, virtual: h ? O.virtual : null, get activeOptionIndex() {
|
|
657
658
|
if (V.current && O.activeOptionIndex === null && (h ? h.options.length > 0 : O.options.length > 0)) {
|
|
658
659
|
if (h) {
|
|
659
660
|
let T = h.options.findIndex((K) => {
|
|
@@ -674,8 +675,8 @@ function Zt(e, s) {
|
|
|
674
675
|
O.dataRef.current = m;
|
|
675
676
|
}, [m]);
|
|
676
677
|
let ee = m.comboboxState === 0;
|
|
677
|
-
|
|
678
|
-
let
|
|
678
|
+
at(ee, [m.buttonRef, m.inputRef, m.optionsRef], () => H.closeCombobox());
|
|
679
|
+
let P = G(() => {
|
|
679
680
|
var v, T, K;
|
|
680
681
|
return { open: m.comboboxState === 0, disabled: c, activeIndex: m.activeOptionIndex, activeOption: m.activeOptionIndex === null ? null : m.virtual ? m.virtual.options[(v = m.activeOptionIndex) != null ? v : 0] : (K = (T = m.options[m.activeOptionIndex]) == null ? void 0 : T.dataRef.current.value) != null ? K : null, value: E };
|
|
681
682
|
}, [m, c, E]), fe = g(() => {
|
|
@@ -693,7 +694,7 @@ function Zt(e, s) {
|
|
|
693
694
|
b({ type: 1 }), V.current = !1, I == null || I();
|
|
694
695
|
}), B = g((v) => {
|
|
695
696
|
b({ type: 3, isTyping: v });
|
|
696
|
-
}),
|
|
697
|
+
}), z = g((v, T, K) => (V.current = !1, v === _.Specific ? b({ type: 2, focus: _.Specific, idx: T, trigger: K }) : b({ type: 2, focus: v, trigger: K }))), W = g((v, T) => (b({ type: 4, payload: { id: v, dataRef: T } }), () => {
|
|
697
698
|
m.isActive(T.current.value) && (V.current = !0), b({ type: 5, id: v });
|
|
698
699
|
})), w = g((v) => te(m.mode, { 0() {
|
|
699
700
|
return y == null ? void 0 : y(v);
|
|
@@ -702,35 +703,35 @@ function Zt(e, s) {
|
|
|
702
703
|
return K === -1 ? T.push(v) : T.splice(K, 1), y == null ? void 0 : y(T);
|
|
703
704
|
} })), L = g((v) => {
|
|
704
705
|
b({ type: 6, trigger: v });
|
|
705
|
-
}), H = G(() => ({ onChange: w, registerOption: W, goToOption:
|
|
706
|
+
}), H = G(() => ({ onChange: w, registerOption: W, goToOption: z, setIsTyping: B, closeCombobox: f, openCombobox: he, setActivationTrigger: L, selectActiveOption: fe }), []), [Be, We] = Xe(), je = s === null ? {} : { ref: s }, He = Ce(() => {
|
|
706
707
|
if (M !== void 0) return y == null ? void 0 : y(M);
|
|
707
708
|
}, [y, M]);
|
|
708
|
-
return $.createElement(We, { value: Be, props: { htmlFor: (n = m.inputRef.current) == null ? void 0 : n.id }, slot: { open: m.comboboxState === 0, disabled: c } }, $.createElement(
|
|
709
|
+
return $.createElement(We, { value: Be, props: { htmlFor: (n = m.inputRef.current) == null ? void 0 : n.id }, slot: { open: m.comboboxState === 0, disabled: c } }, $.createElement(ut, null, $.createElement(Ee.Provider, { value: H }, $.createElement(se.Provider, { value: m }, $.createElement(ct, { value: te(m.comboboxState, { 0: ce.Open, 1: ce.Closed }) }, p != null && $.createElement(Ze, { disabled: c, data: E != null ? { [p]: E } : {}, form: a, onReset: He }), le({ ourProps: je, theirProps: D, slot: P, defaultTag: Qt, name: "Combobox" }))))));
|
|
709
710
|
}
|
|
710
|
-
let
|
|
711
|
+
let Zt = "input";
|
|
711
712
|
function en(e, s) {
|
|
712
713
|
var t, n, o, l, r;
|
|
713
|
-
let i = ne("Combobox.Input"), a = ae("Combobox.Input"), p = pe(), d =
|
|
714
|
+
let i = ne("Combobox.Input"), a = ae("Combobox.Input"), p = pe(), d = et(), { id: c = d || `headlessui-combobox-input-${p}`, onChange: I, displayValue: u, disabled: S = i.disabled || !1, autoFocus: x = !1, type: h = "text", ...R } = e, D = de(i.inputRef, s, dt()), M = Ae(i.inputRef), E = tt(), y = g(() => {
|
|
714
715
|
a.onChange(null), i.optionsRef.current && (i.optionsRef.current.scrollTop = 0), a.goToOption(_.Nothing);
|
|
715
716
|
}), O = G(() => {
|
|
716
717
|
var f;
|
|
717
718
|
return typeof u == "function" && i.value !== void 0 ? (f = u(i.value)) != null ? f : "" : typeof i.value == "string" ? i.value : "";
|
|
718
719
|
}, [i.value, u]);
|
|
719
|
-
|
|
720
|
+
Pe(([f, B], [z, W]) => {
|
|
720
721
|
if (i.isTyping) return;
|
|
721
722
|
let w = i.inputRef.current;
|
|
722
|
-
w && ((W === 0 && B === 1 || f !==
|
|
723
|
+
w && ((W === 0 && B === 1 || f !== z) && (w.value = f), requestAnimationFrame(() => {
|
|
723
724
|
if (i.isTyping || !w || (M == null ? void 0 : M.activeElement) !== w) return;
|
|
724
725
|
let { selectionStart: L, selectionEnd: H } = w;
|
|
725
726
|
Math.abs((H ?? 0) - (L ?? 0)) === 0 && L === 0 && w.setSelectionRange(w.value.length, w.value.length);
|
|
726
727
|
}));
|
|
727
|
-
}, [O, i.comboboxState, M, i.isTyping]),
|
|
728
|
+
}, [O, i.comboboxState, M, i.isTyping]), Pe(([f], [B]) => {
|
|
728
729
|
if (f === 0 && B === 1) {
|
|
729
730
|
if (i.isTyping) return;
|
|
730
|
-
let
|
|
731
|
-
if (!
|
|
732
|
-
let W =
|
|
733
|
-
|
|
731
|
+
let z = i.inputRef.current;
|
|
732
|
+
if (!z) return;
|
|
733
|
+
let W = z.value, { selectionStart: w, selectionEnd: L, selectionDirection: H } = z;
|
|
734
|
+
z.value = "", z.value = W, H !== null ? z.setSelectionRange(w, L, H) : z.setSelectionRange(w, L);
|
|
734
735
|
}
|
|
735
736
|
}, [i.comboboxState]);
|
|
736
737
|
let b = N(!1), V = g(() => {
|
|
@@ -753,7 +754,7 @@ function en(e, s) {
|
|
|
753
754
|
return f.preventDefault(), f.stopPropagation(), te(i.comboboxState, { 0: () => a.goToOption(_.Next), 1: () => a.openCombobox() });
|
|
754
755
|
case F.ArrowUp:
|
|
755
756
|
return f.preventDefault(), f.stopPropagation(), te(i.comboboxState, { 0: () => a.goToOption(_.Previous), 1: () => {
|
|
756
|
-
|
|
757
|
+
Z.flushSync(() => a.openCombobox()), i.value || a.goToOption(_.Last);
|
|
757
758
|
} });
|
|
758
759
|
case F.Home:
|
|
759
760
|
if (f.shiftKey) break;
|
|
@@ -775,17 +776,17 @@ function en(e, s) {
|
|
|
775
776
|
}), j = g((f) => {
|
|
776
777
|
I == null || I(f), i.mode === 0 && f.target.value === "" && y(), a.openCombobox();
|
|
777
778
|
}), Y = g((f) => {
|
|
778
|
-
var B,
|
|
779
|
-
let w = (B = f.relatedTarget) != null ? B :
|
|
780
|
-
if (!((
|
|
779
|
+
var B, z, W;
|
|
780
|
+
let w = (B = f.relatedTarget) != null ? B : X.find((L) => L !== f.currentTarget);
|
|
781
|
+
if (!((z = i.optionsRef.current) != null && z.contains(w)) && !((W = i.buttonRef.current) != null && W.contains(w)) && i.comboboxState === 0) return f.preventDefault(), i.mode === 0 && i.value === null && y(), a.closeCombobox();
|
|
781
782
|
}), k = g((f) => {
|
|
782
|
-
var B,
|
|
783
|
-
let w = (B = f.relatedTarget) != null ? B :
|
|
784
|
-
(
|
|
785
|
-
|
|
783
|
+
var B, z, W;
|
|
784
|
+
let w = (B = f.relatedTarget) != null ? B : X.find((L) => L !== f.currentTarget);
|
|
785
|
+
(z = i.buttonRef.current) != null && z.contains(w) || (W = i.optionsRef.current) != null && W.contains(w) || i.disabled || i.immediate && i.comboboxState !== 0 && E.microTask(() => {
|
|
786
|
+
Z.flushSync(() => a.openCombobox()), a.setActivationTrigger(1);
|
|
786
787
|
});
|
|
787
|
-
}), C = be(), A =
|
|
788
|
-
return le({ ourProps: he, theirProps: R, slot: fe, defaultTag:
|
|
788
|
+
}), C = be(), A = nt(), { isFocused: Q, focusProps: m } = De({ autoFocus: x }), { isHovered: ee, hoverProps: P } = Fe({ isDisabled: S }), fe = G(() => ({ open: i.comboboxState === 0, disabled: S, hover: ee, focus: Q, autofocus: x }), [i, ee, Q, x, S]), he = ge({ ref: D, id: c, role: "combobox", type: h, "aria-controls": (t = i.optionsRef.current) == null ? void 0 : t.id, "aria-expanded": i.comboboxState === 0, "aria-activedescendant": i.activeOptionIndex === null ? void 0 : i.virtual ? (n = i.options.find((f) => !f.dataRef.current.disabled && i.compare(f.dataRef.current.value, i.virtual.options[i.activeOptionIndex]))) == null ? void 0 : n.id : (o = i.options[i.activeOptionIndex]) == null ? void 0 : o.id, "aria-labelledby": C, "aria-describedby": A, "aria-autocomplete": "list", defaultValue: (r = (l = e.defaultValue) != null ? l : i.defaultValue !== void 0 ? u == null ? void 0 : u(i.defaultValue) : null) != null ? r : i.defaultValue, disabled: S || void 0, autoFocus: x, onCompositionStart: V, onCompositionEnd: U, onKeyDown: J, onChange: j, onFocus: k, onBlur: Y }, m, P);
|
|
789
|
+
return le({ ourProps: he, theirProps: R, slot: fe, defaultTag: Zt, name: "Combobox.Input" });
|
|
789
790
|
}
|
|
790
791
|
let tn = "button";
|
|
791
792
|
function nn(e, s) {
|
|
@@ -794,56 +795,56 @@ function nn(e, s) {
|
|
|
794
795
|
switch (b.key) {
|
|
795
796
|
case F.Space:
|
|
796
797
|
case F.Enter:
|
|
797
|
-
b.preventDefault(), b.stopPropagation(), n.comboboxState === 1 &&
|
|
798
|
+
b.preventDefault(), b.stopPropagation(), n.comboboxState === 1 && Z.flushSync(() => o.openCombobox()), c();
|
|
798
799
|
return;
|
|
799
800
|
case F.ArrowDown:
|
|
800
|
-
b.preventDefault(), b.stopPropagation(), n.comboboxState === 1 && (
|
|
801
|
+
b.preventDefault(), b.stopPropagation(), n.comboboxState === 1 && (Z.flushSync(() => o.openCombobox()), n.value || o.goToOption(_.First)), c();
|
|
801
802
|
return;
|
|
802
803
|
case F.ArrowUp:
|
|
803
|
-
b.preventDefault(), b.stopPropagation(), n.comboboxState === 1 && (
|
|
804
|
+
b.preventDefault(), b.stopPropagation(), n.comboboxState === 1 && (Z.flushSync(() => o.openCombobox()), n.value || o.goToOption(_.Last)), c();
|
|
804
805
|
return;
|
|
805
806
|
case F.Escape:
|
|
806
807
|
if (n.comboboxState !== 0) return;
|
|
807
|
-
b.preventDefault(), n.optionsRef.current && !n.optionsPropsRef.current.static && b.stopPropagation(),
|
|
808
|
+
b.preventDefault(), n.optionsRef.current && !n.optionsPropsRef.current.static && b.stopPropagation(), Z.flushSync(() => o.closeCombobox()), c();
|
|
808
809
|
return;
|
|
809
810
|
default:
|
|
810
811
|
return;
|
|
811
812
|
}
|
|
812
813
|
}), u = g((b) => {
|
|
813
|
-
b.preventDefault(), !
|
|
814
|
-
}), S = be([i]), { isFocusVisible: x, focusProps: h } =
|
|
814
|
+
b.preventDefault(), !ot(b.currentTarget) && (b.button === Oe.Left && (n.comboboxState === 0 ? o.closeCombobox() : o.openCombobox()), c());
|
|
815
|
+
}), S = be([i]), { isFocusVisible: x, focusProps: h } = De({ autoFocus: p }), { isHovered: R, hoverProps: D } = Fe({ isDisabled: a }), { pressed: M, pressProps: E } = pt({ disabled: a }), y = G(() => ({ open: n.comboboxState === 0, active: M || n.comboboxState === 0, disabled: a, value: n.value, hover: R, focus: x }), [n, R, x, M, a]), O = ge({ ref: l, id: i, type: ft(e, n.buttonRef), tabIndex: -1, "aria-haspopup": "listbox", "aria-controls": (t = n.optionsRef.current) == null ? void 0 : t.id, "aria-expanded": n.comboboxState === 0, "aria-labelledby": S, disabled: a || void 0, autoFocus: p, onMouseDown: u, onKeyDown: I }, h, D, E);
|
|
815
816
|
return le({ ourProps: O, theirProps: d, slot: y, defaultTag: tn, name: "Combobox.Button" });
|
|
816
817
|
}
|
|
817
818
|
let on = "div", sn = Re.RenderStrategy | Re.Static;
|
|
818
819
|
function rn(e, s) {
|
|
819
820
|
var t, n, o;
|
|
820
|
-
let l = pe(), { id: r = `headlessui-combobox-options-${l}`, hold: i = !1, anchor: a, portal: p = !1, modal: d = !0, transition: c = !1, ...I } = e, u = ne("Combobox.Options"), S = ae("Combobox.Options"), x =
|
|
821
|
+
let l = pe(), { id: r = `headlessui-combobox-options-${l}`, hold: i = !1, anchor: a, portal: p = !1, modal: d = !0, transition: c = !1, ...I } = e, u = ne("Combobox.Options"), S = ae("Combobox.Options"), x = ht(a);
|
|
821
822
|
x && (p = !0);
|
|
822
|
-
let [h, R] =
|
|
823
|
-
|
|
823
|
+
let [h, R] = mt(x), D = vt(), M = de(u.optionsRef, s, x ? h : null), E = Ae(u.optionsRef), y = bt(), [O, b] = gt(c, u.optionsRef, y !== null ? (y & ce.Open) === ce.Open : u.comboboxState === 0);
|
|
824
|
+
xt(O, u.inputRef, S.closeCombobox);
|
|
824
825
|
let V = u.__demoMode ? !1 : d && u.comboboxState === 0;
|
|
825
|
-
|
|
826
|
+
St(V, E);
|
|
826
827
|
let U = u.__demoMode ? !1 : d && u.comboboxState === 0;
|
|
827
|
-
|
|
828
|
-
var
|
|
829
|
-
u.optionsPropsRef.current.static = (
|
|
828
|
+
It(U, { allowed: g(() => [u.inputRef.current, u.buttonRef.current, u.optionsRef.current]) }), q(() => {
|
|
829
|
+
var P;
|
|
830
|
+
u.optionsPropsRef.current.static = (P = e.static) != null ? P : !1;
|
|
830
831
|
}, [u.optionsPropsRef, e.static]), q(() => {
|
|
831
832
|
u.optionsPropsRef.current.hold = i;
|
|
832
|
-
}, [u.optionsPropsRef, i]), Wt(u.comboboxState === 0, { container: u.optionsRef.current, accept(
|
|
833
|
-
return
|
|
834
|
-
}, walk(
|
|
835
|
-
|
|
833
|
+
}, [u.optionsPropsRef, i]), Wt(u.comboboxState === 0, { container: u.optionsRef.current, accept(P) {
|
|
834
|
+
return P.getAttribute("role") === "option" ? NodeFilter.FILTER_REJECT : P.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
835
|
+
}, walk(P) {
|
|
836
|
+
P.setAttribute("role", "none");
|
|
836
837
|
} });
|
|
837
838
|
let J = be([(t = u.buttonRef.current) == null ? void 0 : t.id]), j = G(() => ({ open: u.comboboxState === 0, option: void 0 }), [u.comboboxState]), Y = g(() => {
|
|
838
839
|
S.setActivationTrigger(0);
|
|
839
|
-
}), k = g((
|
|
840
|
-
|
|
841
|
-
}), C = ge(x ? D() : {}, { "aria-labelledby": J, role: "listbox", "aria-multiselectable": u.mode === 1 ? !0 : void 0, id: r, ref: M, style: { ...I.style, ...R, "--input-width":
|
|
840
|
+
}), k = g((P) => {
|
|
841
|
+
P.preventDefault(), S.setActivationTrigger(0);
|
|
842
|
+
}), C = ge(x ? D() : {}, { "aria-labelledby": J, role: "listbox", "aria-multiselectable": u.mode === 1 ? !0 : void 0, id: r, ref: M, style: { ...I.style, ...R, "--input-width": we(u.inputRef, !0).width, "--button-width": we(u.buttonRef, !0).width }, onWheel: u.activationTrigger === 0 ? void 0 : Y, onMouseDown: k, ...Ot(b) }), A = O && u.comboboxState === 1, Q = Me(A, (n = u.virtual) == null ? void 0 : n.options), m = Me(A, u.value), ee = g((P) => u.compare(m, P));
|
|
842
843
|
if (u.virtual) {
|
|
843
844
|
if (Q === void 0) throw new Error("Missing `options` in virtual mode");
|
|
844
845
|
Object.assign(I, { children: $.createElement(se.Provider, { value: Q !== u.virtual.options ? { ...u, virtual: { ...u.virtual, options: Q } } : u }, $.createElement(Jt, { slot: j }, I.children)) });
|
|
845
846
|
}
|
|
846
|
-
return $.createElement(
|
|
847
|
+
return $.createElement(Et, { enabled: p ? e.static || O : !1 }, $.createElement(se.Provider, { value: u.mode === 1 ? u : { ...u, isSelected: ee } }, le({ ourProps: C, theirProps: { ...I, children: $.createElement(Tt, { freeze: A }, typeof I.children == "function" ? (o = I.children) == null ? void 0 : o.call(I, j) : I.children) }, slot: j, defaultTag: on, features: sn, visible: O, name: "Combobox.Options" })));
|
|
847
848
|
}
|
|
848
849
|
let ln = "div";
|
|
849
850
|
function an(e, s) {
|
|
@@ -854,22 +855,22 @@ function an(e, s) {
|
|
|
854
855
|
q(() => i.registerOption(p, D), [D, p]);
|
|
855
856
|
let O = N(!(r.virtual || r.__demoMode));
|
|
856
857
|
q(() => {
|
|
857
|
-
if (!r.virtual && !r.__demoMode) return
|
|
858
|
+
if (!r.virtual && !r.__demoMode) return ye().requestAnimationFrame(() => {
|
|
858
859
|
O.current = !0;
|
|
859
860
|
});
|
|
860
861
|
}, [r.virtual, r.__demoMode]), q(() => {
|
|
861
|
-
if (O.current && r.comboboxState === 0 && x && r.activationTrigger !== 0) return
|
|
862
|
+
if (O.current && r.comboboxState === 0 && x && r.activationTrigger !== 0) return ye().requestAnimationFrame(() => {
|
|
862
863
|
var C, A;
|
|
863
864
|
(A = (C = R.current) == null ? void 0 : C.scrollIntoView) == null || A.call(C, { block: "nearest" });
|
|
864
865
|
});
|
|
865
866
|
}, [R, x, r.comboboxState, r.activationTrigger, r.activeOptionIndex]);
|
|
866
867
|
let b = g((C) => {
|
|
867
|
-
C.preventDefault(), C.button === Oe.Left && (c || (y(),
|
|
868
|
+
C.preventDefault(), C.button === Oe.Left && (c || (y(), yt() || requestAnimationFrame(() => S()), r.mode === 0 && i.closeCombobox()));
|
|
868
869
|
}), V = g(() => {
|
|
869
870
|
if (c) return i.goToOption(_.Nothing);
|
|
870
871
|
let C = r.calculateIndex(d);
|
|
871
872
|
i.goToOption(_.Specific, C);
|
|
872
|
-
}), U =
|
|
873
|
+
}), U = Rt(), J = g((C) => U.update(C)), j = g((C) => {
|
|
873
874
|
if (!U.wasMoved(C) || c || x) return;
|
|
874
875
|
let A = r.calculateIndex(d);
|
|
875
876
|
i.goToOption(_.Specific, A, 0);
|
|
@@ -878,11 +879,11 @@ function an(e, s) {
|
|
|
878
879
|
}), k = G(() => ({ active: x, focus: x, selected: h, disabled: c }), [x, h, c]);
|
|
879
880
|
return le({ ourProps: { id: p, ref: E, role: "option", tabIndex: c === !0 ? void 0 : -1, "aria-disabled": c === !0 ? !0 : void 0, "aria-selected": h, disabled: void 0, onMouseDown: b, onFocus: V, onPointerEnter: J, onMouseEnter: J, onPointerMove: j, onMouseMove: j, onPointerLeave: Y, onMouseLeave: Y }, theirProps: u, slot: k, defaultTag: ln, name: "Combobox.Option" });
|
|
880
881
|
}
|
|
881
|
-
let un = re(
|
|
882
|
+
let un = re(Xt), cn = re(nn), dn = re(en), pn = qe, fn = re(rn), hn = re(an), xn = Object.assign(un, { Input: dn, Button: cn, Label: pn, Options: fn, Option: hn });
|
|
882
883
|
export {
|
|
883
884
|
dn as G,
|
|
884
885
|
cn as H,
|
|
885
886
|
hn as K,
|
|
886
|
-
|
|
887
|
+
xn as N,
|
|
887
888
|
fn as z
|
|
888
889
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as a, jsxs as f } from "react/jsx-runtime";
|
|
2
2
|
import d, { Fragment as p } from "react";
|
|
3
3
|
import { t as y } from "../../bundle-mjs-SHnj3fHy.js";
|
|
4
|
-
import { H as g
|
|
5
|
-
import { b
|
|
6
|
-
import { getValue as
|
|
7
|
-
import { N as
|
|
4
|
+
import { H as g } from "../../index-DsW4uhBe.js";
|
|
5
|
+
import { b } from "../../index-wvw0O1v3.js";
|
|
6
|
+
import { getValue as o } from "../Selectbox/helper.js";
|
|
7
|
+
import { N as x, G as C, H as E, z as w, K as N } from "../../combobox-CRHFa4aF.js";
|
|
8
|
+
import { X as L } from "../../transition-B0bHCOYe.js";
|
|
8
9
|
const S = (l, r) => r.type === "SEARCH" ? {
|
|
9
10
|
...l,
|
|
10
11
|
query: r.query,
|
|
@@ -12,17 +13,17 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
12
13
|
} : r.type === "SETVALUE" ? {
|
|
13
14
|
...l,
|
|
14
15
|
value: r.value,
|
|
15
|
-
selected: l.list.find((t) =>
|
|
16
|
+
selected: l.list.find((t) => o(t, l.valueField) === r.value) || null
|
|
16
17
|
} : r.type === "SETSELECT" ? {
|
|
17
18
|
...l,
|
|
18
19
|
selected: r.selected,
|
|
19
|
-
value:
|
|
20
|
+
value: o(r.selected, l.valueField) + ""
|
|
20
21
|
} : l, H = ({
|
|
21
22
|
id: l,
|
|
22
23
|
name: r,
|
|
23
24
|
options: t,
|
|
24
25
|
value: i = "",
|
|
25
|
-
valueField:
|
|
26
|
+
valueField: u = "value",
|
|
26
27
|
onChange: m,
|
|
27
28
|
placeholder: h
|
|
28
29
|
}, v) => {
|
|
@@ -31,9 +32,9 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
31
32
|
query: "",
|
|
32
33
|
filterList: t,
|
|
33
34
|
value: i,
|
|
34
|
-
valueField:
|
|
35
|
+
valueField: u,
|
|
35
36
|
selected: t.find((e) => {
|
|
36
|
-
const n =
|
|
37
|
+
const n = o(e, u);
|
|
37
38
|
return i ? n === i : !1;
|
|
38
39
|
}) || null
|
|
39
40
|
});
|
|
@@ -41,18 +42,18 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
41
42
|
search: (e) => s({ type: "SEARCH", query: e }),
|
|
42
43
|
setValue: (e) => s({ type: "SETVALUE", value: e })
|
|
43
44
|
})), /* @__PURE__ */ a(
|
|
44
|
-
|
|
45
|
+
x,
|
|
45
46
|
{
|
|
46
47
|
value: c.selected,
|
|
47
48
|
onChange: (e) => {
|
|
48
49
|
s({
|
|
49
50
|
type: "SETSELECT",
|
|
50
51
|
selected: e
|
|
51
|
-
}), m && m(e ?
|
|
52
|
+
}), m && m(e ? o(e, u) : "");
|
|
52
53
|
},
|
|
53
54
|
children: /* @__PURE__ */ f("div", { className: "relative", children: [
|
|
54
55
|
/* @__PURE__ */ a(
|
|
55
|
-
|
|
56
|
+
C,
|
|
56
57
|
{
|
|
57
58
|
placeholder: h,
|
|
58
59
|
onChange: (e) => s({ type: "SEARCH", query: e.target.value }),
|
|
@@ -60,7 +61,7 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
60
61
|
displayValue: (e) => (e == null ? void 0 : e.label) || ""
|
|
61
62
|
}
|
|
62
63
|
),
|
|
63
|
-
/* @__PURE__ */ a(
|
|
64
|
+
/* @__PURE__ */ a(E, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ a(
|
|
64
65
|
g,
|
|
65
66
|
{
|
|
66
67
|
className: "h-5 w-5 text-gray-400",
|
|
@@ -79,7 +80,7 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
79
80
|
}
|
|
80
81
|
),
|
|
81
82
|
/* @__PURE__ */ a(
|
|
82
|
-
|
|
83
|
+
L,
|
|
83
84
|
{
|
|
84
85
|
as: p,
|
|
85
86
|
enter: "transition duration-100 ease-out",
|
|
@@ -89,7 +90,7 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
89
90
|
leaveFrom: "scale-100 transform opacity-100",
|
|
90
91
|
leaveTo: "scale-95 transform opacity-0",
|
|
91
92
|
afterLeave: () => s({ type: "SEARCH", query: "" }),
|
|
92
|
-
children: /* @__PURE__ */ a(
|
|
93
|
+
children: /* @__PURE__ */ a(w, { className: "absolute z-50 mt-5 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm", children: c.filterList.map((e) => /* @__PURE__ */ a(N, { as: p, value: e, children: ({ selected: n }) => /* @__PURE__ */ f(
|
|
93
94
|
"li",
|
|
94
95
|
{
|
|
95
96
|
className: y(
|
|
@@ -105,7 +106,7 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
105
106
|
className: y(
|
|
106
107
|
"absolute inset-y-0 left-0 flex items-center pl-3 text-indigo-600"
|
|
107
108
|
),
|
|
108
|
-
children: /* @__PURE__ */ a(
|
|
109
|
+
children: /* @__PURE__ */ a(b, { className: "h-5 w-5", "aria-hidden": "true" })
|
|
109
110
|
}
|
|
110
111
|
) : null
|
|
111
112
|
]
|
|
@@ -116,7 +117,7 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
116
117
|
] })
|
|
117
118
|
}
|
|
118
119
|
);
|
|
119
|
-
},
|
|
120
|
+
}, z = d.forwardRef(H);
|
|
120
121
|
export {
|
|
121
|
-
|
|
122
|
+
z as default
|
|
122
123
|
};
|