@designa8/vibedesign-linear-internal-v1-2-176b 0.0.2 → 0.0.4
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 +155 -69
- package/dist/index.js +155 -69
- package/dist/styles.css +6 -0
- package/package.json +1 -1
- package/src/atoms/DataTable/preview.tsx +8 -1
- package/src/atoms/DataTableDesktop/DataTableDesktop.tsx +9 -0
- package/src/atoms/DataTableMobile/DataTableMobile.tsx +8 -0
- package/src/atoms/Sidebar/Sidebar.tsx +15 -1
- package/src/atoms/Sidebar/preview.tsx +50 -7
- package/src/atoms/SidebarDesktop/SidebarDesktop.tsx +60 -19
- package/src/atoms/SidebarDesktop/preview.tsx +41 -7
- package/src/atoms/SidebarMobile/SidebarMobile.tsx +28 -9
- package/src/atoms/SidebarMobile/preview.tsx +37 -7
- package/src/atoms/TableRow/TableRow.tsx +93 -42
package/dist/index.js
CHANGED
|
@@ -2451,6 +2451,20 @@ import * as React31 from "react";
|
|
|
2451
2451
|
import * as React27 from "react";
|
|
2452
2452
|
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2453
2453
|
var cn20 = (...parts) => parts.filter(Boolean).join(" ");
|
|
2454
|
+
var INTERACTIVE_SELECTOR = [
|
|
2455
|
+
"button",
|
|
2456
|
+
"a",
|
|
2457
|
+
"input",
|
|
2458
|
+
"textarea",
|
|
2459
|
+
"select",
|
|
2460
|
+
"label",
|
|
2461
|
+
"[role='button']",
|
|
2462
|
+
"[role='checkbox']",
|
|
2463
|
+
"[role='switch']",
|
|
2464
|
+
"[role='link']",
|
|
2465
|
+
"[role='menuitem']",
|
|
2466
|
+
"[contenteditable='true']"
|
|
2467
|
+
].join(", ");
|
|
2454
2468
|
var TableRow = React27.forwardRef(
|
|
2455
2469
|
({
|
|
2456
2470
|
cells,
|
|
@@ -2458,51 +2472,74 @@ var TableRow = React27.forwardRef(
|
|
|
2458
2472
|
selected = false,
|
|
2459
2473
|
onSelectedChange,
|
|
2460
2474
|
selectLabel = "Select row",
|
|
2475
|
+
onRowActivate,
|
|
2461
2476
|
className,
|
|
2477
|
+
onClick,
|
|
2478
|
+
onKeyDown,
|
|
2462
2479
|
...rest
|
|
2463
|
-
}, ref) =>
|
|
2464
|
-
"
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
)
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2480
|
+
}, ref) => {
|
|
2481
|
+
const interactive = typeof onRowActivate === "function";
|
|
2482
|
+
const fromChildControl = (target) => target instanceof Element && target.closest(INTERACTIVE_SELECTOR) !== null;
|
|
2483
|
+
const handleClick = (event) => {
|
|
2484
|
+
onClick?.(event);
|
|
2485
|
+
if (!interactive || event.defaultPrevented || fromChildControl(event.target)) return;
|
|
2486
|
+
onRowActivate?.();
|
|
2487
|
+
};
|
|
2488
|
+
const handleKeyDown = (event) => {
|
|
2489
|
+
onKeyDown?.(event);
|
|
2490
|
+
if (!interactive || event.defaultPrevented) return;
|
|
2491
|
+
if (event.key !== "Enter" || event.target !== event.currentTarget) return;
|
|
2492
|
+
event.preventDefault();
|
|
2493
|
+
onRowActivate?.();
|
|
2494
|
+
};
|
|
2495
|
+
return /* @__PURE__ */ jsxs21(
|
|
2496
|
+
"tr",
|
|
2497
|
+
{
|
|
2498
|
+
ref,
|
|
2499
|
+
"aria-selected": selectable ? selected : void 0,
|
|
2500
|
+
"data-state": selected ? "selected" : void 0,
|
|
2501
|
+
tabIndex: interactive ? 0 : void 0,
|
|
2502
|
+
onClick: interactive ? handleClick : onClick,
|
|
2503
|
+
onKeyDown: interactive ? handleKeyDown : onKeyDown,
|
|
2504
|
+
className: cn20(
|
|
2505
|
+
"h-10 border-b border-hairline-soft text-body-sm text-ink transition-colors duration-150 ease-out last:border-b-0",
|
|
2506
|
+
"hover:bg-surface-soft data-[state=selected]:bg-primary-soft",
|
|
2507
|
+
interactive && "cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue",
|
|
2508
|
+
className
|
|
2509
|
+
),
|
|
2510
|
+
...rest,
|
|
2511
|
+
children: [
|
|
2512
|
+
selectable && /* @__PURE__ */ jsx27("td", { className: "w-10 pl-base pr-xs align-middle", children: /* @__PURE__ */ jsx27(
|
|
2513
|
+
Checkbox,
|
|
2489
2514
|
{
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2515
|
+
size: "md",
|
|
2516
|
+
checked: selected,
|
|
2517
|
+
onCheckedChange: (v) => onSelectedChange?.(v),
|
|
2518
|
+
"aria-label": selectLabel
|
|
2519
|
+
}
|
|
2520
|
+
) }),
|
|
2521
|
+
cells.map((cell, i) => {
|
|
2522
|
+
const Tag = cell.rowHeader ? "th" : "td";
|
|
2523
|
+
return /* @__PURE__ */ jsx27(
|
|
2524
|
+
Tag,
|
|
2525
|
+
{
|
|
2526
|
+
scope: cell.rowHeader ? "row" : void 0,
|
|
2527
|
+
className: cn20(
|
|
2528
|
+
"px-base align-middle text-body-sm",
|
|
2529
|
+
cell.rowHeader ? "text-ink font-weight-body-md" : "text-body",
|
|
2530
|
+
cell.align === "right" ? "text-right tabular-nums" : "text-left",
|
|
2531
|
+
i === 0 && !selectable && "pl-base",
|
|
2532
|
+
i === cells.length - 1 && "pr-base"
|
|
2533
|
+
),
|
|
2534
|
+
children: cell.content
|
|
2535
|
+
},
|
|
2536
|
+
cell.key
|
|
2537
|
+
);
|
|
2538
|
+
})
|
|
2539
|
+
]
|
|
2540
|
+
}
|
|
2541
|
+
);
|
|
2542
|
+
}
|
|
2506
2543
|
);
|
|
2507
2544
|
TableRow.displayName = "TableRow";
|
|
2508
2545
|
|
|
@@ -2925,6 +2962,7 @@ function DataTableDesktopInner({
|
|
|
2925
2962
|
selectable = false,
|
|
2926
2963
|
selectedIds = [],
|
|
2927
2964
|
onSelectedIdsChange,
|
|
2965
|
+
onRowClick,
|
|
2928
2966
|
page = 1,
|
|
2929
2967
|
totalPages = 1,
|
|
2930
2968
|
onPageChange,
|
|
@@ -3024,6 +3062,7 @@ function DataTableDesktopInner({
|
|
|
3024
3062
|
selected: selectedIds.includes(id),
|
|
3025
3063
|
onSelectedChange: (on) => toggleRow(id, on),
|
|
3026
3064
|
selectLabel: `Select row ${id}`,
|
|
3065
|
+
onRowActivate: onRowClick ? () => onRowClick(row) : void 0,
|
|
3027
3066
|
cells: columns.map((col) => ({
|
|
3028
3067
|
key: col.key,
|
|
3029
3068
|
content: col.render(row),
|
|
@@ -3070,6 +3109,7 @@ function DataTableMobileInner({
|
|
|
3070
3109
|
selectable = true,
|
|
3071
3110
|
selectedIds = [],
|
|
3072
3111
|
onSelectedIdsChange,
|
|
3112
|
+
onRowClick,
|
|
3073
3113
|
page = 1,
|
|
3074
3114
|
totalPages = 1,
|
|
3075
3115
|
onPageChange,
|
|
@@ -3140,6 +3180,7 @@ function DataTableMobileInner({
|
|
|
3140
3180
|
onSelectedChange: (on) => toggleRow(id, on),
|
|
3141
3181
|
selectLabel: `Select row ${id}`,
|
|
3142
3182
|
className: "h-11",
|
|
3183
|
+
onRowActivate: onRowClick ? () => onRowClick(row) : void 0,
|
|
3143
3184
|
cells: [
|
|
3144
3185
|
...primary ? [{ key: primary.key, content: primary.render(row), rowHeader: true }] : [],
|
|
3145
3186
|
...trailing.map((c) => ({
|
|
@@ -7223,6 +7264,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7223
7264
|
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
7224
7265
|
var cn54 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7225
7266
|
var linkBase = "flex h-8 items-center rounded-md border border-transparent text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue";
|
|
7267
|
+
var hasBadge = (badge) => badge !== void 0 && badge !== null && badge !== false;
|
|
7226
7268
|
var SidebarDesktop = React72.forwardRef(
|
|
7227
7269
|
({
|
|
7228
7270
|
brandName = "Linear",
|
|
@@ -7230,6 +7272,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7230
7272
|
workspaceName,
|
|
7231
7273
|
workspaceAvatarSrc,
|
|
7232
7274
|
onWorkspaceClick,
|
|
7275
|
+
headerActions,
|
|
7233
7276
|
sections,
|
|
7234
7277
|
activeId,
|
|
7235
7278
|
onNavigate,
|
|
@@ -7266,6 +7309,16 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7266
7309
|
else next.add(id);
|
|
7267
7310
|
return next;
|
|
7268
7311
|
});
|
|
7312
|
+
const renderIcon = (link) => link.icon ? /* @__PURE__ */ jsxs66("span", { className: "relative inline-flex shrink-0 items-center justify-center", children: [
|
|
7313
|
+
/* @__PURE__ */ jsx72(Icon, { name: link.icon, size: 16, className: "text-body" }),
|
|
7314
|
+
collapsed && hasBadge(link.badge) && /* @__PURE__ */ jsx72(
|
|
7315
|
+
"span",
|
|
7316
|
+
{
|
|
7317
|
+
"aria-hidden": "true",
|
|
7318
|
+
className: "absolute right-0 top-0 h-xs w-xs rounded-full bg-primary ring-2 ring-surface"
|
|
7319
|
+
}
|
|
7320
|
+
)
|
|
7321
|
+
] }) : null;
|
|
7269
7322
|
const renderLink = (link, nested = false) => {
|
|
7270
7323
|
const current = link.id === activeId;
|
|
7271
7324
|
const anchor = /* @__PURE__ */ jsxs66(
|
|
@@ -7281,8 +7334,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7281
7334
|
current ? "bg-surface-strong text-ink font-weight-label" : "text-ink hover:bg-surface-soft active:bg-surface-strong"
|
|
7282
7335
|
),
|
|
7283
7336
|
children: [
|
|
7284
|
-
|
|
7285
|
-
!collapsed && /* @__PURE__ */ jsx72("span", { className: "min-w-0 flex-1 truncate", children: link.label })
|
|
7337
|
+
renderIcon(link),
|
|
7338
|
+
!collapsed && /* @__PURE__ */ jsx72("span", { className: "min-w-0 flex-1 truncate", children: link.label }),
|
|
7339
|
+
!collapsed && hasBadge(link.badge) && /* @__PURE__ */ jsx72("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge })
|
|
7286
7340
|
]
|
|
7287
7341
|
}
|
|
7288
7342
|
);
|
|
@@ -7320,8 +7374,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7320
7374
|
onClick: () => flip(link.id),
|
|
7321
7375
|
leadingIcon: link.icon ? /* @__PURE__ */ jsx72(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7322
7376
|
className: "px-sm",
|
|
7323
|
-
children: /* @__PURE__ */ jsxs66("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7324
|
-
link.label,
|
|
7377
|
+
children: /* @__PURE__ */ jsxs66("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
|
|
7378
|
+
/* @__PURE__ */ jsx72("span", { className: "truncate", children: link.label }),
|
|
7379
|
+
hasBadge(link.badge) && /* @__PURE__ */ jsx72("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge }),
|
|
7325
7380
|
/* @__PURE__ */ jsx72(
|
|
7326
7381
|
Icon,
|
|
7327
7382
|
{
|
|
@@ -7345,6 +7400,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7345
7400
|
] }, link.id);
|
|
7346
7401
|
};
|
|
7347
7402
|
const renderItem = (link) => link.children?.length ? renderGroup(link) : renderLink(link);
|
|
7403
|
+
const showWorkspaceRow = Boolean(workspaceName) || !collapsed && headerActions != null;
|
|
7348
7404
|
return /* @__PURE__ */ jsxs66("div", { ref, className: cn54("flex h-full w-full min-h-0 bg-canvas text-ink", className), ...rest, children: [
|
|
7349
7405
|
/* @__PURE__ */ jsxs66(
|
|
7350
7406
|
"aside",
|
|
@@ -7358,17 +7414,29 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7358
7414
|
/* @__PURE__ */ jsx72(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7359
7415
|
/* @__PURE__ */ jsx72(IconButton, { icon: "panel-left", variant: "secondary", "aria-label": "Collapse sidebar", "aria-expanded": true, onClick: toggle })
|
|
7360
7416
|
] }),
|
|
7361
|
-
|
|
7362
|
-
|
|
7417
|
+
showWorkspaceRow && /* @__PURE__ */ jsxs66(
|
|
7418
|
+
"div",
|
|
7363
7419
|
{
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7420
|
+
className: cn54(
|
|
7421
|
+
"shrink-0 pb-sm",
|
|
7422
|
+
collapsed ? "flex justify-center" : "flex items-center gap-xxs px-sm"
|
|
7423
|
+
),
|
|
7424
|
+
children: [
|
|
7425
|
+
workspaceName ? collapsed ? /* @__PURE__ */ jsx72(Tooltip, { content: workspaceName, placement: "right", children: /* @__PURE__ */ jsx72(Button, { variant: "ghost", iconOnly: true, "aria-label": workspaceName, onClick: onWorkspaceClick, children: /* @__PURE__ */ jsx72(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }) }) }) : /* @__PURE__ */ jsx72(
|
|
7426
|
+
Button,
|
|
7427
|
+
{
|
|
7428
|
+
variant: "ghost",
|
|
7429
|
+
onClick: onWorkspaceClick,
|
|
7430
|
+
className: "min-w-0 flex-1 justify-start px-sm",
|
|
7431
|
+
leadingIcon: /* @__PURE__ */ jsx72(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }),
|
|
7432
|
+
trailingIcon: /* @__PURE__ */ jsx72(Icon, { name: "chevron-down", size: 14, className: "text-muted" }),
|
|
7433
|
+
children: /* @__PURE__ */ jsx72("span", { className: "min-w-0 truncate text-ink", children: workspaceName })
|
|
7434
|
+
}
|
|
7435
|
+
) : /* @__PURE__ */ jsx72("span", { className: "min-w-0 flex-1" }),
|
|
7436
|
+
!collapsed && headerActions != null && /* @__PURE__ */ jsx72("div", { className: "flex shrink-0 items-center gap-xxs", children: headerActions })
|
|
7437
|
+
]
|
|
7370
7438
|
}
|
|
7371
|
-
)
|
|
7439
|
+
),
|
|
7372
7440
|
/* @__PURE__ */ jsx72("nav", { "aria-label": "Main", className: cn54("min-h-0 flex-1 overflow-y-auto overscroll-contain pb-sm", collapsed ? "px-0" : "px-sm"), children: sections.map((section, i) => {
|
|
7373
7441
|
const sectionOpen = !section.label || isOpen(section.id);
|
|
7374
7442
|
const listId = `${baseId}-section-${section.id}`;
|
|
@@ -7447,6 +7515,7 @@ import * as React73 from "react";
|
|
|
7447
7515
|
import { jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
7448
7516
|
var cn55 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7449
7517
|
var linkBase2 = "flex h-9 w-full items-center gap-sm rounded-md border border-transparent px-sm text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue";
|
|
7518
|
+
var hasBadge2 = (badge) => badge !== void 0 && badge !== null && badge !== false;
|
|
7450
7519
|
var SidebarMobile = React73.forwardRef(
|
|
7451
7520
|
({
|
|
7452
7521
|
brandName = "Linear",
|
|
@@ -7454,6 +7523,7 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7454
7523
|
workspaceName,
|
|
7455
7524
|
workspaceAvatarSrc,
|
|
7456
7525
|
onWorkspaceClick,
|
|
7526
|
+
mobileActions,
|
|
7457
7527
|
sections,
|
|
7458
7528
|
activeId,
|
|
7459
7529
|
onNavigate,
|
|
@@ -7507,7 +7577,8 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7507
7577
|
),
|
|
7508
7578
|
children: [
|
|
7509
7579
|
link.icon && /* @__PURE__ */ jsx73(Icon, { name: link.icon, size: 16, className: "text-body" }),
|
|
7510
|
-
/* @__PURE__ */ jsx73("span", { className: "min-w-0 flex-1 truncate", children: link.label })
|
|
7580
|
+
/* @__PURE__ */ jsx73("span", { className: "min-w-0 flex-1 truncate", children: link.label }),
|
|
7581
|
+
hasBadge2(link.badge) && /* @__PURE__ */ jsx73("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge })
|
|
7511
7582
|
]
|
|
7512
7583
|
}
|
|
7513
7584
|
) }, link.id);
|
|
@@ -7526,8 +7597,9 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7526
7597
|
onClick: () => flip(link.id),
|
|
7527
7598
|
leadingIcon: link.icon ? /* @__PURE__ */ jsx73(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7528
7599
|
className: "px-sm",
|
|
7529
|
-
children: /* @__PURE__ */ jsxs67("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7530
|
-
link.label,
|
|
7600
|
+
children: /* @__PURE__ */ jsxs67("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
|
|
7601
|
+
/* @__PURE__ */ jsx73("span", { className: "truncate", children: link.label }),
|
|
7602
|
+
hasBadge2(link.badge) && /* @__PURE__ */ jsx73("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge }),
|
|
7531
7603
|
/* @__PURE__ */ jsx73(
|
|
7532
7604
|
Icon,
|
|
7533
7605
|
{
|
|
@@ -7553,16 +7625,19 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7553
7625
|
return /* @__PURE__ */ jsxs67("div", { ref, className: cn55("flex w-full flex-col bg-canvas text-ink", className), ...rest, children: [
|
|
7554
7626
|
/* @__PURE__ */ jsxs67("header", { className: "flex h-14 w-full shrink-0 items-center justify-between gap-sm border-b border-hairline bg-canvas px-base", children: [
|
|
7555
7627
|
/* @__PURE__ */ jsx73(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7556
|
-
/* @__PURE__ */
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7628
|
+
/* @__PURE__ */ jsxs67("div", { className: "flex min-w-0 items-center gap-xxs", children: [
|
|
7629
|
+
mobileActions != null && /* @__PURE__ */ jsx73("div", { className: "flex items-center gap-xxs", children: mobileActions }),
|
|
7630
|
+
/* @__PURE__ */ jsx73(
|
|
7631
|
+
IconButton,
|
|
7632
|
+
{
|
|
7633
|
+
icon: "menu",
|
|
7634
|
+
variant: "ghost",
|
|
7635
|
+
"aria-label": "Open navigation",
|
|
7636
|
+
"aria-expanded": open,
|
|
7637
|
+
onClick: () => setOpen(true)
|
|
7638
|
+
}
|
|
7639
|
+
)
|
|
7640
|
+
] })
|
|
7566
7641
|
] }),
|
|
7567
7642
|
children !== void 0 && /* @__PURE__ */ jsx73("div", { className: "min-w-0 flex-1", children }),
|
|
7568
7643
|
/* @__PURE__ */ jsxs67(
|
|
@@ -7659,6 +7734,8 @@ var Sidebar = React74.forwardRef(
|
|
|
7659
7734
|
onCollapsedChange,
|
|
7660
7735
|
mobileOpen,
|
|
7661
7736
|
onMobileOpenChange,
|
|
7737
|
+
headerActions,
|
|
7738
|
+
mobileActions,
|
|
7662
7739
|
children,
|
|
7663
7740
|
className,
|
|
7664
7741
|
...shared
|
|
@@ -7672,12 +7749,21 @@ var Sidebar = React74.forwardRef(
|
|
|
7672
7749
|
SidebarDesktop,
|
|
7673
7750
|
{
|
|
7674
7751
|
...shared,
|
|
7752
|
+
headerActions,
|
|
7675
7753
|
collapsed,
|
|
7676
7754
|
defaultCollapsed,
|
|
7677
7755
|
onCollapsedChange
|
|
7678
7756
|
}
|
|
7679
7757
|
) }),
|
|
7680
|
-
/* @__PURE__ */ jsx74("div", { className: "shrink-0 md:hidden", children: /* @__PURE__ */ jsx74(
|
|
7758
|
+
/* @__PURE__ */ jsx74("div", { className: "shrink-0 md:hidden", children: /* @__PURE__ */ jsx74(
|
|
7759
|
+
SidebarMobile,
|
|
7760
|
+
{
|
|
7761
|
+
...shared,
|
|
7762
|
+
mobileActions,
|
|
7763
|
+
open: mobileOpen,
|
|
7764
|
+
onOpenChange: onMobileOpenChange
|
|
7765
|
+
}
|
|
7766
|
+
) }),
|
|
7681
7767
|
children !== void 0 && /* @__PURE__ */ jsx74("div", { className: "min-h-0 min-w-0 flex-1 overflow-auto", children })
|
|
7682
7768
|
]
|
|
7683
7769
|
}
|
package/dist/styles.css
CHANGED
|
@@ -675,6 +675,9 @@
|
|
|
675
675
|
.h-px {
|
|
676
676
|
height: 1px;
|
|
677
677
|
}
|
|
678
|
+
.h-xs {
|
|
679
|
+
height: var(--spacing-xs);
|
|
680
|
+
}
|
|
678
681
|
.max-h-72 {
|
|
679
682
|
max-height: calc(var(--spacing) * 72);
|
|
680
683
|
}
|
|
@@ -1776,6 +1779,9 @@
|
|
|
1776
1779
|
.ring-primary {
|
|
1777
1780
|
--tw-ring-color: var(--color-primary);
|
|
1778
1781
|
}
|
|
1782
|
+
.ring-surface {
|
|
1783
|
+
--tw-ring-color: var(--color-surface);
|
|
1784
|
+
}
|
|
1779
1785
|
.ring-offset-2 {
|
|
1780
1786
|
--tw-ring-offset-width: 2px;
|
|
1781
1787
|
--tw-ring-offset-shadow: var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
package/package.json
CHANGED
|
@@ -69,16 +69,23 @@ export default function DataTablePreview() {
|
|
|
69
69
|
const [view, setView] = React.useState<string | null>("all");
|
|
70
70
|
const [page, setPage] = React.useState(1);
|
|
71
71
|
const [panel, setPanel] = React.useState(false);
|
|
72
|
+
const [opened, setOpened] = React.useState<string | null>(null);
|
|
73
|
+
|
|
72
74
|
const rows = sort
|
|
73
75
|
? [...ALL].sort((a, b) => (a.name > b.name ? 1 : -1) * (sort.direction === "descending" ? -1 : 1))
|
|
74
76
|
: ALL;
|
|
77
|
+
|
|
75
78
|
return (
|
|
76
|
-
<div className="w-full p-lg text-ink">
|
|
79
|
+
<div className="w-full max-w-4xl mx-auto space-y-md p-lg text-ink">
|
|
80
|
+
<div className="min-h-[1.25rem] text-body-sm text-muted" aria-live="polite">
|
|
81
|
+
{opened ? `Opened row: ${opened}` : "Click a row (or focus it and press Enter) to open it."}
|
|
82
|
+
</div>
|
|
77
83
|
<DataTable
|
|
78
84
|
caption="Projects"
|
|
79
85
|
columns={COLUMNS}
|
|
80
86
|
rows={rows}
|
|
81
87
|
getRowId={(p) => p.id}
|
|
88
|
+
onRowClick={(p) => setOpened(p.name)}
|
|
82
89
|
sort={sort}
|
|
83
90
|
onSortChange={setSort}
|
|
84
91
|
viewOptions={[
|
|
@@ -60,6 +60,13 @@ export interface DataTableDesktopProps<T = Record<string, unknown>>
|
|
|
60
60
|
selectedIds?: string[];
|
|
61
61
|
onSelectedIdsChange?: (ids: string[]) => void;
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Makes every body row a click target — the row becomes focusable, Enter
|
|
65
|
+
* activates it, and clicks inside the checkbox or any other control are
|
|
66
|
+
* ignored. Omit it and rows stay static.
|
|
67
|
+
*/
|
|
68
|
+
onRowClick?: (row: T) => void;
|
|
69
|
+
|
|
63
70
|
page?: number;
|
|
64
71
|
totalPages?: number;
|
|
65
72
|
onPageChange?: (page: number) => void;
|
|
@@ -96,6 +103,7 @@ function DataTableDesktopInner<T>(
|
|
|
96
103
|
selectable = false,
|
|
97
104
|
selectedIds = [],
|
|
98
105
|
onSelectedIdsChange,
|
|
106
|
+
onRowClick,
|
|
99
107
|
page = 1,
|
|
100
108
|
totalPages = 1,
|
|
101
109
|
onPageChange,
|
|
@@ -221,6 +229,7 @@ function DataTableDesktopInner<T>(
|
|
|
221
229
|
selected={selectedIds.includes(id)}
|
|
222
230
|
onSelectedChange={(on) => toggleRow(id, on)}
|
|
223
231
|
selectLabel={`Select row ${id}`}
|
|
232
|
+
onRowActivate={onRowClick ? () => onRowClick(row) : undefined}
|
|
224
233
|
cells={columns.map((col) => ({
|
|
225
234
|
key: col.key,
|
|
226
235
|
content: col.render(row),
|
|
@@ -47,6 +47,12 @@ export interface DataTableMobileProps<T = Record<string, unknown>>
|
|
|
47
47
|
selectable?: boolean;
|
|
48
48
|
selectedIds?: string[];
|
|
49
49
|
onSelectedIdsChange?: (ids: string[]) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Makes every body row a click target — the row becomes focusable, Enter
|
|
52
|
+
* activates it, and clicks inside the checkbox or any other control are
|
|
53
|
+
* ignored. Omit it and rows stay static.
|
|
54
|
+
*/
|
|
55
|
+
onRowClick?: (row: T) => void;
|
|
50
56
|
page?: number;
|
|
51
57
|
totalPages?: number;
|
|
52
58
|
onPageChange?: (page: number) => void;
|
|
@@ -81,6 +87,7 @@ function DataTableMobileInner<T>(
|
|
|
81
87
|
selectable = true,
|
|
82
88
|
selectedIds = [],
|
|
83
89
|
onSelectedIdsChange,
|
|
90
|
+
onRowClick,
|
|
84
91
|
page = 1,
|
|
85
92
|
totalPages = 1,
|
|
86
93
|
onPageChange,
|
|
@@ -180,6 +187,7 @@ function DataTableMobileInner<T>(
|
|
|
180
187
|
onSelectedChange={(on) => toggleRow(id, on)}
|
|
181
188
|
selectLabel={`Select row ${id}`}
|
|
182
189
|
className="h-11"
|
|
190
|
+
onRowActivate={onRowClick ? () => onRowClick(row) : undefined}
|
|
183
191
|
cells={[
|
|
184
192
|
...(primary
|
|
185
193
|
? [{ key: primary.key, content: primary.render(row), rowHeader: true }]
|
|
@@ -8,6 +8,8 @@ export interface SidebarLink {
|
|
|
8
8
|
label: string;
|
|
9
9
|
icon?: IconName;
|
|
10
10
|
href?: string;
|
|
11
|
+
/** Small count or muted marker shown right-aligned at the end of the row. */
|
|
12
|
+
badge?: React.ReactNode;
|
|
11
13
|
children?: SidebarLink[];
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -32,6 +34,10 @@ export interface SidebarProps {
|
|
|
32
34
|
userAvatarSrc?: string;
|
|
33
35
|
onHelpClick?: () => void;
|
|
34
36
|
onSettingsClick?: () => void;
|
|
37
|
+
/** App actions rendered right-aligned on the workspace row (desktop). Hidden when folded. */
|
|
38
|
+
headerActions?: React.ReactNode;
|
|
39
|
+
/** App actions rendered in the mobile top bar, between the logo and the menu button. */
|
|
40
|
+
mobileActions?: React.ReactNode;
|
|
35
41
|
/** Desktop fold state. */
|
|
36
42
|
collapsed?: boolean;
|
|
37
43
|
defaultCollapsed?: boolean;
|
|
@@ -53,6 +59,8 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
53
59
|
onCollapsedChange,
|
|
54
60
|
mobileOpen,
|
|
55
61
|
onMobileOpenChange,
|
|
62
|
+
headerActions,
|
|
63
|
+
mobileActions,
|
|
56
64
|
children,
|
|
57
65
|
className,
|
|
58
66
|
...shared
|
|
@@ -66,13 +74,19 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
66
74
|
<div className="hidden h-full shrink-0 md:block">
|
|
67
75
|
<SidebarDesktop
|
|
68
76
|
{...shared}
|
|
77
|
+
headerActions={headerActions}
|
|
69
78
|
collapsed={collapsed}
|
|
70
79
|
defaultCollapsed={defaultCollapsed}
|
|
71
80
|
onCollapsedChange={onCollapsedChange}
|
|
72
81
|
/>
|
|
73
82
|
</div>
|
|
74
83
|
<div className="shrink-0 md:hidden">
|
|
75
|
-
<SidebarMobile
|
|
84
|
+
<SidebarMobile
|
|
85
|
+
{...shared}
|
|
86
|
+
mobileActions={mobileActions}
|
|
87
|
+
open={mobileOpen}
|
|
88
|
+
onOpenChange={onMobileOpenChange}
|
|
89
|
+
/>
|
|
76
90
|
</div>
|
|
77
91
|
{children !== undefined && <div className="min-h-0 min-w-0 flex-1 overflow-auto">{children}</div>}
|
|
78
92
|
</div>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Sidebar } from "./Sidebar";
|
|
3
|
+
import { SidebarMobile } from "../SidebarMobile";
|
|
4
|
+
import { IconButton } from "../IconButton";
|
|
5
|
+
import { Avatar } from "../Avatar";
|
|
3
6
|
import type { SidebarSection } from "./Sidebar";
|
|
4
7
|
|
|
5
8
|
const SECTIONS: SidebarSection[] = [
|
|
6
9
|
{
|
|
7
10
|
id: "main",
|
|
8
11
|
items: [
|
|
9
|
-
{ id: "drafts", label: "Drafts", icon: "square-pen" },
|
|
10
|
-
{ id: "inbox", label: "Inbox", icon: "inbox" },
|
|
12
|
+
{ id: "drafts", label: "Drafts", icon: "square-pen", badge: "2" },
|
|
13
|
+
{ id: "inbox", label: "Inbox", icon: "inbox", badge: "4" },
|
|
11
14
|
{ id: "my-issues", label: "My issues", icon: "scan-eye" },
|
|
12
15
|
{ id: "more", label: "More", icon: "ellipsis" },
|
|
13
16
|
],
|
|
@@ -21,7 +24,7 @@ const SECTIONS: SidebarSection[] = [
|
|
|
21
24
|
label: "Engineering Team",
|
|
22
25
|
icon: "monitor",
|
|
23
26
|
children: [
|
|
24
|
-
{ id: "eng-issues", label: "Issues", icon: "copy" },
|
|
27
|
+
{ id: "eng-issues", label: "Issues", icon: "copy", badge: "12" },
|
|
25
28
|
{ id: "eng-projects", label: "Projects", icon: "box" },
|
|
26
29
|
],
|
|
27
30
|
},
|
|
@@ -50,14 +53,29 @@ const SECTIONS: SidebarSection[] = [
|
|
|
50
53
|
},
|
|
51
54
|
];
|
|
52
55
|
|
|
56
|
+
const HEADER_ACTIONS = (
|
|
57
|
+
<>
|
|
58
|
+
<IconButton icon="search" variant="ghost" aria-label="Search issues" />
|
|
59
|
+
<IconButton icon="square-pen" variant="ghost" aria-label="New issue" />
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const MOBILE_ACTIONS = (
|
|
64
|
+
<>
|
|
65
|
+
<IconButton icon="search" variant="ghost" aria-label="Search issues" />
|
|
66
|
+
<IconButton icon="inbox" variant="ghost" aria-label="Inbox, 4 unread" />
|
|
67
|
+
<Avatar name="AS Mobbin" size="sm" />
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
|
|
53
71
|
export default function SidebarPreview() {
|
|
54
72
|
const [collapsed, setCollapsed] = React.useState(false);
|
|
55
73
|
const [mobileOpen, setMobileOpen] = React.useState(false);
|
|
56
74
|
const [active, setActive] = React.useState("issues");
|
|
57
75
|
|
|
58
76
|
return (
|
|
59
|
-
<div className="w-full">
|
|
60
|
-
<div className="
|
|
77
|
+
<div className="mx-auto w-full max-w-5xl space-y-lg p-md">
|
|
78
|
+
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "24rem" }}>
|
|
61
79
|
<Sidebar
|
|
62
80
|
sections={SECTIONS}
|
|
63
81
|
defaultExpanded={["teams", "try", "workspace-team"]}
|
|
@@ -68,7 +86,8 @@ export default function SidebarPreview() {
|
|
|
68
86
|
}}
|
|
69
87
|
workspaceName="AS Mobbin"
|
|
70
88
|
userName="AS Mobbin"
|
|
71
|
-
|
|
89
|
+
headerActions={HEADER_ACTIONS}
|
|
90
|
+
mobileActions={MOBILE_ACTIONS}
|
|
72
91
|
collapsed={collapsed}
|
|
73
92
|
onCollapsedChange={setCollapsed}
|
|
74
93
|
mobileOpen={mobileOpen}
|
|
@@ -76,10 +95,34 @@ export default function SidebarPreview() {
|
|
|
76
95
|
>
|
|
77
96
|
<div className="p-lg">
|
|
78
97
|
<h1 className="text-heading-sm text-ink">Issues</h1>
|
|
79
|
-
<p className="mt-xs text-body-sm text-muted">
|
|
98
|
+
<p className="mt-xs text-body-sm text-muted">
|
|
99
|
+
Counts sit at the end of Inbox and Drafts; search and compose sit beside the workspace switcher and
|
|
100
|
+
fold away with the rail.
|
|
101
|
+
</p>
|
|
80
102
|
</div>
|
|
81
103
|
</Sidebar>
|
|
82
104
|
</div>
|
|
105
|
+
|
|
106
|
+
<div
|
|
107
|
+
className="w-full overflow-hidden rounded-lg border border-hairline"
|
|
108
|
+
style={{ maxWidth: "var(--container-sm, 24rem)" }}
|
|
109
|
+
>
|
|
110
|
+
<SidebarMobile
|
|
111
|
+
sections={SECTIONS}
|
|
112
|
+
defaultExpanded={["teams", "workspace-team"]}
|
|
113
|
+
activeId={active}
|
|
114
|
+
workspaceName="AS Mobbin"
|
|
115
|
+
userName="AS Mobbin"
|
|
116
|
+
mobileActions={MOBILE_ACTIONS}
|
|
117
|
+
>
|
|
118
|
+
<div className="p-md">
|
|
119
|
+
<h2 className="text-heading-sm text-ink">Mobile top bar</h2>
|
|
120
|
+
<p className="mt-xs text-body-sm text-muted">
|
|
121
|
+
Search, inbox count and avatar sit between the logo and the menu button, on one row.
|
|
122
|
+
</p>
|
|
123
|
+
</div>
|
|
124
|
+
</SidebarMobile>
|
|
125
|
+
</div>
|
|
83
126
|
</div>
|
|
84
127
|
);
|
|
85
128
|
}
|