@kopexa/sidebar 17.2.0 → 17.2.1
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/{chunk-3L2F566G.mjs → chunk-AIRHHM7Z.mjs} +4 -0
- package/dist/{chunk-CMYTESJM.mjs → chunk-KLYPP6QE.mjs} +11 -13
- package/dist/{chunk-WA2NSEYE.mjs → chunk-LCCZNS2E.mjs} +3 -3
- package/dist/{chunk-PZFEB2PM.mjs → chunk-YVQVW5EP.mjs} +9 -15
- package/dist/chunk-YW3JMPRU.mjs +329 -0
- package/dist/index.js +83 -216
- package/dist/index.mjs +5 -5
- package/dist/v2/app-shell.js +9 -14
- package/dist/v2/app-shell.mjs +2 -2
- package/dist/v2/components.js +60 -188
- package/dist/v2/components.mjs +2 -2
- package/dist/v2/context.d.mts +3 -0
- package/dist/v2/context.d.ts +3 -0
- package/dist/v2/context.js +4 -0
- package/dist/v2/context.mjs +1 -1
- package/dist/v2/from-config.js +67 -190
- package/dist/v2/from-config.mjs +3 -3
- package/dist/v2/index.d.mts +1 -0
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +83 -216
- package/dist/v2/index.mjs +5 -5
- package/package.json +11 -11
- package/dist/chunk-EIXUCY5M.mjs +0 -458
package/dist/v2/from-config.js
CHANGED
|
@@ -34,12 +34,13 @@ var import_react4 = require("react");
|
|
|
34
34
|
var import_button = require("@kopexa/button");
|
|
35
35
|
var import_icons = require("@kopexa/icons");
|
|
36
36
|
var import_shared_utils = require("@kopexa/shared-utils");
|
|
37
|
-
var
|
|
37
|
+
var import_theme2 = require("@kopexa/theme");
|
|
38
38
|
var import_tooltip2 = require("@kopexa/tooltip");
|
|
39
39
|
var import_react2 = require("react");
|
|
40
40
|
|
|
41
41
|
// src/v2/context.tsx
|
|
42
42
|
var import_react_utils = require("@kopexa/react-utils");
|
|
43
|
+
var import_theme = require("@kopexa/theme");
|
|
43
44
|
var import_tooltip = require("@kopexa/tooltip");
|
|
44
45
|
var import_use_is_mobile = require("@kopexa/use-is-mobile");
|
|
45
46
|
var import_react = require("react");
|
|
@@ -61,24 +62,18 @@ function panelItemIsSection(item) {
|
|
|
61
62
|
// src/v2/components.tsx
|
|
62
63
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
63
64
|
function SidebarV2Rail({ className, ...props }) {
|
|
64
|
-
const {
|
|
65
|
-
const light = tone === "light";
|
|
65
|
+
const { styles } = useSidebarV2();
|
|
66
66
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
67
67
|
"nav",
|
|
68
68
|
{
|
|
69
69
|
"data-slot": "sidebar-v2-rail",
|
|
70
|
-
className: (
|
|
71
|
-
"flex w-(--kpx-rail-width) shrink-0 flex-col overflow-hidden bg-sidebar py-2 text-sidebar-foreground",
|
|
72
|
-
// Light tone: the dark rail floats as a rounded card on the light
|
|
73
|
-
// surround. Dark tone: full-height, flush to the edge.
|
|
74
|
-
light ? "m-2 rounded-2xl shadow-sm" : "h-full",
|
|
75
|
-
className
|
|
76
|
-
),
|
|
70
|
+
className: styles.rail({ className }),
|
|
77
71
|
...props
|
|
78
72
|
}
|
|
79
73
|
);
|
|
80
74
|
}
|
|
81
75
|
var SidebarV2Workspace = (0, import_react2.forwardRef)(({ name, role, logo, className, appearance = "rail", ...props }, ref) => {
|
|
76
|
+
const { styles } = useSidebarV2();
|
|
82
77
|
if (appearance === "bar") {
|
|
83
78
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
84
79
|
"button",
|
|
@@ -87,19 +82,15 @@ var SidebarV2Workspace = (0, import_react2.forwardRef)(({ name, role, logo, clas
|
|
|
87
82
|
type: "button",
|
|
88
83
|
"data-slot": "sidebar-v2-workspace",
|
|
89
84
|
"aria-label": role ? `${name} \u2013 ${role}` : name,
|
|
90
|
-
className: (
|
|
91
|
-
"group/ws flex cursor-pointer items-center gap-2 rounded-lg py-1 pr-2 pl-1",
|
|
92
|
-
"outline-hidden ring-ring transition-colors hover:bg-foreground/5 focus-visible:ring-2",
|
|
93
|
-
className
|
|
94
|
-
),
|
|
85
|
+
className: styles.workspaceBar({ className }),
|
|
95
86
|
...props,
|
|
96
87
|
children: [
|
|
97
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className:
|
|
98
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className:
|
|
99
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className:
|
|
100
|
-
role && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className:
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.workspaceBarLogo(), children: logo != null ? logo : name.charAt(0).toUpperCase() }),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: styles.workspaceBarText(), children: [
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.workspaceBarName(), children: name }),
|
|
91
|
+
role && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.workspaceBarRole(), children: role })
|
|
101
92
|
] }),
|
|
102
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronDownIcon, { className:
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronDownIcon, { className: styles.workspaceBarChevron() })
|
|
103
94
|
]
|
|
104
95
|
}
|
|
105
96
|
);
|
|
@@ -111,48 +102,25 @@ var SidebarV2Workspace = (0, import_react2.forwardRef)(({ name, role, logo, clas
|
|
|
111
102
|
type: "button",
|
|
112
103
|
"data-slot": "sidebar-v2-workspace",
|
|
113
104
|
"aria-label": role ? `${name} \u2013 ${role}` : name,
|
|
114
|
-
className: (
|
|
115
|
-
"group/ws relative mx-auto mt-1 flex cursor-pointer items-center justify-center rounded-lg p-1",
|
|
116
|
-
"outline-hidden ring-sidebar-ring transition-colors",
|
|
117
|
-
"hover:bg-sidebar-accent focus-visible:ring-2",
|
|
118
|
-
className
|
|
119
|
-
),
|
|
105
|
+
className: styles.workspaceRail({ className }),
|
|
120
106
|
...props,
|
|
121
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className:
|
|
107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: styles.workspaceRailLogo(), children: [
|
|
122
108
|
logo != null ? logo : name.charAt(0).toUpperCase(),
|
|
123
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronDownIcon, { className:
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronDownIcon, { className: styles.workspaceRailChevron() })
|
|
124
110
|
] })
|
|
125
111
|
}
|
|
126
112
|
);
|
|
127
113
|
});
|
|
128
114
|
SidebarV2Workspace.displayName = "SidebarV2Workspace";
|
|
129
|
-
function railButtonClasses(active) {
|
|
130
|
-
return (0, import_shared_utils.cn)(
|
|
131
|
-
"group/rail relative mx-auto flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-xl",
|
|
132
|
-
"outline-hidden ring-sidebar-ring transition-colors",
|
|
133
|
-
"text-sidebar-foreground/85 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
134
|
-
"focus-visible:ring-2",
|
|
135
|
-
active && "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
115
|
function RailInner({
|
|
139
116
|
icon: Icon,
|
|
140
|
-
active,
|
|
141
117
|
badge
|
|
142
118
|
}) {
|
|
119
|
+
const { styles } = useSidebarV2();
|
|
143
120
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
144
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"aria-hidden": true,
|
|
148
|
-
className: (0, import_shared_utils.cn)(
|
|
149
|
-
"absolute top-1/2 left-0 h-5 w-0.5 -translate-x-[0.6rem] -translate-y-1/2 rounded-r bg-primary transition-opacity",
|
|
150
|
-
active ? "opacity-100" : "opacity-0"
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
),
|
|
154
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: "size-5 shrink-0" }),
|
|
155
|
-
badge != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "absolute -top-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[0.5625rem] font-semibold text-primary-foreground", children: badge })
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": true, className: styles.railIndicator() }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: styles.railIcon() }),
|
|
123
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.railBadge(), children: badge })
|
|
156
124
|
] });
|
|
157
125
|
}
|
|
158
126
|
function SidebarV2RailLink({
|
|
@@ -161,18 +129,18 @@ function SidebarV2RailLink({
|
|
|
161
129
|
href,
|
|
162
130
|
badge
|
|
163
131
|
}) {
|
|
164
|
-
const { renderLink, isActive, resetPanelSelection } = useSidebarV2();
|
|
132
|
+
const { renderLink, isActive, resetPanelSelection, styles } = useSidebarV2();
|
|
165
133
|
const active = isActive(href);
|
|
166
134
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_tooltip2.Tooltip, { content: label, side: "right", children: renderLink({
|
|
167
135
|
href,
|
|
168
|
-
className:
|
|
136
|
+
className: styles.railButton(),
|
|
169
137
|
"data-active": active,
|
|
170
138
|
"aria-current": active ? "page" : void 0,
|
|
171
139
|
"aria-label": label,
|
|
172
140
|
// Navigating to a destination link clears any open panel preview,
|
|
173
141
|
// even when the route doesn't change (e.g. already on it).
|
|
174
142
|
onClick: resetPanelSelection,
|
|
175
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RailInner, { icon,
|
|
143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RailInner, { icon, badge })
|
|
176
144
|
}) });
|
|
177
145
|
}
|
|
178
146
|
function SidebarV2RailItem({
|
|
@@ -185,6 +153,7 @@ function SidebarV2RailItem({
|
|
|
185
153
|
onMouseLeave,
|
|
186
154
|
badge
|
|
187
155
|
}) {
|
|
156
|
+
const { styles } = useSidebarV2();
|
|
188
157
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_tooltip2.Tooltip, { content: label, side: "right", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
189
158
|
"button",
|
|
190
159
|
{
|
|
@@ -195,8 +164,8 @@ function SidebarV2RailItem({
|
|
|
195
164
|
onClick,
|
|
196
165
|
onMouseEnter,
|
|
197
166
|
onMouseLeave,
|
|
198
|
-
className:
|
|
199
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RailInner, { icon,
|
|
167
|
+
className: styles.railButton(),
|
|
168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RailInner, { icon, badge })
|
|
200
169
|
}
|
|
201
170
|
) });
|
|
202
171
|
}
|
|
@@ -209,54 +178,18 @@ function SidebarV2Panel({
|
|
|
209
178
|
children,
|
|
210
179
|
className
|
|
211
180
|
}) {
|
|
212
|
-
const { togglePin, pinned,
|
|
213
|
-
const light = tone === "light";
|
|
181
|
+
const { togglePin, pinned, styles } = useSidebarV2();
|
|
214
182
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
215
183
|
"div",
|
|
216
184
|
{
|
|
217
185
|
"data-slot": "sidebar-v2-panel",
|
|
218
|
-
"data-floating": floating,
|
|
219
|
-
className: (
|
|
220
|
-
"flex h-full w-(--kpx-panel-width) shrink-0 flex-col",
|
|
221
|
-
// Surface. The flyout is a distinct floating card (white on light),
|
|
222
|
-
// so it reads as an overlay rather than a flat full-height slab.
|
|
223
|
-
floating ? light ? "bg-background text-foreground" : "bg-sidebar text-sidebar-foreground" : light ? "bg-muted text-foreground" : "bg-sidebar text-sidebar-foreground",
|
|
224
|
-
floating ? (
|
|
225
|
-
// Floating card: rounded, soft layered shadow, hairline ring.
|
|
226
|
-
(0, import_shared_utils.cn)(
|
|
227
|
-
"overflow-hidden rounded-2xl shadow-2xl shadow-black/20 ring-1",
|
|
228
|
-
light ? "ring-black/5" : "ring-white/10"
|
|
229
|
-
)
|
|
230
|
-
) : (
|
|
231
|
-
// Pinned: light blends into the surround (no border); dark keeps a
|
|
232
|
-
// hairline against the rail.
|
|
233
|
-
light ? "" : "border-l border-sidebar-border/40"
|
|
234
|
-
),
|
|
235
|
-
className
|
|
236
|
-
),
|
|
186
|
+
"data-floating": floating ? "true" : "false",
|
|
187
|
+
className: styles.panel({ className }),
|
|
237
188
|
children: [
|
|
238
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className:
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.panelHeader(), children: [
|
|
239
190
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
240
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
241
|
-
|
|
242
|
-
{
|
|
243
|
-
className: (0, import_shared_utils.cn)(
|
|
244
|
-
"truncate text-sm font-semibold",
|
|
245
|
-
light ? "text-foreground" : "text-sidebar-foreground"
|
|
246
|
-
),
|
|
247
|
-
children: title
|
|
248
|
-
}
|
|
249
|
-
),
|
|
250
|
-
subtitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
251
|
-
"div",
|
|
252
|
-
{
|
|
253
|
-
className: (0, import_shared_utils.cn)(
|
|
254
|
-
"truncate text-xs",
|
|
255
|
-
light ? "text-muted-foreground" : "text-sidebar-foreground/70"
|
|
256
|
-
),
|
|
257
|
-
children: subtitle
|
|
258
|
-
}
|
|
259
|
-
)
|
|
191
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.panelTitle(), children: title }),
|
|
192
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.panelSubtitle(), children: subtitle })
|
|
260
193
|
] }),
|
|
261
194
|
action != null ? action : !hidePin && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
262
195
|
import_tooltip2.Tooltip,
|
|
@@ -270,41 +203,28 @@ function SidebarV2Panel({
|
|
|
270
203
|
size: "sm",
|
|
271
204
|
"aria-label": pinned ? "Panel l\xF6sen" : "Panel anheften",
|
|
272
205
|
onClick: togglePin,
|
|
273
|
-
className: (
|
|
274
|
-
"-mr-1 shrink-0",
|
|
275
|
-
light ? "text-muted-foreground hover:bg-foreground/5 hover:text-foreground" : "text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
276
|
-
),
|
|
206
|
+
className: styles.panelPin(),
|
|
277
207
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.PanelLeftIcon, { className: "size-4" })
|
|
278
208
|
}
|
|
279
209
|
)
|
|
280
210
|
}
|
|
281
211
|
)
|
|
282
212
|
] }),
|
|
283
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className:
|
|
213
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.panelBody(), children })
|
|
284
214
|
]
|
|
285
215
|
}
|
|
286
216
|
);
|
|
287
217
|
}
|
|
288
|
-
function panelRowLight(active) {
|
|
289
|
-
return (0, import_shared_utils.cn)(
|
|
290
|
-
"flex h-8 w-full items-center gap-2.5 rounded-md px-2 text-sm outline-hidden ring-ring transition-colors focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
291
|
-
active ? "bg-primary/10 font-medium text-primary" : "text-foreground/80 hover:bg-foreground/5"
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
218
|
function SidebarV2PanelLabel({
|
|
295
219
|
className,
|
|
296
220
|
...props
|
|
297
221
|
}) {
|
|
298
|
-
const {
|
|
222
|
+
const { styles } = useSidebarV2();
|
|
299
223
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
300
224
|
"div",
|
|
301
225
|
{
|
|
302
226
|
"data-slot": "sidebar-v2-panel-label",
|
|
303
|
-
className: (
|
|
304
|
-
"px-2 pt-3 pb-1 text-[0.6875rem] font-medium uppercase tracking-wide",
|
|
305
|
-
tone === "light" ? "text-muted-foreground" : "text-sidebar-foreground/50",
|
|
306
|
-
className
|
|
307
|
-
),
|
|
227
|
+
className: styles.panelLabel({ className }),
|
|
308
228
|
...props
|
|
309
229
|
}
|
|
310
230
|
);
|
|
@@ -313,7 +233,7 @@ function SidebarV2PanelLeaf({
|
|
|
313
233
|
item,
|
|
314
234
|
active: activeProp
|
|
315
235
|
}) {
|
|
316
|
-
const { renderLink, isActive, tone } = useSidebarV2();
|
|
236
|
+
const { renderLink, isActive, tone, styles } = useSidebarV2();
|
|
317
237
|
const light = tone === "light";
|
|
318
238
|
const Icon = item.icon;
|
|
319
239
|
const active = activeProp != null ? activeProp : isActive(item.href);
|
|
@@ -321,27 +241,13 @@ function SidebarV2PanelLeaf({
|
|
|
321
241
|
href: item.href,
|
|
322
242
|
"data-active": active,
|
|
323
243
|
"aria-current": active ? "page" : void 0,
|
|
324
|
-
|
|
244
|
+
// Light tone uses the recipe's leaf slot (group/leaf + data-active);
|
|
245
|
+
// dark tone reuses the existing sidebarMenuButton recipe.
|
|
246
|
+
className: light ? styles.panelLeaf() : (0, import_theme2.sidebarMenuButton)({ size: "md" }),
|
|
325
247
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
326
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
className: (0, import_shared_utils.cn)(
|
|
330
|
-
light ? active ? void 0 : "text-muted-foreground" : "text-sidebar-foreground/75"
|
|
331
|
-
)
|
|
332
|
-
}
|
|
333
|
-
),
|
|
334
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
|
|
335
|
-
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
336
|
-
"span",
|
|
337
|
-
{
|
|
338
|
-
className: (0, import_shared_utils.cn)(
|
|
339
|
-
"ml-auto rounded-full px-1.5 text-[0.625rem] font-medium",
|
|
340
|
-
light ? "bg-foreground/10 text-foreground/70" : "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
341
|
-
),
|
|
342
|
-
children: item.badge
|
|
343
|
-
}
|
|
344
|
-
)
|
|
248
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: styles.panelLeafIcon() }),
|
|
249
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.panelLeafLabel(), children: item.label }),
|
|
250
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.panelLeafBadge(), children: item.badge })
|
|
345
251
|
] })
|
|
346
252
|
}) });
|
|
347
253
|
}
|
|
@@ -349,7 +255,7 @@ function SidebarV2PanelGroup({
|
|
|
349
255
|
item
|
|
350
256
|
}) {
|
|
351
257
|
var _a;
|
|
352
|
-
const { openGroup, toggleGroup, activeHref, renderLink, tone } = useSidebarV2();
|
|
258
|
+
const { openGroup, toggleGroup, activeHref, renderLink, tone, styles } = useSidebarV2();
|
|
353
259
|
const light = tone === "light";
|
|
354
260
|
const Icon = item.icon;
|
|
355
261
|
const key = (_a = item.value) != null ? _a : item.label;
|
|
@@ -373,57 +279,30 @@ function SidebarV2PanelGroup({
|
|
|
373
279
|
{
|
|
374
280
|
type: "button",
|
|
375
281
|
"data-state": open ? "open" : "closed",
|
|
282
|
+
"data-contains-active": containsActive,
|
|
376
283
|
"aria-expanded": open,
|
|
377
284
|
onClick: () => toggleGroup(key),
|
|
378
285
|
className: (0, import_shared_utils.cn)(
|
|
379
|
-
light ?
|
|
380
|
-
|
|
381
|
-
containsActive && (light ? "font-medium text-foreground" : "font-medium")
|
|
286
|
+
light ? styles.panelLeaf() : (0, import_theme2.sidebarMenuButton)({ size: "md" }),
|
|
287
|
+
styles.panelGroupButton()
|
|
382
288
|
),
|
|
383
289
|
children: [
|
|
384
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
className: light ? "text-muted-foreground" : "text-sidebar-foreground/75"
|
|
388
|
-
}
|
|
389
|
-
),
|
|
390
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "min-w-0 flex-1 truncate text-left", children: item.label }),
|
|
391
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
392
|
-
import_icons.ChevronRightIcon,
|
|
393
|
-
{
|
|
394
|
-
className: (0, import_shared_utils.cn)(
|
|
395
|
-
"size-3.5! shrink-0 transition-transform",
|
|
396
|
-
light ? "text-muted-foreground" : "text-sidebar-foreground/60",
|
|
397
|
-
open && "rotate-90"
|
|
398
|
-
)
|
|
399
|
-
}
|
|
400
|
-
)
|
|
290
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: styles.panelGroupIcon() }),
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.panelGroupLabel(), children: item.label }),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronRightIcon, { className: styles.panelGroupChevron() })
|
|
401
293
|
]
|
|
402
294
|
}
|
|
403
295
|
),
|
|
404
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
405
|
-
|
|
406
|
-
{
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
),
|
|
411
|
-
children:
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
href: child.href,
|
|
415
|
-
"data-active": active,
|
|
416
|
-
"aria-current": active ? "page" : void 0,
|
|
417
|
-
className: (0, import_shared_utils.cn)(
|
|
418
|
-
"relative block rounded-md px-2 py-1.5 text-[0.8125rem] outline-hidden transition-colors focus-visible:ring-2",
|
|
419
|
-
"before:absolute before:top-1/2 before:-left-3 before:h-px before:w-2.5",
|
|
420
|
-
light ? active ? "bg-primary/10 font-medium text-primary ring-ring before:bg-primary" : "text-muted-foreground ring-ring hover:bg-foreground/5 hover:text-foreground before:bg-border" : active ? "bg-sidebar-accent font-medium text-sidebar-accent-foreground ring-sidebar-ring before:bg-primary" : "text-sidebar-foreground/80 ring-sidebar-ring hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground before:bg-sidebar-foreground/30"
|
|
421
|
-
),
|
|
422
|
-
children: child.label
|
|
423
|
-
}) }, child.href);
|
|
424
|
-
})
|
|
425
|
-
}
|
|
426
|
-
)
|
|
296
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.panelTree(), children: item.children.map((child) => {
|
|
297
|
+
const active = child.href === bestChildHref;
|
|
298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: renderLink({
|
|
299
|
+
href: child.href,
|
|
300
|
+
"data-active": active,
|
|
301
|
+
"aria-current": active ? "page" : void 0,
|
|
302
|
+
className: styles.subItem(),
|
|
303
|
+
children: child.label
|
|
304
|
+
}) }, child.href);
|
|
305
|
+
}) })
|
|
427
306
|
] });
|
|
428
307
|
}
|
|
429
308
|
function SidebarV2PanelItems({
|
|
@@ -474,7 +353,8 @@ function SidebarV2FromConfig({
|
|
|
474
353
|
setDrawerOpen,
|
|
475
354
|
setPanelHost,
|
|
476
355
|
panelOverrideActive,
|
|
477
|
-
navPreviewActive
|
|
356
|
+
navPreviewActive,
|
|
357
|
+
styles
|
|
478
358
|
} = useSidebarV2();
|
|
479
359
|
const hoverMode = flyoutTrigger === "hover" && !pinned && !isMobile;
|
|
480
360
|
const closeTimer = (0, import_react4.useRef)(null);
|
|
@@ -531,7 +411,7 @@ function SidebarV2FromConfig({
|
|
|
531
411
|
"div",
|
|
532
412
|
{
|
|
533
413
|
"aria-hidden": true,
|
|
534
|
-
className:
|
|
414
|
+
className: styles.railDivider()
|
|
535
415
|
},
|
|
536
416
|
`rail-divider-${index}`
|
|
537
417
|
);
|
|
@@ -583,14 +463,14 @@ function SidebarV2FromConfig({
|
|
|
583
463
|
);
|
|
584
464
|
}
|
|
585
465
|
const railContent = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
586
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className:
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: styles.railScroll(), children: [
|
|
587
467
|
header && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
588
468
|
header,
|
|
589
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className:
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.railHeaderDivider() })
|
|
590
470
|
] }),
|
|
591
471
|
topEntries.map(renderRailEntry)
|
|
592
472
|
] }),
|
|
593
|
-
bottomEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className:
|
|
473
|
+
bottomEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.railBottom(), children: bottomEntries.map(renderRailEntry) })
|
|
594
474
|
] });
|
|
595
475
|
const navData = pinned && shownPanel && (navPreviewActive || !panelOverrideActive) ? shownPanel : null;
|
|
596
476
|
const [bufferedPanel, setBufferedPanel] = (0, import_react4.useState)(navData);
|
|
@@ -622,7 +502,7 @@ function SidebarV2FromConfig({
|
|
|
622
502
|
open: drawerOpen,
|
|
623
503
|
onOpenChange: setDrawerOpen,
|
|
624
504
|
placement: "left",
|
|
625
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_drawer.Drawer.Content, { className:
|
|
505
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_drawer.Drawer.Content, { className: styles.mobileDrawer(), children: [
|
|
626
506
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_drawer.Drawer.Header, { className: "sr-only", children: [
|
|
627
507
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_drawer.Drawer.Title, { children: "Navigation" }),
|
|
628
508
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_drawer.Drawer.Description, { children: "Hauptnavigation" })
|
|
@@ -650,10 +530,7 @@ function SidebarV2FromConfig({
|
|
|
650
530
|
{
|
|
651
531
|
ref: setPanelHost,
|
|
652
532
|
"data-slot": "sidebar-v2-panel-zone",
|
|
653
|
-
className: (0, import_shared_utils2.cn)(
|
|
654
|
-
"relative shrink-0 transition-[width] duration-200 ease-out motion-reduce:transition-none",
|
|
655
|
-
pinned && "overflow-hidden"
|
|
656
|
-
),
|
|
533
|
+
className: (0, import_shared_utils2.cn)(styles.panelZone(), pinned && "overflow-hidden"),
|
|
657
534
|
style: { gridArea: "panel", width: docked ? PANEL_WIDTH : "0px" },
|
|
658
535
|
children: [
|
|
659
536
|
panelContent,
|
|
@@ -661,7 +538,7 @@ function SidebarV2FromConfig({
|
|
|
661
538
|
import_react3.motion.div,
|
|
662
539
|
{
|
|
663
540
|
"data-floating": "true",
|
|
664
|
-
className:
|
|
541
|
+
className: styles.flyout(),
|
|
665
542
|
initial: { x: -14, opacity: 0 },
|
|
666
543
|
animate: { x: 0, opacity: 1 },
|
|
667
544
|
exit: { x: -14, opacity: 0 },
|
package/dist/v2/from-config.mjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
4
|
SidebarV2FromConfig
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-KLYPP6QE.mjs";
|
|
6
|
+
import "../chunk-YW3JMPRU.mjs";
|
|
7
7
|
import "../chunk-SDMGFB6V.mjs";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-AIRHHM7Z.mjs";
|
|
9
9
|
export {
|
|
10
10
|
SidebarV2FromConfig
|
|
11
11
|
};
|
package/dist/v2/index.d.mts
CHANGED
|
@@ -9,6 +9,7 @@ export { SidebarV2Icon, SidebarV2LinkProps, SidebarV2Nav, SidebarV2PanelItem, Si
|
|
|
9
9
|
import 'react';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import '@kopexa/button';
|
|
12
|
+
import '@kopexa/theme';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* SidebarV2 — icon rail + expandable panel navigation context + primitives.
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { SidebarV2Icon, SidebarV2LinkProps, SidebarV2Nav, SidebarV2PanelItem, Si
|
|
|
9
9
|
import 'react';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import '@kopexa/button';
|
|
12
|
+
import '@kopexa/theme';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* SidebarV2 — icon rail + expandable panel navigation context + primitives.
|