asta-ui 0.9.6 → 0.9.7

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.
@@ -0,0 +1,388 @@
1
+ "use client";
2
+ import {
3
+ Avatar
4
+ } from "./chunk-IVCHYE55.js";
5
+
6
+ // components/kit/base/sidebar.tsx
7
+ import { useEffect, useLayoutEffect, useRef, useState } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ var cx = (...c) => c.filter(Boolean).join(" ");
10
+ var EASE = "ease-[cubic-bezier(.16,1,.3,1)]";
11
+ var RING = "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent)]";
12
+ var HOVER = "hover:bg-[color-mix(in_srgb,var(--ink)_4%,transparent)]";
13
+ var ON = "bg-[color-mix(in_srgb,var(--ink)_6%,transparent)]";
14
+ var Icon = ({ d, className = "" }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: cx("h-4 w-4", className), fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d }) });
15
+ function Logo({ w, size = "sm" }) {
16
+ return /* @__PURE__ */ jsx(
17
+ "span",
18
+ {
19
+ "aria-hidden": true,
20
+ className: cx(
21
+ "flex shrink-0 items-center justify-center overflow-hidden bg-brand font-semibold text-paper [&>*]:h-full [&>*]:w-full",
22
+ size === "sm" ? "h-5 w-5 rounded-[5px] text-[11px]" : "h-7 w-7 rounded-[7px] text-[12.5px]"
23
+ ),
24
+ children: w.logo ?? w.name.charAt(0)
25
+ }
26
+ );
27
+ }
28
+ function Label({ hidden, children, className }) {
29
+ return /* @__PURE__ */ jsx(
30
+ "span",
31
+ {
32
+ className: cx(
33
+ "min-w-0 flex-1 overflow-hidden whitespace-nowrap text-left transition-[opacity,transform] duration-300",
34
+ EASE,
35
+ hidden ? "pointer-events-none -translate-x-1 opacity-0" : "translate-x-0 opacity-100 delay-75",
36
+ className
37
+ ),
38
+ children
39
+ }
40
+ );
41
+ }
42
+ function Tip({ children }) {
43
+ return /* @__PURE__ */ jsx(
44
+ "span",
45
+ {
46
+ "aria-hidden": true,
47
+ className: cx(
48
+ "pointer-events-none absolute left-[calc(100%+10px)] top-1/2 z-20 -translate-x-1 -translate-y-1/2 whitespace-nowrap rounded-md bg-ink px-2 py-1 text-[12px] text-paper opacity-0 transition-[opacity,translate] duration-200",
49
+ "group-hover/item:translate-x-0 group-hover/item:opacity-100 group-focus-visible/item:translate-x-0 group-focus-visible/item:opacity-100",
50
+ EASE
51
+ ),
52
+ children
53
+ }
54
+ );
55
+ }
56
+ var itemCls = "group/item relative flex h-9 w-full items-center rounded-lg text-[14px] outline-none transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-brand/50";
57
+ function Row({ it, on, collapsed, onClick, flat }) {
58
+ return /* @__PURE__ */ jsxs(
59
+ "button",
60
+ {
61
+ type: "button",
62
+ "data-sb-id": flat ? void 0 : it.id,
63
+ "aria-current": on ? "page" : void 0,
64
+ "aria-label": collapsed ? it.label : void 0,
65
+ onClick,
66
+ className: cx(itemCls, on ? cx("text-ink", flat && ON) : cx("text-ink-2 hover:text-ink", HOVER)),
67
+ children: [
68
+ /* @__PURE__ */ jsxs("span", { className: cx("relative flex w-10 shrink-0 justify-center transition-colors duration-200 [&_svg]:h-[18px] [&_svg]:w-[18px]", on ? "text-ink" : "text-mute group-hover/item:text-ink"), children: [
69
+ it.icon,
70
+ !!it.badge && /* @__PURE__ */ jsx(
71
+ "span",
72
+ {
73
+ className: cx(
74
+ "absolute right-2 top-0 h-1.5 w-1.5 rounded-full bg-brand shadow-[0_0_0_2px_var(--paper-2)] transition-[opacity,transform] duration-300",
75
+ EASE,
76
+ collapsed ? "scale-100 opacity-100" : "scale-50 opacity-0"
77
+ )
78
+ }
79
+ )
80
+ ] }),
81
+ /* @__PURE__ */ jsx(Label, { hidden: collapsed, className: "relative", children: it.label }),
82
+ !!it.badge && /* @__PURE__ */ jsx(
83
+ "span",
84
+ {
85
+ className: cx(
86
+ "relative mr-2 rounded-md bg-[color-mix(in_srgb,var(--ink)_6%,transparent)] px-1.5 text-[11.5px] tabular-nums leading-5 text-mute transition-opacity duration-300",
87
+ collapsed ? "opacity-0" : "opacity-100"
88
+ ),
89
+ children: it.badge
90
+ }
91
+ ),
92
+ collapsed && /* @__PURE__ */ jsx(Tip, { children: it.label })
93
+ ]
94
+ }
95
+ );
96
+ }
97
+ function Sidebar({
98
+ brand,
99
+ groups,
100
+ footer = [],
101
+ promo,
102
+ cta,
103
+ workspaces = [],
104
+ defaultWorkspace,
105
+ onWorkspaceChange,
106
+ active: activeProp,
107
+ defaultActive,
108
+ onNavigate,
109
+ collapsed: collapsedProp,
110
+ defaultCollapsed = false,
111
+ onCollapsedChange,
112
+ user,
113
+ className
114
+ }) {
115
+ const [activeState, setActive] = useState(defaultActive ?? groups[0]?.items[0]?.id ?? "");
116
+ const [collapsedState, setCollapsed] = useState(defaultCollapsed);
117
+ const [workspace, setWorkspace] = useState(defaultWorkspace ?? workspaces[0]?.id);
118
+ const [menu, setMenu] = useState(false);
119
+ const [promoOpen, setPromoOpen] = useState(true);
120
+ const active = activeProp ?? activeState;
121
+ const collapsed = collapsedProp ?? collapsedState;
122
+ const current = workspaces.find((w) => w.id === workspace) ?? workspaces[0];
123
+ const nav = useRef(null);
124
+ const indicator = useRef(null);
125
+ const placed = useRef(false);
126
+ const switcher = useRef(null);
127
+ const trigger = useRef(null);
128
+ useLayoutEffect(() => {
129
+ const ind = indicator.current;
130
+ const el = nav.current?.querySelector(`[data-sb-id="${CSS.escape(active)}"]`);
131
+ if (!ind) return;
132
+ if (!el) {
133
+ ind.style.opacity = "0";
134
+ return;
135
+ }
136
+ if (!placed.current) ind.style.transition = "none";
137
+ ind.style.transform = `translateY(${el.offsetTop}px)`;
138
+ ind.style.opacity = "1";
139
+ if (!placed.current) {
140
+ void ind.offsetHeight;
141
+ ind.style.transition = "";
142
+ placed.current = true;
143
+ }
144
+ }, [active]);
145
+ useEffect(() => {
146
+ if (!menu) return;
147
+ switcher.current?.querySelector("[role=menuitemradio][aria-checked=true]")?.focus();
148
+ const down = (e) => {
149
+ if (!switcher.current?.contains(e.target)) setMenu(false);
150
+ };
151
+ document.addEventListener("pointerdown", down);
152
+ return () => document.removeEventListener("pointerdown", down);
153
+ }, [menu]);
154
+ const navigate = (id) => {
155
+ setActive(id);
156
+ onNavigate?.(id);
157
+ };
158
+ const toggle = () => {
159
+ setCollapsed(!collapsed);
160
+ onCollapsedChange?.(!collapsed);
161
+ };
162
+ const pick = (id) => {
163
+ setWorkspace(id);
164
+ onWorkspaceChange?.(id);
165
+ setMenu(false);
166
+ trigger.current?.focus();
167
+ };
168
+ const rove = (e, selector, root) => {
169
+ const els = [...root?.querySelectorAll(selector) ?? []];
170
+ const i = els.indexOf(document.activeElement);
171
+ const next = { ArrowDown: i + 1, ArrowUp: i - 1, Home: 0, End: els.length - 1 }[e.key];
172
+ if (next === void 0 || !els.length) return;
173
+ e.preventDefault();
174
+ els[(next + els.length) % els.length]?.focus();
175
+ };
176
+ return /* @__PURE__ */ jsxs(
177
+ "aside",
178
+ {
179
+ "aria-label": "Sidebar",
180
+ "data-collapsed": collapsed || void 0,
181
+ className: cx(
182
+ "relative flex h-full shrink-0 flex-col bg-paper-2 px-3 py-3 shadow-[inset_-1px_0_0_color-mix(in_srgb,var(--ink)_8%,transparent)] transition-[width] duration-500",
183
+ EASE,
184
+ collapsed ? "w-16" : "w-[248px]",
185
+ className
186
+ ),
187
+ children: [
188
+ /* @__PURE__ */ jsx("style", { href: "asta-sidebar", precedence: "asta", children: `
189
+ @keyframes kit-sb-pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
190
+ @keyframes kit-sb-fade { from { opacity: 0; } to { opacity: 1; } }
191
+ @media (prefers-reduced-motion: reduce) { .kit-sb, .kit-sb * { animation: none !important; transition-duration: 0s !important; } }
192
+ ` }),
193
+ /* @__PURE__ */ jsxs("div", { className: "kit-sb flex min-h-0 flex-1 flex-col", children: [
194
+ /* @__PURE__ */ jsxs("div", { className: "flex h-11 shrink-0 items-center", children: [
195
+ /* @__PURE__ */ jsx(Label, { hidden: collapsed, className: "pl-3 text-[19px] font-semibold tracking-[-0.03em] text-ink", children: brand ?? current?.name }),
196
+ /* @__PURE__ */ jsxs(
197
+ "button",
198
+ {
199
+ type: "button",
200
+ "aria-pressed": collapsed,
201
+ "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
202
+ onClick: toggle,
203
+ className: cx(
204
+ "group/item relative flex h-9 w-10 shrink-0 items-center justify-center rounded-lg text-mute outline-none transition-colors duration-200 hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50",
205
+ HOVER
206
+ ),
207
+ children: [
208
+ /* @__PURE__ */ jsx(Icon, { d: "M2.5 3.5h11v9h-11zM6 3.5v9M10.5 6.5 9 8l1.5 1.5", className: cx("transition-transform duration-500", EASE, collapsed && "-scale-x-100") }),
209
+ collapsed && /* @__PURE__ */ jsx(Tip, { children: "Expand" })
210
+ ]
211
+ }
212
+ )
213
+ ] }),
214
+ /* @__PURE__ */ jsx(
215
+ "nav",
216
+ {
217
+ "aria-label": "Main",
218
+ className: cx("-mx-1 mt-3 min-h-0 flex-1 px-1 [scrollbar-width:none]", collapsed ? "overflow-visible" : "overflow-y-auto overscroll-contain [mask-image:linear-gradient(to_bottom,black_calc(100%-20px),transparent)]"),
219
+ onKeyDown: (e) => rove(e, "[data-sb-id]", nav.current),
220
+ children: /* @__PURE__ */ jsxs("div", { ref: nav, className: "relative pb-2", children: [
221
+ /* @__PURE__ */ jsx(
222
+ "span",
223
+ {
224
+ ref: indicator,
225
+ "aria-hidden": true,
226
+ className: cx("absolute inset-x-0 top-0 h-9 rounded-lg opacity-0 transition-[transform,opacity] duration-500", ON, EASE)
227
+ }
228
+ ),
229
+ groups.map((g, gi) => /* @__PURE__ */ jsxs("div", { className: cx(gi > 0 && "mt-5"), children: [
230
+ g.label && /* @__PURE__ */ jsxs("div", { className: "relative flex h-8 items-center px-3", "aria-hidden": collapsed || void 0, children: [
231
+ /* @__PURE__ */ jsx("span", { className: cx("text-[13px] text-mute transition-opacity duration-300", collapsed ? "opacity-0" : "opacity-100"), children: g.label }),
232
+ /* @__PURE__ */ jsx(
233
+ "span",
234
+ {
235
+ className: cx(
236
+ "absolute left-1/2 h-px w-3 -translate-x-1/2 bg-[color-mix(in_srgb,var(--ink)_14%,transparent)] transition-opacity duration-300",
237
+ collapsed ? "opacity-100" : "opacity-0"
238
+ )
239
+ }
240
+ )
241
+ ] }),
242
+ /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-0.5", children: g.items.map((it) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Row, { it, on: it.id === active, collapsed, onClick: () => navigate(it.id) }) }, it.id)) })
243
+ ] }, g.label ?? gi))
244
+ ] })
245
+ }
246
+ ),
247
+ promo && promoOpen && !collapsed && /* @__PURE__ */ jsxs(
248
+ "div",
249
+ {
250
+ className: cx("group/promo relative mt-3 min-w-[222px] shrink-0 rounded-xl bg-paper p-4", RING, promo.onClick && "transition-colors hover:bg-[color-mix(in_srgb,var(--ink)_2%,var(--paper))]"),
251
+ style: { animation: "kit-sb-fade .3s .25s cubic-bezier(.16,1,.3,1) both" },
252
+ children: [
253
+ promo.icon && /* @__PURE__ */ jsx("span", { className: "mb-3 flex h-8 w-8 items-center justify-center rounded-full bg-paper-2 text-mute [&_svg]:h-4 [&_svg]:w-4", children: promo.icon }),
254
+ promo.onClick ? /* @__PURE__ */ jsx("button", { type: "button", onClick: promo.onClick, className: "block text-left text-[14px] font-medium text-ink outline-none after:absolute after:inset-0 after:rounded-xl focus-visible:after:ring-2 focus-visible:after:ring-brand/50", children: promo.title }) : /* @__PURE__ */ jsx("p", { className: "text-[14px] font-medium text-ink", children: promo.title }),
255
+ promo.text && /* @__PURE__ */ jsx("p", { className: "mt-1 text-[13px] leading-snug text-mute", children: promo.text }),
256
+ promo.onDismiss && /* @__PURE__ */ jsx(
257
+ "button",
258
+ {
259
+ type: "button",
260
+ "aria-label": `Dismiss ${promo.title}`,
261
+ onClick: () => {
262
+ setPromoOpen(false);
263
+ promo.onDismiss?.();
264
+ },
265
+ className: "absolute right-2 top-2 z-10 flex h-7 w-7 items-center justify-center rounded-md text-mute outline-none transition-colors hover:bg-paper-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50",
266
+ children: /* @__PURE__ */ jsx(Icon, { d: "M4.5 4.5l7 7M11.5 4.5l-7 7", className: "h-3.5 w-3.5" })
267
+ }
268
+ )
269
+ ]
270
+ }
271
+ ),
272
+ footer.length > 0 && /* @__PURE__ */ jsx("ul", { className: "mt-2 flex shrink-0 flex-col gap-0.5", children: footer.map((it) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Row, { it, on: it.id === active, collapsed, onClick: () => navigate(it.id), flat: true }) }, it.id)) }),
273
+ cta && /* @__PURE__ */ jsxs(
274
+ "button",
275
+ {
276
+ type: "button",
277
+ onClick: cta.onClick,
278
+ "aria-label": collapsed ? cta.label : void 0,
279
+ className: cx(itemCls, "mt-2 h-10 shrink-0 overflow-visible bg-paper font-medium text-ink", RING, "hover:bg-[color-mix(in_srgb,var(--ink)_3%,var(--paper))]"),
280
+ children: [
281
+ /* @__PURE__ */ jsx(
282
+ "span",
283
+ {
284
+ "aria-hidden": true,
285
+ className: cx(
286
+ "pointer-events-none absolute inset-y-0 right-0 w-3/5 rounded-r-lg bg-[repeating-linear-gradient(-45deg,color-mix(in_srgb,var(--ink)_9%,transparent)_0_1px,transparent_1px_6px)] [mask-image:linear-gradient(to_right,transparent,black)] transition-opacity duration-300",
287
+ collapsed ? "opacity-0" : "opacity-100"
288
+ )
289
+ }
290
+ ),
291
+ /* @__PURE__ */ jsx("span", { className: "relative flex w-10 shrink-0 justify-center", children: /* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-ink text-paper [&_svg]:h-3 [&_svg]:w-3", children: cta.icon ?? /* @__PURE__ */ jsx(Icon, { d: "M9 1.5 3.5 9H8l-1 5.5L12.5 7H8z" }) }) }),
292
+ /* @__PURE__ */ jsx(Label, { hidden: collapsed, className: "relative", children: /* @__PURE__ */ jsx("span", { className: "block text-center", children: cta.label }) }),
293
+ !collapsed && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "w-10 shrink-0" }),
294
+ collapsed && /* @__PURE__ */ jsx(Tip, { children: cta.label })
295
+ ]
296
+ }
297
+ ),
298
+ current && /* @__PURE__ */ jsxs("div", { ref: switcher, className: "relative mt-2 shrink-0", children: [
299
+ /* @__PURE__ */ jsxs(
300
+ "button",
301
+ {
302
+ ref: trigger,
303
+ type: "button",
304
+ "aria-haspopup": "menu",
305
+ "aria-expanded": menu,
306
+ "aria-label": collapsed ? `Workspace: ${current.name}` : void 0,
307
+ onClick: () => setMenu((v) => !v),
308
+ onKeyDown: (e) => {
309
+ if (e.key === "ArrowUp" && !menu) {
310
+ e.preventDefault();
311
+ setMenu(true);
312
+ }
313
+ },
314
+ className: cx(itemCls, "h-10 text-ink", HOVER, "aria-expanded:bg-[color-mix(in_srgb,var(--ink)_5%,transparent)]"),
315
+ children: [
316
+ /* @__PURE__ */ jsx("span", { className: "flex w-10 shrink-0 justify-center", children: /* @__PURE__ */ jsx(Logo, { w: current }) }),
317
+ /* @__PURE__ */ jsx(Label, { hidden: collapsed, className: "truncate", children: current.name }),
318
+ /* @__PURE__ */ jsx(
319
+ Icon,
320
+ {
321
+ d: "m5.5 6 2.5-2.5L10.5 6M5.5 10l2.5 2.5 2.5-2.5",
322
+ className: cx("mr-2 shrink-0 text-mute transition-opacity duration-300", collapsed ? "opacity-0" : "opacity-100")
323
+ }
324
+ ),
325
+ collapsed && /* @__PURE__ */ jsx(Tip, { children: current.name })
326
+ ]
327
+ }
328
+ ),
329
+ menu && /* @__PURE__ */ jsxs(
330
+ "div",
331
+ {
332
+ role: "menu",
333
+ "aria-label": "Switch workspace",
334
+ onKeyDown: (e) => {
335
+ if (e.key === "Escape" || e.key === "Tab") {
336
+ if (e.key === "Escape") e.preventDefault();
337
+ setMenu(false);
338
+ trigger.current?.focus();
339
+ } else rove(e, "[role=menuitemradio]", e.currentTarget);
340
+ },
341
+ className: "absolute bottom-[calc(100%+6px)] left-0 z-30 w-[232px] origin-bottom-left rounded-xl bg-paper p-1.5 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),0_16px_36px_-14px_rgb(0_0_0/0.3)]",
342
+ style: { animation: "kit-sb-pop .28s cubic-bezier(.16,1,.3,1) both" },
343
+ children: [
344
+ /* @__PURE__ */ jsx("p", { className: "px-2 pb-1.5 pt-1 text-[11.5px] text-mute", children: "Workspaces" }),
345
+ workspaces.map((w) => {
346
+ const on = w.id === current.id;
347
+ return /* @__PURE__ */ jsxs(
348
+ "button",
349
+ {
350
+ type: "button",
351
+ role: "menuitemradio",
352
+ "aria-checked": on,
353
+ onClick: () => pick(w.id),
354
+ className: "flex w-full items-center gap-2.5 rounded-lg px-2 py-1.5 text-left outline-none transition-colors hover:bg-paper-2 focus-visible:bg-paper-2",
355
+ children: [
356
+ /* @__PURE__ */ jsx(Logo, { w, size: "md" }),
357
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col leading-tight", children: [
358
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[13.5px] text-ink", children: w.name }),
359
+ w.plan && /* @__PURE__ */ jsx("span", { className: "truncate text-[11.5px] text-mute", children: w.plan })
360
+ ] }),
361
+ on && /* @__PURE__ */ jsx(Icon, { d: "M3.5 8.5l3 3 6-7", className: "shrink-0 text-brand" })
362
+ ]
363
+ },
364
+ w.id
365
+ );
366
+ })
367
+ ]
368
+ }
369
+ )
370
+ ] }),
371
+ user && /* @__PURE__ */ jsxs("div", { className: "mt-2 flex h-12 shrink-0 items-center rounded-lg", children: [
372
+ /* @__PURE__ */ jsx("span", { className: "flex w-10 shrink-0 justify-center", children: /* @__PURE__ */ jsx(Avatar, { name: user.name, src: user.src, size: "sm" }) }),
373
+ /* @__PURE__ */ jsxs(Label, { hidden: collapsed, className: "flex flex-col pl-1 leading-tight", children: [
374
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[13px] font-medium text-ink", children: user.name }),
375
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[11.5px] text-mute", children: user.email })
376
+ ] })
377
+ ] })
378
+ ] })
379
+ ]
380
+ }
381
+ );
382
+ }
383
+ var sidebar_default = Sidebar;
384
+
385
+ export {
386
+ Sidebar,
387
+ sidebar_default
388
+ };
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  } from "./chunk-FLCT7THQ.js";
36
36
  import {
37
37
  Navbar
38
- } from "./chunk-CACW5LH3.js";
38
+ } from "./chunk-EAHHWF3V.js";
39
39
  import {
40
40
  CookieConsent,
41
41
  DEFAULT_CONSENT_CATEGORIES
@@ -60,7 +60,7 @@ import {
60
60
  } from "./chunk-3PQTSFOS.js";
61
61
  import {
62
62
  Sidebar
63
- } from "./chunk-TBMUSER2.js";
63
+ } from "./chunk-FT66LAUZ.js";
64
64
  import {
65
65
  Kanban
66
66
  } from "./chunk-JWBGI7FN.js";
package/dist/navbar.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  Navbar,
4
4
  navbar_default
5
- } from "./chunk-CACW5LH3.js";
5
+ } from "./chunk-EAHHWF3V.js";
6
6
  import "./chunk-ZWBJUJTR.js";
7
7
  export {
8
8
  Navbar,
package/dist/sidebar.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  Sidebar,
4
4
  sidebar_default
5
- } from "./chunk-TBMUSER2.js";
5
+ } from "./chunk-FT66LAUZ.js";
6
6
  import "./chunk-6RA7LJ3K.js";
7
7
  export {
8
8
  Sidebar,
@@ -10,6 +10,8 @@ export interface NavTile {
10
10
  export interface NavMenu {
11
11
  /** Panel width in px (clamped to the space available). */
12
12
  width?: number;
13
+ /** A plain dropdown: a short list that opens right under its trigger instead of the centred mega panel. */
14
+ list?: NavTile[];
13
15
  tiles?: NavTile[];
14
16
  columns?: {
15
17
  heading: string;
@@ -46,7 +48,8 @@ export interface NavbarProps {
46
48
  }
47
49
  /**
48
50
  * Site header with a mega menu. One shared panel sits under the bar and morphs its size between
49
- * sections while the new content slides in from the side you moved toward. Hovering a tile dims the
51
+ * sections while the new content slides in from the side you moved toward. A menu with `list` is a
52
+ * plain dropdown: the same panel glides over to sit right under its trigger. Hovering a tile dims the
50
53
  * rest. Below 560px of container width it collapses to a burger and a sheet of accordion sections.
51
54
  * Wrap it in an element with `@container` (the demo does) or it falls back to the viewport width.
52
55
  */
@@ -14,12 +14,34 @@ export interface SidebarWorkspace {
14
14
  id: string;
15
15
  name: string;
16
16
  plan?: string;
17
+ /** Square logo. Leave it out and the first letter is used. */
18
+ logo?: ReactNode;
19
+ }
20
+ export interface SidebarPromo {
21
+ title: string;
22
+ text?: string;
23
+ icon?: ReactNode;
24
+ onClick?: () => void;
25
+ /** Shows a close button. The card hides itself and this is called. */
26
+ onDismiss?: () => void;
17
27
  }
18
28
  export interface SidebarProps {
19
- workspaces: SidebarWorkspace[];
29
+ /** Wordmark at the top. Defaults to the current workspace name. */
30
+ brand?: ReactNode;
31
+ groups: SidebarGroup[];
32
+ /** Links pinned to the bottom, under the promo card. */
33
+ footer?: SidebarItem[];
34
+ promo?: SidebarPromo;
35
+ /** The striped button near the bottom, for an upgrade or a plan. */
36
+ cta?: {
37
+ label: string;
38
+ icon?: ReactNode;
39
+ onClick?: () => void;
40
+ };
41
+ /** Workspace switcher at the very bottom. The menu opens upward. */
42
+ workspaces?: SidebarWorkspace[];
20
43
  defaultWorkspace?: string;
21
44
  onWorkspaceChange?: (id: string) => void;
22
- groups: SidebarGroup[];
23
45
  /** Controlled active item. Leave it out and the sidebar tracks clicks itself. */
24
46
  active?: string;
25
47
  defaultActive?: string;
@@ -27,7 +49,7 @@ export interface SidebarProps {
27
49
  collapsed?: boolean;
28
50
  defaultCollapsed?: boolean;
29
51
  onCollapsedChange?: (collapsed: boolean) => void;
30
- user: {
52
+ user?: {
31
53
  name: string;
32
54
  email: string;
33
55
  src?: string;
@@ -35,9 +57,9 @@ export interface SidebarProps {
35
57
  className?: string;
36
58
  }
37
59
  /**
38
- * App sidebar: a workspace switcher, grouped navigation with a sliding active indicator, and the
39
- * signed-in user at the bottom. It folds to a 64px icon rail where labels fade out and tooltips take
40
- * over. Arrow keys move between items.
60
+ * App sidebar: a wordmark, grouped navigation with a sliding grey pill, then a promo card, footer
61
+ * links, a striped call to action and the workspace switcher at the bottom. It folds to a 64px icon
62
+ * rail where labels fade out and tooltips take over. Arrow keys move between items.
41
63
  */
42
- export declare function Sidebar({ workspaces, defaultWorkspace, onWorkspaceChange, groups, active: activeProp, defaultActive, onNavigate, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, user, className, }: SidebarProps): import("react").JSX.Element;
64
+ export declare function Sidebar({ brand, groups, footer, promo, cta, workspaces, defaultWorkspace, onWorkspaceChange, active: activeProp, defaultActive, onNavigate, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, user, className, }: SidebarProps): import("react").JSX.Element;
43
65
  export default Sidebar;
@@ -10,6 +10,8 @@ export interface NavTile {
10
10
  export interface NavMenu {
11
11
  /** Panel width in px (clamped to the space available). */
12
12
  width?: number;
13
+ /** A plain dropdown: a short list that opens right under its trigger instead of the centred mega panel. */
14
+ list?: NavTile[];
13
15
  tiles?: NavTile[];
14
16
  columns?: {
15
17
  heading: string;
@@ -46,7 +48,8 @@ export interface NavbarProps {
46
48
  }
47
49
  /**
48
50
  * Site header with a mega menu. One shared panel sits under the bar and morphs its size between
49
- * sections while the new content slides in from the side you moved toward. Hovering a tile dims the
51
+ * sections while the new content slides in from the side you moved toward. A menu with `list` is a
52
+ * plain dropdown: the same panel glides over to sit right under its trigger. Hovering a tile dims the
50
53
  * rest. Below 560px of container width it collapses to a burger and a sheet of accordion sections.
51
54
  * Wrap it in an element with `@container` (the demo does) or it falls back to the viewport width.
52
55
  */
@@ -14,12 +14,34 @@ export interface SidebarWorkspace {
14
14
  id: string;
15
15
  name: string;
16
16
  plan?: string;
17
+ /** Square logo. Leave it out and the first letter is used. */
18
+ logo?: ReactNode;
19
+ }
20
+ export interface SidebarPromo {
21
+ title: string;
22
+ text?: string;
23
+ icon?: ReactNode;
24
+ onClick?: () => void;
25
+ /** Shows a close button. The card hides itself and this is called. */
26
+ onDismiss?: () => void;
17
27
  }
18
28
  export interface SidebarProps {
19
- workspaces: SidebarWorkspace[];
29
+ /** Wordmark at the top. Defaults to the current workspace name. */
30
+ brand?: ReactNode;
31
+ groups: SidebarGroup[];
32
+ /** Links pinned to the bottom, under the promo card. */
33
+ footer?: SidebarItem[];
34
+ promo?: SidebarPromo;
35
+ /** The striped button near the bottom, for an upgrade or a plan. */
36
+ cta?: {
37
+ label: string;
38
+ icon?: ReactNode;
39
+ onClick?: () => void;
40
+ };
41
+ /** Workspace switcher at the very bottom. The menu opens upward. */
42
+ workspaces?: SidebarWorkspace[];
20
43
  defaultWorkspace?: string;
21
44
  onWorkspaceChange?: (id: string) => void;
22
- groups: SidebarGroup[];
23
45
  /** Controlled active item. Leave it out and the sidebar tracks clicks itself. */
24
46
  active?: string;
25
47
  defaultActive?: string;
@@ -27,7 +49,7 @@ export interface SidebarProps {
27
49
  collapsed?: boolean;
28
50
  defaultCollapsed?: boolean;
29
51
  onCollapsedChange?: (collapsed: boolean) => void;
30
- user: {
52
+ user?: {
31
53
  name: string;
32
54
  email: string;
33
55
  src?: string;
@@ -35,9 +57,9 @@ export interface SidebarProps {
35
57
  className?: string;
36
58
  }
37
59
  /**
38
- * App sidebar: a workspace switcher, grouped navigation with a sliding active indicator, and the
39
- * signed-in user at the bottom. It folds to a 64px icon rail where labels fade out and tooltips take
40
- * over. Arrow keys move between items.
60
+ * App sidebar: a wordmark, grouped navigation with a sliding grey pill, then a promo card, footer
61
+ * links, a striped call to action and the workspace switcher at the bottom. It folds to a 64px icon
62
+ * rail where labels fade out and tooltips take over. Arrow keys move between items.
41
63
  */
42
- export declare function Sidebar({ workspaces, defaultWorkspace, onWorkspaceChange, groups, active: activeProp, defaultActive, onNavigate, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, user, className, }: SidebarProps): import("react").JSX.Element;
64
+ export declare function Sidebar({ brand, groups, footer, promo, cta, workspaces, defaultWorkspace, onWorkspaceChange, active: activeProp, defaultActive, onNavigate, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, user, className, }: SidebarProps): import("react").JSX.Element;
43
65
  export default Sidebar;
@@ -92,7 +92,7 @@ export type { PropertiesPanelProps, PropSectionProps, PropRowProps, ScrubInputPr
92
92
  export { EmptyState } from "../../../components/kit/base/empty-state";
93
93
  export type { EmptyStateVariant, EmptyStateAction, EmptyStateProps } from "../../../components/kit/base/empty-state";
94
94
  export { Sidebar } from "../../../components/kit/base/sidebar";
95
- export type { SidebarItem, SidebarGroup, SidebarWorkspace, SidebarProps } from "../../../components/kit/base/sidebar";
95
+ export type { SidebarItem, SidebarGroup, SidebarWorkspace, SidebarPromo, SidebarProps } from "../../../components/kit/base/sidebar";
96
96
  export { Kanban } from "../../../components/kit/base/kanban";
97
97
  export type { KanbanColumn, KanbanCard, KanbanProps } from "../../../components/kit/base/kanban";
98
98
  export { Onboarding } from "../../../components/kit/base/onboarding";
@@ -92,7 +92,7 @@ export type { PropertiesPanelProps, PropSectionProps, PropRowProps, ScrubInputPr
92
92
  export { EmptyState } from "../../../components/kit/empty-state";
93
93
  export type { EmptyStateVariant, EmptyStateAction, EmptyStateProps } from "../../../components/kit/empty-state";
94
94
  export { Sidebar } from "../../../components/kit/sidebar";
95
- export type { SidebarItem, SidebarGroup, SidebarWorkspace, SidebarProps } from "../../../components/kit/sidebar";
95
+ export type { SidebarItem, SidebarGroup, SidebarWorkspace, SidebarPromo, SidebarProps } from "../../../components/kit/sidebar";
96
96
  export { Kanban } from "../../../components/kit/kanban";
97
97
  export type { KanbanColumn, KanbanCard, KanbanProps } from "../../../components/kit/kanban";
98
98
  export { Onboarding } from "../../../components/kit/onboarding";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asta-ui",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "Astabyte UI: motion-first React + Tailwind v4 components (Radix or Base UI). Install as a package, or copy the source with the CLI.",
5
5
  "keywords": [
6
6
  "astabyte",