@caratlogic/design-system 0.1.7 → 0.1.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardShell.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/AppShell/DashboardShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;AAuC/C,OAAO,KAAK,EAMV,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAgW1B,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAkDlD,CAAC"}
1
+ {"version":3,"file":"DashboardShell.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/AppShell/DashboardShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;AAwC/C,OAAO,KAAK,EAMV,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AA8X1B,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAkDlD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.parts.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Sidebar/Sidebar.parts.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMlE,OAAO,EAEL,cAAc,EAGf,MAAM,yBAAyB,CAAC;AAYjC,UAAU,mBAAmB;IAC3B,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,UAAU,EAAE,OAAO,C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O,EACL,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,CAAC;AAEF,eAAO,MAAM,WAAW,8GAA4B,CAAC;AACrD,eAAO,MAAM,kBAAkB,wHAA+B,CAAC;AAC/D,eAAO,MAAM,kBAAkB,qHAA+B,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -57479,7 +57479,11 @@ const SidebarInset = React__namespace.forwardRef(({ className, ...props }, ref)
57479
57479
  SidebarInset.displayName = 'SidebarInset';
57480
57480
  const SidebarInput = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("input", { ref: ref, "data-sidebar": "input", className: cn('h-8 w-full bg-background text-sm shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring', className), ...props })));
57481
57481
  SidebarInput.displayName = 'SidebarInput';
57482
- const SidebarHeader = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("div", { ref: ref, "data-sidebar": "header", className: cn('flex flex-col gap-2 pr-1 pt-3 pb-4 pl-4', className), ...props })));
57482
+ const SidebarHeader = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("div", { ref: ref, "data-sidebar": "header",
57483
+ /* Icon mode drops the asymmetric pl-4/pr-1 (which is there for the expanded
57484
+ brand + collapse button row) so a centred brand lands on the same axis as
57485
+ the nav icons below it. */
57486
+ className: cn('flex flex-col gap-2 pr-1 pt-3 pb-4 pl-4 group-data-[collapsible=icon]:px-0', className), ...props })));
57483
57487
  SidebarHeader.displayName = 'SidebarHeader';
57484
57488
  const SidebarFooter = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("div", { ref: ref, "data-sidebar": "footer", className: cn('flex flex-col gap-2 pr-1 py-4 pl-4', className), ...props })));
57485
57489
  SidebarFooter.displayName = 'SidebarFooter';
@@ -57505,6 +57509,21 @@ const SidebarMenu = React__namespace.forwardRef(({ className, ...props }, ref) =
57505
57509
  SidebarMenu.displayName = 'SidebarMenu';
57506
57510
  const SidebarMenuItem = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("li", { ref: ref, "data-sidebar": "menu-item", className: cn('group/menu-item relative', className), ...props })));
57507
57511
  SidebarMenuItem.displayName = 'SidebarMenuItem';
57512
+ /**
57513
+ * Owns a nav tooltip's open state so every tooltip closes when the sidebar
57514
+ * expands or collapses. The width transition slides buttons out from under a
57515
+ * stationary pointer without firing `pointerleave`, so Radix otherwise keeps
57516
+ * each tooltip it opened on the way in — they surface together the moment the
57517
+ * rail renders them, and only a fresh hover dismisses them one by one.
57518
+ */
57519
+ const useSidebarTooltipOpen = () => {
57520
+ const { state } = useSidebar();
57521
+ const [open, setOpen] = React__namespace.useState(false);
57522
+ React__namespace.useEffect(() => {
57523
+ setOpen(false);
57524
+ }, [state]);
57525
+ return { open, setOpen };
57526
+ };
57508
57527
  const sidebarMenuButtonVariants = cva('peer/menu-button relative flex h-9 w-full cursor-pointer items-center gap-2 overflow-hidden rounded-sm px-2.5 py-1.5 text-left text-sm text-sidebar-foreground outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-active-bg data-[active=true]:text-sidebar-foreground data-[state=open]:hover:bg-sidebar-active-bg data-[state=open]:hover:text-sidebar-foreground group-data-[collapsible=icon]:!size-9 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:[&>span]:hidden [&>span]:truncate [&>svg]:size-4 [&>svg]:shrink-0', {
57509
57528
  variants: {
57510
57529
  variant: {
@@ -57527,13 +57546,15 @@ const SidebarMenuButton = React__namespace.forwardRef(({ asChild = false, isActi
57527
57546
  const { state } = useSidebar();
57528
57547
  const [innerRef, setRef] = useForwardedRef(ref);
57529
57548
  const truncatedText = useTruncatedText(innerRef);
57549
+ const { open: tooltipOpen, setOpen: setTooltipOpen } = useSidebarTooltipOpen();
57530
57550
  const button = (jsxRuntime.jsx(Comp, { ref: setRef, "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className), ...props }));
57531
57551
  // Tooltip when collapsed (icon-only) OR when the expanded label is clipped.
57532
57552
  // The Tooltip structure stays mounted and only the content is conditional,
57533
57553
  // so toggling it never remounts the button.
57534
57554
  const collapsed = !!tooltip && state === 'collapsed';
57535
57555
  const collapsedProps = typeof tooltip === 'string' ? { children: tooltip } : tooltip;
57536
- return (jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }), collapsed ? (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, ...collapsedProps })) : truncatedText ? (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText })) : null] }));
57556
+ const tooltipContent = collapsed ? (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, ...collapsedProps })) : truncatedText ? (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText })) : null;
57557
+ return (jsxRuntime.jsxs(Tooltip, { open: !!tooltipContent && tooltipOpen, onOpenChange: setTooltipOpen, children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }), tooltipContent] }));
57537
57558
  });
57538
57559
  SidebarMenuButton.displayName = 'SidebarMenuButton';
57539
57560
  const SidebarMenuAction = React__namespace.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
@@ -57557,9 +57578,10 @@ const SidebarMenuSubButton = React__namespace.forwardRef(({ asChild = false, siz
57557
57578
  const Comp = asChild ? reactSlot.Slot : 'a';
57558
57579
  const [innerRef, setRef] = useForwardedRef(ref);
57559
57580
  const truncatedText = useTruncatedText(innerRef);
57581
+ const { open: tooltipOpen, setOpen: setTooltipOpen } = useSidebarTooltipOpen();
57560
57582
  const button = (jsxRuntime.jsx(Comp, { ref: setRef, "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn('relative flex h-9 w-full min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-sm pl-3 pr-1 py-1.5 text-left text-sidebar-foreground/80 outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span]:truncate [&>svg]:size-4 [&>svg]:shrink-0', 'data-[active=true]:bg-sidebar-primary data-[active=true]:text-sidebar-primary-foreground', size === 'sm' && 'text-xs', size === 'md' && 'text-sm', 'group-data-[collapsible=icon]:hidden', className), ...props }));
57561
57583
  // Keep the Tooltip mounted; render the content only when the label is clipped.
57562
- return (jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }), truncatedText && (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText }))] }));
57584
+ return (jsxRuntime.jsxs(Tooltip, { open: !!truncatedText && tooltipOpen, onOpenChange: setTooltipOpen, children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }), truncatedText && (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText }))] }));
57563
57585
  });
57564
57586
  SidebarMenuSubButton.displayName = 'SidebarMenuSubButton';
57565
57587
  const Collapsible = CollapsiblePrimitive__namespace.Root;
@@ -65829,6 +65851,15 @@ const DEFAULT_SIDEBAR_WIDTH = '248px';
65829
65851
  /** Green pill marking the active top-level item. Rendered in-flow as the row's
65830
65852
  * first flex child (hidden when the sidebar collapses to icons). */
65831
65853
  const ActiveRail = () => (jsxRuntime.jsx("span", { "aria-hidden": "true", className: "pointer-events-none h-9 w-[4px] shrink-0 rounded-full bg-sidebar-primary group-data-[collapsible=icon]:hidden" }));
65854
+ /** Collapsed, the rail is also the way back into the menu: clicking any nav
65855
+ * item opens the sidebar, not just the brand. */
65856
+ const useCollapsedSidebar = () => {
65857
+ const { state, isMobile, setOpen } = useSidebar();
65858
+ return {
65859
+ collapsed: !isMobile && state === 'collapsed',
65860
+ expandSidebar: () => setOpen(true),
65861
+ };
65862
+ };
65832
65863
  const BrandHeader = ({ brand }) => {
65833
65864
  const { state, isMobile, openMobile, toggleSidebar } = useSidebar();
65834
65865
  const expanded = state === 'expanded' || (isMobile && openMobile);
@@ -65840,13 +65871,31 @@ const BrandHeader = ({ brand }) => {
65840
65871
  const NavLeaf = ({ item, currentPath, onNavigate }) => {
65841
65872
  const Icon = item.icon;
65842
65873
  const active = isPathActive(currentPath, item.path);
65843
- return (jsxRuntime.jsxs(SidebarMenuItem, { className: cn(active && 'flex items-center gap-1.5 group-data-[collapsible=icon]:block'), children: [active && jsxRuntime.jsx(ActiveRail, {}), jsxRuntime.jsxs(SidebarMenuButton, { isActive: active, tooltip: item.label, onClick: () => item.path && onNavigate(item.path), className: cn(active && 'min-w-0 flex-1 group-data-[collapsible=icon]:flex-none'), children: [Icon && jsxRuntime.jsx(Icon, {}), jsxRuntime.jsx("span", { children: item.label })] }), item.badge != null && (jsxRuntime.jsx(SidebarMenuBadge, { className: "h-5 w-5 min-w-5 rounded-full border border-primary bg-primary/10 p-0 text-primary", children: item.badge }))] }));
65874
+ const { collapsed, expandSidebar } = useCollapsedSidebar();
65875
+ return (jsxRuntime.jsxs(SidebarMenuItem, { className: cn(active && 'flex items-center gap-1.5 group-data-[collapsible=icon]:block'), children: [active && jsxRuntime.jsx(ActiveRail, {}), jsxRuntime.jsxs(SidebarMenuButton, { isActive: active, tooltip: item.label, onClick: () => {
65876
+ if (collapsed)
65877
+ expandSidebar();
65878
+ if (item.path)
65879
+ onNavigate(item.path);
65880
+ }, className: cn(active && 'min-w-0 flex-1 group-data-[collapsible=icon]:flex-none'), children: [Icon && jsxRuntime.jsx(Icon, {}), jsxRuntime.jsx("span", { children: item.label })] }), item.badge != null && (jsxRuntime.jsx(SidebarMenuBadge, { className: "h-5 w-5 min-w-5 rounded-full border border-primary bg-primary/10 p-0 text-primary", children: item.badge }))] }));
65844
65881
  };
65845
65882
  const NavParent = ({ item, currentPath, onNavigate }) => {
65846
65883
  const Icon = item.icon;
65847
65884
  const children = (item.children ?? []).filter((s) => s.visible !== false);
65848
65885
  const parentActive = children.some((s) => isPathActive(currentPath, s.path));
65849
- return (jsxRuntime.jsx(Collapsible, { asChild: true, defaultOpen: parentActive, children: jsxRuntime.jsxs(SidebarMenuItem, { className: "group/collapsible", children: [jsxRuntime.jsxs("div", { className: cn(parentActive &&
65886
+ const { collapsed, expandSidebar } = useCollapsedSidebar();
65887
+ const [open, setOpen] = React.useState(parentActive);
65888
+ // Collapsed, the sub-menu is hidden, so a click opens the sidebar and this
65889
+ // group instead of silently toggling something the user cannot see.
65890
+ const handleOpenChange = (next) => {
65891
+ if (!collapsed) {
65892
+ setOpen(next);
65893
+ return;
65894
+ }
65895
+ expandSidebar();
65896
+ setOpen(true);
65897
+ };
65898
+ return (jsxRuntime.jsx(Collapsible, { asChild: true, open: open, onOpenChange: handleOpenChange, children: jsxRuntime.jsxs(SidebarMenuItem, { className: "group/collapsible", children: [jsxRuntime.jsxs("div", { className: cn(parentActive &&
65850
65899
  'flex items-center gap-1.5 group-data-[collapsible=icon]:block'), children: [parentActive && jsxRuntime.jsx(ActiveRail, {}), jsxRuntime.jsx(CollapsibleTrigger, { asChild: true, children: jsxRuntime.jsxs(SidebarMenuButton, { isActive: parentActive, tooltip: item.label, className: cn(parentActive &&
65851
65900
  'min-w-0 flex-1 group-data-[collapsible=icon]:flex-none'), children: [Icon && jsxRuntime.jsx(Icon, {}), jsxRuntime.jsx("span", { children: item.label }), jsxRuntime.jsx(ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90 group-data-[collapsible=icon]:hidden" })] }) })] }), jsxRuntime.jsx(CollapsibleContent, { children: jsxRuntime.jsx(SidebarMenuSub, { children: children.map((sub) => {
65852
65901
  const SubIcon = sub.icon;