@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/app-shell.js
CHANGED
|
@@ -30,12 +30,12 @@ __export(app_shell_exports, {
|
|
|
30
30
|
AppShellRoot: () => AppShellRoot
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(app_shell_exports);
|
|
33
|
-
var import_shared_utils = require("@kopexa/shared-utils");
|
|
34
33
|
var import_react2 = require("react");
|
|
35
34
|
var import_react_dom = require("react-dom");
|
|
36
35
|
|
|
37
36
|
// src/v2/context.tsx
|
|
38
37
|
var import_react_utils = require("@kopexa/react-utils");
|
|
38
|
+
var import_theme = require("@kopexa/theme");
|
|
39
39
|
var import_tooltip = require("@kopexa/tooltip");
|
|
40
40
|
var import_use_is_mobile = require("@kopexa/use-is-mobile");
|
|
41
41
|
var import_react = require("react");
|
|
@@ -56,17 +56,13 @@ function AppShellRoot({
|
|
|
56
56
|
children,
|
|
57
57
|
...props
|
|
58
58
|
}) {
|
|
59
|
-
const { tone } = useSidebarV2();
|
|
59
|
+
const { tone, styles } = useSidebarV2();
|
|
60
60
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
61
61
|
"div",
|
|
62
62
|
{
|
|
63
63
|
"data-slot": "app-shell",
|
|
64
64
|
"data-tone": tone,
|
|
65
|
-
className: (
|
|
66
|
-
"relative isolate grid h-svh w-full overflow-hidden antialiased",
|
|
67
|
-
tone === "light" ? "bg-muted text-foreground" : "bg-sidebar text-sidebar-foreground",
|
|
68
|
-
className
|
|
69
|
-
),
|
|
65
|
+
className: styles.shell({ className }),
|
|
70
66
|
style: {
|
|
71
67
|
"--kpx-rail-width": RAIL_WIDTH,
|
|
72
68
|
"--kpx-panel-width": PANEL_WIDTH,
|
|
@@ -85,26 +81,24 @@ function AppShellHeader({
|
|
|
85
81
|
style,
|
|
86
82
|
...props
|
|
87
83
|
}) {
|
|
84
|
+
const { styles } = useSidebarV2();
|
|
88
85
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
89
86
|
"header",
|
|
90
87
|
{
|
|
91
88
|
"data-slot": "app-shell-header",
|
|
92
|
-
className:
|
|
89
|
+
className: styles.header({ className }),
|
|
93
90
|
style: { gridArea: "header", ...style },
|
|
94
91
|
...props
|
|
95
92
|
}
|
|
96
93
|
);
|
|
97
94
|
}
|
|
98
95
|
function AppShellMain({ className, style, ...props }) {
|
|
96
|
+
const { styles } = useSidebarV2();
|
|
99
97
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
100
98
|
"main",
|
|
101
99
|
{
|
|
102
100
|
"data-slot": "app-shell-main",
|
|
103
|
-
className: (
|
|
104
|
-
"relative flex min-h-0 min-w-0 flex-col overflow-hidden bg-background",
|
|
105
|
-
"m-2 rounded-xl shadow-sm",
|
|
106
|
-
className
|
|
107
|
-
),
|
|
101
|
+
className: styles.main({ className }),
|
|
108
102
|
style: { gridArea: "main", ...style },
|
|
109
103
|
...props
|
|
110
104
|
}
|
|
@@ -115,11 +109,12 @@ function AppShellAside({
|
|
|
115
109
|
style,
|
|
116
110
|
...props
|
|
117
111
|
}) {
|
|
112
|
+
const { styles } = useSidebarV2();
|
|
118
113
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
119
114
|
"aside",
|
|
120
115
|
{
|
|
121
116
|
"data-slot": "app-shell-aside",
|
|
122
|
-
className:
|
|
117
|
+
className: styles.aside({ className }),
|
|
123
118
|
style: { gridArea: "aside", ...style },
|
|
124
119
|
...props
|
|
125
120
|
}
|
package/dist/v2/app-shell.mjs
CHANGED
package/dist/v2/components.js
CHANGED
|
@@ -39,12 +39,13 @@ module.exports = __toCommonJS(components_exports);
|
|
|
39
39
|
var import_button = require("@kopexa/button");
|
|
40
40
|
var import_icons = require("@kopexa/icons");
|
|
41
41
|
var import_shared_utils = require("@kopexa/shared-utils");
|
|
42
|
-
var
|
|
42
|
+
var import_theme2 = require("@kopexa/theme");
|
|
43
43
|
var import_tooltip2 = require("@kopexa/tooltip");
|
|
44
44
|
var import_react2 = require("react");
|
|
45
45
|
|
|
46
46
|
// src/v2/context.tsx
|
|
47
47
|
var import_react_utils = require("@kopexa/react-utils");
|
|
48
|
+
var import_theme = require("@kopexa/theme");
|
|
48
49
|
var import_tooltip = require("@kopexa/tooltip");
|
|
49
50
|
var import_use_is_mobile = require("@kopexa/use-is-mobile");
|
|
50
51
|
var import_react = require("react");
|
|
@@ -69,37 +70,23 @@ function SidebarV2Inset({
|
|
|
69
70
|
className,
|
|
70
71
|
...props
|
|
71
72
|
}) {
|
|
72
|
-
const {
|
|
73
|
+
const { styles } = useSidebarV2();
|
|
73
74
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
74
75
|
"main",
|
|
75
76
|
{
|
|
76
77
|
"data-slot": "sidebar-v2-inset",
|
|
77
|
-
className: (
|
|
78
|
-
"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",
|
|
79
|
-
"md:m-2 md:rounded-xl md:shadow-sm",
|
|
80
|
-
// On a light surround the white card needs a hairline to define its
|
|
81
|
-
// edge; on the dark surround a border would read as a seam.
|
|
82
|
-
tone === "light" && "md:border md:border-border/70",
|
|
83
|
-
className
|
|
84
|
-
),
|
|
78
|
+
className: styles.inset({ className }),
|
|
85
79
|
...props
|
|
86
80
|
}
|
|
87
81
|
);
|
|
88
82
|
}
|
|
89
83
|
function SidebarV2Rail({ className, ...props }) {
|
|
90
|
-
const {
|
|
91
|
-
const light = tone === "light";
|
|
84
|
+
const { styles } = useSidebarV2();
|
|
92
85
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
93
86
|
"nav",
|
|
94
87
|
{
|
|
95
88
|
"data-slot": "sidebar-v2-rail",
|
|
96
|
-
className: (
|
|
97
|
-
"flex w-(--kpx-rail-width) shrink-0 flex-col overflow-hidden bg-sidebar py-2 text-sidebar-foreground",
|
|
98
|
-
// Light tone: the dark rail floats as a rounded card on the light
|
|
99
|
-
// surround. Dark tone: full-height, flush to the edge.
|
|
100
|
-
light ? "m-2 rounded-2xl shadow-sm" : "h-full",
|
|
101
|
-
className
|
|
102
|
-
),
|
|
89
|
+
className: styles.rail({ className }),
|
|
103
90
|
...props
|
|
104
91
|
}
|
|
105
92
|
);
|
|
@@ -108,6 +95,7 @@ function SidebarV2RailSpacer() {
|
|
|
108
95
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "aria-hidden": true, className: "flex-1" });
|
|
109
96
|
}
|
|
110
97
|
var SidebarV2Workspace = (0, import_react2.forwardRef)(({ name, role, logo, className, appearance = "rail", ...props }, ref) => {
|
|
98
|
+
const { styles } = useSidebarV2();
|
|
111
99
|
if (appearance === "bar") {
|
|
112
100
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
113
101
|
"button",
|
|
@@ -116,19 +104,15 @@ var SidebarV2Workspace = (0, import_react2.forwardRef)(({ name, role, logo, clas
|
|
|
116
104
|
type: "button",
|
|
117
105
|
"data-slot": "sidebar-v2-workspace",
|
|
118
106
|
"aria-label": role ? `${name} \u2013 ${role}` : name,
|
|
119
|
-
className: (
|
|
120
|
-
"group/ws flex cursor-pointer items-center gap-2 rounded-lg py-1 pr-2 pl-1",
|
|
121
|
-
"outline-hidden ring-ring transition-colors hover:bg-foreground/5 focus-visible:ring-2",
|
|
122
|
-
className
|
|
123
|
-
),
|
|
107
|
+
className: styles.workspaceBar({ className }),
|
|
124
108
|
...props,
|
|
125
109
|
children: [
|
|
126
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className:
|
|
127
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className:
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className:
|
|
129
|
-
role && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className:
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.workspaceBarLogo(), children: logo != null ? logo : name.charAt(0).toUpperCase() }),
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: styles.workspaceBarText(), children: [
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.workspaceBarName(), children: name }),
|
|
113
|
+
role && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.workspaceBarRole(), children: role })
|
|
130
114
|
] }),
|
|
131
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronDownIcon, { className:
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronDownIcon, { className: styles.workspaceBarChevron() })
|
|
132
116
|
]
|
|
133
117
|
}
|
|
134
118
|
);
|
|
@@ -140,48 +124,25 @@ var SidebarV2Workspace = (0, import_react2.forwardRef)(({ name, role, logo, clas
|
|
|
140
124
|
type: "button",
|
|
141
125
|
"data-slot": "sidebar-v2-workspace",
|
|
142
126
|
"aria-label": role ? `${name} \u2013 ${role}` : name,
|
|
143
|
-
className: (
|
|
144
|
-
"group/ws relative mx-auto mt-1 flex cursor-pointer items-center justify-center rounded-lg p-1",
|
|
145
|
-
"outline-hidden ring-sidebar-ring transition-colors",
|
|
146
|
-
"hover:bg-sidebar-accent focus-visible:ring-2",
|
|
147
|
-
className
|
|
148
|
-
),
|
|
127
|
+
className: styles.workspaceRail({ className }),
|
|
149
128
|
...props,
|
|
150
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className:
|
|
129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: styles.workspaceRailLogo(), children: [
|
|
151
130
|
logo != null ? logo : name.charAt(0).toUpperCase(),
|
|
152
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronDownIcon, { className:
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronDownIcon, { className: styles.workspaceRailChevron() })
|
|
153
132
|
] })
|
|
154
133
|
}
|
|
155
134
|
);
|
|
156
135
|
});
|
|
157
136
|
SidebarV2Workspace.displayName = "SidebarV2Workspace";
|
|
158
|
-
function railButtonClasses(active) {
|
|
159
|
-
return (0, import_shared_utils.cn)(
|
|
160
|
-
"group/rail relative mx-auto flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-xl",
|
|
161
|
-
"outline-hidden ring-sidebar-ring transition-colors",
|
|
162
|
-
"text-sidebar-foreground/85 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
163
|
-
"focus-visible:ring-2",
|
|
164
|
-
active && "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
137
|
function RailInner({
|
|
168
138
|
icon: Icon,
|
|
169
|
-
active,
|
|
170
139
|
badge
|
|
171
140
|
}) {
|
|
141
|
+
const { styles } = useSidebarV2();
|
|
172
142
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
173
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"aria-hidden": true,
|
|
177
|
-
className: (0, import_shared_utils.cn)(
|
|
178
|
-
"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",
|
|
179
|
-
active ? "opacity-100" : "opacity-0"
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
),
|
|
183
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: "size-5 shrink-0" }),
|
|
184
|
-
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 })
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": true, className: styles.railIndicator() }),
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: styles.railIcon() }),
|
|
145
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.railBadge(), children: badge })
|
|
185
146
|
] });
|
|
186
147
|
}
|
|
187
148
|
function SidebarV2RailLink({
|
|
@@ -190,18 +151,18 @@ function SidebarV2RailLink({
|
|
|
190
151
|
href,
|
|
191
152
|
badge
|
|
192
153
|
}) {
|
|
193
|
-
const { renderLink, isActive, resetPanelSelection } = useSidebarV2();
|
|
154
|
+
const { renderLink, isActive, resetPanelSelection, styles } = useSidebarV2();
|
|
194
155
|
const active = isActive(href);
|
|
195
156
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_tooltip2.Tooltip, { content: label, side: "right", children: renderLink({
|
|
196
157
|
href,
|
|
197
|
-
className:
|
|
158
|
+
className: styles.railButton(),
|
|
198
159
|
"data-active": active,
|
|
199
160
|
"aria-current": active ? "page" : void 0,
|
|
200
161
|
"aria-label": label,
|
|
201
162
|
// Navigating to a destination link clears any open panel preview,
|
|
202
163
|
// even when the route doesn't change (e.g. already on it).
|
|
203
164
|
onClick: resetPanelSelection,
|
|
204
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RailInner, { icon,
|
|
165
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RailInner, { icon, badge })
|
|
205
166
|
}) });
|
|
206
167
|
}
|
|
207
168
|
function SidebarV2RailItem({
|
|
@@ -214,6 +175,7 @@ function SidebarV2RailItem({
|
|
|
214
175
|
onMouseLeave,
|
|
215
176
|
badge
|
|
216
177
|
}) {
|
|
178
|
+
const { styles } = useSidebarV2();
|
|
217
179
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_tooltip2.Tooltip, { content: label, side: "right", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
218
180
|
"button",
|
|
219
181
|
{
|
|
@@ -224,8 +186,8 @@ function SidebarV2RailItem({
|
|
|
224
186
|
onClick,
|
|
225
187
|
onMouseEnter,
|
|
226
188
|
onMouseLeave,
|
|
227
|
-
className:
|
|
228
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RailInner, { icon,
|
|
189
|
+
className: styles.railButton(),
|
|
190
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RailInner, { icon, badge })
|
|
229
191
|
}
|
|
230
192
|
) });
|
|
231
193
|
}
|
|
@@ -238,54 +200,18 @@ function SidebarV2Panel({
|
|
|
238
200
|
children,
|
|
239
201
|
className
|
|
240
202
|
}) {
|
|
241
|
-
const { togglePin, pinned,
|
|
242
|
-
const light = tone === "light";
|
|
203
|
+
const { togglePin, pinned, styles } = useSidebarV2();
|
|
243
204
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
244
205
|
"div",
|
|
245
206
|
{
|
|
246
207
|
"data-slot": "sidebar-v2-panel",
|
|
247
|
-
"data-floating": floating,
|
|
248
|
-
className: (
|
|
249
|
-
"flex h-full w-(--kpx-panel-width) shrink-0 flex-col",
|
|
250
|
-
// Surface. The flyout is a distinct floating card (white on light),
|
|
251
|
-
// so it reads as an overlay rather than a flat full-height slab.
|
|
252
|
-
floating ? light ? "bg-background text-foreground" : "bg-sidebar text-sidebar-foreground" : light ? "bg-muted text-foreground" : "bg-sidebar text-sidebar-foreground",
|
|
253
|
-
floating ? (
|
|
254
|
-
// Floating card: rounded, soft layered shadow, hairline ring.
|
|
255
|
-
(0, import_shared_utils.cn)(
|
|
256
|
-
"overflow-hidden rounded-2xl shadow-2xl shadow-black/20 ring-1",
|
|
257
|
-
light ? "ring-black/5" : "ring-white/10"
|
|
258
|
-
)
|
|
259
|
-
) : (
|
|
260
|
-
// Pinned: light blends into the surround (no border); dark keeps a
|
|
261
|
-
// hairline against the rail.
|
|
262
|
-
light ? "" : "border-l border-sidebar-border/40"
|
|
263
|
-
),
|
|
264
|
-
className
|
|
265
|
-
),
|
|
208
|
+
"data-floating": floating ? "true" : "false",
|
|
209
|
+
className: styles.panel({ className }),
|
|
266
210
|
children: [
|
|
267
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className:
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.panelHeader(), children: [
|
|
268
212
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
269
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
270
|
-
|
|
271
|
-
{
|
|
272
|
-
className: (0, import_shared_utils.cn)(
|
|
273
|
-
"truncate text-sm font-semibold",
|
|
274
|
-
light ? "text-foreground" : "text-sidebar-foreground"
|
|
275
|
-
),
|
|
276
|
-
children: title
|
|
277
|
-
}
|
|
278
|
-
),
|
|
279
|
-
subtitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
280
|
-
"div",
|
|
281
|
-
{
|
|
282
|
-
className: (0, import_shared_utils.cn)(
|
|
283
|
-
"truncate text-xs",
|
|
284
|
-
light ? "text-muted-foreground" : "text-sidebar-foreground/70"
|
|
285
|
-
),
|
|
286
|
-
children: subtitle
|
|
287
|
-
}
|
|
288
|
-
)
|
|
213
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.panelTitle(), children: title }),
|
|
214
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.panelSubtitle(), children: subtitle })
|
|
289
215
|
] }),
|
|
290
216
|
action != null ? action : !hidePin && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
291
217
|
import_tooltip2.Tooltip,
|
|
@@ -299,41 +225,28 @@ function SidebarV2Panel({
|
|
|
299
225
|
size: "sm",
|
|
300
226
|
"aria-label": pinned ? "Panel l\xF6sen" : "Panel anheften",
|
|
301
227
|
onClick: togglePin,
|
|
302
|
-
className: (
|
|
303
|
-
"-mr-1 shrink-0",
|
|
304
|
-
light ? "text-muted-foreground hover:bg-foreground/5 hover:text-foreground" : "text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
305
|
-
),
|
|
228
|
+
className: styles.panelPin(),
|
|
306
229
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.PanelLeftIcon, { className: "size-4" })
|
|
307
230
|
}
|
|
308
231
|
)
|
|
309
232
|
}
|
|
310
233
|
)
|
|
311
234
|
] }),
|
|
312
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className:
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.panelBody(), children })
|
|
313
236
|
]
|
|
314
237
|
}
|
|
315
238
|
);
|
|
316
239
|
}
|
|
317
|
-
function panelRowLight(active) {
|
|
318
|
-
return (0, import_shared_utils.cn)(
|
|
319
|
-
"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",
|
|
320
|
-
active ? "bg-primary/10 font-medium text-primary" : "text-foreground/80 hover:bg-foreground/5"
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
240
|
function SidebarV2PanelLabel({
|
|
324
241
|
className,
|
|
325
242
|
...props
|
|
326
243
|
}) {
|
|
327
|
-
const {
|
|
244
|
+
const { styles } = useSidebarV2();
|
|
328
245
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
329
246
|
"div",
|
|
330
247
|
{
|
|
331
248
|
"data-slot": "sidebar-v2-panel-label",
|
|
332
|
-
className: (
|
|
333
|
-
"px-2 pt-3 pb-1 text-[0.6875rem] font-medium uppercase tracking-wide",
|
|
334
|
-
tone === "light" ? "text-muted-foreground" : "text-sidebar-foreground/50",
|
|
335
|
-
className
|
|
336
|
-
),
|
|
249
|
+
className: styles.panelLabel({ className }),
|
|
337
250
|
...props
|
|
338
251
|
}
|
|
339
252
|
);
|
|
@@ -342,7 +255,7 @@ function SidebarV2PanelLeaf({
|
|
|
342
255
|
item,
|
|
343
256
|
active: activeProp
|
|
344
257
|
}) {
|
|
345
|
-
const { renderLink, isActive, tone } = useSidebarV2();
|
|
258
|
+
const { renderLink, isActive, tone, styles } = useSidebarV2();
|
|
346
259
|
const light = tone === "light";
|
|
347
260
|
const Icon = item.icon;
|
|
348
261
|
const active = activeProp != null ? activeProp : isActive(item.href);
|
|
@@ -350,27 +263,13 @@ function SidebarV2PanelLeaf({
|
|
|
350
263
|
href: item.href,
|
|
351
264
|
"data-active": active,
|
|
352
265
|
"aria-current": active ? "page" : void 0,
|
|
353
|
-
|
|
266
|
+
// Light tone uses the recipe's leaf slot (group/leaf + data-active);
|
|
267
|
+
// dark tone reuses the existing sidebarMenuButton recipe.
|
|
268
|
+
className: light ? styles.panelLeaf() : (0, import_theme2.sidebarMenuButton)({ size: "md" }),
|
|
354
269
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
355
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
className: (0, import_shared_utils.cn)(
|
|
359
|
-
light ? active ? void 0 : "text-muted-foreground" : "text-sidebar-foreground/75"
|
|
360
|
-
)
|
|
361
|
-
}
|
|
362
|
-
),
|
|
363
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
|
|
364
|
-
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
365
|
-
"span",
|
|
366
|
-
{
|
|
367
|
-
className: (0, import_shared_utils.cn)(
|
|
368
|
-
"ml-auto rounded-full px-1.5 text-[0.625rem] font-medium",
|
|
369
|
-
light ? "bg-foreground/10 text-foreground/70" : "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
370
|
-
),
|
|
371
|
-
children: item.badge
|
|
372
|
-
}
|
|
373
|
-
)
|
|
270
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: styles.panelLeafIcon() }),
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.panelLeafLabel(), children: item.label }),
|
|
272
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.panelLeafBadge(), children: item.badge })
|
|
374
273
|
] })
|
|
375
274
|
}) });
|
|
376
275
|
}
|
|
@@ -378,7 +277,7 @@ function SidebarV2PanelGroup({
|
|
|
378
277
|
item
|
|
379
278
|
}) {
|
|
380
279
|
var _a;
|
|
381
|
-
const { openGroup, toggleGroup, activeHref, renderLink, tone } = useSidebarV2();
|
|
280
|
+
const { openGroup, toggleGroup, activeHref, renderLink, tone, styles } = useSidebarV2();
|
|
382
281
|
const light = tone === "light";
|
|
383
282
|
const Icon = item.icon;
|
|
384
283
|
const key = (_a = item.value) != null ? _a : item.label;
|
|
@@ -402,57 +301,30 @@ function SidebarV2PanelGroup({
|
|
|
402
301
|
{
|
|
403
302
|
type: "button",
|
|
404
303
|
"data-state": open ? "open" : "closed",
|
|
304
|
+
"data-contains-active": containsActive,
|
|
405
305
|
"aria-expanded": open,
|
|
406
306
|
onClick: () => toggleGroup(key),
|
|
407
307
|
className: (0, import_shared_utils.cn)(
|
|
408
|
-
light ?
|
|
409
|
-
|
|
410
|
-
containsActive && (light ? "font-medium text-foreground" : "font-medium")
|
|
308
|
+
light ? styles.panelLeaf() : (0, import_theme2.sidebarMenuButton)({ size: "md" }),
|
|
309
|
+
styles.panelGroupButton()
|
|
411
310
|
),
|
|
412
311
|
children: [
|
|
413
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
className: light ? "text-muted-foreground" : "text-sidebar-foreground/75"
|
|
417
|
-
}
|
|
418
|
-
),
|
|
419
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "min-w-0 flex-1 truncate text-left", children: item.label }),
|
|
420
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
421
|
-
import_icons.ChevronRightIcon,
|
|
422
|
-
{
|
|
423
|
-
className: (0, import_shared_utils.cn)(
|
|
424
|
-
"size-3.5! shrink-0 transition-transform",
|
|
425
|
-
light ? "text-muted-foreground" : "text-sidebar-foreground/60",
|
|
426
|
-
open && "rotate-90"
|
|
427
|
-
)
|
|
428
|
-
}
|
|
429
|
-
)
|
|
312
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: styles.panelGroupIcon() }),
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.panelGroupLabel(), children: item.label }),
|
|
314
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ChevronRightIcon, { className: styles.panelGroupChevron() })
|
|
430
315
|
]
|
|
431
316
|
}
|
|
432
317
|
),
|
|
433
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
434
|
-
|
|
435
|
-
{
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
),
|
|
440
|
-
children:
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
href: child.href,
|
|
444
|
-
"data-active": active,
|
|
445
|
-
"aria-current": active ? "page" : void 0,
|
|
446
|
-
className: (0, import_shared_utils.cn)(
|
|
447
|
-
"relative block rounded-md px-2 py-1.5 text-[0.8125rem] outline-hidden transition-colors focus-visible:ring-2",
|
|
448
|
-
"before:absolute before:top-1/2 before:-left-3 before:h-px before:w-2.5",
|
|
449
|
-
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"
|
|
450
|
-
),
|
|
451
|
-
children: child.label
|
|
452
|
-
}) }, child.href);
|
|
453
|
-
})
|
|
454
|
-
}
|
|
455
|
-
)
|
|
318
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.panelTree(), children: item.children.map((child) => {
|
|
319
|
+
const active = child.href === bestChildHref;
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: renderLink({
|
|
321
|
+
href: child.href,
|
|
322
|
+
"data-active": active,
|
|
323
|
+
"aria-current": active ? "page" : void 0,
|
|
324
|
+
className: styles.subItem(),
|
|
325
|
+
children: child.label
|
|
326
|
+
}) }, child.href);
|
|
327
|
+
}) })
|
|
456
328
|
] });
|
|
457
329
|
}
|
|
458
330
|
function SidebarV2PanelItems({
|
package/dist/v2/components.mjs
CHANGED
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
SidebarV2RailSpacer,
|
|
14
14
|
SidebarV2Trigger,
|
|
15
15
|
SidebarV2Workspace
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-YW3JMPRU.mjs";
|
|
17
17
|
import "../chunk-SDMGFB6V.mjs";
|
|
18
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-AIRHHM7Z.mjs";
|
|
19
19
|
export {
|
|
20
20
|
SidebarV2Inset,
|
|
21
21
|
SidebarV2Panel,
|
package/dist/v2/context.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { sidebarV2 } from '@kopexa/theme';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
import { SidebarV2LinkProps } from './types.mjs';
|
|
4
5
|
|
|
@@ -13,6 +14,8 @@ type SidebarV2FlyoutTrigger = "click" | "hover";
|
|
|
13
14
|
type SidebarV2ContextValue = {
|
|
14
15
|
/** Visual tone of the panel + surround. */
|
|
15
16
|
tone: SidebarV2Tone;
|
|
17
|
+
/** Resolved tailwind-variants styles (from @kopexa/theme) for the tone. */
|
|
18
|
+
styles: ReturnType<typeof sidebarV2>;
|
|
16
19
|
/** Pinned = persistent two-column. Unpinned = rail only + flyout panel. */
|
|
17
20
|
pinned: boolean;
|
|
18
21
|
togglePin: () => void;
|
package/dist/v2/context.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { sidebarV2 } from '@kopexa/theme';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
import { SidebarV2LinkProps } from './types.js';
|
|
4
5
|
|
|
@@ -13,6 +14,8 @@ type SidebarV2FlyoutTrigger = "click" | "hover";
|
|
|
13
14
|
type SidebarV2ContextValue = {
|
|
14
15
|
/** Visual tone of the panel + surround. */
|
|
15
16
|
tone: SidebarV2Tone;
|
|
17
|
+
/** Resolved tailwind-variants styles (from @kopexa/theme) for the tone. */
|
|
18
|
+
styles: ReturnType<typeof sidebarV2>;
|
|
16
19
|
/** Pinned = persistent two-column. Unpinned = rail only + flyout panel. */
|
|
17
20
|
pinned: boolean;
|
|
18
21
|
togglePin: () => void;
|
package/dist/v2/context.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(context_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(context_exports);
|
|
29
29
|
var import_react_utils = require("@kopexa/react-utils");
|
|
30
|
+
var import_theme = require("@kopexa/theme");
|
|
30
31
|
var import_tooltip = require("@kopexa/tooltip");
|
|
31
32
|
var import_use_is_mobile = require("@kopexa/use-is-mobile");
|
|
32
33
|
var import_react = require("react");
|
|
@@ -66,6 +67,7 @@ function SidebarV2Provider({
|
|
|
66
67
|
}, []);
|
|
67
68
|
const panelOverrideActive = overrideCount > 0;
|
|
68
69
|
const navPreviewActive = pinned ? selectedRail !== null : flyoutValue !== null;
|
|
70
|
+
const styles = (0, import_react.useMemo)(() => (0, import_theme.sidebarV2)({ tone }), [tone]);
|
|
69
71
|
const setPinned = (0, import_react.useCallback)(
|
|
70
72
|
(value2) => {
|
|
71
73
|
onPinnedChange == null ? void 0 : onPinnedChange(value2);
|
|
@@ -101,6 +103,7 @@ function SidebarV2Provider({
|
|
|
101
103
|
const value = (0, import_react.useMemo)(
|
|
102
104
|
() => ({
|
|
103
105
|
tone,
|
|
106
|
+
styles,
|
|
104
107
|
pinned,
|
|
105
108
|
togglePin,
|
|
106
109
|
setPinned,
|
|
@@ -129,6 +132,7 @@ function SidebarV2Provider({
|
|
|
129
132
|
}),
|
|
130
133
|
[
|
|
131
134
|
tone,
|
|
135
|
+
styles,
|
|
132
136
|
pinned,
|
|
133
137
|
togglePin,
|
|
134
138
|
setPinned,
|