anysystem-design 0.0.23 → 0.0.24
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as C, Fragment as ae } from "react/jsx-runtime";
|
|
2
2
|
import { G as ne } from "../../iconBase-Bipuk9tK.js";
|
|
3
3
|
import { t as x } from "../../bundle-mjs-SHnj3fHy.js";
|
|
4
4
|
import W from "../Icon/Icon.js";
|
|
@@ -7,9 +7,9 @@ import { $ as se, a as ie, r as ue } from "../../bugs-CHTtT8VX.js";
|
|
|
7
7
|
import y, { createContext as R, useRef as D, Fragment as Q, useReducer as ce, useMemo as w, useId as X, useEffect as Y, useContext as N } from "react";
|
|
8
8
|
import { w as de, T as pe } from "../../use-resolve-button-type-DkEA2l9L.js";
|
|
9
9
|
import { M as _, W as B, y as F, T as fe, o as E, u as M, H as L, I as Z, D as q } from "../../use-sync-refs-TDnk3jQt.js";
|
|
10
|
-
import { c as
|
|
11
|
-
import { u as
|
|
12
|
-
import { u as
|
|
10
|
+
import { c as ge, i as T, u as he, V as ye, A as be, s as ke } from "../../open-closed-CowzTowH.js";
|
|
11
|
+
import { u as ve } from "../../close-provider-Cs3ZWgEC.js";
|
|
12
|
+
import { u as me, o as S } from "../../keyboard-DnlWU23I.js";
|
|
13
13
|
var J;
|
|
14
14
|
let Pe = (J = y.startTransition) != null ? J : function(e) {
|
|
15
15
|
e();
|
|
@@ -25,18 +25,18 @@ let xe = { 0: (e) => ({ ...e, disclosureState: M(e.disclosureState, { 0: 1, 1: 0
|
|
|
25
25
|
return e.panelId === t.panelId ? e : { ...e, panelId: t.panelId };
|
|
26
26
|
} }, O = R(null);
|
|
27
27
|
O.displayName = "DisclosureContext";
|
|
28
|
-
function
|
|
28
|
+
function H(e) {
|
|
29
29
|
let t = N(O);
|
|
30
30
|
if (t === null) {
|
|
31
31
|
let r = new Error(`<${e} /> is missing a parent <Disclosure /> component.`);
|
|
32
|
-
throw Error.captureStackTrace && Error.captureStackTrace(r,
|
|
32
|
+
throw Error.captureStackTrace && Error.captureStackTrace(r, H), r;
|
|
33
33
|
}
|
|
34
34
|
return t;
|
|
35
35
|
}
|
|
36
|
-
let
|
|
37
|
-
|
|
36
|
+
let j = R(null);
|
|
37
|
+
j.displayName = "DisclosureAPIContext";
|
|
38
38
|
function ee(e) {
|
|
39
|
-
let t = N(
|
|
39
|
+
let t = N(j);
|
|
40
40
|
if (t === null) {
|
|
41
41
|
let r = new Error(`<${e} /> is missing a parent <Disclosure /> component.`);
|
|
42
42
|
throw Error.captureStackTrace && Error.captureStackTrace(r, ee), r;
|
|
@@ -52,34 +52,34 @@ function Ee(e, t) {
|
|
|
52
52
|
return M(t.type, xe, e, t);
|
|
53
53
|
}
|
|
54
54
|
let we = Q;
|
|
55
|
-
function
|
|
55
|
+
function Te(e, t) {
|
|
56
56
|
let { defaultOpen: r = !1, ...d } = e, n = D(null), i = F(t, fe((c) => {
|
|
57
57
|
n.current = c;
|
|
58
|
-
}, e.as === void 0 || e.as === Q)),
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
if (!
|
|
62
|
-
let P = c ? c instanceof HTMLElement ? c : c.current instanceof HTMLElement ? c.current :
|
|
58
|
+
}, e.as === void 0 || e.as === Q)), l = D(null), a = D(null), o = ce(Ee, { disclosureState: r ? 0 : 1, linkedPanel: !1, buttonRef: a, panelRef: l, buttonId: null, panelId: null }), [{ disclosureState: g, buttonId: u }, h] = o, f = E((c) => {
|
|
59
|
+
h({ type: 1 });
|
|
60
|
+
let k = me(n);
|
|
61
|
+
if (!k || !u) return;
|
|
62
|
+
let P = c ? c instanceof HTMLElement ? c : c.current instanceof HTMLElement ? c.current : k.getElementById(u) : k.getElementById(u);
|
|
63
63
|
P == null || P.focus();
|
|
64
|
-
}),
|
|
65
|
-
return y.createElement(O.Provider, { value: o }, y.createElement(
|
|
64
|
+
}), v = w(() => ({ close: f }), [f]), b = w(() => ({ open: g === 0, close: f }), [g, f]), m = { ref: i };
|
|
65
|
+
return y.createElement(O.Provider, { value: o }, y.createElement(j.Provider, { value: v }, y.createElement(ve, { value: f }, y.createElement(ge, { value: M(g, { 0: T.Open, 1: T.Closed }) }, L({ ourProps: m, theirProps: d, slot: b, defaultTag: we, name: "Disclosure" })))));
|
|
66
66
|
}
|
|
67
|
-
let
|
|
68
|
-
function
|
|
69
|
-
let r = X(), { id: d = `headlessui-disclosure-button-${r}`, disabled: n = !1, autoFocus: i = !1, ...
|
|
67
|
+
let Ce = "button";
|
|
68
|
+
function Ie(e, t) {
|
|
69
|
+
let r = X(), { id: d = `headlessui-disclosure-button-${r}`, disabled: n = !1, autoFocus: i = !1, ...l } = e, [a, o] = H("Disclosure.Button"), g = De(), u = g === null ? !1 : g === a.panelId, h = D(null), f = F(h, t, u ? null : a.buttonRef), v = Z();
|
|
70
70
|
Y(() => {
|
|
71
71
|
if (!u) return o({ type: 2, buttonId: d }), () => {
|
|
72
72
|
o({ type: 2, buttonId: null });
|
|
73
73
|
};
|
|
74
74
|
}, [d, o, u]);
|
|
75
|
-
let
|
|
75
|
+
let b = E((p) => {
|
|
76
76
|
var $;
|
|
77
77
|
if (u) {
|
|
78
|
-
if (
|
|
78
|
+
if (a.disclosureState === 1) return;
|
|
79
79
|
switch (p.key) {
|
|
80
80
|
case S.Space:
|
|
81
81
|
case S.Enter:
|
|
82
|
-
p.preventDefault(), p.stopPropagation(), o({ type: 0 }), ($ =
|
|
82
|
+
p.preventDefault(), p.stopPropagation(), o({ type: 0 }), ($ = a.buttonRef.current) == null || $.focus();
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
} else switch (p.key) {
|
|
@@ -88,7 +88,7 @@ function Ce(e, t) {
|
|
|
88
88
|
p.preventDefault(), p.stopPropagation(), o({ type: 0 });
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
|
-
}),
|
|
91
|
+
}), m = E((p) => {
|
|
92
92
|
switch (p.key) {
|
|
93
93
|
case S.Space:
|
|
94
94
|
p.preventDefault();
|
|
@@ -96,22 +96,22 @@ function Ce(e, t) {
|
|
|
96
96
|
}
|
|
97
97
|
}), c = E((p) => {
|
|
98
98
|
var $;
|
|
99
|
-
ue(p.currentTarget) || n || (u ? (o({ type: 0 }), ($ =
|
|
100
|
-
}), { isFocusVisible:
|
|
101
|
-
return L({ mergeRefs:
|
|
99
|
+
ue(p.currentTarget) || n || (u ? (o({ type: 0 }), ($ = a.buttonRef.current) == null || $.focus()) : o({ type: 0 }));
|
|
100
|
+
}), { isFocusVisible: k, focusProps: P } = se({ autoFocus: i }), { isHovered: V, hoverProps: z } = ie({ isDisabled: n }), { pressed: A, pressProps: G } = de({ disabled: n }), te = w(() => ({ open: a.disclosureState === 0, hover: V, active: A, disabled: n, focus: k, autofocus: i }), [a, V, A, k, n, i]), K = pe(e, h), le = u ? q({ ref: f, type: K, disabled: n || void 0, autoFocus: i, onKeyDown: b, onClick: c }, P, z, G) : q({ ref: f, id: d, type: K, "aria-expanded": a.disclosureState === 0, "aria-controls": a.linkedPanel ? a.panelId : void 0, disabled: n || void 0, autoFocus: i, onKeyDown: b, onKeyUp: m, onClick: c }, P, z, G);
|
|
101
|
+
return L({ mergeRefs: v, ourProps: le, theirProps: l, slot: te, defaultTag: Ce, name: "Disclosure.Button" });
|
|
102
102
|
}
|
|
103
103
|
let Re = "div", Ne = _.RenderStrategy | _.Static;
|
|
104
104
|
function Be(e, t) {
|
|
105
|
-
let r = X(), { id: d = `headlessui-disclosure-panel-${r}`, transition: n = !1, ...i } = e, [
|
|
106
|
-
Pe(() =>
|
|
105
|
+
let r = X(), { id: d = `headlessui-disclosure-panel-${r}`, transition: n = !1, ...i } = e, [l, a] = H("Disclosure.Panel"), { close: o } = ee("Disclosure.Panel"), g = Z(), u = F(t, l.panelRef, (c) => {
|
|
106
|
+
Pe(() => a({ type: c ? 4 : 5 }));
|
|
107
107
|
});
|
|
108
|
-
Y(() => (
|
|
109
|
-
|
|
110
|
-
}), [d,
|
|
111
|
-
let
|
|
112
|
-
return y.createElement(
|
|
108
|
+
Y(() => (a({ type: 3, panelId: d }), () => {
|
|
109
|
+
a({ type: 3, panelId: null });
|
|
110
|
+
}), [d, a]);
|
|
111
|
+
let h = he(), [f, v] = ye(n, l.panelRef, h !== null ? (h & T.Open) === T.Open : l.disclosureState === 0), b = w(() => ({ open: l.disclosureState === 0, close: o }), [l.disclosureState, o]), m = { ref: u, id: d, ...be(v) };
|
|
112
|
+
return y.createElement(ke, null, y.createElement(U.Provider, { value: l.panelId }, L({ mergeRefs: g, ourProps: m, theirProps: i, slot: b, defaultTag: Re, features: Ne, visible: f, name: "Disclosure.Panel" })));
|
|
113
113
|
}
|
|
114
|
-
let Fe = B(
|
|
114
|
+
let Fe = B(Te), I = B(Ie), re = B(Be), Me = Object.assign(Fe, { Button: I, Panel: re });
|
|
115
115
|
function Le(e) {
|
|
116
116
|
return ne({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708" }, child: [] }] })(e);
|
|
117
117
|
}
|
|
@@ -119,9 +119,9 @@ const Je = ({ list: e }) => {
|
|
|
119
119
|
const t = oe();
|
|
120
120
|
return /* @__PURE__ */ s("nav", { className: "w-full bg-white px-4 py-6 dark:bg-gray-950", children: /* @__PURE__ */ s("ul", { children: e && e.map((r, d) => /* @__PURE__ */ s("li", { children: r != null && r.title ? /* @__PURE__ */ s("div", { className: "px-3 py-2 text-sm font-bold dark:text-white", children: r.label }) : r.list ? /* @__PURE__ */ s(Me, { as: "div", children: ({ open: n }) => {
|
|
121
121
|
var i;
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
|
|
122
|
+
return /* @__PURE__ */ C(ae, { children: [
|
|
123
|
+
/* @__PURE__ */ C(
|
|
124
|
+
I,
|
|
125
125
|
{
|
|
126
126
|
className: x(
|
|
127
127
|
"flex w-full items-center gap-2 rounded p-3 text-left font-semibold hover:bg-primary-50 dark:text-white dark:hover:bg-gray-700"
|
|
@@ -142,24 +142,24 @@ const Je = ({ list: e }) => {
|
|
|
142
142
|
]
|
|
143
143
|
}
|
|
144
144
|
),
|
|
145
|
-
/* @__PURE__ */ s(re, { as: "ul", className: "mt-1 px-2", children: (i = r == null ? void 0 : r.list) == null ? void 0 : i.map((
|
|
146
|
-
|
|
145
|
+
/* @__PURE__ */ s(re, { as: "ul", className: "mt-1 px-2", children: (i = r == null ? void 0 : r.list) == null ? void 0 : i.map((l, a) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(
|
|
146
|
+
I,
|
|
147
147
|
{
|
|
148
148
|
as: "a",
|
|
149
|
-
href:
|
|
149
|
+
href: l == null ? void 0 : l.path,
|
|
150
150
|
className: x(
|
|
151
151
|
"block rounded py-2 pl-9 pr-2 text-gray-700 hover:bg-primary-50 dark:text-white dark:hover:bg-gray-700",
|
|
152
|
-
t.pathname ===
|
|
152
|
+
t.pathname === l.path && "bg-primary-50 dark:bg-gray-700"
|
|
153
153
|
),
|
|
154
|
-
onClick:
|
|
155
|
-
children:
|
|
154
|
+
onClick: l == null ? void 0 : l.onClick,
|
|
155
|
+
children: l.label
|
|
156
156
|
}
|
|
157
|
-
) },
|
|
157
|
+
) }, a)) })
|
|
158
158
|
] });
|
|
159
|
-
} }) : /* @__PURE__ */
|
|
159
|
+
} }) : /* @__PURE__ */ C(
|
|
160
160
|
"a",
|
|
161
161
|
{
|
|
162
|
-
href: r
|
|
162
|
+
href: r == null ? void 0 : r.path,
|
|
163
163
|
className: x(
|
|
164
164
|
"flex w-full items-center justify-start gap-2 rounded p-3 font-semibold hover:bg-primary-50 dark:text-white dark:hover:bg-gray-800",
|
|
165
165
|
t.pathname === r.path ? "bg-primary-50 dark:bg-gray-800" : ""
|