@noxickon/onyx 0.1.0 → 1.0.0
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/chunks/hooks-DiKvsNs-.js +48 -0
- package/dist/chunks/hooks-bJFfbTks.js +8624 -0
- package/dist/chunks/query-BhvXa-m6.js +10 -0
- package/dist/chunks/query-iDn3qBGF.js +14 -0
- package/dist/chunks/ui-ChsTPgui.js +41 -0
- package/dist/chunks/ui-DxsSYHCv.js +20634 -0
- package/dist/chunks/useAuth-BFgXzu6Q.js +12 -0
- package/dist/chunks/useAuth-DxoDe3YA.js +1 -0
- package/dist/contexts/contexts.cjs.js +5 -0
- package/dist/contexts/contexts.es.js +156 -0
- package/dist/contexts.d.ts +117 -0
- package/dist/hooks/hooks.cjs.js +1 -6
- package/dist/hooks/hooks.es.js +11 -1916
- package/dist/hooks.d.ts +79 -21
- package/dist/index.d.ts +1782 -268
- package/dist/layouts/layouts.cjs.js +1 -0
- package/dist/layouts/layouts.es.js +688 -0
- package/dist/layouts.d.ts +430 -0
- package/dist/onyx.cjs.js +1 -1
- package/dist/onyx.es.js +53 -1395
- package/dist/pages/pages.cjs.js +2 -2
- package/dist/pages/pages.es.js +71 -69
- package/dist/pages.d.ts +4 -4
- package/dist/routes/routes.cjs.js +1 -0
- package/dist/routes/routes.es.js +31 -0
- package/dist/routes.d.ts +28 -0
- package/dist/shared.css +77 -48
- package/dist/ui.css +1 -0
- package/dist/utils/utils.cjs.js +1 -1
- package/dist/utils/utils.es.js +20 -6
- package/dist/utils.d.ts +109 -5
- package/package.json +39 -28
- package/dist/chunks/AuthContext-CaZKJMxQ.js +0 -2149
- package/dist/chunks/AuthContext-uU1aP9gj.js +0 -31
- package/dist/chunks/Button-D-v4l8ZE.js +0 -20
- package/dist/chunks/Button-bARrxYyo.js +0 -11053
- package/dist/chunks/Input-CLi1H63d.js +0 -1
- package/dist/chunks/Input-dfvmdIHi.js +0 -138
- package/dist/chunks/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/chunks/_commonjsHelpers-DwGv2jUC.js +0 -1
- package/dist/chunks/constants-B1_n9ezb.js +0 -1
- package/dist/chunks/constants-CDXq37n6.js +0 -4
- package/dist/chunks/errorHelper-DbQKxxQA.js +0 -1
- package/dist/chunks/errorHelper-qN6iGI6f.js +0 -18
- package/dist/chunks/formatTimestamp-CMxOnPo1.js +0 -12
- package/dist/chunks/formatTimestamp-TTsNcy7u.js +0 -1
- package/dist/chunks/index-CPwC_oqh.js +0 -561
- package/dist/chunks/index-DY808_YF.js +0 -2
- package/dist/chunks/isObject-BDHKUJKN.js +0 -1
- package/dist/chunks/isObject-vmP43YLW.js +0 -6
- package/dist/chunks/jsx-runtime--oOP9f8K.js +0 -284
- package/dist/chunks/jsx-runtime-CITbqOLs.js +0 -22
- package/dist/chunks/tslib.es6-ci7D5hcx.js +0 -44
- package/dist/chunks/tslib.es6-nRfFZWHa.js +0 -1
- package/dist/chunks/useAuth-BsWbsZD5.js +0 -1
- package/dist/chunks/useAuth-CkaMowHd.js +0 -11
- package/dist/chunks/useForm-BuzPPZZE.js +0 -3070
- package/dist/chunks/useForm-F8doF8lW.js +0 -18
- package/dist/chunks/useQuery-Dh3SZN5S.js +0 -1482
- package/dist/chunks/useQuery-y4De9xeL.js +0 -2
- package/dist/context/context.cjs.js +0 -1
- package/dist/context/context.es.js +0 -39
- package/dist/context.d.ts +0 -47
- package/dist/index.css +0 -1
- package/dist/layout/layout.cjs.js +0 -1
- package/dist/layout/layout.es.js +0 -265
- package/dist/layout.d.ts +0 -90
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
import { _ as s, $ as r, e as f, a1 as j, i as h, l as y, a2 as D, c as $, u as G, t as P } from "../chunks/ui-DxsSYHCv.js";
|
|
2
|
+
import { createContext as w, useState as v, useMemo as R, useEffect as k, useContext as N, useCallback as S } from "react";
|
|
3
|
+
const Ne = ({
|
|
4
|
+
brand: e,
|
|
5
|
+
children: a,
|
|
6
|
+
className: t,
|
|
7
|
+
hasSidebar: o = !1,
|
|
8
|
+
navClassName: n,
|
|
9
|
+
toggleSidebar: i,
|
|
10
|
+
...l
|
|
11
|
+
}) => /* @__PURE__ */ s.jsx(
|
|
12
|
+
"header",
|
|
13
|
+
{
|
|
14
|
+
className: r("max-h-15 min-h-15 sticky top-0 z-10 bg-gray-100", t),
|
|
15
|
+
"data-ox-slot": "header",
|
|
16
|
+
...l,
|
|
17
|
+
children: /* @__PURE__ */ s.jsxs(
|
|
18
|
+
"nav",
|
|
19
|
+
{
|
|
20
|
+
className: r(
|
|
21
|
+
"max-w-10xl mx-auto flex items-center justify-between px-4 py-2.5",
|
|
22
|
+
n
|
|
23
|
+
),
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ s.jsxs("div", { className: "flex items-center gap-[17px]", children: [
|
|
26
|
+
o ? /* @__PURE__ */ s.jsx(
|
|
27
|
+
f,
|
|
28
|
+
{
|
|
29
|
+
"aria-label": "Open menu",
|
|
30
|
+
"data-ox-slot": "header-toggle",
|
|
31
|
+
size: "md",
|
|
32
|
+
variant: "ghost",
|
|
33
|
+
onClick: i,
|
|
34
|
+
children: /* @__PURE__ */ s.jsx(f.Icon, { path: "mdiMenu" })
|
|
35
|
+
}
|
|
36
|
+
) : null,
|
|
37
|
+
e ? /* @__PURE__ */ s.jsx("div", { children: e }) : null
|
|
38
|
+
] }),
|
|
39
|
+
a
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
), I = "group ox-gray-inset-focus items-center rounded-lg text-sm transition-colors text-left col-span-2 grid grid-cols-subgrid", E = "size-10 justify-center", _ = "h-10 w-full px-2", L = "bg-gray-300 text-gray-1200", W = "h-15", B = w(void 0), Y = ({
|
|
45
|
+
children: e,
|
|
46
|
+
className: a,
|
|
47
|
+
desktopCollapsed: t = !1,
|
|
48
|
+
hasHeader: o = !1,
|
|
49
|
+
mobileCollapsed: n = !0,
|
|
50
|
+
onClose: i,
|
|
51
|
+
...l
|
|
52
|
+
}) => {
|
|
53
|
+
const [d, x] = v(window.innerWidth < j), b = d ? n : t, O = R(
|
|
54
|
+
() => ({ collapsed: b, isMobile: d }),
|
|
55
|
+
[b, d]
|
|
56
|
+
);
|
|
57
|
+
return k(() => {
|
|
58
|
+
const c = () => {
|
|
59
|
+
x(window.innerWidth < j);
|
|
60
|
+
};
|
|
61
|
+
return c(), window.addEventListener("resize", c), () => {
|
|
62
|
+
window.removeEventListener("resize", c);
|
|
63
|
+
};
|
|
64
|
+
}, []), /* @__PURE__ */ s.jsx(B.Provider, { value: O, children: d ? /* @__PURE__ */ s.jsx(h, { open: !b, onOpenChange: (c) => !c && i?.(), children: /* @__PURE__ */ s.jsx(h.Content, { closeOnOutsideClick: !!i, side: "left", ...l, children: /* @__PURE__ */ s.jsxs(
|
|
65
|
+
"nav",
|
|
66
|
+
{
|
|
67
|
+
"aria-label": "Mobile navigation",
|
|
68
|
+
className: r("flex h-screen w-full flex-col bg-gray-100", a),
|
|
69
|
+
"data-ox-slot": "sidebar",
|
|
70
|
+
role: "navigation",
|
|
71
|
+
...l,
|
|
72
|
+
children: [
|
|
73
|
+
i ? /* @__PURE__ */ s.jsx("div", { className: r("h-15 flex items-center gap-[17px] px-4", W), children: /* @__PURE__ */ s.jsx(f, { "aria-label": "Close sidebar", size: "md", variant: "ghost", onClick: i, children: /* @__PURE__ */ s.jsx(f.Icon, { path: "mdiClose" }) }) }) : null,
|
|
74
|
+
e
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) }) }) : /* @__PURE__ */ s.jsx(
|
|
78
|
+
"nav",
|
|
79
|
+
{
|
|
80
|
+
"aria-label": "Desktop navigation",
|
|
81
|
+
className: r(
|
|
82
|
+
"sticky box-content flex flex-col overflow-y-auto bg-gray-100",
|
|
83
|
+
{
|
|
84
|
+
"top-0 h-screen": !o,
|
|
85
|
+
"viewport-minus-header top-15": o,
|
|
86
|
+
'max-w-18 min-w-18 [&_[data-ox-slot="sidebar-label"]]:hidden': b,
|
|
87
|
+
"min-w-64 max-w-64": !b
|
|
88
|
+
},
|
|
89
|
+
a
|
|
90
|
+
),
|
|
91
|
+
"data-ox-slot": "sidebar",
|
|
92
|
+
role: "navigation",
|
|
93
|
+
...l,
|
|
94
|
+
children: e
|
|
95
|
+
}
|
|
96
|
+
) });
|
|
97
|
+
}, g = () => {
|
|
98
|
+
const e = N(B);
|
|
99
|
+
if (!e)
|
|
100
|
+
throw new Error("useSidebar must be used within a SidebarProvider");
|
|
101
|
+
return e;
|
|
102
|
+
}, F = ({ children: e, className: a, ...t }) => {
|
|
103
|
+
const { collapsed: o, isMobile: n } = g();
|
|
104
|
+
return /* @__PURE__ */ s.jsx(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
className: r(
|
|
108
|
+
"grid flex-1 content-start gap-y-1 overflow-y-auto p-4",
|
|
109
|
+
{
|
|
110
|
+
"grid-cols-1 place-items-center": o && !n,
|
|
111
|
+
"grid-cols-[auto_1fr]": !o || n
|
|
112
|
+
},
|
|
113
|
+
'[&_[data-ox-slot="sidebar-link"]]:col-span-2 [&_[data-ox-slot="sidebar-link"]]:grid [&_[data-ox-slot="sidebar-link"]]:grid-cols-subgrid',
|
|
114
|
+
'[&_[data-ox-slot="sidebar-button"]]:col-span-2 [&_[data-ox-slot="sidebar-button"]]:grid [&_[data-ox-slot="sidebar-button"]]:grid-cols-subgrid',
|
|
115
|
+
'[&_[data-ox-slot="sidebar-icon"]]:justify-self-center [&_[data-ox-slot="sidebar-icon"]]:[grid-column-start:var(--ox-menu-icon-col)]',
|
|
116
|
+
'[&_[data-ox-slot="sidebar-label"]]:[grid-column-start:var(--ox-menu-label-col)]',
|
|
117
|
+
a
|
|
118
|
+
),
|
|
119
|
+
"data-ox-slot": "sidebar-body",
|
|
120
|
+
...t,
|
|
121
|
+
children: e
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
}, V = ({
|
|
125
|
+
active: e = !1,
|
|
126
|
+
children: a,
|
|
127
|
+
className: t,
|
|
128
|
+
disabled: o = !1,
|
|
129
|
+
...n
|
|
130
|
+
}) => {
|
|
131
|
+
const { collapsed: i } = g();
|
|
132
|
+
return /* @__PURE__ */ s.jsx(
|
|
133
|
+
"button",
|
|
134
|
+
{
|
|
135
|
+
className: r(
|
|
136
|
+
"enabled:text-gray-1000 enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300",
|
|
137
|
+
I,
|
|
138
|
+
{
|
|
139
|
+
[E]: i,
|
|
140
|
+
[_]: !i,
|
|
141
|
+
[L]: e && !o,
|
|
142
|
+
"disabled:ox-default-disabled": o
|
|
143
|
+
},
|
|
144
|
+
t
|
|
145
|
+
),
|
|
146
|
+
"data-ox-slot": "sidebar-button",
|
|
147
|
+
disabled: o,
|
|
148
|
+
type: "button",
|
|
149
|
+
...n,
|
|
150
|
+
"data-ox-state": e ? "active" : "inactive",
|
|
151
|
+
children: a
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}, K = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx("div", { className: r("p-4", a), "data-ox-slot": "sidebar-footer", ...t, children: e }), q = ({
|
|
155
|
+
children: e,
|
|
156
|
+
className: a,
|
|
157
|
+
headline: t,
|
|
158
|
+
...o
|
|
159
|
+
}) => {
|
|
160
|
+
const { collapsed: n, isMobile: i } = g();
|
|
161
|
+
return /* @__PURE__ */ s.jsxs("div", { className: r("contents", a), "data-ox-slot": "sidebar-group", ...o, children: [
|
|
162
|
+
/* @__PURE__ */ s.jsx(
|
|
163
|
+
"h3",
|
|
164
|
+
{
|
|
165
|
+
className: r("text-gray-1000 col-span-full mb-2 mt-4 block cursor-default text-xs", {
|
|
166
|
+
invisible: n && !i
|
|
167
|
+
}),
|
|
168
|
+
children: t
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
e
|
|
172
|
+
] });
|
|
173
|
+
}, J = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: r("h-15 flex items-center px-4", a),
|
|
177
|
+
"data-ox-slot": "sidebar-header",
|
|
178
|
+
...t,
|
|
179
|
+
children: e
|
|
180
|
+
}
|
|
181
|
+
), Q = ({ className: e, size: a = 0.8, ...t }) => {
|
|
182
|
+
const { collapsed: o } = g();
|
|
183
|
+
return /* @__PURE__ */ s.jsx(
|
|
184
|
+
y,
|
|
185
|
+
{
|
|
186
|
+
className: r("shrink-0 text-current", { "mr-2": !o }, e),
|
|
187
|
+
"data-ox-slot": "sidebar-icon",
|
|
188
|
+
size: a,
|
|
189
|
+
...t
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}, U = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
193
|
+
"span",
|
|
194
|
+
{
|
|
195
|
+
className: r("overflow-hidden text-ellipsis", a),
|
|
196
|
+
"data-ox-slot": "sidebar-label",
|
|
197
|
+
...t,
|
|
198
|
+
children: e
|
|
199
|
+
}
|
|
200
|
+
), X = ({
|
|
201
|
+
active: e = !1,
|
|
202
|
+
children: a,
|
|
203
|
+
className: t,
|
|
204
|
+
disabled: o = !1,
|
|
205
|
+
href: n,
|
|
206
|
+
...i
|
|
207
|
+
}) => {
|
|
208
|
+
const { collapsed: l } = g();
|
|
209
|
+
return /* @__PURE__ */ s.jsx(
|
|
210
|
+
"a",
|
|
211
|
+
{
|
|
212
|
+
"aria-current": e ? "page" : void 0,
|
|
213
|
+
className: r(
|
|
214
|
+
I,
|
|
215
|
+
{
|
|
216
|
+
[E]: l,
|
|
217
|
+
[_]: !l,
|
|
218
|
+
[L]: e && !o,
|
|
219
|
+
"text-gray-1000 hover:text-gray-1200 cursor-pointer hover:bg-gray-300": !e && !o,
|
|
220
|
+
"ox-default-disabled": o
|
|
221
|
+
},
|
|
222
|
+
t
|
|
223
|
+
),
|
|
224
|
+
"data-ox-slot": "sidebar-link",
|
|
225
|
+
href: o ? void 0 : n,
|
|
226
|
+
role: "link",
|
|
227
|
+
onClick: o ? (d) => d.preventDefault() : void 0,
|
|
228
|
+
...i,
|
|
229
|
+
"data-ox-state": e ? "active" : "inactive",
|
|
230
|
+
children: a
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
}, m = Y;
|
|
234
|
+
m.Body = F;
|
|
235
|
+
m.Button = V;
|
|
236
|
+
m.Footer = K;
|
|
237
|
+
m.Group = q;
|
|
238
|
+
m.Header = J;
|
|
239
|
+
m.Icon = Q;
|
|
240
|
+
m.Label = U;
|
|
241
|
+
m.Link = X;
|
|
242
|
+
const Me = ({
|
|
243
|
+
children: e,
|
|
244
|
+
className: a,
|
|
245
|
+
color: t = "purple",
|
|
246
|
+
icon: o,
|
|
247
|
+
subtitle: n,
|
|
248
|
+
title: i,
|
|
249
|
+
...l
|
|
250
|
+
}) => {
|
|
251
|
+
const d = i || n || o, x = D[t];
|
|
252
|
+
return /* @__PURE__ */ s.jsxs(
|
|
253
|
+
"main",
|
|
254
|
+
{
|
|
255
|
+
"aria-labelledby": d ? "main-headline" : void 0,
|
|
256
|
+
className: r("w-full p-6", a),
|
|
257
|
+
"data-ox-slot": "main-content",
|
|
258
|
+
...l,
|
|
259
|
+
children: [
|
|
260
|
+
d ? /* @__PURE__ */ s.jsx("div", { className: "mb-8 border-b border-gray-400 pb-6", children: /* @__PURE__ */ s.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
261
|
+
o ? /* @__PURE__ */ s.jsx("div", { className: r("rounded-lg border p-3", x.border, x.background), children: /* @__PURE__ */ s.jsx(y, { className: x.text, path: o, size: 1.41 }) }) : null,
|
|
262
|
+
/* @__PURE__ */ s.jsxs("div", { children: [
|
|
263
|
+
i ? /* @__PURE__ */ s.jsx(
|
|
264
|
+
"h2",
|
|
265
|
+
{
|
|
266
|
+
id: "main-headline",
|
|
267
|
+
className: "text-gray-1200 text-xl font-semibold",
|
|
268
|
+
"data-ox-slot": "main-headline",
|
|
269
|
+
children: i
|
|
270
|
+
}
|
|
271
|
+
) : null,
|
|
272
|
+
n && /* @__PURE__ */ s.jsx("p", { className: "mt-1 text-sm", children: n })
|
|
273
|
+
] })
|
|
274
|
+
] }) }) : null,
|
|
275
|
+
e
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
}, Ce = ({ children: e, className: a, ...t }) => {
|
|
280
|
+
const { isMobile: o } = M();
|
|
281
|
+
return /* @__PURE__ */ s.jsx(
|
|
282
|
+
"div",
|
|
283
|
+
{
|
|
284
|
+
className: r(
|
|
285
|
+
"max-w-10xl mx-auto grid min-h-screen bg-transparent",
|
|
286
|
+
o ? "grid-cols-1" : "grid-cols-[auto_1fr]",
|
|
287
|
+
a
|
|
288
|
+
),
|
|
289
|
+
"data-ox-slot": "app-layout",
|
|
290
|
+
...t,
|
|
291
|
+
children: e
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}, Z = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
295
|
+
"main",
|
|
296
|
+
{
|
|
297
|
+
className: r("flex flex-col overflow-y-auto", a),
|
|
298
|
+
"data-ox-slot": "main-content",
|
|
299
|
+
...t,
|
|
300
|
+
children: e
|
|
301
|
+
}
|
|
302
|
+
), ee = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
className: r("flex-1 overflow-y-auto px-6 py-6", a),
|
|
306
|
+
"data-ox-slot": "main-content-body",
|
|
307
|
+
...t,
|
|
308
|
+
children: e
|
|
309
|
+
}
|
|
310
|
+
), te = ({
|
|
311
|
+
children: e,
|
|
312
|
+
className: a,
|
|
313
|
+
...t
|
|
314
|
+
}) => /* @__PURE__ */ s.jsx(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
className: r("flex-shrink-0 border-b border-gray-400 bg-gray-100 px-6 py-4", a),
|
|
318
|
+
"data-ox-slot": "main-content-header",
|
|
319
|
+
...t,
|
|
320
|
+
children: e
|
|
321
|
+
}
|
|
322
|
+
), ke = Object.assign(Z, {
|
|
323
|
+
Header: te,
|
|
324
|
+
Body: ee
|
|
325
|
+
}), T = w(void 0);
|
|
326
|
+
function M() {
|
|
327
|
+
const e = N(T);
|
|
328
|
+
if (!e)
|
|
329
|
+
throw new Error("useOxSidebar must be used within a SidebarProvider");
|
|
330
|
+
return e;
|
|
331
|
+
}
|
|
332
|
+
const ae = 256, se = ({ children: e, className: a, ...t }) => {
|
|
333
|
+
const { isMobile: o, mobileOpen: n, toggleSidebar: i } = M();
|
|
334
|
+
return o ? /* @__PURE__ */ s.jsx(h, { open: n, onOpenChange: i, children: /* @__PURE__ */ s.jsx(h.Content, { closeOnOutsideClick: !0, side: "left", children: /* @__PURE__ */ s.jsx(
|
|
335
|
+
"aside",
|
|
336
|
+
{
|
|
337
|
+
className: r("bg-gray-150 flex h-full flex-col", a),
|
|
338
|
+
"data-ox-slot": "sidebar",
|
|
339
|
+
...t,
|
|
340
|
+
children: e
|
|
341
|
+
}
|
|
342
|
+
) }) }) : /* @__PURE__ */ s.jsx(
|
|
343
|
+
"aside",
|
|
344
|
+
{
|
|
345
|
+
className: r("bg-gray-150 sticky top-0 flex h-screen flex-col overflow-y-auto", a),
|
|
346
|
+
"data-ox-slot": "sidebar",
|
|
347
|
+
style: { width: ae },
|
|
348
|
+
...t,
|
|
349
|
+
children: e
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
}, oe = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
353
|
+
"div",
|
|
354
|
+
{
|
|
355
|
+
className: r("flex-1 overflow-y-auto p-2", a),
|
|
356
|
+
"data-ox-slot": "sidebar-content",
|
|
357
|
+
...t,
|
|
358
|
+
children: e
|
|
359
|
+
}
|
|
360
|
+
), re = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
className: r("flex shrink-0 flex-col p-2", a),
|
|
364
|
+
"data-ox-slot": "sidebar-footer",
|
|
365
|
+
...t,
|
|
366
|
+
children: e
|
|
367
|
+
}
|
|
368
|
+
), ne = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
369
|
+
"div",
|
|
370
|
+
{
|
|
371
|
+
className: r(
|
|
372
|
+
"flex flex-wrap items-center gap-2",
|
|
373
|
+
'[&_[data-ox-slot="sidebar-group-content"]]:w-full',
|
|
374
|
+
a
|
|
375
|
+
),
|
|
376
|
+
"data-ox-slot": "sidebar-group",
|
|
377
|
+
...t,
|
|
378
|
+
children: e
|
|
379
|
+
}
|
|
380
|
+
), ie = ({
|
|
381
|
+
children: e,
|
|
382
|
+
className: a,
|
|
383
|
+
...t
|
|
384
|
+
}) => /* @__PURE__ */ s.jsx(
|
|
385
|
+
"button",
|
|
386
|
+
{
|
|
387
|
+
className: r(
|
|
388
|
+
"mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-md",
|
|
389
|
+
"enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:text-gray-900 enabled:hover:bg-gray-300",
|
|
390
|
+
"ox-gray-outset-focus disabled:ox-default-disabled",
|
|
391
|
+
a
|
|
392
|
+
),
|
|
393
|
+
"data-ox-slot": "sidebar-group-action",
|
|
394
|
+
type: "button",
|
|
395
|
+
...t,
|
|
396
|
+
children: e
|
|
397
|
+
}
|
|
398
|
+
), le = ({
|
|
399
|
+
children: e,
|
|
400
|
+
className: a,
|
|
401
|
+
...t
|
|
402
|
+
}) => /* @__PURE__ */ s.jsx("div", { className: r(a), "data-ox-slot": "sidebar-group-content", ...t, children: e }), de = ({
|
|
403
|
+
children: e,
|
|
404
|
+
className: a,
|
|
405
|
+
...t
|
|
406
|
+
}) => /* @__PURE__ */ s.jsx(
|
|
407
|
+
"div",
|
|
408
|
+
{
|
|
409
|
+
className: r("flex flex-1 items-center pl-2 text-xs font-medium text-gray-900", a),
|
|
410
|
+
"data-ox-slot": "sidebar-group-label",
|
|
411
|
+
...t,
|
|
412
|
+
children: e
|
|
413
|
+
}
|
|
414
|
+
), xe = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
className: r("flex shrink-0 flex-col p-2", a),
|
|
418
|
+
"data-ox-slot": "sidebar-header",
|
|
419
|
+
...t,
|
|
420
|
+
children: e
|
|
421
|
+
}
|
|
422
|
+
), ce = ({ children: e, className: a, ...t }) => /* @__PURE__ */ s.jsx(
|
|
423
|
+
"ul",
|
|
424
|
+
{
|
|
425
|
+
className: r("flex flex-col items-stretch gap-1", a),
|
|
426
|
+
"data-ox-slot": "sidebar-menu",
|
|
427
|
+
...t,
|
|
428
|
+
children: e
|
|
429
|
+
}
|
|
430
|
+
), ue = ({
|
|
431
|
+
children: e,
|
|
432
|
+
className: a,
|
|
433
|
+
...t
|
|
434
|
+
}) => /* @__PURE__ */ s.jsx(
|
|
435
|
+
"button",
|
|
436
|
+
{
|
|
437
|
+
className: r(
|
|
438
|
+
"inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-transparent",
|
|
439
|
+
"enabled:text-gray-1200 enabled:cursor-pointer enabled:bg-transparent enabled:hover:bg-gray-300",
|
|
440
|
+
"ox-gray-outset-focus disabled:ox-default-disabled",
|
|
441
|
+
a
|
|
442
|
+
),
|
|
443
|
+
"data-ox-slot": "sidebar-menu-action",
|
|
444
|
+
type: "button",
|
|
445
|
+
...t,
|
|
446
|
+
children: e
|
|
447
|
+
}
|
|
448
|
+
), be = ({ children: e, className: a }) => /* @__PURE__ */ s.jsx($, { className: r("ml-auto", a), "data-ox-slot": "sidebar-menu-badge", size: "sm", children: e }), z = w(void 0), A = () => {
|
|
449
|
+
const e = N(z);
|
|
450
|
+
if (!e)
|
|
451
|
+
throw new Error("useMenuItemContext must be used within MenuItemProvider");
|
|
452
|
+
return e;
|
|
453
|
+
}, H = ({ className: e, path: a, placeholder: t }) => /* @__PURE__ */ s.jsx(
|
|
454
|
+
y,
|
|
455
|
+
{
|
|
456
|
+
className: r("shrink-0", e),
|
|
457
|
+
"data-ox-slot": "sidebar-menu-icon",
|
|
458
|
+
path: a,
|
|
459
|
+
placeholder: t,
|
|
460
|
+
size: 0.8
|
|
461
|
+
}
|
|
462
|
+
), me = ({
|
|
463
|
+
children: e,
|
|
464
|
+
className: a,
|
|
465
|
+
disabled: t = !1,
|
|
466
|
+
href: o,
|
|
467
|
+
onClick: n,
|
|
468
|
+
...i
|
|
469
|
+
}) => {
|
|
470
|
+
const { hasSub: l, isOpen: d, toggleOpen: x } = A(), b = r(
|
|
471
|
+
"flex h-9 flex-1 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-left text-sm",
|
|
472
|
+
"ox-gray-outset-focus",
|
|
473
|
+
a
|
|
474
|
+
);
|
|
475
|
+
if (o)
|
|
476
|
+
return /* @__PURE__ */ s.jsx(
|
|
477
|
+
"a",
|
|
478
|
+
{
|
|
479
|
+
"aria-disabled": t ? "true" : void 0,
|
|
480
|
+
className: r(b, {
|
|
481
|
+
"text-gray-1200 cursor-pointer hover:bg-gray-300": !t,
|
|
482
|
+
"ox-default-disabled": t
|
|
483
|
+
}),
|
|
484
|
+
"data-ox-slot": "sidebar-menu-button",
|
|
485
|
+
href: t ? void 0 : o,
|
|
486
|
+
onClick: t ? (c) => c.preventDefault() : void 0,
|
|
487
|
+
...i,
|
|
488
|
+
children: e
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
const O = (c) => {
|
|
492
|
+
l && x(), n && n(c);
|
|
493
|
+
};
|
|
494
|
+
return /* @__PURE__ */ s.jsxs(
|
|
495
|
+
"button",
|
|
496
|
+
{
|
|
497
|
+
className: r(
|
|
498
|
+
b,
|
|
499
|
+
"enabled:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300",
|
|
500
|
+
"disabled:ox-default-disabled"
|
|
501
|
+
),
|
|
502
|
+
"data-ox-slot": "sidebar-menu-button",
|
|
503
|
+
disabled: t,
|
|
504
|
+
type: "button",
|
|
505
|
+
onClick: O,
|
|
506
|
+
...i,
|
|
507
|
+
children: [
|
|
508
|
+
e,
|
|
509
|
+
l ? /* @__PURE__ */ s.jsx(
|
|
510
|
+
H,
|
|
511
|
+
{
|
|
512
|
+
className: r("ml-auto transition-transform duration-200", { "rotate-180": d }),
|
|
513
|
+
path: "mdiChevronDown"
|
|
514
|
+
}
|
|
515
|
+
) : null
|
|
516
|
+
]
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
};
|
|
520
|
+
function ge({
|
|
521
|
+
children: e,
|
|
522
|
+
defaultOpen: a = !1,
|
|
523
|
+
hasSub: t = !1
|
|
524
|
+
}) {
|
|
525
|
+
const [o, n] = v(a), i = () => n((l) => !l);
|
|
526
|
+
return /* @__PURE__ */ s.jsx(z.Provider, { value: { hasSub: t, isOpen: o, setIsOpen: n, toggleOpen: i }, children: e });
|
|
527
|
+
}
|
|
528
|
+
const pe = ({
|
|
529
|
+
children: e,
|
|
530
|
+
className: a,
|
|
531
|
+
defaultOpen: t = !1,
|
|
532
|
+
hasSub: o = !1,
|
|
533
|
+
...n
|
|
534
|
+
}) => /* @__PURE__ */ s.jsx(ge, { defaultOpen: t, hasSub: o, children: /* @__PURE__ */ s.jsx(
|
|
535
|
+
"li",
|
|
536
|
+
{
|
|
537
|
+
className: r("group flex flex-wrap items-center gap-x-2", a),
|
|
538
|
+
"data-ox-slot": "sidebar-menu-item",
|
|
539
|
+
...n,
|
|
540
|
+
children: e
|
|
541
|
+
}
|
|
542
|
+
) }), fe = ({ className: e }) => /* @__PURE__ */ s.jsx(G, { className: e, "data-ox-slot": "sidebar-menu-skeleton", fullWidth: !0, height: 36 }), he = ({ children: e, className: a, ...t }) => {
|
|
543
|
+
const { isOpen: o } = A();
|
|
544
|
+
return /* @__PURE__ */ s.jsx(
|
|
545
|
+
"div",
|
|
546
|
+
{
|
|
547
|
+
className: "ox-sidebar-submenu w-content grid w-full",
|
|
548
|
+
"data-ox-slot": "sidebar-menu-sub-wrapper",
|
|
549
|
+
"data-ox-state": o ? "open" : "closed",
|
|
550
|
+
children: /* @__PURE__ */ s.jsx(
|
|
551
|
+
"ul",
|
|
552
|
+
{
|
|
553
|
+
className: r(
|
|
554
|
+
"ml-4.5 flex flex-col gap-1 border-l border-gray-400 py-0.5 pl-2.5",
|
|
555
|
+
a
|
|
556
|
+
),
|
|
557
|
+
"data-ox-slot": "sidebar-menu-sub",
|
|
558
|
+
...t,
|
|
559
|
+
children: e
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
}, ve = ({
|
|
565
|
+
children: e,
|
|
566
|
+
className: a,
|
|
567
|
+
href: t,
|
|
568
|
+
...o
|
|
569
|
+
}) => {
|
|
570
|
+
const n = r(
|
|
571
|
+
"text-gray-1200 flex h-8 flex-1 cursor-pointer items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-left text-sm hover:bg-gray-300",
|
|
572
|
+
"ox-gray-outset-focus",
|
|
573
|
+
a
|
|
574
|
+
);
|
|
575
|
+
return t ? /* @__PURE__ */ s.jsx(
|
|
576
|
+
"a",
|
|
577
|
+
{
|
|
578
|
+
className: n,
|
|
579
|
+
"data-ox-slot": "sidebar-menu-sub-button",
|
|
580
|
+
href: t,
|
|
581
|
+
...o,
|
|
582
|
+
children: e
|
|
583
|
+
}
|
|
584
|
+
) : /* @__PURE__ */ s.jsx(
|
|
585
|
+
"button",
|
|
586
|
+
{
|
|
587
|
+
className: n,
|
|
588
|
+
"data-ox-slot": "sidebar-menu-sub-button",
|
|
589
|
+
type: "button",
|
|
590
|
+
...o,
|
|
591
|
+
children: e
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
}, ye = ({
|
|
595
|
+
children: e,
|
|
596
|
+
className: a,
|
|
597
|
+
...t
|
|
598
|
+
}) => /* @__PURE__ */ s.jsx(
|
|
599
|
+
"li",
|
|
600
|
+
{
|
|
601
|
+
className: r("flex items-center gap-2", a),
|
|
602
|
+
"data-ox-slot": "sidebar-menu-sub-item",
|
|
603
|
+
...t,
|
|
604
|
+
children: e
|
|
605
|
+
}
|
|
606
|
+
), Oe = ({ className: e, ...a }) => /* @__PURE__ */ s.jsx(P, { className: e, "data-ox-slot": "sidebar-separator", ...a }), Se = ({ className: e, onClick: a }) => {
|
|
607
|
+
const { isMobile: t, toggleSidebar: o } = M(), n = () => {
|
|
608
|
+
t ? o() : a && a();
|
|
609
|
+
}, i = t || a;
|
|
610
|
+
return /* @__PURE__ */ s.jsx(
|
|
611
|
+
"button",
|
|
612
|
+
{
|
|
613
|
+
"aria-label": "Toggle sidebar",
|
|
614
|
+
className: r(
|
|
615
|
+
"inline-flex size-8 items-center justify-center rounded-lg",
|
|
616
|
+
"text-gray-1200 border border-transparent bg-transparent",
|
|
617
|
+
{
|
|
618
|
+
"ox-gray-outset-focus cursor-pointer hover:bg-gray-300": i
|
|
619
|
+
},
|
|
620
|
+
e
|
|
621
|
+
),
|
|
622
|
+
"data-ox-slot": "sidebar-trigger",
|
|
623
|
+
disabled: !i,
|
|
624
|
+
type: "button",
|
|
625
|
+
onClick: n,
|
|
626
|
+
children: /* @__PURE__ */ s.jsx(y, { path: "mdiDockLeft", size: 0.8 })
|
|
627
|
+
}
|
|
628
|
+
);
|
|
629
|
+
};
|
|
630
|
+
function Ie({ children: e }) {
|
|
631
|
+
const [a, t] = v(!1), [o, n] = v(!1);
|
|
632
|
+
k(() => {
|
|
633
|
+
const x = () => {
|
|
634
|
+
n(window.innerWidth < j);
|
|
635
|
+
};
|
|
636
|
+
return x(), window.addEventListener("resize", x), () => window.removeEventListener("resize", x);
|
|
637
|
+
}, []);
|
|
638
|
+
const i = S(() => {
|
|
639
|
+
t(!0);
|
|
640
|
+
}, []), l = S(() => {
|
|
641
|
+
t(!1);
|
|
642
|
+
}, []), d = S(() => {
|
|
643
|
+
t((x) => !x);
|
|
644
|
+
}, []);
|
|
645
|
+
return /* @__PURE__ */ s.jsx(
|
|
646
|
+
T.Provider,
|
|
647
|
+
{
|
|
648
|
+
value: {
|
|
649
|
+
closeSidebar: l,
|
|
650
|
+
isMobile: o,
|
|
651
|
+
mobileOpen: a,
|
|
652
|
+
openSidebar: i,
|
|
653
|
+
toggleSidebar: d
|
|
654
|
+
},
|
|
655
|
+
children: e
|
|
656
|
+
}
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
const p = se, u = ce, C = ne;
|
|
660
|
+
p.Header = xe;
|
|
661
|
+
p.Content = oe;
|
|
662
|
+
p.Footer = re;
|
|
663
|
+
p.Separator = Oe;
|
|
664
|
+
p.Trigger = Se;
|
|
665
|
+
u.Item = pe;
|
|
666
|
+
u.Button = me;
|
|
667
|
+
u.Icon = H;
|
|
668
|
+
u.Badge = be;
|
|
669
|
+
u.Action = ue;
|
|
670
|
+
u.Skeleton = fe;
|
|
671
|
+
u.Sub = he;
|
|
672
|
+
u.SubItem = ye;
|
|
673
|
+
u.SubButton = ve;
|
|
674
|
+
C.Label = de;
|
|
675
|
+
C.Action = ie;
|
|
676
|
+
C.Content = le;
|
|
677
|
+
export {
|
|
678
|
+
Ce as OxAppLayout,
|
|
679
|
+
Ne as OxLegacyHeader,
|
|
680
|
+
Me as OxLegacyMainContent,
|
|
681
|
+
m as OxLegacySidebar,
|
|
682
|
+
ke as OxMainContent,
|
|
683
|
+
p as OxSidebar,
|
|
684
|
+
C as OxSidebarGroup,
|
|
685
|
+
u as OxSidebarMenu,
|
|
686
|
+
Ie as OxSidebarProvider,
|
|
687
|
+
M as useOxSidebar
|
|
688
|
+
};
|