@noxickon/onyx 1.0.3 → 1.0.5
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-B6Ov6Z0O.js +6487 -0
- package/dist/chunks/hooks-BGvU5VHk.js +27 -0
- package/dist/chunks/{query-BhvXa-m6.js → query-CIsrxNi-.js} +1 -1
- package/dist/chunks/{query-iDn3qBGF.js → query-D2S9cFBP.js} +1 -1
- package/dist/chunks/ui-CZGrB58H.js +20 -0
- package/dist/chunks/ui-Dmzl3_Y3.js +20368 -0
- package/dist/contexts/contexts.cjs.js +2 -2
- package/dist/contexts/contexts.es.js +88 -86
- package/dist/hooks/hooks.cjs.js +1 -1
- package/dist/hooks/hooks.es.js +1 -1
- package/dist/layouts/layouts.cjs.js +1 -1
- package/dist/layouts/layouts.es.js +250 -249
- package/dist/onyx.cjs.js +1 -1
- package/dist/onyx.es.js +1 -1
- package/dist/pages/pages.cjs.js +2 -2
- package/dist/pages/pages.es.js +58 -56
- package/dist/routes/routes.cjs.js +1 -1
- package/dist/routes/routes.es.js +2 -2
- package/dist/utils/utils.cjs.js +1 -1
- package/dist/utils/utils.es.js +1 -1
- package/package.json +11 -5
- package/dist/chunks/hooks-DiKvsNs-.js +0 -48
- package/dist/chunks/hooks-bJFfbTks.js +0 -8624
- package/dist/chunks/ui-BgyYCO2P.js +0 -20648
- package/dist/chunks/ui-WTrU_DUw.js +0 -41
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../chunks/ui-CZGrB58H.js"),m=require("../chunks/query-CIsrxNi-.js"),x=require("react/jsx-runtime"),E=require("../chunks/useAuth-DxoDe3YA.js"),f=require("../chunks/hooks-BGvU5VHk.js"),D=require("@apollo/client"),u=require("react");function P({adminRole:r="admin",children:s,getCurrentUserQuery:n=m.DEFAULT_GET_CURRENT_USER,options:o={},pollInterval:c=300*1e3}){const{data:l,error:h,loading:O,refetch:e}=f.useQuery(n,{fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first",errorPolicy:"all",pollInterval:c,...o}),t=!!l?.me,i=l?.me?.role===r;return x.jsx(E.OxAuthContext.Provider,{value:{user:l?.me||null,loading:O,error:h??null,isLoggedIn:t,isAdmin:i,refreshUser:e},children:s})}const F=D.gql`
|
|
2
2
|
query getFeatures {
|
|
3
3
|
features
|
|
4
4
|
}
|
|
5
|
-
`,
|
|
5
|
+
`,v=u.createContext(void 0);function T({children:r,enableDevMode:s=!1,getFeaturesQuery:n=F,options:o={},pollInterval:c=300*1e3}){const{data:l,error:h,loading:O,refetch:e}=f.useQuery(n,{fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first",errorPolicy:"all",pollInterval:c,skip:s,...o}),t=l?.features||{},i=a=>s?!0:t[a]??!1;return x.jsx(v.Provider,{value:{features:t,isEnabled:i,loading:O,error:h??null,refreshFeatures:e,enableDevMode:s},children:r})}function p(){const r=u.useContext(v);if(!r)throw new Error("useOxFeature must be used within an OxFeatureProvider");return r}const C=({children:r,className:s,fallback:n=null,name:o})=>{const{isEnabled:c}=p();return c(o)?x.jsx("div",{className:g.cn("contents",s),children:r}):n?x.jsx("div",{className:g.cn("contents",s),children:n}):null},A=u.createContext(null),y=({children:r,maxDialogs:s=3})=>{const[n,o]=u.useState([]);u.useEffect(()=>(n.some(t=>t.isOpen)?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden"),()=>{document.body.classList.remove("overflow-hidden")}),[n]);const c=u.useCallback(()=>{let e=null;o(t=>{const i=t.filter(d=>d.isOpen),a=f.head(i);return a?(e=a.id,t.map(d=>d.id===a.id?{...d,isOpen:!1}:d)):t}),e&&setTimeout(()=>{o(t=>f.reject(t,i=>i.id===e))},200)},[]),l=u.useCallback((e,t)=>{const i=f.uniqueId(),a={id:i,content:e,isOpen:!0,options:t};return o(d=>[a,...d].slice(0,s)),i},[s]),h=u.useCallback(()=>{o(e=>e.map(t=>({...t,isOpen:!1}))),setTimeout(()=>{o([])},200)},[]),O=Object.assign((e,t)=>l(e,t),{open:l,dismiss:c,dismissAll:h});return x.jsxs(A.Provider,{value:O,children:[r,n.map(e=>x.jsx(g.OxDialog,{isOpen:e.isOpen,onClose:c,...e.options,children:e.content},e.id))]})},U=()=>{const r=u.useContext(A);if(!r)throw new Error("useOxDialog must be used within a DialogProvider");return r};exports.DEFAULT_GET_CURRENT_USER=m.DEFAULT_GET_CURRENT_USER;exports.OxAuthContext=E.OxAuthContext;exports.useOxAuth=E.useOxAuth;exports.DEFAULT_GET_FEATURES=F;exports.OxAuthProvider=P;exports.OxDialogProvider=y;exports.OxFeatureFlag=C;exports.OxFeatureProvider=T;exports.useOxDialog=U;exports.useOxFeature=p;
|
|
@@ -1,132 +1,134 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { D as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { _ as p, o as F } from "../chunks/ui-Dmzl3_Y3.js";
|
|
2
|
+
import { D as P } from "../chunks/query-D2S9cFBP.js";
|
|
3
|
+
import { jsx as m, jsxs as w } from "react/jsx-runtime";
|
|
4
|
+
import { O as E } from "../chunks/useAuth-BFgXzu6Q.js";
|
|
5
|
+
import { u as W } from "../chunks/useAuth-BFgXzu6Q.js";
|
|
6
|
+
import { q as x, v as y, r as A, k as C } from "../chunks/hooks-B6Ov6Z0O.js";
|
|
7
|
+
import { gql as T } from "@apollo/client";
|
|
8
|
+
import { createContext as O, useContext as g, useState as b, useEffect as L, useCallback as h } from "react";
|
|
9
|
+
function Q({
|
|
10
|
+
adminRole: o = "admin",
|
|
11
|
+
children: r,
|
|
12
|
+
getCurrentUserQuery: n = P,
|
|
13
|
+
options: s = {},
|
|
12
14
|
pollInterval: c = 300 * 1e3
|
|
13
15
|
}) {
|
|
14
|
-
const { data: l, error:
|
|
16
|
+
const { data: l, error: d, loading: f, refetch: e } = x(
|
|
15
17
|
n,
|
|
16
18
|
{
|
|
17
19
|
fetchPolicy: "cache-and-network",
|
|
18
20
|
nextFetchPolicy: "cache-first",
|
|
19
21
|
errorPolicy: "all",
|
|
20
22
|
pollInterval: c,
|
|
21
|
-
...
|
|
23
|
+
...s
|
|
22
24
|
}
|
|
23
|
-
),
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
|
|
25
|
+
), t = !!l?.me, i = l?.me?.role === o;
|
|
26
|
+
return /* @__PURE__ */ m(
|
|
27
|
+
E.Provider,
|
|
26
28
|
{
|
|
27
29
|
value: {
|
|
28
30
|
user: l?.me || null,
|
|
29
|
-
loading:
|
|
30
|
-
error:
|
|
31
|
-
isLoggedIn:
|
|
31
|
+
loading: f,
|
|
32
|
+
error: d ?? null,
|
|
33
|
+
isLoggedIn: t,
|
|
32
34
|
isAdmin: i,
|
|
33
35
|
refreshUser: e
|
|
34
36
|
},
|
|
35
|
-
children:
|
|
37
|
+
children: r
|
|
36
38
|
}
|
|
37
39
|
);
|
|
38
40
|
}
|
|
39
|
-
const
|
|
41
|
+
const U = T`
|
|
40
42
|
query getFeatures {
|
|
41
43
|
features
|
|
42
44
|
}
|
|
43
45
|
`, v = O(void 0);
|
|
44
|
-
function
|
|
45
|
-
children:
|
|
46
|
-
enableDevMode:
|
|
47
|
-
getFeaturesQuery: n =
|
|
48
|
-
options:
|
|
46
|
+
function z({
|
|
47
|
+
children: o,
|
|
48
|
+
enableDevMode: r = !1,
|
|
49
|
+
getFeaturesQuery: n = U,
|
|
50
|
+
options: s = {},
|
|
49
51
|
pollInterval: c = 300 * 1e3
|
|
50
52
|
}) {
|
|
51
|
-
const { data: l, error:
|
|
53
|
+
const { data: l, error: d, loading: f, refetch: e } = x(n, {
|
|
52
54
|
fetchPolicy: "cache-and-network",
|
|
53
55
|
nextFetchPolicy: "cache-first",
|
|
54
56
|
errorPolicy: "all",
|
|
55
57
|
pollInterval: c,
|
|
56
|
-
skip:
|
|
57
|
-
...
|
|
58
|
-
}),
|
|
59
|
-
return /* @__PURE__ */
|
|
58
|
+
skip: r,
|
|
59
|
+
...s
|
|
60
|
+
}), t = l?.features || {}, i = (u) => r ? !0 : t[u] ?? !1;
|
|
61
|
+
return /* @__PURE__ */ m(
|
|
60
62
|
v.Provider,
|
|
61
63
|
{
|
|
62
64
|
value: {
|
|
63
|
-
features:
|
|
65
|
+
features: t,
|
|
64
66
|
isEnabled: i,
|
|
65
|
-
loading:
|
|
66
|
-
error:
|
|
67
|
+
loading: f,
|
|
68
|
+
error: d ?? null,
|
|
67
69
|
refreshFeatures: e,
|
|
68
|
-
enableDevMode:
|
|
70
|
+
enableDevMode: r
|
|
69
71
|
},
|
|
70
|
-
children:
|
|
72
|
+
children: o
|
|
71
73
|
}
|
|
72
74
|
);
|
|
73
75
|
}
|
|
74
|
-
function
|
|
75
|
-
const
|
|
76
|
-
if (!
|
|
76
|
+
function _() {
|
|
77
|
+
const o = g(v);
|
|
78
|
+
if (!o)
|
|
77
79
|
throw new Error("useOxFeature must be used within an OxFeatureProvider");
|
|
78
|
-
return
|
|
80
|
+
return o;
|
|
79
81
|
}
|
|
80
|
-
const
|
|
81
|
-
children:
|
|
82
|
-
className:
|
|
82
|
+
const B = ({
|
|
83
|
+
children: o,
|
|
84
|
+
className: r,
|
|
83
85
|
fallback: n = null,
|
|
84
|
-
name:
|
|
86
|
+
name: s
|
|
85
87
|
}) => {
|
|
86
|
-
const { isEnabled: c } =
|
|
87
|
-
return c(
|
|
88
|
-
},
|
|
89
|
-
const [n,
|
|
90
|
-
|
|
88
|
+
const { isEnabled: c } = _();
|
|
89
|
+
return c(s) ? /* @__PURE__ */ m("div", { className: p("contents", r), children: o }) : n ? /* @__PURE__ */ m("div", { className: p("contents", r), children: n }) : null;
|
|
90
|
+
}, D = O(null), H = ({ children: o, maxDialogs: r = 3 }) => {
|
|
91
|
+
const [n, s] = b([]);
|
|
92
|
+
L(() => (n.some((t) => t.isOpen) ? document.body.classList.add("overflow-hidden") : document.body.classList.remove("overflow-hidden"), () => {
|
|
91
93
|
document.body.classList.remove("overflow-hidden");
|
|
92
94
|
}), [n]);
|
|
93
|
-
const c =
|
|
95
|
+
const c = h(() => {
|
|
94
96
|
let e = null;
|
|
95
|
-
|
|
96
|
-
const i =
|
|
97
|
-
return
|
|
98
|
-
(
|
|
99
|
-
)) :
|
|
97
|
+
s((t) => {
|
|
98
|
+
const i = t.filter((a) => a.isOpen), u = y(i);
|
|
99
|
+
return u ? (e = u.id, t.map(
|
|
100
|
+
(a) => a.id === u.id ? { ...a, isOpen: !1 } : a
|
|
101
|
+
)) : t;
|
|
100
102
|
}), e && setTimeout(() => {
|
|
101
|
-
|
|
103
|
+
s((t) => A(t, (i) => i.id === e));
|
|
102
104
|
}, 200);
|
|
103
|
-
}, []), l =
|
|
104
|
-
(e,
|
|
105
|
-
const i =
|
|
105
|
+
}, []), l = h(
|
|
106
|
+
(e, t) => {
|
|
107
|
+
const i = C(), u = {
|
|
106
108
|
id: i,
|
|
107
109
|
content: e,
|
|
108
110
|
isOpen: !0,
|
|
109
|
-
options:
|
|
111
|
+
options: t
|
|
110
112
|
};
|
|
111
|
-
return
|
|
113
|
+
return s((a) => [u, ...a].slice(0, r)), i;
|
|
112
114
|
},
|
|
113
|
-
[
|
|
114
|
-
),
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
[r]
|
|
116
|
+
), d = h(() => {
|
|
117
|
+
s((e) => e.map((t) => ({ ...t, isOpen: !1 }))), setTimeout(() => {
|
|
118
|
+
s([]);
|
|
117
119
|
}, 200);
|
|
118
|
-
}, []),
|
|
119
|
-
(e,
|
|
120
|
+
}, []), f = Object.assign(
|
|
121
|
+
(e, t) => l(e, t),
|
|
120
122
|
{
|
|
121
123
|
open: l,
|
|
122
124
|
dismiss: c,
|
|
123
|
-
dismissAll:
|
|
125
|
+
dismissAll: d
|
|
124
126
|
}
|
|
125
127
|
);
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
|
|
128
|
-
n.map((e) => /* @__PURE__ */
|
|
129
|
-
|
|
128
|
+
return /* @__PURE__ */ w(D.Provider, { value: f, children: [
|
|
129
|
+
o,
|
|
130
|
+
n.map((e) => /* @__PURE__ */ m(
|
|
131
|
+
F,
|
|
130
132
|
{
|
|
131
133
|
isOpen: e.isOpen,
|
|
132
134
|
onClose: c,
|
|
@@ -136,21 +138,21 @@ const N = ({
|
|
|
136
138
|
e.id
|
|
137
139
|
))
|
|
138
140
|
] });
|
|
139
|
-
},
|
|
140
|
-
const
|
|
141
|
-
if (!
|
|
141
|
+
}, J = () => {
|
|
142
|
+
const o = g(D);
|
|
143
|
+
if (!o)
|
|
142
144
|
throw new Error("useOxDialog must be used within a DialogProvider");
|
|
143
|
-
return
|
|
145
|
+
return o;
|
|
144
146
|
};
|
|
145
147
|
export {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
P as DEFAULT_GET_CURRENT_USER,
|
|
149
|
+
U as DEFAULT_GET_FEATURES,
|
|
150
|
+
E as OxAuthContext,
|
|
151
|
+
Q as OxAuthProvider,
|
|
152
|
+
H as OxDialogProvider,
|
|
153
|
+
B as OxFeatureFlag,
|
|
154
|
+
z as OxFeatureProvider,
|
|
155
|
+
W as useOxAuth,
|
|
156
|
+
J as useOxDialog,
|
|
157
|
+
_ as useOxFeature
|
|
156
158
|
};
|
package/dist/hooks/hooks.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/hooks-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/hooks-BGvU5VHk.js");exports.handleRules=e.handleRules;exports.useControllableState=e.useControllableState;exports.useFileUpload=e.useFileUpload;exports.useFilter=e.useFilter;exports.useFocus=e.useFocus;exports.useForm=e.useForm;exports.useFormState=e.useFormState;exports.useKeyboard=e.useKeyboard;exports.useOverflowDetection=e.useOverflowDetection;exports.validator=e.validator;
|
package/dist/hooks/hooks.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { x as a, f as o, z as l, A as t, g as u, l as r, w as F, h as d, j as i, y as f } from "../chunks/hooks-B6Ov6Z0O.js";
|
|
2
2
|
export {
|
|
3
3
|
a as handleRules,
|
|
4
4
|
o as useControllableState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/ui-WTrU_DUw.js"),x=require("react"),C=({brand:t,children:n,className:s,hasSidebar:r=!1,navClassName:o,toggleSidebar:a,...i})=>e.jsxRuntimeExports.jsx("header",{className:e.cn("max-h-15 min-h-15 sticky top-0 z-10 bg-gray-100",s),"data-ox-slot":"header",...i,children:e.jsxRuntimeExports.jsxs("nav",{className:e.cn("max-w-10xl mx-auto flex items-center justify-between px-4 py-2.5",o),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-[17px]",children:[r?e.jsxRuntimeExports.jsx(e.OxButton,{"aria-label":"Open menu","data-ox-slot":"header-toggle",size:"md",variant:"ghost",onClick:a,children:e.jsxRuntimeExports.jsx(e.OxButton.Icon,{path:"mdiMenu"})}):null,t?e.jsxRuntimeExports.jsx("div",{children:t}):null]}),n]})}),O="group ox-gray-inset-focus items-center rounded-lg text-sm transition-colors text-left col-span-2 grid grid-cols-subgrid",h="size-10 justify-center",S="h-10 w-full px-2",v="bg-gray-300 text-gray-1200",I="h-15",y=x.createContext(void 0),k=({children:t,className:n,desktopCollapsed:s=!1,hasHeader:r=!1,mobileCollapsed:o=!0,onClose:a,...i})=>{const[l,d]=x.useState(window.innerWidth<e.MOBILE_BREAKPOINT),m=l?o:s,E=x.useMemo(()=>({collapsed:m,isMobile:l}),[m,l]);return x.useEffect(()=>{const u=()=>{d(window.innerWidth<e.MOBILE_BREAKPOINT)};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]),e.jsxRuntimeExports.jsx(y.Provider,{value:E,children:l?e.jsxRuntimeExports.jsx(e.OxDrawer,{open:!m,onOpenChange:u=>!u&&a?.(),children:e.jsxRuntimeExports.jsx(e.OxDrawer.Content,{closeOnOutsideClick:!!a,side:"left",...i,children:e.jsxRuntimeExports.jsxs("nav",{"aria-label":"Mobile navigation",className:e.cn("flex h-screen w-full flex-col bg-gray-100",n),"data-ox-slot":"sidebar",role:"navigation",...i,children:[a?e.jsxRuntimeExports.jsx("div",{className:e.cn("h-15 flex items-center gap-[17px] px-4",I),children:e.jsxRuntimeExports.jsx(e.OxButton,{"aria-label":"Close sidebar",size:"md",variant:"ghost",onClick:a,children:e.jsxRuntimeExports.jsx(e.OxButton.Icon,{path:"mdiClose"})})}):null,t]})})}):e.jsxRuntimeExports.jsx("nav",{"aria-label":"Desktop navigation",className:e.cn("sticky box-content flex flex-col overflow-y-auto bg-gray-100",{"top-0 h-screen":!r,"viewport-minus-header top-15":r,'max-w-18 min-w-18 [&_[data-ox-slot="sidebar-label"]]:hidden':m,"min-w-64 max-w-64":!m},n),"data-ox-slot":"sidebar",role:"navigation",...i,children:t})})},g=()=>{const t=x.useContext(y);if(!t)throw new Error("useSidebar must be used within a SidebarProvider");return t},L=({children:t,className:n,...s})=>{const{collapsed:r,isMobile:o}=g();return e.jsxRuntimeExports.jsx("div",{className:e.cn("grid flex-1 content-start gap-y-1 overflow-y-auto p-4",{"grid-cols-1 place-items-center":r&&!o,"grid-cols-[auto_1fr]":!r||o},'[&_[data-ox-slot="sidebar-link"]]:col-span-2 [&_[data-ox-slot="sidebar-link"]]:grid [&_[data-ox-slot="sidebar-link"]]:grid-cols-subgrid','[&_[data-ox-slot="sidebar-button"]]:col-span-2 [&_[data-ox-slot="sidebar-button"]]:grid [&_[data-ox-slot="sidebar-button"]]:grid-cols-subgrid','[&_[data-ox-slot="sidebar-icon"]]:justify-self-center [&_[data-ox-slot="sidebar-icon"]]:[grid-column-start:var(--ox-menu-icon-col)]','[&_[data-ox-slot="sidebar-label"]]:[grid-column-start:var(--ox-menu-label-col)]',n),"data-ox-slot":"sidebar-body",...s,children:t})},_=({active:t=!1,children:n,className:s,disabled:r=!1,...o})=>{const{collapsed:a}=g();return e.jsxRuntimeExports.jsx("button",{className:e.cn("enabled:text-gray-1000 enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300",O,{[h]:a,[S]:!a,[v]:t&&!r,"disabled:ox-default-disabled":r},s),"data-ox-slot":"sidebar-button",disabled:r,type:"button",...o,"data-ox-state":t?"active":"inactive",children:n})},B=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("p-4",n),"data-ox-slot":"sidebar-footer",...s,children:t}),T=({children:t,className:n,headline:s,...r})=>{const{collapsed:o,isMobile:a}=g();return e.jsxRuntimeExports.jsxs("div",{className:e.cn("contents",n),"data-ox-slot":"sidebar-group",...r,children:[e.jsxRuntimeExports.jsx("h3",{className:e.cn("text-gray-1000 col-span-full mb-2 mt-4 block cursor-default text-xs",{invisible:o&&!a}),children:s}),t]})},z=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("h-15 flex items-center px-4",n),"data-ox-slot":"sidebar-header",...s,children:t}),A=({className:t,size:n=.8,...s})=>{const{collapsed:r}=g();return e.jsxRuntimeExports.jsx(e.OxIcon,{className:e.cn("shrink-0 text-current",{"mr-2":!r},t),"data-ox-slot":"sidebar-icon",size:n,...s})},D=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("span",{className:e.cn("overflow-hidden text-ellipsis",n),"data-ox-slot":"sidebar-label",...s,children:t}),H=({active:t=!1,children:n,className:s,disabled:r=!1,href:o,...a})=>{const{collapsed:i}=g();return e.jsxRuntimeExports.jsx("a",{"aria-current":t?"page":void 0,className:e.cn(O,{[h]:i,[S]:!i,[v]:t&&!r,"text-gray-1000 hover:text-gray-1200 cursor-pointer hover:bg-gray-300":!t&&!r,"ox-default-disabled":r},s),"data-ox-slot":"sidebar-link",href:r?void 0:o,role:"link",onClick:r?l=>l.preventDefault():void 0,...a,"data-ox-state":t?"active":"inactive",children:n})},b=k;b.Body=L;b.Button=_;b.Footer=B;b.Group=T;b.Header=z;b.Icon=A;b.Label=D;b.Link=H;const P=({children:t,className:n,color:s="purple",icon:r,subtitle:o,title:a,...i})=>{const l=a||o||r,d=e.COLOR_STYLES[s];return e.jsxRuntimeExports.jsxs("main",{"aria-labelledby":l?"main-headline":void 0,className:e.cn("w-full p-6",n),"data-ox-slot":"main-content",...i,children:[l?e.jsxRuntimeExports.jsx("div",{className:"mb-8 border-b border-gray-400 pb-6",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4",children:[r?e.jsxRuntimeExports.jsx("div",{className:e.cn("rounded-lg border p-3",d.border,d.background),children:e.jsxRuntimeExports.jsx(e.OxIcon,{className:d.text,path:r,size:1.41})}):null,e.jsxRuntimeExports.jsxs("div",{children:[a?e.jsxRuntimeExports.jsx("h2",{id:"main-headline",className:"text-gray-1200 text-xl font-semibold","data-ox-slot":"main-headline",children:a}):null,o&&e.jsxRuntimeExports.jsx("p",{className:"mt-1 text-sm",children:o})]})]})}):null,t]})},G=({children:t,className:n,...s})=>{const{isMobile:r}=j();return e.jsxRuntimeExports.jsx("div",{className:e.cn("max-w-10xl mx-auto grid min-h-screen bg-transparent",r?"grid-cols-1":"grid-cols-[auto_1fr]",n),"data-ox-slot":"app-layout",...s,children:t})},$=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("main",{className:e.cn("flex flex-col overflow-y-auto",n),"data-ox-slot":"main-content",...s,children:t}),W=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-1 overflow-y-auto px-6 py-6",n),"data-ox-slot":"main-content-body",...s,children:t}),Y=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-shrink-0 border-b border-gray-400 bg-gray-100 px-6 py-4",n),"data-ox-slot":"main-content-header",...s,children:t}),F=Object.assign($,{Header:Y,Body:W}),R=x.createContext(void 0);function j(){const t=x.useContext(R);if(!t)throw new Error("useOxSidebar must be used within a SidebarProvider");return t}const K=256,q=({children:t,className:n,...s})=>{const{isMobile:r,mobileOpen:o,toggleSidebar:a}=j();return r?e.jsxRuntimeExports.jsx(e.OxDrawer,{open:o,onOpenChange:a,children:e.jsxRuntimeExports.jsx(e.OxDrawer.Content,{closeOnOutsideClick:!0,side:"left",children:e.jsxRuntimeExports.jsx("aside",{className:e.cn("bg-gray-150 flex h-full flex-col",n),"data-ox-slot":"sidebar",...s,children:t})})}):e.jsxRuntimeExports.jsx("aside",{className:e.cn("bg-gray-150 sticky top-0 flex h-screen flex-col overflow-y-auto",n),"data-ox-slot":"sidebar",style:{width:K},...s,children:t})},V=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex-1 overflow-y-auto p-2",n),"data-ox-slot":"sidebar-content",...s,children:t}),J=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex shrink-0 flex-col p-2",n),"data-ox-slot":"sidebar-footer",...s,children:t}),Q=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex flex-wrap items-center gap-2",'[&_[data-ox-slot="sidebar-group-content"]]:w-full',n),"data-ox-slot":"sidebar-group",...s,children:t}),U=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("button",{className:e.cn("mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-md","enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:text-gray-900 enabled:hover:bg-gray-300","ox-gray-outset-focus disabled:ox-default-disabled",n),"data-ox-slot":"sidebar-group-action",type:"button",...s,children:t}),X=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn(n),"data-ox-slot":"sidebar-group-content",...s,children:t}),Z=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex flex-1 items-center pl-2 text-xs font-medium text-gray-900",n),"data-ox-slot":"sidebar-group-label",...s,children:t}),ee=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("div",{className:e.cn("flex shrink-0 flex-col p-2",n),"data-ox-slot":"sidebar-header",...s,children:t}),te=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("ul",{className:e.cn("flex flex-col items-stretch gap-1",n),"data-ox-slot":"sidebar-menu",...s,children:t}),se=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("button",{className:e.cn("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-transparent","enabled:text-gray-1200 enabled:cursor-pointer enabled:bg-transparent enabled:hover:bg-gray-300","ox-gray-outset-focus disabled:ox-default-disabled",n),"data-ox-slot":"sidebar-menu-action",type:"button",...s,children:t}),ne=({children:t,className:n})=>e.jsxRuntimeExports.jsx(e.OxBadge,{className:e.cn("ml-auto",n),"data-ox-slot":"sidebar-menu-badge",size:"sm",children:t}),w=x.createContext(void 0),N=()=>{const t=x.useContext(w);if(!t)throw new Error("useMenuItemContext must be used within MenuItemProvider");return t},M=({className:t,path:n,placeholder:s})=>e.jsxRuntimeExports.jsx(e.OxIcon,{className:e.cn("shrink-0",t),"data-ox-slot":"sidebar-menu-icon",path:n,placeholder:s,size:.8}),re=({children:t,className:n,disabled:s=!1,href:r,onClick:o,...a})=>{const{hasSub:i,isOpen:l,toggleOpen:d}=N(),m=e.cn("flex h-9 flex-1 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-left text-sm","ox-gray-outset-focus",n);if(r)return e.jsxRuntimeExports.jsx("a",{"aria-disabled":s?"true":void 0,className:e.cn(m,{"text-gray-1200 cursor-pointer hover:bg-gray-300":!s,"ox-default-disabled":s}),"data-ox-slot":"sidebar-menu-button",href:s?void 0:r,onClick:s?u=>u.preventDefault():void 0,...a,children:t});const E=u=>{i&&d(),o&&o(u)};return e.jsxRuntimeExports.jsxs("button",{className:e.cn(m,"enabled:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300","disabled:ox-default-disabled"),"data-ox-slot":"sidebar-menu-button",disabled:s,type:"button",onClick:E,...a,children:[t,i?e.jsxRuntimeExports.jsx(M,{className:e.cn("ml-auto transition-transform duration-200",{"rotate-180":l}),path:"mdiChevronDown"}):null]})};function oe({children:t,defaultOpen:n=!1,hasSub:s=!1}){const[r,o]=x.useState(n),a=()=>o(i=>!i);return e.jsxRuntimeExports.jsx(w.Provider,{value:{hasSub:s,isOpen:r,setIsOpen:o,toggleOpen:a},children:t})}const ae=({children:t,className:n,defaultOpen:s=!1,hasSub:r=!1,...o})=>e.jsxRuntimeExports.jsx(oe,{defaultOpen:s,hasSub:r,children:e.jsxRuntimeExports.jsx("li",{className:e.cn("group flex flex-wrap items-center gap-x-2",n),"data-ox-slot":"sidebar-menu-item",...o,children:t})}),ie=({className:t})=>e.jsxRuntimeExports.jsx(e.OxSkeleton,{className:t,"data-ox-slot":"sidebar-menu-skeleton",fullWidth:!0,height:36}),xe=({children:t,className:n,...s})=>{const{isOpen:r}=N();return e.jsxRuntimeExports.jsx("div",{className:"ox-sidebar-submenu w-content grid w-full","data-ox-slot":"sidebar-menu-sub-wrapper","data-ox-state":r?"open":"closed",children:e.jsxRuntimeExports.jsx("ul",{className:e.cn("ml-4.5 flex flex-col gap-1 border-l border-gray-400 py-0.5 pl-2.5",n),"data-ox-slot":"sidebar-menu-sub",...s,children:t})})},le=({children:t,className:n,href:s,...r})=>{const o=e.cn("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","ox-gray-outset-focus",n);return s?e.jsxRuntimeExports.jsx("a",{className:o,"data-ox-slot":"sidebar-menu-sub-button",href:s,...r,children:t}):e.jsxRuntimeExports.jsx("button",{className:o,"data-ox-slot":"sidebar-menu-sub-button",type:"button",...r,children:t})},de=({children:t,className:n,...s})=>e.jsxRuntimeExports.jsx("li",{className:e.cn("flex items-center gap-2",n),"data-ox-slot":"sidebar-menu-sub-item",...s,children:t}),ce=({className:t,...n})=>e.jsxRuntimeExports.jsx(e.OxSeparator,{className:t,"data-ox-slot":"sidebar-separator",...n}),ue=({className:t,onClick:n})=>{const{isMobile:s,toggleSidebar:r}=j(),o=()=>{s?r():n&&n()},a=s||n;return e.jsxRuntimeExports.jsx("button",{"aria-label":"Toggle sidebar",className:e.cn("inline-flex size-8 items-center justify-center rounded-lg","text-gray-1200 border border-transparent bg-transparent",{"ox-gray-outset-focus cursor-pointer hover:bg-gray-300":a},t),"data-ox-slot":"sidebar-trigger",disabled:!a,type:"button",onClick:o,children:e.jsxRuntimeExports.jsx(e.OxIcon,{path:"mdiDockLeft",size:.8})})};function be({children:t}){const[n,s]=x.useState(!1),[r,o]=x.useState(!1);x.useEffect(()=>{const d=()=>{o(window.innerWidth<e.MOBILE_BREAKPOINT)};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]);const a=x.useCallback(()=>{s(!0)},[]),i=x.useCallback(()=>{s(!1)},[]),l=x.useCallback(()=>{s(d=>!d)},[]);return e.jsxRuntimeExports.jsx(R.Provider,{value:{closeSidebar:i,isMobile:r,mobileOpen:n,openSidebar:a,toggleSidebar:l},children:t})}const p=q,c=te,f=Q;p.Header=ee;p.Content=V;p.Footer=J;p.Separator=ce;p.Trigger=ue;c.Item=ae;c.Button=re;c.Icon=M;c.Badge=ne;c.Action=se;c.Skeleton=ie;c.Sub=xe;c.SubItem=de;c.SubButton=le;f.Label=Z;f.Action=U;f.Content=X;exports.OxAppLayout=G;exports.OxLegacyHeader=C;exports.OxLegacyMainContent=P;exports.OxLegacySidebar=b;exports.OxMainContent=F;exports.OxSidebar=p;exports.OxSidebarGroup=f;exports.OxSidebarMenu=c;exports.OxSidebarProvider=be;exports.useOxSidebar=j;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../chunks/ui-CZGrB58H.js"),s=require("react/jsx-runtime"),d=require("react"),E=({brand:e,children:a,className:t,hasSidebar:r=!1,navClassName:o,toggleSidebar:i,...l})=>s.jsx("header",{className:n.cn("max-h-15 min-h-15 sticky top-0 z-10 bg-gray-100",t),"data-ox-slot":"header",...l,children:s.jsxs("nav",{className:n.cn("max-w-10xl mx-auto flex items-center justify-between px-4 py-2.5",o),children:[s.jsxs("div",{className:"flex items-center gap-[17px]",children:[r?s.jsx(n.OxButton,{"aria-label":"Open menu","data-ox-slot":"header-toggle",size:"md",variant:"ghost",onClick:i,children:s.jsx(n.OxButton.Icon,{path:"mdiMenu"})}):null,e?s.jsx("div",{children:e}):null]}),a]})}),v="group ox-gray-inset-focus items-center rounded-lg text-sm transition-colors text-left col-span-2 grid grid-cols-subgrid",y="size-10 justify-center",j="h-10 w-full px-2",w="bg-gray-300 text-gray-1200",L="h-15",N=d.createContext(void 0),_=({children:e,className:a,desktopCollapsed:t=!1,hasHeader:r=!1,mobileCollapsed:o=!0,onClose:i,...l})=>{const[c,x]=d.useState(window.innerWidth<n.MOBILE_BREAKPOINT),m=c?o:t,S=d.useMemo(()=>({collapsed:m,isMobile:c}),[m,c]);return d.useEffect(()=>{const b=()=>{x(window.innerWidth<n.MOBILE_BREAKPOINT)};return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[]),s.jsx(N.Provider,{value:S,children:c?s.jsx(n.OxDrawer,{open:!m,onOpenChange:b=>!b&&i?.(),children:s.jsx(n.OxDrawer.Content,{closeOnOutsideClick:!!i,side:"left",...l,children:s.jsxs("nav",{"aria-label":"Mobile navigation",className:n.cn("flex h-screen w-full flex-col bg-gray-100",a),"data-ox-slot":"sidebar",role:"navigation",...l,children:[i?s.jsx("div",{className:n.cn("h-15 flex items-center gap-[17px] px-4",L),children:s.jsx(n.OxButton,{"aria-label":"Close sidebar",size:"md",variant:"ghost",onClick:i,children:s.jsx(n.OxButton.Icon,{path:"mdiClose"})})}):null,e]})})}):s.jsx("nav",{"aria-label":"Desktop navigation",className:n.cn("sticky box-content flex flex-col overflow-y-auto bg-gray-100",{"top-0 h-screen":!r,"viewport-minus-header top-15":r,'max-w-18 min-w-18 [&_[data-ox-slot="sidebar-label"]]:hidden':m,"min-w-64 max-w-64":!m},a),"data-ox-slot":"sidebar",role:"navigation",...l,children:e})})},f=()=>{const e=d.useContext(N);if(!e)throw new Error("useSidebar must be used within a SidebarProvider");return e},B=({children:e,className:a,...t})=>{const{collapsed:r,isMobile:o}=f();return s.jsx("div",{className:n.cn("grid flex-1 content-start gap-y-1 overflow-y-auto p-4",{"grid-cols-1 place-items-center":r&&!o,"grid-cols-[auto_1fr]":!r||o},'[&_[data-ox-slot="sidebar-link"]]:col-span-2 [&_[data-ox-slot="sidebar-link"]]:grid [&_[data-ox-slot="sidebar-link"]]:grid-cols-subgrid','[&_[data-ox-slot="sidebar-button"]]:col-span-2 [&_[data-ox-slot="sidebar-button"]]:grid [&_[data-ox-slot="sidebar-button"]]:grid-cols-subgrid','[&_[data-ox-slot="sidebar-icon"]]:justify-self-center [&_[data-ox-slot="sidebar-icon"]]:[grid-column-start:var(--ox-menu-icon-col)]','[&_[data-ox-slot="sidebar-label"]]:[grid-column-start:var(--ox-menu-label-col)]',a),"data-ox-slot":"sidebar-body",...t,children:e})},T=({active:e=!1,children:a,className:t,disabled:r=!1,...o})=>{const{collapsed:i}=f();return s.jsx("button",{className:n.cn("enabled:text-gray-1000 enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300",v,{[y]:i,[j]:!i,[w]:e&&!r,"disabled:ox-default-disabled":r},t),"data-ox-slot":"sidebar-button",disabled:r,type:"button",...o,"data-ox-state":e?"active":"inactive",children:a})},z=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("p-4",a),"data-ox-slot":"sidebar-footer",...t,children:e}),A=({children:e,className:a,headline:t,...r})=>{const{collapsed:o,isMobile:i}=f();return s.jsxs("div",{className:n.cn("contents",a),"data-ox-slot":"sidebar-group",...r,children:[s.jsx("h3",{className:n.cn("text-gray-1000 col-span-full mb-2 mt-4 block cursor-default text-xs",{invisible:o&&!i}),children:t}),e]})},D=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("h-15 flex items-center px-4",a),"data-ox-slot":"sidebar-header",...t,children:e}),H=({className:e,size:a=.8,...t})=>{const{collapsed:r}=f();return s.jsx(n.OxIcon,{className:n.cn("shrink-0 text-current",{"mr-2":!r},e),"data-ox-slot":"sidebar-icon",size:a,...t})},P=({children:e,className:a,...t})=>s.jsx("span",{className:n.cn("overflow-hidden text-ellipsis",a),"data-ox-slot":"sidebar-label",...t,children:e}),G=({active:e=!1,children:a,className:t,disabled:r=!1,href:o,...i})=>{const{collapsed:l}=f();return s.jsx("a",{"aria-current":e?"page":void 0,className:n.cn(v,{[y]:l,[j]:!l,[w]:e&&!r,"text-gray-1000 hover:text-gray-1200 cursor-pointer hover:bg-gray-300":!e&&!r,"ox-default-disabled":r},t),"data-ox-slot":"sidebar-link",href:r?void 0:o,role:"link",onClick:r?c=>c.preventDefault():void 0,...i,"data-ox-state":e?"active":"inactive",children:a})},g=_;g.Body=B;g.Button=T;g.Footer=z;g.Group=A;g.Header=D;g.Icon=H;g.Label=P;g.Link=G;const R=({children:e,className:a,color:t="purple",icon:r,subtitle:o,title:i,...l})=>{const c=i||o||r,x=n.COLOR_STYLES[t];return s.jsxs("main",{"aria-labelledby":c?"main-headline":void 0,className:n.cn("w-full p-6",a),"data-ox-slot":"main-content",...l,children:[c?s.jsx("div",{className:"mb-8 border-b border-gray-400 pb-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[r?s.jsx("div",{className:n.cn("rounded-lg border p-3",x.border,x.background),children:s.jsx(n.OxIcon,{className:x.text,path:r,size:1.41})}):null,s.jsxs("div",{children:[i?s.jsx("h2",{id:"main-headline",className:"text-gray-1200 text-xl font-semibold","data-ox-slot":"main-headline",children:i}):null,o&&s.jsx("p",{className:"mt-1 text-sm",children:o})]})]})}):null,e]})},$=({children:e,className:a,...t})=>{const{isMobile:r}=O();return s.jsx("div",{className:n.cn("max-w-10xl mx-auto grid min-h-screen bg-transparent",r?"grid-cols-1":"grid-cols-[auto_1fr]",a),"data-ox-slot":"app-layout",...t,children:e})},W=({children:e,className:a,...t})=>s.jsx("main",{className:n.cn("flex flex-col overflow-y-auto",a),"data-ox-slot":"main-content",...t,children:e}),Y=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("flex-1 overflow-y-auto px-6 py-6",a),"data-ox-slot":"main-content-body",...t,children:e}),F=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("flex-shrink-0 border-b border-gray-400 bg-gray-100 px-6 py-4",a),"data-ox-slot":"main-content-header",...t,children:e}),q=Object.assign(W,{Header:F,Body:Y}),M=d.createContext(void 0);function O(){const e=d.useContext(M);if(!e)throw new Error("useOxSidebar must be used within a SidebarProvider");return e}const K=256,V=({children:e,className:a,...t})=>{const{isMobile:r,mobileOpen:o,toggleSidebar:i}=O();return r?s.jsx(n.OxDrawer,{open:o,onOpenChange:i,children:s.jsx(n.OxDrawer.Content,{closeOnOutsideClick:!0,side:"left",children:s.jsx("aside",{className:n.cn("bg-gray-150 flex h-full flex-col",a),"data-ox-slot":"sidebar",...t,children:e})})}):s.jsx("aside",{className:n.cn("bg-gray-150 sticky top-0 flex h-screen flex-col overflow-y-auto",a),"data-ox-slot":"sidebar",style:{width:K},...t,children:e})},J=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("flex-1 overflow-y-auto p-2",a),"data-ox-slot":"sidebar-content",...t,children:e}),Q=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("flex shrink-0 flex-col p-2",a),"data-ox-slot":"sidebar-footer",...t,children:e}),U=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("flex flex-wrap items-center gap-2",'[&_[data-ox-slot="sidebar-group-content"]]:w-full',a),"data-ox-slot":"sidebar-group",...t,children:e}),X=({children:e,className:a,...t})=>s.jsx("button",{className:n.cn("mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-md","enabled:hover:text-gray-1200 enabled:cursor-pointer enabled:text-gray-900 enabled:hover:bg-gray-300","ox-gray-outset-focus disabled:ox-default-disabled",a),"data-ox-slot":"sidebar-group-action",type:"button",...t,children:e}),Z=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn(a),"data-ox-slot":"sidebar-group-content",...t,children:e}),ee=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("flex flex-1 items-center pl-2 text-xs font-medium text-gray-900",a),"data-ox-slot":"sidebar-group-label",...t,children:e}),te=({children:e,className:a,...t})=>s.jsx("div",{className:n.cn("flex shrink-0 flex-col p-2",a),"data-ox-slot":"sidebar-header",...t,children:e}),ae=({children:e,className:a,...t})=>s.jsx("ul",{className:n.cn("flex flex-col items-stretch gap-1",a),"data-ox-slot":"sidebar-menu",...t,children:e}),se=({children:e,className:a,...t})=>s.jsx("button",{className:n.cn("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-transparent","enabled:text-gray-1200 enabled:cursor-pointer enabled:bg-transparent enabled:hover:bg-gray-300","ox-gray-outset-focus disabled:ox-default-disabled",a),"data-ox-slot":"sidebar-menu-action",type:"button",...t,children:e}),ne=({children:e,className:a})=>s.jsx(n.OxBadge,{className:n.cn("ml-auto",a),"data-ox-slot":"sidebar-menu-badge",size:"sm",children:e}),C=d.createContext(void 0),I=()=>{const e=d.useContext(C);if(!e)throw new Error("useMenuItemContext must be used within MenuItemProvider");return e},k=({className:e,path:a,placeholder:t})=>s.jsx(n.OxIcon,{className:n.cn("shrink-0",e),"data-ox-slot":"sidebar-menu-icon",path:a,placeholder:t,size:.8}),re=({children:e,className:a,disabled:t=!1,href:r,onClick:o,...i})=>{const{hasSub:l,isOpen:c,toggleOpen:x}=I(),m=n.cn("flex h-9 flex-1 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-left text-sm","ox-gray-outset-focus",a);if(r)return s.jsx("a",{"aria-disabled":t?"true":void 0,className:n.cn(m,{"text-gray-1200 cursor-pointer hover:bg-gray-300":!t,"ox-default-disabled":t}),"data-ox-slot":"sidebar-menu-button",href:t?void 0:r,onClick:t?b=>b.preventDefault():void 0,...i,children:e});const S=b=>{l&&x(),o&&o(b)};return s.jsxs("button",{className:n.cn(m,"enabled:text-gray-1200 enabled:cursor-pointer enabled:hover:bg-gray-300","disabled:ox-default-disabled"),"data-ox-slot":"sidebar-menu-button",disabled:t,type:"button",onClick:S,...i,children:[e,l?s.jsx(k,{className:n.cn("ml-auto transition-transform duration-200",{"rotate-180":c}),path:"mdiChevronDown"}):null]})};function oe({children:e,defaultOpen:a=!1,hasSub:t=!1}){const[r,o]=d.useState(a),i=()=>o(l=>!l);return s.jsx(C.Provider,{value:{hasSub:t,isOpen:r,setIsOpen:o,toggleOpen:i},children:e})}const ie=({children:e,className:a,defaultOpen:t=!1,hasSub:r=!1,...o})=>s.jsx(oe,{defaultOpen:t,hasSub:r,children:s.jsx("li",{className:n.cn("group flex flex-wrap items-center gap-x-2",a),"data-ox-slot":"sidebar-menu-item",...o,children:e})}),le=({className:e})=>s.jsx(n.OxSkeleton,{className:e,"data-ox-slot":"sidebar-menu-skeleton",fullWidth:!0,height:36}),de=({children:e,className:a,...t})=>{const{isOpen:r}=I();return s.jsx("div",{className:"ox-sidebar-submenu w-content grid w-full","data-ox-slot":"sidebar-menu-sub-wrapper","data-ox-state":r?"open":"closed",children:s.jsx("ul",{className:n.cn("ml-4.5 flex flex-col gap-1 border-l border-gray-400 py-0.5 pl-2.5",a),"data-ox-slot":"sidebar-menu-sub",...t,children:e})})},ce=({children:e,className:a,href:t,...r})=>{const o=n.cn("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","ox-gray-outset-focus",a);return t?s.jsx("a",{className:o,"data-ox-slot":"sidebar-menu-sub-button",href:t,...r,children:e}):s.jsx("button",{className:o,"data-ox-slot":"sidebar-menu-sub-button",type:"button",...r,children:e})},xe=({children:e,className:a,...t})=>s.jsx("li",{className:n.cn("flex items-center gap-2",a),"data-ox-slot":"sidebar-menu-sub-item",...t,children:e}),ue=({className:e,...a})=>s.jsx(n.OxSeparator,{className:e,"data-ox-slot":"sidebar-separator",...a}),be=({className:e,onClick:a})=>{const{isMobile:t,toggleSidebar:r}=O(),o=()=>{t?r():a&&a()},i=t||a;return s.jsx("button",{"aria-label":"Toggle sidebar",className:n.cn("inline-flex size-8 items-center justify-center rounded-lg","text-gray-1200 border border-transparent bg-transparent",{"ox-gray-outset-focus cursor-pointer hover:bg-gray-300":i},e),"data-ox-slot":"sidebar-trigger",disabled:!i,type:"button",onClick:o,children:s.jsx(n.OxIcon,{path:"mdiDockLeft",size:.8})})};function ge({children:e}){const[a,t]=d.useState(!1),[r,o]=d.useState(!1);d.useEffect(()=>{const x=()=>{o(window.innerWidth<n.MOBILE_BREAKPOINT)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const i=d.useCallback(()=>{t(!0)},[]),l=d.useCallback(()=>{t(!1)},[]),c=d.useCallback(()=>{t(x=>!x)},[]);return s.jsx(M.Provider,{value:{closeSidebar:l,isMobile:r,mobileOpen:a,openSidebar:i,toggleSidebar:c},children:e})}const p=V,u=ae,h=U;p.Header=te;p.Content=J;p.Footer=Q;p.Separator=ue;p.Trigger=be;u.Item=ie;u.Button=re;u.Icon=k;u.Badge=ne;u.Action=se;u.Skeleton=le;u.Sub=de;u.SubItem=xe;u.SubButton=ce;h.Label=ee;h.Action=X;h.Content=Z;exports.OxAppLayout=$;exports.OxLegacyHeader=E;exports.OxLegacyMainContent=R;exports.OxLegacySidebar=g;exports.OxMainContent=q;exports.OxSidebar=p;exports.OxSidebarGroup=h;exports.OxSidebarMenu=u;exports.OxSidebarProvider=ge;exports.useOxSidebar=O;
|