anysystem-design 0.0.14 → 0.0.16
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-CbwTCd-z.js → combobox-GYodOLPS.js} +59 -55
- package/dist/components/AutoComplete/AutoCompleteBase.js +31 -31
- package/dist/components/AutoComplete/AutoCompleteMultiple.js +59 -59
- package/dist/components/Button/Button.js +10 -10
- package/dist/components/Checkbox/Checkbox.js +16 -16
- package/dist/components/Checkbox/CheckboxBase.js +12 -12
- package/dist/components/DatePicker/DatePicker.js +7 -7
- package/dist/components/Label/Label.js +3 -3
- package/dist/components/NavList/NavList.d.ts +14 -0
- package/dist/components/NavList/NavList.js +178 -0
- package/dist/components/NavList/index.d.ts +2 -0
- package/dist/components/NavList/index.js +4 -0
- package/dist/components/Navbar/Navbar.d.ts +10 -0
- package/dist/components/Navbar/Navbar.js +36 -0
- package/dist/components/Navbar/index.d.ts +2 -0
- package/dist/components/Navbar/index.js +4 -0
- package/dist/components/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +54 -52
- package/dist/components/Selectbox/SelectboxBase.js +30 -29
- package/dist/components/Selectbox/SelectboxMultiple.js +34 -33
- package/dist/components/Switch/Switch.js +21 -19
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +30 -26
- package/dist/contexts/AppContext.d.ts +5 -0
- package/dist/contexts/AppContext.js +287 -784
- package/dist/hooks/useLocalStorage.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +31 -0
- package/dist/{index-wvw0O1v3.js → index-Bv0kHmgl.js} +2 -2
- package/dist/{index-CsJbhhQY.js → index-CGOwpnLF.js} +15 -14
- package/dist/index-qfA2zEnA.js +524 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +49 -40
- package/dist/keyboard-WLAoTvIF.js +361 -0
- package/dist/label-C-udG76R.js +164 -0
- package/dist/layouts/Empty/Empty.d.ts +7 -0
- package/dist/layouts/Empty/Empty.js +6 -0
- package/dist/layouts/Empty/index.d.ts +2 -0
- package/dist/layouts/Empty/index.js +4 -0
- package/dist/layouts/SideMenu/SideMenu.d.ts +13 -0
- package/dist/layouts/SideMenu/SideMenu.js +60 -0
- package/dist/layouts/SideMenu/index.d.ts +2 -0
- package/dist/layouts/SideMenu/index.js +4 -0
- package/dist/layouts/index.d.ts +4 -0
- package/dist/layouts/index.js +6 -0
- package/dist/{listbox-CJZgAdIt.js → listbox-BXC8z9Qj.js} +41 -37
- package/dist/open-closed-C-QjnEr7.js +93 -0
- package/dist/portal-Cczr4jWX.js +1443 -0
- package/dist/transition-B_YPzh_T.js +163 -0
- package/dist/{use-resolve-button-type-WMDXx_9F.js → use-resolve-button-type-BXUD2Zvz.js} +11 -10
- package/dist/use-sync-refs-DhGTVDyx.js +234 -0
- package/package.json +3 -2
- package/dist/label-M2WV1DNi.js +0 -742
- package/dist/transition-DgjncSwT.js +0 -1682
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { u as Ke, $ as $e, a as De, o as F, r as Ue } from "./keyboard-WLAoTvIF.js";
|
|
2
2
|
import * as ie from "react";
|
|
3
|
-
import $, { useEffect as
|
|
3
|
+
import $, { useEffect as be, useRef as N, createContext as ge, useReducer as qe, createRef as Ge, useCallback as Re, useMemo as q, useId as de, useContext as xe, useState as Je, Fragment as Fe } from "react";
|
|
4
4
|
import { r as Z } from "./index-DsprzSCj.js";
|
|
5
|
-
import { w as
|
|
6
|
-
import { f as
|
|
7
|
-
import {
|
|
5
|
+
import { w as Ye, T as Qe } from "./use-resolve-button-type-BXUD2Zvz.js";
|
|
6
|
+
import { f as Xe, u as Ze, _ as et } from "./index-CGOwpnLF.js";
|
|
7
|
+
import { K as tt, a as nt, l as ot, T as it, z as st, j as rt, u as lt, I as Se, G as at } from "./label-C-udG76R.js";
|
|
8
|
+
import { s as ke, o as g, n as G, M as ye, W as re, u as te, H as le, y as pe, p as ut, D as Ie, a as Ce } from "./use-sync-refs-DhGTVDyx.js";
|
|
9
|
+
import { F as ct, v as dt, y as pt, n as Ae, x as ft, R as ht, i as mt, g as vt, h as bt, j as we, l as Me, t as gt, p as xt, k as St, m as _, q as It, o as _e } from "./portal-Cczr4jWX.js";
|
|
10
|
+
import { m as Ot } from "./transition-B_YPzh_T.js";
|
|
11
|
+
import { c as Et, i as ce, u as Tt, V as Rt, A as yt } from "./open-closed-C-QjnEr7.js";
|
|
8
12
|
function oe(e, s, t) {
|
|
9
13
|
let n = t.initialDeps ?? [], o;
|
|
10
14
|
return () => {
|
|
@@ -478,8 +482,8 @@ function Vt(e) {
|
|
|
478
482
|
});
|
|
479
483
|
}
|
|
480
484
|
function Bt(e, s, t, n) {
|
|
481
|
-
let o =
|
|
482
|
-
|
|
485
|
+
let o = ke(t);
|
|
486
|
+
be(() => {
|
|
483
487
|
e = e ?? window;
|
|
484
488
|
function l(r) {
|
|
485
489
|
o.current(r);
|
|
@@ -506,9 +510,9 @@ function Ne(e) {
|
|
|
506
510
|
}
|
|
507
511
|
function Wt(e, { container: s, accept: t, walk: n }) {
|
|
508
512
|
let o = N(t), l = N(n);
|
|
509
|
-
|
|
513
|
+
be(() => {
|
|
510
514
|
o.current = t, l.current = n;
|
|
511
|
-
}, [t, n]),
|
|
515
|
+
}, [t, n]), G(() => {
|
|
512
516
|
if (!s || !e) return;
|
|
513
517
|
let r = Ke(s);
|
|
514
518
|
if (!r) return;
|
|
@@ -518,7 +522,7 @@ function Wt(e, { container: s, accept: t, walk: n }) {
|
|
|
518
522
|
}
|
|
519
523
|
function Pe(e, s) {
|
|
520
524
|
let t = N([]), n = g(e);
|
|
521
|
-
|
|
525
|
+
be(() => {
|
|
522
526
|
let o = [...t.current];
|
|
523
527
|
for (let [l, r] of s.entries()) if (t.current[l] !== r) {
|
|
524
528
|
let i = n(s, o);
|
|
@@ -537,13 +541,13 @@ jt(() => {
|
|
|
537
541
|
function e(s) {
|
|
538
542
|
if (!(s.target instanceof HTMLElement) || s.target === document.body || X[0] === s.target) return;
|
|
539
543
|
let t = s.target;
|
|
540
|
-
t = t.closest(
|
|
544
|
+
t = t.closest(Xe), X.unshift(t ?? s.target), X = X.filter((n) => n != null && n.isConnected), X.splice(10);
|
|
541
545
|
}
|
|
542
546
|
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 });
|
|
543
547
|
});
|
|
544
548
|
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 || {});
|
|
545
549
|
function ve(e, s = (t) => t) {
|
|
546
|
-
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) :
|
|
550
|
+
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) : et(n, (r) => r.dataRef.current.domRef.current), l = t ? o.indexOf(t) : null;
|
|
547
551
|
return l === -1 && (l = null), { options: o, activeOptionIndex: l };
|
|
548
552
|
}
|
|
549
553
|
let Gt = { 1(e) {
|
|
@@ -603,19 +607,19 @@ let Gt = { 1(e) {
|
|
|
603
607
|
l !== -1 ? o = l : o = null;
|
|
604
608
|
}
|
|
605
609
|
return { ...e, activeOptionIndex: o, virtual: { options: s.options, disabled: (n = s.disabled) != null ? n : () => !1 } };
|
|
606
|
-
} }, Ee =
|
|
610
|
+
} }, Ee = ge(null);
|
|
607
611
|
Ee.displayName = "ComboboxActionsContext";
|
|
608
612
|
function ae(e) {
|
|
609
|
-
let s =
|
|
613
|
+
let s = xe(Ee);
|
|
610
614
|
if (s === null) {
|
|
611
615
|
let t = new Error(`<${e} /> is missing a parent <Combobox /> component.`);
|
|
612
616
|
throw Error.captureStackTrace && Error.captureStackTrace(t, ae), t;
|
|
613
617
|
}
|
|
614
618
|
return s;
|
|
615
619
|
}
|
|
616
|
-
let Ve =
|
|
620
|
+
let Ve = ge(null);
|
|
617
621
|
function Jt(e) {
|
|
618
|
-
let s = ne("VirtualProvider"), { options: t } = s.virtual, [n, o] =
|
|
622
|
+
let s = ne("VirtualProvider"), { options: t } = s.virtual, [n, o] = q(() => {
|
|
619
623
|
let p = s.optionsRef.current;
|
|
620
624
|
if (!p) return [0, 0];
|
|
621
625
|
let d = window.getComputedStyle(p);
|
|
@@ -625,8 +629,8 @@ function Jt(e) {
|
|
|
625
629
|
}, getScrollElement() {
|
|
626
630
|
var p;
|
|
627
631
|
return (p = s.optionsRef.current) != null ? p : null;
|
|
628
|
-
}, overscan: 12 }), [r, i] =
|
|
629
|
-
|
|
632
|
+
}, overscan: 12 }), [r, i] = Je(0);
|
|
633
|
+
G(() => {
|
|
630
634
|
i((p) => p + 1);
|
|
631
635
|
}, [t]);
|
|
632
636
|
let a = l.getVirtualItems();
|
|
@@ -637,13 +641,13 @@ function Jt(e) {
|
|
|
637
641
|
}
|
|
638
642
|
} }, a.map((p) => {
|
|
639
643
|
var d;
|
|
640
|
-
return $.createElement(
|
|
644
|
+
return $.createElement(Fe, { 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" } }));
|
|
641
645
|
})));
|
|
642
646
|
}
|
|
643
|
-
let se =
|
|
647
|
+
let se = ge(null);
|
|
644
648
|
se.displayName = "ComboboxDataContext";
|
|
645
649
|
function ne(e) {
|
|
646
|
-
let s =
|
|
650
|
+
let s = xe(se);
|
|
647
651
|
if (s === null) {
|
|
648
652
|
let t = new Error(`<${e} /> is missing a parent <Combobox /> component.`);
|
|
649
653
|
throw Error.captureStackTrace && Error.captureStackTrace(t, ne), t;
|
|
@@ -653,10 +657,10 @@ function ne(e) {
|
|
|
653
657
|
function Yt(e, s) {
|
|
654
658
|
return te(s.type, Gt, e, s);
|
|
655
659
|
}
|
|
656
|
-
let Qt =
|
|
660
|
+
let Qt = Fe;
|
|
657
661
|
function Xt(e, s) {
|
|
658
662
|
var t, n;
|
|
659
|
-
let o =
|
|
663
|
+
let o = nt(), { 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 = ot(r), [E = S ? [] : void 0, y] = it(l, i, M), [O, b] = qe(Yt, { dataRef: Ge(), 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 = Ze(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 = Re((v) => te(m.mode, { 1: () => E.some((T) => k(T, v)), 0: () => k(E, v) }), [E]), Q = g((v) => O.activeOptionIndex === C(v)), m = q(() => ({ ...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() {
|
|
660
664
|
if (V.current && O.activeOptionIndex === null && (h ? h.options.length > 0 : O.options.length > 0)) {
|
|
661
665
|
if (h) {
|
|
662
666
|
let T = h.options.findIndex((K) => {
|
|
@@ -670,15 +674,15 @@ function Xt(e, s) {
|
|
|
670
674
|
}
|
|
671
675
|
return O.activeOptionIndex;
|
|
672
676
|
}, calculateIndex: C, compare: k, isSelected: A, isActive: Q }), [E, M, c, S, u, O, h]);
|
|
673
|
-
|
|
677
|
+
G(() => {
|
|
674
678
|
var v;
|
|
675
679
|
h && b({ type: 7, options: h.options, disabled: (v = h.disabled) != null ? v : null });
|
|
676
|
-
}, [h, h == null ? void 0 : h.options, h == null ? void 0 : h.disabled]),
|
|
680
|
+
}, [h, h == null ? void 0 : h.options, h == null ? void 0 : h.disabled]), G(() => {
|
|
677
681
|
O.dataRef.current = m;
|
|
678
682
|
}, [m]);
|
|
679
683
|
let ee = m.comboboxState === 0;
|
|
680
684
|
ct(ee, [m.buttonRef, m.inputRef, m.optionsRef], () => H.closeCombobox());
|
|
681
|
-
let P =
|
|
685
|
+
let P = q(() => {
|
|
682
686
|
var v, T, K;
|
|
683
687
|
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 };
|
|
684
688
|
}, [m, c, E]), fe = g(() => {
|
|
@@ -705,17 +709,17 @@ function Xt(e, s) {
|
|
|
705
709
|
return K === -1 ? T.push(v) : T.splice(K, 1), y == null ? void 0 : y(T);
|
|
706
710
|
} })), L = g((v) => {
|
|
707
711
|
b({ type: 6, trigger: v });
|
|
708
|
-
}), H =
|
|
712
|
+
}), H = q(() => ({ onChange: w, registerOption: W, goToOption: z, setIsTyping: B, closeCombobox: f, openCombobox: he, setActivationTrigger: L, selectActiveOption: fe }), []), [Be, We] = st(), je = s === null ? {} : { ref: s }, He = Re(() => {
|
|
709
713
|
if (M !== void 0) return y == null ? void 0 : y(M);
|
|
710
714
|
}, [y, M]);
|
|
711
|
-
return $.createElement(We, { value: Be, props: { htmlFor: (n = m.inputRef.current) == null ? void 0 : n.id }, slot: { open: m.comboboxState === 0, disabled: c } }, $.createElement(dt, null, $.createElement(Ee.Provider, { value: H }, $.createElement(se.Provider, { value: m }, $.createElement(
|
|
715
|
+
return $.createElement(We, { value: Be, props: { htmlFor: (n = m.inputRef.current) == null ? void 0 : n.id }, slot: { open: m.comboboxState === 0, disabled: c } }, $.createElement(dt, null, $.createElement(Ee.Provider, { value: H }, $.createElement(se.Provider, { value: m }, $.createElement(Et, { value: te(m.comboboxState, { 0: ce.Open, 1: ce.Closed }) }, p != null && $.createElement(rt, { disabled: c, data: E != null ? { [p]: E } : {}, form: a, onReset: He }), le({ ourProps: je, theirProps: D, slot: P, defaultTag: Qt, name: "Combobox" }))))));
|
|
712
716
|
}
|
|
713
717
|
let Zt = "input";
|
|
714
718
|
function en(e, s) {
|
|
715
719
|
var t, n, o, l, r;
|
|
716
|
-
let i = ne("Combobox.Input"), a = ae("Combobox.Input"), p =
|
|
720
|
+
let i = ne("Combobox.Input"), a = ae("Combobox.Input"), p = de(), d = lt(), { 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 = pe(i.inputRef, s, pt()), M = Ae(i.inputRef), E = ut(), y = g(() => {
|
|
717
721
|
a.onChange(null), i.optionsRef.current && (i.optionsRef.current.scrollTop = 0), a.goToOption(_.Nothing);
|
|
718
|
-
}), O =
|
|
722
|
+
}), O = q(() => {
|
|
719
723
|
var f;
|
|
720
724
|
return typeof u == "function" && i.value !== void 0 ? (f = u(i.value)) != null ? f : "" : typeof i.value == "string" ? i.value : "";
|
|
721
725
|
}, [i.value, u]);
|
|
@@ -787,13 +791,13 @@ function en(e, s) {
|
|
|
787
791
|
(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(() => {
|
|
788
792
|
Z.flushSync(() => a.openCombobox()), a.setActivationTrigger(1);
|
|
789
793
|
});
|
|
790
|
-
}), C =
|
|
794
|
+
}), C = Se(), A = at(), { isFocused: Q, focusProps: m } = $e({ autoFocus: x }), { isHovered: ee, hoverProps: P } = De({ isDisabled: S }), fe = q(() => ({ open: i.comboboxState === 0, disabled: S, hover: ee, focus: Q, autofocus: x }), [i, ee, Q, x, S]), he = Ie({ 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);
|
|
791
795
|
return le({ ourProps: he, theirProps: R, slot: fe, defaultTag: Zt, name: "Combobox.Input" });
|
|
792
796
|
}
|
|
793
797
|
let tn = "button";
|
|
794
798
|
function nn(e, s) {
|
|
795
799
|
var t;
|
|
796
|
-
let n = ne("Combobox.Button"), o = ae("Combobox.Button"), l =
|
|
800
|
+
let n = ne("Combobox.Button"), o = ae("Combobox.Button"), l = pe(n.buttonRef, s), r = de(), { id: i = `headlessui-combobox-button-${r}`, disabled: a = n.disabled || !1, autoFocus: p = !1, ...d } = e, c = Ne(n.inputRef), I = g((b) => {
|
|
797
801
|
switch (b.key) {
|
|
798
802
|
case F.Space:
|
|
799
803
|
case F.Enter:
|
|
@@ -813,79 +817,79 @@ function nn(e, s) {
|
|
|
813
817
|
return;
|
|
814
818
|
}
|
|
815
819
|
}), u = g((b) => {
|
|
816
|
-
b.preventDefault(), !
|
|
817
|
-
}), S =
|
|
820
|
+
b.preventDefault(), !Ue(b.currentTarget) && (b.button === Oe.Left && (n.comboboxState === 0 ? o.closeCombobox() : o.openCombobox()), c());
|
|
821
|
+
}), S = Se([i]), { isFocusVisible: x, focusProps: h } = $e({ autoFocus: p }), { isHovered: R, hoverProps: D } = De({ isDisabled: a }), { pressed: M, pressProps: E } = Ye({ disabled: a }), y = q(() => ({ open: n.comboboxState === 0, active: M || n.comboboxState === 0, disabled: a, value: n.value, hover: R, focus: x }), [n, R, x, M, a]), O = Ie({ ref: l, id: i, type: Qe(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);
|
|
818
822
|
return le({ ourProps: O, theirProps: d, slot: y, defaultTag: tn, name: "Combobox.Button" });
|
|
819
823
|
}
|
|
820
|
-
let on = "div", sn =
|
|
824
|
+
let on = "div", sn = ye.RenderStrategy | ye.Static;
|
|
821
825
|
function rn(e, s) {
|
|
822
826
|
var t, n, o;
|
|
823
|
-
let l =
|
|
827
|
+
let l = de(), { 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 = ft(a);
|
|
824
828
|
x && (p = !0);
|
|
825
|
-
let [h, R] =
|
|
826
|
-
|
|
829
|
+
let [h, R] = ht(x), D = mt(), M = pe(u.optionsRef, s, x ? h : null), E = Ae(u.optionsRef), y = Tt(), [O, b] = Rt(c, u.optionsRef, y !== null ? (y & ce.Open) === ce.Open : u.comboboxState === 0);
|
|
830
|
+
Ot(O, u.inputRef, S.closeCombobox);
|
|
827
831
|
let V = u.__demoMode ? !1 : d && u.comboboxState === 0;
|
|
828
|
-
|
|
832
|
+
vt(V, E);
|
|
829
833
|
let U = u.__demoMode ? !1 : d && u.comboboxState === 0;
|
|
830
|
-
|
|
834
|
+
bt(U, { allowed: g(() => [u.inputRef.current, u.buttonRef.current, u.optionsRef.current]) }), G(() => {
|
|
831
835
|
var P;
|
|
832
836
|
u.optionsPropsRef.current.static = (P = e.static) != null ? P : !1;
|
|
833
|
-
}, [u.optionsPropsRef, e.static]),
|
|
837
|
+
}, [u.optionsPropsRef, e.static]), G(() => {
|
|
834
838
|
u.optionsPropsRef.current.hold = i;
|
|
835
839
|
}, [u.optionsPropsRef, i]), Wt(u.comboboxState === 0, { container: u.optionsRef.current, accept(P) {
|
|
836
840
|
return P.getAttribute("role") === "option" ? NodeFilter.FILTER_REJECT : P.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
837
841
|
}, walk(P) {
|
|
838
842
|
P.setAttribute("role", "none");
|
|
839
843
|
} });
|
|
840
|
-
let J =
|
|
844
|
+
let J = Se([(t = u.buttonRef.current) == null ? void 0 : t.id]), j = q(() => ({ open: u.comboboxState === 0, option: void 0 }), [u.comboboxState]), Y = g(() => {
|
|
841
845
|
S.setActivationTrigger(0);
|
|
842
846
|
}), k = g((P) => {
|
|
843
847
|
P.preventDefault(), S.setActivationTrigger(0);
|
|
844
|
-
}), C =
|
|
848
|
+
}), C = Ie(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, ...yt(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));
|
|
845
849
|
if (u.virtual) {
|
|
846
850
|
if (Q === void 0) throw new Error("Missing `options` in virtual mode");
|
|
847
851
|
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)) });
|
|
848
852
|
}
|
|
849
|
-
return $.createElement(
|
|
853
|
+
return $.createElement(gt, { enabled: p ? e.static || O : !1 }, $.createElement(se.Provider, { value: u.mode === 1 ? u : { ...u, isSelected: ee } }, le({ ourProps: C, theirProps: { ...I, children: $.createElement(xt, { 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" })));
|
|
850
854
|
}
|
|
851
855
|
let ln = "div";
|
|
852
856
|
function an(e, s) {
|
|
853
857
|
var t, n, o, l;
|
|
854
|
-
let r = ne("Combobox.Option"), i = ae("Combobox.Option"), a =
|
|
858
|
+
let r = ne("Combobox.Option"), i = ae("Combobox.Option"), a = de(), { id: p = `headlessui-combobox-option-${a}`, value: d, disabled: c = (o = (n = (t = r.virtual) == null ? void 0 : t.disabled) == null ? void 0 : n.call(t, d)) != null ? o : !1, order: I = null, ...u } = e, S = Ne(r.inputRef), x = r.virtual ? r.activeOptionIndex === r.calculateIndex(d) : r.activeOptionIndex === null ? !1 : ((l = r.options[r.activeOptionIndex]) == null ? void 0 : l.id) === p, h = r.isSelected(d), R = N(null), D = ke({ disabled: c, value: d, domRef: R, order: I }), M = xe(Ve), E = pe(s, R, M ? M.measureElement : null), y = g(() => {
|
|
855
859
|
i.setIsTyping(!1), i.onChange(d);
|
|
856
860
|
});
|
|
857
|
-
|
|
861
|
+
G(() => i.registerOption(p, D), [D, p]);
|
|
858
862
|
let O = N(!(r.virtual || r.__demoMode));
|
|
859
|
-
|
|
860
|
-
if (!r.virtual && !r.__demoMode) return
|
|
863
|
+
G(() => {
|
|
864
|
+
if (!r.virtual && !r.__demoMode) return Ce().requestAnimationFrame(() => {
|
|
861
865
|
O.current = !0;
|
|
862
866
|
});
|
|
863
|
-
}, [r.virtual, r.__demoMode]),
|
|
864
|
-
if (O.current && r.comboboxState === 0 && x && r.activationTrigger !== 0) return
|
|
867
|
+
}, [r.virtual, r.__demoMode]), G(() => {
|
|
868
|
+
if (O.current && r.comboboxState === 0 && x && r.activationTrigger !== 0) return Ce().requestAnimationFrame(() => {
|
|
865
869
|
var C, A;
|
|
866
870
|
(A = (C = R.current) == null ? void 0 : C.scrollIntoView) == null || A.call(C, { block: "nearest" });
|
|
867
871
|
});
|
|
868
872
|
}, [R, x, r.comboboxState, r.activationTrigger, r.activeOptionIndex]);
|
|
869
873
|
let b = g((C) => {
|
|
870
|
-
C.preventDefault(), C.button === Oe.Left && (c || (y(),
|
|
874
|
+
C.preventDefault(), C.button === Oe.Left && (c || (y(), It() || requestAnimationFrame(() => S()), r.mode === 0 && i.closeCombobox()));
|
|
871
875
|
}), V = g(() => {
|
|
872
876
|
if (c) return i.goToOption(_.Nothing);
|
|
873
877
|
let C = r.calculateIndex(d);
|
|
874
878
|
i.goToOption(_.Specific, C);
|
|
875
|
-
}), U =
|
|
879
|
+
}), U = St(), J = g((C) => U.update(C)), j = g((C) => {
|
|
876
880
|
if (!U.wasMoved(C) || c || x) return;
|
|
877
881
|
let A = r.calculateIndex(d);
|
|
878
882
|
i.goToOption(_.Specific, A, 0);
|
|
879
883
|
}), Y = g((C) => {
|
|
880
884
|
U.wasMoved(C) && (c || x && (r.optionsPropsRef.current.hold || i.goToOption(_.Nothing)));
|
|
881
|
-
}), k =
|
|
885
|
+
}), k = q(() => ({ active: x, focus: x, selected: h, disabled: c }), [x, h, c]);
|
|
882
886
|
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" });
|
|
883
887
|
}
|
|
884
|
-
let un = re(Xt), cn = re(nn), dn = re(en), pn =
|
|
888
|
+
let un = re(Xt), cn = re(nn), dn = re(en), pn = tt, fn = re(rn), hn = re(an), Rn = Object.assign(un, { Input: dn, Button: cn, Label: pn, Options: fn, Option: hn });
|
|
885
889
|
export {
|
|
886
890
|
dn as G,
|
|
887
891
|
cn as H,
|
|
888
892
|
hn as K,
|
|
889
|
-
|
|
893
|
+
Rn as N,
|
|
890
894
|
fn as z
|
|
891
895
|
};
|
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
import { jsx as a, jsxs as f } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import c, { Fragment as p } from "react";
|
|
3
3
|
import { t as y } from "../../bundle-mjs-SHnj3fHy.js";
|
|
4
|
-
import { H as
|
|
5
|
-
import {
|
|
6
|
-
import { getValue as
|
|
7
|
-
import { N as
|
|
8
|
-
import { X as
|
|
9
|
-
const
|
|
4
|
+
import { H as x } from "../../index-CGOwpnLF.js";
|
|
5
|
+
import { c as C } from "../../index-Bv0kHmgl.js";
|
|
6
|
+
import { getValue as u } from "../Selectbox/helper.js";
|
|
7
|
+
import { N as E, G as g, H as w, z as N, K as L } from "../../combobox-GYodOLPS.js";
|
|
8
|
+
import { X as S } from "../../transition-B_YPzh_T.js";
|
|
9
|
+
const H = (l, r) => r.type === "SEARCH" ? {
|
|
10
10
|
...l,
|
|
11
11
|
query: r.query,
|
|
12
12
|
filterList: l.list.filter((t) => t.label.toLowerCase().includes(r.query.toLowerCase()))
|
|
13
13
|
} : r.type === "SETVALUE" ? {
|
|
14
14
|
...l,
|
|
15
15
|
value: r.value,
|
|
16
|
-
selected: l.list.find((t) =>
|
|
16
|
+
selected: l.list.find((t) => u(t, l.valueField) === r.value) || null
|
|
17
17
|
} : r.type === "SETSELECT" ? {
|
|
18
18
|
...l,
|
|
19
19
|
selected: r.selected,
|
|
20
|
-
value:
|
|
21
|
-
} : l,
|
|
20
|
+
value: u(r.selected, l.valueField) + ""
|
|
21
|
+
} : l, A = ({
|
|
22
22
|
id: l,
|
|
23
23
|
name: r,
|
|
24
24
|
options: t,
|
|
25
25
|
value: i = "",
|
|
26
|
-
valueField:
|
|
27
|
-
onChange:
|
|
26
|
+
valueField: o = "value",
|
|
27
|
+
onChange: d,
|
|
28
28
|
placeholder: h
|
|
29
29
|
}, v) => {
|
|
30
|
-
const [
|
|
30
|
+
const [m, s] = c.useReducer(H, {
|
|
31
31
|
list: t,
|
|
32
32
|
query: "",
|
|
33
33
|
filterList: t,
|
|
34
34
|
value: i,
|
|
35
|
-
valueField:
|
|
35
|
+
valueField: o,
|
|
36
36
|
selected: t.find((e) => {
|
|
37
|
-
const n =
|
|
37
|
+
const n = u(e, o);
|
|
38
38
|
return i ? n === i : !1;
|
|
39
39
|
}) || null
|
|
40
40
|
});
|
|
41
|
-
return
|
|
41
|
+
return c.useImperativeHandle(v, () => ({
|
|
42
42
|
search: (e) => s({ type: "SEARCH", query: e }),
|
|
43
43
|
setValue: (e) => s({ type: "SETVALUE", value: e })
|
|
44
44
|
})), /* @__PURE__ */ a(
|
|
45
|
-
|
|
45
|
+
E,
|
|
46
46
|
{
|
|
47
|
-
value:
|
|
47
|
+
value: m.selected,
|
|
48
48
|
onChange: (e) => {
|
|
49
49
|
s({
|
|
50
50
|
type: "SETSELECT",
|
|
51
51
|
selected: e
|
|
52
|
-
}),
|
|
52
|
+
}), d && d(e ? u(e, o) : "");
|
|
53
53
|
},
|
|
54
54
|
children: /* @__PURE__ */ f("div", { className: "relative", children: [
|
|
55
55
|
/* @__PURE__ */ a(
|
|
56
|
-
|
|
56
|
+
g,
|
|
57
57
|
{
|
|
58
58
|
placeholder: h,
|
|
59
59
|
onChange: (e) => s({ type: "SEARCH", query: e.target.value }),
|
|
@@ -61,8 +61,8 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
61
61
|
displayValue: (e) => (e == null ? void 0 : e.label) || ""
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
/* @__PURE__ */ a(
|
|
65
|
-
|
|
64
|
+
/* @__PURE__ */ a(w, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ a(
|
|
65
|
+
x,
|
|
66
66
|
{
|
|
67
67
|
className: "h-5 w-5 text-gray-400",
|
|
68
68
|
"aria-hidden": "true"
|
|
@@ -76,11 +76,11 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
76
76
|
id: l,
|
|
77
77
|
name: r,
|
|
78
78
|
readOnly: !0,
|
|
79
|
-
value:
|
|
79
|
+
value: m.value + ""
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
82
|
/* @__PURE__ */ a(
|
|
83
|
-
|
|
83
|
+
S,
|
|
84
84
|
{
|
|
85
85
|
as: p,
|
|
86
86
|
enter: "transition duration-100 ease-out",
|
|
@@ -90,12 +90,12 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
90
90
|
leaveFrom: "scale-100 transform opacity-100",
|
|
91
91
|
leaveTo: "scale-95 transform opacity-0",
|
|
92
92
|
afterLeave: () => s({ type: "SEARCH", query: "" }),
|
|
93
|
-
children: /* @__PURE__ */ a(
|
|
93
|
+
children: /* @__PURE__ */ a(N, { 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: m.filterList.map((e) => /* @__PURE__ */ a(L, { as: p, value: e, children: ({ selected: n, focus: b }) => /* @__PURE__ */ f(
|
|
94
94
|
"li",
|
|
95
95
|
{
|
|
96
96
|
className: y(
|
|
97
|
-
"relative flex cursor-pointer justify-between px-5 py-4 text-black hover:bg-
|
|
98
|
-
n && "bg-
|
|
97
|
+
"relative flex cursor-pointer justify-between px-5 py-4 text-black hover:bg-primary-100",
|
|
98
|
+
(n || b) && "bg-primary-100",
|
|
99
99
|
e.enable === !1 && "cursor-not-allowed opacity-50"
|
|
100
100
|
),
|
|
101
101
|
children: [
|
|
@@ -104,9 +104,9 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
104
104
|
"span",
|
|
105
105
|
{
|
|
106
106
|
className: y(
|
|
107
|
-
"absolute inset-y-0 left-0 flex items-center pl-3 text-
|
|
107
|
+
"absolute inset-y-0 left-0 flex items-center pl-3 text-primary-600"
|
|
108
108
|
),
|
|
109
|
-
children: /* @__PURE__ */ a(
|
|
109
|
+
children: /* @__PURE__ */ a(C, { className: "h-5 w-5", "aria-hidden": "true" })
|
|
110
110
|
}
|
|
111
111
|
) : null
|
|
112
112
|
]
|
|
@@ -117,7 +117,7 @@ const S = (l, r) => r.type === "SEARCH" ? {
|
|
|
117
117
|
] })
|
|
118
118
|
}
|
|
119
119
|
);
|
|
120
|
-
},
|
|
120
|
+
}, U = c.forwardRef(A);
|
|
121
121
|
export {
|
|
122
|
-
|
|
122
|
+
U as default
|
|
123
123
|
};
|