@knkcs/anker 1.6.0 → 1.8.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.
@@ -12,14 +12,14 @@ type ButtonProps = Omit<ButtonProps$1, "variant"> & {
12
12
  variant?: "solid" | "subtle" | "surface" | "outline" | "ghost" | "plain" | "primary" | "secondary" | "link" | "link-gray" | undefined;
13
13
  };
14
14
  declare const Button: {
15
- ({ ref, ...props }: ButtonProps & {
15
+ ({ ref, colorPalette, ...props }: ButtonProps & {
16
16
  ref?: React.Ref<HTMLButtonElement>;
17
17
  }): react_jsx_runtime.JSX.Element;
18
18
  displayName: string;
19
19
  };
20
20
 
21
21
  declare const IconButton: {
22
- ({ ref, ...props }: IconButtonProps & {
22
+ ({ ref, colorPalette, ...props }: IconButtonProps & {
23
23
  ref?: React.Ref<HTMLButtonElement>;
24
24
  }): react_jsx_runtime.JSX.Element;
25
25
  displayName: string;
@@ -7,8 +7,8 @@ import { Textarea } from '../chunk-NFZMG6ZL.js';
7
7
  import { text_input_default } from '../chunk-OU6H3KU4.js';
8
8
  export { text_input_default as TextInput } from '../chunk-OU6H3KU4.js';
9
9
  import { Spinner } from '../chunk-5YDCDC4B.js';
10
- import { IconButton, Button } from '../chunk-SJ6YXNZW.js';
11
- export { Button, IconButton } from '../chunk-SJ6YXNZW.js';
10
+ import { IconButton, Button } from '../chunk-JS7ZEZV3.js';
11
+ export { Button, IconButton } from '../chunk-JS7ZEZV3.js';
12
12
  import { Text, Box, Stack as Stack$1, Flex, HStack, Heading } from '../chunk-G4QMIXLC.js';
13
13
  import { jsx, jsxs } from 'react/jsx-runtime';
14
14
  import { DataList as DataList$1, Icon, Circle, useCheckboxGroup, Stack, Box as Box$1, Clipboard, IconButton as IconButton$1, Input, chakra, ButtonGroup, Button as Button$1, Square } from '@chakra-ui/react';
@@ -4,6 +4,7 @@ import { jsx } from 'react/jsx-runtime';
4
4
  // src/atoms/button/button.tsx
5
5
  var Button = ({
6
6
  ref,
7
+ colorPalette = "primary",
7
8
  ...props
8
9
  }) => {
9
10
  return /* @__PURE__ */ jsx(
@@ -11,6 +12,7 @@ var Button = ({
11
12
  {
12
13
  size: "md",
13
14
  variant: "secondary",
15
+ colorPalette,
14
16
  ref,
15
17
  ...props
16
18
  }
@@ -19,12 +21,22 @@ var Button = ({
19
21
  Button.displayName = "Button";
20
22
  var IconButton = ({
21
23
  ref,
24
+ colorPalette = "primary",
22
25
  ...props
23
26
  }) => {
24
- return /* @__PURE__ */ jsx(IconButton$1, { size: "md", variant: "ghost", ref, ...props });
27
+ return /* @__PURE__ */ jsx(
28
+ IconButton$1,
29
+ {
30
+ size: "md",
31
+ variant: "ghost",
32
+ colorPalette,
33
+ ref,
34
+ ...props
35
+ }
36
+ );
25
37
  };
26
38
  IconButton.displayName = "IconButton";
27
39
 
28
40
  export { Button, IconButton };
29
- //# sourceMappingURL=chunk-SJ6YXNZW.js.map
30
- //# sourceMappingURL=chunk-SJ6YXNZW.js.map
41
+ //# sourceMappingURL=chunk-JS7ZEZV3.js.map
42
+ //# sourceMappingURL=chunk-JS7ZEZV3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/atoms/button/button.tsx","../src/atoms/button/icon-button.tsx"],"names":["ChakraButton","jsx","ChakraIconButton"],"mappings":";;;;AAsBO,IAAM,SAAS,CAAC;AAAA,EACtB,GAAA;AAAA,EACA,YAAA,GAAe,SAAA;AAAA,EACf,GAAG;AACJ,CAAA,KAA4D;AAC3D,EAAA,uBACC,GAAA;AAAA,IAACA,QAAA;AAAA,IAAA;AAAA,MACA,IAAA,EAAK,IAAA;AAAA,MACL,OAAA,EAAS,WAAA;AAAA,MACT,YAAA;AAAA,MACA,GAAA;AAAA,MACC,GAAI;AAAA;AAAA,GACN;AAEF;AACA,MAAA,CAAO,WAAA,GAAc,QAAA;AC9Bd,IAAM,aAAa,CAAC;AAAA,EAC1B,GAAA;AAAA,EACA,YAAA,GAAe,SAAA;AAAA,EACf,GAAG;AACJ,CAAA,KAAgE;AAC/D,EAAA,uBACCC,GAAAA;AAAA,IAACC,YAAA;AAAA,IAAA;AAAA,MACA,IAAA,EAAK,IAAA;AAAA,MACL,OAAA,EAAQ,OAAA;AAAA,MACR,YAAA;AAAA,MACA,GAAA;AAAA,MACC,GAAG;AAAA;AAAA,GACL;AAEF;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"chunk-JS7ZEZV3.js","sourcesContent":["import {\n\tButton as ChakraButton,\n\ttype ButtonProps as ChakraButtonProps,\n} from \"@chakra-ui/react\";\n\n// Extend ButtonProps to include custom variants defined in the @knkcs/anker\n// theme (primary, secondary, link-gray) that are not in Chakra's default types.\nexport type ButtonProps = Omit<ChakraButtonProps, \"variant\"> & {\n\tvariant?:\n\t\t| \"solid\"\n\t\t| \"subtle\"\n\t\t| \"surface\"\n\t\t| \"outline\"\n\t\t| \"ghost\"\n\t\t| \"plain\"\n\t\t| \"primary\"\n\t\t| \"secondary\"\n\t\t| \"link\"\n\t\t| \"link-gray\"\n\t\t| undefined;\n};\n\nexport const Button = ({\n\tref,\n\tcolorPalette = \"primary\",\n\t...props\n}: ButtonProps & { ref?: React.Ref<HTMLButtonElement> }) => {\n\treturn (\n\t\t<ChakraButton\n\t\t\tsize=\"md\"\n\t\t\tvariant={\"secondary\" as ChakraButtonProps[\"variant\"]}\n\t\t\tcolorPalette={colorPalette}\n\t\t\tref={ref}\n\t\t\t{...(props as ChakraButtonProps)}\n\t\t/>\n\t);\n};\nButton.displayName = \"Button\";\n","import {\n\tIconButton as ChakraIconButton,\n\ttype IconButtonProps,\n} from \"@chakra-ui/react\";\n\nexport type { IconButtonProps };\n\nexport const IconButton = ({\n\tref,\n\tcolorPalette = \"primary\",\n\t...props\n}: IconButtonProps & { ref?: React.Ref<HTMLButtonElement> }) => {\n\treturn (\n\t\t<ChakraIconButton\n\t\t\tsize=\"md\"\n\t\t\tvariant=\"ghost\"\n\t\t\tcolorPalette={colorPalette}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\nIconButton.displayName = \"IconButton\";\n"]}
@@ -575,7 +575,14 @@ declare const SelectableCard: {
575
575
  };
576
576
  };
577
577
 
578
+ interface SidebarContextValue {
579
+ collapsed: boolean;
580
+ toggle: () => void;
581
+ }
582
+ declare function useSidebarContext(): SidebarContextValue;
578
583
  interface SidebarProps {
584
+ storageKey?: string;
585
+ defaultCollapsed?: boolean;
579
586
  children: React__default.ReactNode;
580
587
  }
581
588
  interface SidebarLogoProps {
@@ -591,6 +598,7 @@ interface SidebarItemProps {
591
598
  children: React__default.ReactNode;
592
599
  asChild?: boolean;
593
600
  active?: boolean;
601
+ label?: string;
594
602
  }
595
603
  interface SidebarUserMenuProps {
596
604
  user: {
@@ -605,7 +613,7 @@ interface SidebarUserMenuItemProps {
605
613
  children: React__default.ReactNode;
606
614
  }
607
615
  declare const Sidebar: {
608
- ({ children }: SidebarProps): react_jsx_runtime.JSX.Element;
616
+ ({ storageKey, defaultCollapsed, children, }: SidebarProps): react_jsx_runtime.JSX.Element;
609
617
  displayName: string;
610
618
  } & {
611
619
  Header: {
@@ -641,7 +649,7 @@ declare const Sidebar: {
641
649
  displayName: string;
642
650
  };
643
651
  Item: {
644
- ({ icon, children, asChild, active }: SidebarItemProps): react_jsx_runtime.JSX.Element;
652
+ ({ icon, children, asChild, active, label, }: SidebarItemProps): react_jsx_runtime.JSX.Element;
645
653
  displayName: string;
646
654
  };
647
655
  UserMenu: {
@@ -935,4 +943,4 @@ interface WidgetProps {
935
943
  }
936
944
  declare const Widget: React__default.FC<WidgetProps>;
937
945
 
938
- export { ActionCell, type ActionCellAction, type ActionCellProps, AuthCard, type AuthCardProps, BooleanCell, type BooleanCellProps, BulkActionBar, type BulkActionBarProps, type BulkActionProps, type BulkPopoverActionProps, Card, CardList, CardListData, type CardListDataProps, CardListItem, type CardListItemProps, type CardListMenuItem, type CardListProps, type CardProps, ChipPicker, type ChipPickerProps, CodeCell, type CodeCellProps, ColorSwatchCell, type ColorSwatchCellProps, ContextRail, type ContextRailHeaderProps, type ContextRailProps, type ContextRailSectionProps, CountCell, type CountCellProps, DataTable, type DataTableProps, DateCell, type DateCellProps, type DrawerProps, DrawerRoot, FactBox, type FactBoxAction, type FactBoxProps, InlineCreatableList, type InlineCreatableListProps, LabeledSwitch, type LabeledSwitchProps, LinkCell, type LinkCellProps, MenuCell, type MenuCellAction, type MenuCellProps, Modal, type ModalProps, NumberCell, type NumberCellProps, PageHeader, type PageHeaderBreadcrumb, type PageHeaderProps, Pagination, type PaginationProps, SelectableCard, type SelectableCardBodyProps, type SelectableCardFooterProps, type SelectableCardProps, type SelectableCardThumbnailProps, Sidebar, type SidebarItemProps, type SidebarLogoProps, type SidebarSectionProps$1 as SidebarNavSectionProps, type SidebarProps, SidebarSection, type SidebarSectionProps, type SidebarUserMenuItemProps, type SidebarUserMenuProps, SlugCell, type SlugCellProps, StatusBadgeCell, type StatusBadgeCellProps, Stepper, StepperCompleted, StepperContainer, StepperContent, type StepperContentProps, StepperIcon, type StepperIconProps, type StepperProps, StepperProvider, StepperSeparator, type StepperSeparatorProps, StepperStep, type StepperStepProps, StepperStepTitle, StepperSteps, type StepperStepsProps, SwitchCell, type SwitchCellProps, CardList as Table, CardListData as TableData, type CardListDataProps as TableDataProps, CardListItem as TableItem, type CardListItemProps as TableItemProps, type CardListMenuItem as TableMenuItem, type CardListProps as TableProps, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, type TimelineItemProps, TimelineRoot, type TimelineRootProps, TimelineSeparator, TimelineTitle, Toolbar, type ToolbarFilterChipProps, type ToolbarSearchProps, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, type TreeViewBranchProps, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, type TreeViewItemProps, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, type TreeViewRootProps, TreeViewTree, TruncatedTextCell, type TruncatedTextCellProps, UploadDropZone, type UploadDropZoneProps, UrlCell, type UrlCellProps, type UseStepProps, type UseStepperProps, type UseStepperReturn, Widget, type WidgetProps, emptyCellValue, pluralize, truncateText, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
946
+ export { ActionCell, type ActionCellAction, type ActionCellProps, AuthCard, type AuthCardProps, BooleanCell, type BooleanCellProps, BulkActionBar, type BulkActionBarProps, type BulkActionProps, type BulkPopoverActionProps, Card, CardList, CardListData, type CardListDataProps, CardListItem, type CardListItemProps, type CardListMenuItem, type CardListProps, type CardProps, ChipPicker, type ChipPickerProps, CodeCell, type CodeCellProps, ColorSwatchCell, type ColorSwatchCellProps, ContextRail, type ContextRailHeaderProps, type ContextRailProps, type ContextRailSectionProps, CountCell, type CountCellProps, DataTable, type DataTableProps, DateCell, type DateCellProps, type DrawerProps, DrawerRoot, FactBox, type FactBoxAction, type FactBoxProps, InlineCreatableList, type InlineCreatableListProps, LabeledSwitch, type LabeledSwitchProps, LinkCell, type LinkCellProps, MenuCell, type MenuCellAction, type MenuCellProps, Modal, type ModalProps, NumberCell, type NumberCellProps, PageHeader, type PageHeaderBreadcrumb, type PageHeaderProps, Pagination, type PaginationProps, SelectableCard, type SelectableCardBodyProps, type SelectableCardFooterProps, type SelectableCardProps, type SelectableCardThumbnailProps, Sidebar, type SidebarItemProps, type SidebarLogoProps, type SidebarSectionProps$1 as SidebarNavSectionProps, type SidebarProps, SidebarSection, type SidebarSectionProps, type SidebarUserMenuItemProps, type SidebarUserMenuProps, SlugCell, type SlugCellProps, StatusBadgeCell, type StatusBadgeCellProps, Stepper, StepperCompleted, StepperContainer, StepperContent, type StepperContentProps, StepperIcon, type StepperIconProps, type StepperProps, StepperProvider, StepperSeparator, type StepperSeparatorProps, StepperStep, type StepperStepProps, StepperStepTitle, StepperSteps, type StepperStepsProps, SwitchCell, type SwitchCellProps, CardList as Table, CardListData as TableData, type CardListDataProps as TableDataProps, CardListItem as TableItem, type CardListItemProps as TableItemProps, type CardListMenuItem as TableMenuItem, type CardListProps as TableProps, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, type TimelineItemProps, TimelineRoot, type TimelineRootProps, TimelineSeparator, TimelineTitle, Toolbar, type ToolbarFilterChipProps, type ToolbarSearchProps, TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, type TreeViewBranchProps, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, type TreeViewItemProps, TreeViewItemText, TreeViewLabel, TreeViewNode, TreeViewRoot, type TreeViewRootProps, TreeViewTree, TruncatedTextCell, type TruncatedTextCellProps, UploadDropZone, type UploadDropZoneProps, UrlCell, type UrlCellProps, type UseStepProps, type UseStepperProps, type UseStepperReturn, Widget, type WidgetProps, emptyCellValue, pluralize, truncateText, useSidebarContext, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
@@ -3,13 +3,13 @@ import { formatRelativeDateTime, StatusBadge } from '../chunk-NQN6LXYU.js';
3
3
  import { MenuItem, MenuRoot, MenuTrigger, MenuContent, Tooltip, Table } from '../chunk-2QFOWHTU.js';
4
4
  import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Switch } from '../chunk-WQIEF5N3.js';
5
5
  import { text_input_default } from '../chunk-OU6H3KU4.js';
6
- import { Button, IconButton } from '../chunk-SJ6YXNZW.js';
6
+ import { Button, IconButton } from '../chunk-JS7ZEZV3.js';
7
7
  import { Box, Flex, Text, Heading, HStack, Grid, GridItem, Code, Link, VStack, Spacer, Stack } from '../chunk-G4QMIXLC.js';
8
8
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
- import { PanelRightOpen, PanelRightClose, ChevronRight, Search, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
9
+ import { PanelRightOpen, PanelRightClose, ChevronRight, PanelLeftOpen, PanelLeftClose, Search, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
10
10
  import { createContext, Timeline, TreeView, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe, chakra } from '@chakra-ui/react';
11
11
  export { createTreeCollection } from '@chakra-ui/react';
12
- import React3, { createContext as createContext$1, useState, useEffect, Children, useMemo, useRef, useCallback, useContext } from 'react';
12
+ import React3, { createContext as createContext$1, useState, useEffect, useMemo, Children, useRef, useCallback, useContext } from 'react';
13
13
  import dayjs from 'dayjs';
14
14
  import { Link as Link$1 } from 'react-router-dom';
15
15
  import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
@@ -1035,6 +1035,9 @@ function DataTableInner(props) {
1035
1035
  const selectionColumn = useMemo(
1036
1036
  () => ({
1037
1037
  id: "_select",
1038
+ size: 40,
1039
+ minSize: 40,
1040
+ maxSize: 40,
1038
1041
  header: ({ table: table2 }) => /* @__PURE__ */ jsxs(
1039
1042
  Checkbox.Root,
1040
1043
  {
@@ -1092,6 +1095,7 @@ function DataTableInner(props) {
1092
1095
  /* @__PURE__ */ jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(Table.Row, { children: headerGroup.headers.map((header) => {
1093
1096
  const canSort = header.column.getCanSort();
1094
1097
  const sorted = header.column.getIsSorted();
1098
+ const isSelectCol = header.column.id === "_select";
1095
1099
  return /* @__PURE__ */ jsx(
1096
1100
  Table.ColumnHeader,
1097
1101
  {
@@ -1107,6 +1111,7 @@ function DataTableInner(props) {
1107
1111
  header.column.getToggleSortingHandler()?.(e);
1108
1112
  }
1109
1113
  } : void 0,
1114
+ style: isSelectCol ? { width: header.column.getSize() } : void 0,
1110
1115
  children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 1, children: [
1111
1116
  header.isPlaceholder ? null : flexRender(
1112
1117
  header.column.columnDef.header,
@@ -1136,10 +1141,17 @@ function DataTableInner(props) {
1136
1141
  onRowClick(row.original);
1137
1142
  }
1138
1143
  } : void 0,
1139
- children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(Table.Cell, { children: flexRender(
1140
- cell.column.columnDef.cell,
1141
- cell.getContext()
1142
- ) }, cell.id))
1144
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
1145
+ Table.Cell,
1146
+ {
1147
+ style: cell.column.id === "_select" ? { width: cell.column.getSize() } : void 0,
1148
+ children: flexRender(
1149
+ cell.column.columnDef.cell,
1150
+ cell.getContext()
1151
+ )
1152
+ },
1153
+ cell.id
1154
+ ))
1143
1155
  },
1144
1156
  row.id
1145
1157
  )),
@@ -1786,19 +1798,78 @@ SelectableCard.displayName = "SelectableCard";
1786
1798
  SelectableCard.Thumbnail = SelectableCardThumbnail;
1787
1799
  SelectableCard.Body = SelectableCardBody;
1788
1800
  SelectableCard.Footer = SelectableCardFooter;
1789
- var SidebarRoot = ({ children }) => /* @__PURE__ */ jsx(
1790
- Flex,
1791
- {
1792
- "data-testid": "sidebar",
1793
- direction: "column",
1794
- w: "240px",
1795
- minH: "100vh",
1796
- bg: "bg-canvas",
1797
- borderRightWidth: "1px",
1798
- borderRightColor: "border",
1799
- children
1801
+ var COLLAPSED_WIDTH2 = "64px";
1802
+ var EXPANDED_WIDTH2 = "240px";
1803
+ var COLLAPSE_BREAKPOINT2 = 1440;
1804
+ var SidebarContext = React3.createContext(null);
1805
+ function useSidebarContext() {
1806
+ const ctx = React3.useContext(SidebarContext);
1807
+ if (!ctx) {
1808
+ throw new Error("useSidebarContext must be used inside <Sidebar>");
1800
1809
  }
1801
- );
1810
+ return ctx;
1811
+ }
1812
+ function getInitialCollapsed2(storageKey, defaultCollapsed) {
1813
+ if (typeof window === "undefined") return defaultCollapsed ?? false;
1814
+ if (storageKey) {
1815
+ const stored = window.localStorage.getItem(storageKey);
1816
+ if (stored === "true") return true;
1817
+ if (stored === "false") return false;
1818
+ }
1819
+ if (defaultCollapsed !== void 0) return defaultCollapsed;
1820
+ return window.innerWidth < COLLAPSE_BREAKPOINT2;
1821
+ }
1822
+ var SidebarRoot = ({
1823
+ storageKey,
1824
+ defaultCollapsed,
1825
+ children
1826
+ }) => {
1827
+ const [collapsed, setCollapsed] = useState(
1828
+ () => getInitialCollapsed2(storageKey, defaultCollapsed)
1829
+ );
1830
+ useEffect(() => {
1831
+ if (storageKey) {
1832
+ window.localStorage.setItem(storageKey, String(collapsed));
1833
+ }
1834
+ }, [collapsed, storageKey]);
1835
+ const ctx = useMemo(
1836
+ () => ({
1837
+ collapsed,
1838
+ toggle: () => setCollapsed((c) => !c)
1839
+ }),
1840
+ [collapsed]
1841
+ );
1842
+ return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
1843
+ Flex,
1844
+ {
1845
+ "data-testid": "sidebar",
1846
+ "data-collapsed": collapsed ? "true" : "false",
1847
+ direction: "column",
1848
+ w: collapsed ? COLLAPSED_WIDTH2 : EXPANDED_WIDTH2,
1849
+ minH: "100vh",
1850
+ bg: "bg-canvas",
1851
+ borderRightWidth: "1px",
1852
+ borderRightColor: "border",
1853
+ transition: "width 250ms ease-out",
1854
+ overflow: "hidden",
1855
+ 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
+ ]
1870
+ }
1871
+ ) });
1872
+ };
1802
1873
  SidebarRoot.displayName = "Sidebar";
1803
1874
  var SidebarHeader = ({ children }) => /* @__PURE__ */ jsx(Box, { p: "4", borderBottomWidth: "1px", borderBottomColor: "border", children });
1804
1875
  SidebarHeader.displayName = "Sidebar.Header";
@@ -1806,55 +1877,82 @@ var SidebarBody = ({ children }) => /* @__PURE__ */ jsx(Box, { flex: "1", overfl
1806
1877
  SidebarBody.displayName = "Sidebar.Body";
1807
1878
  var SidebarFooter = ({ children }) => /* @__PURE__ */ jsx(Box, { p: "3", borderTopWidth: "1px", borderTopColor: "border", children });
1808
1879
  SidebarFooter.displayName = "Sidebar.Footer";
1809
- var SidebarLogo = ({ wordmark, subtitle }) => /* @__PURE__ */ jsxs(Box, { mb: subtitle ? "3" : "0", children: [
1810
- /* @__PURE__ */ jsx(
1811
- Heading,
1812
- {
1813
- as: "span",
1814
- fontSize: "lg",
1815
- fontWeight: "bold",
1816
- color: "primary.700",
1817
- letterSpacing: "tight",
1818
- children: wordmark
1819
- }
1820
- ),
1821
- subtitle && /* @__PURE__ */ jsx(
1822
- Text,
1823
- {
1824
- fontSize: "2xs",
1825
- fontWeight: "semibold",
1826
- letterSpacing: "wider",
1827
- textTransform: "uppercase",
1828
- color: "muted",
1829
- mt: "0.5",
1830
- children: subtitle
1831
- }
1832
- )
1833
- ] });
1880
+ var SidebarLogo = ({ wordmark, subtitle }) => {
1881
+ const { collapsed } = useSidebarContext();
1882
+ 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
+ ) });
1894
+ }
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
+ ] });
1920
+ };
1834
1921
  SidebarLogo.displayName = "Sidebar.Logo";
1835
1922
  var SidebarSlot = ({ children }) => /* @__PURE__ */ jsx(Box, { mt: "3", children });
1836
1923
  SidebarSlot.displayName = "Sidebar.Slot";
1837
- var SidebarSection = ({ label, children }) => /* @__PURE__ */ jsxs(Box, { mb: "4", px: "3", children: [
1838
- /* @__PURE__ */ jsx(
1839
- Text,
1840
- {
1841
- fontSize: "2xs",
1842
- fontWeight: "semibold",
1843
- letterSpacing: "wider",
1844
- textTransform: "uppercase",
1845
- color: "muted",
1846
- px: "2",
1847
- mb: "1",
1848
- children: label
1849
- }
1850
- ),
1851
- /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "0.5", children })
1852
- ] });
1924
+ var SidebarSection = ({ label, children }) => {
1925
+ const { collapsed } = useSidebarContext();
1926
+ return /* @__PURE__ */ jsxs(Box, { mb: "4", px: "3", children: [
1927
+ !collapsed && /* @__PURE__ */ jsx(
1928
+ Text,
1929
+ {
1930
+ fontSize: "2xs",
1931
+ fontWeight: "semibold",
1932
+ letterSpacing: "wider",
1933
+ textTransform: "uppercase",
1934
+ color: "muted",
1935
+ px: "2",
1936
+ mb: "1",
1937
+ children: label
1938
+ }
1939
+ ),
1940
+ /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "0.5", children })
1941
+ ] });
1942
+ };
1853
1943
  SidebarSection.displayName = "Sidebar.Section";
1854
- var SidebarItem = ({ icon, children, asChild, active }) => {
1944
+ var SidebarItem = ({
1945
+ icon,
1946
+ children,
1947
+ asChild,
1948
+ active,
1949
+ label
1950
+ }) => {
1951
+ const { collapsed } = useSidebarContext();
1855
1952
  const itemStyle = {
1856
1953
  display: "flex",
1857
1954
  alignItems: "center",
1955
+ justifyContent: collapsed ? "center" : "flex-start",
1858
1956
  gap: "var(--chakra-spacing-2)",
1859
1957
  paddingInline: "var(--chakra-spacing-3)",
1860
1958
  paddingBlock: "var(--chakra-spacing-2)",
@@ -1868,7 +1966,7 @@ var SidebarItem = ({ icon, children, asChild, active }) => {
1868
1966
  textDecoration: "none"
1869
1967
  };
1870
1968
  const iconEl = icon ? /* @__PURE__ */ jsx(Box, { display: "inline-flex", alignItems: "center", flexShrink: 0, children: icon }) : null;
1871
- const activeTab = active ? /* @__PURE__ */ jsx(
1969
+ const activeTab = active && !collapsed ? /* @__PURE__ */ jsx(
1872
1970
  "span",
1873
1971
  {
1874
1972
  "aria-hidden": "true",
@@ -1882,9 +1980,11 @@ var SidebarItem = ({ icon, children, asChild, active }) => {
1882
1980
  }
1883
1981
  }
1884
1982
  ) : null;
1983
+ const tooltipLabel = label || (typeof children === "string" ? children : "");
1984
+ const wrapTooltip = (node) => collapsed && tooltipLabel ? /* @__PURE__ */ jsx(Tooltip, { content: tooltipLabel, positioning: { placement: "right" }, children: node }) : node;
1885
1985
  if (asChild) {
1886
1986
  const child = React3.Children.only(children);
1887
- return React3.cloneElement(
1987
+ const cloned = React3.cloneElement(
1888
1988
  child,
1889
1989
  {
1890
1990
  "data-active": active ? "true" : "false",
@@ -1894,26 +1994,30 @@ var SidebarItem = ({ icon, children, asChild, active }) => {
1894
1994
  }
1895
1995
  },
1896
1996
  iconEl,
1897
- child.props.children,
1997
+ collapsed ? null : child.props.children,
1898
1998
  activeTab
1899
1999
  );
2000
+ return wrapTooltip(cloned);
1900
2001
  }
1901
- return /* @__PURE__ */ jsxs(
1902
- Box,
1903
- {
1904
- "data-testid": "sidebar-item",
1905
- "data-active": active ? "true" : "false",
1906
- style: itemStyle,
1907
- children: [
1908
- iconEl,
1909
- children,
1910
- activeTab
1911
- ]
1912
- }
2002
+ return wrapTooltip(
2003
+ /* @__PURE__ */ jsxs(
2004
+ Box,
2005
+ {
2006
+ "data-testid": "sidebar-item",
2007
+ "data-active": active ? "true" : "false",
2008
+ style: itemStyle,
2009
+ children: [
2010
+ iconEl,
2011
+ !collapsed && children,
2012
+ activeTab
2013
+ ]
2014
+ }
2015
+ )
1913
2016
  );
1914
2017
  };
1915
2018
  SidebarItem.displayName = "Sidebar.Item";
1916
2019
  var SidebarUserMenu = ({ user, children }) => {
2020
+ const { collapsed } = useSidebarContext();
1917
2021
  const initials = (user.name ?? user.email ?? "").split(/\s+/).slice(0, 2).map((s) => s[0]?.toUpperCase() ?? "").join("");
1918
2022
  return /* @__PURE__ */ jsxs(MenuRoot, { children: [
1919
2023
  /* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
@@ -1923,9 +2027,9 @@ var SidebarUserMenu = ({ user, children }) => {
1923
2027
  variant: "ghost",
1924
2028
  size: "md",
1925
2029
  w: "full",
1926
- justifyContent: "flex-start",
2030
+ justifyContent: collapsed ? "center" : "flex-start",
1927
2031
  px: "2",
1928
- children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", w: "full", children: [
2032
+ children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", w: collapsed ? "auto" : "full", children: [
1929
2033
  /* @__PURE__ */ jsx(
1930
2034
  Flex,
1931
2035
  {
@@ -1942,7 +2046,7 @@ var SidebarUserMenu = ({ user, children }) => {
1942
2046
  children: initials || "?"
1943
2047
  }
1944
2048
  ),
1945
- /* @__PURE__ */ jsxs(Box, { textAlign: "start", flex: "1", minW: "0", children: [
2049
+ !collapsed && /* @__PURE__ */ jsxs(Box, { textAlign: "start", flex: "1", minW: "0", children: [
1946
2050
  /* @__PURE__ */ jsx(
1947
2051
  Text,
1948
2052
  {
@@ -2632,6 +2736,6 @@ var Widget = ({
2632
2736
  };
2633
2737
  Widget.displayName = "Widget";
2634
2738
 
2635
- 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, useStep, useStepper, useStepperContext, useStepperNextButton, useStepperPrevButton };
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 };
2636
2740
  //# sourceMappingURL=index.js.map
2637
2741
  //# sourceMappingURL=index.js.map