@knkcs/anker 2.2.1 → 2.3.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/CLAUDE-ANKER.md +1 -0
- package/dist/components/index.d.ts +53 -2
- package/dist/components/index.js +299 -30
- package/dist/components/index.js.map +1 -1
- package/package.json +1 -1
package/CLAUDE-ANKER.md
CHANGED
|
@@ -78,6 +78,7 @@ Available templates:
|
|
|
78
78
|
| Template | Use for |
|
|
79
79
|
|---|---|
|
|
80
80
|
| `<AppShell>` | Authenticated chrome (sidebar · main · rail). Provides `usePageActions(node)`, `usePageHeader(node)`, and `usePageRail(node)` hooks. Page templates register their `<PageHeader>` via `usePageHeader`, which renders it as a band spanning main + rail. |
|
|
81
|
+
| `<ContextRail>` | Right-rail container with sticky positioning, collapse toggle on the leading edge, and five mode-aware atom subcomponents for compact rendering at 44px: `IconButton`, `ValueTile`, `StatusIcon`, `Avatar`, `Divider`. Sections (`<ContextRail.Section>`) keep their expanded-mode chrome; in collapsed mode, only atom-tagged children render. See `docs/page-patterns.md` §ContextRail patterns. |
|
|
81
82
|
| `<PageHeader>` | Three-row page header band (breadcrumb · detail · tabs). Props: `breadcrumbs`, `title`, `subtitle`, `eyebrow`, `actions`, `avatar`, `badges`, `meta`, `tabs`. Each row is independently optional except title. See `docs/page-patterns.md` §Page header anatomy. |
|
|
82
83
|
| `<IndexPageTemplate>` | List pages — header + optional tabs + toolbar + DataTable |
|
|
83
84
|
| `<DetailPageTemplate>` | Single-entity pages — registers a three-row header band via `usePageHeader`. New props: `avatar`, `badges`, `meta`, `tabs`. `subheader` and `bodyTabs` were removed in v2.2.0 — migrate to the slot props on PageHeader. |
|
|
@@ -146,6 +146,52 @@ interface ChipPickerProps<T> {
|
|
|
146
146
|
}
|
|
147
147
|
declare const ChipPicker: <T>(props: ChipPickerProps<T>) => React$1.ReactElement;
|
|
148
148
|
|
|
149
|
+
type IconButtonTone = "default" | "primary" | "outline-red" | "outline-primary" | "ghost";
|
|
150
|
+
interface ContextRailIconButtonProps {
|
|
151
|
+
label: string;
|
|
152
|
+
icon: React__default.ReactNode;
|
|
153
|
+
onClick?: () => void;
|
|
154
|
+
tone?: IconButtonTone;
|
|
155
|
+
}
|
|
156
|
+
declare function ContextRailIconButton({ label, icon, onClick, tone, }: ContextRailIconButtonProps): react_jsx_runtime.JSX.Element;
|
|
157
|
+
declare namespace ContextRailIconButton {
|
|
158
|
+
var displayName: string;
|
|
159
|
+
}
|
|
160
|
+
interface ContextRailValueTileProps {
|
|
161
|
+
value: number | string;
|
|
162
|
+
label: string;
|
|
163
|
+
muted?: boolean;
|
|
164
|
+
keepWhenEmpty?: boolean;
|
|
165
|
+
}
|
|
166
|
+
declare function ContextRailValueTile({ value, label, muted, keepWhenEmpty, }: ContextRailValueTileProps): react_jsx_runtime.JSX.Element | null;
|
|
167
|
+
declare namespace ContextRailValueTile {
|
|
168
|
+
var displayName: string;
|
|
169
|
+
}
|
|
170
|
+
type StatusTone = "green" | "amber" | "red" | "gray";
|
|
171
|
+
interface ContextRailStatusIconProps {
|
|
172
|
+
icon: React__default.ReactNode;
|
|
173
|
+
label: string;
|
|
174
|
+
tone: StatusTone;
|
|
175
|
+
}
|
|
176
|
+
declare function ContextRailStatusIcon({ icon, label, tone, }: ContextRailStatusIconProps): react_jsx_runtime.JSX.Element;
|
|
177
|
+
declare namespace ContextRailStatusIcon {
|
|
178
|
+
var displayName: string;
|
|
179
|
+
}
|
|
180
|
+
interface ContextRailAvatarProps {
|
|
181
|
+
initials: string;
|
|
182
|
+
label: string;
|
|
183
|
+
src?: string;
|
|
184
|
+
onClick?: () => void;
|
|
185
|
+
}
|
|
186
|
+
declare function ContextRailAvatar({ initials, label, src, onClick, }: ContextRailAvatarProps): react_jsx_runtime.JSX.Element;
|
|
187
|
+
declare namespace ContextRailAvatar {
|
|
188
|
+
var displayName: string;
|
|
189
|
+
}
|
|
190
|
+
declare function ContextRailDivider(): react_jsx_runtime.JSX.Element;
|
|
191
|
+
declare namespace ContextRailDivider {
|
|
192
|
+
var displayName: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
149
195
|
interface ContextRailProps {
|
|
150
196
|
storageKey?: string;
|
|
151
197
|
children: React__default.ReactNode;
|
|
@@ -167,11 +213,11 @@ declare const ContextRail: {
|
|
|
167
213
|
displayName: string;
|
|
168
214
|
} & {
|
|
169
215
|
Header: {
|
|
170
|
-
({ eyebrow, title }: ContextRailHeaderProps): react_jsx_runtime.JSX.Element;
|
|
216
|
+
({ eyebrow, title }: ContextRailHeaderProps): react_jsx_runtime.JSX.Element | null;
|
|
171
217
|
displayName: string;
|
|
172
218
|
};
|
|
173
219
|
Section: {
|
|
174
|
-
({ id, icon, label, defaultOpen, action, children, }: ContextRailSectionProps): react_jsx_runtime.JSX.Element;
|
|
220
|
+
({ id, icon, label, defaultOpen, action, children, }: ContextRailSectionProps): react_jsx_runtime.JSX.Element | null;
|
|
175
221
|
displayName: string;
|
|
176
222
|
};
|
|
177
223
|
Footer: {
|
|
@@ -180,6 +226,11 @@ declare const ContextRail: {
|
|
|
180
226
|
}): react_jsx_runtime.JSX.Element;
|
|
181
227
|
displayName: string;
|
|
182
228
|
};
|
|
229
|
+
Avatar: typeof ContextRailAvatar;
|
|
230
|
+
Divider: typeof ContextRailDivider;
|
|
231
|
+
IconButton: typeof ContextRailIconButton;
|
|
232
|
+
StatusIcon: typeof ContextRailStatusIcon;
|
|
233
|
+
ValueTile: typeof ContextRailValueTile;
|
|
183
234
|
};
|
|
184
235
|
|
|
185
236
|
interface ActionCellAction {
|
package/dist/components/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Collapsible, Skeleton, Separator, Checkbox as Checkbox$1 } from '../chunk-TXGJ7BNX.js';
|
|
2
2
|
import { formatRelativeDateTime, StatusBadge } from '../chunk-ETY43HAI.js';
|
|
3
|
-
import { MenuItem, MenuRoot, MenuTrigger, MenuContent,
|
|
3
|
+
import { Tooltip, MenuItem, MenuRoot, MenuTrigger, MenuContent, Badge, Avatar, Table } from '../chunk-2ZWZ2WAS.js';
|
|
4
4
|
import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Switch } from '../chunk-WQIEF5N3.js';
|
|
5
5
|
import { text_input_default } from '../chunk-OU6H3KU4.js';
|
|
6
6
|
import { Button, IconButton } from '../chunk-JS7ZEZV3.js';
|
|
7
7
|
export { AuthCard, PageHeader } from '../chunk-L7SKAZX3.js';
|
|
8
|
-
import { Box, Flex,
|
|
8
|
+
import { Box, Flex, Text, Heading, HStack, Grid, GridItem, Code, VStack, Link, Spacer, Stack } from '../chunk-G4QMIXLC.js';
|
|
9
9
|
import { PanelRightOpen, PanelRightClose, ChevronRight, PanelLeftOpen, PanelLeftClose, Search, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { createContext as createContext$1, Timeline, TreeView, chakra, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe } from '@chakra-ui/react';
|
|
12
12
|
export { createTreeCollection } from '@chakra-ui/react';
|
|
13
|
-
import
|
|
13
|
+
import React5, { createContext, useState, useEffect, useCallback, useMemo, useContext, useRef, Children } from 'react';
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
15
|
import { Link as Link$1 } from 'react-router-dom';
|
|
16
16
|
import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
@@ -135,7 +135,7 @@ var CardList = ({
|
|
|
135
135
|
emptyState
|
|
136
136
|
}) => {
|
|
137
137
|
const colSpan = Math.floor(columnCount / headers.length);
|
|
138
|
-
const
|
|
138
|
+
const isEmpty2 = Children.count(children) === 0;
|
|
139
139
|
return /* @__PURE__ */ jsxs(Box, { role: "grid", "aria-colcount": headers.length, children: [
|
|
140
140
|
/* @__PURE__ */ jsxs(Flex, { pb: 2, px: hasComponentLeft ? 0 : 6, children: [
|
|
141
141
|
hasComponentLeft && /* @__PURE__ */ jsx(Box, { minWidth: 75, px: 6 }),
|
|
@@ -153,7 +153,7 @@ var CardList = ({
|
|
|
153
153
|
),
|
|
154
154
|
hasMenu && /* @__PURE__ */ jsx(Box, { minWidth: "80px", px: 6 })
|
|
155
155
|
] }),
|
|
156
|
-
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "3", children:
|
|
156
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "3", children: isEmpty2 && emptyState ? emptyState : children })
|
|
157
157
|
] });
|
|
158
158
|
};
|
|
159
159
|
CardList.displayName = "CardList";
|
|
@@ -390,6 +390,236 @@ function ChipPickerInner(props) {
|
|
|
390
390
|
}
|
|
391
391
|
var ChipPicker = ChipPickerInner;
|
|
392
392
|
ChipPicker.displayName = "ChipPicker";
|
|
393
|
+
var RailModeContext = createContext({
|
|
394
|
+
collapsed: false
|
|
395
|
+
});
|
|
396
|
+
function useContextRailMode() {
|
|
397
|
+
return useContext(RailModeContext);
|
|
398
|
+
}
|
|
399
|
+
var RAIL_ATOM = /* @__PURE__ */ Symbol.for("anker.contextRail.atom");
|
|
400
|
+
function isRailAtom(child) {
|
|
401
|
+
if (!React5.isValidElement(child)) return false;
|
|
402
|
+
const type = child.type;
|
|
403
|
+
if (typeof type !== "function") return false;
|
|
404
|
+
return type.railAtom === RAIL_ATOM;
|
|
405
|
+
}
|
|
406
|
+
function buttonVariantFromTone(tone) {
|
|
407
|
+
switch (tone) {
|
|
408
|
+
case "primary":
|
|
409
|
+
return { variant: "solid", colorPalette: "primary" };
|
|
410
|
+
case "outline-red":
|
|
411
|
+
return { variant: "outline", colorPalette: "red" };
|
|
412
|
+
case "outline-primary":
|
|
413
|
+
return { variant: "outline", colorPalette: "primary" };
|
|
414
|
+
case "ghost":
|
|
415
|
+
return { variant: "ghost" };
|
|
416
|
+
default:
|
|
417
|
+
return { variant: "outline" };
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function ContextRailIconButton({
|
|
421
|
+
label,
|
|
422
|
+
icon,
|
|
423
|
+
onClick,
|
|
424
|
+
tone = "default"
|
|
425
|
+
}) {
|
|
426
|
+
const { collapsed } = useContextRailMode();
|
|
427
|
+
const { variant, colorPalette } = buttonVariantFromTone(tone);
|
|
428
|
+
if (collapsed) {
|
|
429
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "left" }, children: /* @__PURE__ */ jsx(
|
|
430
|
+
IconButton,
|
|
431
|
+
{
|
|
432
|
+
variant,
|
|
433
|
+
colorPalette,
|
|
434
|
+
size: "sm",
|
|
435
|
+
"aria-label": label,
|
|
436
|
+
onClick,
|
|
437
|
+
children: icon
|
|
438
|
+
}
|
|
439
|
+
) });
|
|
440
|
+
}
|
|
441
|
+
return /* @__PURE__ */ jsxs(
|
|
442
|
+
Button,
|
|
443
|
+
{
|
|
444
|
+
variant,
|
|
445
|
+
colorPalette,
|
|
446
|
+
size: "sm",
|
|
447
|
+
w: "full",
|
|
448
|
+
onClick,
|
|
449
|
+
children: [
|
|
450
|
+
icon,
|
|
451
|
+
label
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
ContextRailIconButton.displayName = "ContextRail.IconButton";
|
|
457
|
+
ContextRailIconButton.railAtom = RAIL_ATOM;
|
|
458
|
+
function isEmpty(value) {
|
|
459
|
+
if (value === 0) return true;
|
|
460
|
+
if (value === "0" || value === "") return true;
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
function ContextRailValueTile({
|
|
464
|
+
value,
|
|
465
|
+
label,
|
|
466
|
+
muted,
|
|
467
|
+
keepWhenEmpty
|
|
468
|
+
}) {
|
|
469
|
+
const { collapsed } = useContextRailMode();
|
|
470
|
+
const hideWhenEmpty = collapsed && isEmpty(value) && !keepWhenEmpty;
|
|
471
|
+
if (hideWhenEmpty) return null;
|
|
472
|
+
if (collapsed) {
|
|
473
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "left" }, children: /* @__PURE__ */ jsx(
|
|
474
|
+
Box,
|
|
475
|
+
{
|
|
476
|
+
w: "8",
|
|
477
|
+
h: "8",
|
|
478
|
+
borderRadius: "md",
|
|
479
|
+
bg: "bg-subtle",
|
|
480
|
+
borderWidth: "1px",
|
|
481
|
+
borderColor: "border",
|
|
482
|
+
display: "flex",
|
|
483
|
+
alignItems: "center",
|
|
484
|
+
justifyContent: "center",
|
|
485
|
+
fontSize: "xs",
|
|
486
|
+
fontWeight: "bold",
|
|
487
|
+
color: muted ? "muted" : "default",
|
|
488
|
+
"aria-label": `${label}: ${value}`,
|
|
489
|
+
children: value
|
|
490
|
+
}
|
|
491
|
+
) });
|
|
492
|
+
}
|
|
493
|
+
return /* @__PURE__ */ jsxs(Box, { bg: "bg-subtle", borderRadius: "md", p: "2", minW: "0", flex: "1", children: [
|
|
494
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "xs", color: "muted", mb: "1", children: label }),
|
|
495
|
+
/* @__PURE__ */ jsx(
|
|
496
|
+
Text,
|
|
497
|
+
{
|
|
498
|
+
fontSize: "lg",
|
|
499
|
+
fontWeight: "semibold",
|
|
500
|
+
color: muted ? "muted" : "default",
|
|
501
|
+
children: value
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
] });
|
|
505
|
+
}
|
|
506
|
+
ContextRailValueTile.displayName = "ContextRail.ValueTile";
|
|
507
|
+
ContextRailValueTile.railAtom = RAIL_ATOM;
|
|
508
|
+
var STATUS_TINTS = {
|
|
509
|
+
green: { bg: "green.50", color: "green.700" },
|
|
510
|
+
amber: { bg: "yellow.50", color: "yellow.700" },
|
|
511
|
+
red: { bg: "red.50", color: "red.700" },
|
|
512
|
+
gray: { bg: "gray.100", color: "gray.700" }
|
|
513
|
+
};
|
|
514
|
+
function ContextRailStatusIcon({
|
|
515
|
+
icon,
|
|
516
|
+
label,
|
|
517
|
+
tone
|
|
518
|
+
}) {
|
|
519
|
+
const { collapsed } = useContextRailMode();
|
|
520
|
+
const tint = STATUS_TINTS[tone];
|
|
521
|
+
if (collapsed) {
|
|
522
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "left" }, children: /* @__PURE__ */ jsx(
|
|
523
|
+
Flex,
|
|
524
|
+
{
|
|
525
|
+
w: "8",
|
|
526
|
+
h: "8",
|
|
527
|
+
borderRadius: "full",
|
|
528
|
+
bg: tint.bg,
|
|
529
|
+
color: tint.color,
|
|
530
|
+
align: "center",
|
|
531
|
+
justify: "center",
|
|
532
|
+
"aria-label": label,
|
|
533
|
+
children: icon
|
|
534
|
+
}
|
|
535
|
+
) });
|
|
536
|
+
}
|
|
537
|
+
return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", py: "1", children: [
|
|
538
|
+
/* @__PURE__ */ jsx(
|
|
539
|
+
Flex,
|
|
540
|
+
{
|
|
541
|
+
w: "6",
|
|
542
|
+
h: "6",
|
|
543
|
+
borderRadius: "full",
|
|
544
|
+
bg: tint.bg,
|
|
545
|
+
color: tint.color,
|
|
546
|
+
align: "center",
|
|
547
|
+
justify: "center",
|
|
548
|
+
flexShrink: 0,
|
|
549
|
+
children: icon
|
|
550
|
+
}
|
|
551
|
+
),
|
|
552
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "xs", color: "muted", children: label })
|
|
553
|
+
] });
|
|
554
|
+
}
|
|
555
|
+
ContextRailStatusIcon.displayName = "ContextRail.StatusIcon";
|
|
556
|
+
ContextRailStatusIcon.railAtom = RAIL_ATOM;
|
|
557
|
+
function ContextRailAvatar({
|
|
558
|
+
initials,
|
|
559
|
+
label,
|
|
560
|
+
src,
|
|
561
|
+
onClick
|
|
562
|
+
}) {
|
|
563
|
+
const { collapsed } = useContextRailMode();
|
|
564
|
+
const avatarBox = /* @__PURE__ */ jsx(
|
|
565
|
+
Flex,
|
|
566
|
+
{
|
|
567
|
+
w: collapsed ? "8" : "10",
|
|
568
|
+
h: collapsed ? "8" : "10",
|
|
569
|
+
borderRadius: "full",
|
|
570
|
+
bg: "bg-emphasis",
|
|
571
|
+
color: "white",
|
|
572
|
+
align: "center",
|
|
573
|
+
justify: "center",
|
|
574
|
+
fontWeight: "bold",
|
|
575
|
+
fontSize: collapsed ? "xs" : "sm",
|
|
576
|
+
flexShrink: 0,
|
|
577
|
+
cursor: onClick ? "pointer" : "default",
|
|
578
|
+
onClick,
|
|
579
|
+
backgroundImage: src ? `url(${src})` : void 0,
|
|
580
|
+
backgroundSize: "cover",
|
|
581
|
+
backgroundPosition: "center",
|
|
582
|
+
"aria-label": label,
|
|
583
|
+
children: !src && initials
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
if (collapsed) {
|
|
587
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "left" }, children: avatarBox });
|
|
588
|
+
}
|
|
589
|
+
return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "3", py: "1", children: [
|
|
590
|
+
avatarBox,
|
|
591
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "xs", color: "muted", truncate: true, children: label })
|
|
592
|
+
] });
|
|
593
|
+
}
|
|
594
|
+
ContextRailAvatar.displayName = "ContextRail.Avatar";
|
|
595
|
+
ContextRailAvatar.railAtom = RAIL_ATOM;
|
|
596
|
+
function ContextRailDivider() {
|
|
597
|
+
const { collapsed } = useContextRailMode();
|
|
598
|
+
if (collapsed) {
|
|
599
|
+
return /* @__PURE__ */ jsx(
|
|
600
|
+
Box,
|
|
601
|
+
{
|
|
602
|
+
"data-testid": "context-rail-divider",
|
|
603
|
+
w: "5",
|
|
604
|
+
h: "1px",
|
|
605
|
+
bg: "border",
|
|
606
|
+
my: "1"
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
return /* @__PURE__ */ jsx(
|
|
611
|
+
Box,
|
|
612
|
+
{
|
|
613
|
+
"data-testid": "context-rail-divider",
|
|
614
|
+
w: "full",
|
|
615
|
+
h: "1px",
|
|
616
|
+
bg: "border",
|
|
617
|
+
my: "3"
|
|
618
|
+
}
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
ContextRailDivider.displayName = "ContextRail.Divider";
|
|
622
|
+
ContextRailDivider.railAtom = RAIL_ATOM;
|
|
393
623
|
var COLLAPSED_WIDTH = "44px";
|
|
394
624
|
var EXPANDED_WIDTH = "360px";
|
|
395
625
|
var COLLAPSE_BREAKPOINT = 1440;
|
|
@@ -428,7 +658,7 @@ var ContextRailRoot = ({ storageKey, children }) => {
|
|
|
428
658
|
window.localStorage.setItem(storageKey, String(collapsed));
|
|
429
659
|
}
|
|
430
660
|
}, [collapsed, storageKey]);
|
|
431
|
-
return /* @__PURE__ */ jsx(RailRootContext.Provider, { value: true, children: /* @__PURE__ */ jsxs(
|
|
661
|
+
return /* @__PURE__ */ jsx(RailRootContext.Provider, { value: true, children: /* @__PURE__ */ jsx(RailModeContext.Provider, { value: { collapsed }, children: /* @__PURE__ */ jsxs(
|
|
432
662
|
Box,
|
|
433
663
|
{
|
|
434
664
|
"data-testid": "context-rail",
|
|
@@ -461,14 +691,29 @@ var ContextRailRoot = ({ storageKey, children }) => {
|
|
|
461
691
|
children: collapsed ? /* @__PURE__ */ jsx(PanelRightOpen, { size: 14 }) : /* @__PURE__ */ jsx(PanelRightClose, { size: 14 })
|
|
462
692
|
}
|
|
463
693
|
),
|
|
464
|
-
collapsed ?
|
|
694
|
+
collapsed ? /* @__PURE__ */ jsx(
|
|
695
|
+
Flex,
|
|
696
|
+
{
|
|
697
|
+
"data-testid": "context-rail-collapsed-body",
|
|
698
|
+
direction: "column",
|
|
699
|
+
align: "center",
|
|
700
|
+
gap: "2",
|
|
701
|
+
pt: "14",
|
|
702
|
+
pb: "3",
|
|
703
|
+
h: "full",
|
|
704
|
+
overflowY: "auto",
|
|
705
|
+
children
|
|
706
|
+
}
|
|
707
|
+
) : /* @__PURE__ */ jsx(Box, { h: "full", overflowY: "auto", px: "4", pt: "4", pb: "4", children })
|
|
465
708
|
]
|
|
466
709
|
}
|
|
467
|
-
) });
|
|
710
|
+
) }) });
|
|
468
711
|
};
|
|
469
712
|
ContextRailRoot.displayName = "ContextRail";
|
|
470
713
|
var ContextRailHeader = ({ eyebrow, title }) => {
|
|
471
714
|
useWarnIfOutsideRailRoot("ContextRail.Header");
|
|
715
|
+
const { collapsed } = useContextRailMode();
|
|
716
|
+
if (collapsed) return null;
|
|
472
717
|
return /* @__PURE__ */ jsxs(Box, { mb: "4", pb: "3", borderBottomWidth: "1px", borderBottomColor: "border", children: [
|
|
473
718
|
eyebrow && /* @__PURE__ */ jsx(
|
|
474
719
|
Text,
|
|
@@ -505,7 +750,13 @@ var ContextRailSection = ({
|
|
|
505
750
|
children
|
|
506
751
|
}) => {
|
|
507
752
|
useWarnIfOutsideRailRoot("ContextRail.Section");
|
|
753
|
+
const { collapsed } = useContextRailMode();
|
|
508
754
|
const [open, setOpen] = useState(defaultOpen);
|
|
755
|
+
if (collapsed) {
|
|
756
|
+
const atomChildren = React5.Children.toArray(children).filter(isRailAtom);
|
|
757
|
+
if (atomChildren.length === 0) return null;
|
|
758
|
+
return /* @__PURE__ */ jsx(Fragment, { children: atomChildren });
|
|
759
|
+
}
|
|
509
760
|
return /* @__PURE__ */ jsxs(
|
|
510
761
|
Box,
|
|
511
762
|
{
|
|
@@ -568,12 +819,30 @@ var ContextRailSection = ({
|
|
|
568
819
|
);
|
|
569
820
|
};
|
|
570
821
|
ContextRailSection.displayName = "ContextRail.Section";
|
|
571
|
-
var ContextRailFooter = ({ children }) =>
|
|
822
|
+
var ContextRailFooter = ({ children }) => {
|
|
823
|
+
const { collapsed } = useContextRailMode();
|
|
824
|
+
return /* @__PURE__ */ jsx(
|
|
825
|
+
Box,
|
|
826
|
+
{
|
|
827
|
+
mt: collapsed ? "auto" : "4",
|
|
828
|
+
pt: collapsed ? "3" : "4",
|
|
829
|
+
borderTopWidth: "1px",
|
|
830
|
+
borderTopColor: "border-muted",
|
|
831
|
+
w: "full",
|
|
832
|
+
children
|
|
833
|
+
}
|
|
834
|
+
);
|
|
835
|
+
};
|
|
572
836
|
ContextRailFooter.displayName = "ContextRail.Footer";
|
|
573
837
|
var ContextRail = Object.assign(ContextRailRoot, {
|
|
574
838
|
Header: ContextRailHeader,
|
|
575
839
|
Section: ContextRailSection,
|
|
576
|
-
Footer: ContextRailFooter
|
|
840
|
+
Footer: ContextRailFooter,
|
|
841
|
+
Avatar: ContextRailAvatar,
|
|
842
|
+
Divider: ContextRailDivider,
|
|
843
|
+
IconButton: ContextRailIconButton,
|
|
844
|
+
StatusIcon: ContextRailStatusIcon,
|
|
845
|
+
ValueTile: ContextRailValueTile
|
|
577
846
|
});
|
|
578
847
|
var ActionCell = ({ actions }) => {
|
|
579
848
|
return /* @__PURE__ */ jsx(HStack, { gap: 1, children: actions.map((action) => /* @__PURE__ */ jsx(Tooltip, { content: action.label, children: action.href ? /* @__PURE__ */ jsx(
|
|
@@ -1086,7 +1355,7 @@ function DataTableInner(props) {
|
|
|
1086
1355
|
...getRowId !== void 0 ? { getRowId } : {}
|
|
1087
1356
|
});
|
|
1088
1357
|
const hasPagination = total !== void 0 && page !== void 0 && pageSize !== void 0 && onPageChange !== void 0;
|
|
1089
|
-
const
|
|
1358
|
+
const isEmpty2 = !loading && data.length === 0;
|
|
1090
1359
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 4, children: [
|
|
1091
1360
|
/* @__PURE__ */ jsx(Box, { overflowX: "auto", children: /* @__PURE__ */ jsxs(Table.Root, { variant, children: [
|
|
1092
1361
|
/* @__PURE__ */ jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(Table.Row, { children: headerGroup.headers.map((header) => {
|
|
@@ -1152,7 +1421,7 @@ function DataTableInner(props) {
|
|
|
1152
1421
|
},
|
|
1153
1422
|
row.id
|
|
1154
1423
|
)),
|
|
1155
|
-
|
|
1424
|
+
isEmpty2 && /* @__PURE__ */ jsx(Table.Row, { children: /* @__PURE__ */ jsx(
|
|
1156
1425
|
Table.Cell,
|
|
1157
1426
|
{
|
|
1158
1427
|
colSpan: allColumns.length,
|
|
@@ -1314,7 +1583,7 @@ var FactBox = (props) => {
|
|
|
1314
1583
|
expandLabel = "Expand",
|
|
1315
1584
|
...rest
|
|
1316
1585
|
} = props;
|
|
1317
|
-
const [show, setShow] =
|
|
1586
|
+
const [show, setShow] = React5.useState(true);
|
|
1318
1587
|
const handleToggle = () => {
|
|
1319
1588
|
setShow(!show);
|
|
1320
1589
|
};
|
|
@@ -1780,9 +2049,9 @@ SelectableCard.Footer = SelectableCardFooter;
|
|
|
1780
2049
|
var COLLAPSED_WIDTH2 = "64px";
|
|
1781
2050
|
var EXPANDED_WIDTH2 = "240px";
|
|
1782
2051
|
var COLLAPSE_BREAKPOINT2 = 1440;
|
|
1783
|
-
var SidebarContext =
|
|
2052
|
+
var SidebarContext = React5.createContext(null);
|
|
1784
2053
|
function useSidebarContext() {
|
|
1785
|
-
const ctx =
|
|
2054
|
+
const ctx = React5.useContext(SidebarContext);
|
|
1786
2055
|
if (!ctx) {
|
|
1787
2056
|
throw new Error("useSidebarContext must be used inside <Sidebar>");
|
|
1788
2057
|
}
|
|
@@ -1960,8 +2229,8 @@ var SidebarItem = ({
|
|
|
1960
2229
|
const tooltipLabel = label || (typeof children === "string" ? children : "");
|
|
1961
2230
|
const wrapTooltip = (node) => collapsed && tooltipLabel ? /* @__PURE__ */ jsx(Tooltip, { content: tooltipLabel, positioning: { placement: "right" }, children: node }) : node;
|
|
1962
2231
|
if (asChild) {
|
|
1963
|
-
const child =
|
|
1964
|
-
const cloned =
|
|
2232
|
+
const child = React5.Children.only(children);
|
|
2233
|
+
const cloned = React5.cloneElement(
|
|
1965
2234
|
child,
|
|
1966
2235
|
{
|
|
1967
2236
|
"data-active": active ? "true" : "false",
|
|
@@ -2049,8 +2318,8 @@ var SidebarUserMenuItem = ({
|
|
|
2049
2318
|
children
|
|
2050
2319
|
}) => {
|
|
2051
2320
|
if (asChild) {
|
|
2052
|
-
const child =
|
|
2053
|
-
return /* @__PURE__ */ jsx(MenuItem, { value: "link", onClick, children:
|
|
2321
|
+
const child = React5.Children.only(children);
|
|
2322
|
+
return /* @__PURE__ */ jsx(MenuItem, { value: "link", onClick, children: React5.cloneElement(child, {}) });
|
|
2054
2323
|
}
|
|
2055
2324
|
return /* @__PURE__ */ jsx(
|
|
2056
2325
|
MenuItem,
|
|
@@ -2100,7 +2369,7 @@ var SidebarSection2 = ({
|
|
|
2100
2369
|
} else {
|
|
2101
2370
|
content = children;
|
|
2102
2371
|
}
|
|
2103
|
-
const
|
|
2372
|
+
const isEmpty2 = content === null || content === void 0 || content === "" || content === false;
|
|
2104
2373
|
return /* @__PURE__ */ jsxs(Box, { py: 3, children: [
|
|
2105
2374
|
/* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", children: [
|
|
2106
2375
|
/* @__PURE__ */ jsx(
|
|
@@ -2125,7 +2394,7 @@ var SidebarSection2 = ({
|
|
|
2125
2394
|
}
|
|
2126
2395
|
)
|
|
2127
2396
|
] }),
|
|
2128
|
-
/* @__PURE__ */ jsx(Box, { py: 2, children:
|
|
2397
|
+
/* @__PURE__ */ jsx(Box, { py: 2, children: isEmpty2 && emptyText ? /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: "fg.subtle", children: emptyText }) : content })
|
|
2129
2398
|
] });
|
|
2130
2399
|
};
|
|
2131
2400
|
SidebarSection2.displayName = "SidebarSection";
|
|
@@ -2135,16 +2404,16 @@ var [StepperProvider, useStepperContext] = createContext$1({
|
|
|
2135
2404
|
});
|
|
2136
2405
|
function useStepper(props) {
|
|
2137
2406
|
const { step, onChange } = props;
|
|
2138
|
-
const [activeIndex, setIndex] =
|
|
2139
|
-
const stepsRef =
|
|
2140
|
-
const registerStep =
|
|
2407
|
+
const [activeIndex, setIndex] = React5.useState(-1);
|
|
2408
|
+
const stepsRef = React5.useRef([]);
|
|
2409
|
+
const registerStep = React5.useCallback((name) => {
|
|
2141
2410
|
const newSteps = [...stepsRef.current];
|
|
2142
2411
|
if (newSteps.indexOf(name) === -1) {
|
|
2143
2412
|
newSteps.push(name);
|
|
2144
2413
|
}
|
|
2145
2414
|
stepsRef.current = newSteps;
|
|
2146
2415
|
}, []);
|
|
2147
|
-
const unregisterStep =
|
|
2416
|
+
const unregisterStep = React5.useCallback((name) => {
|
|
2148
2417
|
stepsRef.current = stepsRef.current.filter((step2) => step2 !== name);
|
|
2149
2418
|
}, []);
|
|
2150
2419
|
const setStep = useCallback((name) => {
|
|
@@ -2159,7 +2428,7 @@ function useStepper(props) {
|
|
|
2159
2428
|
const prevStep = () => {
|
|
2160
2429
|
setIndex(activeIndex - 1);
|
|
2161
2430
|
};
|
|
2162
|
-
|
|
2431
|
+
React5.useEffect(() => {
|
|
2163
2432
|
if (typeof step === "string") {
|
|
2164
2433
|
setStep(step);
|
|
2165
2434
|
} else if (typeof step === "number") {
|
|
@@ -2168,7 +2437,7 @@ function useStepper(props) {
|
|
|
2168
2437
|
setIndex(0);
|
|
2169
2438
|
}
|
|
2170
2439
|
}, [step, activeIndex, setStep]);
|
|
2171
|
-
|
|
2440
|
+
React5.useEffect(() => {
|
|
2172
2441
|
onChange?.(activeIndex);
|
|
2173
2442
|
}, [activeIndex, onChange]);
|
|
2174
2443
|
const context = {
|
|
@@ -2190,7 +2459,7 @@ function useStepper(props) {
|
|
|
2190
2459
|
function useStep(props) {
|
|
2191
2460
|
const { name, isActive, isCompleted } = props;
|
|
2192
2461
|
const { registerStep, unregisterStep, activeStep } = useStepperContext();
|
|
2193
|
-
|
|
2462
|
+
React5.useEffect(() => {
|
|
2194
2463
|
if (!name) {
|
|
2195
2464
|
return;
|
|
2196
2465
|
}
|
|
@@ -2224,12 +2493,12 @@ function useStepperNextButton({
|
|
|
2224
2493
|
};
|
|
2225
2494
|
}
|
|
2226
2495
|
function getChildOfType(children, type) {
|
|
2227
|
-
return
|
|
2496
|
+
return React5.Children.toArray(children).find(
|
|
2228
2497
|
(item) => item.type === type
|
|
2229
2498
|
);
|
|
2230
2499
|
}
|
|
2231
2500
|
function getChildrenOfType(children, type) {
|
|
2232
|
-
return
|
|
2501
|
+
return React5.Children.toArray(children).filter(
|
|
2233
2502
|
(item) => Array.isArray(type) ? type.some((component) => component === item.type) : item.type === type
|
|
2234
2503
|
);
|
|
2235
2504
|
}
|