@knkcs/anker 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.d.ts +11 -3
- package/dist/components/index.js +177 -71
- package/dist/components/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 };
|
package/dist/components/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import { text_input_default } from '../chunk-OU6H3KU4.js';
|
|
|
6
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, Search, PanelLeftOpen, PanelLeftClose, 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,
|
|
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';
|
|
@@ -1798,19 +1798,65 @@ SelectableCard.displayName = "SelectableCard";
|
|
|
1798
1798
|
SelectableCard.Thumbnail = SelectableCardThumbnail;
|
|
1799
1799
|
SelectableCard.Body = SelectableCardBody;
|
|
1800
1800
|
SelectableCard.Footer = SelectableCardFooter;
|
|
1801
|
-
var
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
borderRightWidth: "1px",
|
|
1810
|
-
borderRightColor: "border",
|
|
1811
|
-
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>");
|
|
1812
1809
|
}
|
|
1813
|
-
|
|
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__ */ jsx(
|
|
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
|
+
}
|
|
1858
|
+
) });
|
|
1859
|
+
};
|
|
1814
1860
|
SidebarRoot.displayName = "Sidebar";
|
|
1815
1861
|
var SidebarHeader = ({ children }) => /* @__PURE__ */ jsx(Box, { p: "4", borderBottomWidth: "1px", borderBottomColor: "border", children });
|
|
1816
1862
|
SidebarHeader.displayName = "Sidebar.Header";
|
|
@@ -1818,55 +1864,109 @@ var SidebarBody = ({ children }) => /* @__PURE__ */ jsx(Box, { flex: "1", overfl
|
|
|
1818
1864
|
SidebarBody.displayName = "Sidebar.Body";
|
|
1819
1865
|
var SidebarFooter = ({ children }) => /* @__PURE__ */ jsx(Box, { p: "3", borderTopWidth: "1px", borderTopColor: "border", children });
|
|
1820
1866
|
SidebarFooter.displayName = "Sidebar.Footer";
|
|
1821
|
-
var SidebarLogo = ({ wordmark, subtitle }) =>
|
|
1822
|
-
|
|
1823
|
-
|
|
1867
|
+
var SidebarLogo = ({ wordmark, subtitle }) => {
|
|
1868
|
+
const { collapsed, toggle } = useSidebarContext();
|
|
1869
|
+
const toggleButton = /* @__PURE__ */ jsx(
|
|
1870
|
+
IconButton,
|
|
1824
1871
|
{
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
children:
|
|
1872
|
+
"data-testid": "sidebar-toggle",
|
|
1873
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
1874
|
+
variant: "ghost",
|
|
1875
|
+
size: "sm",
|
|
1876
|
+
onClick: toggle,
|
|
1877
|
+
children: collapsed ? /* @__PURE__ */ jsx(PanelLeftOpen, { size: 16 }) : /* @__PURE__ */ jsx(PanelLeftClose, { size: 16 })
|
|
1831
1878
|
}
|
|
1832
|
-
)
|
|
1833
|
-
|
|
1834
|
-
|
|
1879
|
+
);
|
|
1880
|
+
if (collapsed) {
|
|
1881
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", gap: "2", children: [
|
|
1882
|
+
/* @__PURE__ */ jsx(
|
|
1883
|
+
Heading,
|
|
1884
|
+
{
|
|
1885
|
+
as: "span",
|
|
1886
|
+
fontSize: "lg",
|
|
1887
|
+
fontWeight: "bold",
|
|
1888
|
+
color: "primary.700",
|
|
1889
|
+
letterSpacing: "tight",
|
|
1890
|
+
children: wordmark.charAt(0)
|
|
1891
|
+
}
|
|
1892
|
+
),
|
|
1893
|
+
toggleButton
|
|
1894
|
+
] });
|
|
1895
|
+
}
|
|
1896
|
+
return /* @__PURE__ */ jsxs(
|
|
1897
|
+
Flex,
|
|
1835
1898
|
{
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1899
|
+
direction: "row",
|
|
1900
|
+
align: "center",
|
|
1901
|
+
justify: "space-between",
|
|
1902
|
+
gap: "2",
|
|
1903
|
+
w: "full",
|
|
1904
|
+
children: [
|
|
1905
|
+
/* @__PURE__ */ jsxs(Box, { mb: subtitle ? "0" : "0", children: [
|
|
1906
|
+
/* @__PURE__ */ jsx(
|
|
1907
|
+
Heading,
|
|
1908
|
+
{
|
|
1909
|
+
as: "span",
|
|
1910
|
+
fontSize: "lg",
|
|
1911
|
+
fontWeight: "bold",
|
|
1912
|
+
color: "primary.700",
|
|
1913
|
+
letterSpacing: "tight",
|
|
1914
|
+
children: wordmark
|
|
1915
|
+
}
|
|
1916
|
+
),
|
|
1917
|
+
subtitle && /* @__PURE__ */ jsx(
|
|
1918
|
+
Text,
|
|
1919
|
+
{
|
|
1920
|
+
fontSize: "2xs",
|
|
1921
|
+
fontWeight: "semibold",
|
|
1922
|
+
letterSpacing: "wider",
|
|
1923
|
+
textTransform: "uppercase",
|
|
1924
|
+
color: "muted",
|
|
1925
|
+
mt: "0.5",
|
|
1926
|
+
children: subtitle
|
|
1927
|
+
}
|
|
1928
|
+
)
|
|
1929
|
+
] }),
|
|
1930
|
+
toggleButton
|
|
1931
|
+
]
|
|
1843
1932
|
}
|
|
1844
|
-
)
|
|
1845
|
-
|
|
1933
|
+
);
|
|
1934
|
+
};
|
|
1846
1935
|
SidebarLogo.displayName = "Sidebar.Logo";
|
|
1847
1936
|
var SidebarSlot = ({ children }) => /* @__PURE__ */ jsx(Box, { mt: "3", children });
|
|
1848
1937
|
SidebarSlot.displayName = "Sidebar.Slot";
|
|
1849
|
-
var SidebarSection = ({ label, children }) =>
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1938
|
+
var SidebarSection = ({ label, children }) => {
|
|
1939
|
+
const { collapsed } = useSidebarContext();
|
|
1940
|
+
return /* @__PURE__ */ jsxs(Box, { mb: "4", px: "3", children: [
|
|
1941
|
+
!collapsed && /* @__PURE__ */ jsx(
|
|
1942
|
+
Text,
|
|
1943
|
+
{
|
|
1944
|
+
fontSize: "2xs",
|
|
1945
|
+
fontWeight: "semibold",
|
|
1946
|
+
letterSpacing: "wider",
|
|
1947
|
+
textTransform: "uppercase",
|
|
1948
|
+
color: "muted",
|
|
1949
|
+
px: "2",
|
|
1950
|
+
mb: "1",
|
|
1951
|
+
children: label
|
|
1952
|
+
}
|
|
1953
|
+
),
|
|
1954
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "0.5", children })
|
|
1955
|
+
] });
|
|
1956
|
+
};
|
|
1865
1957
|
SidebarSection.displayName = "Sidebar.Section";
|
|
1866
|
-
var SidebarItem = ({
|
|
1958
|
+
var SidebarItem = ({
|
|
1959
|
+
icon,
|
|
1960
|
+
children,
|
|
1961
|
+
asChild,
|
|
1962
|
+
active,
|
|
1963
|
+
label
|
|
1964
|
+
}) => {
|
|
1965
|
+
const { collapsed } = useSidebarContext();
|
|
1867
1966
|
const itemStyle = {
|
|
1868
1967
|
display: "flex",
|
|
1869
1968
|
alignItems: "center",
|
|
1969
|
+
justifyContent: collapsed ? "center" : "flex-start",
|
|
1870
1970
|
gap: "var(--chakra-spacing-2)",
|
|
1871
1971
|
paddingInline: "var(--chakra-spacing-3)",
|
|
1872
1972
|
paddingBlock: "var(--chakra-spacing-2)",
|
|
@@ -1880,7 +1980,7 @@ var SidebarItem = ({ icon, children, asChild, active }) => {
|
|
|
1880
1980
|
textDecoration: "none"
|
|
1881
1981
|
};
|
|
1882
1982
|
const iconEl = icon ? /* @__PURE__ */ jsx(Box, { display: "inline-flex", alignItems: "center", flexShrink: 0, children: icon }) : null;
|
|
1883
|
-
const activeTab = active ? /* @__PURE__ */ jsx(
|
|
1983
|
+
const activeTab = active && !collapsed ? /* @__PURE__ */ jsx(
|
|
1884
1984
|
"span",
|
|
1885
1985
|
{
|
|
1886
1986
|
"aria-hidden": "true",
|
|
@@ -1894,9 +1994,11 @@ var SidebarItem = ({ icon, children, asChild, active }) => {
|
|
|
1894
1994
|
}
|
|
1895
1995
|
}
|
|
1896
1996
|
) : null;
|
|
1997
|
+
const tooltipLabel = label || (typeof children === "string" ? children : "");
|
|
1998
|
+
const wrapTooltip = (node) => collapsed && tooltipLabel ? /* @__PURE__ */ jsx(Tooltip, { content: tooltipLabel, positioning: { placement: "right" }, children: node }) : node;
|
|
1897
1999
|
if (asChild) {
|
|
1898
2000
|
const child = React3.Children.only(children);
|
|
1899
|
-
|
|
2001
|
+
const cloned = React3.cloneElement(
|
|
1900
2002
|
child,
|
|
1901
2003
|
{
|
|
1902
2004
|
"data-active": active ? "true" : "false",
|
|
@@ -1906,26 +2008,30 @@ var SidebarItem = ({ icon, children, asChild, active }) => {
|
|
|
1906
2008
|
}
|
|
1907
2009
|
},
|
|
1908
2010
|
iconEl,
|
|
1909
|
-
child.props.children,
|
|
2011
|
+
collapsed ? null : child.props.children,
|
|
1910
2012
|
activeTab
|
|
1911
2013
|
);
|
|
2014
|
+
return wrapTooltip(cloned);
|
|
1912
2015
|
}
|
|
1913
|
-
return
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
2016
|
+
return wrapTooltip(
|
|
2017
|
+
/* @__PURE__ */ jsxs(
|
|
2018
|
+
Box,
|
|
2019
|
+
{
|
|
2020
|
+
"data-testid": "sidebar-item",
|
|
2021
|
+
"data-active": active ? "true" : "false",
|
|
2022
|
+
style: itemStyle,
|
|
2023
|
+
children: [
|
|
2024
|
+
iconEl,
|
|
2025
|
+
!collapsed && children,
|
|
2026
|
+
activeTab
|
|
2027
|
+
]
|
|
2028
|
+
}
|
|
2029
|
+
)
|
|
1925
2030
|
);
|
|
1926
2031
|
};
|
|
1927
2032
|
SidebarItem.displayName = "Sidebar.Item";
|
|
1928
2033
|
var SidebarUserMenu = ({ user, children }) => {
|
|
2034
|
+
const { collapsed } = useSidebarContext();
|
|
1929
2035
|
const initials = (user.name ?? user.email ?? "").split(/\s+/).slice(0, 2).map((s) => s[0]?.toUpperCase() ?? "").join("");
|
|
1930
2036
|
return /* @__PURE__ */ jsxs(MenuRoot, { children: [
|
|
1931
2037
|
/* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
@@ -1935,9 +2041,9 @@ var SidebarUserMenu = ({ user, children }) => {
|
|
|
1935
2041
|
variant: "ghost",
|
|
1936
2042
|
size: "md",
|
|
1937
2043
|
w: "full",
|
|
1938
|
-
justifyContent: "flex-start",
|
|
2044
|
+
justifyContent: collapsed ? "center" : "flex-start",
|
|
1939
2045
|
px: "2",
|
|
1940
|
-
children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", w: "full", children: [
|
|
2046
|
+
children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", w: collapsed ? "auto" : "full", children: [
|
|
1941
2047
|
/* @__PURE__ */ jsx(
|
|
1942
2048
|
Flex,
|
|
1943
2049
|
{
|
|
@@ -1954,7 +2060,7 @@ var SidebarUserMenu = ({ user, children }) => {
|
|
|
1954
2060
|
children: initials || "?"
|
|
1955
2061
|
}
|
|
1956
2062
|
),
|
|
1957
|
-
/* @__PURE__ */ jsxs(Box, { textAlign: "start", flex: "1", minW: "0", children: [
|
|
2063
|
+
!collapsed && /* @__PURE__ */ jsxs(Box, { textAlign: "start", flex: "1", minW: "0", children: [
|
|
1958
2064
|
/* @__PURE__ */ jsx(
|
|
1959
2065
|
Text,
|
|
1960
2066
|
{
|
|
@@ -2644,6 +2750,6 @@ var Widget = ({
|
|
|
2644
2750
|
};
|
|
2645
2751
|
Widget.displayName = "Widget";
|
|
2646
2752
|
|
|
2647
|
-
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 };
|
|
2753
|
+
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 };
|
|
2648
2754
|
//# sourceMappingURL=index.js.map
|
|
2649
2755
|
//# sourceMappingURL=index.js.map
|