@designa8/vibedesign-v6 1.12.14 → 1.12.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +31 -5
- package/dist/index.js +31 -5
- package/package.json +1 -1
- package/src/atoms/AppSidebar/AppSidebar.tsx +7 -1
- package/src/atoms/NavItem/NavItem.tsx +33 -5
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2396,12 +2396,15 @@ var TrashIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
|
2396
2396
|
]
|
|
2397
2397
|
}
|
|
2398
2398
|
);
|
|
2399
|
-
var SubItemRow = ({ item }) => {
|
|
2399
|
+
var SubItemRow = ({ item, isActive = false }) => {
|
|
2400
2400
|
const [hovered, setHovered] = import_react8.default.useState(false);
|
|
2401
2401
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2402
2402
|
"li",
|
|
2403
2403
|
{
|
|
2404
|
-
className:
|
|
2404
|
+
className: [
|
|
2405
|
+
"list-none flex items-center gap-xs rounded-sm",
|
|
2406
|
+
isActive ? "bg-primary-disabled" : ""
|
|
2407
|
+
].filter(Boolean).join(" "),
|
|
2405
2408
|
onMouseEnter: () => setHovered(true),
|
|
2406
2409
|
onMouseLeave: () => setHovered(false),
|
|
2407
2410
|
children: [
|
|
@@ -2410,11 +2413,25 @@ var SubItemRow = ({ item }) => {
|
|
|
2410
2413
|
{
|
|
2411
2414
|
variant: "ghost",
|
|
2412
2415
|
size: "sm",
|
|
2413
|
-
|
|
2416
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2417
|
+
className: [
|
|
2418
|
+
"!flex-1 !justify-start !px-sm !py-xxs !text-body-sm !rounded-sm !cursor-pointer",
|
|
2419
|
+
isActive ? "!text-primary" : "!text-body hover:!text-ink"
|
|
2420
|
+
].join(" "),
|
|
2414
2421
|
onClick: () => item.onClick(item.id),
|
|
2415
2422
|
children: item.label
|
|
2416
2423
|
}
|
|
2417
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2424
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2425
|
+
"span",
|
|
2426
|
+
{
|
|
2427
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2428
|
+
className: [
|
|
2429
|
+
"flex-1 truncate px-sm py-xxs text-body-sm rounded-sm cursor-default select-none",
|
|
2430
|
+
isActive ? "text-primary" : "text-body"
|
|
2431
|
+
].join(" "),
|
|
2432
|
+
children: item.label
|
|
2433
|
+
}
|
|
2434
|
+
),
|
|
2418
2435
|
item.onDelete && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2419
2436
|
Button,
|
|
2420
2437
|
{
|
|
@@ -2450,6 +2467,7 @@ var NavItem = import_react8.default.forwardRef(
|
|
|
2450
2467
|
onExpandToggle,
|
|
2451
2468
|
iconOnly = false,
|
|
2452
2469
|
onClick,
|
|
2470
|
+
activeSubId,
|
|
2453
2471
|
className,
|
|
2454
2472
|
...rest
|
|
2455
2473
|
}, ref) => {
|
|
@@ -2591,7 +2609,14 @@ var NavItem = import_react8.default.forwardRef(
|
|
|
2591
2609
|
{
|
|
2592
2610
|
className: "ml-lg pl-sm border-l border-hairline-soft space-y-xxs",
|
|
2593
2611
|
role: "list",
|
|
2594
|
-
children: subItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2612
|
+
children: subItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2613
|
+
SubItemRow,
|
|
2614
|
+
{
|
|
2615
|
+
item,
|
|
2616
|
+
isActive: activeSubId !== void 0 && item.id === activeSubId
|
|
2617
|
+
},
|
|
2618
|
+
item.id
|
|
2619
|
+
))
|
|
2595
2620
|
}
|
|
2596
2621
|
),
|
|
2597
2622
|
hasChildren && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -2830,6 +2855,7 @@ var AppSidebar = import_react10.default.forwardRef(
|
|
|
2830
2855
|
active: isActive,
|
|
2831
2856
|
iconOnly: collapsed,
|
|
2832
2857
|
subItems: !collapsed ? mappedSubItems : void 0,
|
|
2858
|
+
activeSubId: hasSubItems ? activeSubId : void 0,
|
|
2833
2859
|
expanded: hasSubItems ? isExpanded : void 0,
|
|
2834
2860
|
onExpandToggle: hasSubItems ? () => toggleExpanded(entry.id) : void 0,
|
|
2835
2861
|
onClick: (e) => {
|
package/dist/index.js
CHANGED
|
@@ -2343,12 +2343,15 @@ var TrashIcon = () => /* @__PURE__ */ jsxs8(
|
|
|
2343
2343
|
]
|
|
2344
2344
|
}
|
|
2345
2345
|
);
|
|
2346
|
-
var SubItemRow = ({ item }) => {
|
|
2346
|
+
var SubItemRow = ({ item, isActive = false }) => {
|
|
2347
2347
|
const [hovered, setHovered] = React8.useState(false);
|
|
2348
2348
|
return /* @__PURE__ */ jsxs8(
|
|
2349
2349
|
"li",
|
|
2350
2350
|
{
|
|
2351
|
-
className:
|
|
2351
|
+
className: [
|
|
2352
|
+
"list-none flex items-center gap-xs rounded-sm",
|
|
2353
|
+
isActive ? "bg-primary-disabled" : ""
|
|
2354
|
+
].filter(Boolean).join(" "),
|
|
2352
2355
|
onMouseEnter: () => setHovered(true),
|
|
2353
2356
|
onMouseLeave: () => setHovered(false),
|
|
2354
2357
|
children: [
|
|
@@ -2357,11 +2360,25 @@ var SubItemRow = ({ item }) => {
|
|
|
2357
2360
|
{
|
|
2358
2361
|
variant: "ghost",
|
|
2359
2362
|
size: "sm",
|
|
2360
|
-
|
|
2363
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2364
|
+
className: [
|
|
2365
|
+
"!flex-1 !justify-start !px-sm !py-xxs !text-body-sm !rounded-sm !cursor-pointer",
|
|
2366
|
+
isActive ? "!text-primary" : "!text-body hover:!text-ink"
|
|
2367
|
+
].join(" "),
|
|
2361
2368
|
onClick: () => item.onClick(item.id),
|
|
2362
2369
|
children: item.label
|
|
2363
2370
|
}
|
|
2364
|
-
) : /* @__PURE__ */ jsx8(
|
|
2371
|
+
) : /* @__PURE__ */ jsx8(
|
|
2372
|
+
"span",
|
|
2373
|
+
{
|
|
2374
|
+
"aria-current": isActive ? "page" : void 0,
|
|
2375
|
+
className: [
|
|
2376
|
+
"flex-1 truncate px-sm py-xxs text-body-sm rounded-sm cursor-default select-none",
|
|
2377
|
+
isActive ? "text-primary" : "text-body"
|
|
2378
|
+
].join(" "),
|
|
2379
|
+
children: item.label
|
|
2380
|
+
}
|
|
2381
|
+
),
|
|
2365
2382
|
item.onDelete && /* @__PURE__ */ jsx8(
|
|
2366
2383
|
Button,
|
|
2367
2384
|
{
|
|
@@ -2397,6 +2414,7 @@ var NavItem = React8.forwardRef(
|
|
|
2397
2414
|
onExpandToggle,
|
|
2398
2415
|
iconOnly = false,
|
|
2399
2416
|
onClick,
|
|
2417
|
+
activeSubId,
|
|
2400
2418
|
className,
|
|
2401
2419
|
...rest
|
|
2402
2420
|
}, ref) => {
|
|
@@ -2538,7 +2556,14 @@ var NavItem = React8.forwardRef(
|
|
|
2538
2556
|
{
|
|
2539
2557
|
className: "ml-lg pl-sm border-l border-hairline-soft space-y-xxs",
|
|
2540
2558
|
role: "list",
|
|
2541
|
-
children: subItems.map((item) => /* @__PURE__ */ jsx8(
|
|
2559
|
+
children: subItems.map((item) => /* @__PURE__ */ jsx8(
|
|
2560
|
+
SubItemRow,
|
|
2561
|
+
{
|
|
2562
|
+
item,
|
|
2563
|
+
isActive: activeSubId !== void 0 && item.id === activeSubId
|
|
2564
|
+
},
|
|
2565
|
+
item.id
|
|
2566
|
+
))
|
|
2542
2567
|
}
|
|
2543
2568
|
),
|
|
2544
2569
|
hasChildren && /* @__PURE__ */ jsx8(
|
|
@@ -2777,6 +2802,7 @@ var AppSidebar = React10.forwardRef(
|
|
|
2777
2802
|
active: isActive,
|
|
2778
2803
|
iconOnly: collapsed,
|
|
2779
2804
|
subItems: !collapsed ? mappedSubItems : void 0,
|
|
2805
|
+
activeSubId: hasSubItems ? activeSubId : void 0,
|
|
2780
2806
|
expanded: hasSubItems ? isExpanded : void 0,
|
|
2781
2807
|
onExpandToggle: hasSubItems ? () => toggleExpanded(entry.id) : void 0,
|
|
2782
2808
|
onClick: (e) => {
|
package/package.json
CHANGED
|
@@ -96,7 +96,12 @@ export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
96
96
|
/** Called when the user selects a top-level entry. */
|
|
97
97
|
onSelect?: (id: string) => void;
|
|
98
98
|
|
|
99
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* ID of the currently-active sub-item (optional). Forwarded to each
|
|
101
|
+
* rendered NavItem so the matching nested sub-item row shows the selected
|
|
102
|
+
* indication. Does NOT affect which top-level entry is treated as active —
|
|
103
|
+
* that is driven exclusively by `activeId`.
|
|
104
|
+
*/
|
|
100
105
|
activeSubId?: string;
|
|
101
106
|
|
|
102
107
|
/** Called when the user selects a sub-item. */
|
|
@@ -343,6 +348,7 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
|
343
348
|
active={isActive}
|
|
344
349
|
iconOnly={collapsed}
|
|
345
350
|
subItems={!collapsed ? mappedSubItems : undefined}
|
|
351
|
+
activeSubId={hasSubItems ? activeSubId : undefined}
|
|
346
352
|
expanded={hasSubItems ? isExpanded : undefined}
|
|
347
353
|
onExpandToggle={hasSubItems ? () => toggleExpanded(entry.id) : undefined}
|
|
348
354
|
onClick={(e) => {
|
|
@@ -40,6 +40,13 @@ export interface NavItemProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
40
40
|
iconOnly?: boolean;
|
|
41
41
|
/** Callback when the item is clicked */
|
|
42
42
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
43
|
+
/**
|
|
44
|
+
* Id of the currently active structured sub-item. When a sub-item's `id`
|
|
45
|
+
* matches, that row shows the same selected indication as an active
|
|
46
|
+
* top-level NavItem (bg-primary-disabled, text-primary, aria-current).
|
|
47
|
+
* Does NOT affect the parent NavItem's own `active` state.
|
|
48
|
+
*/
|
|
49
|
+
activeSubId?: string;
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
const ChevronDownIcon = () => (
|
|
@@ -77,14 +84,20 @@ const TrashIcon = () => (
|
|
|
77
84
|
|
|
78
85
|
interface SubItemRowProps {
|
|
79
86
|
item: NavItemSubItem;
|
|
87
|
+
isActive?: boolean;
|
|
80
88
|
}
|
|
81
89
|
|
|
82
|
-
const SubItemRow = ({ item }: SubItemRowProps) => {
|
|
90
|
+
const SubItemRow = ({ item, isActive = false }: SubItemRowProps) => {
|
|
83
91
|
const [hovered, setHovered] = React.useState(false);
|
|
84
92
|
|
|
85
93
|
return (
|
|
86
94
|
<li
|
|
87
|
-
className=
|
|
95
|
+
className={[
|
|
96
|
+
"list-none flex items-center gap-xs rounded-sm",
|
|
97
|
+
isActive ? "bg-primary-disabled" : "",
|
|
98
|
+
]
|
|
99
|
+
.filter(Boolean)
|
|
100
|
+
.join(" ")}
|
|
88
101
|
onMouseEnter={() => setHovered(true)}
|
|
89
102
|
onMouseLeave={() => setHovered(false)}
|
|
90
103
|
>
|
|
@@ -92,13 +105,23 @@ const SubItemRow = ({ item }: SubItemRowProps) => {
|
|
|
92
105
|
<Button
|
|
93
106
|
variant="ghost"
|
|
94
107
|
size="sm"
|
|
95
|
-
|
|
108
|
+
aria-current={isActive ? "page" : undefined}
|
|
109
|
+
className={[
|
|
110
|
+
"!flex-1 !justify-start !px-sm !py-xxs !text-body-sm !rounded-sm !cursor-pointer",
|
|
111
|
+
isActive ? "!text-primary" : "!text-body hover:!text-ink",
|
|
112
|
+
].join(" ")}
|
|
96
113
|
onClick={() => item.onClick!(item.id)}
|
|
97
114
|
>
|
|
98
115
|
{item.label}
|
|
99
116
|
</Button>
|
|
100
117
|
) : (
|
|
101
|
-
<span
|
|
118
|
+
<span
|
|
119
|
+
aria-current={isActive ? "page" : undefined}
|
|
120
|
+
className={[
|
|
121
|
+
"flex-1 truncate px-sm py-xxs text-body-sm rounded-sm cursor-default select-none",
|
|
122
|
+
isActive ? "text-primary" : "text-body",
|
|
123
|
+
].join(" ")}
|
|
124
|
+
>
|
|
102
125
|
{item.label}
|
|
103
126
|
</span>
|
|
104
127
|
)}
|
|
@@ -138,6 +161,7 @@ export const NavItem = React.forwardRef<HTMLLIElement, NavItemProps>(
|
|
|
138
161
|
onExpandToggle,
|
|
139
162
|
iconOnly = false,
|
|
140
163
|
onClick,
|
|
164
|
+
activeSubId,
|
|
141
165
|
className,
|
|
142
166
|
...rest
|
|
143
167
|
},
|
|
@@ -292,7 +316,11 @@ export const NavItem = React.forwardRef<HTMLLIElement, NavItemProps>(
|
|
|
292
316
|
role="list"
|
|
293
317
|
>
|
|
294
318
|
{subItems!.map((item) => (
|
|
295
|
-
<SubItemRow
|
|
319
|
+
<SubItemRow
|
|
320
|
+
key={item.id}
|
|
321
|
+
item={item}
|
|
322
|
+
isActive={activeSubId !== undefined && item.id === activeSubId}
|
|
323
|
+
/>
|
|
296
324
|
))}
|
|
297
325
|
</ul>
|
|
298
326
|
)}
|