anysystem-design 0.0.13 → 0.0.14
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-BGTTsE1z.js → combobox-CbwTCd-z.js} +18 -16
- package/dist/components/AutoComplete/AutoCompleteBase.js +3 -3
- package/dist/components/AutoComplete/AutoCompleteMultiple.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/Label/Label.d.ts +1 -1
- package/dist/components/Label/Label.js +28 -27
- package/dist/components/RadioGroup/RadioGroup.js +25 -24
- package/dist/components/Selectbox/SelectboxBase.js +4 -4
- package/dist/components/Selectbox/SelectboxMultiple.js +4 -4
- package/dist/components/Switch/Switch.d.ts +10 -0
- package/dist/components/Switch/Switch.js +61 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +44 -42
- package/dist/{floating-ui.react-dom-xElE0hWP.js → floating-ui.react-dom-YTFlGVA5.js} +175 -175
- package/dist/index-CsJbhhQY.js +108 -0
- package/dist/index.css +1 -1
- package/dist/index.js +46 -44
- package/dist/label-M2WV1DNi.js +742 -0
- package/dist/{listbox-jWCPHdFz.js → listbox-CJZgAdIt.js} +40 -38
- package/dist/{transition-KgVrpnkt.js → transition-DgjncSwT.js} +671 -712
- package/dist/use-resolve-button-type-WMDXx_9F.js +46 -0
- package/package.json +1 -1
- package/dist/focus-management-DIhMJUCI.js +0 -846
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { s as $e, o as g, n as q, f as Ke,
|
|
1
|
+
import { s as $e, o as g, n as q, f as Ke, M as Re, W as re, K as Ue, a as qe, l as Ge, T as Je, e as te, z as Ye, j as Qe, H as le, u as Xe, y as de, p as Ze, I as be, G as et, $ as De, b as Fe, D as ge, g as ye, c as F, r as tt } from "./label-M2WV1DNi.js";
|
|
2
2
|
import * as ie from "react";
|
|
3
|
-
import $, { useEffect as xe, useRef as N, createContext as Se, useReducer as
|
|
3
|
+
import $, { useEffect as xe, useRef as N, createContext as Se, useReducer as nt, createRef as ot, useCallback as Ce, useMemo as G, useId as pe, useContext as Ie, useState as it, Fragment as ke } from "react";
|
|
4
4
|
import { r as Z } from "./index-DsprzSCj.js";
|
|
5
|
-
import {
|
|
5
|
+
import { w as st, T as rt } from "./use-resolve-button-type-WMDXx_9F.js";
|
|
6
|
+
import { f as lt, u as at, _ as ut } from "./index-CsJbhhQY.js";
|
|
7
|
+
import { F as ct, v as dt, f as pt, i as ce, y as ft, n as Ae, 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, w as Tt, q as Rt, r as _, z as yt, s as _e } from "./transition-DgjncSwT.js";
|
|
6
8
|
function oe(e, s, t) {
|
|
7
9
|
let n = t.initialDeps ?? [], o;
|
|
8
10
|
return () => {
|
|
@@ -535,13 +537,13 @@ jt(() => {
|
|
|
535
537
|
function e(s) {
|
|
536
538
|
if (!(s.target instanceof HTMLElement) || s.target === document.body || X[0] === s.target) return;
|
|
537
539
|
let t = s.target;
|
|
538
|
-
t = t.closest(
|
|
540
|
+
t = t.closest(lt), X.unshift(t ?? s.target), X = X.filter((n) => n != null && n.isConnected), X.splice(10);
|
|
539
541
|
}
|
|
540
542
|
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 });
|
|
541
543
|
});
|
|
542
544
|
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 || {});
|
|
543
545
|
function ve(e, s = (t) => t) {
|
|
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) :
|
|
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) : ut(n, (r) => r.dataRef.current.domRef.current), l = t ? o.indexOf(t) : null;
|
|
545
547
|
return l === -1 && (l = null), { options: o, activeOptionIndex: l };
|
|
546
548
|
}
|
|
547
549
|
let Gt = { 1(e) {
|
|
@@ -623,7 +625,7 @@ function Jt(e) {
|
|
|
623
625
|
}, getScrollElement() {
|
|
624
626
|
var p;
|
|
625
627
|
return (p = s.optionsRef.current) != null ? p : null;
|
|
626
|
-
}, overscan: 12 }), [r, i] =
|
|
628
|
+
}, overscan: 12 }), [r, i] = it(0);
|
|
627
629
|
q(() => {
|
|
628
630
|
i((p) => p + 1);
|
|
629
631
|
}, [t]);
|
|
@@ -654,7 +656,7 @@ function Yt(e, s) {
|
|
|
654
656
|
let Qt = ke;
|
|
655
657
|
function Xt(e, s) {
|
|
656
658
|
var t, n;
|
|
657
|
-
let o =
|
|
659
|
+
let o = qe(), { 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 = Ge(r), [E = S ? [] : void 0, y] = Je(l, i, M), [O, b] = nt(Yt, { dataRef: ot(), 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 = at(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() {
|
|
658
660
|
if (V.current && O.activeOptionIndex === null && (h ? h.options.length > 0 : O.options.length > 0)) {
|
|
659
661
|
if (h) {
|
|
660
662
|
let T = h.options.findIndex((K) => {
|
|
@@ -675,7 +677,7 @@ function Xt(e, s) {
|
|
|
675
677
|
O.dataRef.current = m;
|
|
676
678
|
}, [m]);
|
|
677
679
|
let ee = m.comboboxState === 0;
|
|
678
|
-
|
|
680
|
+
ct(ee, [m.buttonRef, m.inputRef, m.optionsRef], () => H.closeCombobox());
|
|
679
681
|
let P = G(() => {
|
|
680
682
|
var v, T, K;
|
|
681
683
|
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 };
|
|
@@ -703,15 +705,15 @@ function Xt(e, s) {
|
|
|
703
705
|
return K === -1 ? T.push(v) : T.splice(K, 1), y == null ? void 0 : y(T);
|
|
704
706
|
} })), L = g((v) => {
|
|
705
707
|
b({ type: 6, trigger: v });
|
|
706
|
-
}), H = G(() => ({ onChange: w, registerOption: W, goToOption: z, setIsTyping: B, closeCombobox: f, openCombobox: he, setActivationTrigger: L, selectActiveOption: fe }), []), [Be, We] =
|
|
708
|
+
}), H = G(() => ({ onChange: w, registerOption: W, goToOption: z, setIsTyping: B, closeCombobox: f, openCombobox: he, setActivationTrigger: L, selectActiveOption: fe }), []), [Be, We] = Ye(), je = s === null ? {} : { ref: s }, He = Ce(() => {
|
|
707
709
|
if (M !== void 0) return y == null ? void 0 : y(M);
|
|
708
710
|
}, [y, M]);
|
|
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(
|
|
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(pt, { value: te(m.comboboxState, { 0: ce.Open, 1: ce.Closed }) }, p != null && $.createElement(Qe, { disabled: c, data: E != null ? { [p]: E } : {}, form: a, onReset: He }), le({ ourProps: je, theirProps: D, slot: P, defaultTag: Qt, name: "Combobox" }))))));
|
|
710
712
|
}
|
|
711
713
|
let Zt = "input";
|
|
712
714
|
function en(e, s) {
|
|
713
715
|
var t, n, o, l, r;
|
|
714
|
-
let i = ne("Combobox.Input"), a = ae("Combobox.Input"), p = pe(), d =
|
|
716
|
+
let i = ne("Combobox.Input"), a = ae("Combobox.Input"), p = pe(), d = Xe(), { 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, ft()), M = Ae(i.inputRef), E = Ze(), y = g(() => {
|
|
715
717
|
a.onChange(null), i.optionsRef.current && (i.optionsRef.current.scrollTop = 0), a.goToOption(_.Nothing);
|
|
716
718
|
}), O = G(() => {
|
|
717
719
|
var f;
|
|
@@ -785,7 +787,7 @@ function en(e, s) {
|
|
|
785
787
|
(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
788
|
Z.flushSync(() => a.openCombobox()), a.setActivationTrigger(1);
|
|
787
789
|
});
|
|
788
|
-
}), C = be(), A =
|
|
790
|
+
}), C = be(), A = et(), { 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
791
|
return le({ ourProps: he, theirProps: R, slot: fe, defaultTag: Zt, name: "Combobox.Input" });
|
|
790
792
|
}
|
|
791
793
|
let tn = "button";
|
|
@@ -811,8 +813,8 @@ function nn(e, s) {
|
|
|
811
813
|
return;
|
|
812
814
|
}
|
|
813
815
|
}), u = g((b) => {
|
|
814
|
-
b.preventDefault(), !
|
|
815
|
-
}), S = be([i]), { isFocusVisible: x, focusProps: h } = De({ autoFocus: p }), { isHovered: R, hoverProps: D } = Fe({ isDisabled: a }), { pressed: M, pressProps: E } =
|
|
816
|
+
b.preventDefault(), !tt(b.currentTarget) && (b.button === Oe.Left && (n.comboboxState === 0 ? o.closeCombobox() : o.openCombobox()), c());
|
|
817
|
+
}), S = be([i]), { isFocusVisible: x, focusProps: h } = De({ autoFocus: p }), { isHovered: R, hoverProps: D } = Fe({ isDisabled: a }), { pressed: M, pressProps: E } = st({ 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: rt(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);
|
|
816
818
|
return le({ ourProps: O, theirProps: d, slot: y, defaultTag: tn, name: "Combobox.Button" });
|
|
817
819
|
}
|
|
818
820
|
let on = "div", sn = Re.RenderStrategy | Re.Static;
|
|
@@ -879,11 +881,11 @@ function an(e, s) {
|
|
|
879
881
|
}), k = G(() => ({ active: x, focus: x, selected: h, disabled: c }), [x, h, c]);
|
|
880
882
|
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" });
|
|
881
883
|
}
|
|
882
|
-
let un = re(Xt), cn = re(nn), dn = re(en), pn =
|
|
884
|
+
let un = re(Xt), cn = re(nn), dn = re(en), pn = Ue, fn = re(rn), hn = re(an), In = Object.assign(un, { Input: dn, Button: cn, Label: pn, Options: fn, Option: hn });
|
|
883
885
|
export {
|
|
884
886
|
dn as G,
|
|
885
887
|
cn as H,
|
|
886
888
|
hn as K,
|
|
887
|
-
|
|
889
|
+
In as N,
|
|
888
890
|
fn as z
|
|
889
891
|
};
|
|
@@ -1,11 +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 } from "../../
|
|
4
|
+
import { H as g } from "../../index-CsJbhhQY.js";
|
|
5
5
|
import { b } from "../../index-wvw0O1v3.js";
|
|
6
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-
|
|
8
|
-
import { X as L } from "../../transition-
|
|
7
|
+
import { N as x, G as C, H as E, z as w, K as N } from "../../combobox-CbwTCd-z.js";
|
|
8
|
+
import { X as L } from "../../transition-DgjncSwT.js";
|
|
9
9
|
const S = (l, r) => r.type === "SEARCH" ? {
|
|
10
10
|
...l,
|
|
11
11
|
query: r.query,
|
|
@@ -2,12 +2,12 @@ import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
|
2
2
|
import f, { Fragment as h } from "react";
|
|
3
3
|
import { _ as x } from "../../lodash-XYp3qmxI.js";
|
|
4
4
|
import { t as v } from "../../bundle-mjs-SHnj3fHy.js";
|
|
5
|
-
import { H as C } from "../../
|
|
5
|
+
import { H as C } from "../../index-CsJbhhQY.js";
|
|
6
6
|
import { b } from "../../index-wvw0O1v3.js";
|
|
7
7
|
import { a as w } from "../../index-C197ia6B.js";
|
|
8
8
|
import { getValue as c } from "../Selectbox/helper.js";
|
|
9
|
-
import { N, G as S, H as L, z as T, K as q } from "../../combobox-
|
|
10
|
-
import { X as A } from "../../transition-
|
|
9
|
+
import { N, G as S, H as L, z as T, K as q } from "../../combobox-CbwTCd-z.js";
|
|
10
|
+
import { X as A } from "../../transition-DgjncSwT.js";
|
|
11
11
|
const R = (l, t) => {
|
|
12
12
|
if (t.type === "SEARCH")
|
|
13
13
|
return {
|
|
@@ -13,7 +13,7 @@ const x = ({
|
|
|
13
13
|
"label",
|
|
14
14
|
{
|
|
15
15
|
className: s(
|
|
16
|
-
"relative my-
|
|
16
|
+
"relative my-2 flex cursor-pointer select-none items-center gap-2 py-2 pr-3",
|
|
17
17
|
"after:absolute after:left-1/2 after:top-1/2 after:-z-20 after:h-[calc(100%+12px)] after:w-[calc(100%+20px)] after:-translate-x-1/2 after:-translate-y-1/2 after:transform after:rounded-md after:bg-blue-100 after:opacity-0 after:transition-all after:content-[''] dark:after:bg-gray-800",
|
|
18
18
|
"hover:after:opacity-100 hover:after:duration-200",
|
|
19
19
|
o === !0 && "hidden"
|
|
@@ -2,7 +2,7 @@ import { jsx as j, jsxs as Ne, Fragment as ct } from "react/jsx-runtime";
|
|
|
2
2
|
import { t as We } from "../../bundle-mjs-SHnj3fHy.js";
|
|
3
3
|
import { b as Hn, c as In } from "../../index-C197ia6B.js";
|
|
4
4
|
import Ln, { createContext as wa, forwardRef as pa, useRef as Qe, useReducer as An, useEffect as Fe, Fragment as ga, isValidElement as jn, cloneElement as Gn, createElement as qn, useContext as Dt, useId as $n, useMemo as br, useState as _a, useCallback as Vn, useLayoutEffect as ba } from "react";
|
|
5
|
-
import { u as Qn, a as Bn, o as zn, f as Zn, s as Xn } from "../../floating-ui.react-dom-
|
|
5
|
+
import { u as Qn, a as Bn, o as zn, f as Zn, s as Xn } from "../../floating-ui.react-dom-YTFlGVA5.js";
|
|
6
6
|
//! moment.js
|
|
7
7
|
//! version : 2.30.1
|
|
8
8
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as r, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { t as s } from "../../bundle-mjs-SHnj3fHy.js";
|
|
3
|
-
import { c } from "../../index-wvw0O1v3.js";
|
|
4
|
-
const
|
|
5
|
-
label:
|
|
6
|
-
className:
|
|
7
|
-
htmlFor:
|
|
8
|
-
isError:
|
|
9
|
-
errorMessage:
|
|
10
|
-
type:
|
|
11
|
-
children:
|
|
12
|
-
}) => /* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
3
|
+
import { c as m } from "../../index-wvw0O1v3.js";
|
|
4
|
+
const h = ({
|
|
5
|
+
label: t,
|
|
6
|
+
className: i,
|
|
7
|
+
htmlFor: d,
|
|
8
|
+
isError: a = !1,
|
|
9
|
+
errorMessage: o,
|
|
10
|
+
type: e = "border",
|
|
11
|
+
children: c
|
|
12
|
+
}) => /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
|
|
13
|
+
/* @__PURE__ */ r(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
className: s(
|
|
17
|
-
"relative
|
|
18
|
-
|
|
19
|
-
"form-group",
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
"relative flex w-full flex-col ",
|
|
18
|
+
e === "border" && "rounded border border-gray-400",
|
|
19
|
+
e === "horizontal" ? "flex-row gap-2" : "form-group",
|
|
20
|
+
a && "error",
|
|
21
|
+
i
|
|
22
22
|
),
|
|
23
23
|
children: [
|
|
24
|
-
|
|
24
|
+
t && /* @__PURE__ */ l(
|
|
25
25
|
"label",
|
|
26
26
|
{
|
|
27
27
|
className: s(
|
|
28
|
-
|
|
29
|
-
"
|
|
28
|
+
e === "border" && "hidden text-gray-600 opacity-0 dark:text-white",
|
|
29
|
+
e === "horizontal" && "flex items-center justify-center",
|
|
30
|
+
"mb-1 text-sm font-semibold"
|
|
30
31
|
),
|
|
31
|
-
htmlFor:
|
|
32
|
-
children:
|
|
32
|
+
htmlFor: d,
|
|
33
|
+
children: t
|
|
33
34
|
}
|
|
34
35
|
),
|
|
35
|
-
|
|
36
|
+
c
|
|
36
37
|
]
|
|
37
38
|
}
|
|
38
39
|
),
|
|
39
|
-
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
40
|
+
a && o && /* @__PURE__ */ r("span", { className: "flex items-center gap-1 text-sm text-red-600", children: [
|
|
41
|
+
/* @__PURE__ */ l("div", { className: "w-4", children: /* @__PURE__ */ l(m, {}) }),
|
|
42
|
+
o
|
|
42
43
|
] })
|
|
43
44
|
] });
|
|
44
45
|
export {
|
|
45
|
-
|
|
46
|
+
h as default
|
|
46
47
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as C, jsxs as ge } from "react/jsx-runtime";
|
|
2
2
|
import $, { createContext as re, useId as V, useReducer as $e, useRef as _, useMemo as P, useCallback as ye, useContext as te } from "react";
|
|
3
3
|
import { t as M } from "../../bundle-mjs-SHnj3fHy.js";
|
|
4
|
-
import {
|
|
4
|
+
import { u as Ee, P as Z, F as H, T as ee, _ as ke, a as Te, b as Oe } from "../../index-CsJbhhQY.js";
|
|
5
5
|
import { getValue as z } from "../Selectbox/helper.js";
|
|
6
|
+
import { W, K as Ce, w as Pe, a as ae, z as ie, U as oe, y as K, l as xe, T as De, o as U, j as we, H as q, s as le, n as ne, $ as se, b as ue, D as de, u as Ge, I as Se, G as Fe, e as Ne, f as Ae, c as F, d as Le, r as ce } from "../../label-M2WV1DNi.js";
|
|
6
7
|
var Ie = ((e) => (e[e.RegisterOption = 0] = "RegisterOption", e[e.UnregisterOption = 1] = "UnregisterOption", e))(Ie || {});
|
|
7
8
|
let Ue = { 0(e, r) {
|
|
8
9
|
let t = [...e.options, { id: r.id, element: r.element, propsRef: r.propsRef }];
|
|
9
|
-
return { ...e, options:
|
|
10
|
+
return { ...e, options: ke(t, (a) => a.element.current) };
|
|
10
11
|
}, 1(e, r) {
|
|
11
12
|
let t = e.options.slice(), a = e.options.findIndex((n) => n.id === r.id);
|
|
12
13
|
return a === -1 ? e : (t.splice(a, 1), { ...e, options: t });
|
|
@@ -31,49 +32,49 @@ function Q(e) {
|
|
|
31
32
|
return r;
|
|
32
33
|
}
|
|
33
34
|
function je(e, r) {
|
|
34
|
-
return
|
|
35
|
+
return Ne(r.type, Ue, e, r);
|
|
35
36
|
}
|
|
36
37
|
let He = "div";
|
|
37
38
|
function ze(e, r) {
|
|
38
|
-
let t = V(), a = ae(), { id: n = `headlessui-radiogroup-${t}`, value: y, form: l, name: s, onChange: u, by: b, disabled: d = a || !1, defaultValue: m, ...N } = e, f =
|
|
39
|
+
let t = V(), a = ae(), { id: n = `headlessui-radiogroup-${t}`, value: y, form: l, name: s, onChange: u, by: b, disabled: d = a || !1, defaultValue: m, ...N } = e, f = Ee(b), [E, x] = $e(je, { options: [] }), c = E.options, [k, A] = ie(), [D, T] = oe(), O = _(null), w = K(O, r), h = xe(m), [i, G] = De(y, u, h), S = P(() => c.find((o) => !o.propsRef.current.disabled), [c]), g = P(() => c.some((o) => f(o.propsRef.current.value, i)), [c, i]), p = U((o) => {
|
|
39
40
|
var L;
|
|
40
41
|
if (d || f(o, i)) return !1;
|
|
41
|
-
let
|
|
42
|
-
return
|
|
42
|
+
let R = (L = c.find((j) => f(j.propsRef.current.value, o))) == null ? void 0 : L.propsRef.current;
|
|
43
|
+
return R != null && R.disabled ? !1 : (G == null || G(o), !0);
|
|
43
44
|
}), fe = U((o) => {
|
|
44
|
-
let L =
|
|
45
|
+
let L = O.current;
|
|
45
46
|
if (!L) return;
|
|
46
|
-
let
|
|
47
|
+
let R = Ae(L), j = c.filter((v) => v.propsRef.current.disabled === !1).map((v) => v.element.current);
|
|
47
48
|
switch (o.key) {
|
|
48
49
|
case F.Enter:
|
|
49
|
-
|
|
50
|
+
Le(o.currentTarget);
|
|
50
51
|
break;
|
|
51
52
|
case F.ArrowLeft:
|
|
52
53
|
case F.ArrowUp:
|
|
53
54
|
if (o.preventDefault(), o.stopPropagation(), Z(j, H.Previous | H.WrapAround) === ee.Success) {
|
|
54
|
-
let v = c.find((I) => I.element.current === (
|
|
55
|
+
let v = c.find((I) => I.element.current === (R == null ? void 0 : R.activeElement));
|
|
55
56
|
v && p(v.propsRef.current.value);
|
|
56
57
|
}
|
|
57
58
|
break;
|
|
58
59
|
case F.ArrowRight:
|
|
59
60
|
case F.ArrowDown:
|
|
60
61
|
if (o.preventDefault(), o.stopPropagation(), Z(j, H.Next | H.WrapAround) === ee.Success) {
|
|
61
|
-
let v = c.find((I) => I.element.current === (
|
|
62
|
+
let v = c.find((I) => I.element.current === (R == null ? void 0 : R.activeElement));
|
|
62
63
|
v && p(v.propsRef.current.value);
|
|
63
64
|
}
|
|
64
65
|
break;
|
|
65
66
|
case F.Space:
|
|
66
67
|
{
|
|
67
68
|
o.preventDefault(), o.stopPropagation();
|
|
68
|
-
let v = c.find((I) => I.element.current === (
|
|
69
|
+
let v = c.find((I) => I.element.current === (R == null ? void 0 : R.activeElement));
|
|
69
70
|
v && p(v.propsRef.current.value);
|
|
70
71
|
}
|
|
71
72
|
break;
|
|
72
73
|
}
|
|
73
|
-
}), Y = U((o) => (x({ type: 0, ...o }), () => x({ type: 1, id: o.id }))), ve = P(() => ({ value: i, firstOption: S, containsCheckedOption: g, disabled: d, compare: f, ...E }), [i, S, g, d, f, E]), me = P(() => ({ registerOption: Y, change: p }), [Y, p]), be = { ref: w, id: n, role: "radiogroup", "aria-labelledby": k, "aria-describedby": D, onKeyDown: fe },
|
|
74
|
-
if (
|
|
75
|
-
}, [p,
|
|
76
|
-
return $.createElement(
|
|
74
|
+
}), Y = U((o) => (x({ type: 0, ...o }), () => x({ type: 1, id: o.id }))), ve = P(() => ({ value: i, firstOption: S, containsCheckedOption: g, disabled: d, compare: f, ...E }), [i, S, g, d, f, E]), me = P(() => ({ registerOption: Y, change: p }), [Y, p]), be = { ref: w, id: n, role: "radiogroup", "aria-labelledby": k, "aria-describedby": D, onKeyDown: fe }, Re = P(() => ({ value: i }), [i]), he = ye(() => {
|
|
75
|
+
if (h !== void 0) return p(h);
|
|
76
|
+
}, [p, h]);
|
|
77
|
+
return $.createElement(T, { name: "RadioGroup.Description" }, $.createElement(A, { name: "RadioGroup.Label" }, $.createElement(X.Provider, { value: me }, $.createElement(B.Provider, { value: ve }, s != null && $.createElement(we, { disabled: d, data: { [s]: i || "on" }, overrides: { type: "radio", checked: i != null }, form: l, onReset: he }), q({ ourProps: be, theirProps: N, slot: Re, defaultTag: He, name: "RadioGroup" })))));
|
|
77
78
|
}
|
|
78
79
|
let Me = "div";
|
|
79
80
|
function Ve(e, r) {
|
|
@@ -84,22 +85,22 @@ function Ve(e, r) {
|
|
|
84
85
|
var p;
|
|
85
86
|
if (ce(g.currentTarget)) return g.preventDefault();
|
|
86
87
|
n.change(s) && ((p = m.current) == null || p.focus());
|
|
87
|
-
}), D = ((t = a.firstOption) == null ? void 0 : t.id) === l, { isFocusVisible:
|
|
88
|
+
}), D = ((t = a.firstOption) == null ? void 0 : t.id) === l, { isFocusVisible: T, focusProps: O } = se({ autoFocus: b }), { isHovered: w, hoverProps: h } = ue({ isDisabled: u }), i = a.compare(a.value, s), G = de({ ref: N, id: l, role: "radio", "aria-checked": i ? "true" : "false", "aria-labelledby": f, "aria-describedby": x, "aria-disabled": u ? !0 : void 0, tabIndex: u ? -1 : i || !a.containsCheckedOption && D ? 0 : -1, onClick: u ? void 0 : A, autoFocus: b }, O, h), S = P(() => ({ checked: i, disabled: u, active: T, hover: w, focus: T, autofocus: b }), [i, u, w, T, b]);
|
|
88
89
|
return $.createElement(c, { name: "RadioGroup.Description" }, $.createElement(E, { name: "RadioGroup.Label" }, q({ ourProps: G, theirProps: d, slot: S, defaultTag: Me, name: "RadioGroup.Option" })));
|
|
89
90
|
}
|
|
90
91
|
let _e = "span";
|
|
91
92
|
function We(e, r) {
|
|
92
93
|
var t;
|
|
93
|
-
let a = J("Radio"), n = Q("Radio"), y = V(), l =
|
|
94
|
+
let a = J("Radio"), n = Q("Radio"), y = V(), l = Ge(), s = ae(), { id: u = l || `headlessui-radio-${y}`, value: b, disabled: d = a.disabled || s || !1, autoFocus: m = !1, ...N } = e, f = _(null), E = K(f, r), x = Se(), c = Fe(), k = le({ value: b, disabled: d });
|
|
94
95
|
ne(() => n.registerOption({ id: u, element: f, propsRef: k }), [u, n, f, k]);
|
|
95
96
|
let A = U((g) => {
|
|
96
97
|
var p;
|
|
97
98
|
if (ce(g.currentTarget)) return g.preventDefault();
|
|
98
99
|
n.change(b) && ((p = f.current) == null || p.focus());
|
|
99
|
-
}), { isFocusVisible: D, focusProps:
|
|
100
|
+
}), { isFocusVisible: D, focusProps: T } = se({ autoFocus: m }), { isHovered: O, hoverProps: w } = ue({ isDisabled: d }), h = ((t = a.firstOption) == null ? void 0 : t.id) === u, i = a.compare(a.value, b), G = de({ ref: E, id: u, role: "radio", "aria-checked": i ? "true" : "false", "aria-labelledby": x, "aria-describedby": c, "aria-disabled": d ? !0 : void 0, tabIndex: d ? -1 : i || !a.containsCheckedOption && h ? 0 : -1, autoFocus: m, onClick: d ? void 0 : A }, T, w), S = P(() => ({ checked: i, disabled: d, hover: O, focus: D, autofocus: m }), [i, d, O, D, m]);
|
|
100
101
|
return q({ ourProps: G, theirProps: N, slot: S, defaultTag: _e, name: "Radio" });
|
|
101
102
|
}
|
|
102
|
-
let Ke = W(ze), qe = W(Ve), pe = W(We), Be =
|
|
103
|
+
let Ke = W(ze), qe = W(Ve), pe = W(We), Be = Ce, Je = Pe, Xe = Object.assign(Ke, { Option: qe, Radio: pe, Label: Be, Description: Je });
|
|
103
104
|
const Qe = (e, r) => r.type === "SETVALUE" ? {
|
|
104
105
|
...e,
|
|
105
106
|
value: r.value,
|
|
@@ -108,7 +109,7 @@ const Qe = (e, r) => r.type === "SETVALUE" ? {
|
|
|
108
109
|
...e,
|
|
109
110
|
selected: r.selected,
|
|
110
111
|
value: z(r.selected, e.valueField) + ""
|
|
111
|
-
} : e,
|
|
112
|
+
} : e, ir = ({
|
|
112
113
|
options: e,
|
|
113
114
|
value: r,
|
|
114
115
|
valueField: t = "value",
|
|
@@ -142,7 +143,7 @@ const Qe = (e, r) => r.type === "SETVALUE" ? {
|
|
|
142
143
|
children: ({ checked: s }) => /* @__PURE__ */ ge("div", { className: "flex w-full items-center justify-between", children: [
|
|
143
144
|
/* @__PURE__ */ C("div", { className: "text-sm/6", children: /* @__PURE__ */ C("p", { className: "font-semibold", children: l.label }) }),
|
|
144
145
|
s ? /* @__PURE__ */ C(
|
|
145
|
-
|
|
146
|
+
Te,
|
|
146
147
|
{
|
|
147
148
|
className: M(
|
|
148
149
|
"size-6 transition fill-blue-600 opacity-0 group-hover:opacity-80",
|
|
@@ -150,7 +151,7 @@ const Qe = (e, r) => r.type === "SETVALUE" ? {
|
|
|
150
151
|
)
|
|
151
152
|
}
|
|
152
153
|
) : /* @__PURE__ */ C(
|
|
153
|
-
|
|
154
|
+
Oe,
|
|
154
155
|
{
|
|
155
156
|
className: M(
|
|
156
157
|
"size-6 transition text-gray-200 group-hover:text-blue-600"
|
|
@@ -165,5 +166,5 @@ const Qe = (e, r) => r.type === "SETVALUE" ? {
|
|
|
165
166
|
) });
|
|
166
167
|
};
|
|
167
168
|
export {
|
|
168
|
-
|
|
169
|
+
ir as default
|
|
169
170
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as i, jsx as t, Fragment as p } from "react/jsx-runtime";
|
|
2
2
|
import g, { Fragment as j } from "react";
|
|
3
|
-
import { H } from "../../
|
|
3
|
+
import { H } from "../../index-CsJbhhQY.js";
|
|
4
4
|
import { b as M } from "../../index-wvw0O1v3.js";
|
|
5
|
-
import { u as A, a as C, b as z, c as B, d as D, e as G, X as I } from "../../transition-
|
|
5
|
+
import { u as A, a as C, b as z, c as B, d as D, e as G, X as I } from "../../transition-DgjncSwT.js";
|
|
6
6
|
import { t as v } from "../../bundle-mjs-SHnj3fHy.js";
|
|
7
7
|
import { getValue as n } from "./helper.js";
|
|
8
|
-
import { M as P, U as X, G as _, V as $ } from "../../listbox-
|
|
9
|
-
import { o as O, f as q, s as J, a as K } from "../../floating-ui.react-dom-
|
|
8
|
+
import { M as P, U as X, G as _, V as $ } from "../../listbox-CJZgAdIt.js";
|
|
9
|
+
import { o as O, f as q, s as J, a as K } from "../../floating-ui.react-dom-YTFlGVA5.js";
|
|
10
10
|
const Q = (s, a) => a.type === "SETVALUE" ? {
|
|
11
11
|
...s,
|
|
12
12
|
value: a.value,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as f, jsx as l, Fragment as y } from "react/jsx-runtime";
|
|
2
2
|
import g, { Fragment as k } from "react";
|
|
3
3
|
import { _ as A } from "../../lodash-XYp3qmxI.js";
|
|
4
|
-
import { H as L } from "../../
|
|
4
|
+
import { H as L } from "../../index-CsJbhhQY.js";
|
|
5
5
|
import { b as H } from "../../index-wvw0O1v3.js";
|
|
6
|
-
import { u as C, a as _, b as z, c as D, d as G, e as I, X as O } from "../../transition-
|
|
6
|
+
import { u as C, a as _, b as z, c as D, d as G, e as I, X as O } from "../../transition-DgjncSwT.js";
|
|
7
7
|
import { t as h } from "../../bundle-mjs-SHnj3fHy.js";
|
|
8
8
|
import { getValue as n } from "./helper.js";
|
|
9
|
-
import { o as P, f as X, s as $, a as q } from "../../floating-ui.react-dom-
|
|
10
|
-
import { M as B, U as J, G as K, V as Q } from "../../listbox-
|
|
9
|
+
import { o as P, f as X, s as $, a as q } from "../../floating-ui.react-dom-YTFlGVA5.js";
|
|
10
|
+
import { M as B, U as J, G as K, V as Q } from "../../listbox-CJZgAdIt.js";
|
|
11
11
|
const W = (r, s) => s.type === "SETVALUE" ? {
|
|
12
12
|
...r,
|
|
13
13
|
value: s.value,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as X, jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import { W as A, K as Q, w as Y, z as Z, U as ee, H as F, u as te, a as ae, y as re, l as oe, T as le, p as ne, o as h, I as se, G as ie, $ as ue, b as ce, D as de, j as pe, r as fe, c as E, d as he } from "../../label-M2WV1DNi.js";
|
|
3
|
+
import n, { createContext as be, useState as I, useMemo as j, useId as me, useContext as ve, useRef as $e, useCallback as ge, Fragment as we } from "react";
|
|
4
|
+
import { w as xe, T as ke } from "../../use-resolve-button-type-WMDXx_9F.js";
|
|
5
|
+
let g = be(null);
|
|
6
|
+
g.displayName = "GroupContext";
|
|
7
|
+
let ye = we;
|
|
8
|
+
function Ce(a) {
|
|
9
|
+
var o;
|
|
10
|
+
let [e, l] = I(null), [s, b] = Z(), [m, r] = ee(), p = j(() => ({ switch: e, setSwitch: l }), [e, l]), v = {}, $ = a;
|
|
11
|
+
return n.createElement(r, { name: "Switch.Description", value: m }, n.createElement(b, { name: "Switch.Label", value: s, props: { htmlFor: (o = p.switch) == null ? void 0 : o.id, onClick(i) {
|
|
12
|
+
e && (i.currentTarget instanceof HTMLLabelElement && i.preventDefault(), e.click(), e.focus({ preventScroll: !0 }));
|
|
13
|
+
} } }, n.createElement(g.Provider, { value: p }, F({ ourProps: v, theirProps: $, slot: {}, defaultTag: ye, name: "Switch.Group" }))));
|
|
14
|
+
}
|
|
15
|
+
let De = "button";
|
|
16
|
+
function Pe(a, o) {
|
|
17
|
+
var e;
|
|
18
|
+
let l = me(), s = te(), b = ae(), { id: m = s || `headlessui-switch-${l}`, disabled: r = b || !1, checked: p, defaultChecked: v, onChange: $, name: i, value: N, form: G, autoFocus: f = !1, ...H } = a, w = ve(g), x = $e(null), K = re(x, o, w === null ? null : w.setSwitch), u = oe(v), [c, d] = le(p, $, u ?? !1), L = ne(), [k, y] = I(!1), C = h(() => {
|
|
19
|
+
y(!0), d == null || d(!c), L.nextFrame(() => {
|
|
20
|
+
y(!1);
|
|
21
|
+
});
|
|
22
|
+
}), _ = h((t) => {
|
|
23
|
+
if (fe(t.currentTarget)) return t.preventDefault();
|
|
24
|
+
t.preventDefault(), C();
|
|
25
|
+
}), M = h((t) => {
|
|
26
|
+
t.key === E.Space ? (t.preventDefault(), C()) : t.key === E.Enter && he(t.currentTarget);
|
|
27
|
+
}), R = h((t) => t.preventDefault()), U = se(), z = ie(), { isFocusVisible: D, focusProps: B } = ue({ autoFocus: f }), { isHovered: P, hoverProps: O } = ce({ isDisabled: r }), { pressed: S, pressProps: V } = xe({ disabled: r }), W = j(() => ({ checked: c, disabled: r, hover: P, focus: D, active: S, autofocus: f, changing: k }), [c, P, D, S, r, k, f]), q = de({ id: m, ref: K, role: "switch", type: ke(a, x), tabIndex: a.tabIndex === -1 ? 0 : (e = a.tabIndex) != null ? e : 0, "aria-checked": c, "aria-labelledby": U, "aria-describedby": z, disabled: r || void 0, autoFocus: f, onClick: _, onKeyUp: M, onKeyPress: R }, B, O, V), J = ge(() => {
|
|
28
|
+
if (u !== void 0) return d == null ? void 0 : d(u);
|
|
29
|
+
}, [d, u]);
|
|
30
|
+
return n.createElement(n.Fragment, null, i != null && n.createElement(pe, { disabled: r, data: { [i]: N || "on" }, overrides: { type: "checkbox", checked: c }, form: G, onReset: J }), F({ ourProps: q, theirProps: H, slot: W, defaultTag: De, name: "Switch" }));
|
|
31
|
+
}
|
|
32
|
+
let Se = A(Pe), Te = Ce, Ee = Q, Fe = Y, Ie = Object.assign(Se, { Group: Te, Label: Ee, Description: Fe });
|
|
33
|
+
const Ke = ({ checked: a, onChange: o, name: e, value: l }) => /* @__PURE__ */ X(
|
|
34
|
+
Ie,
|
|
35
|
+
{
|
|
36
|
+
checked: a,
|
|
37
|
+
onChange: (s) => o(s),
|
|
38
|
+
className: "group relative flex h-7 w-14 cursor-pointer rounded-full bg-gray-800/10 p-1 transition-colors duration-200 ease-in-out focus:outline-none data-[focus]:outline-1 data-[focus]:outline-white data-[checked]:bg-blue-500",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ T(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
className: "pointer-events-none inline-block size-5 translate-x-0 rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out group-data-[checked]:translate-x-7"
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ T(
|
|
48
|
+
"input",
|
|
49
|
+
{
|
|
50
|
+
type: "hidden",
|
|
51
|
+
className: "!hidden",
|
|
52
|
+
name: e,
|
|
53
|
+
value: a ? l : ""
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
export {
|
|
60
|
+
Ke as default
|
|
61
|
+
};
|
|
@@ -2,6 +2,8 @@ export * from './Button/';
|
|
|
2
2
|
export { default as Button } from './Button/';
|
|
3
3
|
export * from './Checkbox/';
|
|
4
4
|
export { default as Checkbox } from './Checkbox/';
|
|
5
|
+
export * from './Switch/';
|
|
6
|
+
export { default as Switch } from './Switch/';
|
|
5
7
|
export * from './Column/';
|
|
6
8
|
export { default as Column } from './Column/';
|
|
7
9
|
export * from './Container/';
|