@dimaan/ui 0.0.29 → 0.0.30
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 +25 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -344,7 +344,7 @@ function DashboardMain({ className, children, ...props }) {
|
|
|
344
344
|
// stretching the whole layout past 100%.
|
|
345
345
|
"flex min-h-screen min-w-0 flex-1 flex-col transition-[margin] duration-200 ease-out",
|
|
346
346
|
// On desktop, push the main column past the fixed sidebar using logical margin.
|
|
347
|
-
collapsed ? "lg:ms-
|
|
347
|
+
collapsed ? "lg:ms-0" : "lg:ms-(--sidebar-width)",
|
|
348
348
|
className
|
|
349
349
|
),
|
|
350
350
|
...props,
|
|
@@ -513,14 +513,16 @@ function Sidebar({ className, children, ...props }) {
|
|
|
513
513
|
"fixed inset-y-0 start-0 z-40 flex flex-col",
|
|
514
514
|
// Surface
|
|
515
515
|
"bg-sidebar text-sidebar-foreground border-e border-sidebar-border",
|
|
516
|
-
// Sizing — width
|
|
517
|
-
|
|
516
|
+
// Sizing — always full width; collapse hides it off-canvas (below).
|
|
517
|
+
"w-[var(--sidebar-width)]",
|
|
518
518
|
// Motion
|
|
519
|
-
"transition-
|
|
520
|
-
// Mobile slide
|
|
521
|
-
//
|
|
522
|
-
|
|
523
|
-
|
|
519
|
+
"transition-transform duration-200 ease-out",
|
|
520
|
+
// Mobile: slide in/out via mobileOpen. Logical translate (rtl variant)
|
|
521
|
+
// so it slides off the inline-start edge in both LTR and RTL.
|
|
522
|
+
mobileOpen ? "translate-x-0" : "-translate-x-full rtl:translate-x-full",
|
|
523
|
+
// Desktop: collapse fully hides the sidebar off-canvas; the header
|
|
524
|
+
// trigger slides it back in and the main content reclaims the width.
|
|
525
|
+
collapsed ? "lg:-translate-x-full lg:rtl:translate-x-full" : "lg:translate-x-0 lg:rtl:translate-x-0",
|
|
524
526
|
className
|
|
525
527
|
),
|
|
526
528
|
...props,
|
|
@@ -543,18 +545,8 @@ function SidebarFooter({ className, children, ...props }) {
|
|
|
543
545
|
);
|
|
544
546
|
}
|
|
545
547
|
function SidebarGroup({ label, className, children, ...props }) {
|
|
546
|
-
const { collapsed } = useDashboardLayout();
|
|
547
548
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1 py-2", className), ...props, children: [
|
|
548
|
-
label ? /* @__PURE__ */ jsx(
|
|
549
|
-
"div",
|
|
550
|
-
{
|
|
551
|
-
className: cn(
|
|
552
|
-
"px-3 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground transition-opacity",
|
|
553
|
-
collapsed && "pointer-events-none h-0 overflow-hidden opacity-0"
|
|
554
|
-
),
|
|
555
|
-
children: label
|
|
556
|
-
}
|
|
557
|
-
) : null,
|
|
549
|
+
label ? /* @__PURE__ */ jsx("div", { className: "px-3 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: label }) : null,
|
|
558
550
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children })
|
|
559
551
|
] });
|
|
560
552
|
}
|
|
@@ -588,7 +580,6 @@ function SidebarNavGroup({
|
|
|
588
580
|
onClick,
|
|
589
581
|
...props
|
|
590
582
|
}) {
|
|
591
|
-
const { collapsed } = useDashboardLayout();
|
|
592
583
|
const submenuId = useId();
|
|
593
584
|
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
594
585
|
const isControlled = openProp !== void 0;
|
|
@@ -615,27 +606,23 @@ function SidebarNavGroup({
|
|
|
615
606
|
const isActive = active || hasActiveChild;
|
|
616
607
|
const prevHasActiveChild = useRef(false);
|
|
617
608
|
useEffect(() => {
|
|
618
|
-
if (hasActiveChild && !prevHasActiveChild.current
|
|
609
|
+
if (hasActiveChild && !prevHasActiveChild.current) {
|
|
619
610
|
setOpen(true);
|
|
620
611
|
}
|
|
621
612
|
prevHasActiveChild.current = hasActiveChild;
|
|
622
|
-
}, [hasActiveChild,
|
|
623
|
-
|
|
624
|
-
if (collapsed && open) setOpen(false);
|
|
625
|
-
}, [collapsed, open, setOpen]);
|
|
626
|
-
const titleAttr = collapsed && typeof label === "string" ? label : props.title ?? void 0;
|
|
627
|
-
const showChildren = !collapsed;
|
|
613
|
+
}, [hasActiveChild, setOpen]);
|
|
614
|
+
const titleAttr = props.title ?? void 0;
|
|
628
615
|
return /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-col", children: [
|
|
629
616
|
/* @__PURE__ */ jsxs(
|
|
630
617
|
"button",
|
|
631
618
|
{
|
|
632
619
|
type: "button",
|
|
633
|
-
"aria-expanded":
|
|
634
|
-
"aria-controls":
|
|
620
|
+
"aria-expanded": open,
|
|
621
|
+
"aria-controls": submenuId,
|
|
635
622
|
"data-active": isActive ? "true" : void 0,
|
|
636
623
|
title: titleAttr,
|
|
637
624
|
onClick: (e) => {
|
|
638
|
-
|
|
625
|
+
setOpen(!open);
|
|
639
626
|
onClick?.(e);
|
|
640
627
|
},
|
|
641
628
|
className: cn(
|
|
@@ -643,7 +630,6 @@ function SidebarNavGroup({
|
|
|
643
630
|
"text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
644
631
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-sidebar",
|
|
645
632
|
isActive && "bg-sidebar-accent text-sidebar-accent-foreground",
|
|
646
|
-
collapsed && "justify-center px-0",
|
|
647
633
|
className
|
|
648
634
|
),
|
|
649
635
|
...props,
|
|
@@ -656,18 +642,9 @@ function SidebarNavGroup({
|
|
|
656
642
|
}
|
|
657
643
|
) : null,
|
|
658
644
|
icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "flex size-5 shrink-0 items-center justify-center", children: icon }) : null,
|
|
659
|
-
/* @__PURE__ */ jsx(
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
className: cn(
|
|
663
|
-
"flex-1 truncate text-start transition-[opacity,width]",
|
|
664
|
-
collapsed && "pointer-events-none w-0 opacity-0"
|
|
665
|
-
),
|
|
666
|
-
children: label
|
|
667
|
-
}
|
|
668
|
-
),
|
|
669
|
-
endSlot && !collapsed ? /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center", children: endSlot }) : null,
|
|
670
|
-
showChildren ? /* @__PURE__ */ jsx(ChevronCaret, { open }) : null
|
|
645
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-start", children: label }),
|
|
646
|
+
endSlot ? /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center", children: endSlot }) : null,
|
|
647
|
+
/* @__PURE__ */ jsx(ChevronCaret, { open })
|
|
671
648
|
]
|
|
672
649
|
}
|
|
673
650
|
),
|
|
@@ -675,10 +652,10 @@ function SidebarNavGroup({
|
|
|
675
652
|
"div",
|
|
676
653
|
{
|
|
677
654
|
id: submenuId,
|
|
678
|
-
hidden: !
|
|
655
|
+
hidden: !open,
|
|
679
656
|
className: cn(
|
|
680
657
|
"grid transition-[grid-template-rows] duration-200 ease-out",
|
|
681
|
-
|
|
658
|
+
open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
682
659
|
),
|
|
683
660
|
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5 ps-7 pt-1", children: /* @__PURE__ */ jsx(SidebarNavGroupContext.Provider, { value: contextValue, children }) }) })
|
|
684
661
|
}
|
|
@@ -709,7 +686,6 @@ function SidebarNavItem({
|
|
|
709
686
|
end,
|
|
710
687
|
...props
|
|
711
688
|
}) {
|
|
712
|
-
const { collapsed } = useDashboardLayout();
|
|
713
689
|
const resolved = useResolvedPath(to);
|
|
714
690
|
const group = useContext(SidebarNavGroupContext);
|
|
715
691
|
const itemId = useId();
|
|
@@ -721,13 +697,12 @@ function SidebarNavItem({
|
|
|
721
697
|
return () => group.reportActive(itemId, false);
|
|
722
698
|
}, [group, itemId, isActive]);
|
|
723
699
|
const labelContent = label ?? children;
|
|
724
|
-
const titleAttr =
|
|
700
|
+
const titleAttr = props.title;
|
|
725
701
|
const getClassName = (active) => cn(
|
|
726
702
|
"group relative flex h-9 shrink-0 items-center gap-3 rounded-md px-3 text-sm font-medium outline-none transition-colors",
|
|
727
703
|
"text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
728
704
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-sidebar",
|
|
729
705
|
active && "bg-sidebar-accent text-sidebar-accent-foreground",
|
|
730
|
-
collapsed && "justify-center px-0",
|
|
731
706
|
className
|
|
732
707
|
);
|
|
733
708
|
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -739,17 +714,8 @@ function SidebarNavItem({
|
|
|
739
714
|
}
|
|
740
715
|
) : null,
|
|
741
716
|
icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "flex size-5 shrink-0 items-center justify-center", children: icon }) : null,
|
|
742
|
-
/* @__PURE__ */ jsx(
|
|
743
|
-
|
|
744
|
-
{
|
|
745
|
-
className: cn(
|
|
746
|
-
"flex-1 truncate text-start transition-[opacity,width]",
|
|
747
|
-
collapsed && "pointer-events-none w-0 opacity-0"
|
|
748
|
-
),
|
|
749
|
-
children: labelContent
|
|
750
|
-
}
|
|
751
|
-
),
|
|
752
|
-
endSlot && !collapsed ? /* @__PURE__ */ jsx("span", { className: "ms-auto flex shrink-0 items-center", children: endSlot }) : null
|
|
717
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-start", children: labelContent }),
|
|
718
|
+
endSlot ? /* @__PURE__ */ jsx("span", { className: "ms-auto flex shrink-0 items-center", children: endSlot }) : null
|
|
753
719
|
] });
|
|
754
720
|
if (render) {
|
|
755
721
|
return render({
|