@knkcs/anker 1.8.0 → 1.9.0

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.
@@ -4,9 +4,10 @@ import { MenuItem, MenuRoot, MenuTrigger, MenuContent, Tooltip, Table } from '..
4
4
  import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Switch } from '../chunk-WQIEF5N3.js';
5
5
  import { text_input_default } from '../chunk-OU6H3KU4.js';
6
6
  import { Button, IconButton } from '../chunk-JS7ZEZV3.js';
7
+ export { AuthCard, PageHeader } from '../chunk-D5ICTOCW.js';
7
8
  import { Box, Flex, Text, Heading, HStack, Grid, GridItem, Code, Link, VStack, Spacer, Stack } from '../chunk-G4QMIXLC.js';
9
+ import { PanelRightOpen, PanelRightClose, ChevronRight, Search, PanelLeftOpen, PanelLeftClose, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
8
10
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
- import { PanelRightOpen, PanelRightClose, ChevronRight, PanelLeftOpen, PanelLeftClose, Search, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
10
11
  import { createContext, Timeline, TreeView, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe, chakra } from '@chakra-ui/react';
11
12
  export { createTreeCollection } from '@chakra-ui/react';
12
13
  import React3, { createContext as createContext$1, useState, useEffect, useMemo, Children, useRef, useCallback, useContext } from 'react';
@@ -14,106 +15,6 @@ import dayjs from 'dayjs';
14
15
  import { Link as Link$1 } from 'react-router-dom';
15
16
  import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
16
17
 
17
- var SIZE_TO_WIDTH = {
18
- md: "440px",
19
- lg: "480px"
20
- };
21
- var DOT_PATTERN_BG = "radial-gradient(var(--chakra-colors-primary-200) 1px, transparent 1px)";
22
- var AuthCard = ({
23
- logo,
24
- topBarRight,
25
- hideTopBar = false,
26
- hideBackground = false,
27
- eyebrow,
28
- title,
29
- subtitle,
30
- size = "md",
31
- footer,
32
- children
33
- }) => {
34
- return /* @__PURE__ */ jsx(Box, { "data-testid": "auth-card", "data-size": size, minH: "100vh", bg: "bg-canvas", children: /* @__PURE__ */ jsxs(
35
- Box,
36
- {
37
- "data-testid": "auth-card-canvas",
38
- "data-background": hideBackground ? "hidden" : "visible",
39
- minH: "100vh",
40
- bgImage: hideBackground ? void 0 : DOT_PATTERN_BG,
41
- bgSize: "24px 24px",
42
- children: [
43
- !hideTopBar && /* @__PURE__ */ jsxs(
44
- Flex,
45
- {
46
- align: "center",
47
- justify: "space-between",
48
- px: "8",
49
- py: "4",
50
- bg: "bg-surface/85",
51
- backdropFilter: "blur(4px)",
52
- borderBottom: "1px solid",
53
- borderColor: "border",
54
- children: [
55
- /* @__PURE__ */ jsx(Box, { children: logo }),
56
- /* @__PURE__ */ jsx(Flex, { gap: "4", fontSize: "xs", color: "muted", children: topBarRight })
57
- ]
58
- }
59
- ),
60
- /* @__PURE__ */ jsx(Flex, { justify: "center", pt: "16", px: "4", children: /* @__PURE__ */ jsxs(
61
- Box,
62
- {
63
- w: "full",
64
- maxW: SIZE_TO_WIDTH[size],
65
- bg: "bg-surface",
66
- borderRadius: "lg",
67
- shadow: "md",
68
- p: "8",
69
- children: [
70
- eyebrow && /* @__PURE__ */ jsx(
71
- Text,
72
- {
73
- textStyle: "overline",
74
- color: "muted",
75
- textAlign: "center",
76
- mb: "2",
77
- children: eyebrow
78
- }
79
- ),
80
- title && /* @__PURE__ */ jsx(
81
- Heading,
82
- {
83
- as: "h3",
84
- size: "2xl",
85
- fontWeight: "semibold",
86
- color: "default",
87
- textAlign: "center",
88
- mb: "2",
89
- letterSpacing: "-0.02em",
90
- children: title
91
- }
92
- ),
93
- subtitle && /* @__PURE__ */ jsx(Text, { color: "muted", textAlign: "center", fontSize: "sm", mb: "6", children: subtitle }),
94
- children,
95
- footer && /* @__PURE__ */ jsx(
96
- Box,
97
- {
98
- "data-testid": "auth-card-footer",
99
- mt: "6",
100
- pt: "4",
101
- borderTop: "1px solid",
102
- borderColor: "border",
103
- textAlign: "center",
104
- fontSize: "xs",
105
- color: "emphasized",
106
- children: footer
107
- }
108
- )
109
- ]
110
- }
111
- ) })
112
- ]
113
- }
114
- ) });
115
- };
116
- AuthCard.displayName = "AuthCard";
117
18
  var BulkAction = ({
118
19
  label,
119
20
  icon,
@@ -1614,105 +1515,6 @@ var Modal = ({
1614
1515
  );
1615
1516
  };
1616
1517
  Modal.displayName = "Modal";
1617
- var PageHeader = ({
1618
- breadcrumbs,
1619
- title,
1620
- subtitle,
1621
- actions,
1622
- eyebrow
1623
- }) => {
1624
- const hasCrumbs = !!breadcrumbs && breadcrumbs.length > 0;
1625
- const hasActions = !!actions;
1626
- return /* @__PURE__ */ jsxs(
1627
- Box,
1628
- {
1629
- py: "4",
1630
- px: "8",
1631
- borderBottomWidth: "1px",
1632
- borderBottomColor: "border",
1633
- bg: "bg-surface",
1634
- children: [
1635
- eyebrow && /* @__PURE__ */ jsx(
1636
- Text,
1637
- {
1638
- fontSize: "2xs",
1639
- fontWeight: "semibold",
1640
- letterSpacing: "wider",
1641
- textTransform: "uppercase",
1642
- color: "muted",
1643
- mb: "1",
1644
- children: eyebrow
1645
- }
1646
- ),
1647
- hasCrumbs && /* @__PURE__ */ jsx(
1648
- Flex,
1649
- {
1650
- "data-testid": "page-header-breadcrumbs",
1651
- align: "center",
1652
- gap: "1",
1653
- mb: "1",
1654
- fontSize: "xs",
1655
- color: "muted",
1656
- children: breadcrumbs.map((c, idx) => {
1657
- const isLast = idx === breadcrumbs.length - 1;
1658
- const sep = !isLast ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: " \u203A " }) : null;
1659
- const node = c.to ? /* @__PURE__ */ jsx(
1660
- Link,
1661
- {
1662
- href: c.to,
1663
- color: "muted",
1664
- _hover: { color: "default" },
1665
- children: c.label
1666
- },
1667
- `crumb-link-${c.label}`
1668
- ) : /* @__PURE__ */ jsx(
1669
- Text,
1670
- {
1671
- as: "span",
1672
- color: isLast ? "default" : "muted",
1673
- fontWeight: isLast ? "medium" : "normal",
1674
- children: c.label
1675
- },
1676
- `crumb-text-${c.label}`
1677
- );
1678
- return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "1", children: [
1679
- node,
1680
- sep
1681
- ] }, `crumb-wrap-${c.label}`);
1682
- })
1683
- }
1684
- ),
1685
- /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", gap: "4", children: [
1686
- /* @__PURE__ */ jsxs(Box, { flex: "1", minW: "0", children: [
1687
- /* @__PURE__ */ jsx(
1688
- Heading,
1689
- {
1690
- as: "h1",
1691
- fontSize: "2xl",
1692
- fontWeight: "semibold",
1693
- color: "default",
1694
- letterSpacing: "-0.02em",
1695
- children: title
1696
- }
1697
- ),
1698
- subtitle && /* @__PURE__ */ jsx(
1699
- Text,
1700
- {
1701
- "data-testid": "page-header-subtitle",
1702
- fontSize: "sm",
1703
- color: "muted",
1704
- mt: "1",
1705
- children: subtitle
1706
- }
1707
- )
1708
- ] }),
1709
- hasActions && /* @__PURE__ */ jsx(Flex, { align: "center", gap: "2", flexShrink: 0, children: actions })
1710
- ] })
1711
- ]
1712
- }
1713
- );
1714
- };
1715
- PageHeader.displayName = "PageHeader";
1716
1518
  var SelectableCardThumbnail = ({
1717
1519
  height = "160px",
1718
1520
  children
@@ -1839,7 +1641,7 @@ var SidebarRoot = ({
1839
1641
  }),
1840
1642
  [collapsed]
1841
1643
  );
1842
- return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
1644
+ return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
1843
1645
  Flex,
1844
1646
  {
1845
1647
  "data-testid": "sidebar",
@@ -1853,20 +1655,7 @@ var SidebarRoot = ({
1853
1655
  transition: "width 250ms ease-out",
1854
1656
  overflow: "hidden",
1855
1657
  position: "relative",
1856
- children: [
1857
- /* @__PURE__ */ jsx(Flex, { justify: "flex-end", px: "2", pt: "2", children: /* @__PURE__ */ jsx(
1858
- IconButton,
1859
- {
1860
- "data-testid": "sidebar-toggle",
1861
- "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
1862
- variant: "ghost",
1863
- size: "sm",
1864
- onClick: () => setCollapsed((c) => !c),
1865
- children: collapsed ? /* @__PURE__ */ jsx(PanelLeftOpen, { size: 16 }) : /* @__PURE__ */ jsx(PanelLeftClose, { size: 16 })
1866
- }
1867
- ) }),
1868
- children
1869
- ]
1658
+ children
1870
1659
  }
1871
1660
  ) });
1872
1661
  };
@@ -1878,45 +1667,72 @@ SidebarBody.displayName = "Sidebar.Body";
1878
1667
  var SidebarFooter = ({ children }) => /* @__PURE__ */ jsx(Box, { p: "3", borderTopWidth: "1px", borderTopColor: "border", children });
1879
1668
  SidebarFooter.displayName = "Sidebar.Footer";
1880
1669
  var SidebarLogo = ({ wordmark, subtitle }) => {
1881
- const { collapsed } = useSidebarContext();
1670
+ const { collapsed, toggle } = useSidebarContext();
1671
+ const toggleButton = /* @__PURE__ */ jsx(
1672
+ IconButton,
1673
+ {
1674
+ "data-testid": "sidebar-toggle",
1675
+ "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
1676
+ variant: "ghost",
1677
+ size: "sm",
1678
+ onClick: toggle,
1679
+ children: collapsed ? /* @__PURE__ */ jsx(PanelLeftOpen, { size: 16 }) : /* @__PURE__ */ jsx(PanelLeftClose, { size: 16 })
1680
+ }
1681
+ );
1882
1682
  if (collapsed) {
1883
- return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
1884
- Heading,
1885
- {
1886
- as: "span",
1887
- fontSize: "lg",
1888
- fontWeight: "bold",
1889
- color: "primary.700",
1890
- letterSpacing: "tight",
1891
- children: wordmark.charAt(0)
1892
- }
1893
- ) });
1683
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", gap: "2", children: [
1684
+ /* @__PURE__ */ jsx(
1685
+ Heading,
1686
+ {
1687
+ as: "span",
1688
+ fontSize: "lg",
1689
+ fontWeight: "bold",
1690
+ color: "primary.700",
1691
+ letterSpacing: "tight",
1692
+ children: wordmark.charAt(0)
1693
+ }
1694
+ ),
1695
+ toggleButton
1696
+ ] });
1894
1697
  }
1895
- return /* @__PURE__ */ jsxs(Box, { mb: subtitle ? "3" : "0", children: [
1896
- /* @__PURE__ */ jsx(
1897
- Heading,
1898
- {
1899
- as: "span",
1900
- fontSize: "lg",
1901
- fontWeight: "bold",
1902
- color: "primary.700",
1903
- letterSpacing: "tight",
1904
- children: wordmark
1905
- }
1906
- ),
1907
- subtitle && /* @__PURE__ */ jsx(
1908
- Text,
1909
- {
1910
- fontSize: "2xs",
1911
- fontWeight: "semibold",
1912
- letterSpacing: "wider",
1913
- textTransform: "uppercase",
1914
- color: "muted",
1915
- mt: "0.5",
1916
- children: subtitle
1917
- }
1918
- )
1919
- ] });
1698
+ return /* @__PURE__ */ jsxs(
1699
+ Flex,
1700
+ {
1701
+ direction: "row",
1702
+ align: "center",
1703
+ justify: "space-between",
1704
+ gap: "2",
1705
+ w: "full",
1706
+ children: [
1707
+ /* @__PURE__ */ jsxs(Box, { mb: subtitle ? "0" : "0", children: [
1708
+ /* @__PURE__ */ jsx(
1709
+ Heading,
1710
+ {
1711
+ as: "span",
1712
+ fontSize: "lg",
1713
+ fontWeight: "bold",
1714
+ color: "primary.700",
1715
+ letterSpacing: "tight",
1716
+ children: wordmark
1717
+ }
1718
+ ),
1719
+ subtitle && /* @__PURE__ */ jsx(
1720
+ Text,
1721
+ {
1722
+ fontSize: "2xs",
1723
+ fontWeight: "semibold",
1724
+ letterSpacing: "wider",
1725
+ textTransform: "uppercase",
1726
+ color: "muted",
1727
+ mt: "0.5",
1728
+ children: subtitle
1729
+ }
1730
+ )
1731
+ ] }),
1732
+ toggleButton
1733
+ ]
1734
+ }
1735
+ );
1920
1736
  };
1921
1737
  SidebarLogo.displayName = "Sidebar.Logo";
1922
1738
  var SidebarSlot = ({ children }) => /* @__PURE__ */ jsx(Box, { mt: "3", children });
@@ -2736,6 +2552,6 @@ var Widget = ({
2736
2552
  };
2737
2553
  Widget.displayName = "Widget";
2738
2554
 
2739
- export { ActionCell, AuthCard, BooleanCell, BulkActionBar, Card, CardList, CardListData, CardListItem, ChipPicker, CodeCell, ColorSwatchCell, ContextRail, CountCell, DataTable, DateCell, DrawerRoot, FactBox, InlineCreatableList, LabeledSwitch, LinkCell, MenuCell, Modal, NumberCell, PageHeader, Pagination, SelectableCard, Sidebar, SidebarSection2 as SidebarSection, SlugCell, StatusBadgeCell, Stepper, StepperCompleted, StepperContainer, StepperContent, StepperIcon, StepperProvider, StepperSeparator, StepperStep, StepperStepTitle, StepperSteps, SwitchCell, CardList as Table, CardListData as TableData, CardListItem as TableItem, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineRoot, TimelineSeparator, TimelineTitle, Toolbar, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, TreeViewTree, TruncatedTextCell, UploadDropZone, UrlCell, Widget, emptyCellValue, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
2555
+ export { ActionCell, BooleanCell, BulkActionBar, Card, CardList, CardListData, CardListItem, ChipPicker, CodeCell, ColorSwatchCell, ContextRail, CountCell, DataTable, DateCell, DrawerRoot, FactBox, InlineCreatableList, LabeledSwitch, LinkCell, MenuCell, Modal, NumberCell, Pagination, SelectableCard, Sidebar, SidebarSection2 as SidebarSection, SlugCell, StatusBadgeCell, Stepper, StepperCompleted, StepperContainer, StepperContent, StepperIcon, StepperProvider, StepperSeparator, StepperStep, StepperStepTitle, StepperSteps, SwitchCell, CardList as Table, CardListData as TableData, CardListItem as TableItem, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineRoot, TimelineSeparator, TimelineTitle, Toolbar, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, TreeViewTree, TruncatedTextCell, UploadDropZone, UrlCell, Widget, emptyCellValue, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
2740
2556
  //# sourceMappingURL=index.js.map
2741
2557
  //# sourceMappingURL=index.js.map