@teja-app/ui 0.0.2 → 0.0.3
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/Sidebar/Sidebar.d.ts +36 -0
- package/dist/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts +196 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarDivider.d.ts +12 -0
- package/dist/components/Sidebar/SidebarDivider.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarGroup.d.ts +26 -0
- package/dist/components/Sidebar/SidebarGroup.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarItem.d.ts +23 -0
- package/dist/components/Sidebar/SidebarItem.d.ts.map +1 -0
- package/dist/components/Sidebar/index.d.ts +9 -0
- package/dist/components/Sidebar/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/hooks/index.cjs +7 -6
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -2
- package/dist/hooks/useSidebar.d.ts +39 -0
- package/dist/hooks/useSidebar.d.ts.map +1 -0
- package/dist/index.cjs +482 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1323 -878
- package/dist/index.js.map +1 -1
- package/dist/{useSelection-BK6u5Ezx.js → useSidebar-BWe09WbE.js} +109 -2
- package/dist/useSidebar-BWe09WbE.js.map +1 -0
- package/dist/{useSelection-DyXUWnGK.cjs → useSidebar-d1VZFhxd.cjs} +108 -1
- package/dist/useSidebar-d1VZFhxd.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/useSelection-BK6u5Ezx.js.map +0 -1
- package/dist/useSelection-DyXUWnGK.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const useSidebar = require("./useSidebar-d1VZFhxd.cjs");
|
|
4
4
|
const utils_index = require("./utils/index.cjs");
|
|
5
5
|
const jsxRuntime = require("react/jsx-runtime");
|
|
6
6
|
const React = require("react");
|
|
@@ -23,7 +23,7 @@ function _interopNamespaceDefault(e2) {
|
|
|
23
23
|
}
|
|
24
24
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
25
25
|
const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
|
|
26
|
-
const variantStyles$
|
|
26
|
+
const variantStyles$4 = {
|
|
27
27
|
primary: [
|
|
28
28
|
// Light mode
|
|
29
29
|
"bg-primary-800 text-white border border-gold-500/40",
|
|
@@ -63,7 +63,7 @@ const variantStyles$3 = {
|
|
|
63
63
|
"dark:focus:ring-error/30"
|
|
64
64
|
].join(" ")
|
|
65
65
|
};
|
|
66
|
-
const sizeStyles$
|
|
66
|
+
const sizeStyles$b = {
|
|
67
67
|
sm: "px-3 py-1.5 text-sm h-8",
|
|
68
68
|
md: "px-4 py-2 text-base h-10",
|
|
69
69
|
lg: "px-6 py-3 text-lg h-12"
|
|
@@ -93,9 +93,9 @@ const Button = React.forwardRef(
|
|
|
93
93
|
"dark:focus:ring-offset-primary-900",
|
|
94
94
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
95
95
|
// Variant styles
|
|
96
|
-
variantStyles$
|
|
96
|
+
variantStyles$4[variant],
|
|
97
97
|
// Size styles
|
|
98
|
-
sizeStyles$
|
|
98
|
+
sizeStyles$b[size2],
|
|
99
99
|
// Width styles
|
|
100
100
|
fullWidth && "w-full",
|
|
101
101
|
// Custom className (allows override)
|
|
@@ -146,7 +146,7 @@ const Button = React.forwardRef(
|
|
|
146
146
|
}
|
|
147
147
|
);
|
|
148
148
|
Button.displayName = "Button";
|
|
149
|
-
const sizeStyles$
|
|
149
|
+
const sizeStyles$a = {
|
|
150
150
|
xs: "h-3 w-3",
|
|
151
151
|
// 12px
|
|
152
152
|
sm: "h-4 w-4",
|
|
@@ -176,7 +176,7 @@ const Spinner = React.forwardRef(
|
|
|
176
176
|
ref,
|
|
177
177
|
className: utils_index.cn(
|
|
178
178
|
"animate-spin",
|
|
179
|
-
sizeStyles$
|
|
179
|
+
sizeStyles$a[size2],
|
|
180
180
|
colorStyles[color],
|
|
181
181
|
className
|
|
182
182
|
),
|
|
@@ -7387,7 +7387,7 @@ const CloseIcon$2 = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
7387
7387
|
)
|
|
7388
7388
|
}
|
|
7389
7389
|
);
|
|
7390
|
-
const sizeStyles$
|
|
7390
|
+
const sizeStyles$9 = {
|
|
7391
7391
|
sm: "max-w-[400px]",
|
|
7392
7392
|
md: "max-w-[560px]",
|
|
7393
7393
|
lg: "max-w-[720px]"
|
|
@@ -7440,7 +7440,7 @@ function Modal({
|
|
|
7440
7440
|
"bg-white border border-primary-200",
|
|
7441
7441
|
// Dark mode
|
|
7442
7442
|
"dark:bg-primary-800 dark:border-primary-700",
|
|
7443
|
-
sizeStyles$
|
|
7443
|
+
sizeStyles$9[size2],
|
|
7444
7444
|
className
|
|
7445
7445
|
),
|
|
7446
7446
|
children: [
|
|
@@ -7518,7 +7518,7 @@ const CloseIcon$1 = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
7518
7518
|
)
|
|
7519
7519
|
}
|
|
7520
7520
|
);
|
|
7521
|
-
const sizeStyles$
|
|
7521
|
+
const sizeStyles$8 = {
|
|
7522
7522
|
sm: "max-w-[400px]",
|
|
7523
7523
|
md: "max-w-[560px]",
|
|
7524
7524
|
lg: "max-w-[720px]"
|
|
@@ -7567,7 +7567,7 @@ function Drawer({
|
|
|
7567
7567
|
"bg-white border-l border-primary-200",
|
|
7568
7568
|
// Dark mode
|
|
7569
7569
|
"dark:bg-primary-800 dark:border-primary-700",
|
|
7570
|
-
sizeStyles$
|
|
7570
|
+
sizeStyles$8[size2],
|
|
7571
7571
|
className
|
|
7572
7572
|
),
|
|
7573
7573
|
children: [
|
|
@@ -7683,7 +7683,7 @@ const paddingStyles = {
|
|
|
7683
7683
|
md: "p-6",
|
|
7684
7684
|
lg: "p-8"
|
|
7685
7685
|
};
|
|
7686
|
-
const variantStyles$
|
|
7686
|
+
const variantStyles$3 = {
|
|
7687
7687
|
default: [
|
|
7688
7688
|
"shadow-sm border border-primary-200",
|
|
7689
7689
|
"dark:border-primary-700"
|
|
@@ -7724,7 +7724,7 @@ const Card = React.forwardRef(
|
|
|
7724
7724
|
// Padding
|
|
7725
7725
|
paddingStyles[padding],
|
|
7726
7726
|
// Variant
|
|
7727
|
-
variantStyles$
|
|
7727
|
+
variantStyles$3[variant],
|
|
7728
7728
|
// Hover effect
|
|
7729
7729
|
hoverable && [
|
|
7730
7730
|
"cursor-pointer",
|
|
@@ -7740,7 +7740,7 @@ const Card = React.forwardRef(
|
|
|
7740
7740
|
}
|
|
7741
7741
|
);
|
|
7742
7742
|
Card.displayName = "Card";
|
|
7743
|
-
const sizeStyles$
|
|
7743
|
+
const sizeStyles$7 = {
|
|
7744
7744
|
sm: "h-4 w-4",
|
|
7745
7745
|
md: "h-5 w-5",
|
|
7746
7746
|
lg: "h-6 w-6"
|
|
@@ -7810,7 +7810,7 @@ const Checkbox = React.forwardRef(
|
|
|
7810
7810
|
"aria-describedby": errorId,
|
|
7811
7811
|
onChange: handleChange,
|
|
7812
7812
|
className: utils_index.cn(
|
|
7813
|
-
sizeStyles$
|
|
7813
|
+
sizeStyles$7[size2],
|
|
7814
7814
|
"rounded border transition-colors",
|
|
7815
7815
|
"focus:ring-2 focus:ring-offset-0",
|
|
7816
7816
|
"disabled:cursor-not-allowed",
|
|
@@ -7864,7 +7864,7 @@ const Checkbox = React.forwardRef(
|
|
|
7864
7864
|
}
|
|
7865
7865
|
);
|
|
7866
7866
|
Checkbox.displayName = "Checkbox";
|
|
7867
|
-
const sizeStyles$
|
|
7867
|
+
const sizeStyles$6 = {
|
|
7868
7868
|
sm: "h-4 w-4",
|
|
7869
7869
|
md: "h-5 w-5",
|
|
7870
7870
|
lg: "h-6 w-6"
|
|
@@ -7903,7 +7903,7 @@ const Radio = React.forwardRef(
|
|
|
7903
7903
|
id: radioId,
|
|
7904
7904
|
disabled,
|
|
7905
7905
|
className: utils_index.cn(
|
|
7906
|
-
sizeStyles$
|
|
7906
|
+
sizeStyles$6[size2],
|
|
7907
7907
|
"border transition-colors",
|
|
7908
7908
|
"focus:ring-2 focus:ring-offset-0",
|
|
7909
7909
|
"disabled:cursor-not-allowed",
|
|
@@ -8010,7 +8010,7 @@ function RadioGroup({
|
|
|
8010
8010
|
] });
|
|
8011
8011
|
}
|
|
8012
8012
|
RadioGroup.displayName = "RadioGroup";
|
|
8013
|
-
const sizeStyles$
|
|
8013
|
+
const sizeStyles$5 = {
|
|
8014
8014
|
sm: {
|
|
8015
8015
|
switch: "h-5 w-9",
|
|
8016
8016
|
dot: "h-3 w-3",
|
|
@@ -8037,7 +8037,7 @@ function Toggle({
|
|
|
8037
8037
|
className,
|
|
8038
8038
|
isLoading = false
|
|
8039
8039
|
}) {
|
|
8040
|
-
const currentSize = sizeStyles$
|
|
8040
|
+
const currentSize = sizeStyles$5[size2];
|
|
8041
8041
|
const isDisabled = disabled || isLoading;
|
|
8042
8042
|
return /* @__PURE__ */ jsxRuntime.jsx(W, { className, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8043
8043
|
(label || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 mr-4", children: [
|
|
@@ -8274,7 +8274,7 @@ function Combobox({
|
|
|
8274
8274
|
] });
|
|
8275
8275
|
}
|
|
8276
8276
|
Combobox.displayName = "Combobox";
|
|
8277
|
-
const variantStyles$
|
|
8277
|
+
const variantStyles$2 = {
|
|
8278
8278
|
default: utils_index.cn(
|
|
8279
8279
|
"bg-primary-100 text-primary-700 border-primary-200",
|
|
8280
8280
|
"dark:bg-primary-800 dark:text-primary-200 dark:border-primary-700"
|
|
@@ -8300,7 +8300,7 @@ const variantStyles$1 = {
|
|
|
8300
8300
|
"dark:bg-gold-900/50 dark:text-gold-300 dark:border-gold-700"
|
|
8301
8301
|
)
|
|
8302
8302
|
};
|
|
8303
|
-
const sizeStyles$
|
|
8303
|
+
const sizeStyles$4 = {
|
|
8304
8304
|
sm: "px-2 py-0.5 text-xs",
|
|
8305
8305
|
md: "px-2.5 py-1 text-sm",
|
|
8306
8306
|
lg: "px-3 py-1.5 text-base"
|
|
@@ -8313,8 +8313,8 @@ const Badge = React.forwardRef(
|
|
|
8313
8313
|
ref,
|
|
8314
8314
|
className: utils_index.cn(
|
|
8315
8315
|
"inline-flex items-center justify-center font-medium rounded-full border",
|
|
8316
|
-
variantStyles$
|
|
8317
|
-
sizeStyles$
|
|
8316
|
+
variantStyles$2[variant],
|
|
8317
|
+
sizeStyles$4[size2],
|
|
8318
8318
|
className
|
|
8319
8319
|
),
|
|
8320
8320
|
...props,
|
|
@@ -8472,7 +8472,7 @@ const TableCell = React.forwardRef(
|
|
|
8472
8472
|
}
|
|
8473
8473
|
);
|
|
8474
8474
|
TableCell.displayName = "TableCell";
|
|
8475
|
-
const sizeStyles$
|
|
8475
|
+
const sizeStyles$3 = {
|
|
8476
8476
|
sm: "px-3 py-1.5 text-sm",
|
|
8477
8477
|
md: "px-4 py-2 text-sm",
|
|
8478
8478
|
lg: "px-5 py-2.5 text-base"
|
|
@@ -8521,7 +8521,7 @@ function Tabs({
|
|
|
8521
8521
|
className: ({ selected }) => utils_index.cn(
|
|
8522
8522
|
"relative outline-none transition-colors duration-normal",
|
|
8523
8523
|
"focus-visible:ring-2 focus-visible:ring-gold-500/50",
|
|
8524
|
-
sizeStyles$
|
|
8524
|
+
sizeStyles$3[size2],
|
|
8525
8525
|
fullWidth && "flex-1",
|
|
8526
8526
|
// Default variant styles
|
|
8527
8527
|
variant === "default" && [
|
|
@@ -8705,7 +8705,7 @@ const Breadcrumbs = React.forwardRef(
|
|
|
8705
8705
|
}
|
|
8706
8706
|
);
|
|
8707
8707
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
8708
|
-
const variantStyles = {
|
|
8708
|
+
const variantStyles$1 = {
|
|
8709
8709
|
text: "rounded",
|
|
8710
8710
|
circular: "rounded-full",
|
|
8711
8711
|
rectangular: "rounded-md"
|
|
@@ -8741,7 +8741,7 @@ const Skeleton = React.forwardRef(
|
|
|
8741
8741
|
{
|
|
8742
8742
|
className: utils_index.cn(
|
|
8743
8743
|
"bg-primary-200 dark:bg-primary-700",
|
|
8744
|
-
variantStyles[variant],
|
|
8744
|
+
variantStyles$1[variant],
|
|
8745
8745
|
animate && "animate-pulse"
|
|
8746
8746
|
),
|
|
8747
8747
|
style: {
|
|
@@ -8763,7 +8763,7 @@ const Skeleton = React.forwardRef(
|
|
|
8763
8763
|
ref,
|
|
8764
8764
|
className: utils_index.cn(
|
|
8765
8765
|
"bg-primary-200 dark:bg-primary-700",
|
|
8766
|
-
variantStyles[variant],
|
|
8766
|
+
variantStyles$1[variant],
|
|
8767
8767
|
animate && "animate-pulse",
|
|
8768
8768
|
className
|
|
8769
8769
|
),
|
|
@@ -8841,7 +8841,7 @@ const defaultIcons = {
|
|
|
8841
8841
|
}
|
|
8842
8842
|
)
|
|
8843
8843
|
};
|
|
8844
|
-
const sizeStyles$
|
|
8844
|
+
const sizeStyles$2 = {
|
|
8845
8845
|
sm: {
|
|
8846
8846
|
container: "py-6 px-4",
|
|
8847
8847
|
icon: "w-10 h-10",
|
|
@@ -8877,7 +8877,7 @@ const EmptyState = React.forwardRef(
|
|
|
8877
8877
|
className,
|
|
8878
8878
|
...props
|
|
8879
8879
|
}, ref) => {
|
|
8880
|
-
const styles = sizeStyles$
|
|
8880
|
+
const styles = sizeStyles$2[size2];
|
|
8881
8881
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8882
8882
|
"div",
|
|
8883
8883
|
{
|
|
@@ -8921,7 +8921,7 @@ const EmptyState = React.forwardRef(
|
|
|
8921
8921
|
EmptyState.displayName = "EmptyState";
|
|
8922
8922
|
const ChevronLeftIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) });
|
|
8923
8923
|
const ChevronRightIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) });
|
|
8924
|
-
const sizeStyles = {
|
|
8924
|
+
const sizeStyles$1 = {
|
|
8925
8925
|
sm: { button: "h-8 min-w-8 px-2 text-sm", text: "text-sm" },
|
|
8926
8926
|
md: { button: "h-10 min-w-10 px-3 text-sm", text: "text-sm" }
|
|
8927
8927
|
};
|
|
@@ -8971,7 +8971,7 @@ function Pagination({
|
|
|
8971
8971
|
className
|
|
8972
8972
|
}) {
|
|
8973
8973
|
const pageSizeId = React.useId();
|
|
8974
|
-
const currentSize = sizeStyles[size2];
|
|
8974
|
+
const currentSize = sizeStyles$1[size2];
|
|
8975
8975
|
const canGoPrevious = currentPage > 1;
|
|
8976
8976
|
const canGoNext = currentPage < totalPages;
|
|
8977
8977
|
const pageNumbers = React.useMemo(
|
|
@@ -9498,11 +9498,452 @@ function MultiSelect({
|
|
|
9498
9498
|
] });
|
|
9499
9499
|
}
|
|
9500
9500
|
MultiSelect.displayName = "MultiSelect";
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9501
|
+
function shouldShowItem(item) {
|
|
9502
|
+
if (item.visible === void 0) return true;
|
|
9503
|
+
if (typeof item.visible === "boolean") return item.visible;
|
|
9504
|
+
if (typeof item.visible === "function") return item.visible();
|
|
9505
|
+
return true;
|
|
9506
|
+
}
|
|
9507
|
+
function isItemActive(currentPath, href, matcher = "exact") {
|
|
9508
|
+
if (!currentPath) return false;
|
|
9509
|
+
if (typeof matcher === "function") {
|
|
9510
|
+
return matcher(currentPath, href);
|
|
9511
|
+
}
|
|
9512
|
+
switch (matcher) {
|
|
9513
|
+
case "exact":
|
|
9514
|
+
return currentPath === href;
|
|
9515
|
+
case "startsWith":
|
|
9516
|
+
return currentPath === href || currentPath.startsWith(`${href}/`);
|
|
9517
|
+
default:
|
|
9518
|
+
return false;
|
|
9519
|
+
}
|
|
9520
|
+
}
|
|
9521
|
+
const sizeStyles = {
|
|
9522
|
+
sm: "px-2 py-1.5 text-xs gap-2",
|
|
9523
|
+
md: "px-3 py-2.5 text-sm gap-3",
|
|
9524
|
+
lg: "px-4 py-3 text-base gap-3"
|
|
9525
|
+
};
|
|
9526
|
+
const iconSizeStyles = {
|
|
9527
|
+
sm: "h-4 w-4",
|
|
9528
|
+
md: "h-5 w-5",
|
|
9529
|
+
lg: "h-6 w-6"
|
|
9530
|
+
};
|
|
9531
|
+
const DefaultLink = ({
|
|
9532
|
+
to,
|
|
9533
|
+
children,
|
|
9534
|
+
className,
|
|
9535
|
+
onClick,
|
|
9536
|
+
title,
|
|
9537
|
+
"aria-current": ariaCurrent,
|
|
9538
|
+
"aria-label": ariaLabel
|
|
9539
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9540
|
+
"a",
|
|
9541
|
+
{
|
|
9542
|
+
href: to,
|
|
9543
|
+
className,
|
|
9544
|
+
onClick,
|
|
9545
|
+
title,
|
|
9546
|
+
"aria-current": ariaCurrent,
|
|
9547
|
+
"aria-label": ariaLabel,
|
|
9548
|
+
children
|
|
9549
|
+
}
|
|
9550
|
+
);
|
|
9551
|
+
function SidebarItem({
|
|
9552
|
+
item,
|
|
9553
|
+
currentPath,
|
|
9554
|
+
size: size2 = "md",
|
|
9555
|
+
collapsed = false,
|
|
9556
|
+
onNavigate,
|
|
9557
|
+
LinkComponent,
|
|
9558
|
+
className,
|
|
9559
|
+
...props
|
|
9560
|
+
}) {
|
|
9561
|
+
if (!shouldShowItem(item)) {
|
|
9562
|
+
return null;
|
|
9563
|
+
}
|
|
9564
|
+
const isActive = isItemActive(currentPath, item.href, item.activeMatch);
|
|
9565
|
+
const LinkElement = LinkComponent || DefaultLink;
|
|
9566
|
+
const handleClick = () => {
|
|
9567
|
+
if (item.disabled) return;
|
|
9568
|
+
item.onClick?.();
|
|
9569
|
+
onNavigate?.(item.href);
|
|
9570
|
+
};
|
|
9571
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9572
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9573
|
+
"span",
|
|
9574
|
+
{
|
|
9575
|
+
className: utils_index.cn(
|
|
9576
|
+
"flex-shrink-0",
|
|
9577
|
+
iconSizeStyles[size2],
|
|
9578
|
+
"[&>svg]:h-full [&>svg]:w-full"
|
|
9579
|
+
),
|
|
9580
|
+
"aria-hidden": "true",
|
|
9581
|
+
children: item.icon
|
|
9582
|
+
}
|
|
9583
|
+
),
|
|
9584
|
+
!collapsed && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: item.label }),
|
|
9585
|
+
!collapsed && item.badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9586
|
+
"span",
|
|
9587
|
+
{
|
|
9588
|
+
className: utils_index.cn(
|
|
9589
|
+
"flex-shrink-0 rounded-full px-2 py-0.5 text-xs font-medium",
|
|
9590
|
+
isActive ? "bg-primary-200 text-primary-800 dark:bg-primary-700 dark:text-primary-200" : "bg-primary-100 text-primary-600 dark:bg-primary-800 dark:text-primary-300"
|
|
9591
|
+
),
|
|
9592
|
+
children: item.badge
|
|
9593
|
+
}
|
|
9594
|
+
)
|
|
9595
|
+
] });
|
|
9596
|
+
if (item.onClick && !item.href) {
|
|
9597
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9598
|
+
"button",
|
|
9599
|
+
{
|
|
9600
|
+
type: "button",
|
|
9601
|
+
onClick: handleClick,
|
|
9602
|
+
disabled: item.disabled,
|
|
9603
|
+
"aria-label": item["aria-label"] || item.label,
|
|
9604
|
+
title: collapsed ? item.label : void 0,
|
|
9605
|
+
className: utils_index.cn(
|
|
9606
|
+
// Base styles
|
|
9607
|
+
"flex w-full items-center rounded-lg font-medium",
|
|
9608
|
+
"transition-colors duration-150",
|
|
9609
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-2",
|
|
9610
|
+
"dark:focus:ring-offset-primary-900",
|
|
9611
|
+
// Size styles
|
|
9612
|
+
sizeStyles[size2],
|
|
9613
|
+
// State styles
|
|
9614
|
+
item.disabled && "opacity-50 cursor-not-allowed",
|
|
9615
|
+
!item.disabled && !isActive && [
|
|
9616
|
+
"text-primary-600 hover:bg-primary-50 hover:text-primary-900",
|
|
9617
|
+
"dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-100"
|
|
9618
|
+
],
|
|
9619
|
+
isActive && [
|
|
9620
|
+
"bg-primary-100 text-primary-900",
|
|
9621
|
+
"dark:bg-primary-800 dark:text-primary-100"
|
|
9622
|
+
],
|
|
9623
|
+
// Collapsed mode
|
|
9624
|
+
collapsed && "justify-center",
|
|
9625
|
+
className
|
|
9626
|
+
),
|
|
9627
|
+
...props,
|
|
9628
|
+
children: content
|
|
9629
|
+
}
|
|
9630
|
+
);
|
|
9631
|
+
}
|
|
9632
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9633
|
+
LinkElement,
|
|
9634
|
+
{
|
|
9635
|
+
to: item.href,
|
|
9636
|
+
onClick: handleClick,
|
|
9637
|
+
className: utils_index.cn(
|
|
9638
|
+
// Base styles
|
|
9639
|
+
"flex items-center rounded-lg font-medium",
|
|
9640
|
+
"transition-colors duration-150",
|
|
9641
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-2",
|
|
9642
|
+
"dark:focus:ring-offset-primary-900",
|
|
9643
|
+
// Size styles
|
|
9644
|
+
sizeStyles[size2],
|
|
9645
|
+
// State styles
|
|
9646
|
+
item.disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
9647
|
+
!item.disabled && !isActive && [
|
|
9648
|
+
"text-primary-600 hover:bg-primary-50 hover:text-primary-900",
|
|
9649
|
+
"dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-100"
|
|
9650
|
+
],
|
|
9651
|
+
isActive && [
|
|
9652
|
+
"bg-primary-100 text-primary-900",
|
|
9653
|
+
"dark:bg-primary-800 dark:text-primary-100"
|
|
9654
|
+
],
|
|
9655
|
+
// Collapsed mode
|
|
9656
|
+
collapsed && "justify-center",
|
|
9657
|
+
className
|
|
9658
|
+
),
|
|
9659
|
+
"aria-current": isActive ? "page" : void 0,
|
|
9660
|
+
"aria-label": item["aria-label"] || (collapsed ? item.label : void 0),
|
|
9661
|
+
title: collapsed ? item.label : void 0,
|
|
9662
|
+
children: content
|
|
9663
|
+
}
|
|
9664
|
+
);
|
|
9665
|
+
}
|
|
9666
|
+
function shouldShowGroup(group) {
|
|
9667
|
+
if (group.visible === void 0) return true;
|
|
9668
|
+
if (typeof group.visible === "boolean") return group.visible;
|
|
9669
|
+
if (typeof group.visible === "function") return group.visible();
|
|
9670
|
+
return true;
|
|
9671
|
+
}
|
|
9672
|
+
const SidebarGroup = React.forwardRef(
|
|
9673
|
+
({
|
|
9674
|
+
group,
|
|
9675
|
+
currentPath,
|
|
9676
|
+
size: size2 = "md",
|
|
9677
|
+
collapsed = false,
|
|
9678
|
+
LinkComponent,
|
|
9679
|
+
onNavigate,
|
|
9680
|
+
className,
|
|
9681
|
+
...props
|
|
9682
|
+
}, ref) => {
|
|
9683
|
+
if (!shouldShowGroup(group)) {
|
|
9684
|
+
return null;
|
|
9685
|
+
}
|
|
9686
|
+
const visibleItems = group.items.filter(shouldShowItem);
|
|
9687
|
+
if (visibleItems.length === 0) {
|
|
9688
|
+
return null;
|
|
9689
|
+
}
|
|
9690
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, role: "group", className: utils_index.cn("space-y-1", className), ...props, children: [
|
|
9691
|
+
group.label && !collapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9692
|
+
"h3",
|
|
9693
|
+
{
|
|
9694
|
+
className: utils_index.cn(
|
|
9695
|
+
"px-3 py-2 text-xs font-semibold uppercase tracking-wider",
|
|
9696
|
+
"text-primary-500 dark:text-primary-400"
|
|
9697
|
+
),
|
|
9698
|
+
children: group.label
|
|
9699
|
+
}
|
|
9700
|
+
),
|
|
9701
|
+
/* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": group.label || `Navigation group ${group.key}`, children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-1", children: visibleItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9702
|
+
SidebarItem,
|
|
9703
|
+
{
|
|
9704
|
+
item,
|
|
9705
|
+
currentPath,
|
|
9706
|
+
size: size2,
|
|
9707
|
+
collapsed,
|
|
9708
|
+
LinkComponent,
|
|
9709
|
+
onNavigate
|
|
9710
|
+
}
|
|
9711
|
+
) }, item.key)) }) })
|
|
9712
|
+
] });
|
|
9713
|
+
}
|
|
9714
|
+
);
|
|
9715
|
+
SidebarGroup.displayName = "SidebarGroup";
|
|
9716
|
+
const SidebarDivider = React.forwardRef(
|
|
9717
|
+
({ label, className, ...props }, ref) => {
|
|
9718
|
+
if (label) {
|
|
9719
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils_index.cn("relative my-4", className), children: [
|
|
9720
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9721
|
+
"hr",
|
|
9722
|
+
{
|
|
9723
|
+
ref,
|
|
9724
|
+
className: "w-full border-t border-primary-200 dark:border-primary-700",
|
|
9725
|
+
...props
|
|
9726
|
+
}
|
|
9727
|
+
) }),
|
|
9728
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-white px-2 text-xs text-primary-500 dark:bg-primary-900 dark:text-primary-400", children: label }) })
|
|
9729
|
+
] });
|
|
9730
|
+
}
|
|
9731
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9732
|
+
"hr",
|
|
9733
|
+
{
|
|
9734
|
+
ref,
|
|
9735
|
+
className: utils_index.cn(
|
|
9736
|
+
"my-4 border-t border-primary-200 dark:border-primary-700",
|
|
9737
|
+
className
|
|
9738
|
+
),
|
|
9739
|
+
...props
|
|
9740
|
+
}
|
|
9741
|
+
);
|
|
9742
|
+
}
|
|
9743
|
+
);
|
|
9744
|
+
SidebarDivider.displayName = "SidebarDivider";
|
|
9745
|
+
const variantStyles = {
|
|
9746
|
+
default: [
|
|
9747
|
+
"bg-white border-r border-gold-500/40",
|
|
9748
|
+
"dark:bg-primary-900 dark:border-gold-500/20"
|
|
9749
|
+
].join(" "),
|
|
9750
|
+
minimal: [
|
|
9751
|
+
"bg-white border-r border-primary-200",
|
|
9752
|
+
"dark:bg-primary-900 dark:border-primary-700"
|
|
9753
|
+
].join(" ")
|
|
9754
|
+
};
|
|
9755
|
+
const Sidebar = React.forwardRef(
|
|
9756
|
+
({
|
|
9757
|
+
navigation,
|
|
9758
|
+
currentPath,
|
|
9759
|
+
isOpen = false,
|
|
9760
|
+
onClose,
|
|
9761
|
+
collapsed = false,
|
|
9762
|
+
onCollapsedChange,
|
|
9763
|
+
variant = "default",
|
|
9764
|
+
size: size2 = "md",
|
|
9765
|
+
header,
|
|
9766
|
+
footer,
|
|
9767
|
+
LinkComponent,
|
|
9768
|
+
onNavigate,
|
|
9769
|
+
showMobileOverlay = true,
|
|
9770
|
+
width = "16rem",
|
|
9771
|
+
collapsedWidth = "4rem",
|
|
9772
|
+
className,
|
|
9773
|
+
"aria-label": ariaLabel = "Main navigation",
|
|
9774
|
+
...props
|
|
9775
|
+
}, ref) => {
|
|
9776
|
+
React.useEffect(() => {
|
|
9777
|
+
const handleEscape = (event) => {
|
|
9778
|
+
if (event.key === "Escape" && isOpen) {
|
|
9779
|
+
onClose?.();
|
|
9780
|
+
}
|
|
9781
|
+
};
|
|
9782
|
+
document.addEventListener("keydown", handleEscape);
|
|
9783
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
9784
|
+
}, [isOpen, onClose]);
|
|
9785
|
+
React.useEffect(() => {
|
|
9786
|
+
if (isOpen) {
|
|
9787
|
+
document.body.style.overflow = "hidden";
|
|
9788
|
+
} else {
|
|
9789
|
+
document.body.style.overflow = "";
|
|
9790
|
+
}
|
|
9791
|
+
return () => {
|
|
9792
|
+
document.body.style.overflow = "";
|
|
9793
|
+
};
|
|
9794
|
+
}, [isOpen]);
|
|
9795
|
+
const handleNavigate = React.useCallback(
|
|
9796
|
+
(href) => {
|
|
9797
|
+
onNavigate?.(href);
|
|
9798
|
+
onClose?.();
|
|
9799
|
+
},
|
|
9800
|
+
[onNavigate, onClose]
|
|
9801
|
+
);
|
|
9802
|
+
const handleOverlayClick = React.useCallback(() => {
|
|
9803
|
+
onClose?.();
|
|
9804
|
+
}, [onClose]);
|
|
9805
|
+
const handleCollapseToggle = React.useCallback(() => {
|
|
9806
|
+
onCollapsedChange?.(!collapsed);
|
|
9807
|
+
}, [collapsed, onCollapsedChange]);
|
|
9808
|
+
const hasVisibleGroups = (groups) => groups?.some(shouldShowGroup) ?? false;
|
|
9809
|
+
const hasFeatured = hasVisibleGroups(navigation.featured);
|
|
9810
|
+
const hasPrimary = hasVisibleGroups(navigation.primary);
|
|
9811
|
+
const hasSecondary = hasVisibleGroups(navigation.secondary);
|
|
9812
|
+
const hasBottom = hasVisibleGroups(navigation.bottom);
|
|
9813
|
+
const sidebarWidth = collapsed ? collapsedWidth : width;
|
|
9814
|
+
const sidebarContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9815
|
+
header && /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_index.cn("flex-shrink-0", collapsed && "px-2"), children: header }),
|
|
9816
|
+
hasFeatured && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: navigation.featured?.map((group) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9817
|
+
SidebarGroup,
|
|
9818
|
+
{
|
|
9819
|
+
group,
|
|
9820
|
+
currentPath,
|
|
9821
|
+
size: size2,
|
|
9822
|
+
collapsed,
|
|
9823
|
+
LinkComponent,
|
|
9824
|
+
onNavigate: handleNavigate
|
|
9825
|
+
},
|
|
9826
|
+
group.key
|
|
9827
|
+
)) }) }),
|
|
9828
|
+
hasPrimary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto px-3 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: navigation.primary?.map((group) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9829
|
+
SidebarGroup,
|
|
9830
|
+
{
|
|
9831
|
+
group,
|
|
9832
|
+
currentPath,
|
|
9833
|
+
size: size2,
|
|
9834
|
+
collapsed,
|
|
9835
|
+
LinkComponent,
|
|
9836
|
+
onNavigate: handleNavigate
|
|
9837
|
+
},
|
|
9838
|
+
group.key
|
|
9839
|
+
)) }) }),
|
|
9840
|
+
hasPrimary && hasSecondary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3", children: /* @__PURE__ */ jsxRuntime.jsx(SidebarDivider, {}) }),
|
|
9841
|
+
hasSecondary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: navigation.secondary?.map((group) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9842
|
+
SidebarGroup,
|
|
9843
|
+
{
|
|
9844
|
+
group,
|
|
9845
|
+
currentPath,
|
|
9846
|
+
size: size2,
|
|
9847
|
+
collapsed,
|
|
9848
|
+
LinkComponent,
|
|
9849
|
+
onNavigate: handleNavigate
|
|
9850
|
+
},
|
|
9851
|
+
group.key
|
|
9852
|
+
)) }) }),
|
|
9853
|
+
!hasPrimary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
|
|
9854
|
+
(hasPrimary || hasSecondary) && hasBottom && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3", children: /* @__PURE__ */ jsxRuntime.jsx(SidebarDivider, {}) }),
|
|
9855
|
+
hasBottom && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 px-3 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: navigation.bottom?.map((group) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9856
|
+
SidebarGroup,
|
|
9857
|
+
{
|
|
9858
|
+
group,
|
|
9859
|
+
currentPath,
|
|
9860
|
+
size: size2,
|
|
9861
|
+
collapsed,
|
|
9862
|
+
LinkComponent,
|
|
9863
|
+
onNavigate: handleNavigate
|
|
9864
|
+
},
|
|
9865
|
+
group.key
|
|
9866
|
+
)) }) }),
|
|
9867
|
+
footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_index.cn("flex-shrink-0", collapsed && "px-2"), children: footer }),
|
|
9868
|
+
onCollapsedChange && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden lg:block flex-shrink-0 border-t border-primary-200 dark:border-primary-700 p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9869
|
+
"button",
|
|
9870
|
+
{
|
|
9871
|
+
type: "button",
|
|
9872
|
+
onClick: handleCollapseToggle,
|
|
9873
|
+
className: utils_index.cn(
|
|
9874
|
+
"flex w-full items-center justify-center rounded-lg p-2",
|
|
9875
|
+
"text-primary-500 hover:bg-primary-50 hover:text-primary-700",
|
|
9876
|
+
"dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200",
|
|
9877
|
+
"transition-colors duration-150",
|
|
9878
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500/20"
|
|
9879
|
+
),
|
|
9880
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
9881
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9882
|
+
"svg",
|
|
9883
|
+
{
|
|
9884
|
+
className: utils_index.cn(
|
|
9885
|
+
"h-5 w-5 transition-transform duration-200",
|
|
9886
|
+
collapsed && "rotate-180"
|
|
9887
|
+
),
|
|
9888
|
+
fill: "none",
|
|
9889
|
+
viewBox: "0 0 24 24",
|
|
9890
|
+
stroke: "currentColor",
|
|
9891
|
+
"aria-hidden": "true",
|
|
9892
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9893
|
+
"path",
|
|
9894
|
+
{
|
|
9895
|
+
strokeLinecap: "round",
|
|
9896
|
+
strokeLinejoin: "round",
|
|
9897
|
+
strokeWidth: 2,
|
|
9898
|
+
d: "M11 19l-7-7 7-7m8 14l-7-7 7-7"
|
|
9899
|
+
}
|
|
9900
|
+
)
|
|
9901
|
+
}
|
|
9902
|
+
)
|
|
9903
|
+
}
|
|
9904
|
+
) })
|
|
9905
|
+
] });
|
|
9906
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9907
|
+
showMobileOverlay && isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9908
|
+
"div",
|
|
9909
|
+
{
|
|
9910
|
+
className: "fixed inset-0 z-40 bg-black/20 lg:hidden",
|
|
9911
|
+
onClick: handleOverlayClick,
|
|
9912
|
+
"aria-hidden": "true"
|
|
9913
|
+
}
|
|
9914
|
+
),
|
|
9915
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9916
|
+
"aside",
|
|
9917
|
+
{
|
|
9918
|
+
ref,
|
|
9919
|
+
className: utils_index.cn(
|
|
9920
|
+
// Base styles
|
|
9921
|
+
"fixed top-0 left-0 z-50 flex h-full flex-col",
|
|
9922
|
+
"transform transition-all duration-300 ease-in-out",
|
|
9923
|
+
// Desktop styles
|
|
9924
|
+
"lg:static lg:z-auto lg:translate-x-0",
|
|
9925
|
+
// Mobile styles
|
|
9926
|
+
isOpen ? "translate-x-0" : "-translate-x-full",
|
|
9927
|
+
// Variant styles
|
|
9928
|
+
variantStyles[variant],
|
|
9929
|
+
className
|
|
9930
|
+
),
|
|
9931
|
+
style: { width: sidebarWidth },
|
|
9932
|
+
"aria-label": ariaLabel,
|
|
9933
|
+
...props,
|
|
9934
|
+
children: sidebarContent
|
|
9935
|
+
}
|
|
9936
|
+
)
|
|
9937
|
+
] });
|
|
9938
|
+
}
|
|
9939
|
+
);
|
|
9940
|
+
Sidebar.displayName = "Sidebar";
|
|
9941
|
+
exports.useDebounce = useSidebar.useDebounce;
|
|
9942
|
+
exports.useDebouncedCallback = useSidebar.useDebouncedCallback;
|
|
9943
|
+
exports.useDebouncedCallbackWithControl = useSidebar.useDebouncedCallbackWithControl;
|
|
9944
|
+
exports.useSelection = useSidebar.useSelection;
|
|
9945
|
+
exports.useSidebar = useSidebar.useSidebar;
|
|
9946
|
+
exports.useTable = useSidebar.useTable;
|
|
9506
9947
|
exports.cn = utils_index.cn;
|
|
9507
9948
|
exports.Badge = Badge;
|
|
9508
9949
|
exports.Breadcrumbs = Breadcrumbs;
|
|
@@ -9521,6 +9962,10 @@ exports.PasswordInput = PasswordInput;
|
|
|
9521
9962
|
exports.Radio = Radio;
|
|
9522
9963
|
exports.RadioGroup = RadioGroup;
|
|
9523
9964
|
exports.Select = Select;
|
|
9965
|
+
exports.Sidebar = Sidebar;
|
|
9966
|
+
exports.SidebarDivider = SidebarDivider;
|
|
9967
|
+
exports.SidebarGroup = SidebarGroup;
|
|
9968
|
+
exports.SidebarItem = SidebarItem;
|
|
9524
9969
|
exports.Skeleton = Skeleton;
|
|
9525
9970
|
exports.Spinner = Spinner;
|
|
9526
9971
|
exports.TabContentPanels = TabContentPanels;
|