@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/index.js
CHANGED
|
@@ -48,12 +48,12 @@ __export(v2_exports, {
|
|
|
48
48
|
module.exports = __toCommonJS(v2_exports);
|
|
49
49
|
|
|
50
50
|
// src/v2/app-shell.tsx
|
|
51
|
-
var import_shared_utils = require("@kopexa/shared-utils");
|
|
52
51
|
var import_react2 = require("react");
|
|
53
52
|
var import_react_dom = require("react-dom");
|
|
54
53
|
|
|
55
54
|
// src/v2/context.tsx
|
|
56
55
|
var import_react_utils = require("@kopexa/react-utils");
|
|
56
|
+
var import_theme = require("@kopexa/theme");
|
|
57
57
|
var import_tooltip = require("@kopexa/tooltip");
|
|
58
58
|
var import_use_is_mobile = require("@kopexa/use-is-mobile");
|
|
59
59
|
var import_react = require("react");
|
|
@@ -93,6 +93,7 @@ function SidebarV2Provider({
|
|
|
93
93
|
}, []);
|
|
94
94
|
const panelOverrideActive = overrideCount > 0;
|
|
95
95
|
const navPreviewActive = pinned ? selectedRail !== null : flyoutValue !== null;
|
|
96
|
+
const styles = (0, import_react.useMemo)(() => (0, import_theme.sidebarV2)({ tone }), [tone]);
|
|
96
97
|
const setPinned = (0, import_react.useCallback)(
|
|
97
98
|
(value2) => {
|
|
98
99
|
onPinnedChange == null ? void 0 : onPinnedChange(value2);
|
|
@@ -128,6 +129,7 @@ function SidebarV2Provider({
|
|
|
128
129
|
const value = (0, import_react.useMemo)(
|
|
129
130
|
() => ({
|
|
130
131
|
tone,
|
|
132
|
+
styles,
|
|
131
133
|
pinned,
|
|
132
134
|
togglePin,
|
|
133
135
|
setPinned,
|
|
@@ -156,6 +158,7 @@ function SidebarV2Provider({
|
|
|
156
158
|
}),
|
|
157
159
|
[
|
|
158
160
|
tone,
|
|
161
|
+
styles,
|
|
159
162
|
pinned,
|
|
160
163
|
togglePin,
|
|
161
164
|
setPinned,
|
|
@@ -198,17 +201,13 @@ function AppShellRoot({
|
|
|
198
201
|
children,
|
|
199
202
|
...props
|
|
200
203
|
}) {
|
|
201
|
-
const { tone } = useSidebarV2();
|
|
204
|
+
const { tone, styles } = useSidebarV2();
|
|
202
205
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
203
206
|
"div",
|
|
204
207
|
{
|
|
205
208
|
"data-slot": "app-shell",
|
|
206
209
|
"data-tone": tone,
|
|
207
|
-
className: (
|
|
208
|
-
"relative isolate grid h-svh w-full overflow-hidden antialiased",
|
|
209
|
-
tone === "light" ? "bg-muted text-foreground" : "bg-sidebar text-sidebar-foreground",
|
|
210
|
-
className
|
|
211
|
-
),
|
|
210
|
+
className: styles.shell({ className }),
|
|
212
211
|
style: {
|
|
213
212
|
"--kpx-rail-width": RAIL_WIDTH,
|
|
214
213
|
"--kpx-panel-width": PANEL_WIDTH,
|
|
@@ -227,26 +226,24 @@ function AppShellHeader({
|
|
|
227
226
|
style,
|
|
228
227
|
...props
|
|
229
228
|
}) {
|
|
229
|
+
const { styles } = useSidebarV2();
|
|
230
230
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
231
231
|
"header",
|
|
232
232
|
{
|
|
233
233
|
"data-slot": "app-shell-header",
|
|
234
|
-
className:
|
|
234
|
+
className: styles.header({ className }),
|
|
235
235
|
style: { gridArea: "header", ...style },
|
|
236
236
|
...props
|
|
237
237
|
}
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
240
|
function AppShellMain({ className, style, ...props }) {
|
|
241
|
+
const { styles } = useSidebarV2();
|
|
241
242
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
242
243
|
"main",
|
|
243
244
|
{
|
|
244
245
|
"data-slot": "app-shell-main",
|
|
245
|
-
className: (
|
|
246
|
-
"relative flex min-h-0 min-w-0 flex-col overflow-hidden bg-background",
|
|
247
|
-
"m-2 rounded-xl shadow-sm",
|
|
248
|
-
className
|
|
249
|
-
),
|
|
246
|
+
className: styles.main({ className }),
|
|
250
247
|
style: { gridArea: "main", ...style },
|
|
251
248
|
...props
|
|
252
249
|
}
|
|
@@ -257,11 +254,12 @@ function AppShellAside({
|
|
|
257
254
|
style,
|
|
258
255
|
...props
|
|
259
256
|
}) {
|
|
257
|
+
const { styles } = useSidebarV2();
|
|
260
258
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
261
259
|
"aside",
|
|
262
260
|
{
|
|
263
261
|
"data-slot": "app-shell-aside",
|
|
264
|
-
className:
|
|
262
|
+
className: styles.aside({ className }),
|
|
265
263
|
style: { gridArea: "aside", ...style },
|
|
266
264
|
...props
|
|
267
265
|
}
|
|
@@ -282,8 +280,8 @@ AppShell.PanelContent = AppShellPanelContent;
|
|
|
282
280
|
// src/v2/components.tsx
|
|
283
281
|
var import_button = require("@kopexa/button");
|
|
284
282
|
var import_icons = require("@kopexa/icons");
|
|
285
|
-
var
|
|
286
|
-
var
|
|
283
|
+
var import_shared_utils = require("@kopexa/shared-utils");
|
|
284
|
+
var import_theme2 = require("@kopexa/theme");
|
|
287
285
|
var import_tooltip2 = require("@kopexa/tooltip");
|
|
288
286
|
var import_react3 = require("react");
|
|
289
287
|
|
|
@@ -301,37 +299,23 @@ function SidebarV2Inset({
|
|
|
301
299
|
className,
|
|
302
300
|
...props
|
|
303
301
|
}) {
|
|
304
|
-
const {
|
|
302
|
+
const { styles } = useSidebarV2();
|
|
305
303
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
306
304
|
"main",
|
|
307
305
|
{
|
|
308
306
|
"data-slot": "sidebar-v2-inset",
|
|
309
|
-
className: (
|
|
310
|
-
"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",
|
|
311
|
-
"md:m-2 md:rounded-xl md:shadow-sm",
|
|
312
|
-
// On a light surround the white card needs a hairline to define its
|
|
313
|
-
// edge; on the dark surround a border would read as a seam.
|
|
314
|
-
tone === "light" && "md:border md:border-border/70",
|
|
315
|
-
className
|
|
316
|
-
),
|
|
307
|
+
className: styles.inset({ className }),
|
|
317
308
|
...props
|
|
318
309
|
}
|
|
319
310
|
);
|
|
320
311
|
}
|
|
321
312
|
function SidebarV2Rail({ className, ...props }) {
|
|
322
|
-
const {
|
|
323
|
-
const light = tone === "light";
|
|
313
|
+
const { styles } = useSidebarV2();
|
|
324
314
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
325
315
|
"nav",
|
|
326
316
|
{
|
|
327
317
|
"data-slot": "sidebar-v2-rail",
|
|
328
|
-
className: (
|
|
329
|
-
"flex w-(--kpx-rail-width) shrink-0 flex-col overflow-hidden bg-sidebar py-2 text-sidebar-foreground",
|
|
330
|
-
// Light tone: the dark rail floats as a rounded card on the light
|
|
331
|
-
// surround. Dark tone: full-height, flush to the edge.
|
|
332
|
-
light ? "m-2 rounded-2xl shadow-sm" : "h-full",
|
|
333
|
-
className
|
|
334
|
-
),
|
|
318
|
+
className: styles.rail({ className }),
|
|
335
319
|
...props
|
|
336
320
|
}
|
|
337
321
|
);
|
|
@@ -340,6 +324,7 @@ function SidebarV2RailSpacer() {
|
|
|
340
324
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "aria-hidden": true, className: "flex-1" });
|
|
341
325
|
}
|
|
342
326
|
var SidebarV2Workspace = (0, import_react3.forwardRef)(({ name, role, logo, className, appearance = "rail", ...props }, ref) => {
|
|
327
|
+
const { styles } = useSidebarV2();
|
|
343
328
|
if (appearance === "bar") {
|
|
344
329
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
345
330
|
"button",
|
|
@@ -348,19 +333,15 @@ var SidebarV2Workspace = (0, import_react3.forwardRef)(({ name, role, logo, clas
|
|
|
348
333
|
type: "button",
|
|
349
334
|
"data-slot": "sidebar-v2-workspace",
|
|
350
335
|
"aria-label": role ? `${name} \u2013 ${role}` : name,
|
|
351
|
-
className: (
|
|
352
|
-
"group/ws flex cursor-pointer items-center gap-2 rounded-lg py-1 pr-2 pl-1",
|
|
353
|
-
"outline-hidden ring-ring transition-colors hover:bg-foreground/5 focus-visible:ring-2",
|
|
354
|
-
className
|
|
355
|
-
),
|
|
336
|
+
className: styles.workspaceBar({ className }),
|
|
356
337
|
...props,
|
|
357
338
|
children: [
|
|
358
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className:
|
|
359
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className:
|
|
360
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className:
|
|
361
|
-
role && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className:
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.workspaceBarLogo(), children: logo != null ? logo : name.charAt(0).toUpperCase() }),
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: styles.workspaceBarText(), children: [
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.workspaceBarName(), children: name }),
|
|
342
|
+
role && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.workspaceBarRole(), children: role })
|
|
362
343
|
] }),
|
|
363
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.ChevronDownIcon, { className:
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.ChevronDownIcon, { className: styles.workspaceBarChevron() })
|
|
364
345
|
]
|
|
365
346
|
}
|
|
366
347
|
);
|
|
@@ -372,48 +353,25 @@ var SidebarV2Workspace = (0, import_react3.forwardRef)(({ name, role, logo, clas
|
|
|
372
353
|
type: "button",
|
|
373
354
|
"data-slot": "sidebar-v2-workspace",
|
|
374
355
|
"aria-label": role ? `${name} \u2013 ${role}` : name,
|
|
375
|
-
className: (
|
|
376
|
-
"group/ws relative mx-auto mt-1 flex cursor-pointer items-center justify-center rounded-lg p-1",
|
|
377
|
-
"outline-hidden ring-sidebar-ring transition-colors",
|
|
378
|
-
"hover:bg-sidebar-accent focus-visible:ring-2",
|
|
379
|
-
className
|
|
380
|
-
),
|
|
356
|
+
className: styles.workspaceRail({ className }),
|
|
381
357
|
...props,
|
|
382
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className:
|
|
358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: styles.workspaceRailLogo(), children: [
|
|
383
359
|
logo != null ? logo : name.charAt(0).toUpperCase(),
|
|
384
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.ChevronDownIcon, { className:
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.ChevronDownIcon, { className: styles.workspaceRailChevron() })
|
|
385
361
|
] })
|
|
386
362
|
}
|
|
387
363
|
);
|
|
388
364
|
});
|
|
389
365
|
SidebarV2Workspace.displayName = "SidebarV2Workspace";
|
|
390
|
-
function railButtonClasses(active) {
|
|
391
|
-
return (0, import_shared_utils2.cn)(
|
|
392
|
-
"group/rail relative mx-auto flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-xl",
|
|
393
|
-
"outline-hidden ring-sidebar-ring transition-colors",
|
|
394
|
-
"text-sidebar-foreground/85 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
395
|
-
"focus-visible:ring-2",
|
|
396
|
-
active && "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
366
|
function RailInner({
|
|
400
367
|
icon: Icon,
|
|
401
|
-
active,
|
|
402
368
|
badge
|
|
403
369
|
}) {
|
|
370
|
+
const { styles } = useSidebarV2();
|
|
404
371
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
405
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
"aria-hidden": true,
|
|
409
|
-
className: (0, import_shared_utils2.cn)(
|
|
410
|
-
"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",
|
|
411
|
-
active ? "opacity-100" : "opacity-0"
|
|
412
|
-
)
|
|
413
|
-
}
|
|
414
|
-
),
|
|
415
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: "size-5 shrink-0" }),
|
|
416
|
-
badge != null && /* @__PURE__ */ (0, import_jsx_runtime3.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 })
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": true, className: styles.railIndicator() }),
|
|
373
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: styles.railIcon() }),
|
|
374
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.railBadge(), children: badge })
|
|
417
375
|
] });
|
|
418
376
|
}
|
|
419
377
|
function SidebarV2RailLink({
|
|
@@ -422,18 +380,18 @@ function SidebarV2RailLink({
|
|
|
422
380
|
href,
|
|
423
381
|
badge
|
|
424
382
|
}) {
|
|
425
|
-
const { renderLink, isActive, resetPanelSelection } = useSidebarV2();
|
|
383
|
+
const { renderLink, isActive, resetPanelSelection, styles } = useSidebarV2();
|
|
426
384
|
const active = isActive(href);
|
|
427
385
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_tooltip2.Tooltip, { content: label, side: "right", children: renderLink({
|
|
428
386
|
href,
|
|
429
|
-
className:
|
|
387
|
+
className: styles.railButton(),
|
|
430
388
|
"data-active": active,
|
|
431
389
|
"aria-current": active ? "page" : void 0,
|
|
432
390
|
"aria-label": label,
|
|
433
391
|
// Navigating to a destination link clears any open panel preview,
|
|
434
392
|
// even when the route doesn't change (e.g. already on it).
|
|
435
393
|
onClick: resetPanelSelection,
|
|
436
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RailInner, { icon,
|
|
394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RailInner, { icon, badge })
|
|
437
395
|
}) });
|
|
438
396
|
}
|
|
439
397
|
function SidebarV2RailItem({
|
|
@@ -446,6 +404,7 @@ function SidebarV2RailItem({
|
|
|
446
404
|
onMouseLeave,
|
|
447
405
|
badge
|
|
448
406
|
}) {
|
|
407
|
+
const { styles } = useSidebarV2();
|
|
449
408
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_tooltip2.Tooltip, { content: label, side: "right", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
450
409
|
"button",
|
|
451
410
|
{
|
|
@@ -456,8 +415,8 @@ function SidebarV2RailItem({
|
|
|
456
415
|
onClick,
|
|
457
416
|
onMouseEnter,
|
|
458
417
|
onMouseLeave,
|
|
459
|
-
className:
|
|
460
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RailInner, { icon,
|
|
418
|
+
className: styles.railButton(),
|
|
419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RailInner, { icon, badge })
|
|
461
420
|
}
|
|
462
421
|
) });
|
|
463
422
|
}
|
|
@@ -470,54 +429,18 @@ function SidebarV2Panel({
|
|
|
470
429
|
children,
|
|
471
430
|
className
|
|
472
431
|
}) {
|
|
473
|
-
const { togglePin, pinned,
|
|
474
|
-
const light = tone === "light";
|
|
432
|
+
const { togglePin, pinned, styles } = useSidebarV2();
|
|
475
433
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
476
434
|
"div",
|
|
477
435
|
{
|
|
478
436
|
"data-slot": "sidebar-v2-panel",
|
|
479
|
-
"data-floating": floating,
|
|
480
|
-
className: (
|
|
481
|
-
"flex h-full w-(--kpx-panel-width) shrink-0 flex-col",
|
|
482
|
-
// Surface. The flyout is a distinct floating card (white on light),
|
|
483
|
-
// so it reads as an overlay rather than a flat full-height slab.
|
|
484
|
-
floating ? light ? "bg-background text-foreground" : "bg-sidebar text-sidebar-foreground" : light ? "bg-muted text-foreground" : "bg-sidebar text-sidebar-foreground",
|
|
485
|
-
floating ? (
|
|
486
|
-
// Floating card: rounded, soft layered shadow, hairline ring.
|
|
487
|
-
(0, import_shared_utils2.cn)(
|
|
488
|
-
"overflow-hidden rounded-2xl shadow-2xl shadow-black/20 ring-1",
|
|
489
|
-
light ? "ring-black/5" : "ring-white/10"
|
|
490
|
-
)
|
|
491
|
-
) : (
|
|
492
|
-
// Pinned: light blends into the surround (no border); dark keeps a
|
|
493
|
-
// hairline against the rail.
|
|
494
|
-
light ? "" : "border-l border-sidebar-border/40"
|
|
495
|
-
),
|
|
496
|
-
className
|
|
497
|
-
),
|
|
437
|
+
"data-floating": floating ? "true" : "false",
|
|
438
|
+
className: styles.panel({ className }),
|
|
498
439
|
children: [
|
|
499
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className:
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: styles.panelHeader(), children: [
|
|
500
441
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
501
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
502
|
-
|
|
503
|
-
{
|
|
504
|
-
className: (0, import_shared_utils2.cn)(
|
|
505
|
-
"truncate text-sm font-semibold",
|
|
506
|
-
light ? "text-foreground" : "text-sidebar-foreground"
|
|
507
|
-
),
|
|
508
|
-
children: title
|
|
509
|
-
}
|
|
510
|
-
),
|
|
511
|
-
subtitle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
512
|
-
"div",
|
|
513
|
-
{
|
|
514
|
-
className: (0, import_shared_utils2.cn)(
|
|
515
|
-
"truncate text-xs",
|
|
516
|
-
light ? "text-muted-foreground" : "text-sidebar-foreground/70"
|
|
517
|
-
),
|
|
518
|
-
children: subtitle
|
|
519
|
-
}
|
|
520
|
-
)
|
|
442
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.panelTitle(), children: title }),
|
|
443
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.panelSubtitle(), children: subtitle })
|
|
521
444
|
] }),
|
|
522
445
|
action != null ? action : !hidePin && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
523
446
|
import_tooltip2.Tooltip,
|
|
@@ -531,41 +454,28 @@ function SidebarV2Panel({
|
|
|
531
454
|
size: "sm",
|
|
532
455
|
"aria-label": pinned ? "Panel l\xF6sen" : "Panel anheften",
|
|
533
456
|
onClick: togglePin,
|
|
534
|
-
className: (
|
|
535
|
-
"-mr-1 shrink-0",
|
|
536
|
-
light ? "text-muted-foreground hover:bg-foreground/5 hover:text-foreground" : "text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
537
|
-
),
|
|
457
|
+
className: styles.panelPin(),
|
|
538
458
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.PanelLeftIcon, { className: "size-4" })
|
|
539
459
|
}
|
|
540
460
|
)
|
|
541
461
|
}
|
|
542
462
|
)
|
|
543
463
|
] }),
|
|
544
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className:
|
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.panelBody(), children })
|
|
545
465
|
]
|
|
546
466
|
}
|
|
547
467
|
);
|
|
548
468
|
}
|
|
549
|
-
function panelRowLight(active) {
|
|
550
|
-
return (0, import_shared_utils2.cn)(
|
|
551
|
-
"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",
|
|
552
|
-
active ? "bg-primary/10 font-medium text-primary" : "text-foreground/80 hover:bg-foreground/5"
|
|
553
|
-
);
|
|
554
|
-
}
|
|
555
469
|
function SidebarV2PanelLabel({
|
|
556
470
|
className,
|
|
557
471
|
...props
|
|
558
472
|
}) {
|
|
559
|
-
const {
|
|
473
|
+
const { styles } = useSidebarV2();
|
|
560
474
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
561
475
|
"div",
|
|
562
476
|
{
|
|
563
477
|
"data-slot": "sidebar-v2-panel-label",
|
|
564
|
-
className: (
|
|
565
|
-
"px-2 pt-3 pb-1 text-[0.6875rem] font-medium uppercase tracking-wide",
|
|
566
|
-
tone === "light" ? "text-muted-foreground" : "text-sidebar-foreground/50",
|
|
567
|
-
className
|
|
568
|
-
),
|
|
478
|
+
className: styles.panelLabel({ className }),
|
|
569
479
|
...props
|
|
570
480
|
}
|
|
571
481
|
);
|
|
@@ -574,7 +484,7 @@ function SidebarV2PanelLeaf({
|
|
|
574
484
|
item,
|
|
575
485
|
active: activeProp
|
|
576
486
|
}) {
|
|
577
|
-
const { renderLink, isActive, tone } = useSidebarV2();
|
|
487
|
+
const { renderLink, isActive, tone, styles } = useSidebarV2();
|
|
578
488
|
const light = tone === "light";
|
|
579
489
|
const Icon = item.icon;
|
|
580
490
|
const active = activeProp != null ? activeProp : isActive(item.href);
|
|
@@ -582,27 +492,13 @@ function SidebarV2PanelLeaf({
|
|
|
582
492
|
href: item.href,
|
|
583
493
|
"data-active": active,
|
|
584
494
|
"aria-current": active ? "page" : void 0,
|
|
585
|
-
|
|
495
|
+
// Light tone uses the recipe's leaf slot (group/leaf + data-active);
|
|
496
|
+
// dark tone reuses the existing sidebarMenuButton recipe.
|
|
497
|
+
className: light ? styles.panelLeaf() : (0, import_theme2.sidebarMenuButton)({ size: "md" }),
|
|
586
498
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
587
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
className: (0, import_shared_utils2.cn)(
|
|
591
|
-
light ? active ? void 0 : "text-muted-foreground" : "text-sidebar-foreground/75"
|
|
592
|
-
)
|
|
593
|
-
}
|
|
594
|
-
),
|
|
595
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
|
|
596
|
-
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
597
|
-
"span",
|
|
598
|
-
{
|
|
599
|
-
className: (0, import_shared_utils2.cn)(
|
|
600
|
-
"ml-auto rounded-full px-1.5 text-[0.625rem] font-medium",
|
|
601
|
-
light ? "bg-foreground/10 text-foreground/70" : "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
602
|
-
),
|
|
603
|
-
children: item.badge
|
|
604
|
-
}
|
|
605
|
-
)
|
|
499
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: styles.panelLeafIcon() }),
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.panelLeafLabel(), children: item.label }),
|
|
501
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.panelLeafBadge(), children: item.badge })
|
|
606
502
|
] })
|
|
607
503
|
}) });
|
|
608
504
|
}
|
|
@@ -610,7 +506,7 @@ function SidebarV2PanelGroup({
|
|
|
610
506
|
item
|
|
611
507
|
}) {
|
|
612
508
|
var _a;
|
|
613
|
-
const { openGroup, toggleGroup, activeHref, renderLink, tone } = useSidebarV2();
|
|
509
|
+
const { openGroup, toggleGroup, activeHref, renderLink, tone, styles } = useSidebarV2();
|
|
614
510
|
const light = tone === "light";
|
|
615
511
|
const Icon = item.icon;
|
|
616
512
|
const key = (_a = item.value) != null ? _a : item.label;
|
|
@@ -634,57 +530,30 @@ function SidebarV2PanelGroup({
|
|
|
634
530
|
{
|
|
635
531
|
type: "button",
|
|
636
532
|
"data-state": open ? "open" : "closed",
|
|
533
|
+
"data-contains-active": containsActive,
|
|
637
534
|
"aria-expanded": open,
|
|
638
535
|
onClick: () => toggleGroup(key),
|
|
639
|
-
className: (0,
|
|
640
|
-
light ?
|
|
641
|
-
|
|
642
|
-
containsActive && (light ? "font-medium text-foreground" : "font-medium")
|
|
536
|
+
className: (0, import_shared_utils.cn)(
|
|
537
|
+
light ? styles.panelLeaf() : (0, import_theme2.sidebarMenuButton)({ size: "md" }),
|
|
538
|
+
styles.panelGroupButton()
|
|
643
539
|
),
|
|
644
540
|
children: [
|
|
645
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
className: light ? "text-muted-foreground" : "text-sidebar-foreground/75"
|
|
649
|
-
}
|
|
650
|
-
),
|
|
651
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "min-w-0 flex-1 truncate text-left", children: item.label }),
|
|
652
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
653
|
-
import_icons.ChevronRightIcon,
|
|
654
|
-
{
|
|
655
|
-
className: (0, import_shared_utils2.cn)(
|
|
656
|
-
"size-3.5! shrink-0 transition-transform",
|
|
657
|
-
light ? "text-muted-foreground" : "text-sidebar-foreground/60",
|
|
658
|
-
open && "rotate-90"
|
|
659
|
-
)
|
|
660
|
-
}
|
|
661
|
-
)
|
|
541
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: styles.panelGroupIcon() }),
|
|
542
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.panelGroupLabel(), children: item.label }),
|
|
543
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.ChevronRightIcon, { className: styles.panelGroupChevron() })
|
|
662
544
|
]
|
|
663
545
|
}
|
|
664
546
|
),
|
|
665
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
666
|
-
|
|
667
|
-
{
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
),
|
|
672
|
-
children:
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
href: child.href,
|
|
676
|
-
"data-active": active,
|
|
677
|
-
"aria-current": active ? "page" : void 0,
|
|
678
|
-
className: (0, import_shared_utils2.cn)(
|
|
679
|
-
"relative block rounded-md px-2 py-1.5 text-[0.8125rem] outline-hidden transition-colors focus-visible:ring-2",
|
|
680
|
-
"before:absolute before:top-1/2 before:-left-3 before:h-px before:w-2.5",
|
|
681
|
-
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"
|
|
682
|
-
),
|
|
683
|
-
children: child.label
|
|
684
|
-
}) }, child.href);
|
|
685
|
-
})
|
|
686
|
-
}
|
|
687
|
-
)
|
|
547
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.panelTree(), children: item.children.map((child) => {
|
|
548
|
+
const active = child.href === bestChildHref;
|
|
549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: renderLink({
|
|
550
|
+
href: child.href,
|
|
551
|
+
"data-active": active,
|
|
552
|
+
"aria-current": active ? "page" : void 0,
|
|
553
|
+
className: styles.subItem(),
|
|
554
|
+
children: child.label
|
|
555
|
+
}) }, child.href);
|
|
556
|
+
}) })
|
|
688
557
|
] });
|
|
689
558
|
}
|
|
690
559
|
function SidebarV2PanelItems({
|
|
@@ -722,7 +591,7 @@ function SidebarV2Trigger({
|
|
|
722
591
|
|
|
723
592
|
// src/v2/from-config.tsx
|
|
724
593
|
var import_drawer = require("@kopexa/drawer");
|
|
725
|
-
var
|
|
594
|
+
var import_shared_utils2 = require("@kopexa/shared-utils");
|
|
726
595
|
var import_react4 = require("motion/react");
|
|
727
596
|
var import_react5 = require("react");
|
|
728
597
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -757,7 +626,8 @@ function SidebarV2FromConfig({
|
|
|
757
626
|
setDrawerOpen,
|
|
758
627
|
setPanelHost,
|
|
759
628
|
panelOverrideActive,
|
|
760
|
-
navPreviewActive
|
|
629
|
+
navPreviewActive,
|
|
630
|
+
styles
|
|
761
631
|
} = useSidebarV2();
|
|
762
632
|
const hoverMode = flyoutTrigger === "hover" && !pinned && !isMobile;
|
|
763
633
|
const closeTimer = (0, import_react5.useRef)(null);
|
|
@@ -814,7 +684,7 @@ function SidebarV2FromConfig({
|
|
|
814
684
|
"div",
|
|
815
685
|
{
|
|
816
686
|
"aria-hidden": true,
|
|
817
|
-
className:
|
|
687
|
+
className: styles.railDivider()
|
|
818
688
|
},
|
|
819
689
|
`rail-divider-${index}`
|
|
820
690
|
);
|
|
@@ -866,14 +736,14 @@ function SidebarV2FromConfig({
|
|
|
866
736
|
);
|
|
867
737
|
}
|
|
868
738
|
const railContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
869
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className:
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.railScroll(), children: [
|
|
870
740
|
header && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
871
741
|
header,
|
|
872
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className:
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.railHeaderDivider() })
|
|
873
743
|
] }),
|
|
874
744
|
topEntries.map(renderRailEntry)
|
|
875
745
|
] }),
|
|
876
|
-
bottomEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className:
|
|
746
|
+
bottomEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.railBottom(), children: bottomEntries.map(renderRailEntry) })
|
|
877
747
|
] });
|
|
878
748
|
const navData = pinned && shownPanel && (navPreviewActive || !panelOverrideActive) ? shownPanel : null;
|
|
879
749
|
const [bufferedPanel, setBufferedPanel] = (0, import_react5.useState)(navData);
|
|
@@ -905,7 +775,7 @@ function SidebarV2FromConfig({
|
|
|
905
775
|
open: drawerOpen,
|
|
906
776
|
onOpenChange: setDrawerOpen,
|
|
907
777
|
placement: "left",
|
|
908
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_drawer.Drawer.Content, { className:
|
|
778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_drawer.Drawer.Content, { className: styles.mobileDrawer(), children: [
|
|
909
779
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_drawer.Drawer.Header, { className: "sr-only", children: [
|
|
910
780
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_drawer.Drawer.Title, { children: "Navigation" }),
|
|
911
781
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_drawer.Drawer.Description, { children: "Hauptnavigation" })
|
|
@@ -933,10 +803,7 @@ function SidebarV2FromConfig({
|
|
|
933
803
|
{
|
|
934
804
|
ref: setPanelHost,
|
|
935
805
|
"data-slot": "sidebar-v2-panel-zone",
|
|
936
|
-
className: (0,
|
|
937
|
-
"relative shrink-0 transition-[width] duration-200 ease-out motion-reduce:transition-none",
|
|
938
|
-
pinned && "overflow-hidden"
|
|
939
|
-
),
|
|
806
|
+
className: (0, import_shared_utils2.cn)(styles.panelZone(), pinned && "overflow-hidden"),
|
|
940
807
|
style: { gridArea: "panel", width: docked ? PANEL_WIDTH2 : "0px" },
|
|
941
808
|
children: [
|
|
942
809
|
panelContent,
|
|
@@ -944,7 +811,7 @@ function SidebarV2FromConfig({
|
|
|
944
811
|
import_react4.motion.div,
|
|
945
812
|
{
|
|
946
813
|
"data-floating": "true",
|
|
947
|
-
className:
|
|
814
|
+
className: styles.flyout(),
|
|
948
815
|
initial: { x: -14, opacity: 0 },
|
|
949
816
|
animate: { x: 0, opacity: 1 },
|
|
950
817
|
exit: { x: -14, opacity: 0 },
|
package/dist/v2/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
4
|
SidebarV2
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-LCCZNS2E.mjs";
|
|
6
6
|
import {
|
|
7
7
|
AppShell,
|
|
8
8
|
AppShellAside,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
AppShellMain,
|
|
11
11
|
AppShellPanelContent,
|
|
12
12
|
AppShellRoot
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-YVQVW5EP.mjs";
|
|
14
14
|
import {
|
|
15
15
|
SidebarV2FromConfig
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-KLYPP6QE.mjs";
|
|
17
17
|
import {
|
|
18
18
|
SidebarV2Inset,
|
|
19
19
|
SidebarV2Panel,
|
|
@@ -27,12 +27,12 @@ import {
|
|
|
27
27
|
SidebarV2RailSpacer,
|
|
28
28
|
SidebarV2Trigger,
|
|
29
29
|
SidebarV2Workspace
|
|
30
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-YW3JMPRU.mjs";
|
|
31
31
|
import "../chunk-SDMGFB6V.mjs";
|
|
32
32
|
import {
|
|
33
33
|
SidebarV2Provider,
|
|
34
34
|
useSidebarV2
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-AIRHHM7Z.mjs";
|
|
36
36
|
export {
|
|
37
37
|
AppShell,
|
|
38
38
|
AppShellAside,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kopexa/sidebar",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sidebar"
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"motion": ">=12.23.6",
|
|
29
29
|
"react": ">=19.0.0-rc.0",
|
|
30
30
|
"react-dom": ">=19.0.0-rc.0",
|
|
31
|
-
"@kopexa/theme": "17.33.
|
|
31
|
+
"@kopexa/theme": "17.33.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@radix-ui/react-slot": "^1.2.4",
|
|
35
|
-
"@kopexa/button": "17.0.
|
|
36
|
-
"@kopexa/
|
|
37
|
-
"@kopexa/
|
|
38
|
-
"@kopexa/
|
|
39
|
-
"@kopexa/
|
|
40
|
-
"@kopexa/separator": "17.0.
|
|
41
|
-
"@kopexa/shared-utils": "17.0.
|
|
42
|
-
"@kopexa/tooltip": "17.2.
|
|
43
|
-
"@kopexa/use-is-mobile": "17.0.
|
|
35
|
+
"@kopexa/button": "17.0.92",
|
|
36
|
+
"@kopexa/drawer": "17.2.57",
|
|
37
|
+
"@kopexa/icons": "17.10.21",
|
|
38
|
+
"@kopexa/react-utils": "17.1.34",
|
|
39
|
+
"@kopexa/input": "17.0.92",
|
|
40
|
+
"@kopexa/separator": "17.0.92",
|
|
41
|
+
"@kopexa/shared-utils": "17.0.92",
|
|
42
|
+
"@kopexa/tooltip": "17.2.57",
|
|
43
|
+
"@kopexa/use-is-mobile": "17.0.92"
|
|
44
44
|
},
|
|
45
45
|
"clean-package": "../../../clean-package.config.json",
|
|
46
46
|
"module": "dist/index.mjs",
|