@leonardaustin/ui 0.30.0 → 0.32.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/README.md +2 -0
- package/dist/components/app-shell/Sidebar.js +125 -123
- package/dist/components/app-shell/ThemeMenu.js +44 -42
- package/dist/components/charts/BarChart.d.ts +1 -1
- package/dist/components/charts/BarChart.js +39 -42
- package/dist/components/charts/StackedBarChart.js +66 -68
- package/dist/components/charts/VerticalBarChart.js +49 -51
- package/dist/components/charts/barChartUtils.d.ts +6 -7
- package/dist/components/charts/barChartUtils.js +51 -11
- package/dist/config/theme.js +49 -7
- package/dist/core.css +120 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +117 -116
- package/dist/providers/SettingsContext.d.ts +1 -1
- package/dist/providers/SettingsProvider.js +4 -2
- package/dist/providers/ThemeContext.d.ts +2 -2
- package/dist/providers/accentColors.d.ts +3 -1
- package/dist/providers/accentColors.js +20 -6
- package/dist/providers/themeClasses.js +2 -0
- package/dist/styles.css +254 -1
- package/dist/themes/studio-dark.css +68 -0
- package/dist/themes/studio-light.css +68 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -220,5 +220,7 @@ root when using the stylesheet directly.
|
|
|
220
220
|
| Cyber Brutal Dark | `cyberBrutalDark` | `theme-cyber-brutal-dark` |
|
|
221
221
|
| Cyber Brutal Light | `cyberBrutalLight` | `theme-cyber-brutal-light` |
|
|
222
222
|
| HashiTheme | `hashiTheme` | `theme-hashi` |
|
|
223
|
+
| Studio Light | `studioLight` | `theme-studio-light` |
|
|
224
|
+
| Studio Dark | `studioDark` | `theme-studio-dark` |
|
|
223
225
|
| Glass Dark | `glassDark` | `theme-glass`, `theme-glass-dark` |
|
|
224
226
|
| Glass Light | `glassLight` | `theme-glass`, `theme-glass-light` |
|
|
@@ -6,21 +6,22 @@ import { accentItems as o } from "../../config/theme.js";
|
|
|
6
6
|
import { useAnchoredPopup as s } from "../../hooks/useAnchoredPopup.js";
|
|
7
7
|
import { useDismiss as c } from "../../hooks/useDismiss.js";
|
|
8
8
|
import { useSettings as l } from "../../hooks/useSettings.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
9
|
+
import { usesThemeAccent as u } from "../../providers/accentColors.js";
|
|
10
|
+
import { Avatar as d } from "../ui/Avatar.js";
|
|
11
|
+
import { useToast as f } from "../ui/Toast.js";
|
|
12
|
+
import { useCallback as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
13
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
14
|
+
import { Accessibility as b, Check as x, ChevronDown as S, ChevronsUpDown as C, LogOut as w, Monitor as T, Moon as E, Settings as D, Sun as O } from "lucide-react";
|
|
15
|
+
import { createPortal as k } from "react-dom";
|
|
15
16
|
//#region src/components/app-shell/Sidebar.tsx
|
|
16
|
-
var
|
|
17
|
+
var A = 140, j = 400, M = 48, N = {
|
|
17
18
|
side: "right",
|
|
18
19
|
align: "end",
|
|
19
20
|
gap: 6
|
|
20
21
|
};
|
|
21
|
-
function
|
|
22
|
+
function P({ item: t, collapsed: i, currentPath: a, onNavigate: o }) {
|
|
22
23
|
let s = r(t, a);
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ y("a", {
|
|
24
25
|
href: t.path,
|
|
25
26
|
onClick: (e) => n(e, t.path, o),
|
|
26
27
|
"aria-current": s ? "page" : void 0,
|
|
@@ -28,152 +29,152 @@ function N({ item: t, collapsed: i, currentPath: a, onNavigate: o }) {
|
|
|
28
29
|
style: { height: "2em" },
|
|
29
30
|
title: i ? t.label : void 0,
|
|
30
31
|
children: [
|
|
31
|
-
s && /* @__PURE__ */
|
|
32
|
+
s && /* @__PURE__ */ v("div", {
|
|
32
33
|
className: "bg-accent absolute left-0 w-0.5 rounded-md",
|
|
33
34
|
style: {
|
|
34
35
|
top: "0.3em",
|
|
35
36
|
bottom: "0.3em"
|
|
36
37
|
}
|
|
37
38
|
}),
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ v("span", {
|
|
39
40
|
className: "shrink-0",
|
|
40
|
-
children: /* @__PURE__ */
|
|
41
|
+
children: /* @__PURE__ */ v(t.icon, { className: "h-3.5 w-3.5" })
|
|
41
42
|
}),
|
|
42
|
-
!i && /* @__PURE__ */
|
|
43
|
+
!i && /* @__PURE__ */ v("span", {
|
|
43
44
|
className: "min-w-0 flex-1 truncate text-xs",
|
|
44
45
|
children: t.label
|
|
45
46
|
}),
|
|
46
|
-
!i && t.badge && /* @__PURE__ */
|
|
47
|
+
!i && t.badge && /* @__PURE__ */ v("span", {
|
|
47
48
|
className: "ml-auto shrink-0",
|
|
48
49
|
children: t.badge
|
|
49
50
|
})
|
|
50
51
|
]
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function F({ brand: t, collapsed: n }) {
|
|
54
55
|
let r = t.icon, i = t.name.trim().charAt(0).toUpperCase();
|
|
55
|
-
return t.logo && !n ? /* @__PURE__ */
|
|
56
|
+
return t.logo && !n ? /* @__PURE__ */ v("div", {
|
|
56
57
|
className: "flex min-w-0 items-center gap-2 px-2",
|
|
57
58
|
children: t.logo
|
|
58
|
-
}) : /* @__PURE__ */
|
|
59
|
+
}) : /* @__PURE__ */ y("div", {
|
|
59
60
|
className: e("flex min-w-0 items-center gap-2 px-2", n && "mx-auto justify-center px-0"),
|
|
60
|
-
children: [r ? /* @__PURE__ */
|
|
61
|
+
children: [r ? /* @__PURE__ */ v(r, { className: "text-accent h-3.5 w-3.5 shrink-0" }) : n && i && /* @__PURE__ */ v("span", {
|
|
61
62
|
className: "text-accent-fg shrink-0 text-xs font-bold",
|
|
62
63
|
children: i
|
|
63
|
-
}), !n && /* @__PURE__ */
|
|
64
|
+
}), !n && /* @__PURE__ */ v("span", {
|
|
64
65
|
className: "text-text-primary truncate text-xs font-semibold",
|
|
65
66
|
children: t.name
|
|
66
67
|
})]
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function I(e) {
|
|
70
71
|
return e.role ?? e.email;
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
let [
|
|
74
|
-
c(
|
|
75
|
-
...
|
|
73
|
+
function L({ collapsed: t, accounts: n, initialAccountIndex: r = 0, onAccountChange: o, onSignOut: l, signOutPath: u, signOutLabel: f = "Sign out", onNavigate: m }) {
|
|
74
|
+
let [b, S] = g(!1), T = a(), [E, D] = g(() => Math.min(r, Math.max(n.length - 1, 0))), O = h(null), A = h(null), j = p(() => S(!1), []);
|
|
75
|
+
c(b, j, [A], [O]), s(b, O, A, {
|
|
76
|
+
...N,
|
|
76
77
|
onAnchorHidden: j
|
|
77
78
|
});
|
|
78
|
-
let
|
|
79
|
-
function
|
|
80
|
-
|
|
79
|
+
let M = n[E] ?? n[0], P = !!(l || u);
|
|
80
|
+
function F() {
|
|
81
|
+
S(!b);
|
|
81
82
|
}
|
|
82
83
|
function L(e, t) {
|
|
83
|
-
D(t), o?.(e, t),
|
|
84
|
+
D(t), o?.(e, t), S(!1);
|
|
84
85
|
}
|
|
85
86
|
function R() {
|
|
86
|
-
|
|
87
|
+
S(!1), l ? l() : u && i(u, m);
|
|
87
88
|
}
|
|
88
|
-
return
|
|
89
|
+
return M ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ y("button", {
|
|
89
90
|
type: "button",
|
|
90
|
-
ref:
|
|
91
|
-
onClick:
|
|
91
|
+
ref: O,
|
|
92
|
+
onClick: F,
|
|
92
93
|
className: e("font-navigation flex w-full cursor-pointer items-center gap-2 rounded px-2 transition-colors duration-[100ms]", "text-text-secondary hover:text-text-primary hover:bg-bg-hover", t && "justify-center px-0"),
|
|
93
94
|
style: { height: "2.5em" },
|
|
94
|
-
title: t ?
|
|
95
|
-
children: [/* @__PURE__ */
|
|
96
|
-
name:
|
|
97
|
-
src:
|
|
95
|
+
title: t ? M.name : void 0,
|
|
96
|
+
children: [/* @__PURE__ */ v(d, {
|
|
97
|
+
name: M.name,
|
|
98
|
+
src: M.avatarSrc,
|
|
98
99
|
size: "sm"
|
|
99
|
-
}), !t && /* @__PURE__ */
|
|
100
|
+
}), !t && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ y("div", {
|
|
100
101
|
className: "min-w-0 flex-1 text-left",
|
|
101
|
-
children: [/* @__PURE__ */
|
|
102
|
+
children: [/* @__PURE__ */ v("p", {
|
|
102
103
|
className: "text-text-primary truncate text-xs leading-tight font-medium",
|
|
103
|
-
children:
|
|
104
|
-
}),
|
|
104
|
+
children: M.name
|
|
105
|
+
}), I(M) && /* @__PURE__ */ v("p", {
|
|
105
106
|
className: "text-2xs text-text-tertiary truncate leading-tight",
|
|
106
|
-
children:
|
|
107
|
+
children: I(M)
|
|
107
108
|
})]
|
|
108
|
-
}), /* @__PURE__ */
|
|
109
|
-
}),
|
|
109
|
+
}), /* @__PURE__ */ v(C, { className: "text-text-tertiary h-3 w-3 shrink-0" })] })]
|
|
110
|
+
}), b && k(/* @__PURE__ */ y("div", {
|
|
110
111
|
ref: A,
|
|
111
112
|
className: "ui-glass ui-glass-popover bg-bg-tertiary border-border-strong animate-scale-in fixed top-0 left-0 z-[100] w-56 rounded-md border py-1 shadow-lg",
|
|
112
113
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ v("p", {
|
|
114
115
|
className: "text-2xs-f text-text-tertiary font-label px-3 py-1.5 font-semibold tracking-wider uppercase",
|
|
115
116
|
children: "Accounts"
|
|
116
117
|
}),
|
|
117
|
-
n.map((e, t) => /* @__PURE__ */
|
|
118
|
+
n.map((e, t) => /* @__PURE__ */ y("button", {
|
|
118
119
|
type: "button",
|
|
119
120
|
onClick: () => L(e, t),
|
|
120
121
|
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-8 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
121
122
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ v(d, {
|
|
123
124
|
name: e.name,
|
|
124
125
|
src: e.avatarSrc,
|
|
125
126
|
size: "sm"
|
|
126
127
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ y("div", {
|
|
128
129
|
className: "min-w-0 flex-1 text-left",
|
|
129
|
-
children: [/* @__PURE__ */
|
|
130
|
+
children: [/* @__PURE__ */ v("p", {
|
|
130
131
|
className: "text-text-primary truncate text-xs leading-tight",
|
|
131
132
|
children: e.name
|
|
132
|
-
}), e.email && /* @__PURE__ */
|
|
133
|
+
}), e.email && /* @__PURE__ */ v("p", {
|
|
133
134
|
className: "text-2xs text-text-tertiary truncate leading-tight",
|
|
134
135
|
children: e.email
|
|
135
136
|
})]
|
|
136
137
|
}),
|
|
137
|
-
t === E && /* @__PURE__ */
|
|
138
|
+
t === E && /* @__PURE__ */ v(x, { className: "text-accent h-3.5 w-3.5 shrink-0" })
|
|
138
139
|
]
|
|
139
140
|
}, `${e.name}-${e.email ?? t}`)),
|
|
140
|
-
P && /* @__PURE__ */
|
|
141
|
+
P && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", { className: "border-border my-1 border-t" }), /* @__PURE__ */ y("button", {
|
|
141
142
|
type: "button",
|
|
142
143
|
onClick: R,
|
|
143
144
|
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
144
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ v(w, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ v("span", { children: f })]
|
|
145
146
|
})] })
|
|
146
147
|
]
|
|
147
148
|
}), T ?? document.body)] }) : null;
|
|
148
149
|
}
|
|
149
|
-
function
|
|
150
|
-
let [
|
|
151
|
-
c(
|
|
152
|
-
...
|
|
153
|
-
onAnchorHidden:
|
|
150
|
+
function R({ collapsed: t, settingsPath: n, settingsLabel: r = "All Settings", onOpenSettings: d, onNavigate: m }) {
|
|
151
|
+
let [S, C] = g(!1), w = a(), A = h(null), j = h(null), { resolvedTheme: M, accentColor: P, setAccentColor: F, reducedMotion: I, setReducedMotion: L, colorMode: R, setColorMode: z } = l(), B = u(M), { toast: V } = f(), H = !!(n || d), U = p(() => C(!1), []);
|
|
152
|
+
c(S, U, [j], [A]), s(S, A, j, {
|
|
153
|
+
...N,
|
|
154
|
+
onAnchorHidden: U
|
|
154
155
|
});
|
|
155
|
-
function
|
|
156
|
-
|
|
156
|
+
function W() {
|
|
157
|
+
C(!S);
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
-
|
|
159
|
+
function G() {
|
|
160
|
+
C(!1), d ? d() : n && i(n, m);
|
|
160
161
|
}
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ y("button", {
|
|
162
163
|
type: "button",
|
|
163
|
-
ref:
|
|
164
|
-
onClick:
|
|
165
|
-
className: e("font-navigation relative flex w-full items-center gap-2 rounded px-2", "cursor-pointer transition-colors duration-[100ms]", t ? "mx-auto w-[2em] justify-center" : "",
|
|
164
|
+
ref: A,
|
|
165
|
+
onClick: W,
|
|
166
|
+
className: e("font-navigation relative flex w-full items-center gap-2 rounded px-2", "cursor-pointer transition-colors duration-[100ms]", t ? "mx-auto w-[2em] justify-center" : "", S ? "bg-accent-muted text-accent-fg" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
|
|
166
167
|
style: { height: "2em" },
|
|
167
168
|
title: t ? "Settings" : void 0,
|
|
168
|
-
children: [/* @__PURE__ */
|
|
169
|
+
children: [/* @__PURE__ */ v(D, { className: "h-3.5 w-3.5 shrink-0" }), !t && /* @__PURE__ */ v("span", {
|
|
169
170
|
className: "truncate text-xs",
|
|
170
171
|
children: "Settings"
|
|
171
172
|
})]
|
|
172
|
-
}),
|
|
173
|
-
ref:
|
|
173
|
+
}), S && k(/* @__PURE__ */ y("div", {
|
|
174
|
+
ref: j,
|
|
174
175
|
className: "ui-glass ui-glass-popover bg-bg-tertiary border-border-strong animate-scale-in fixed top-0 left-0 z-[100] w-64 rounded-md border py-1 shadow-lg",
|
|
175
176
|
children: [
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ v("p", {
|
|
177
178
|
className: "text-2xs-f text-text-tertiary font-label px-3 py-1.5 font-semibold tracking-wider uppercase",
|
|
178
179
|
children: "Mode"
|
|
179
180
|
}),
|
|
@@ -181,128 +182,129 @@ function L({ collapsed: t, settingsPath: n, settingsLabel: r = "All Settings", o
|
|
|
181
182
|
{
|
|
182
183
|
value: "dark",
|
|
183
184
|
label: "Dark",
|
|
184
|
-
Icon:
|
|
185
|
+
Icon: E
|
|
185
186
|
},
|
|
186
187
|
{
|
|
187
188
|
value: "light",
|
|
188
189
|
label: "Light",
|
|
189
|
-
Icon:
|
|
190
|
+
Icon: O
|
|
190
191
|
},
|
|
191
192
|
{
|
|
192
193
|
value: "system",
|
|
193
194
|
label: "System",
|
|
194
|
-
Icon:
|
|
195
|
+
Icon: T
|
|
195
196
|
}
|
|
196
|
-
].map(({ value: e, label: t, Icon: n }) => /* @__PURE__ */
|
|
197
|
+
].map(({ value: e, label: t, Icon: n }) => /* @__PURE__ */ y("button", {
|
|
197
198
|
type: "button",
|
|
198
|
-
onClick: () =>
|
|
199
|
+
onClick: () => z(e),
|
|
199
200
|
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
200
201
|
children: [
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ v(n, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
203
|
+
/* @__PURE__ */ v("span", {
|
|
203
204
|
className: "flex-1 text-left",
|
|
204
205
|
children: t
|
|
205
206
|
}),
|
|
206
|
-
|
|
207
|
+
R === e && /* @__PURE__ */ v(x, { className: "text-accent h-3.5 w-3.5 shrink-0" })
|
|
207
208
|
]
|
|
208
209
|
}, e)),
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ v("div", { className: "border-border my-1 border-t" }),
|
|
211
|
+
/* @__PURE__ */ v("p", {
|
|
211
212
|
className: "text-2xs-f text-text-tertiary font-label px-3 py-1.5 font-semibold tracking-wider uppercase",
|
|
212
|
-
children: "Accent"
|
|
213
|
+
children: B ? "Studio uses its own accent" : "Accent"
|
|
213
214
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ v("div", {
|
|
215
216
|
className: "flex flex-wrap gap-1.5 px-3 pb-2",
|
|
216
|
-
children: o.map((t) => /* @__PURE__ */
|
|
217
|
+
children: o.map((t) => /* @__PURE__ */ v("button", {
|
|
217
218
|
type: "button",
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
disabled: B,
|
|
220
|
+
onClick: () => F(t.value),
|
|
221
|
+
className: e("h-5 w-5 cursor-pointer rounded-full transition-transform duration-[100ms] hover:scale-110 disabled:cursor-not-allowed disabled:opacity-40", !B && P === t.value && "ring-offset-bg-tertiary scale-110 ring-2 ring-offset-1"),
|
|
220
222
|
style: {
|
|
221
223
|
backgroundColor: t.color,
|
|
222
|
-
|
|
224
|
+
...!B && P === t.value ? { "--utility-ring-color": t.color } : {}
|
|
223
225
|
},
|
|
224
226
|
title: t.value.charAt(0).toUpperCase() + t.value.slice(1)
|
|
225
227
|
}, t.value))
|
|
226
228
|
}),
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ v("div", { className: "border-border my-1 border-t" }),
|
|
230
|
+
/* @__PURE__ */ y("button", {
|
|
229
231
|
type: "button",
|
|
230
232
|
onClick: () => {
|
|
231
|
-
|
|
233
|
+
L(!I), V("info", I ? "Animations enabled" : "Animations disabled");
|
|
232
234
|
},
|
|
233
235
|
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
234
236
|
children: [
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ v(b, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
238
|
+
/* @__PURE__ */ v("span", {
|
|
237
239
|
className: "flex-1 text-left",
|
|
238
240
|
children: "Reduced Motion"
|
|
239
241
|
}),
|
|
240
|
-
|
|
242
|
+
I && /* @__PURE__ */ v(x, { className: "text-accent h-3.5 w-3.5 shrink-0" })
|
|
241
243
|
]
|
|
242
244
|
}),
|
|
243
|
-
|
|
245
|
+
H && /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", { className: "border-border my-1 border-t" }), /* @__PURE__ */ y("button", {
|
|
244
246
|
type: "button",
|
|
245
|
-
onClick:
|
|
247
|
+
onClick: G,
|
|
246
248
|
className: "text-text-secondary hover:text-text-primary hover:bg-bg-hover font-navigation flex h-7 w-full cursor-pointer items-center gap-2.5 px-3 text-xs transition-colors duration-[100ms]",
|
|
247
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ v(D, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ v("span", {
|
|
248
250
|
className: "flex-1 text-left",
|
|
249
251
|
children: r
|
|
250
252
|
})]
|
|
251
253
|
})] })
|
|
252
254
|
]
|
|
253
|
-
}),
|
|
255
|
+
}), w ?? document.body)] });
|
|
254
256
|
}
|
|
255
|
-
function
|
|
256
|
-
let { sidebarCollapsed: O, sidebarWidth:
|
|
257
|
+
function z({ navSections: n, brand: r, accounts: i = [], initialAccountIndex: a, onAccountChange: o, onSignOut: s, signOutPath: c, signOutLabel: u, settingsPath: d, settingsLabel: f, onOpenSettings: _, currentPath: b, onNavigate: x, headerActions: C, className: w, style: T, ref: E, ...D }) {
|
|
258
|
+
let { sidebarCollapsed: O, sidebarWidth: k, setSidebarWidth: N } = l(), [I, z] = g(/* @__PURE__ */ new Set()), B = h(null), V = m(() => t(B, E), [E]), H = h(!1), [U, W] = g(!1), G = p((e) => {
|
|
257
259
|
if (O) return;
|
|
258
260
|
e.preventDefault(), H.current = !0, W(!0), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
259
261
|
let t = (e) => {
|
|
260
262
|
if (!H.current || !B.current) return;
|
|
261
263
|
let t = B.current.getBoundingClientRect(), n = e.clientX - t.left;
|
|
262
|
-
|
|
264
|
+
N(Math.max(A, Math.min(n, j)));
|
|
263
265
|
}, n = () => {
|
|
264
266
|
H.current = !1, W(!1), document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
265
267
|
};
|
|
266
268
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
267
|
-
}, [O,
|
|
269
|
+
}, [O, N]);
|
|
268
270
|
function K(e) {
|
|
269
271
|
z((t) => {
|
|
270
272
|
let n = new Set(t);
|
|
271
273
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
272
274
|
});
|
|
273
275
|
}
|
|
274
|
-
return /* @__PURE__ */
|
|
276
|
+
return /* @__PURE__ */ y("aside", {
|
|
275
277
|
...D,
|
|
276
278
|
ref: V,
|
|
277
279
|
className: e("ui-glass ui-glass-chrome bg-bg-secondary relative hidden shrink-0 flex-col border-r md:flex", !U && "transition-[width] duration-[200ms] ease-out", "border-border", w),
|
|
278
280
|
style: {
|
|
279
|
-
width: O ?
|
|
281
|
+
width: O ? M : k,
|
|
280
282
|
...T
|
|
281
283
|
},
|
|
282
284
|
children: [
|
|
283
|
-
!O && /* @__PURE__ */
|
|
285
|
+
!O && /* @__PURE__ */ v("div", {
|
|
284
286
|
onMouseDown: G,
|
|
285
287
|
className: "hover:bg-accent/30 active:bg-accent/50 absolute top-0 right-0 bottom-0 z-10 w-1 cursor-col-resize"
|
|
286
288
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ v("div", {
|
|
288
290
|
className: "border-border flex shrink-0 items-center border-b px-2",
|
|
289
291
|
style: { height: "var(--topbar-height)" },
|
|
290
|
-
children: /* @__PURE__ */
|
|
292
|
+
children: /* @__PURE__ */ v(F, {
|
|
291
293
|
brand: r,
|
|
292
294
|
collapsed: O
|
|
293
295
|
})
|
|
294
296
|
}),
|
|
295
|
-
!O && C && /* @__PURE__ */
|
|
297
|
+
!O && C && /* @__PURE__ */ v("div", {
|
|
296
298
|
className: "border-border shrink-0 border-b px-2 py-2",
|
|
297
299
|
children: C
|
|
298
300
|
}),
|
|
299
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ v("nav", {
|
|
300
302
|
className: "flex-1 overflow-y-auto px-2 py-2",
|
|
301
303
|
children: n.map((t, n) => {
|
|
302
|
-
let r =
|
|
303
|
-
return /* @__PURE__ */
|
|
304
|
+
let r = I.has(t.title);
|
|
305
|
+
return /* @__PURE__ */ y("div", {
|
|
304
306
|
className: "mb-4",
|
|
305
|
-
children: [O ? n > 0 && /* @__PURE__ */
|
|
307
|
+
children: [O ? n > 0 && /* @__PURE__ */ v("hr", { className: "border-border mx-auto my-1.5 w-4/5" }) : /* @__PURE__ */ y("button", {
|
|
306
308
|
type: "button",
|
|
307
309
|
onClick: () => K(t.title),
|
|
308
310
|
className: "text-2xs-f text-text-tertiary hover:text-text-secondary font-label flex w-full cursor-pointer items-center gap-1 px-2 text-left font-semibold tracking-wider uppercase",
|
|
@@ -310,33 +312,33 @@ function R({ navSections: n, brand: r, accounts: i = [], initialAccountIndex: a,
|
|
|
310
312
|
paddingTop: "0.35em",
|
|
311
313
|
paddingBottom: "0.35em"
|
|
312
314
|
},
|
|
313
|
-
children: [/* @__PURE__ */
|
|
315
|
+
children: [/* @__PURE__ */ v("span", {
|
|
314
316
|
className: "min-w-0 flex-1",
|
|
315
317
|
children: t.title
|
|
316
|
-
}), /* @__PURE__ */
|
|
317
|
-
}), (!r || O) && /* @__PURE__ */
|
|
318
|
+
}), /* @__PURE__ */ v(S, { className: e("h-3 w-3 shrink-0 transition-transform", r && "-rotate-90") })]
|
|
319
|
+
}), (!r || O) && /* @__PURE__ */ v("ul", {
|
|
318
320
|
className: "flex flex-col gap-1",
|
|
319
|
-
children: t.items.map((e) => /* @__PURE__ */
|
|
321
|
+
children: t.items.map((e) => /* @__PURE__ */ v("li", { children: /* @__PURE__ */ v(P, {
|
|
320
322
|
item: e,
|
|
321
323
|
collapsed: O,
|
|
322
324
|
currentPath: b,
|
|
323
|
-
onNavigate:
|
|
325
|
+
onNavigate: x
|
|
324
326
|
}) }, e.path))
|
|
325
327
|
})]
|
|
326
328
|
}, t.title);
|
|
327
329
|
})
|
|
328
330
|
}),
|
|
329
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ y("div", {
|
|
330
332
|
className: "shrink-0 px-2 py-1.5",
|
|
331
|
-
children: [/* @__PURE__ */
|
|
333
|
+
children: [/* @__PURE__ */ v(R, {
|
|
332
334
|
collapsed: O,
|
|
333
335
|
settingsPath: d,
|
|
334
|
-
settingsLabel:
|
|
335
|
-
onOpenSettings:
|
|
336
|
-
onNavigate:
|
|
337
|
-
}), i.length > 0 && /* @__PURE__ */
|
|
336
|
+
settingsLabel: f,
|
|
337
|
+
onOpenSettings: _,
|
|
338
|
+
onNavigate: x
|
|
339
|
+
}), i.length > 0 && /* @__PURE__ */ v("div", {
|
|
338
340
|
className: "border-border mt-2 border-t pt-2",
|
|
339
|
-
children: /* @__PURE__ */
|
|
341
|
+
children: /* @__PURE__ */ v(L, {
|
|
340
342
|
collapsed: O,
|
|
341
343
|
accounts: i,
|
|
342
344
|
initialAccountIndex: a,
|
|
@@ -344,7 +346,7 @@ function R({ navSections: n, brand: r, accounts: i = [], initialAccountIndex: a,
|
|
|
344
346
|
onSignOut: s,
|
|
345
347
|
signOutPath: c,
|
|
346
348
|
signOutLabel: u,
|
|
347
|
-
onNavigate:
|
|
349
|
+
onNavigate: x
|
|
348
350
|
})
|
|
349
351
|
})]
|
|
350
352
|
})
|
|
@@ -352,4 +354,4 @@ function R({ navSections: n, brand: r, accounts: i = [], initialAccountIndex: a,
|
|
|
352
354
|
});
|
|
353
355
|
}
|
|
354
356
|
//#endregion
|
|
355
|
-
export {
|
|
357
|
+
export { z as Sidebar };
|