@ship-it-ui/ui 0.0.3 → 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/dist/index.cjs +1156 -612
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +288 -26
- package/dist/index.d.ts +288 -26
- package/dist/index.js +1039 -502
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
// src/index.ts
|
|
33
33
|
var index_exports = {};
|
|
34
34
|
__export(index_exports, {
|
|
35
|
+
ActivityTimeline: () => ActivityTimeline,
|
|
35
36
|
Alert: () => Alert,
|
|
36
37
|
AlertDialog: () => AlertDialog,
|
|
37
38
|
AlertDialogAction: () => AlertDialogAction,
|
|
@@ -84,6 +85,8 @@ __export(index_exports, {
|
|
|
84
85
|
FAB: () => FAB,
|
|
85
86
|
Field: () => Field,
|
|
86
87
|
FileChip: () => FileChip,
|
|
88
|
+
FilterPanel: () => FilterPanel,
|
|
89
|
+
HealthScore: () => HealthScore,
|
|
87
90
|
HoverCard: () => HoverCard,
|
|
88
91
|
HoverCardContent: () => HoverCardContent,
|
|
89
92
|
HoverCardPortal: () => HoverCardPortal,
|
|
@@ -105,6 +108,7 @@ __export(index_exports, {
|
|
|
105
108
|
NavItem: () => NavItem,
|
|
106
109
|
NavSection: () => NavSection,
|
|
107
110
|
OTP: () => OTP,
|
|
111
|
+
OnboardingChecklist: () => OnboardingChecklist,
|
|
108
112
|
Pagination: () => Pagination,
|
|
109
113
|
Popover: () => Popover,
|
|
110
114
|
PopoverAnchor: () => PopoverAnchor,
|
|
@@ -118,6 +122,7 @@ __export(index_exports, {
|
|
|
118
122
|
RadialProgress: () => RadialProgress,
|
|
119
123
|
Radio: () => Radio,
|
|
120
124
|
RadioGroup: () => RadioGroup,
|
|
125
|
+
ScrollArea: () => ScrollArea,
|
|
121
126
|
SearchInput: () => SearchInput,
|
|
122
127
|
Select: () => Select,
|
|
123
128
|
SelectContent: () => SelectContent,
|
|
@@ -158,11 +163,13 @@ __export(index_exports, {
|
|
|
158
163
|
TooltipTrigger: () => TooltipTrigger,
|
|
159
164
|
Topbar: () => Topbar,
|
|
160
165
|
Tree: () => Tree,
|
|
166
|
+
WizardDialog: () => WizardDialog,
|
|
161
167
|
badgeStyles: () => badgeStyles,
|
|
162
168
|
buttonStyles: () => buttonStyles,
|
|
163
169
|
cardStyles: () => cardStyles,
|
|
164
170
|
cn: () => cn,
|
|
165
171
|
filterCommandItems: () => filterCommandItems,
|
|
172
|
+
formatRelative: () => formatRelative,
|
|
166
173
|
iconButtonStyles: () => iconButtonStyles,
|
|
167
174
|
useControllableState: () => useControllableState,
|
|
168
175
|
useDisclosure: () => useDisclosure,
|
|
@@ -1573,10 +1580,71 @@ var Kbd = (0, import_react30.forwardRef)(function Kbd2({ className, children, ..
|
|
|
1573
1580
|
});
|
|
1574
1581
|
Kbd.displayName = "Kbd";
|
|
1575
1582
|
|
|
1576
|
-
// src/components/
|
|
1577
|
-
var
|
|
1583
|
+
// src/components/ScrollArea/ScrollArea.tsx
|
|
1584
|
+
var RadixScrollArea = __toESM(require("@radix-ui/react-scroll-area"), 1);
|
|
1578
1585
|
var import_react31 = require("react");
|
|
1579
1586
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1587
|
+
var scrollbarBase = "flex touch-none select-none p-[2px] transition-colors duration-(--duration-micro)";
|
|
1588
|
+
var thumbBase = 'relative flex-1 rounded-full bg-text-muted/40 hover:bg-text-muted/60 before:absolute before:inset-1/2 before:size-full before:min-h-[44px] before:min-w-[44px] before:-translate-x-1/2 before:-translate-y-1/2 before:content-[""]';
|
|
1589
|
+
var ScrollArea = (0, import_react31.forwardRef)(function ScrollArea2({
|
|
1590
|
+
type = "hover",
|
|
1591
|
+
orientation = "vertical",
|
|
1592
|
+
scrollHideDelay = 600,
|
|
1593
|
+
className,
|
|
1594
|
+
viewportClassName,
|
|
1595
|
+
viewportRef,
|
|
1596
|
+
children,
|
|
1597
|
+
...props
|
|
1598
|
+
}, ref) {
|
|
1599
|
+
const showVertical = orientation === "vertical" || orientation === "both";
|
|
1600
|
+
const showHorizontal = orientation === "horizontal" || orientation === "both";
|
|
1601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1602
|
+
RadixScrollArea.Root,
|
|
1603
|
+
{
|
|
1604
|
+
ref,
|
|
1605
|
+
type,
|
|
1606
|
+
scrollHideDelay,
|
|
1607
|
+
className: cn("relative overflow-hidden", className),
|
|
1608
|
+
...props,
|
|
1609
|
+
children: [
|
|
1610
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1611
|
+
RadixScrollArea.Viewport,
|
|
1612
|
+
{
|
|
1613
|
+
ref: viewportRef,
|
|
1614
|
+
className: cn("h-full w-full rounded-[inherit]", viewportClassName),
|
|
1615
|
+
children
|
|
1616
|
+
}
|
|
1617
|
+
),
|
|
1618
|
+
showVertical && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1619
|
+
RadixScrollArea.Scrollbar,
|
|
1620
|
+
{
|
|
1621
|
+
orientation: "vertical",
|
|
1622
|
+
className: cn(scrollbarBase, "bg-panel-2/40 hover:bg-panel-2/80 h-full w-[10px]"),
|
|
1623
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RadixScrollArea.Thumb, { className: thumbBase })
|
|
1624
|
+
}
|
|
1625
|
+
),
|
|
1626
|
+
showHorizontal && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1627
|
+
RadixScrollArea.Scrollbar,
|
|
1628
|
+
{
|
|
1629
|
+
orientation: "horizontal",
|
|
1630
|
+
className: cn(
|
|
1631
|
+
scrollbarBase,
|
|
1632
|
+
"bg-panel-2/40 hover:bg-panel-2/80 h-[10px] w-full flex-col"
|
|
1633
|
+
),
|
|
1634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RadixScrollArea.Thumb, { className: thumbBase })
|
|
1635
|
+
}
|
|
1636
|
+
),
|
|
1637
|
+
orientation === "both" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RadixScrollArea.Corner, { className: "bg-panel-2/60" })
|
|
1638
|
+
]
|
|
1639
|
+
}
|
|
1640
|
+
);
|
|
1641
|
+
});
|
|
1642
|
+
ScrollArea.displayName = "ScrollArea";
|
|
1643
|
+
|
|
1644
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
1645
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
1646
|
+
var import_react32 = require("react");
|
|
1647
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1580
1648
|
var skeletonStyles = (0, import_class_variance_authority7.cva)("block bg-panel-2 animate-[ship-skeleton_1.4s_infinite]", {
|
|
1581
1649
|
variants: {
|
|
1582
1650
|
shape: {
|
|
@@ -1588,11 +1656,11 @@ var skeletonStyles = (0, import_class_variance_authority7.cva)("block bg-panel-2
|
|
|
1588
1656
|
defaultVariants: { shape: "line" }
|
|
1589
1657
|
});
|
|
1590
1658
|
var defaultHeight = { line: 14, block: 80, circle: 40 };
|
|
1591
|
-
var Skeleton = (0,
|
|
1659
|
+
var Skeleton = (0, import_react32.forwardRef)(function Skeleton2({ shape = "line", width = "100%", height, standalone = false, className, style, ...props }, ref) {
|
|
1592
1660
|
const h = height ?? defaultHeight[shape];
|
|
1593
1661
|
const w = shape === "circle" ? h : width;
|
|
1594
1662
|
const a11yProps = standalone ? { role: "status", "aria-busy": true, "aria-label": "Loading" } : { "aria-hidden": true };
|
|
1595
|
-
return /* @__PURE__ */ (0,
|
|
1663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1596
1664
|
"div",
|
|
1597
1665
|
{
|
|
1598
1666
|
ref,
|
|
@@ -1604,11 +1672,11 @@ var Skeleton = (0, import_react31.forwardRef)(function Skeleton2({ shape = "line
|
|
|
1604
1672
|
);
|
|
1605
1673
|
});
|
|
1606
1674
|
Skeleton.displayName = "Skeleton";
|
|
1607
|
-
var SkeletonGroup = (0,
|
|
1675
|
+
var SkeletonGroup = (0, import_react32.forwardRef)(function SkeletonGroup2({ label = "Loading", loading = true, className, children, ...props }, ref) {
|
|
1608
1676
|
if (!loading) {
|
|
1609
|
-
return /* @__PURE__ */ (0,
|
|
1677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className, ...props, children });
|
|
1610
1678
|
}
|
|
1611
|
-
return /* @__PURE__ */ (0,
|
|
1679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1612
1680
|
"div",
|
|
1613
1681
|
{
|
|
1614
1682
|
ref,
|
|
@@ -1624,10 +1692,10 @@ var SkeletonGroup = (0, import_react31.forwardRef)(function SkeletonGroup2({ lab
|
|
|
1624
1692
|
SkeletonGroup.displayName = "SkeletonGroup";
|
|
1625
1693
|
|
|
1626
1694
|
// src/components/Tag/Tag.tsx
|
|
1627
|
-
var
|
|
1628
|
-
var
|
|
1629
|
-
var Tag = (0,
|
|
1630
|
-
return /* @__PURE__ */ (0,
|
|
1695
|
+
var import_react33 = require("react");
|
|
1696
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1697
|
+
var Tag = (0, import_react33.forwardRef)(function Tag2({ onRemove, icon, size = 22, className, children, ...props }, ref) {
|
|
1698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1631
1699
|
"span",
|
|
1632
1700
|
{
|
|
1633
1701
|
ref,
|
|
@@ -1639,9 +1707,9 @@ var Tag = (0, import_react32.forwardRef)(function Tag2({ onRemove, icon, size =
|
|
|
1639
1707
|
style: { height: size },
|
|
1640
1708
|
...props,
|
|
1641
1709
|
children: [
|
|
1642
|
-
icon && /* @__PURE__ */ (0,
|
|
1710
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-text-dim inline-flex", children: icon }),
|
|
1643
1711
|
children,
|
|
1644
|
-
onRemove && /* @__PURE__ */ (0,
|
|
1712
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1645
1713
|
"button",
|
|
1646
1714
|
{
|
|
1647
1715
|
type: "button",
|
|
@@ -1659,14 +1727,14 @@ Tag.displayName = "Tag";
|
|
|
1659
1727
|
|
|
1660
1728
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
1661
1729
|
var RadixContext = __toESM(require("@radix-ui/react-context-menu"), 1);
|
|
1662
|
-
var
|
|
1663
|
-
var
|
|
1730
|
+
var import_react34 = require("react");
|
|
1731
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1664
1732
|
var ContextMenuRoot = RadixContext.Root;
|
|
1665
1733
|
var ContextMenuTrigger = RadixContext.Trigger;
|
|
1666
1734
|
var ContextMenuPortal = RadixContext.Portal;
|
|
1667
|
-
var ContextMenuContent = (0,
|
|
1735
|
+
var ContextMenuContent = (0, import_react34.forwardRef)(
|
|
1668
1736
|
function ContextMenuContent2({ className, ...props }, ref) {
|
|
1669
|
-
return /* @__PURE__ */ (0,
|
|
1737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RadixContext.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1670
1738
|
RadixContext.Content,
|
|
1671
1739
|
{
|
|
1672
1740
|
ref,
|
|
@@ -1686,26 +1754,26 @@ var itemBase = cn(
|
|
|
1686
1754
|
"data-[highlighted]:bg-panel-2",
|
|
1687
1755
|
"data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed"
|
|
1688
1756
|
);
|
|
1689
|
-
var ContextMenuItem = (0,
|
|
1757
|
+
var ContextMenuItem = (0, import_react34.forwardRef)(
|
|
1690
1758
|
function ContextMenuItem2({ icon, trailing, destructive, className, children, ...props }, ref) {
|
|
1691
|
-
return /* @__PURE__ */ (0,
|
|
1759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1692
1760
|
RadixContext.Item,
|
|
1693
1761
|
{
|
|
1694
1762
|
ref,
|
|
1695
1763
|
className: cn(itemBase, destructive ? "text-err" : "text-text", className),
|
|
1696
1764
|
...props,
|
|
1697
1765
|
children: [
|
|
1698
|
-
icon && /* @__PURE__ */ (0,
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
1700
|
-
trailing && /* @__PURE__ */ (0,
|
|
1766
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "w-[14px] text-[12px] opacity-70", children: icon }),
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "flex-1", children }),
|
|
1768
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: trailing })
|
|
1701
1769
|
]
|
|
1702
1770
|
}
|
|
1703
1771
|
);
|
|
1704
1772
|
}
|
|
1705
1773
|
);
|
|
1706
1774
|
ContextMenuItem.displayName = "ContextMenuItem";
|
|
1707
|
-
var ContextMenuSeparator = (0,
|
|
1708
|
-
return /* @__PURE__ */ (0,
|
|
1775
|
+
var ContextMenuSeparator = (0, import_react34.forwardRef)(function ContextMenuSeparator2({ className, ...props }, ref) {
|
|
1776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1709
1777
|
RadixContext.Separator,
|
|
1710
1778
|
{
|
|
1711
1779
|
ref,
|
|
@@ -1719,15 +1787,15 @@ var ContextMenu = RadixContext.Root;
|
|
|
1719
1787
|
|
|
1720
1788
|
// src/components/Dialog/Dialog.tsx
|
|
1721
1789
|
var RadixDialog = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1722
|
-
var
|
|
1723
|
-
var
|
|
1790
|
+
var import_react35 = require("react");
|
|
1791
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1724
1792
|
var DialogRoot = RadixDialog.Root;
|
|
1725
1793
|
var DialogTrigger = RadixDialog.Trigger;
|
|
1726
1794
|
var DialogClose = RadixDialog.Close;
|
|
1727
1795
|
var DialogPortal = RadixDialog.Portal;
|
|
1728
|
-
var DialogOverlay = (0,
|
|
1796
|
+
var DialogOverlay = (0, import_react35.forwardRef)(
|
|
1729
1797
|
function DialogOverlay2({ className, ...props }, ref) {
|
|
1730
|
-
return /* @__PURE__ */ (0,
|
|
1798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1731
1799
|
RadixDialog.Overlay,
|
|
1732
1800
|
{
|
|
1733
1801
|
ref,
|
|
@@ -1742,10 +1810,10 @@ var DialogOverlay = (0, import_react34.forwardRef)(
|
|
|
1742
1810
|
}
|
|
1743
1811
|
);
|
|
1744
1812
|
DialogOverlay.displayName = "DialogOverlay";
|
|
1745
|
-
var DialogContent = (0,
|
|
1746
|
-
return /* @__PURE__ */ (0,
|
|
1747
|
-
/* @__PURE__ */ (0,
|
|
1748
|
-
/* @__PURE__ */ (0,
|
|
1813
|
+
var DialogContent = (0, import_react35.forwardRef)(function DialogContent2({ className, width = 460, style, children, ...props }, ref) {
|
|
1814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DialogPortal, { children: [
|
|
1815
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DialogOverlay, {}),
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1749
1817
|
RadixDialog.Content,
|
|
1750
1818
|
{
|
|
1751
1819
|
ref,
|
|
@@ -1765,31 +1833,31 @@ var DialogContent = (0, import_react34.forwardRef)(function DialogContent2({ cla
|
|
|
1765
1833
|
});
|
|
1766
1834
|
DialogContent.displayName = "DialogContent";
|
|
1767
1835
|
function Dialog({ title, description, footer, width, children, ...rootProps }) {
|
|
1768
|
-
return /* @__PURE__ */ (0,
|
|
1769
|
-
title && /* @__PURE__ */ (0,
|
|
1836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DialogRoot, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DialogContent, { width, children: [
|
|
1837
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1770
1838
|
RadixDialog.Title,
|
|
1771
1839
|
{
|
|
1772
1840
|
className: cn("text-[16px] font-medium", description ? "mb-[6px]" : "mb-4"),
|
|
1773
1841
|
children: title
|
|
1774
1842
|
}
|
|
1775
1843
|
),
|
|
1776
|
-
description && /* @__PURE__ */ (0,
|
|
1844
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RadixDialog.Description, { className: "text-text-muted mb-[18px] text-[13px] leading-[1.55]", children: description }),
|
|
1777
1845
|
children,
|
|
1778
|
-
footer && /* @__PURE__ */ (0,
|
|
1846
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mt-5 flex justify-end gap-2", children: footer })
|
|
1779
1847
|
] }) });
|
|
1780
1848
|
}
|
|
1781
1849
|
|
|
1782
1850
|
// src/components/Dialog/Drawer.tsx
|
|
1783
1851
|
var RadixDialog2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1784
|
-
var
|
|
1785
|
-
var
|
|
1852
|
+
var import_react36 = require("react");
|
|
1853
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1786
1854
|
var sideClasses = {
|
|
1787
1855
|
left: "left-0 border-r border-border-strong data-[state=open]:animate-[ship-slide-in-left_220ms_var(--easing-out)]",
|
|
1788
1856
|
right: "right-0 border-l border-border-strong data-[state=open]:animate-[ship-slide-in-right_220ms_var(--easing-out)]"
|
|
1789
1857
|
};
|
|
1790
|
-
var DrawerHeader = ({ title, onClose }) => /* @__PURE__ */ (0,
|
|
1791
|
-
/* @__PURE__ */ (0,
|
|
1792
|
-
/* @__PURE__ */ (0,
|
|
1858
|
+
var DrawerHeader = ({ title, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "border-border flex items-center justify-between border-b p-[16px] px-5", children: [
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RadixDialog2.Title, { className: "text-[14px] font-medium", children: title }),
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1793
1861
|
RadixDialog2.Close,
|
|
1794
1862
|
{
|
|
1795
1863
|
onClick: onClose,
|
|
@@ -1799,10 +1867,10 @@ var DrawerHeader = ({ title, onClose }) => /* @__PURE__ */ (0, import_jsx_runtim
|
|
|
1799
1867
|
}
|
|
1800
1868
|
)
|
|
1801
1869
|
] });
|
|
1802
|
-
var Drawer = (0,
|
|
1803
|
-
return /* @__PURE__ */ (0,
|
|
1804
|
-
/* @__PURE__ */ (0,
|
|
1805
|
-
/* @__PURE__ */ (0,
|
|
1870
|
+
var Drawer = (0, import_react36.forwardRef)(function Drawer2({ side = "right", title, width = 420, children, ...rootProps }, ref) {
|
|
1871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DialogRoot, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(DialogPortal, { children: [
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DialogOverlay, {}),
|
|
1873
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1806
1874
|
RadixDialog2.Content,
|
|
1807
1875
|
{
|
|
1808
1876
|
ref,
|
|
@@ -1813,8 +1881,8 @@ var Drawer = (0, import_react35.forwardRef)(function Drawer2({ side = "right", t
|
|
|
1813
1881
|
),
|
|
1814
1882
|
style: { width },
|
|
1815
1883
|
children: [
|
|
1816
|
-
title ? /* @__PURE__ */ (0,
|
|
1817
|
-
/* @__PURE__ */ (0,
|
|
1884
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DrawerHeader, { title }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RadixDialog2.Title, { className: "sr-only", children: "Drawer" }),
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex-1 overflow-auto p-5", children })
|
|
1818
1886
|
]
|
|
1819
1887
|
}
|
|
1820
1888
|
)
|
|
@@ -1824,12 +1892,12 @@ Drawer.displayName = "Drawer";
|
|
|
1824
1892
|
|
|
1825
1893
|
// src/components/Dialog/Sheet.tsx
|
|
1826
1894
|
var RadixDialog3 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1827
|
-
var
|
|
1828
|
-
var
|
|
1829
|
-
var Sheet = (0,
|
|
1830
|
-
return /* @__PURE__ */ (0,
|
|
1831
|
-
/* @__PURE__ */ (0,
|
|
1832
|
-
/* @__PURE__ */ (0,
|
|
1895
|
+
var import_react37 = require("react");
|
|
1896
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1897
|
+
var Sheet = (0, import_react37.forwardRef)(function Sheet2({ title, width = "min(640px, 90vw)", children, ...rootProps }, ref) {
|
|
1898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DialogRoot, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(DialogPortal, { children: [
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DialogOverlay, {}),
|
|
1900
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1833
1901
|
RadixDialog3.Content,
|
|
1834
1902
|
{
|
|
1835
1903
|
ref,
|
|
@@ -1841,7 +1909,7 @@ var Sheet = (0, import_react36.forwardRef)(function Sheet2({ title, width = "min
|
|
|
1841
1909
|
),
|
|
1842
1910
|
style: { width },
|
|
1843
1911
|
children: [
|
|
1844
|
-
title ? /* @__PURE__ */ (0,
|
|
1912
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RadixDialog3.Title, { className: "mb-1 text-[15px] font-medium", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RadixDialog3.Title, { className: "sr-only", children: "Sheet" }),
|
|
1845
1913
|
children
|
|
1846
1914
|
]
|
|
1847
1915
|
}
|
|
@@ -1852,15 +1920,15 @@ Sheet.displayName = "Sheet";
|
|
|
1852
1920
|
|
|
1853
1921
|
// src/components/Dialog/AlertDialog.tsx
|
|
1854
1922
|
var RadixAlert = __toESM(require("@radix-ui/react-alert-dialog"), 1);
|
|
1855
|
-
var
|
|
1856
|
-
var
|
|
1923
|
+
var import_react38 = require("react");
|
|
1924
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1857
1925
|
var AlertDialogRoot = RadixAlert.Root;
|
|
1858
1926
|
var AlertDialogTrigger = RadixAlert.Trigger;
|
|
1859
1927
|
var AlertDialogAction = RadixAlert.Action;
|
|
1860
1928
|
var AlertDialogCancel = RadixAlert.Cancel;
|
|
1861
|
-
var AlertDialog = (0,
|
|
1862
|
-
return /* @__PURE__ */ (0,
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1929
|
+
var AlertDialog = (0, import_react38.forwardRef)(function AlertDialog2({ title, description, footer, width = 460, children, ...rootProps }, ref) {
|
|
1930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AlertDialogRoot, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(RadixAlert.Portal, { children: [
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1864
1932
|
RadixAlert.Overlay,
|
|
1865
1933
|
{
|
|
1866
1934
|
className: cn(
|
|
@@ -1869,7 +1937,7 @@ var AlertDialog = (0, import_react37.forwardRef)(function AlertDialog2({ title,
|
|
|
1869
1937
|
)
|
|
1870
1938
|
}
|
|
1871
1939
|
),
|
|
1872
|
-
/* @__PURE__ */ (0,
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
1873
1941
|
RadixAlert.Content,
|
|
1874
1942
|
{
|
|
1875
1943
|
ref,
|
|
@@ -1880,16 +1948,16 @@ var AlertDialog = (0, import_react37.forwardRef)(function AlertDialog2({ title,
|
|
|
1880
1948
|
"data-[state=open]:animate-[ship-dialog-in_180ms_var(--easing-out)]"
|
|
1881
1949
|
),
|
|
1882
1950
|
children: [
|
|
1883
|
-
/* @__PURE__ */ (0,
|
|
1951
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1884
1952
|
RadixAlert.Title,
|
|
1885
1953
|
{
|
|
1886
1954
|
className: cn("text-[16px] font-medium", description ? "mb-[6px]" : "mb-4"),
|
|
1887
1955
|
children: title
|
|
1888
1956
|
}
|
|
1889
1957
|
),
|
|
1890
|
-
description && /* @__PURE__ */ (0,
|
|
1958
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RadixAlert.Description, { className: "text-text-muted mb-[18px] text-[13px] leading-[1.55]", children: description }),
|
|
1891
1959
|
children,
|
|
1892
|
-
footer && /* @__PURE__ */ (0,
|
|
1960
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "mt-5 flex justify-end gap-2", children: footer })
|
|
1893
1961
|
]
|
|
1894
1962
|
}
|
|
1895
1963
|
)
|
|
@@ -1899,17 +1967,17 @@ AlertDialog.displayName = "AlertDialog";
|
|
|
1899
1967
|
|
|
1900
1968
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
1901
1969
|
var RadixMenu = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
1902
|
-
var
|
|
1903
|
-
var
|
|
1970
|
+
var import_react39 = require("react");
|
|
1971
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1904
1972
|
var DropdownMenuRoot = RadixMenu.Root;
|
|
1905
1973
|
var DropdownMenuTrigger = RadixMenu.Trigger;
|
|
1906
1974
|
var DropdownMenuPortal = RadixMenu.Portal;
|
|
1907
1975
|
var DropdownMenuGroup = RadixMenu.Group;
|
|
1908
1976
|
var DropdownMenuLabel = RadixMenu.Label;
|
|
1909
1977
|
var DropdownMenuRadioGroup = RadixMenu.RadioGroup;
|
|
1910
|
-
var DropdownMenuContent = (0,
|
|
1978
|
+
var DropdownMenuContent = (0, import_react39.forwardRef)(
|
|
1911
1979
|
function DropdownMenuContent2({ className, sideOffset = 6, align = "start", ...props }, ref) {
|
|
1912
|
-
return /* @__PURE__ */ (0,
|
|
1980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RadixMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1913
1981
|
RadixMenu.Content,
|
|
1914
1982
|
{
|
|
1915
1983
|
ref,
|
|
@@ -1931,32 +1999,32 @@ var itemBase2 = cn(
|
|
|
1931
1999
|
"data-[highlighted]:bg-panel-2",
|
|
1932
2000
|
"data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed"
|
|
1933
2001
|
);
|
|
1934
|
-
var MenuItem = (0,
|
|
1935
|
-
return /* @__PURE__ */ (0,
|
|
2002
|
+
var MenuItem = (0, import_react39.forwardRef)(function MenuItem2({ icon, trailing, destructive, className, children, ...props }, ref) {
|
|
2003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1936
2004
|
RadixMenu.Item,
|
|
1937
2005
|
{
|
|
1938
2006
|
ref,
|
|
1939
2007
|
className: cn(itemBase2, destructive ? "text-err" : "text-text", className),
|
|
1940
2008
|
...props,
|
|
1941
2009
|
children: [
|
|
1942
|
-
icon && /* @__PURE__ */ (0,
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
1944
|
-
trailing && /* @__PURE__ */ (0,
|
|
2010
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-[14px] text-[12px] opacity-70", children: icon }),
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "flex-1", children }),
|
|
2012
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: trailing })
|
|
1945
2013
|
]
|
|
1946
2014
|
}
|
|
1947
2015
|
);
|
|
1948
2016
|
});
|
|
1949
2017
|
MenuItem.displayName = "MenuItem";
|
|
1950
|
-
var MenuCheckboxItem = (0,
|
|
2018
|
+
var MenuCheckboxItem = (0, import_react39.forwardRef)(
|
|
1951
2019
|
function MenuCheckboxItem2({ className, children, ...props }, ref) {
|
|
1952
|
-
return /* @__PURE__ */ (0,
|
|
2020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1953
2021
|
RadixMenu.CheckboxItem,
|
|
1954
2022
|
{
|
|
1955
2023
|
ref,
|
|
1956
2024
|
className: cn(itemBase2, "text-text relative pl-[26px]", className),
|
|
1957
2025
|
...props,
|
|
1958
2026
|
children: [
|
|
1959
|
-
/* @__PURE__ */ (0,
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RadixMenu.ItemIndicator, { className: "text-accent absolute top-1/2 left-2 -translate-y-1/2 text-[10px]", children: "\u2713" }),
|
|
1960
2028
|
children
|
|
1961
2029
|
]
|
|
1962
2030
|
}
|
|
@@ -1964,9 +2032,9 @@ var MenuCheckboxItem = (0, import_react38.forwardRef)(
|
|
|
1964
2032
|
}
|
|
1965
2033
|
);
|
|
1966
2034
|
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
1967
|
-
var MenuSeparator = (0,
|
|
2035
|
+
var MenuSeparator = (0, import_react39.forwardRef)(
|
|
1968
2036
|
function MenuSeparator2({ className, ...props }, ref) {
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
2037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1970
2038
|
RadixMenu.Separator,
|
|
1971
2039
|
{
|
|
1972
2040
|
ref,
|
|
@@ -1981,14 +2049,14 @@ var DropdownMenu = RadixMenu.Root;
|
|
|
1981
2049
|
|
|
1982
2050
|
// src/components/HoverCard/HoverCard.tsx
|
|
1983
2051
|
var RadixHoverCard = __toESM(require("@radix-ui/react-hover-card"), 1);
|
|
1984
|
-
var
|
|
1985
|
-
var
|
|
2052
|
+
var import_react40 = require("react");
|
|
2053
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1986
2054
|
var HoverCardRoot = RadixHoverCard.Root;
|
|
1987
2055
|
var HoverCardTrigger = RadixHoverCard.Trigger;
|
|
1988
2056
|
var HoverCardPortal = RadixHoverCard.Portal;
|
|
1989
|
-
var HoverCardContent = (0,
|
|
2057
|
+
var HoverCardContent = (0, import_react40.forwardRef)(
|
|
1990
2058
|
function HoverCardContent2({ className, sideOffset = 4, ...props }, ref) {
|
|
1991
|
-
return /* @__PURE__ */ (0,
|
|
2059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(RadixHoverCard.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1992
2060
|
RadixHoverCard.Content,
|
|
1993
2061
|
{
|
|
1994
2062
|
ref,
|
|
@@ -2005,25 +2073,25 @@ var HoverCardContent = (0, import_react39.forwardRef)(
|
|
|
2005
2073
|
);
|
|
2006
2074
|
HoverCardContent.displayName = "HoverCardContent";
|
|
2007
2075
|
function HoverCard({ trigger, content, ...rootProps }) {
|
|
2008
|
-
return /* @__PURE__ */ (0,
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
2010
|
-
/* @__PURE__ */ (0,
|
|
2076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(RadixHoverCard.Root, { openDelay: 200, closeDelay: 120, ...rootProps, children: [
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(RadixHoverCard.Trigger, { asChild: true, children: trigger }),
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(HoverCardContent, { children: content })
|
|
2011
2079
|
] });
|
|
2012
2080
|
}
|
|
2013
2081
|
|
|
2014
2082
|
// src/components/Popover/Popover.tsx
|
|
2015
2083
|
var RadixPopover = __toESM(require("@radix-ui/react-popover"), 1);
|
|
2016
|
-
var
|
|
2017
|
-
var
|
|
2084
|
+
var import_react41 = require("react");
|
|
2085
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2018
2086
|
var PopoverRoot = RadixPopover.Root;
|
|
2019
2087
|
var PopoverTrigger = RadixPopover.Trigger;
|
|
2020
2088
|
var PopoverAnchor = RadixPopover.Anchor;
|
|
2021
2089
|
var PopoverPortal = RadixPopover.Portal;
|
|
2022
2090
|
var PopoverClose = RadixPopover.Close;
|
|
2023
2091
|
var PopoverArrow = RadixPopover.Arrow;
|
|
2024
|
-
var PopoverContent = (0,
|
|
2092
|
+
var PopoverContent = (0, import_react41.forwardRef)(
|
|
2025
2093
|
function PopoverContent2({ className, align = "start", sideOffset = 6, ...props }, ref) {
|
|
2026
|
-
return /* @__PURE__ */ (0,
|
|
2094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RadixPopover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2027
2095
|
RadixPopover.Content,
|
|
2028
2096
|
{
|
|
2029
2097
|
ref,
|
|
@@ -2044,9 +2112,9 @@ var Popover = RadixPopover.Root;
|
|
|
2044
2112
|
|
|
2045
2113
|
// src/components/Toast/Toast.tsx
|
|
2046
2114
|
var RadixToast = __toESM(require("@radix-ui/react-toast"), 1);
|
|
2047
|
-
var
|
|
2048
|
-
var
|
|
2049
|
-
var ToastContext = (0,
|
|
2115
|
+
var import_react42 = require("react");
|
|
2116
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2117
|
+
var ToastContext = (0, import_react42.createContext)(null);
|
|
2050
2118
|
var variantIcon = {
|
|
2051
2119
|
default: "\u25CF",
|
|
2052
2120
|
info: "\u2139",
|
|
@@ -2071,8 +2139,8 @@ var variantBorderLeft = {
|
|
|
2071
2139
|
var toastIdCounter = 0;
|
|
2072
2140
|
var nextToastId = () => `toast-${++toastIdCounter}`;
|
|
2073
2141
|
function ToastProvider({ children }) {
|
|
2074
|
-
const [toasts, setToasts] = (0,
|
|
2075
|
-
const toast = (0,
|
|
2142
|
+
const [toasts, setToasts] = (0, import_react42.useState)([]);
|
|
2143
|
+
const toast = (0, import_react42.useCallback)((t) => {
|
|
2076
2144
|
const explicitId = t.id;
|
|
2077
2145
|
const id = explicitId ?? nextToastId();
|
|
2078
2146
|
const entry = { ...t, id };
|
|
@@ -2084,24 +2152,24 @@ function ToastProvider({ children }) {
|
|
|
2084
2152
|
});
|
|
2085
2153
|
return id;
|
|
2086
2154
|
}, []);
|
|
2087
|
-
const dismiss = (0,
|
|
2155
|
+
const dismiss = (0, import_react42.useCallback)((id) => {
|
|
2088
2156
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
2089
2157
|
}, []);
|
|
2090
|
-
const value = (0,
|
|
2091
|
-
return /* @__PURE__ */ (0,
|
|
2158
|
+
const value = (0, import_react42.useMemo)(() => ({ toast, dismiss }), [toast, dismiss]);
|
|
2159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ToastContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(RadixToast.Provider, { swipeDirection: "right", children: [
|
|
2092
2160
|
children,
|
|
2093
|
-
toasts.map((t) => /* @__PURE__ */ (0,
|
|
2094
|
-
/* @__PURE__ */ (0,
|
|
2161
|
+
toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ToastCard, { toast: t, onDismiss: () => dismiss(t.id) }, t.id)),
|
|
2162
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RadixToast.Viewport, { className: "z-toast fixed right-5 bottom-5 flex w-[380px] max-w-[calc(100vw-40px)] flex-col gap-2 outline-none" })
|
|
2095
2163
|
] }) });
|
|
2096
2164
|
}
|
|
2097
2165
|
function useToast() {
|
|
2098
|
-
const ctx = (0,
|
|
2166
|
+
const ctx = (0, import_react42.useContext)(ToastContext);
|
|
2099
2167
|
if (!ctx) throw new Error("useToast must be inside <ToastProvider>");
|
|
2100
2168
|
return ctx;
|
|
2101
2169
|
}
|
|
2102
|
-
var ToastCard = (0,
|
|
2170
|
+
var ToastCard = (0, import_react42.forwardRef)(function ToastCard2({ toast, onDismiss }, ref) {
|
|
2103
2171
|
const variant = toast.variant ?? "default";
|
|
2104
|
-
return /* @__PURE__ */ (0,
|
|
2172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2105
2173
|
RadixToast.Root,
|
|
2106
2174
|
{
|
|
2107
2175
|
ref,
|
|
@@ -2116,13 +2184,13 @@ var ToastCard = (0, import_react41.forwardRef)(function ToastCard2({ toast, onDi
|
|
|
2116
2184
|
variantBorderLeft[variant]
|
|
2117
2185
|
),
|
|
2118
2186
|
children: [
|
|
2119
|
-
/* @__PURE__ */ (0,
|
|
2120
|
-
/* @__PURE__ */ (0,
|
|
2121
|
-
/* @__PURE__ */ (0,
|
|
2122
|
-
toast.description && /* @__PURE__ */ (0,
|
|
2123
|
-
toast.action && /* @__PURE__ */ (0,
|
|
2187
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: cn("mt-px text-[14px] leading-none", variantTextColor[variant]), children: variantIcon[variant] }),
|
|
2188
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RadixToast.Title, { className: "text-text text-[13px] font-medium", children: toast.title }),
|
|
2190
|
+
toast.description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RadixToast.Description, { className: "text-text-muted mt-[2px] text-[12px] leading-[1.5]", children: toast.description }),
|
|
2191
|
+
toast.action && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mt-2", children: toast.action })
|
|
2124
2192
|
] }),
|
|
2125
|
-
/* @__PURE__ */ (0,
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2126
2194
|
RadixToast.Close,
|
|
2127
2195
|
{
|
|
2128
2196
|
"aria-label": "Dismiss",
|
|
@@ -2138,16 +2206,16 @@ ToastCard.displayName = "ToastCard";
|
|
|
2138
2206
|
|
|
2139
2207
|
// src/components/Tooltip/Tooltip.tsx
|
|
2140
2208
|
var RadixTooltip = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
2141
|
-
var
|
|
2142
|
-
var
|
|
2209
|
+
var import_react43 = require("react");
|
|
2210
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2143
2211
|
var TooltipProvider = RadixTooltip.Provider;
|
|
2144
2212
|
var TooltipRoot = RadixTooltip.Root;
|
|
2145
2213
|
var TooltipTrigger = RadixTooltip.Trigger;
|
|
2146
2214
|
var TooltipPortal = RadixTooltip.Portal;
|
|
2147
2215
|
var TooltipArrow = RadixTooltip.Arrow;
|
|
2148
|
-
var TooltipContent = (0,
|
|
2216
|
+
var TooltipContent = (0, import_react43.forwardRef)(
|
|
2149
2217
|
function TooltipContent2({ className, sideOffset = 6, ...props }, ref) {
|
|
2150
|
-
return /* @__PURE__ */ (0,
|
|
2218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RadixTooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2151
2219
|
RadixTooltip.Content,
|
|
2152
2220
|
{
|
|
2153
2221
|
ref,
|
|
@@ -2165,16 +2233,16 @@ var TooltipContent = (0, import_react42.forwardRef)(
|
|
|
2165
2233
|
);
|
|
2166
2234
|
TooltipContent.displayName = "TooltipContent";
|
|
2167
2235
|
function Tooltip({ content, children, side = "top", delayDuration = 400 }) {
|
|
2168
|
-
return /* @__PURE__ */ (0,
|
|
2169
|
-
/* @__PURE__ */ (0,
|
|
2170
|
-
/* @__PURE__ */ (0,
|
|
2236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipProvider, { delayDuration, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(TooltipRoot, { children: [
|
|
2237
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipTrigger, { asChild: true, children }),
|
|
2238
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipContent, { side, children: content })
|
|
2171
2239
|
] }) });
|
|
2172
2240
|
}
|
|
2173
2241
|
|
|
2174
2242
|
// src/patterns/Alert/Alert.tsx
|
|
2175
2243
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
2176
|
-
var
|
|
2177
|
-
var
|
|
2244
|
+
var import_react44 = require("react");
|
|
2245
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2178
2246
|
var alertStyles = (0, import_class_variance_authority8.cva)("flex items-start gap-3 rounded-base border bg-panel p-3 text-[13px]", {
|
|
2179
2247
|
variants: {
|
|
2180
2248
|
tone: {
|
|
@@ -2198,7 +2266,7 @@ var defaultGlyph = {
|
|
|
2198
2266
|
warn: "!",
|
|
2199
2267
|
err: "\xD7"
|
|
2200
2268
|
};
|
|
2201
|
-
var Alert = (0,
|
|
2269
|
+
var Alert = (0, import_react44.forwardRef)(function Alert2({
|
|
2202
2270
|
tone = "accent",
|
|
2203
2271
|
title,
|
|
2204
2272
|
description,
|
|
@@ -2210,7 +2278,7 @@ var Alert = (0, import_react43.forwardRef)(function Alert2({
|
|
|
2210
2278
|
...props
|
|
2211
2279
|
}, ref) {
|
|
2212
2280
|
const t = tone ?? "accent";
|
|
2213
|
-
return /* @__PURE__ */ (0,
|
|
2281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2214
2282
|
"div",
|
|
2215
2283
|
{
|
|
2216
2284
|
ref,
|
|
@@ -2219,13 +2287,13 @@ var Alert = (0, import_react43.forwardRef)(function Alert2({
|
|
|
2219
2287
|
className: cn(alertStyles({ tone }), className),
|
|
2220
2288
|
...props,
|
|
2221
2289
|
children: [
|
|
2222
|
-
/* @__PURE__ */ (0,
|
|
2223
|
-
/* @__PURE__ */ (0,
|
|
2224
|
-
title && /* @__PURE__ */ (0,
|
|
2225
|
-
description && /* @__PURE__ */ (0,
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "aria-hidden": true, className: cn("mt-[1px] text-[14px] leading-none", iconColorClass[t]), children: icon ?? defaultGlyph[t] }),
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
2292
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "font-medium", children: title }),
|
|
2293
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "text-text-muted mt-[2px] text-[12px]", children: description }),
|
|
2226
2294
|
children
|
|
2227
2295
|
] }),
|
|
2228
|
-
action && /* @__PURE__ */ (0,
|
|
2296
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "ml-1 shrink-0", children: action })
|
|
2229
2297
|
]
|
|
2230
2298
|
}
|
|
2231
2299
|
);
|
|
@@ -2234,8 +2302,8 @@ Alert.displayName = "Alert";
|
|
|
2234
2302
|
|
|
2235
2303
|
// src/patterns/Banner/Banner.tsx
|
|
2236
2304
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
2237
|
-
var
|
|
2238
|
-
var
|
|
2305
|
+
var import_react45 = require("react");
|
|
2306
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2239
2307
|
var bannerStyles = (0, import_class_variance_authority9.cva)(
|
|
2240
2308
|
"flex items-center gap-3 border-b border-border px-[14px] py-2 text-[12px]",
|
|
2241
2309
|
{
|
|
@@ -2260,9 +2328,9 @@ var defaultGlyph2 = {
|
|
|
2260
2328
|
warn: "!",
|
|
2261
2329
|
err: "\xD7"
|
|
2262
2330
|
};
|
|
2263
|
-
var Banner = (0,
|
|
2331
|
+
var Banner = (0, import_react45.forwardRef)(function Banner2({ tone = "accent", sticky, icon, action, live = "polite", className, children, ...props }, ref) {
|
|
2264
2332
|
const t = tone ?? "accent";
|
|
2265
|
-
return /* @__PURE__ */ (0,
|
|
2333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2266
2334
|
"div",
|
|
2267
2335
|
{
|
|
2268
2336
|
ref,
|
|
@@ -2271,9 +2339,9 @@ var Banner = (0, import_react44.forwardRef)(function Banner2({ tone = "accent",
|
|
|
2271
2339
|
className: cn(bannerStyles({ tone, sticky }), className),
|
|
2272
2340
|
...props,
|
|
2273
2341
|
children: [
|
|
2274
|
-
/* @__PURE__ */ (0,
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2276
|
-
action && /* @__PURE__ */ (0,
|
|
2342
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "aria-hidden": true, className: "leading-none", children: icon ?? defaultGlyph2[t] }),
|
|
2343
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "min-w-0 flex-1", children }),
|
|
2344
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ml-auto", children: action })
|
|
2277
2345
|
]
|
|
2278
2346
|
}
|
|
2279
2347
|
);
|
|
@@ -2281,28 +2349,28 @@ var Banner = (0, import_react44.forwardRef)(function Banner2({ tone = "accent",
|
|
|
2281
2349
|
Banner.displayName = "Banner";
|
|
2282
2350
|
|
|
2283
2351
|
// src/patterns/Breadcrumbs/Breadcrumbs.tsx
|
|
2284
|
-
var
|
|
2285
|
-
var
|
|
2286
|
-
var Breadcrumbs = (0,
|
|
2287
|
-
const crumbs =
|
|
2352
|
+
var import_react46 = require("react");
|
|
2353
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2354
|
+
var Breadcrumbs = (0, import_react46.forwardRef)(function Breadcrumbs2({ separator = "/", className, children, ...props }, ref) {
|
|
2355
|
+
const crumbs = import_react46.Children.toArray(children).filter(import_react46.isValidElement);
|
|
2288
2356
|
const last = crumbs.length - 1;
|
|
2289
|
-
return /* @__PURE__ */ (0,
|
|
2357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("nav", { ref, "aria-label": "Breadcrumb", className: cn("text-[13px]", className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("ol", { className: "text-text-muted flex flex-wrap items-center gap-[6px]", children: crumbs.map((crumb, i) => {
|
|
2290
2358
|
const isCurrent = i === last;
|
|
2291
|
-
return /* @__PURE__ */ (0,
|
|
2292
|
-
isCurrent ? /* @__PURE__ */ (0,
|
|
2293
|
-
!isCurrent && /* @__PURE__ */ (0,
|
|
2359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("li", { className: "inline-flex items-center gap-[6px]", children: [
|
|
2360
|
+
isCurrent ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Crumb, { ...crumb.props, current: true }) : crumb,
|
|
2361
|
+
!isCurrent && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "aria-hidden": true, className: "text-text-dim", children: separator })
|
|
2294
2362
|
] }, i);
|
|
2295
2363
|
}) }) });
|
|
2296
2364
|
});
|
|
2297
2365
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
2298
|
-
var Crumb = (0,
|
|
2366
|
+
var Crumb = (0, import_react46.forwardRef)(function Crumb2({ current, className, href, children, ...props }, ref) {
|
|
2299
2367
|
if (current) {
|
|
2300
|
-
return /* @__PURE__ */ (0,
|
|
2368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "aria-current": "page", className: cn("text-text", className), children });
|
|
2301
2369
|
}
|
|
2302
2370
|
if (href === void 0) {
|
|
2303
|
-
return /* @__PURE__ */ (0,
|
|
2371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: cn("text-text-dim", className), children });
|
|
2304
2372
|
}
|
|
2305
|
-
return /* @__PURE__ */ (0,
|
|
2373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2306
2374
|
"a",
|
|
2307
2375
|
{
|
|
2308
2376
|
ref,
|
|
@@ -2316,8 +2384,8 @@ var Crumb = (0, import_react45.forwardRef)(function Crumb2({ current, className,
|
|
|
2316
2384
|
Crumb.displayName = "Crumb";
|
|
2317
2385
|
|
|
2318
2386
|
// src/patterns/Combobox/Combobox.tsx
|
|
2319
|
-
var
|
|
2320
|
-
var
|
|
2387
|
+
var import_react47 = require("react");
|
|
2388
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2321
2389
|
function normalize(option) {
|
|
2322
2390
|
if (typeof option === "string") {
|
|
2323
2391
|
return { value: option, label: option, searchText: option.toLowerCase() };
|
|
@@ -2333,7 +2401,7 @@ function normalize(option) {
|
|
|
2333
2401
|
};
|
|
2334
2402
|
}
|
|
2335
2403
|
var defaultFilter = (option, query) => option.searchText.includes(query.toLowerCase());
|
|
2336
|
-
var Combobox = (0,
|
|
2404
|
+
var Combobox = (0, import_react47.forwardRef)(function Combobox2({
|
|
2337
2405
|
options,
|
|
2338
2406
|
value: valueProp,
|
|
2339
2407
|
defaultValue,
|
|
@@ -2350,16 +2418,16 @@ var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
|
2350
2418
|
id,
|
|
2351
2419
|
"aria-label": ariaLabel
|
|
2352
2420
|
}, ref) {
|
|
2353
|
-
const reactId = (0,
|
|
2421
|
+
const reactId = (0, import_react47.useId)();
|
|
2354
2422
|
const listboxId = `${id ?? reactId}-listbox`;
|
|
2355
2423
|
const inputId = id ?? `${reactId}-input`;
|
|
2356
|
-
const normalized = (0,
|
|
2424
|
+
const normalized = (0, import_react47.useMemo)(() => options.map(normalize), [options]);
|
|
2357
2425
|
const [value, setValue] = useControllableState({
|
|
2358
2426
|
value: valueProp,
|
|
2359
2427
|
defaultValue,
|
|
2360
2428
|
onChange: onValueChange
|
|
2361
2429
|
});
|
|
2362
|
-
const initialQuery = (0,
|
|
2430
|
+
const initialQuery = (0, import_react47.useMemo)(() => {
|
|
2363
2431
|
if (defaultQuery !== void 0) return defaultQuery;
|
|
2364
2432
|
if (defaultValue !== void 0) {
|
|
2365
2433
|
const opt = normalized.find((o) => o.value === defaultValue);
|
|
@@ -2372,10 +2440,10 @@ var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
|
2372
2440
|
defaultValue: initialQuery,
|
|
2373
2441
|
onChange: onQueryChange
|
|
2374
2442
|
});
|
|
2375
|
-
const [open, setOpen] = (0,
|
|
2376
|
-
const wrapperRef = (0,
|
|
2443
|
+
const [open, setOpen] = (0, import_react47.useState)(false);
|
|
2444
|
+
const wrapperRef = (0, import_react47.useRef)(null);
|
|
2377
2445
|
useOutsideClick(wrapperRef, () => setOpen(false));
|
|
2378
|
-
const filtered = (0,
|
|
2446
|
+
const filtered = (0, import_react47.useMemo)(
|
|
2379
2447
|
() => query ? normalized.filter((o) => filter(o, query)) : normalized,
|
|
2380
2448
|
[normalized, query, filter]
|
|
2381
2449
|
);
|
|
@@ -2387,7 +2455,7 @@ var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
|
2387
2455
|
if (item && !item.disabled) commit(item);
|
|
2388
2456
|
}
|
|
2389
2457
|
});
|
|
2390
|
-
(0,
|
|
2458
|
+
(0, import_react47.useEffect)(() => {
|
|
2391
2459
|
setCursor(0);
|
|
2392
2460
|
}, [query, setCursor]);
|
|
2393
2461
|
function commit(option) {
|
|
@@ -2410,8 +2478,8 @@ var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
|
2410
2478
|
setOpen(false);
|
|
2411
2479
|
}
|
|
2412
2480
|
};
|
|
2413
|
-
return /* @__PURE__ */ (0,
|
|
2414
|
-
/* @__PURE__ */ (0,
|
|
2481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { ref: wrapperRef, className: "relative", style: { width }, children: [
|
|
2482
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2415
2483
|
"input",
|
|
2416
2484
|
{
|
|
2417
2485
|
ref,
|
|
@@ -2445,7 +2513,7 @@ var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
|
2445
2513
|
)
|
|
2446
2514
|
}
|
|
2447
2515
|
),
|
|
2448
|
-
open && /* @__PURE__ */ (0,
|
|
2516
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2449
2517
|
"ul",
|
|
2450
2518
|
{
|
|
2451
2519
|
id: listboxId,
|
|
@@ -2455,9 +2523,9 @@ var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
|
2455
2523
|
"z-dropdown absolute top-full right-0 left-0 mt-1 max-h-[220px] overflow-auto",
|
|
2456
2524
|
"border-border bg-panel rounded-md border p-1 shadow-lg"
|
|
2457
2525
|
),
|
|
2458
|
-
children: filtered.length === 0 ? /* @__PURE__ */ (0,
|
|
2526
|
+
children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("li", { className: "text-text-dim px-2 py-3 text-center text-[12px]", role: "presentation", children: emptyState ?? "No matches" }) : filtered.map((option, i) => {
|
|
2459
2527
|
const isActive = i === cursor;
|
|
2460
|
-
return /* @__PURE__ */ (0,
|
|
2528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2461
2529
|
"li",
|
|
2462
2530
|
{
|
|
2463
2531
|
id: `${listboxId}-option-${i}`,
|
|
@@ -2475,8 +2543,8 @@ var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
|
2475
2543
|
option.disabled && "pointer-events-none opacity-40"
|
|
2476
2544
|
),
|
|
2477
2545
|
children: [
|
|
2478
|
-
/* @__PURE__ */ (0,
|
|
2479
|
-
option.description && /* @__PURE__ */ (0,
|
|
2546
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: option.label }),
|
|
2547
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-text-dim text-[11px]", children: option.description })
|
|
2480
2548
|
]
|
|
2481
2549
|
},
|
|
2482
2550
|
option.value
|
|
@@ -2484,19 +2552,19 @@ var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
|
2484
2552
|
})
|
|
2485
2553
|
}
|
|
2486
2554
|
),
|
|
2487
|
-
name && /* @__PURE__ */ (0,
|
|
2555
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("input", { type: "hidden", name, value: value ?? "", readOnly: true })
|
|
2488
2556
|
] });
|
|
2489
2557
|
});
|
|
2490
2558
|
Combobox.displayName = "Combobox";
|
|
2491
2559
|
|
|
2492
2560
|
// src/patterns/CommandPalette/CommandPalette.tsx
|
|
2493
2561
|
var RadixDialog4 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
2494
|
-
var
|
|
2495
|
-
var
|
|
2562
|
+
var import_react48 = require("react");
|
|
2563
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2496
2564
|
function flatItems(groups) {
|
|
2497
2565
|
return groups.flatMap((g) => g.items);
|
|
2498
2566
|
}
|
|
2499
|
-
var CommandPalette = (0,
|
|
2567
|
+
var CommandPalette = (0, import_react48.forwardRef)(
|
|
2500
2568
|
function CommandPalette2({
|
|
2501
2569
|
open,
|
|
2502
2570
|
onOpenChange,
|
|
@@ -2509,7 +2577,7 @@ var CommandPalette = (0, import_react47.forwardRef)(
|
|
|
2509
2577
|
emptyState,
|
|
2510
2578
|
width = 540
|
|
2511
2579
|
}, ref) {
|
|
2512
|
-
const flat = (0,
|
|
2580
|
+
const flat = (0, import_react48.useMemo)(() => flatItems(groups), [groups]);
|
|
2513
2581
|
const { cursor, setCursor, onKeyDown } = useKeyboardList({
|
|
2514
2582
|
count: flat.length,
|
|
2515
2583
|
defaultCursor: 0,
|
|
@@ -2518,15 +2586,15 @@ var CommandPalette = (0, import_react47.forwardRef)(
|
|
|
2518
2586
|
if (item) onSelect(item.id);
|
|
2519
2587
|
}
|
|
2520
2588
|
});
|
|
2521
|
-
const reactId = (0,
|
|
2589
|
+
const reactId = (0, import_react48.useId)();
|
|
2522
2590
|
const listboxId = `${reactId}-listbox`;
|
|
2523
2591
|
const optionId = (i) => `${listboxId}-option-${i}`;
|
|
2524
2592
|
const hasMatches = flat.length > 0;
|
|
2525
|
-
(0,
|
|
2593
|
+
(0, import_react48.useEffect)(() => {
|
|
2526
2594
|
setCursor(0);
|
|
2527
2595
|
}, [query, groups, setCursor]);
|
|
2528
|
-
return /* @__PURE__ */ (0,
|
|
2529
|
-
/* @__PURE__ */ (0,
|
|
2596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RadixDialog4.Root, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(RadixDialog4.Portal, { children: [
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2530
2598
|
RadixDialog4.Overlay,
|
|
2531
2599
|
{
|
|
2532
2600
|
className: cn(
|
|
@@ -2535,7 +2603,7 @@ var CommandPalette = (0, import_react47.forwardRef)(
|
|
|
2535
2603
|
)
|
|
2536
2604
|
}
|
|
2537
2605
|
),
|
|
2538
|
-
/* @__PURE__ */ (0,
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
2539
2607
|
RadixDialog4.Content,
|
|
2540
2608
|
{
|
|
2541
2609
|
ref,
|
|
@@ -2549,10 +2617,10 @@ var CommandPalette = (0, import_react47.forwardRef)(
|
|
|
2549
2617
|
),
|
|
2550
2618
|
onKeyDown,
|
|
2551
2619
|
children: [
|
|
2552
|
-
/* @__PURE__ */ (0,
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2554
|
-
/* @__PURE__ */ (0,
|
|
2555
|
-
/* @__PURE__ */ (0,
|
|
2620
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RadixDialog4.Title, { className: "sr-only", children: "Command palette" }),
|
|
2621
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "border-border flex items-center gap-[10px] border-b px-4 py-[14px]", children: [
|
|
2622
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "aria-hidden": true, className: "text-text-dim", children: "\u2315" }),
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2556
2624
|
"input",
|
|
2557
2625
|
{
|
|
2558
2626
|
autoFocus: true,
|
|
@@ -2569,9 +2637,9 @@ var CommandPalette = (0, import_react47.forwardRef)(
|
|
|
2569
2637
|
className: "text-text placeholder:text-text-dim flex-1 border-0 bg-transparent text-[14px] outline-none"
|
|
2570
2638
|
}
|
|
2571
2639
|
),
|
|
2572
|
-
/* @__PURE__ */ (0,
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "border-border text-text-dim rounded-xs border px-[6px] py-[2px] font-mono text-[10px]", children: "ESC" })
|
|
2573
2641
|
] }),
|
|
2574
|
-
/* @__PURE__ */ (0,
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { id: listboxId, className: "min-h-[220px] p-2", role: "listbox", "aria-label": "Results", children: flat.length === 0 ? emptyState ?? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-text-dim px-3 py-5 text-center text-[12px]", children: "No matches" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2575
2643
|
CommandGroups,
|
|
2576
2644
|
{
|
|
2577
2645
|
groups,
|
|
@@ -2581,7 +2649,7 @@ var CommandPalette = (0, import_react47.forwardRef)(
|
|
|
2581
2649
|
optionId
|
|
2582
2650
|
}
|
|
2583
2651
|
) }),
|
|
2584
|
-
footer && /* @__PURE__ */ (0,
|
|
2652
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "border-border text-text-dim flex gap-4 border-t px-[14px] py-[10px] font-mono text-[10px]", children: footer })
|
|
2585
2653
|
]
|
|
2586
2654
|
}
|
|
2587
2655
|
)
|
|
@@ -2591,10 +2659,10 @@ var CommandPalette = (0, import_react47.forwardRef)(
|
|
|
2591
2659
|
CommandPalette.displayName = "CommandPalette";
|
|
2592
2660
|
function CommandGroups({ groups, cursor, setCursor, onSelect, optionId }) {
|
|
2593
2661
|
let runningIndex = 0;
|
|
2594
|
-
return /* @__PURE__ */ (0,
|
|
2662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: groups.map((group, gIdx) => {
|
|
2595
2663
|
if (group.items.length === 0) return null;
|
|
2596
|
-
return /* @__PURE__ */ (0,
|
|
2597
|
-
group.label && /* @__PURE__ */ (0,
|
|
2664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
2665
|
+
group.label && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "text-text-dim px-2 pt-2 pb-1 font-mono text-[9px] tracking-[1.4px] uppercase", children: [
|
|
2598
2666
|
group.label,
|
|
2599
2667
|
" \xB7 ",
|
|
2600
2668
|
group.items.length
|
|
@@ -2602,7 +2670,7 @@ function CommandGroups({ groups, cursor, setCursor, onSelect, optionId }) {
|
|
|
2602
2670
|
group.items.map((item) => {
|
|
2603
2671
|
const myIndex = runningIndex++;
|
|
2604
2672
|
const isActive = cursor === myIndex;
|
|
2605
|
-
return /* @__PURE__ */ (0,
|
|
2673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
2606
2674
|
"button",
|
|
2607
2675
|
{
|
|
2608
2676
|
id: optionId(myIndex),
|
|
@@ -2616,7 +2684,7 @@ function CommandGroups({ groups, cursor, setCursor, onSelect, optionId }) {
|
|
|
2616
2684
|
isActive ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2"
|
|
2617
2685
|
),
|
|
2618
2686
|
children: [
|
|
2619
|
-
item.glyph != null && /* @__PURE__ */ (0,
|
|
2687
|
+
item.glyph != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2620
2688
|
"span",
|
|
2621
2689
|
{
|
|
2622
2690
|
"aria-hidden": true,
|
|
@@ -2627,11 +2695,11 @@ function CommandGroups({ groups, cursor, setCursor, onSelect, optionId }) {
|
|
|
2627
2695
|
children: item.glyph
|
|
2628
2696
|
}
|
|
2629
2697
|
),
|
|
2630
|
-
/* @__PURE__ */ (0,
|
|
2631
|
-
/* @__PURE__ */ (0,
|
|
2632
|
-
item.description && /* @__PURE__ */ (0,
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
2699
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "block truncate text-[13px]", children: item.label }),
|
|
2700
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-text-dim block truncate text-[11px]", children: item.description })
|
|
2633
2701
|
] }),
|
|
2634
|
-
item.trailing && /* @__PURE__ */ (0,
|
|
2702
|
+
item.trailing && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: item.trailing })
|
|
2635
2703
|
]
|
|
2636
2704
|
},
|
|
2637
2705
|
item.id
|
|
@@ -2653,8 +2721,8 @@ function filterCommandItems(query, groups) {
|
|
|
2653
2721
|
}
|
|
2654
2722
|
|
|
2655
2723
|
// src/patterns/DataTable/DataTable.tsx
|
|
2656
|
-
var
|
|
2657
|
-
var
|
|
2724
|
+
var import_react49 = require("react");
|
|
2725
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2658
2726
|
var alignClass = {
|
|
2659
2727
|
left: "text-left",
|
|
2660
2728
|
right: "text-right",
|
|
@@ -2689,12 +2757,12 @@ function DataTable(props) {
|
|
|
2689
2757
|
defaultValue: new Set(defaultSelected ?? []),
|
|
2690
2758
|
onChange: onSelectionChange
|
|
2691
2759
|
});
|
|
2692
|
-
const sortableMap = (0,
|
|
2760
|
+
const sortableMap = (0, import_react49.useMemo)(() => {
|
|
2693
2761
|
const m = /* @__PURE__ */ new Map();
|
|
2694
2762
|
for (const c of columns) if (c.accessor) m.set(c.key, c);
|
|
2695
2763
|
return m;
|
|
2696
2764
|
}, [columns]);
|
|
2697
|
-
const sortedData = (0,
|
|
2765
|
+
const sortedData = (0, import_react49.useMemo)(() => {
|
|
2698
2766
|
if (!sort) return [...data];
|
|
2699
2767
|
const col = sortableMap.get(sort.key);
|
|
2700
2768
|
if (!col || !col.accessor) return [...data];
|
|
@@ -2706,12 +2774,12 @@ function DataTable(props) {
|
|
|
2706
2774
|
return String(av).localeCompare(String(bv)) * factor;
|
|
2707
2775
|
});
|
|
2708
2776
|
}, [data, sort, sortableMap]);
|
|
2709
|
-
const allIds = (0,
|
|
2777
|
+
const allIds = (0, import_react49.useMemo)(() => sortedData.map(rowKey), [sortedData, rowKey]);
|
|
2710
2778
|
const selectedSet = selected ?? EMPTY_SET;
|
|
2711
2779
|
const allSelected = allIds.length > 0 && allIds.every((id) => selectedSet.has(id));
|
|
2712
2780
|
const someSelected = !allSelected && allIds.some((id) => selectedSet.has(id));
|
|
2713
|
-
const headerCheckRef = (0,
|
|
2714
|
-
(0,
|
|
2781
|
+
const headerCheckRef = (0, import_react49.useRef)(null);
|
|
2782
|
+
(0, import_react49.useEffect)(() => {
|
|
2715
2783
|
if (headerCheckRef.current) headerCheckRef.current.indeterminate = someSelected;
|
|
2716
2784
|
}, [someSelected]);
|
|
2717
2785
|
const toggleSort = (key) => {
|
|
@@ -2742,10 +2810,10 @@ function DataTable(props) {
|
|
|
2742
2810
|
return next;
|
|
2743
2811
|
});
|
|
2744
2812
|
};
|
|
2745
|
-
return /* @__PURE__ */ (0,
|
|
2746
|
-
caption && /* @__PURE__ */ (0,
|
|
2747
|
-
/* @__PURE__ */ (0,
|
|
2748
|
-
selectable && /* @__PURE__ */ (0,
|
|
2813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("table", { ref, className: cn("w-full border-collapse text-[12px]", className), children: [
|
|
2814
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("caption", { className: "sr-only", children: caption }),
|
|
2815
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("thead", { className: cn("bg-panel-2", stickyHeader && "z-raised sticky top-0"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tr", { children: [
|
|
2816
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("th", { scope: "col", className: "border-border w-8 border-b px-3 py-2 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2749
2817
|
"input",
|
|
2750
2818
|
{
|
|
2751
2819
|
ref: headerCheckRef,
|
|
@@ -2761,8 +2829,8 @@ function DataTable(props) {
|
|
|
2761
2829
|
const isSorted = sort?.key === col.key;
|
|
2762
2830
|
const ariaSort = !sortable ? void 0 : isSorted ? sort?.direction === "asc" ? "ascending" : "descending" : "none";
|
|
2763
2831
|
const align = col.align ?? "left";
|
|
2764
|
-
const indicator = sortable && isSorted && /* @__PURE__ */ (0,
|
|
2765
|
-
return /* @__PURE__ */ (0,
|
|
2832
|
+
const indicator = sortable && isSorted && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "aria-hidden": true, className: "ml-1", children: sort?.direction === "asc" ? "\u2191" : "\u2193" });
|
|
2833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2766
2834
|
"th",
|
|
2767
2835
|
{
|
|
2768
2836
|
scope: "col",
|
|
@@ -2774,7 +2842,7 @@ function DataTable(props) {
|
|
|
2774
2842
|
sortable && "cursor-pointer",
|
|
2775
2843
|
isSorted ? "text-accent" : "text-text-dim"
|
|
2776
2844
|
),
|
|
2777
|
-
children: sortable ? /* @__PURE__ */ (0,
|
|
2845
|
+
children: sortable ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
2778
2846
|
"button",
|
|
2779
2847
|
{
|
|
2780
2848
|
type: "button",
|
|
@@ -2791,8 +2859,8 @@ function DataTable(props) {
|
|
|
2791
2859
|
);
|
|
2792
2860
|
})
|
|
2793
2861
|
] }) }),
|
|
2794
|
-
/* @__PURE__ */ (0,
|
|
2795
|
-
sortedData.length === 0 && /* @__PURE__ */ (0,
|
|
2862
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tbody", { children: [
|
|
2863
|
+
sortedData.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2796
2864
|
"td",
|
|
2797
2865
|
{
|
|
2798
2866
|
colSpan: columns.length + (selectable ? 1 : 0),
|
|
@@ -2803,7 +2871,7 @@ function DataTable(props) {
|
|
|
2803
2871
|
sortedData.map((row) => {
|
|
2804
2872
|
const id = rowKey(row);
|
|
2805
2873
|
const isSelected = selectedSet.has(id);
|
|
2806
|
-
return /* @__PURE__ */ (0,
|
|
2874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
2807
2875
|
"tr",
|
|
2808
2876
|
{
|
|
2809
2877
|
"data-state": isSelected ? "selected" : void 0,
|
|
@@ -2812,7 +2880,7 @@ function DataTable(props) {
|
|
|
2812
2880
|
isSelected ? "bg-accent-dim/50" : "hover:bg-panel-2"
|
|
2813
2881
|
),
|
|
2814
2882
|
children: [
|
|
2815
|
-
selectable && /* @__PURE__ */ (0,
|
|
2883
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", { className: "px-3 py-[10px]", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2816
2884
|
"input",
|
|
2817
2885
|
{
|
|
2818
2886
|
type: "checkbox",
|
|
@@ -2822,7 +2890,7 @@ function DataTable(props) {
|
|
|
2822
2890
|
className: "cursor-pointer accent-[var(--color-accent)]"
|
|
2823
2891
|
}
|
|
2824
2892
|
) }),
|
|
2825
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
2893
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", { className: cn("px-3 py-[10px]", alignClass[col.align ?? "left"]), children: col.cell ? col.cell(row) : col.accessor ? String(col.accessor(row)) : null }, col.key))
|
|
2826
2894
|
]
|
|
2827
2895
|
},
|
|
2828
2896
|
id
|
|
@@ -2833,8 +2901,8 @@ function DataTable(props) {
|
|
|
2833
2901
|
}
|
|
2834
2902
|
|
|
2835
2903
|
// src/patterns/DatePicker/Calendar.tsx
|
|
2836
|
-
var
|
|
2837
|
-
var
|
|
2904
|
+
var import_react50 = require("react");
|
|
2905
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2838
2906
|
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
2839
2907
|
var DAYS = ["S", "M", "T", "W", "T", "F", "S"];
|
|
2840
2908
|
function isSameDay(a, b) {
|
|
@@ -2845,7 +2913,7 @@ function clampDay(year, month, day) {
|
|
|
2845
2913
|
const max = new Date(year, month + 1, 0).getDate();
|
|
2846
2914
|
return Math.min(Math.max(1, day), max);
|
|
2847
2915
|
}
|
|
2848
|
-
var Calendar = (0,
|
|
2916
|
+
var Calendar = (0, import_react50.forwardRef)(function Calendar2({
|
|
2849
2917
|
value,
|
|
2850
2918
|
defaultValue,
|
|
2851
2919
|
onValueChange,
|
|
@@ -2858,9 +2926,9 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
2858
2926
|
className,
|
|
2859
2927
|
...props
|
|
2860
2928
|
}, ref) {
|
|
2861
|
-
const [today] = (0,
|
|
2862
|
-
const [hydrated, setHydrated] = (0,
|
|
2863
|
-
(0,
|
|
2929
|
+
const [today] = (0, import_react50.useState)(() => /* @__PURE__ */ new Date());
|
|
2930
|
+
const [hydrated, setHydrated] = (0, import_react50.useState)(false);
|
|
2931
|
+
(0, import_react50.useEffect)(() => setHydrated(true), []);
|
|
2864
2932
|
const [selectedDate, setSelectedDate] = useControllableState({
|
|
2865
2933
|
value,
|
|
2866
2934
|
defaultValue,
|
|
@@ -2868,12 +2936,12 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
2868
2936
|
});
|
|
2869
2937
|
const initialMonth = defaultMonth ?? defaultValue?.getMonth() ?? today.getMonth();
|
|
2870
2938
|
const initialYear = defaultYear ?? defaultValue?.getFullYear() ?? today.getFullYear();
|
|
2871
|
-
const [internalMonth, setInternalMonth] = (0,
|
|
2872
|
-
const [internalYear, setInternalYear] = (0,
|
|
2939
|
+
const [internalMonth, setInternalMonth] = (0, import_react50.useState)(initialMonth);
|
|
2940
|
+
const [internalYear, setInternalYear] = (0, import_react50.useState)(initialYear);
|
|
2873
2941
|
const month = monthProp ?? internalMonth;
|
|
2874
2942
|
const year = yearProp ?? internalYear;
|
|
2875
2943
|
const isControlled = monthProp !== void 0 && yearProp !== void 0;
|
|
2876
|
-
const setVisible = (0,
|
|
2944
|
+
const setVisible = (0, import_react50.useCallback)(
|
|
2877
2945
|
(m, y) => {
|
|
2878
2946
|
if (!isControlled) {
|
|
2879
2947
|
setInternalMonth(m);
|
|
@@ -2883,36 +2951,36 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
2883
2951
|
},
|
|
2884
2952
|
[isControlled, onVisibleMonthChange]
|
|
2885
2953
|
);
|
|
2886
|
-
const goPrev = (0,
|
|
2954
|
+
const goPrev = (0, import_react50.useCallback)(() => {
|
|
2887
2955
|
const m = month === 0 ? 11 : month - 1;
|
|
2888
2956
|
const y = month === 0 ? year - 1 : year;
|
|
2889
2957
|
setVisible(m, y);
|
|
2890
2958
|
}, [month, year, setVisible]);
|
|
2891
|
-
const goNext = (0,
|
|
2959
|
+
const goNext = (0, import_react50.useCallback)(() => {
|
|
2892
2960
|
const m = month === 11 ? 0 : month + 1;
|
|
2893
2961
|
const y = month === 11 ? year + 1 : year;
|
|
2894
2962
|
setVisible(m, y);
|
|
2895
2963
|
}, [month, year, setVisible]);
|
|
2896
2964
|
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
2897
2965
|
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
2898
|
-
const [focusedDate, setFocusedDate] = (0,
|
|
2966
|
+
const [focusedDate, setFocusedDate] = (0, import_react50.useState)(() => {
|
|
2899
2967
|
if (selectedDate) return selectedDate;
|
|
2900
2968
|
return new Date(initialYear, initialMonth, 1);
|
|
2901
2969
|
});
|
|
2902
|
-
(0,
|
|
2970
|
+
(0, import_react50.useEffect)(() => {
|
|
2903
2971
|
if (selectedDate) setFocusedDate(selectedDate);
|
|
2904
2972
|
}, [selectedDate]);
|
|
2905
2973
|
const focusedInVisibleMonth = focusedDate.getMonth() === month && focusedDate.getFullYear() === year;
|
|
2906
2974
|
const effectiveFocusDay = focusedInVisibleMonth ? focusedDate.getDate() : clampDay(year, month, focusedDate.getDate());
|
|
2907
|
-
const dayRefs = (0,
|
|
2908
|
-
const shouldFocusRef = (0,
|
|
2909
|
-
(0,
|
|
2975
|
+
const dayRefs = (0, import_react50.useRef)(/* @__PURE__ */ new Map());
|
|
2976
|
+
const shouldFocusRef = (0, import_react50.useRef)(false);
|
|
2977
|
+
(0, import_react50.useEffect)(() => {
|
|
2910
2978
|
if (!shouldFocusRef.current) return;
|
|
2911
2979
|
shouldFocusRef.current = false;
|
|
2912
2980
|
const node = dayRefs.current.get(effectiveFocusDay);
|
|
2913
2981
|
node?.focus();
|
|
2914
2982
|
}, [effectiveFocusDay, month, year]);
|
|
2915
|
-
const moveFocus = (0,
|
|
2983
|
+
const moveFocus = (0, import_react50.useCallback)(
|
|
2916
2984
|
(next) => {
|
|
2917
2985
|
setFocusedDate(next);
|
|
2918
2986
|
shouldFocusRef.current = true;
|
|
@@ -2924,7 +2992,7 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
2924
2992
|
},
|
|
2925
2993
|
[month, year, setVisible]
|
|
2926
2994
|
);
|
|
2927
|
-
const onCellKeyDown = (0,
|
|
2995
|
+
const onCellKeyDown = (0, import_react50.useCallback)(
|
|
2928
2996
|
(e, day) => {
|
|
2929
2997
|
const current = new Date(year, month, day);
|
|
2930
2998
|
let next = null;
|
|
@@ -2976,7 +3044,7 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
2976
3044
|
},
|
|
2977
3045
|
[month, year, moveFocus]
|
|
2978
3046
|
);
|
|
2979
|
-
return /* @__PURE__ */ (0,
|
|
3047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
2980
3048
|
"div",
|
|
2981
3049
|
{
|
|
2982
3050
|
ref,
|
|
@@ -2988,14 +3056,14 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
2988
3056
|
),
|
|
2989
3057
|
...props,
|
|
2990
3058
|
children: [
|
|
2991
|
-
/* @__PURE__ */ (0,
|
|
2992
|
-
/* @__PURE__ */ (0,
|
|
3059
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
3060
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "text-[13px] font-medium", "aria-live": "polite", children: [
|
|
2993
3061
|
MONTHS[month],
|
|
2994
3062
|
" ",
|
|
2995
3063
|
year
|
|
2996
3064
|
] }),
|
|
2997
|
-
/* @__PURE__ */ (0,
|
|
2998
|
-
/* @__PURE__ */ (0,
|
|
3065
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-1", children: [
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2999
3067
|
IconButton,
|
|
3000
3068
|
{
|
|
3001
3069
|
size: "sm",
|
|
@@ -3005,11 +3073,11 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
3005
3073
|
onClick: goPrev
|
|
3006
3074
|
}
|
|
3007
3075
|
),
|
|
3008
|
-
/* @__PURE__ */ (0,
|
|
3076
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(IconButton, { size: "sm", variant: "ghost", icon: "\u203A", "aria-label": "Next month", onClick: goNext })
|
|
3009
3077
|
] })
|
|
3010
3078
|
] }),
|
|
3011
|
-
/* @__PURE__ */ (0,
|
|
3012
|
-
/* @__PURE__ */ (0,
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { role: "grid", "aria-label": `${MONTHS[month]} ${year}`, className: "flex flex-col gap-[2px]", children: [
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { role: "row", className: "grid grid-cols-7 gap-[2px]", children: DAYS.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3013
3081
|
"div",
|
|
3014
3082
|
{
|
|
3015
3083
|
role: "columnheader",
|
|
@@ -3029,7 +3097,7 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
3029
3097
|
const cellIndex = r * 7 + c;
|
|
3030
3098
|
const dayNum = cellIndex - firstDayOfMonth + 1;
|
|
3031
3099
|
if (dayNum < 1 || dayNum > daysInMonth) {
|
|
3032
|
-
cells.push(/* @__PURE__ */ (0,
|
|
3100
|
+
cells.push(/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { role: "gridcell", "aria-hidden": true }, `pad-${r}-${c}`));
|
|
3033
3101
|
continue;
|
|
3034
3102
|
}
|
|
3035
3103
|
const date = new Date(year, month, dayNum);
|
|
@@ -3039,7 +3107,7 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
3039
3107
|
const isFocused = dayNum === effectiveFocusDay;
|
|
3040
3108
|
const day = dayNum;
|
|
3041
3109
|
cells.push(
|
|
3042
|
-
/* @__PURE__ */ (0,
|
|
3110
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { role: "gridcell", "aria-selected": isSelected, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3043
3111
|
"button",
|
|
3044
3112
|
{
|
|
3045
3113
|
ref: (node) => {
|
|
@@ -3070,7 +3138,7 @@ var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
|
3070
3138
|
);
|
|
3071
3139
|
}
|
|
3072
3140
|
rows.push(
|
|
3073
|
-
/* @__PURE__ */ (0,
|
|
3141
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { role: "row", className: "grid grid-cols-7 gap-[2px]", children: cells }, `row-${r}`)
|
|
3074
3142
|
);
|
|
3075
3143
|
}
|
|
3076
3144
|
return rows;
|
|
@@ -3084,10 +3152,10 @@ Calendar.displayName = "Calendar";
|
|
|
3084
3152
|
|
|
3085
3153
|
// src/patterns/DatePicker/DatePicker.tsx
|
|
3086
3154
|
var RadixPopover2 = __toESM(require("@radix-ui/react-popover"), 1);
|
|
3087
|
-
var
|
|
3088
|
-
var
|
|
3155
|
+
var import_react51 = require("react");
|
|
3156
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3089
3157
|
var defaultFormat = (d) => d.toLocaleDateString();
|
|
3090
|
-
var DatePicker = (0,
|
|
3158
|
+
var DatePicker = (0, import_react51.forwardRef)(function DatePicker2({
|
|
3091
3159
|
value: valueProp,
|
|
3092
3160
|
defaultValue,
|
|
3093
3161
|
onValueChange,
|
|
@@ -3101,14 +3169,14 @@ var DatePicker = (0, import_react50.forwardRef)(function DatePicker2({
|
|
|
3101
3169
|
id,
|
|
3102
3170
|
name
|
|
3103
3171
|
}, ref) {
|
|
3104
|
-
const [open, setOpen] = (0,
|
|
3172
|
+
const [open, setOpen] = (0, import_react51.useState)(false);
|
|
3105
3173
|
const [value, setValue] = useControllableState({
|
|
3106
3174
|
value: valueProp,
|
|
3107
3175
|
defaultValue,
|
|
3108
3176
|
onChange: onValueChange
|
|
3109
3177
|
});
|
|
3110
|
-
return /* @__PURE__ */ (0,
|
|
3111
|
-
/* @__PURE__ */ (0,
|
|
3178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(RadixPopover2.Root, { open, onOpenChange: setOpen, children: [
|
|
3179
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(RadixPopover2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3112
3180
|
"button",
|
|
3113
3181
|
{
|
|
3114
3182
|
ref,
|
|
@@ -3125,18 +3193,18 @@ var DatePicker = (0, import_react50.forwardRef)(function DatePicker2({
|
|
|
3125
3193
|
),
|
|
3126
3194
|
style: { width },
|
|
3127
3195
|
children: [
|
|
3128
|
-
/* @__PURE__ */ (0,
|
|
3129
|
-
/* @__PURE__ */ (0,
|
|
3196
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { "aria-hidden": true, className: "text-text-dim", children: "\u25A2" }),
|
|
3197
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: cn("flex-1 truncate", !value && "text-text-dim"), children: value ? format(value) : emptyLabel ?? placeholder })
|
|
3130
3198
|
]
|
|
3131
3199
|
}
|
|
3132
3200
|
) }),
|
|
3133
|
-
/* @__PURE__ */ (0,
|
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(RadixPopover2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3134
3202
|
RadixPopover2.Content,
|
|
3135
3203
|
{
|
|
3136
3204
|
align: "start",
|
|
3137
3205
|
sideOffset: 6,
|
|
3138
3206
|
className: "z-popover outline-none data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
3139
|
-
children: /* @__PURE__ */ (0,
|
|
3207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3140
3208
|
Calendar,
|
|
3141
3209
|
{
|
|
3142
3210
|
value,
|
|
@@ -3151,17 +3219,17 @@ var DatePicker = (0, import_react50.forwardRef)(function DatePicker2({
|
|
|
3151
3219
|
)
|
|
3152
3220
|
}
|
|
3153
3221
|
) }),
|
|
3154
|
-
name && /* @__PURE__ */ (0,
|
|
3222
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("input", { type: "hidden", name, value: value ? value.toISOString() : "", readOnly: true })
|
|
3155
3223
|
] });
|
|
3156
3224
|
});
|
|
3157
3225
|
DatePicker.displayName = "DatePicker";
|
|
3158
3226
|
|
|
3159
3227
|
// src/patterns/Dots/Dots.tsx
|
|
3160
|
-
var
|
|
3161
|
-
var
|
|
3162
|
-
var Dots = (0,
|
|
3228
|
+
var import_react52 = require("react");
|
|
3229
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3230
|
+
var Dots = (0, import_react52.forwardRef)(function Dots2({ total, current, onChange, className, "aria-label": ariaLabel = "Progress", ...props }, ref) {
|
|
3163
3231
|
const interactive = typeof onChange === "function";
|
|
3164
|
-
return /* @__PURE__ */ (0,
|
|
3232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3165
3233
|
"nav",
|
|
3166
3234
|
{
|
|
3167
3235
|
ref,
|
|
@@ -3175,7 +3243,7 @@ var Dots = (0, import_react51.forwardRef)(function Dots2({ total, current, onCha
|
|
|
3175
3243
|
isActive ? "w-[18px] bg-accent" : "w-[6px] bg-panel-2"
|
|
3176
3244
|
);
|
|
3177
3245
|
if (interactive) {
|
|
3178
|
-
return /* @__PURE__ */ (0,
|
|
3246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3179
3247
|
"button",
|
|
3180
3248
|
{
|
|
3181
3249
|
type: "button",
|
|
@@ -3192,7 +3260,7 @@ var Dots = (0, import_react51.forwardRef)(function Dots2({ total, current, onCha
|
|
|
3192
3260
|
i
|
|
3193
3261
|
);
|
|
3194
3262
|
}
|
|
3195
|
-
return /* @__PURE__ */ (0,
|
|
3263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "aria-hidden": true, className: sharedClass }, i);
|
|
3196
3264
|
})
|
|
3197
3265
|
}
|
|
3198
3266
|
);
|
|
@@ -3200,13 +3268,13 @@ var Dots = (0, import_react51.forwardRef)(function Dots2({ total, current, onCha
|
|
|
3200
3268
|
Dots.displayName = "Dots";
|
|
3201
3269
|
|
|
3202
3270
|
// src/patterns/Dropzone/Dropzone.tsx
|
|
3203
|
-
var
|
|
3204
|
-
var
|
|
3271
|
+
var import_react53 = require("react");
|
|
3272
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3205
3273
|
function listToArray(list) {
|
|
3206
3274
|
if (!list) return [];
|
|
3207
3275
|
return Array.from(list);
|
|
3208
3276
|
}
|
|
3209
|
-
var Dropzone = (0,
|
|
3277
|
+
var Dropzone = (0, import_react53.forwardRef)(function Dropzone2({
|
|
3210
3278
|
onFiles,
|
|
3211
3279
|
accept,
|
|
3212
3280
|
multiple = true,
|
|
@@ -3217,7 +3285,7 @@ var Dropzone = (0, import_react52.forwardRef)(function Dropzone2({
|
|
|
3217
3285
|
className,
|
|
3218
3286
|
...props
|
|
3219
3287
|
}, ref) {
|
|
3220
|
-
const [isDragging, setIsDragging] = (0,
|
|
3288
|
+
const [isDragging, setIsDragging] = (0, import_react53.useState)(false);
|
|
3221
3289
|
const onDragOver = (e) => {
|
|
3222
3290
|
if (disabled) return;
|
|
3223
3291
|
e.preventDefault();
|
|
@@ -3231,7 +3299,7 @@ var Dropzone = (0, import_react52.forwardRef)(function Dropzone2({
|
|
|
3231
3299
|
const files = listToArray(e.dataTransfer.files);
|
|
3232
3300
|
if (files.length) onFiles?.(files);
|
|
3233
3301
|
};
|
|
3234
|
-
return /* @__PURE__ */ (0,
|
|
3302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3235
3303
|
"label",
|
|
3236
3304
|
{
|
|
3237
3305
|
ref,
|
|
@@ -3248,7 +3316,7 @@ var Dropzone = (0, import_react52.forwardRef)(function Dropzone2({
|
|
|
3248
3316
|
),
|
|
3249
3317
|
...props,
|
|
3250
3318
|
children: [
|
|
3251
|
-
/* @__PURE__ */ (0,
|
|
3319
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3252
3320
|
"input",
|
|
3253
3321
|
{
|
|
3254
3322
|
type: "file",
|
|
@@ -3264,7 +3332,7 @@ var Dropzone = (0, import_react52.forwardRef)(function Dropzone2({
|
|
|
3264
3332
|
}
|
|
3265
3333
|
}
|
|
3266
3334
|
),
|
|
3267
|
-
/* @__PURE__ */ (0,
|
|
3335
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3268
3336
|
"div",
|
|
3269
3337
|
{
|
|
3270
3338
|
"aria-hidden": true,
|
|
@@ -3272,8 +3340,8 @@ var Dropzone = (0, import_react52.forwardRef)(function Dropzone2({
|
|
|
3272
3340
|
children: icon
|
|
3273
3341
|
}
|
|
3274
3342
|
),
|
|
3275
|
-
/* @__PURE__ */ (0,
|
|
3276
|
-
description && /* @__PURE__ */ (0,
|
|
3343
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "mb-1 text-[13px] font-medium", children: title }),
|
|
3344
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "text-text-dim text-[11px]", children: description })
|
|
3277
3345
|
]
|
|
3278
3346
|
}
|
|
3279
3347
|
);
|
|
@@ -3282,8 +3350,8 @@ Dropzone.displayName = "Dropzone";
|
|
|
3282
3350
|
|
|
3283
3351
|
// src/patterns/EmptyState/EmptyState.tsx
|
|
3284
3352
|
var import_class_variance_authority10 = require("class-variance-authority");
|
|
3285
|
-
var
|
|
3286
|
-
var
|
|
3353
|
+
var import_react54 = require("react");
|
|
3354
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3287
3355
|
var plateStyles = (0, import_class_variance_authority10.cva)("grid h-12 w-12 place-items-center rounded-base text-[22px]", {
|
|
3288
3356
|
variants: {
|
|
3289
3357
|
tone: {
|
|
@@ -3296,8 +3364,8 @@ var plateStyles = (0, import_class_variance_authority10.cva)("grid h-12 w-12 pla
|
|
|
3296
3364
|
},
|
|
3297
3365
|
defaultVariants: { tone: "neutral" }
|
|
3298
3366
|
});
|
|
3299
|
-
var EmptyState = (0,
|
|
3300
|
-
return /* @__PURE__ */ (0,
|
|
3367
|
+
var EmptyState = (0, import_react54.forwardRef)(function EmptyState2({ icon, title, description, action, chips, tone, className, ...props }, ref) {
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3301
3369
|
"div",
|
|
3302
3370
|
{
|
|
3303
3371
|
ref,
|
|
@@ -3307,10 +3375,10 @@ var EmptyState = (0, import_react53.forwardRef)(function EmptyState2({ icon, tit
|
|
|
3307
3375
|
),
|
|
3308
3376
|
...props,
|
|
3309
3377
|
children: [
|
|
3310
|
-
icon != null && /* @__PURE__ */ (0,
|
|
3311
|
-
/* @__PURE__ */ (0,
|
|
3312
|
-
description && /* @__PURE__ */ (0,
|
|
3313
|
-
chips && chips.length > 0 && /* @__PURE__ */ (0,
|
|
3378
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { "aria-hidden": true, className: plateStyles({ tone: tone ?? "neutral" }), children: icon }),
|
|
3379
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "text-[14px] font-medium", children: title }),
|
|
3380
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "text-text-muted max-w-[260px] text-[12px] leading-[1.5]", children: description }),
|
|
3381
|
+
chips && chips.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex w-full flex-col gap-1", children: chips.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3314
3382
|
"button",
|
|
3315
3383
|
{
|
|
3316
3384
|
type: "button",
|
|
@@ -3332,18 +3400,18 @@ var EmptyState = (0, import_react53.forwardRef)(function EmptyState2({ icon, tit
|
|
|
3332
3400
|
EmptyState.displayName = "EmptyState";
|
|
3333
3401
|
|
|
3334
3402
|
// src/patterns/FileChip/FileChip.tsx
|
|
3335
|
-
var
|
|
3336
|
-
var
|
|
3403
|
+
var import_react55 = require("react");
|
|
3404
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3337
3405
|
function deriveExt(name) {
|
|
3338
3406
|
const dot = name.lastIndexOf(".");
|
|
3339
3407
|
if (dot < 0) return "FILE";
|
|
3340
3408
|
return name.slice(dot + 1).slice(0, 4).toUpperCase();
|
|
3341
3409
|
}
|
|
3342
|
-
var FileChip = (0,
|
|
3410
|
+
var FileChip = (0, import_react55.forwardRef)(function FileChip2({ name, size, progress, icon, onRemove, failed, className, ...props }, ref) {
|
|
3343
3411
|
const ext = deriveExt(name);
|
|
3344
3412
|
const showProgress = typeof progress === "number";
|
|
3345
3413
|
const isComplete = showProgress && progress >= 100;
|
|
3346
|
-
return /* @__PURE__ */ (0,
|
|
3414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3347
3415
|
"div",
|
|
3348
3416
|
{
|
|
3349
3417
|
ref,
|
|
@@ -3353,7 +3421,7 @@ var FileChip = (0, import_react54.forwardRef)(function FileChip2({ name, size, p
|
|
|
3353
3421
|
),
|
|
3354
3422
|
...props,
|
|
3355
3423
|
children: [
|
|
3356
|
-
/* @__PURE__ */ (0,
|
|
3424
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3357
3425
|
"span",
|
|
3358
3426
|
{
|
|
3359
3427
|
"aria-hidden": true,
|
|
@@ -3361,17 +3429,17 @@ var FileChip = (0, import_react54.forwardRef)(function FileChip2({ name, size, p
|
|
|
3361
3429
|
children: icon ?? ext
|
|
3362
3430
|
}
|
|
3363
3431
|
),
|
|
3364
|
-
/* @__PURE__ */ (0,
|
|
3365
|
-
/* @__PURE__ */ (0,
|
|
3366
|
-
/* @__PURE__ */ (0,
|
|
3432
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
3433
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "truncate text-[12px] font-medium", children: name }),
|
|
3434
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: cn("font-mono text-[10px]", failed ? "text-err" : "text-text-dim"), children: [
|
|
3367
3435
|
size,
|
|
3368
|
-
showProgress && !isComplete && /* @__PURE__ */ (0,
|
|
3436
|
+
showProgress && !isComplete && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
3369
3437
|
" \xB7 ",
|
|
3370
3438
|
Math.round(progress),
|
|
3371
3439
|
"%"
|
|
3372
3440
|
] })
|
|
3373
3441
|
] }),
|
|
3374
|
-
showProgress && !isComplete && /* @__PURE__ */ (0,
|
|
3442
|
+
showProgress && !isComplete && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "bg-panel mt-1 h-[2px] overflow-hidden rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3375
3443
|
"div",
|
|
3376
3444
|
{
|
|
3377
3445
|
className: cn(
|
|
@@ -3382,7 +3450,7 @@ var FileChip = (0, import_react54.forwardRef)(function FileChip2({ name, size, p
|
|
|
3382
3450
|
}
|
|
3383
3451
|
) })
|
|
3384
3452
|
] }),
|
|
3385
|
-
onRemove && /* @__PURE__ */ (0,
|
|
3453
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3386
3454
|
"button",
|
|
3387
3455
|
{
|
|
3388
3456
|
type: "button",
|
|
@@ -3401,107 +3469,394 @@ var FileChip = (0, import_react54.forwardRef)(function FileChip2({ name, size, p
|
|
|
3401
3469
|
});
|
|
3402
3470
|
FileChip.displayName = "FileChip";
|
|
3403
3471
|
|
|
3404
|
-
// src/patterns/
|
|
3405
|
-
var
|
|
3406
|
-
var
|
|
3407
|
-
var
|
|
3408
|
-
var
|
|
3409
|
-
|
|
3410
|
-
|
|
3472
|
+
// src/patterns/FilterPanel/FilterPanel.tsx
|
|
3473
|
+
var import_react56 = require("react");
|
|
3474
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3475
|
+
var EMPTY = Object.freeze({});
|
|
3476
|
+
var FilterPanel = (0, import_react56.forwardRef)(function FilterPanel2({
|
|
3477
|
+
facets,
|
|
3478
|
+
value,
|
|
3479
|
+
defaultValue,
|
|
3480
|
+
onValueChange,
|
|
3481
|
+
onReset,
|
|
3482
|
+
counts,
|
|
3483
|
+
title = "Filter",
|
|
3484
|
+
resetLabel = "Reset",
|
|
3485
|
+
className,
|
|
3486
|
+
...props
|
|
3487
|
+
}, ref) {
|
|
3488
|
+
const [selection, setSelection] = useControllableState({
|
|
3489
|
+
value,
|
|
3490
|
+
defaultValue: defaultValue ?? EMPTY,
|
|
3491
|
+
onChange: onValueChange
|
|
3492
|
+
});
|
|
3493
|
+
const total = facets.reduce((sum, facet) => sum + (selection[facet.id]?.length ?? 0), 0);
|
|
3494
|
+
const toggle = (0, import_react56.useCallback)(
|
|
3495
|
+
(facetId, optionValue, next) => {
|
|
3496
|
+
setSelection((prev) => {
|
|
3497
|
+
const current = prev?.[facetId] ?? [];
|
|
3498
|
+
const filtered = current.filter((v) => v !== optionValue);
|
|
3499
|
+
const updated = next ? [...filtered, optionValue] : filtered;
|
|
3500
|
+
return { ...prev ?? {}, [facetId]: updated };
|
|
3501
|
+
});
|
|
3502
|
+
},
|
|
3503
|
+
[setSelection]
|
|
3504
|
+
);
|
|
3505
|
+
const handleReset = (0, import_react56.useCallback)(() => {
|
|
3506
|
+
setSelection(EMPTY);
|
|
3507
|
+
onReset?.();
|
|
3508
|
+
}, [setSelection, onReset]);
|
|
3509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3510
|
+
"div",
|
|
3411
3511
|
{
|
|
3412
3512
|
ref,
|
|
3513
|
+
role: "group",
|
|
3514
|
+
"aria-label": typeof title === "string" ? title : void 0,
|
|
3413
3515
|
className: cn(
|
|
3414
|
-
"border-border bg-panel flex
|
|
3516
|
+
"rounded-base border-border bg-panel flex w-[260px] flex-col gap-3 border p-4",
|
|
3415
3517
|
className
|
|
3416
3518
|
),
|
|
3417
|
-
...props
|
|
3519
|
+
...props,
|
|
3520
|
+
children: [
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-text-dim font-mono text-[10px] tracking-[1.4px] uppercase", children: title }),
|
|
3523
|
+
total > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge, { size: "sm", variant: "accent", children: total }),
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3525
|
+
Button,
|
|
3526
|
+
{
|
|
3527
|
+
type: "button",
|
|
3528
|
+
variant: "ghost",
|
|
3529
|
+
size: "sm",
|
|
3530
|
+
onClick: handleReset,
|
|
3531
|
+
disabled: total === 0,
|
|
3532
|
+
className: "ml-auto",
|
|
3533
|
+
children: resetLabel
|
|
3534
|
+
}
|
|
3535
|
+
)
|
|
3536
|
+
] }),
|
|
3537
|
+
facets.map((facet) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3538
|
+
FilterFacetGroup,
|
|
3539
|
+
{
|
|
3540
|
+
facet,
|
|
3541
|
+
selected: selection[facet.id] ?? [],
|
|
3542
|
+
counts: counts?.[facet.id],
|
|
3543
|
+
onToggle: toggle
|
|
3544
|
+
},
|
|
3545
|
+
facet.id
|
|
3546
|
+
))
|
|
3547
|
+
]
|
|
3418
3548
|
}
|
|
3419
3549
|
);
|
|
3420
3550
|
});
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3551
|
+
FilterPanel.displayName = "FilterPanel";
|
|
3552
|
+
function FilterFacetGroup({ facet, selected, counts, onToggle }) {
|
|
3553
|
+
const collapsible = facet.collapsible ?? true;
|
|
3554
|
+
const [open, setOpen] = (0, import_react56.useState)(facet.defaultOpen ?? true);
|
|
3555
|
+
const isOpen = !collapsible || open;
|
|
3556
|
+
const selectedCount = selected.length;
|
|
3557
|
+
const headingClass = "text-text-muted flex items-center gap-[6px] font-mono text-[10px] tracking-[1.4px] uppercase";
|
|
3558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: "flex flex-col gap-1", children: [
|
|
3559
|
+
collapsible ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3560
|
+
"button",
|
|
3427
3561
|
{
|
|
3428
|
-
|
|
3562
|
+
type: "button",
|
|
3563
|
+
"aria-expanded": isOpen,
|
|
3564
|
+
onClick: () => setOpen((v) => !v),
|
|
3429
3565
|
className: cn(
|
|
3430
|
-
|
|
3431
|
-
"
|
|
3432
|
-
"data-[state=open]:bg-panel-2 hover:bg-panel-2",
|
|
3566
|
+
headingClass,
|
|
3567
|
+
"cursor-pointer rounded-xs px-1 py-[2px] outline-none",
|
|
3433
3568
|
"focus-visible:ring-accent-dim focus-visible:ring-[3px]",
|
|
3434
|
-
|
|
3569
|
+
"hover:text-text"
|
|
3435
3570
|
),
|
|
3436
|
-
|
|
3571
|
+
children: [
|
|
3572
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "flex-1 text-left", children: facet.label }),
|
|
3573
|
+
selectedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge, { size: "sm", variant: "neutral", children: selectedCount }),
|
|
3574
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": true, className: "text-[10px] opacity-70", children: isOpen ? "\u25BE" : "\u25B8" })
|
|
3575
|
+
]
|
|
3437
3576
|
}
|
|
3438
|
-
)
|
|
3439
|
-
|
|
3440
|
-
)
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
className
|
|
3577
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn(headingClass, "px-1 py-[2px]"), children: [
|
|
3578
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "flex-1", children: facet.label }),
|
|
3579
|
+
selectedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Badge, { size: "sm", variant: "neutral", children: selectedCount })
|
|
3580
|
+
] }),
|
|
3581
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "m-0 flex list-none flex-col gap-[2px] p-0", children: facet.options.map((option) => {
|
|
3582
|
+
const isSelected = selected.includes(option.value);
|
|
3583
|
+
const count = counts?.[option.value];
|
|
3584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("li", { className: "flex items-center gap-2 px-1 py-[3px]", children: [
|
|
3585
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3586
|
+
Checkbox,
|
|
3587
|
+
{
|
|
3588
|
+
checked: isSelected,
|
|
3589
|
+
onCheckedChange: (next) => onToggle(facet.id, option.value, next === true),
|
|
3590
|
+
label: option.label
|
|
3591
|
+
}
|
|
3454
3592
|
),
|
|
3455
|
-
|
|
3456
|
-
}
|
|
3457
|
-
) })
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
|
-
MenubarContent.displayName = "MenubarContent";
|
|
3461
|
-
var itemBase3 = cn(
|
|
3462
|
-
"flex items-center gap-2 rounded-sm px-[10px] py-[6px] text-[12px] cursor-pointer outline-none",
|
|
3463
|
-
"data-[highlighted]:bg-panel-2",
|
|
3464
|
-
"data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed"
|
|
3465
|
-
);
|
|
3466
|
-
var MenubarItem = (0, import_react55.forwardRef)(function MenubarItem2({ trailing, destructive, className, children, ...props }, ref) {
|
|
3467
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3468
|
-
RadixMenubar.Item,
|
|
3469
|
-
{
|
|
3470
|
-
ref,
|
|
3471
|
-
className: cn(itemBase3, destructive ? "text-err" : "text-text", className),
|
|
3472
|
-
...props,
|
|
3473
|
-
children: [
|
|
3474
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "flex-1", children }),
|
|
3475
|
-
trailing && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: trailing })
|
|
3476
|
-
]
|
|
3477
|
-
}
|
|
3478
|
-
);
|
|
3479
|
-
});
|
|
3480
|
-
MenubarItem.displayName = "MenubarItem";
|
|
3481
|
-
var MenubarSeparator = (0, import_react55.forwardRef)(
|
|
3482
|
-
function MenubarSeparator2({ className, ...props }, ref) {
|
|
3483
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3484
|
-
RadixMenubar.Separator,
|
|
3485
|
-
{
|
|
3486
|
-
ref,
|
|
3487
|
-
className: cn("bg-border my-1 h-px", className),
|
|
3488
|
-
...props
|
|
3489
|
-
}
|
|
3490
|
-
);
|
|
3491
|
-
}
|
|
3492
|
-
);
|
|
3493
|
-
MenubarSeparator.displayName = "MenubarSeparator";
|
|
3593
|
+
typeof count === "number" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-text-dim ml-auto font-mono text-[10px] tabular-nums", children: count })
|
|
3594
|
+
] }, option.value);
|
|
3595
|
+
}) })
|
|
3596
|
+
] });
|
|
3597
|
+
}
|
|
3494
3598
|
|
|
3495
|
-
// src/patterns/
|
|
3496
|
-
var
|
|
3497
|
-
var import_react57 = require("react");
|
|
3599
|
+
// src/patterns/HealthScore/HealthScore.tsx
|
|
3600
|
+
var import_react58 = require("react");
|
|
3498
3601
|
|
|
3499
|
-
// src/patterns/
|
|
3500
|
-
var
|
|
3501
|
-
var
|
|
3502
|
-
var
|
|
3503
|
-
|
|
3504
|
-
|
|
3602
|
+
// src/patterns/RadialProgress/RadialProgress.tsx
|
|
3603
|
+
var import_react57 = require("react");
|
|
3604
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3605
|
+
var toneStrokeClass = {
|
|
3606
|
+
accent: "stroke-accent",
|
|
3607
|
+
ok: "stroke-ok",
|
|
3608
|
+
warn: "stroke-warn",
|
|
3609
|
+
err: "stroke-err"
|
|
3610
|
+
};
|
|
3611
|
+
var RadialProgress = (0, import_react57.forwardRef)(
|
|
3612
|
+
function RadialProgress2({
|
|
3613
|
+
value,
|
|
3614
|
+
max = 100,
|
|
3615
|
+
size = 64,
|
|
3616
|
+
thickness = 4,
|
|
3617
|
+
tone,
|
|
3618
|
+
children,
|
|
3619
|
+
className,
|
|
3620
|
+
"aria-label": ariaLabel,
|
|
3621
|
+
...props
|
|
3622
|
+
}, ref) {
|
|
3623
|
+
const clamped = Math.min(max, Math.max(0, value));
|
|
3624
|
+
const pct = max > 0 ? clamped / max * 100 : 0;
|
|
3625
|
+
const r = (size - thickness) / 2;
|
|
3626
|
+
const c = 2 * Math.PI * r;
|
|
3627
|
+
const dash = pct / 100 * c;
|
|
3628
|
+
const resolvedTone = tone ?? (clamped >= max ? "ok" : "accent");
|
|
3629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
3630
|
+
"div",
|
|
3631
|
+
{
|
|
3632
|
+
ref,
|
|
3633
|
+
role: "progressbar",
|
|
3634
|
+
"aria-valuemin": 0,
|
|
3635
|
+
"aria-valuemax": max,
|
|
3636
|
+
"aria-valuenow": Math.round(pct),
|
|
3637
|
+
"aria-label": ariaLabel ?? `${Math.round(pct)}%`,
|
|
3638
|
+
className: cn("relative inline-grid place-items-center", className),
|
|
3639
|
+
style: { width: size, height: size },
|
|
3640
|
+
...props,
|
|
3641
|
+
children: [
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, children: [
|
|
3643
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3644
|
+
"circle",
|
|
3645
|
+
{
|
|
3646
|
+
cx: size / 2,
|
|
3647
|
+
cy: size / 2,
|
|
3648
|
+
r,
|
|
3649
|
+
fill: "none",
|
|
3650
|
+
strokeWidth: thickness,
|
|
3651
|
+
className: "stroke-panel-2"
|
|
3652
|
+
}
|
|
3653
|
+
),
|
|
3654
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3655
|
+
"circle",
|
|
3656
|
+
{
|
|
3657
|
+
cx: size / 2,
|
|
3658
|
+
cy: size / 2,
|
|
3659
|
+
r,
|
|
3660
|
+
fill: "none",
|
|
3661
|
+
strokeWidth: thickness,
|
|
3662
|
+
strokeLinecap: "round",
|
|
3663
|
+
strokeDasharray: `${dash} ${c}`,
|
|
3664
|
+
transform: `rotate(-90 ${size / 2} ${size / 2})`,
|
|
3665
|
+
className: cn(
|
|
3666
|
+
"transition-[stroke-dasharray] duration-(--duration-step)",
|
|
3667
|
+
toneStrokeClass[resolvedTone]
|
|
3668
|
+
)
|
|
3669
|
+
}
|
|
3670
|
+
)
|
|
3671
|
+
] }),
|
|
3672
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "absolute inset-0 grid place-items-center font-mono text-[11px] font-medium tabular-nums", children: children ?? `${Math.round(pct)}%` })
|
|
3673
|
+
]
|
|
3674
|
+
}
|
|
3675
|
+
);
|
|
3676
|
+
}
|
|
3677
|
+
);
|
|
3678
|
+
RadialProgress.displayName = "RadialProgress";
|
|
3679
|
+
|
|
3680
|
+
// src/patterns/HealthScore/HealthScore.tsx
|
|
3681
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3682
|
+
function deltaTone(delta) {
|
|
3683
|
+
if (delta > 0) return "ok";
|
|
3684
|
+
if (delta < 0) return "err";
|
|
3685
|
+
return "accent";
|
|
3686
|
+
}
|
|
3687
|
+
function deltaGlyph(delta) {
|
|
3688
|
+
if (delta > 0) return "\u2191";
|
|
3689
|
+
if (delta < 0) return "\u2193";
|
|
3690
|
+
return "\xB7";
|
|
3691
|
+
}
|
|
3692
|
+
var toneTextClass = {
|
|
3693
|
+
accent: "text-text-muted",
|
|
3694
|
+
ok: "text-ok",
|
|
3695
|
+
warn: "text-warn",
|
|
3696
|
+
err: "text-err"
|
|
3697
|
+
};
|
|
3698
|
+
var HealthScore = (0, import_react58.forwardRef)(function HealthScore2({
|
|
3699
|
+
value,
|
|
3700
|
+
max = 100,
|
|
3701
|
+
delta,
|
|
3702
|
+
label,
|
|
3703
|
+
breakdown,
|
|
3704
|
+
size = 72,
|
|
3705
|
+
tone,
|
|
3706
|
+
className,
|
|
3707
|
+
"aria-label": ariaLabel,
|
|
3708
|
+
...props
|
|
3709
|
+
}, ref) {
|
|
3710
|
+
const pct = max > 0 ? Math.round(Math.min(max, Math.max(0, value)) / max * 100) : 0;
|
|
3711
|
+
const resolvedTone = tone ?? (pct >= 80 ? "ok" : pct >= 50 ? "accent" : "warn");
|
|
3712
|
+
const indicatorTone = typeof delta === "number" ? deltaTone(delta) : "accent";
|
|
3713
|
+
const core = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
3714
|
+
"div",
|
|
3715
|
+
{
|
|
3716
|
+
ref,
|
|
3717
|
+
className: cn("inline-flex flex-col items-center gap-1", className),
|
|
3718
|
+
"aria-label": ariaLabel ?? `${pct}% health`,
|
|
3719
|
+
...props,
|
|
3720
|
+
children: [
|
|
3721
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RadialProgress, { value, max, size, tone: resolvedTone }),
|
|
3722
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "text-text-muted mt-1 text-[12px] leading-tight", children: label }),
|
|
3723
|
+
typeof delta === "number" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cn("font-mono text-[11px] tabular-nums", toneTextClass[indicatorTone]), children: [
|
|
3724
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": true, children: deltaGlyph(delta) }),
|
|
3725
|
+
" ",
|
|
3726
|
+
Math.abs(delta)
|
|
3727
|
+
] })
|
|
3728
|
+
]
|
|
3729
|
+
}
|
|
3730
|
+
);
|
|
3731
|
+
if (!breakdown || breakdown.length === 0) {
|
|
3732
|
+
return core;
|
|
3733
|
+
}
|
|
3734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3735
|
+
HoverCard,
|
|
3736
|
+
{
|
|
3737
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "inline-flex", children: core }),
|
|
3738
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex min-w-[180px] flex-col gap-2", children: [
|
|
3739
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "text-text-dim font-mono text-[9px] tracking-[1.4px] uppercase", children: "Breakdown" }),
|
|
3740
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className: "m-0 flex list-none flex-col gap-1 p-0 text-[12px]", children: breakdown.map((entry, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("li", { className: "flex items-center gap-2", children: [
|
|
3741
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-text-muted flex-1 truncate", children: entry.label }),
|
|
3742
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3743
|
+
"span",
|
|
3744
|
+
{
|
|
3745
|
+
className: cn(
|
|
3746
|
+
"font-mono tabular-nums",
|
|
3747
|
+
entry.tone ? toneTextClass[entry.tone] : "text-text"
|
|
3748
|
+
),
|
|
3749
|
+
children: entry.value
|
|
3750
|
+
}
|
|
3751
|
+
)
|
|
3752
|
+
] }, i)) })
|
|
3753
|
+
] })
|
|
3754
|
+
}
|
|
3755
|
+
);
|
|
3756
|
+
});
|
|
3757
|
+
HealthScore.displayName = "HealthScore";
|
|
3758
|
+
|
|
3759
|
+
// src/patterns/Menubar/Menubar.tsx
|
|
3760
|
+
var RadixMenubar = __toESM(require("@radix-ui/react-menubar"), 1);
|
|
3761
|
+
var import_react59 = require("react");
|
|
3762
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3763
|
+
var Menubar = (0, import_react59.forwardRef)(function Menubar2({ className, ...props }, ref) {
|
|
3764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3765
|
+
RadixMenubar.Root,
|
|
3766
|
+
{
|
|
3767
|
+
ref,
|
|
3768
|
+
className: cn(
|
|
3769
|
+
"border-border bg-panel flex h-[30px] items-center gap-[2px] border-b px-3",
|
|
3770
|
+
className
|
|
3771
|
+
),
|
|
3772
|
+
...props
|
|
3773
|
+
}
|
|
3774
|
+
);
|
|
3775
|
+
});
|
|
3776
|
+
Menubar.displayName = "Menubar";
|
|
3777
|
+
var MenubarMenu = RadixMenubar.Menu;
|
|
3778
|
+
var MenubarTrigger = (0, import_react59.forwardRef)(
|
|
3779
|
+
function MenubarTrigger2({ className, ...props }, ref) {
|
|
3780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3781
|
+
RadixMenubar.Trigger,
|
|
3782
|
+
{
|
|
3783
|
+
ref,
|
|
3784
|
+
className: cn(
|
|
3785
|
+
"text-text cursor-pointer rounded-xs border-0 bg-transparent px-[10px] py-1 text-[12px] outline-none",
|
|
3786
|
+
"transition-colors duration-(--duration-micro)",
|
|
3787
|
+
"data-[state=open]:bg-panel-2 hover:bg-panel-2",
|
|
3788
|
+
"focus-visible:ring-accent-dim focus-visible:ring-[3px]",
|
|
3789
|
+
className
|
|
3790
|
+
),
|
|
3791
|
+
...props
|
|
3792
|
+
}
|
|
3793
|
+
);
|
|
3794
|
+
}
|
|
3795
|
+
);
|
|
3796
|
+
MenubarTrigger.displayName = "MenubarTrigger";
|
|
3797
|
+
var MenubarContent = (0, import_react59.forwardRef)(
|
|
3798
|
+
function MenubarContent2({ className, sideOffset = 6, align = "start", ...props }, ref) {
|
|
3799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RadixMenubar.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3800
|
+
RadixMenubar.Content,
|
|
3801
|
+
{
|
|
3802
|
+
ref,
|
|
3803
|
+
sideOffset,
|
|
3804
|
+
align,
|
|
3805
|
+
className: cn(
|
|
3806
|
+
"border-border-strong bg-panel z-popover min-w-[180px] rounded-md border p-1 shadow-lg outline-none",
|
|
3807
|
+
"data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
3808
|
+
className
|
|
3809
|
+
),
|
|
3810
|
+
...props
|
|
3811
|
+
}
|
|
3812
|
+
) });
|
|
3813
|
+
}
|
|
3814
|
+
);
|
|
3815
|
+
MenubarContent.displayName = "MenubarContent";
|
|
3816
|
+
var itemBase3 = cn(
|
|
3817
|
+
"flex items-center gap-2 rounded-sm px-[10px] py-[6px] text-[12px] cursor-pointer outline-none",
|
|
3818
|
+
"data-[highlighted]:bg-panel-2",
|
|
3819
|
+
"data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed"
|
|
3820
|
+
);
|
|
3821
|
+
var MenubarItem = (0, import_react59.forwardRef)(function MenubarItem2({ trailing, destructive, className, children, ...props }, ref) {
|
|
3822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
3823
|
+
RadixMenubar.Item,
|
|
3824
|
+
{
|
|
3825
|
+
ref,
|
|
3826
|
+
className: cn(itemBase3, destructive ? "text-err" : "text-text", className),
|
|
3827
|
+
...props,
|
|
3828
|
+
children: [
|
|
3829
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "flex-1", children }),
|
|
3830
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: trailing })
|
|
3831
|
+
]
|
|
3832
|
+
}
|
|
3833
|
+
);
|
|
3834
|
+
});
|
|
3835
|
+
MenubarItem.displayName = "MenubarItem";
|
|
3836
|
+
var MenubarSeparator = (0, import_react59.forwardRef)(
|
|
3837
|
+
function MenubarSeparator2({ className, ...props }, ref) {
|
|
3838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3839
|
+
RadixMenubar.Separator,
|
|
3840
|
+
{
|
|
3841
|
+
ref,
|
|
3842
|
+
className: cn("bg-border my-1 h-px", className),
|
|
3843
|
+
...props
|
|
3844
|
+
}
|
|
3845
|
+
);
|
|
3846
|
+
}
|
|
3847
|
+
);
|
|
3848
|
+
MenubarSeparator.displayName = "MenubarSeparator";
|
|
3849
|
+
|
|
3850
|
+
// src/patterns/NavBar/NavBar.tsx
|
|
3851
|
+
var RadixNav = __toESM(require("@radix-ui/react-navigation-menu"), 1);
|
|
3852
|
+
var import_react61 = require("react");
|
|
3853
|
+
|
|
3854
|
+
// src/patterns/Sidebar/Sidebar.tsx
|
|
3855
|
+
var import_react60 = require("react");
|
|
3856
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3857
|
+
var Sidebar = (0, import_react60.forwardRef)(function Sidebar2({ width = 240, className, style, ...props }, ref) {
|
|
3858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3859
|
+
"aside",
|
|
3505
3860
|
{
|
|
3506
3861
|
ref,
|
|
3507
3862
|
style: { width, ...style },
|
|
@@ -3514,12 +3869,12 @@ var Sidebar = (0, import_react56.forwardRef)(function Sidebar2({ width = 240, cl
|
|
|
3514
3869
|
);
|
|
3515
3870
|
});
|
|
3516
3871
|
Sidebar.displayName = "Sidebar";
|
|
3517
|
-
var NavItem = (0,
|
|
3872
|
+
var NavItem = (0, import_react60.forwardRef)(
|
|
3518
3873
|
function NavItem2({ icon, label, active, badge, href, disabled, className, ...props }, ref) {
|
|
3519
|
-
const inner = /* @__PURE__ */ (0,
|
|
3520
|
-
icon && /* @__PURE__ */ (0,
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
3522
|
-
badge != null && /* @__PURE__ */ (0,
|
|
3874
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
3875
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { "aria-hidden": true, className: "w-[14px] text-center opacity-80", children: icon }),
|
|
3876
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex-1 truncate", children: label }),
|
|
3877
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3523
3878
|
"span",
|
|
3524
3879
|
{
|
|
3525
3880
|
className: cn(
|
|
@@ -3540,7 +3895,7 @@ var NavItem = (0, import_react56.forwardRef)(
|
|
|
3540
3895
|
);
|
|
3541
3896
|
if (href) {
|
|
3542
3897
|
const anchorProps = props;
|
|
3543
|
-
return /* @__PURE__ */ (0,
|
|
3898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3544
3899
|
"a",
|
|
3545
3900
|
{
|
|
3546
3901
|
ref,
|
|
@@ -3554,7 +3909,7 @@ var NavItem = (0, import_react56.forwardRef)(
|
|
|
3554
3909
|
);
|
|
3555
3910
|
}
|
|
3556
3911
|
const buttonProps = props;
|
|
3557
|
-
return /* @__PURE__ */ (0,
|
|
3912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3558
3913
|
"button",
|
|
3559
3914
|
{
|
|
3560
3915
|
ref,
|
|
@@ -3569,7 +3924,7 @@ var NavItem = (0, import_react56.forwardRef)(
|
|
|
3569
3924
|
}
|
|
3570
3925
|
);
|
|
3571
3926
|
NavItem.displayName = "NavItem";
|
|
3572
|
-
var NavSection = (0,
|
|
3927
|
+
var NavSection = (0, import_react60.forwardRef)(function NavSection2({
|
|
3573
3928
|
label,
|
|
3574
3929
|
icon,
|
|
3575
3930
|
action,
|
|
@@ -3583,16 +3938,16 @@ var NavSection = (0, import_react56.forwardRef)(function NavSection2({
|
|
|
3583
3938
|
...props
|
|
3584
3939
|
}, ref) {
|
|
3585
3940
|
const isControlled = open !== void 0;
|
|
3586
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
3941
|
+
const [internalOpen, setInternalOpen] = (0, import_react60.useState)(defaultOpen);
|
|
3587
3942
|
const isOpen = !collapsible || (isControlled ? open : internalOpen);
|
|
3588
|
-
const toggle = (0,
|
|
3943
|
+
const toggle = (0, import_react60.useCallback)(() => {
|
|
3589
3944
|
const next = !isOpen;
|
|
3590
3945
|
if (!isControlled) setInternalOpen(next);
|
|
3591
3946
|
onOpenChange?.(next);
|
|
3592
3947
|
}, [isOpen, isControlled, onOpenChange]);
|
|
3593
3948
|
const eyebrowClass = "text-text-dim flex items-center gap-[6px] px-2 pt-2 font-mono text-[9px] tracking-[1.4px] uppercase";
|
|
3594
|
-
return /* @__PURE__ */ (0,
|
|
3595
|
-
collapsible ? /* @__PURE__ */ (0,
|
|
3949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { ref, className: cn("flex flex-col gap-1", className), ...props, children: [
|
|
3950
|
+
collapsible ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
3596
3951
|
"button",
|
|
3597
3952
|
{
|
|
3598
3953
|
type: "button",
|
|
@@ -3605,18 +3960,18 @@ var NavSection = (0, import_react56.forwardRef)(function NavSection2({
|
|
|
3605
3960
|
"hover:text-text-muted"
|
|
3606
3961
|
),
|
|
3607
3962
|
children: [
|
|
3608
|
-
icon != null && /* @__PURE__ */ (0,
|
|
3609
|
-
/* @__PURE__ */ (0,
|
|
3963
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { "aria-hidden": true, className: "opacity-80", children: icon }),
|
|
3964
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex-1 text-left", children: label }),
|
|
3610
3965
|
action,
|
|
3611
|
-
/* @__PURE__ */ (0,
|
|
3966
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { "aria-hidden": true, className: "text-[10px] opacity-70", children: isOpen ? "\u25BE" : "\u25B8" })
|
|
3612
3967
|
]
|
|
3613
3968
|
}
|
|
3614
|
-
) : /* @__PURE__ */ (0,
|
|
3615
|
-
icon != null && /* @__PURE__ */ (0,
|
|
3616
|
-
/* @__PURE__ */ (0,
|
|
3969
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: eyebrowClass, children: [
|
|
3970
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { "aria-hidden": true, className: "opacity-80", children: icon }),
|
|
3971
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "flex-1", children: label }),
|
|
3617
3972
|
action
|
|
3618
3973
|
] }),
|
|
3619
|
-
isOpen && /* @__PURE__ */ (0,
|
|
3974
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3620
3975
|
"div",
|
|
3621
3976
|
{
|
|
3622
3977
|
className: cn("flex flex-col gap-[2px]", indent > 0 && "border-border ml-2 border-l"),
|
|
@@ -3629,12 +3984,12 @@ var NavSection = (0, import_react56.forwardRef)(function NavSection2({
|
|
|
3629
3984
|
NavSection.displayName = "NavSection";
|
|
3630
3985
|
|
|
3631
3986
|
// src/patterns/NavBar/NavBar.tsx
|
|
3632
|
-
var
|
|
3987
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3633
3988
|
function isActiveTree(item, activeId) {
|
|
3634
3989
|
if (item.id === activeId) return true;
|
|
3635
3990
|
return item.children?.some((c) => isActiveTree(c, activeId)) ?? false;
|
|
3636
3991
|
}
|
|
3637
|
-
var NavBar = (0,
|
|
3992
|
+
var NavBar = (0, import_react61.forwardRef)(function NavBar2({
|
|
3638
3993
|
orientation = "horizontal",
|
|
3639
3994
|
items,
|
|
3640
3995
|
brand,
|
|
@@ -3648,17 +4003,17 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3648
4003
|
...props
|
|
3649
4004
|
}, ref) {
|
|
3650
4005
|
const isControlled = value !== void 0;
|
|
3651
|
-
const [internalValue, setInternalValue] = (0,
|
|
4006
|
+
const [internalValue, setInternalValue] = (0, import_react61.useState)(defaultValue);
|
|
3652
4007
|
const activeId = isControlled ? value : internalValue;
|
|
3653
|
-
const [drawerOpen, setDrawerOpen] = (0,
|
|
3654
|
-
const select = (0,
|
|
4008
|
+
const [drawerOpen, setDrawerOpen] = (0, import_react61.useState)(false);
|
|
4009
|
+
const select = (0, import_react61.useCallback)(
|
|
3655
4010
|
(id) => {
|
|
3656
4011
|
if (!isControlled) setInternalValue(id);
|
|
3657
4012
|
onValueChange?.(id);
|
|
3658
4013
|
},
|
|
3659
4014
|
[isControlled, onValueChange]
|
|
3660
4015
|
);
|
|
3661
|
-
const handleItemActivate = (0,
|
|
4016
|
+
const handleItemActivate = (0, import_react61.useCallback)(
|
|
3662
4017
|
(id) => {
|
|
3663
4018
|
select(id);
|
|
3664
4019
|
setDrawerOpen(false);
|
|
@@ -3670,7 +4025,7 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3670
4025
|
// drawer is open on a viewport that's resizing past `md`, both navs can
|
|
3671
4026
|
// sit in the DOM together. Identical accessible names would trip axe's
|
|
3672
4027
|
// `landmark-unique` rule.
|
|
3673
|
-
/* @__PURE__ */ (0,
|
|
4028
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("nav", { "aria-label": "Mobile navigation", className: "flex flex-col gap-1", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3674
4029
|
VerticalItem,
|
|
3675
4030
|
{
|
|
3676
4031
|
item,
|
|
@@ -3680,14 +4035,14 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3680
4035
|
item.id
|
|
3681
4036
|
)) })
|
|
3682
4037
|
);
|
|
3683
|
-
const mobileBar = responsive ? /* @__PURE__ */ (0,
|
|
4038
|
+
const mobileBar = responsive ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3684
4039
|
"div",
|
|
3685
4040
|
{
|
|
3686
4041
|
className: cn(
|
|
3687
4042
|
"border-border bg-panel z-overlay sticky top-0 flex h-[52px] items-center gap-4 border-b px-5 md:hidden"
|
|
3688
4043
|
),
|
|
3689
4044
|
children: [
|
|
3690
|
-
/* @__PURE__ */ (0,
|
|
4045
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3691
4046
|
"button",
|
|
3692
4047
|
{
|
|
3693
4048
|
type: "button",
|
|
@@ -3697,15 +4052,15 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3697
4052
|
children: "\u2630"
|
|
3698
4053
|
}
|
|
3699
4054
|
),
|
|
3700
|
-
brand && /* @__PURE__ */ (0,
|
|
3701
|
-
actions && /* @__PURE__ */ (0,
|
|
4055
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex flex-1 items-center text-[13px] font-medium whitespace-nowrap", children: brand }),
|
|
4056
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex items-center gap-3", children: actions })
|
|
3702
4057
|
]
|
|
3703
4058
|
}
|
|
3704
4059
|
) : null;
|
|
3705
4060
|
if (orientation === "horizontal") {
|
|
3706
|
-
return /* @__PURE__ */ (0,
|
|
4061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
3707
4062
|
mobileBar,
|
|
3708
|
-
/* @__PURE__ */ (0,
|
|
4063
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3709
4064
|
"header",
|
|
3710
4065
|
{
|
|
3711
4066
|
ref,
|
|
@@ -3716,10 +4071,10 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3716
4071
|
),
|
|
3717
4072
|
...props,
|
|
3718
4073
|
children: [
|
|
3719
|
-
brand && /* @__PURE__ */ (0,
|
|
3720
|
-
/* @__PURE__ */ (0,
|
|
3721
|
-
/* @__PURE__ */ (0,
|
|
3722
|
-
(item) => item.children?.length ? /* @__PURE__ */ (0,
|
|
4074
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "shrink-0 text-[13px] font-medium whitespace-nowrap", children: brand }),
|
|
4075
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(RadixNav.Root, { className: "relative flex-1", delayDuration: 120, children: [
|
|
4076
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RadixNav.List, { className: "m-0! flex list-none! items-center gap-1 p-0! [&_li]:m-0!", children: items.map(
|
|
4077
|
+
(item) => item.children?.length ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3723
4078
|
HorizontalDropdown,
|
|
3724
4079
|
{
|
|
3725
4080
|
item,
|
|
@@ -3728,7 +4083,7 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3728
4083
|
onActivate: handleItemActivate
|
|
3729
4084
|
},
|
|
3730
4085
|
item.id
|
|
3731
|
-
) : /* @__PURE__ */ (0,
|
|
4086
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RadixNav.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3732
4087
|
HorizontalLink,
|
|
3733
4088
|
{
|
|
3734
4089
|
item,
|
|
@@ -3737,13 +4092,13 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3737
4092
|
}
|
|
3738
4093
|
) }, item.id)
|
|
3739
4094
|
) }),
|
|
3740
|
-
/* @__PURE__ */ (0,
|
|
4095
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "z-popover absolute top-full left-0 flex justify-start", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RadixNav.Viewport, { className: "origin-top-left data-[state=open]:animate-[ship-fade-in_120ms_var(--easing-out)]" }) })
|
|
3741
4096
|
] }),
|
|
3742
|
-
actions && /* @__PURE__ */ (0,
|
|
4097
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex items-center gap-3", children: actions })
|
|
3743
4098
|
]
|
|
3744
4099
|
}
|
|
3745
4100
|
),
|
|
3746
|
-
responsive && /* @__PURE__ */ (0,
|
|
4101
|
+
responsive && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3747
4102
|
Drawer,
|
|
3748
4103
|
{
|
|
3749
4104
|
open: drawerOpen,
|
|
@@ -3756,9 +4111,9 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3756
4111
|
)
|
|
3757
4112
|
] });
|
|
3758
4113
|
}
|
|
3759
|
-
return /* @__PURE__ */ (0,
|
|
4114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
3760
4115
|
mobileBar,
|
|
3761
|
-
/* @__PURE__ */ (0,
|
|
4116
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3762
4117
|
"aside",
|
|
3763
4118
|
{
|
|
3764
4119
|
ref,
|
|
@@ -3771,8 +4126,8 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3771
4126
|
),
|
|
3772
4127
|
...props,
|
|
3773
4128
|
children: [
|
|
3774
|
-
brand && /* @__PURE__ */ (0,
|
|
3775
|
-
/* @__PURE__ */ (0,
|
|
4129
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "px-2 py-1 text-[13px] font-medium", children: brand }),
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("nav", { "aria-label": "Sidebar navigation", className: "flex flex-1 flex-col gap-1 overflow-y-auto", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3776
4131
|
VerticalItem,
|
|
3777
4132
|
{
|
|
3778
4133
|
item,
|
|
@@ -3781,11 +4136,11 @@ var NavBar = (0, import_react57.forwardRef)(function NavBar2({
|
|
|
3781
4136
|
},
|
|
3782
4137
|
item.id
|
|
3783
4138
|
)) }),
|
|
3784
|
-
actions && /* @__PURE__ */ (0,
|
|
4139
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "border-border mt-auto flex flex-col gap-2 border-t pt-3", children: actions })
|
|
3785
4140
|
]
|
|
3786
4141
|
}
|
|
3787
4142
|
),
|
|
3788
|
-
responsive && /* @__PURE__ */ (0,
|
|
4143
|
+
responsive && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3789
4144
|
Drawer,
|
|
3790
4145
|
{
|
|
3791
4146
|
open: drawerOpen,
|
|
@@ -3814,13 +4169,13 @@ function HorizontalLink({ item, active, onActivate }) {
|
|
|
3814
4169
|
}
|
|
3815
4170
|
onActivate(item.id);
|
|
3816
4171
|
};
|
|
3817
|
-
const inner = /* @__PURE__ */ (0,
|
|
3818
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
3819
|
-
/* @__PURE__ */ (0,
|
|
3820
|
-
item.badge != null && /* @__PURE__ */ (0,
|
|
4172
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
4173
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": true, className: "opacity-80", children: item.icon }),
|
|
4174
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: item.label }),
|
|
4175
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ItemBadge, { active, children: item.badge })
|
|
3821
4176
|
] });
|
|
3822
4177
|
if (item.href) {
|
|
3823
|
-
return /* @__PURE__ */ (0,
|
|
4178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RadixNav.Link, { asChild: true, active, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3824
4179
|
"a",
|
|
3825
4180
|
{
|
|
3826
4181
|
href: item.href,
|
|
@@ -3832,7 +4187,7 @@ function HorizontalLink({ item, active, onActivate }) {
|
|
|
3832
4187
|
}
|
|
3833
4188
|
) });
|
|
3834
4189
|
}
|
|
3835
|
-
return /* @__PURE__ */ (0,
|
|
4190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RadixNav.Link, { asChild: true, active, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3836
4191
|
"button",
|
|
3837
4192
|
{
|
|
3838
4193
|
type: "button",
|
|
@@ -3845,8 +4200,8 @@ function HorizontalLink({ item, active, onActivate }) {
|
|
|
3845
4200
|
) });
|
|
3846
4201
|
}
|
|
3847
4202
|
function HorizontalDropdown({ item, active, activeId, onActivate }) {
|
|
3848
|
-
return /* @__PURE__ */ (0,
|
|
3849
|
-
/* @__PURE__ */ (0,
|
|
4203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(RadixNav.Item, { children: [
|
|
4204
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3850
4205
|
RadixNav.Trigger,
|
|
3851
4206
|
{
|
|
3852
4207
|
className: cn(
|
|
@@ -3858,9 +4213,9 @@ function HorizontalDropdown({ item, active, activeId, onActivate }) {
|
|
|
3858
4213
|
),
|
|
3859
4214
|
disabled: item.disabled,
|
|
3860
4215
|
children: [
|
|
3861
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
3862
|
-
/* @__PURE__ */ (0,
|
|
3863
|
-
/* @__PURE__ */ (0,
|
|
4216
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": true, className: "opacity-80", children: item.icon }),
|
|
4217
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: item.label }),
|
|
4218
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3864
4219
|
"span",
|
|
3865
4220
|
{
|
|
3866
4221
|
"aria-hidden": true,
|
|
@@ -3871,7 +4226,7 @@ function HorizontalDropdown({ item, active, activeId, onActivate }) {
|
|
|
3871
4226
|
]
|
|
3872
4227
|
}
|
|
3873
4228
|
),
|
|
3874
|
-
/* @__PURE__ */ (0,
|
|
4229
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RadixNav.Content, { className: "border-border bg-panel min-w-[220px] rounded-xs border p-2 shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className: "m-0! flex list-none! flex-col gap-[2px] p-0! [&_li]:m-0!", children: item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DropdownLink, { item: child, active: child.id === activeId, onActivate }) }, child.id)) }) })
|
|
3875
4230
|
] });
|
|
3876
4231
|
}
|
|
3877
4232
|
function DropdownLink({ item, active, onActivate }) {
|
|
@@ -3888,13 +4243,13 @@ function DropdownLink({ item, active, onActivate }) {
|
|
|
3888
4243
|
}
|
|
3889
4244
|
onActivate(item.id);
|
|
3890
4245
|
};
|
|
3891
|
-
const inner = /* @__PURE__ */ (0,
|
|
3892
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
3893
|
-
/* @__PURE__ */ (0,
|
|
3894
|
-
item.badge != null && /* @__PURE__ */ (0,
|
|
4246
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
4247
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": true, className: "opacity-80", children: item.icon }),
|
|
4248
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "flex-1", children: item.label }),
|
|
4249
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ItemBadge, { active, children: item.badge })
|
|
3895
4250
|
] });
|
|
3896
4251
|
if (item.href) {
|
|
3897
|
-
return /* @__PURE__ */ (0,
|
|
4252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RadixNav.Link, { asChild: true, active, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3898
4253
|
"a",
|
|
3899
4254
|
{
|
|
3900
4255
|
href: item.href,
|
|
@@ -3906,7 +4261,7 @@ function DropdownLink({ item, active, onActivate }) {
|
|
|
3906
4261
|
}
|
|
3907
4262
|
) });
|
|
3908
4263
|
}
|
|
3909
|
-
return /* @__PURE__ */ (0,
|
|
4264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RadixNav.Link, { asChild: true, active, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3910
4265
|
"button",
|
|
3911
4266
|
{
|
|
3912
4267
|
type: "button",
|
|
@@ -3921,9 +4276,9 @@ function DropdownLink({ item, active, onActivate }) {
|
|
|
3921
4276
|
function VerticalItem({ item, activeId, onActivate }) {
|
|
3922
4277
|
const hasChildren = (item.children?.length ?? 0) > 0;
|
|
3923
4278
|
const treeActive = isActiveTree(item, activeId);
|
|
3924
|
-
const [open, setOpen] = (0,
|
|
3925
|
-
const prevTreeActive = (0,
|
|
3926
|
-
(0,
|
|
4279
|
+
const [open, setOpen] = (0, import_react61.useState)(treeActive);
|
|
4280
|
+
const prevTreeActive = (0, import_react61.useRef)(treeActive);
|
|
4281
|
+
(0, import_react61.useEffect)(() => {
|
|
3927
4282
|
if (treeActive && !prevTreeActive.current) setOpen(true);
|
|
3928
4283
|
prevTreeActive.current = treeActive;
|
|
3929
4284
|
}, [treeActive]);
|
|
@@ -3935,7 +4290,7 @@ function VerticalItem({ item, activeId, onActivate }) {
|
|
|
3935
4290
|
}
|
|
3936
4291
|
onActivate(item.id);
|
|
3937
4292
|
};
|
|
3938
|
-
return /* @__PURE__ */ (0,
|
|
4293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3939
4294
|
NavItem,
|
|
3940
4295
|
{
|
|
3941
4296
|
icon: item.icon,
|
|
@@ -3948,8 +4303,8 @@ function VerticalItem({ item, activeId, onActivate }) {
|
|
|
3948
4303
|
}
|
|
3949
4304
|
);
|
|
3950
4305
|
}
|
|
3951
|
-
return /* @__PURE__ */ (0,
|
|
3952
|
-
/* @__PURE__ */ (0,
|
|
4306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col", children: [
|
|
4307
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3953
4308
|
"button",
|
|
3954
4309
|
{
|
|
3955
4310
|
type: "button",
|
|
@@ -3965,18 +4320,18 @@ function VerticalItem({ item, activeId, onActivate }) {
|
|
|
3965
4320
|
item.disabled && "pointer-events-none opacity-50"
|
|
3966
4321
|
),
|
|
3967
4322
|
children: [
|
|
3968
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
3969
|
-
/* @__PURE__ */ (0,
|
|
3970
|
-
item.badge != null && /* @__PURE__ */ (0,
|
|
3971
|
-
/* @__PURE__ */ (0,
|
|
4323
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": true, className: "w-[14px] text-center opacity-80", children: item.icon }),
|
|
4324
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "flex-1 truncate", children: item.label }),
|
|
4325
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ItemBadge, { active: treeActive, children: item.badge }),
|
|
4326
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": true, className: "text-[10px] opacity-60", children: open ? "\u25BE" : "\u25B8" })
|
|
3972
4327
|
]
|
|
3973
4328
|
}
|
|
3974
4329
|
),
|
|
3975
|
-
open && /* @__PURE__ */ (0,
|
|
4330
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "border-border mt-1 ml-[18px] flex flex-col gap-[2px] border-l pl-3", children: item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VerticalItem, { item: child, activeId, onActivate }, child.id)) })
|
|
3976
4331
|
] });
|
|
3977
4332
|
}
|
|
3978
4333
|
function ItemBadge({ active, children }) {
|
|
3979
|
-
return /* @__PURE__ */ (0,
|
|
4334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3980
4335
|
"span",
|
|
3981
4336
|
{
|
|
3982
4337
|
className: cn(
|
|
@@ -3988,9 +4343,105 @@ function ItemBadge({ active, children }) {
|
|
|
3988
4343
|
);
|
|
3989
4344
|
}
|
|
3990
4345
|
|
|
4346
|
+
// src/patterns/OnboardingChecklist/OnboardingChecklist.tsx
|
|
4347
|
+
var import_react62 = require("react");
|
|
4348
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4349
|
+
var statusDot = {
|
|
4350
|
+
pending: "off",
|
|
4351
|
+
"in-progress": "sync",
|
|
4352
|
+
done: "ok"
|
|
4353
|
+
};
|
|
4354
|
+
var labelStateClass = {
|
|
4355
|
+
pending: "text-text",
|
|
4356
|
+
"in-progress": "text-text",
|
|
4357
|
+
done: "text-text-dim line-through"
|
|
4358
|
+
};
|
|
4359
|
+
var OnboardingChecklist = (0, import_react62.forwardRef)(
|
|
4360
|
+
function OnboardingChecklist2({ items, onItemClick, title = "Get started", progressLabel, hideProgress, className, ...props }, ref) {
|
|
4361
|
+
const total = items.length;
|
|
4362
|
+
const done = items.filter((i) => i.status === "done").length;
|
|
4363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4364
|
+
"section",
|
|
4365
|
+
{
|
|
4366
|
+
ref,
|
|
4367
|
+
"aria-label": typeof title === "string" ? title : void 0,
|
|
4368
|
+
className: cn(
|
|
4369
|
+
"rounded-base border-border bg-panel flex flex-col gap-3 border p-5",
|
|
4370
|
+
className
|
|
4371
|
+
),
|
|
4372
|
+
...props,
|
|
4373
|
+
children: [
|
|
4374
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("header", { className: "flex items-center gap-2", children: [
|
|
4375
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-[14px] font-medium", children: title }),
|
|
4376
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-text-dim ml-auto font-mono text-[11px] tabular-nums", children: progressLabel ?? `${done} of ${total} complete` })
|
|
4377
|
+
] }),
|
|
4378
|
+
!hideProgress && total > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4379
|
+
"div",
|
|
4380
|
+
{
|
|
4381
|
+
role: "progressbar",
|
|
4382
|
+
"aria-valuemin": 0,
|
|
4383
|
+
"aria-valuemax": total,
|
|
4384
|
+
"aria-valuenow": done,
|
|
4385
|
+
"aria-label": typeof title === "string" ? `${title} progress` : "Setup progress",
|
|
4386
|
+
className: "bg-panel-2 h-[3px] w-full overflow-hidden rounded-full",
|
|
4387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4388
|
+
"span",
|
|
4389
|
+
{
|
|
4390
|
+
"aria-hidden": true,
|
|
4391
|
+
className: cn(
|
|
4392
|
+
"block h-full rounded-full transition-[width] duration-(--duration-step)",
|
|
4393
|
+
done === total ? "bg-ok" : "bg-accent"
|
|
4394
|
+
),
|
|
4395
|
+
style: { width: `${total > 0 ? done / total * 100 : 0}%` }
|
|
4396
|
+
}
|
|
4397
|
+
)
|
|
4398
|
+
}
|
|
4399
|
+
),
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "m-0 flex list-none flex-col gap-1 p-0", children: items.map((item) => {
|
|
4401
|
+
const interactive = typeof onItemClick === "function";
|
|
4402
|
+
const labelBlock = /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
4403
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4404
|
+
StatusDot,
|
|
4405
|
+
{
|
|
4406
|
+
state: statusDot[item.status],
|
|
4407
|
+
pulse: item.status === "in-progress",
|
|
4408
|
+
size: 10,
|
|
4409
|
+
className: "mt-[3px]"
|
|
4410
|
+
}
|
|
4411
|
+
),
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-[2px]", children: [
|
|
4413
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: cn("text-[13px]", labelStateClass[item.status]), children: item.label }),
|
|
4414
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-text-muted text-[12px] leading-[1.45]", children: item.description })
|
|
4415
|
+
] })
|
|
4416
|
+
] });
|
|
4417
|
+
const labelRegionClass = cn(
|
|
4418
|
+
"flex flex-1 items-start gap-3 rounded-md px-2 py-2 text-left transition-colors duration-(--duration-micro)",
|
|
4419
|
+
interactive && "cursor-pointer outline-none hover:bg-panel-2 focus-visible:ring-[3px] focus-visible:ring-accent-dim"
|
|
4420
|
+
);
|
|
4421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("li", { className: "flex items-start gap-2", children: [
|
|
4422
|
+
interactive ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4423
|
+
"button",
|
|
4424
|
+
{
|
|
4425
|
+
type: "button",
|
|
4426
|
+
"aria-current": item.status === "in-progress" ? "step" : void 0,
|
|
4427
|
+
onClick: () => onItemClick(item.id),
|
|
4428
|
+
className: labelRegionClass,
|
|
4429
|
+
children: labelBlock
|
|
4430
|
+
}
|
|
4431
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: labelRegionClass, children: labelBlock }),
|
|
4432
|
+
item.action && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "shrink-0 self-center", children: item.action })
|
|
4433
|
+
] }, item.id);
|
|
4434
|
+
}) })
|
|
4435
|
+
]
|
|
4436
|
+
}
|
|
4437
|
+
);
|
|
4438
|
+
}
|
|
4439
|
+
);
|
|
4440
|
+
OnboardingChecklist.displayName = "OnboardingChecklist";
|
|
4441
|
+
|
|
3991
4442
|
// src/patterns/Pagination/Pagination.tsx
|
|
3992
|
-
var
|
|
3993
|
-
var
|
|
4443
|
+
var import_react63 = require("react");
|
|
4444
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3994
4445
|
function buildRange(page, total, siblings) {
|
|
3995
4446
|
if (total <= 0) return [];
|
|
3996
4447
|
const items = [];
|
|
@@ -4003,9 +4454,9 @@ function buildRange(page, total, siblings) {
|
|
|
4003
4454
|
if (total > 1) items.push(total);
|
|
4004
4455
|
return items;
|
|
4005
4456
|
}
|
|
4006
|
-
var Pagination = (0,
|
|
4457
|
+
var Pagination = (0, import_react63.forwardRef)(function Pagination2({ page, total, onPageChange, siblings = 1, className, ...props }, ref) {
|
|
4007
4458
|
const items = buildRange(page, total, siblings);
|
|
4008
|
-
return /* @__PURE__ */ (0,
|
|
4459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4009
4460
|
"nav",
|
|
4010
4461
|
{
|
|
4011
4462
|
ref,
|
|
@@ -4013,7 +4464,7 @@ var Pagination = (0, import_react58.forwardRef)(function Pagination2({ page, tot
|
|
|
4013
4464
|
className: cn("inline-flex items-center gap-1", className),
|
|
4014
4465
|
...props,
|
|
4015
4466
|
children: [
|
|
4016
|
-
/* @__PURE__ */ (0,
|
|
4467
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4017
4468
|
IconButton,
|
|
4018
4469
|
{
|
|
4019
4470
|
size: "sm",
|
|
@@ -4026,7 +4477,7 @@ var Pagination = (0, import_react58.forwardRef)(function Pagination2({ page, tot
|
|
|
4026
4477
|
),
|
|
4027
4478
|
items.map((item, i) => {
|
|
4028
4479
|
if (item === "start-ellipsis" || item === "end-ellipsis") {
|
|
4029
|
-
return /* @__PURE__ */ (0,
|
|
4480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4030
4481
|
"span",
|
|
4031
4482
|
{
|
|
4032
4483
|
"aria-hidden": true,
|
|
@@ -4037,7 +4488,7 @@ var Pagination = (0, import_react58.forwardRef)(function Pagination2({ page, tot
|
|
|
4037
4488
|
);
|
|
4038
4489
|
}
|
|
4039
4490
|
const isActive = item === page;
|
|
4040
|
-
return /* @__PURE__ */ (0,
|
|
4491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4041
4492
|
"button",
|
|
4042
4493
|
{
|
|
4043
4494
|
type: "button",
|
|
@@ -4055,7 +4506,7 @@ var Pagination = (0, import_react58.forwardRef)(function Pagination2({ page, tot
|
|
|
4055
4506
|
item
|
|
4056
4507
|
);
|
|
4057
4508
|
}),
|
|
4058
|
-
/* @__PURE__ */ (0,
|
|
4509
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4059
4510
|
IconButton,
|
|
4060
4511
|
{
|
|
4061
4512
|
size: "sm",
|
|
@@ -4074,8 +4525,8 @@ Pagination.displayName = "Pagination";
|
|
|
4074
4525
|
|
|
4075
4526
|
// src/patterns/Progress/Progress.tsx
|
|
4076
4527
|
var import_class_variance_authority11 = require("class-variance-authority");
|
|
4077
|
-
var
|
|
4078
|
-
var
|
|
4528
|
+
var import_react64 = require("react");
|
|
4529
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4079
4530
|
var trackStyles = (0, import_class_variance_authority11.cva)("w-full rounded-full bg-panel-2 overflow-hidden", {
|
|
4080
4531
|
variants: {
|
|
4081
4532
|
size: {
|
|
@@ -4097,7 +4548,7 @@ var fillStyles = (0, import_class_variance_authority11.cva)("h-full rounded-full
|
|
|
4097
4548
|
},
|
|
4098
4549
|
defaultVariants: { tone: "accent" }
|
|
4099
4550
|
});
|
|
4100
|
-
var Progress = (0,
|
|
4551
|
+
var Progress = (0, import_react64.forwardRef)(function Progress2({
|
|
4101
4552
|
value = 0,
|
|
4102
4553
|
max = 100,
|
|
4103
4554
|
indeterminate = false,
|
|
@@ -4111,15 +4562,15 @@ var Progress = (0, import_react59.forwardRef)(function Progress2({
|
|
|
4111
4562
|
const clamped = Math.min(max, Math.max(0, value));
|
|
4112
4563
|
const pct = max > 0 ? clamped / max * 100 : 0;
|
|
4113
4564
|
const display = Math.round(pct);
|
|
4114
|
-
return /* @__PURE__ */ (0,
|
|
4115
|
-
label != null && /* @__PURE__ */ (0,
|
|
4116
|
-
/* @__PURE__ */ (0,
|
|
4117
|
-
showValue && !indeterminate && /* @__PURE__ */ (0,
|
|
4565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
4566
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex text-[12px]", children: [
|
|
4567
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-text-muted", children: label }),
|
|
4568
|
+
showValue && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "text-text ml-auto font-mono tabular-nums", children: [
|
|
4118
4569
|
display,
|
|
4119
4570
|
"%"
|
|
4120
4571
|
] })
|
|
4121
4572
|
] }),
|
|
4122
|
-
/* @__PURE__ */ (0,
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4123
4574
|
"div",
|
|
4124
4575
|
{
|
|
4125
4576
|
role: "progressbar",
|
|
@@ -4128,7 +4579,7 @@ var Progress = (0, import_react59.forwardRef)(function Progress2({
|
|
|
4128
4579
|
"aria-valuenow": indeterminate ? void 0 : display,
|
|
4129
4580
|
"aria-label": typeof label === "string" ? label : void 0,
|
|
4130
4581
|
className: trackStyles({ size }),
|
|
4131
|
-
children: indeterminate ? /* @__PURE__ */ (0,
|
|
4582
|
+
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4132
4583
|
"span",
|
|
4133
4584
|
{
|
|
4134
4585
|
"aria-hidden": true,
|
|
@@ -4138,94 +4589,16 @@ var Progress = (0, import_react59.forwardRef)(function Progress2({
|
|
|
4138
4589
|
"animate-[ship-indeterminate_1.4s_linear_infinite]"
|
|
4139
4590
|
)
|
|
4140
4591
|
}
|
|
4141
|
-
) : /* @__PURE__ */ (0,
|
|
4592
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { "aria-hidden": true, className: fillStyles({ tone }), style: { width: `${pct}%` } })
|
|
4142
4593
|
}
|
|
4143
4594
|
)
|
|
4144
4595
|
] });
|
|
4145
4596
|
});
|
|
4146
4597
|
Progress.displayName = "Progress";
|
|
4147
4598
|
|
|
4148
|
-
// src/patterns/RadialProgress/RadialProgress.tsx
|
|
4149
|
-
var import_react60 = require("react");
|
|
4150
|
-
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4151
|
-
var toneStrokeClass = {
|
|
4152
|
-
accent: "stroke-accent",
|
|
4153
|
-
ok: "stroke-ok",
|
|
4154
|
-
warn: "stroke-warn",
|
|
4155
|
-
err: "stroke-err"
|
|
4156
|
-
};
|
|
4157
|
-
var RadialProgress = (0, import_react60.forwardRef)(
|
|
4158
|
-
function RadialProgress2({
|
|
4159
|
-
value,
|
|
4160
|
-
max = 100,
|
|
4161
|
-
size = 64,
|
|
4162
|
-
thickness = 4,
|
|
4163
|
-
tone,
|
|
4164
|
-
children,
|
|
4165
|
-
className,
|
|
4166
|
-
"aria-label": ariaLabel,
|
|
4167
|
-
...props
|
|
4168
|
-
}, ref) {
|
|
4169
|
-
const clamped = Math.min(max, Math.max(0, value));
|
|
4170
|
-
const pct = max > 0 ? clamped / max * 100 : 0;
|
|
4171
|
-
const r = (size - thickness) / 2;
|
|
4172
|
-
const c = 2 * Math.PI * r;
|
|
4173
|
-
const dash = pct / 100 * c;
|
|
4174
|
-
const resolvedTone = tone ?? (clamped >= max ? "ok" : "accent");
|
|
4175
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4176
|
-
"div",
|
|
4177
|
-
{
|
|
4178
|
-
ref,
|
|
4179
|
-
role: "progressbar",
|
|
4180
|
-
"aria-valuemin": 0,
|
|
4181
|
-
"aria-valuemax": max,
|
|
4182
|
-
"aria-valuenow": Math.round(pct),
|
|
4183
|
-
"aria-label": ariaLabel ?? `${Math.round(pct)}%`,
|
|
4184
|
-
className: cn("relative inline-grid place-items-center", className),
|
|
4185
|
-
style: { width: size, height: size },
|
|
4186
|
-
...props,
|
|
4187
|
-
children: [
|
|
4188
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, children: [
|
|
4189
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4190
|
-
"circle",
|
|
4191
|
-
{
|
|
4192
|
-
cx: size / 2,
|
|
4193
|
-
cy: size / 2,
|
|
4194
|
-
r,
|
|
4195
|
-
fill: "none",
|
|
4196
|
-
strokeWidth: thickness,
|
|
4197
|
-
className: "stroke-panel-2"
|
|
4198
|
-
}
|
|
4199
|
-
),
|
|
4200
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4201
|
-
"circle",
|
|
4202
|
-
{
|
|
4203
|
-
cx: size / 2,
|
|
4204
|
-
cy: size / 2,
|
|
4205
|
-
r,
|
|
4206
|
-
fill: "none",
|
|
4207
|
-
strokeWidth: thickness,
|
|
4208
|
-
strokeLinecap: "round",
|
|
4209
|
-
strokeDasharray: `${dash} ${c}`,
|
|
4210
|
-
transform: `rotate(-90 ${size / 2} ${size / 2})`,
|
|
4211
|
-
className: cn(
|
|
4212
|
-
"transition-[stroke-dasharray] duration-(--duration-step)",
|
|
4213
|
-
toneStrokeClass[resolvedTone]
|
|
4214
|
-
)
|
|
4215
|
-
}
|
|
4216
|
-
)
|
|
4217
|
-
] }),
|
|
4218
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "absolute inset-0 grid place-items-center font-mono text-[11px] font-medium tabular-nums", children: children ?? `${Math.round(pct)}%` })
|
|
4219
|
-
]
|
|
4220
|
-
}
|
|
4221
|
-
);
|
|
4222
|
-
}
|
|
4223
|
-
);
|
|
4224
|
-
RadialProgress.displayName = "RadialProgress";
|
|
4225
|
-
|
|
4226
4599
|
// src/patterns/Sparkline/Sparkline.tsx
|
|
4227
|
-
var
|
|
4228
|
-
var
|
|
4600
|
+
var import_react65 = require("react");
|
|
4601
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4229
4602
|
function buildPath(values, w, h) {
|
|
4230
4603
|
if (values.length === 0) return { line: "", area: "" };
|
|
4231
4604
|
const pad = 2;
|
|
@@ -4244,7 +4617,7 @@ function buildPath(values, w, h) {
|
|
|
4244
4617
|
)} L${pad.toFixed(2)},${(h - pad).toFixed(2)} Z`;
|
|
4245
4618
|
return { line, area };
|
|
4246
4619
|
}
|
|
4247
|
-
var Sparkline = (0,
|
|
4620
|
+
var Sparkline = (0, import_react65.forwardRef)(function Sparkline2({
|
|
4248
4621
|
values,
|
|
4249
4622
|
width = 160,
|
|
4250
4623
|
height = 32,
|
|
@@ -4255,8 +4628,8 @@ var Sparkline = (0, import_react61.forwardRef)(function Sparkline2({
|
|
|
4255
4628
|
"aria-label": ariaLabel = "Trend",
|
|
4256
4629
|
...props
|
|
4257
4630
|
}, ref) {
|
|
4258
|
-
const { line, area } = (0,
|
|
4259
|
-
return /* @__PURE__ */ (0,
|
|
4631
|
+
const { line, area } = (0, import_react65.useMemo)(() => buildPath(values, width, height), [values, width, height]);
|
|
4632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
4260
4633
|
"svg",
|
|
4261
4634
|
{
|
|
4262
4635
|
ref,
|
|
@@ -4268,8 +4641,8 @@ var Sparkline = (0, import_react61.forwardRef)(function Sparkline2({
|
|
|
4268
4641
|
className: cn("inline-block", className),
|
|
4269
4642
|
...props,
|
|
4270
4643
|
children: [
|
|
4271
|
-
fill && /* @__PURE__ */ (0,
|
|
4272
|
-
/* @__PURE__ */ (0,
|
|
4644
|
+
fill && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("path", { d: area, fill: stroke, fillOpacity: 0.16, stroke: "none" }),
|
|
4645
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4273
4646
|
"path",
|
|
4274
4647
|
{
|
|
4275
4648
|
d: line,
|
|
@@ -4287,16 +4660,16 @@ var Sparkline = (0, import_react61.forwardRef)(function Sparkline2({
|
|
|
4287
4660
|
Sparkline.displayName = "Sparkline";
|
|
4288
4661
|
|
|
4289
4662
|
// src/patterns/Spinner/Spinner.tsx
|
|
4290
|
-
var
|
|
4291
|
-
var
|
|
4663
|
+
var import_react66 = require("react");
|
|
4664
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4292
4665
|
var sizes = {
|
|
4293
4666
|
sm: { box: "h-3 w-3", border: "border-[2px]" },
|
|
4294
4667
|
md: { box: "h-4 w-4", border: "border-[2px]" },
|
|
4295
4668
|
lg: { box: "h-5 w-5", border: "border-[2px]" }
|
|
4296
4669
|
};
|
|
4297
|
-
var Spinner2 = (0,
|
|
4670
|
+
var Spinner2 = (0, import_react66.forwardRef)(function Spinner3({ size = "md", label = "Loading", className, ...props }, ref) {
|
|
4298
4671
|
const s = sizes[size];
|
|
4299
|
-
return /* @__PURE__ */ (0,
|
|
4672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4300
4673
|
"span",
|
|
4301
4674
|
{
|
|
4302
4675
|
ref,
|
|
@@ -4304,7 +4677,7 @@ var Spinner2 = (0, import_react62.forwardRef)(function Spinner3({ size = "md", l
|
|
|
4304
4677
|
"aria-label": label,
|
|
4305
4678
|
className: cn("inline-block", className),
|
|
4306
4679
|
...props,
|
|
4307
|
-
children: /* @__PURE__ */ (0,
|
|
4680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4308
4681
|
"span",
|
|
4309
4682
|
{
|
|
4310
4683
|
"aria-hidden": true,
|
|
@@ -4321,15 +4694,15 @@ var Spinner2 = (0, import_react62.forwardRef)(function Spinner3({ size = "md", l
|
|
|
4321
4694
|
Spinner2.displayName = "Spinner";
|
|
4322
4695
|
|
|
4323
4696
|
// src/patterns/Stepper/Stepper.tsx
|
|
4324
|
-
var
|
|
4325
|
-
var
|
|
4697
|
+
var import_react67 = require("react");
|
|
4698
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4326
4699
|
var dotBase = "h-6 w-6 rounded-full grid place-items-center text-[11px] font-mono font-semibold border";
|
|
4327
4700
|
var dotStateClass = {
|
|
4328
4701
|
done: "bg-accent text-on-accent border-accent",
|
|
4329
4702
|
current: "bg-accent-dim text-accent border-accent",
|
|
4330
4703
|
upcoming: "bg-panel text-text-dim border-border"
|
|
4331
4704
|
};
|
|
4332
|
-
var
|
|
4705
|
+
var labelStateClass2 = {
|
|
4333
4706
|
done: "text-text",
|
|
4334
4707
|
current: "text-text font-medium",
|
|
4335
4708
|
upcoming: "text-text-dim"
|
|
@@ -4339,8 +4712,8 @@ function stateFor(index, current) {
|
|
|
4339
4712
|
if (index === current) return "current";
|
|
4340
4713
|
return "upcoming";
|
|
4341
4714
|
}
|
|
4342
|
-
var Stepper = (0,
|
|
4343
|
-
return /* @__PURE__ */ (0,
|
|
4715
|
+
var Stepper = (0, import_react67.forwardRef)(function Stepper2({ steps, current, className, ...props }, ref) {
|
|
4716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4344
4717
|
"ol",
|
|
4345
4718
|
{
|
|
4346
4719
|
ref,
|
|
@@ -4352,19 +4725,19 @@ var Stepper = (0, import_react63.forwardRef)(function Stepper2({ steps, current,
|
|
|
4352
4725
|
const id = typeof step === "string" ? void 0 : step.id;
|
|
4353
4726
|
const state = stateFor(i, current);
|
|
4354
4727
|
const connectorActive = i < current;
|
|
4355
|
-
return /* @__PURE__ */ (0,
|
|
4356
|
-
/* @__PURE__ */ (0,
|
|
4728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react67.Fragment, { children: [
|
|
4729
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4357
4730
|
"li",
|
|
4358
4731
|
{
|
|
4359
4732
|
"aria-current": state === "current" ? "step" : void 0,
|
|
4360
4733
|
className: "flex items-center gap-2",
|
|
4361
4734
|
children: [
|
|
4362
|
-
/* @__PURE__ */ (0,
|
|
4363
|
-
/* @__PURE__ */ (0,
|
|
4735
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { "aria-hidden": true, className: cn(dotBase, dotStateClass[state]), children: state === "done" ? "\u2713" : i + 1 }),
|
|
4736
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: cn("text-[12px]", labelStateClass2[state]), children: label })
|
|
4364
4737
|
]
|
|
4365
4738
|
}
|
|
4366
4739
|
),
|
|
4367
|
-
i < steps.length - 1 && /* @__PURE__ */ (0,
|
|
4740
|
+
i < steps.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4368
4741
|
"span",
|
|
4369
4742
|
{
|
|
4370
4743
|
"aria-hidden": true,
|
|
@@ -4381,9 +4754,9 @@ Stepper.displayName = "Stepper";
|
|
|
4381
4754
|
// src/patterns/Tabs/Tabs.tsx
|
|
4382
4755
|
var RadixTabs = __toESM(require("@radix-ui/react-tabs"), 1);
|
|
4383
4756
|
var import_class_variance_authority12 = require("class-variance-authority");
|
|
4384
|
-
var
|
|
4385
|
-
var
|
|
4386
|
-
var TabsVariantContext = (0,
|
|
4757
|
+
var import_react68 = require("react");
|
|
4758
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4759
|
+
var TabsVariantContext = (0, import_react68.createContext)("underline");
|
|
4387
4760
|
var tabsListStyles = (0, import_class_variance_authority12.cva)("", {
|
|
4388
4761
|
variants: {
|
|
4389
4762
|
variant: {
|
|
@@ -4413,8 +4786,8 @@ var tabsTriggerStyles = (0, import_class_variance_authority12.cva)(
|
|
|
4413
4786
|
}
|
|
4414
4787
|
}
|
|
4415
4788
|
);
|
|
4416
|
-
var Tabs = (0,
|
|
4417
|
-
return /* @__PURE__ */ (0,
|
|
4789
|
+
var Tabs = (0, import_react68.forwardRef)(function Tabs2({ variant = "underline", className, ...props }, ref) {
|
|
4790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TabsVariantContext.Provider, { value: variant, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4418
4791
|
RadixTabs.Root,
|
|
4419
4792
|
{
|
|
4420
4793
|
ref,
|
|
@@ -4424,14 +4797,14 @@ var Tabs = (0, import_react64.forwardRef)(function Tabs2({ variant = "underline"
|
|
|
4424
4797
|
) });
|
|
4425
4798
|
});
|
|
4426
4799
|
Tabs.displayName = "Tabs";
|
|
4427
|
-
var TabsList = (0,
|
|
4428
|
-
const variant = (0,
|
|
4429
|
-
return /* @__PURE__ */ (0,
|
|
4800
|
+
var TabsList = (0, import_react68.forwardRef)(function TabsList2({ className, ...props }, ref) {
|
|
4801
|
+
const variant = (0, import_react68.useContext)(TabsVariantContext);
|
|
4802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RadixTabs.List, { ref, className: cn(tabsListStyles({ variant }), className), ...props });
|
|
4430
4803
|
});
|
|
4431
4804
|
TabsList.displayName = "TabsList";
|
|
4432
|
-
var Tab = (0,
|
|
4433
|
-
const variant = (0,
|
|
4434
|
-
return /* @__PURE__ */ (0,
|
|
4805
|
+
var Tab = (0, import_react68.forwardRef)(function Tab2({ className, ...props }, ref) {
|
|
4806
|
+
const variant = (0, import_react68.useContext)(TabsVariantContext);
|
|
4807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4435
4808
|
RadixTabs.Trigger,
|
|
4436
4809
|
{
|
|
4437
4810
|
ref,
|
|
@@ -4441,9 +4814,9 @@ var Tab = (0, import_react64.forwardRef)(function Tab2({ className, ...props },
|
|
|
4441
4814
|
);
|
|
4442
4815
|
});
|
|
4443
4816
|
Tab.displayName = "Tab";
|
|
4444
|
-
var TabsContent = (0,
|
|
4817
|
+
var TabsContent = (0, import_react68.forwardRef)(
|
|
4445
4818
|
function TabsContent2({ className, ...props }, ref) {
|
|
4446
|
-
return /* @__PURE__ */ (0,
|
|
4819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
4447
4820
|
RadixTabs.Content,
|
|
4448
4821
|
{
|
|
4449
4822
|
ref,
|
|
@@ -4459,8 +4832,8 @@ var TabsContent = (0, import_react64.forwardRef)(
|
|
|
4459
4832
|
TabsContent.displayName = "TabsContent";
|
|
4460
4833
|
|
|
4461
4834
|
// src/patterns/Timeline/Timeline.tsx
|
|
4462
|
-
var
|
|
4463
|
-
var
|
|
4835
|
+
var import_react69 = require("react");
|
|
4836
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4464
4837
|
var ringClass = {
|
|
4465
4838
|
accent: "border-accent",
|
|
4466
4839
|
ok: "border-ok",
|
|
@@ -4468,8 +4841,8 @@ var ringClass = {
|
|
|
4468
4841
|
err: "border-err",
|
|
4469
4842
|
muted: "border-text-dim"
|
|
4470
4843
|
};
|
|
4471
|
-
var Timeline = (0,
|
|
4472
|
-
return /* @__PURE__ */ (0,
|
|
4844
|
+
var Timeline = (0, import_react69.forwardRef)(function Timeline2({ events, className, children, ...props }, ref) {
|
|
4845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4473
4846
|
"ol",
|
|
4474
4847
|
{
|
|
4475
4848
|
ref,
|
|
@@ -4479,14 +4852,14 @@ var Timeline = (0, import_react65.forwardRef)(function Timeline2({ events, class
|
|
|
4479
4852
|
className
|
|
4480
4853
|
),
|
|
4481
4854
|
...props,
|
|
4482
|
-
children: events ? events.map((e, i) => /* @__PURE__ */ (0,
|
|
4855
|
+
children: events ? events.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TimelineItem, { tone: e.tone, time: e.time, description: e.description, children: e.title }, i)) : children
|
|
4483
4856
|
}
|
|
4484
4857
|
);
|
|
4485
4858
|
});
|
|
4486
4859
|
Timeline.displayName = "Timeline";
|
|
4487
|
-
var TimelineItem = (0,
|
|
4488
|
-
return /* @__PURE__ */ (0,
|
|
4489
|
-
/* @__PURE__ */ (0,
|
|
4860
|
+
var TimelineItem = (0, import_react69.forwardRef)(function TimelineItem2({ tone = "accent", description, time, className, children, ...props }, ref) {
|
|
4861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("li", { ref, className: cn("relative mb-[18px] last:mb-0", className), ...props, children: [
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4490
4863
|
"span",
|
|
4491
4864
|
{
|
|
4492
4865
|
"aria-hidden": true,
|
|
@@ -4496,18 +4869,107 @@ var TimelineItem = (0, import_react65.forwardRef)(function TimelineItem2({ tone
|
|
|
4496
4869
|
)
|
|
4497
4870
|
}
|
|
4498
4871
|
),
|
|
4499
|
-
/* @__PURE__ */ (0,
|
|
4500
|
-
description && /* @__PURE__ */ (0,
|
|
4501
|
-
time && /* @__PURE__ */ (0,
|
|
4872
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "text-[13px] font-medium", children }),
|
|
4873
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "text-text-muted text-[12px]", children: description }),
|
|
4874
|
+
time && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "text-text-dim mt-[2px] font-mono text-[10px]", children: time })
|
|
4502
4875
|
] });
|
|
4503
4876
|
});
|
|
4504
4877
|
TimelineItem.displayName = "TimelineItem";
|
|
4505
4878
|
|
|
4879
|
+
// src/patterns/Timeline/ActivityTimeline.tsx
|
|
4880
|
+
var import_react70 = require("react");
|
|
4881
|
+
|
|
4882
|
+
// src/patterns/Timeline/formatRelative.ts
|
|
4883
|
+
var SECOND = 1e3;
|
|
4884
|
+
var MINUTE = 60 * SECOND;
|
|
4885
|
+
var HOUR = 60 * MINUTE;
|
|
4886
|
+
var DAY = 24 * HOUR;
|
|
4887
|
+
var WEEK = 7 * DAY;
|
|
4888
|
+
var MONTH = 30 * DAY;
|
|
4889
|
+
var YEAR = 365 * DAY;
|
|
4890
|
+
var UNITS = [
|
|
4891
|
+
{ ms: YEAR, short: "y" },
|
|
4892
|
+
{ ms: MONTH, short: "mo" },
|
|
4893
|
+
{ ms: WEEK, short: "w" },
|
|
4894
|
+
{ ms: DAY, short: "d" },
|
|
4895
|
+
{ ms: HOUR, short: "h" },
|
|
4896
|
+
{ ms: MINUTE, short: "m" },
|
|
4897
|
+
{ ms: SECOND, short: "s" }
|
|
4898
|
+
];
|
|
4899
|
+
function formatRelative(input, now = /* @__PURE__ */ new Date()) {
|
|
4900
|
+
const target = input instanceof Date ? input : new Date(input);
|
|
4901
|
+
if (Number.isNaN(target.getTime())) return "";
|
|
4902
|
+
const diffMs = now.getTime() - target.getTime();
|
|
4903
|
+
const abs = Math.abs(diffMs);
|
|
4904
|
+
if (abs < 5 * SECOND) return "just now";
|
|
4905
|
+
for (const unit of UNITS) {
|
|
4906
|
+
if (abs >= unit.ms) {
|
|
4907
|
+
const n = Math.floor(abs / unit.ms);
|
|
4908
|
+
return diffMs >= 0 ? `${n}${unit.short} ago` : `in ${n}${unit.short}`;
|
|
4909
|
+
}
|
|
4910
|
+
}
|
|
4911
|
+
return "just now";
|
|
4912
|
+
}
|
|
4913
|
+
|
|
4914
|
+
// src/patterns/Timeline/ActivityTimeline.tsx
|
|
4915
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4916
|
+
var ringClass2 = {
|
|
4917
|
+
accent: "border-accent",
|
|
4918
|
+
ok: "border-ok",
|
|
4919
|
+
warn: "border-warn",
|
|
4920
|
+
err: "border-err",
|
|
4921
|
+
muted: "border-text-dim"
|
|
4922
|
+
};
|
|
4923
|
+
var ActivityTimeline = (0, import_react70.forwardRef)(
|
|
4924
|
+
function ActivityTimeline2({ events, relativeNow, className, ...props }, ref) {
|
|
4925
|
+
const now = relativeNow ?? /* @__PURE__ */ new Date();
|
|
4926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
4927
|
+
"ol",
|
|
4928
|
+
{
|
|
4929
|
+
ref,
|
|
4930
|
+
className: cn(
|
|
4931
|
+
"relative m-0 list-none p-0 pl-6",
|
|
4932
|
+
"before:bg-border before:absolute before:top-[6px] before:bottom-[6px] before:left-[7px] before:w-px",
|
|
4933
|
+
className
|
|
4934
|
+
),
|
|
4935
|
+
...props,
|
|
4936
|
+
children: events.map((event) => {
|
|
4937
|
+
const tone = event.tone ?? "accent";
|
|
4938
|
+
const time = formatRelative(event.at, now);
|
|
4939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("li", { className: "relative mb-4 last:mb-0", children: [
|
|
4940
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
4941
|
+
"span",
|
|
4942
|
+
{
|
|
4943
|
+
"aria-hidden": true,
|
|
4944
|
+
className: cn(
|
|
4945
|
+
"bg-bg absolute top-[4px] -left-6 h-[14px] w-[14px] rounded-full border-2",
|
|
4946
|
+
ringClass2[tone]
|
|
4947
|
+
)
|
|
4948
|
+
}
|
|
4949
|
+
),
|
|
4950
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-baseline gap-2", children: [
|
|
4951
|
+
event.icon && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { "aria-hidden": true, className: "text-text-muted font-mono text-[12px]", children: event.icon }),
|
|
4952
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "text-[13px] font-medium", children: event.title }),
|
|
4953
|
+
time && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("time", { className: "text-text-dim ml-auto font-mono text-[10px]", children: time })
|
|
4954
|
+
] }),
|
|
4955
|
+
event.actor && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "text-text-muted mt-[2px] flex items-center gap-[6px] text-[12px]", children: [
|
|
4956
|
+
event.actor.avatar && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { "aria-hidden": true, className: "inline-flex", children: event.actor.avatar }),
|
|
4957
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: event.actor.name })
|
|
4958
|
+
] }),
|
|
4959
|
+
event.payload && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "border-border bg-panel-2 mt-2 rounded-md border px-3 py-2 font-mono text-[11px] leading-[1.5]", children: event.payload })
|
|
4960
|
+
] }, event.id);
|
|
4961
|
+
})
|
|
4962
|
+
}
|
|
4963
|
+
);
|
|
4964
|
+
}
|
|
4965
|
+
);
|
|
4966
|
+
ActivityTimeline.displayName = "ActivityTimeline";
|
|
4967
|
+
|
|
4506
4968
|
// src/patterns/Topbar/Topbar.tsx
|
|
4507
|
-
var
|
|
4508
|
-
var
|
|
4509
|
-
var Topbar = (0,
|
|
4510
|
-
return /* @__PURE__ */ (0,
|
|
4969
|
+
var import_react71 = require("react");
|
|
4970
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4971
|
+
var Topbar = (0, import_react71.forwardRef)(function Topbar2({ title, leading, actions, className, children, ...props }, ref) {
|
|
4972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
4511
4973
|
"header",
|
|
4512
4974
|
{
|
|
4513
4975
|
ref,
|
|
@@ -4518,9 +4980,9 @@ var Topbar = (0, import_react66.forwardRef)(function Topbar2({ title, leading, a
|
|
|
4518
4980
|
...props,
|
|
4519
4981
|
children: [
|
|
4520
4982
|
leading,
|
|
4521
|
-
title && /* @__PURE__ */ (0,
|
|
4522
|
-
/* @__PURE__ */ (0,
|
|
4523
|
-
actions && /* @__PURE__ */ (0,
|
|
4983
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "text-[13px] font-medium", children: title }),
|
|
4984
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "flex flex-1 items-center" }),
|
|
4985
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "flex items-center gap-3", children: actions }),
|
|
4524
4986
|
children
|
|
4525
4987
|
]
|
|
4526
4988
|
}
|
|
@@ -4529,8 +4991,8 @@ var Topbar = (0, import_react66.forwardRef)(function Topbar2({ title, leading, a
|
|
|
4529
4991
|
Topbar.displayName = "Topbar";
|
|
4530
4992
|
|
|
4531
4993
|
// src/patterns/Tree/Tree.tsx
|
|
4532
|
-
var
|
|
4533
|
-
var
|
|
4994
|
+
var import_react72 = require("react");
|
|
4995
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4534
4996
|
var EMPTY_SET2 = /* @__PURE__ */ new Set();
|
|
4535
4997
|
function flattenVisible(items, expanded, level, parentId, out) {
|
|
4536
4998
|
for (const item of items) {
|
|
@@ -4541,7 +5003,7 @@ function flattenVisible(items, expanded, level, parentId, out) {
|
|
|
4541
5003
|
}
|
|
4542
5004
|
}
|
|
4543
5005
|
}
|
|
4544
|
-
var Tree = (0,
|
|
5006
|
+
var Tree = (0, import_react72.forwardRef)(function Tree2({
|
|
4545
5007
|
items,
|
|
4546
5008
|
expanded: expandedProp,
|
|
4547
5009
|
defaultExpanded,
|
|
@@ -4564,24 +5026,24 @@ var Tree = (0, import_react67.forwardRef)(function Tree2({
|
|
|
4564
5026
|
onChange: onValueChange
|
|
4565
5027
|
});
|
|
4566
5028
|
const expandedSet = expanded ?? EMPTY_SET2;
|
|
4567
|
-
const flatVisible = (0,
|
|
5029
|
+
const flatVisible = (0, import_react72.useMemo)(() => {
|
|
4568
5030
|
const out = [];
|
|
4569
5031
|
flattenVisible(items, expandedSet, 1, null, out);
|
|
4570
5032
|
return out;
|
|
4571
5033
|
}, [items, expandedSet]);
|
|
4572
|
-
const [activeId, setActiveId] = (0,
|
|
4573
|
-
(0,
|
|
5034
|
+
const [activeId, setActiveId] = (0, import_react72.useState)(null);
|
|
5035
|
+
(0, import_react72.useEffect)(() => {
|
|
4574
5036
|
if (activeId && !flatVisible.some((f) => f.id === activeId)) {
|
|
4575
5037
|
setActiveId(null);
|
|
4576
5038
|
}
|
|
4577
5039
|
}, [activeId, flatVisible]);
|
|
4578
|
-
const tabStopId = (0,
|
|
5040
|
+
const tabStopId = (0, import_react72.useMemo)(() => {
|
|
4579
5041
|
if (activeId && flatVisible.some((f) => f.id === activeId)) return activeId;
|
|
4580
5042
|
if (value && flatVisible.some((f) => f.id === value)) return value;
|
|
4581
5043
|
return flatVisible[0]?.id ?? null;
|
|
4582
5044
|
}, [activeId, flatVisible, value]);
|
|
4583
|
-
const listRef = (0,
|
|
4584
|
-
const setRefs = (0,
|
|
5045
|
+
const listRef = (0, import_react72.useRef)(null);
|
|
5046
|
+
const setRefs = (0, import_react72.useCallback)(
|
|
4585
5047
|
(node) => {
|
|
4586
5048
|
listRef.current = node;
|
|
4587
5049
|
if (typeof ref === "function") ref(node);
|
|
@@ -4589,20 +5051,20 @@ var Tree = (0, import_react67.forwardRef)(function Tree2({
|
|
|
4589
5051
|
},
|
|
4590
5052
|
[ref]
|
|
4591
5053
|
);
|
|
4592
|
-
const focusItem = (0,
|
|
5054
|
+
const focusItem = (0, import_react72.useCallback)((id) => {
|
|
4593
5055
|
const root = listRef.current;
|
|
4594
5056
|
if (!root) return;
|
|
4595
5057
|
const el = root.querySelector(`[data-treeitem-id="${CSS.escape(id)}"]`);
|
|
4596
5058
|
el?.focus();
|
|
4597
5059
|
}, []);
|
|
4598
|
-
const moveActive = (0,
|
|
5060
|
+
const moveActive = (0, import_react72.useCallback)(
|
|
4599
5061
|
(id) => {
|
|
4600
5062
|
setActiveId(id);
|
|
4601
5063
|
queueMicrotask(() => focusItem(id));
|
|
4602
5064
|
},
|
|
4603
5065
|
[focusItem]
|
|
4604
5066
|
);
|
|
4605
|
-
const toggle = (0,
|
|
5067
|
+
const toggle = (0, import_react72.useCallback)(
|
|
4606
5068
|
(id) => {
|
|
4607
5069
|
setExpanded((prev) => {
|
|
4608
5070
|
const next = new Set(prev ?? EMPTY_SET2);
|
|
@@ -4613,7 +5075,7 @@ var Tree = (0, import_react67.forwardRef)(function Tree2({
|
|
|
4613
5075
|
},
|
|
4614
5076
|
[setExpanded]
|
|
4615
5077
|
);
|
|
4616
|
-
const expand = (0,
|
|
5078
|
+
const expand = (0, import_react72.useCallback)(
|
|
4617
5079
|
(id) => {
|
|
4618
5080
|
setExpanded((prev) => {
|
|
4619
5081
|
const base = prev ?? EMPTY_SET2;
|
|
@@ -4625,7 +5087,7 @@ var Tree = (0, import_react67.forwardRef)(function Tree2({
|
|
|
4625
5087
|
},
|
|
4626
5088
|
[setExpanded]
|
|
4627
5089
|
);
|
|
4628
|
-
const collapse = (0,
|
|
5090
|
+
const collapse = (0, import_react72.useCallback)(
|
|
4629
5091
|
(id) => {
|
|
4630
5092
|
setExpanded((prev) => {
|
|
4631
5093
|
const base = prev ?? EMPTY_SET2;
|
|
@@ -4637,13 +5099,13 @@ var Tree = (0, import_react67.forwardRef)(function Tree2({
|
|
|
4637
5099
|
},
|
|
4638
5100
|
[setExpanded]
|
|
4639
5101
|
);
|
|
4640
|
-
const selectItem = (0,
|
|
5102
|
+
const selectItem = (0, import_react72.useCallback)(
|
|
4641
5103
|
(id) => {
|
|
4642
5104
|
setValue(id);
|
|
4643
5105
|
},
|
|
4644
5106
|
[setValue]
|
|
4645
5107
|
);
|
|
4646
|
-
const handleKeyDown = (0,
|
|
5108
|
+
const handleKeyDown = (0, import_react72.useCallback)(
|
|
4647
5109
|
(e) => {
|
|
4648
5110
|
onKeyDown?.(e);
|
|
4649
5111
|
if (e.defaultPrevented) return;
|
|
@@ -4723,7 +5185,7 @@ var Tree = (0, import_react67.forwardRef)(function Tree2({
|
|
|
4723
5185
|
toggle
|
|
4724
5186
|
]
|
|
4725
5187
|
);
|
|
4726
|
-
return /* @__PURE__ */ (0,
|
|
5188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4727
5189
|
"ul",
|
|
4728
5190
|
{
|
|
4729
5191
|
ref: setRefs,
|
|
@@ -4731,7 +5193,7 @@ var Tree = (0, import_react67.forwardRef)(function Tree2({
|
|
|
4731
5193
|
className: cn("flex flex-col gap-px text-[12px]", className),
|
|
4732
5194
|
onKeyDown: handleKeyDown,
|
|
4733
5195
|
...props,
|
|
4734
|
-
children: items.map((item) => /* @__PURE__ */ (0,
|
|
5196
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4735
5197
|
TreeItemRow,
|
|
4736
5198
|
{
|
|
4737
5199
|
item,
|
|
@@ -4766,8 +5228,8 @@ function TreeItemRow({
|
|
|
4766
5228
|
const isExpanded = hasChildren && expanded.has(item.id);
|
|
4767
5229
|
const isSelected = selected === item.id;
|
|
4768
5230
|
const isTabStop = tabStopId === item.id;
|
|
4769
|
-
return /* @__PURE__ */ (0,
|
|
4770
|
-
/* @__PURE__ */ (0,
|
|
5231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("li", { role: "none", children: [
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4771
5233
|
"div",
|
|
4772
5234
|
{
|
|
4773
5235
|
role: "treeitem",
|
|
@@ -4790,14 +5252,14 @@ function TreeItemRow({
|
|
|
4790
5252
|
isSelected ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2"
|
|
4791
5253
|
),
|
|
4792
5254
|
children: [
|
|
4793
|
-
/* @__PURE__ */ (0,
|
|
4794
|
-
item.icon && /* @__PURE__ */ (0,
|
|
4795
|
-
/* @__PURE__ */ (0,
|
|
5255
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { "aria-hidden": true, className: "text-text-dim grid w-3 place-items-center text-[10px]", children: hasChildren ? isExpanded ? "\u25BE" : "\u25B8" : "" }),
|
|
5256
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { "aria-hidden": true, className: "text-[12px] opacity-80", children: item.icon }),
|
|
5257
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "flex-1 truncate", children: item.label }),
|
|
4796
5258
|
item.trailing
|
|
4797
5259
|
]
|
|
4798
5260
|
}
|
|
4799
5261
|
),
|
|
4800
|
-
hasChildren && isExpanded && /* @__PURE__ */ (0,
|
|
5262
|
+
hasChildren && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("ul", { role: "group", className: "flex flex-col gap-px", children: (item.children ?? []).map((child) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4801
5263
|
TreeItemRow,
|
|
4802
5264
|
{
|
|
4803
5265
|
item: child,
|
|
@@ -4813,8 +5275,84 @@ function TreeItemRow({
|
|
|
4813
5275
|
)) })
|
|
4814
5276
|
] });
|
|
4815
5277
|
}
|
|
5278
|
+
|
|
5279
|
+
// src/patterns/WizardDialog/WizardDialog.tsx
|
|
5280
|
+
var RadixDialog5 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
5281
|
+
var import_react73 = require("react");
|
|
5282
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
5283
|
+
var WizardDialog = (0, import_react73.forwardRef)(function WizardDialog2({
|
|
5284
|
+
open,
|
|
5285
|
+
defaultOpen,
|
|
5286
|
+
onOpenChange,
|
|
5287
|
+
steps,
|
|
5288
|
+
initialStep = 0,
|
|
5289
|
+
onComplete,
|
|
5290
|
+
title,
|
|
5291
|
+
description,
|
|
5292
|
+
width = 560,
|
|
5293
|
+
nextLabel = "Next",
|
|
5294
|
+
completeLabel = "Done",
|
|
5295
|
+
backLabel = "Back",
|
|
5296
|
+
cancelLabel,
|
|
5297
|
+
onCancel
|
|
5298
|
+
}, ref) {
|
|
5299
|
+
const [current, setCurrent] = (0, import_react73.useState)(initialStep);
|
|
5300
|
+
const total = steps.length;
|
|
5301
|
+
const safeCurrent = Math.min(current, Math.max(0, total - 1));
|
|
5302
|
+
const step = steps[safeCurrent];
|
|
5303
|
+
const goTo = (0, import_react73.useCallback)(
|
|
5304
|
+
(index) => {
|
|
5305
|
+
setCurrent(Math.min(Math.max(0, index), Math.max(0, total - 1)));
|
|
5306
|
+
},
|
|
5307
|
+
[total]
|
|
5308
|
+
);
|
|
5309
|
+
const goNext = (0, import_react73.useCallback)(() => setCurrent((c) => Math.min(c + 1, total - 1)), [total]);
|
|
5310
|
+
const goBack = (0, import_react73.useCallback)(() => setCurrent((c) => Math.max(c - 1, 0)), []);
|
|
5311
|
+
const ctx = (0, import_react73.useMemo)(
|
|
5312
|
+
() => ({
|
|
5313
|
+
current: safeCurrent,
|
|
5314
|
+
total,
|
|
5315
|
+
goNext,
|
|
5316
|
+
goBack,
|
|
5317
|
+
goTo,
|
|
5318
|
+
isFirst: safeCurrent === 0,
|
|
5319
|
+
isLast: safeCurrent >= total - 1
|
|
5320
|
+
}),
|
|
5321
|
+
[safeCurrent, total, goNext, goBack, goTo]
|
|
5322
|
+
);
|
|
5323
|
+
const stepperSteps = (0, import_react73.useMemo)(() => steps.map((s) => ({ id: s.id, label: s.label })), [steps]);
|
|
5324
|
+
if (!step) return null;
|
|
5325
|
+
const canAdvance = step.canAdvance ? step.canAdvance(ctx) : true;
|
|
5326
|
+
const body = typeof step.content === "function" ? step.content(ctx) : step.content;
|
|
5327
|
+
const handlePrimary = () => {
|
|
5328
|
+
if (ctx.isLast) {
|
|
5329
|
+
onComplete?.();
|
|
5330
|
+
} else {
|
|
5331
|
+
goNext();
|
|
5332
|
+
}
|
|
5333
|
+
};
|
|
5334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DialogRoot, { open, defaultOpen, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(DialogContent, { ref, width, children: [
|
|
5335
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(WizardTitle, { children: title }),
|
|
5336
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(WizardDescription, { children: description }),
|
|
5337
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "mb-5", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Stepper, { steps: stepperSteps, current: safeCurrent }) }),
|
|
5338
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "mb-5", children: body }),
|
|
5339
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex justify-end gap-2", children: [
|
|
5340
|
+
cancelLabel && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { type: "button", variant: "ghost", onClick: onCancel, children: cancelLabel }),
|
|
5341
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { type: "button", variant: "secondary", onClick: goBack, disabled: ctx.isFirst, children: backLabel }),
|
|
5342
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { type: "button", variant: "primary", onClick: handlePrimary, disabled: !canAdvance, children: ctx.isLast ? completeLabel : nextLabel })
|
|
5343
|
+
] })
|
|
5344
|
+
] }) });
|
|
5345
|
+
});
|
|
5346
|
+
function WizardTitle({ children }) {
|
|
5347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(RadixDialog5.Title, { className: "mb-2 text-[16px] font-medium", children });
|
|
5348
|
+
}
|
|
5349
|
+
function WizardDescription({ children }) {
|
|
5350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(RadixDialog5.Description, { className: "text-text-muted mb-4 text-[13px] leading-[1.55]", children });
|
|
5351
|
+
}
|
|
5352
|
+
WizardDialog.displayName = "WizardDialog";
|
|
4816
5353
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4817
5354
|
0 && (module.exports = {
|
|
5355
|
+
ActivityTimeline,
|
|
4818
5356
|
Alert,
|
|
4819
5357
|
AlertDialog,
|
|
4820
5358
|
AlertDialogAction,
|
|
@@ -4867,6 +5405,8 @@ function TreeItemRow({
|
|
|
4867
5405
|
FAB,
|
|
4868
5406
|
Field,
|
|
4869
5407
|
FileChip,
|
|
5408
|
+
FilterPanel,
|
|
5409
|
+
HealthScore,
|
|
4870
5410
|
HoverCard,
|
|
4871
5411
|
HoverCardContent,
|
|
4872
5412
|
HoverCardPortal,
|
|
@@ -4888,6 +5428,7 @@ function TreeItemRow({
|
|
|
4888
5428
|
NavItem,
|
|
4889
5429
|
NavSection,
|
|
4890
5430
|
OTP,
|
|
5431
|
+
OnboardingChecklist,
|
|
4891
5432
|
Pagination,
|
|
4892
5433
|
Popover,
|
|
4893
5434
|
PopoverAnchor,
|
|
@@ -4901,6 +5442,7 @@ function TreeItemRow({
|
|
|
4901
5442
|
RadialProgress,
|
|
4902
5443
|
Radio,
|
|
4903
5444
|
RadioGroup,
|
|
5445
|
+
ScrollArea,
|
|
4904
5446
|
SearchInput,
|
|
4905
5447
|
Select,
|
|
4906
5448
|
SelectContent,
|
|
@@ -4941,11 +5483,13 @@ function TreeItemRow({
|
|
|
4941
5483
|
TooltipTrigger,
|
|
4942
5484
|
Topbar,
|
|
4943
5485
|
Tree,
|
|
5486
|
+
WizardDialog,
|
|
4944
5487
|
badgeStyles,
|
|
4945
5488
|
buttonStyles,
|
|
4946
5489
|
cardStyles,
|
|
4947
5490
|
cn,
|
|
4948
5491
|
filterCommandItems,
|
|
5492
|
+
formatRelative,
|
|
4949
5493
|
iconButtonStyles,
|
|
4950
5494
|
useControllableState,
|
|
4951
5495
|
useDisclosure,
|