@teja-app/ui 0.0.2 → 0.0.4

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.
Files changed (38) hide show
  1. package/dist/components/Select/Select.d.ts +1 -1
  2. package/dist/components/Select/Select.d.ts.map +1 -1
  3. package/dist/components/Select/Select.types.d.ts +3 -0
  4. package/dist/components/Select/Select.types.d.ts.map +1 -1
  5. package/dist/components/Select/index.d.ts +1 -1
  6. package/dist/components/Select/index.d.ts.map +1 -1
  7. package/dist/components/Sidebar/Sidebar.d.ts +36 -0
  8. package/dist/components/Sidebar/Sidebar.d.ts.map +1 -0
  9. package/dist/components/Sidebar/Sidebar.types.d.ts +196 -0
  10. package/dist/components/Sidebar/Sidebar.types.d.ts.map +1 -0
  11. package/dist/components/Sidebar/SidebarDivider.d.ts +12 -0
  12. package/dist/components/Sidebar/SidebarDivider.d.ts.map +1 -0
  13. package/dist/components/Sidebar/SidebarGroup.d.ts +26 -0
  14. package/dist/components/Sidebar/SidebarGroup.d.ts.map +1 -0
  15. package/dist/components/Sidebar/SidebarItem.d.ts +23 -0
  16. package/dist/components/Sidebar/SidebarItem.d.ts.map +1 -0
  17. package/dist/components/Sidebar/index.d.ts +9 -0
  18. package/dist/components/Sidebar/index.d.ts.map +1 -0
  19. package/dist/components/index.d.ts +1 -0
  20. package/dist/components/index.d.ts.map +1 -1
  21. package/dist/hooks/index.cjs +7 -6
  22. package/dist/hooks/index.cjs.map +1 -1
  23. package/dist/hooks/index.d.ts +2 -0
  24. package/dist/hooks/index.d.ts.map +1 -1
  25. package/dist/hooks/index.js +3 -2
  26. package/dist/hooks/useSidebar.d.ts +39 -0
  27. package/dist/hooks/useSidebar.d.ts.map +1 -0
  28. package/dist/index.cjs +526 -71
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.js +1367 -912
  31. package/dist/index.js.map +1 -1
  32. package/dist/{useSelection-BK6u5Ezx.js → useSidebar-BWe09WbE.js} +109 -2
  33. package/dist/useSidebar-BWe09WbE.js.map +1 -0
  34. package/dist/{useSelection-DyXUWnGK.cjs → useSidebar-d1VZFhxd.cjs} +108 -1
  35. package/dist/useSidebar-d1VZFhxd.cjs.map +1 -0
  36. package/package.json +1 -1
  37. package/dist/useSelection-BK6u5Ezx.js.map +0 -1
  38. 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 useSelection = require("./useSelection-DyXUWnGK.cjs");
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$3 = {
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$a = {
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$3[variant],
96
+ variantStyles$4[variant],
97
97
  // Size styles
98
- sizeStyles$a[size2],
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$9 = {
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$9[size2],
179
+ sizeStyles$a[size2],
180
180
  colorStyles[color],
181
181
  className
182
182
  ),
@@ -7240,7 +7240,8 @@ function Select({
7240
7240
  fullWidth = false,
7241
7241
  className,
7242
7242
  isLoading = false,
7243
- loadingText = "Loading..."
7243
+ loadingText = "Loading...",
7244
+ placement = "bottom"
7244
7245
  }) {
7245
7246
  const selectedOption = options.find((opt) => opt.value === value);
7246
7247
  const hasError = !!error2;
@@ -7314,43 +7315,52 @@ function Select({
7314
7315
  leave: "transition ease-in duration-100",
7315
7316
  leaveFrom: "opacity-100",
7316
7317
  leaveTo: "opacity-0",
7317
- children: /* @__PURE__ */ jsxRuntime.jsx(Bt, { className: "absolute z-dropdown mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-primary-800 dark:ring-primary-700", children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
7318
- It,
7318
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7319
+ Bt,
7319
7320
  {
7320
- disabled: option.disabled,
7321
- value: option.value,
7322
- className: ({ active, selected }) => utils_index.cn(
7323
- "relative cursor-pointer select-none py-2.5 pl-10 pr-4",
7324
- // Light mode
7325
- active ? "bg-gold-50 text-primary-900" : "text-primary-900",
7326
- // Dark mode
7327
- active ? "dark:bg-primary-700 dark:text-primary-100" : "dark:text-primary-200",
7328
- option.disabled && "cursor-not-allowed opacity-50",
7329
- selected && "font-medium"
7321
+ className: utils_index.cn(
7322
+ "absolute z-dropdown max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-primary-800 dark:ring-primary-700",
7323
+ placement === "top" ? "bottom-full mb-1" : "top-full mt-1"
7330
7324
  ),
7331
- children: ({ selected }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7332
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate", children: option.label }),
7333
- selected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-y-0 left-0 flex items-center pl-3 text-gold-600 dark:text-gold-400", children: /* @__PURE__ */ jsxRuntime.jsx(
7334
- "svg",
7335
- {
7336
- className: "h-5 w-5",
7337
- fill: "currentColor",
7338
- viewBox: "0 0 20 20",
7339
- "aria-hidden": "true",
7340
- children: /* @__PURE__ */ jsxRuntime.jsx(
7341
- "path",
7325
+ children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
7326
+ It,
7327
+ {
7328
+ disabled: option.disabled,
7329
+ value: option.value,
7330
+ className: ({ active, selected }) => utils_index.cn(
7331
+ "relative cursor-pointer select-none py-2.5 pl-10 pr-4",
7332
+ // Light mode
7333
+ active ? "bg-gold-50 text-primary-900" : "text-primary-900",
7334
+ // Dark mode
7335
+ active ? "dark:bg-primary-700 dark:text-primary-100" : "dark:text-primary-200",
7336
+ option.disabled && "cursor-not-allowed opacity-50",
7337
+ selected && "font-medium"
7338
+ ),
7339
+ children: ({ selected }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7340
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate", children: option.label }),
7341
+ selected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-y-0 left-0 flex items-center pl-3 text-gold-600 dark:text-gold-400", children: /* @__PURE__ */ jsxRuntime.jsx(
7342
+ "svg",
7342
7343
  {
7343
- clipRule: "evenodd",
7344
- d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
7345
- fillRule: "evenodd"
7344
+ className: "h-5 w-5",
7345
+ fill: "currentColor",
7346
+ viewBox: "0 0 20 20",
7347
+ "aria-hidden": "true",
7348
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7349
+ "path",
7350
+ {
7351
+ clipRule: "evenodd",
7352
+ d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
7353
+ fillRule: "evenodd"
7354
+ }
7355
+ )
7346
7356
  }
7347
- )
7348
- }
7349
- ) })
7350
- ] })
7351
- },
7352
- option.value
7353
- )) })
7357
+ ) })
7358
+ ] })
7359
+ },
7360
+ option.value
7361
+ ))
7362
+ }
7363
+ )
7354
7364
  }
7355
7365
  )
7356
7366
  ] }) }),
@@ -7387,7 +7397,7 @@ const CloseIcon$2 = () => /* @__PURE__ */ jsxRuntime.jsx(
7387
7397
  )
7388
7398
  }
7389
7399
  );
7390
- const sizeStyles$8 = {
7400
+ const sizeStyles$9 = {
7391
7401
  sm: "max-w-[400px]",
7392
7402
  md: "max-w-[560px]",
7393
7403
  lg: "max-w-[720px]"
@@ -7440,7 +7450,7 @@ function Modal({
7440
7450
  "bg-white border border-primary-200",
7441
7451
  // Dark mode
7442
7452
  "dark:bg-primary-800 dark:border-primary-700",
7443
- sizeStyles$8[size2],
7453
+ sizeStyles$9[size2],
7444
7454
  className
7445
7455
  ),
7446
7456
  children: [
@@ -7518,7 +7528,7 @@ const CloseIcon$1 = () => /* @__PURE__ */ jsxRuntime.jsx(
7518
7528
  )
7519
7529
  }
7520
7530
  );
7521
- const sizeStyles$7 = {
7531
+ const sizeStyles$8 = {
7522
7532
  sm: "max-w-[400px]",
7523
7533
  md: "max-w-[560px]",
7524
7534
  lg: "max-w-[720px]"
@@ -7567,7 +7577,7 @@ function Drawer({
7567
7577
  "bg-white border-l border-primary-200",
7568
7578
  // Dark mode
7569
7579
  "dark:bg-primary-800 dark:border-primary-700",
7570
- sizeStyles$7[size2],
7580
+ sizeStyles$8[size2],
7571
7581
  className
7572
7582
  ),
7573
7583
  children: [
@@ -7683,7 +7693,7 @@ const paddingStyles = {
7683
7693
  md: "p-6",
7684
7694
  lg: "p-8"
7685
7695
  };
7686
- const variantStyles$2 = {
7696
+ const variantStyles$3 = {
7687
7697
  default: [
7688
7698
  "shadow-sm border border-primary-200",
7689
7699
  "dark:border-primary-700"
@@ -7724,7 +7734,7 @@ const Card = React.forwardRef(
7724
7734
  // Padding
7725
7735
  paddingStyles[padding],
7726
7736
  // Variant
7727
- variantStyles$2[variant],
7737
+ variantStyles$3[variant],
7728
7738
  // Hover effect
7729
7739
  hoverable && [
7730
7740
  "cursor-pointer",
@@ -7740,7 +7750,7 @@ const Card = React.forwardRef(
7740
7750
  }
7741
7751
  );
7742
7752
  Card.displayName = "Card";
7743
- const sizeStyles$6 = {
7753
+ const sizeStyles$7 = {
7744
7754
  sm: "h-4 w-4",
7745
7755
  md: "h-5 w-5",
7746
7756
  lg: "h-6 w-6"
@@ -7810,7 +7820,7 @@ const Checkbox = React.forwardRef(
7810
7820
  "aria-describedby": errorId,
7811
7821
  onChange: handleChange,
7812
7822
  className: utils_index.cn(
7813
- sizeStyles$6[size2],
7823
+ sizeStyles$7[size2],
7814
7824
  "rounded border transition-colors",
7815
7825
  "focus:ring-2 focus:ring-offset-0",
7816
7826
  "disabled:cursor-not-allowed",
@@ -7864,7 +7874,7 @@ const Checkbox = React.forwardRef(
7864
7874
  }
7865
7875
  );
7866
7876
  Checkbox.displayName = "Checkbox";
7867
- const sizeStyles$5 = {
7877
+ const sizeStyles$6 = {
7868
7878
  sm: "h-4 w-4",
7869
7879
  md: "h-5 w-5",
7870
7880
  lg: "h-6 w-6"
@@ -7903,7 +7913,7 @@ const Radio = React.forwardRef(
7903
7913
  id: radioId,
7904
7914
  disabled,
7905
7915
  className: utils_index.cn(
7906
- sizeStyles$5[size2],
7916
+ sizeStyles$6[size2],
7907
7917
  "border transition-colors",
7908
7918
  "focus:ring-2 focus:ring-offset-0",
7909
7919
  "disabled:cursor-not-allowed",
@@ -8010,7 +8020,7 @@ function RadioGroup({
8010
8020
  ] });
8011
8021
  }
8012
8022
  RadioGroup.displayName = "RadioGroup";
8013
- const sizeStyles$4 = {
8023
+ const sizeStyles$5 = {
8014
8024
  sm: {
8015
8025
  switch: "h-5 w-9",
8016
8026
  dot: "h-3 w-3",
@@ -8037,7 +8047,7 @@ function Toggle({
8037
8047
  className,
8038
8048
  isLoading = false
8039
8049
  }) {
8040
- const currentSize = sizeStyles$4[size2];
8050
+ const currentSize = sizeStyles$5[size2];
8041
8051
  const isDisabled = disabled || isLoading;
8042
8052
  return /* @__PURE__ */ jsxRuntime.jsx(W, { className, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
8043
8053
  (label || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 mr-4", children: [
@@ -8274,7 +8284,7 @@ function Combobox({
8274
8284
  ] });
8275
8285
  }
8276
8286
  Combobox.displayName = "Combobox";
8277
- const variantStyles$1 = {
8287
+ const variantStyles$2 = {
8278
8288
  default: utils_index.cn(
8279
8289
  "bg-primary-100 text-primary-700 border-primary-200",
8280
8290
  "dark:bg-primary-800 dark:text-primary-200 dark:border-primary-700"
@@ -8300,7 +8310,7 @@ const variantStyles$1 = {
8300
8310
  "dark:bg-gold-900/50 dark:text-gold-300 dark:border-gold-700"
8301
8311
  )
8302
8312
  };
8303
- const sizeStyles$3 = {
8313
+ const sizeStyles$4 = {
8304
8314
  sm: "px-2 py-0.5 text-xs",
8305
8315
  md: "px-2.5 py-1 text-sm",
8306
8316
  lg: "px-3 py-1.5 text-base"
@@ -8313,8 +8323,8 @@ const Badge = React.forwardRef(
8313
8323
  ref,
8314
8324
  className: utils_index.cn(
8315
8325
  "inline-flex items-center justify-center font-medium rounded-full border",
8316
- variantStyles$1[variant],
8317
- sizeStyles$3[size2],
8326
+ variantStyles$2[variant],
8327
+ sizeStyles$4[size2],
8318
8328
  className
8319
8329
  ),
8320
8330
  ...props,
@@ -8472,7 +8482,7 @@ const TableCell = React.forwardRef(
8472
8482
  }
8473
8483
  );
8474
8484
  TableCell.displayName = "TableCell";
8475
- const sizeStyles$2 = {
8485
+ const sizeStyles$3 = {
8476
8486
  sm: "px-3 py-1.5 text-sm",
8477
8487
  md: "px-4 py-2 text-sm",
8478
8488
  lg: "px-5 py-2.5 text-base"
@@ -8521,7 +8531,7 @@ function Tabs({
8521
8531
  className: ({ selected }) => utils_index.cn(
8522
8532
  "relative outline-none transition-colors duration-normal",
8523
8533
  "focus-visible:ring-2 focus-visible:ring-gold-500/50",
8524
- sizeStyles$2[size2],
8534
+ sizeStyles$3[size2],
8525
8535
  fullWidth && "flex-1",
8526
8536
  // Default variant styles
8527
8537
  variant === "default" && [
@@ -8705,7 +8715,7 @@ const Breadcrumbs = React.forwardRef(
8705
8715
  }
8706
8716
  );
8707
8717
  Breadcrumbs.displayName = "Breadcrumbs";
8708
- const variantStyles = {
8718
+ const variantStyles$1 = {
8709
8719
  text: "rounded",
8710
8720
  circular: "rounded-full",
8711
8721
  rectangular: "rounded-md"
@@ -8741,7 +8751,7 @@ const Skeleton = React.forwardRef(
8741
8751
  {
8742
8752
  className: utils_index.cn(
8743
8753
  "bg-primary-200 dark:bg-primary-700",
8744
- variantStyles[variant],
8754
+ variantStyles$1[variant],
8745
8755
  animate && "animate-pulse"
8746
8756
  ),
8747
8757
  style: {
@@ -8763,7 +8773,7 @@ const Skeleton = React.forwardRef(
8763
8773
  ref,
8764
8774
  className: utils_index.cn(
8765
8775
  "bg-primary-200 dark:bg-primary-700",
8766
- variantStyles[variant],
8776
+ variantStyles$1[variant],
8767
8777
  animate && "animate-pulse",
8768
8778
  className
8769
8779
  ),
@@ -8841,7 +8851,7 @@ const defaultIcons = {
8841
8851
  }
8842
8852
  )
8843
8853
  };
8844
- const sizeStyles$1 = {
8854
+ const sizeStyles$2 = {
8845
8855
  sm: {
8846
8856
  container: "py-6 px-4",
8847
8857
  icon: "w-10 h-10",
@@ -8877,7 +8887,7 @@ const EmptyState = React.forwardRef(
8877
8887
  className,
8878
8888
  ...props
8879
8889
  }, ref) => {
8880
- const styles = sizeStyles$1[size2];
8890
+ const styles = sizeStyles$2[size2];
8881
8891
  return /* @__PURE__ */ jsxRuntime.jsxs(
8882
8892
  "div",
8883
8893
  {
@@ -8921,7 +8931,7 @@ const EmptyState = React.forwardRef(
8921
8931
  EmptyState.displayName = "EmptyState";
8922
8932
  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
8933
  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 = {
8934
+ const sizeStyles$1 = {
8925
8935
  sm: { button: "h-8 min-w-8 px-2 text-sm", text: "text-sm" },
8926
8936
  md: { button: "h-10 min-w-10 px-3 text-sm", text: "text-sm" }
8927
8937
  };
@@ -8971,7 +8981,7 @@ function Pagination({
8971
8981
  className
8972
8982
  }) {
8973
8983
  const pageSizeId = React.useId();
8974
- const currentSize = sizeStyles[size2];
8984
+ const currentSize = sizeStyles$1[size2];
8975
8985
  const canGoPrevious = currentPage > 1;
8976
8986
  const canGoNext = currentPage < totalPages;
8977
8987
  const pageNumbers = React.useMemo(
@@ -9498,11 +9508,452 @@ function MultiSelect({
9498
9508
  ] });
9499
9509
  }
9500
9510
  MultiSelect.displayName = "MultiSelect";
9501
- exports.useDebounce = useSelection.useDebounce;
9502
- exports.useDebouncedCallback = useSelection.useDebouncedCallback;
9503
- exports.useDebouncedCallbackWithControl = useSelection.useDebouncedCallbackWithControl;
9504
- exports.useSelection = useSelection.useSelection;
9505
- exports.useTable = useSelection.useTable;
9511
+ function shouldShowItem(item) {
9512
+ if (item.visible === void 0) return true;
9513
+ if (typeof item.visible === "boolean") return item.visible;
9514
+ if (typeof item.visible === "function") return item.visible();
9515
+ return true;
9516
+ }
9517
+ function isItemActive(currentPath, href, matcher = "exact") {
9518
+ if (!currentPath) return false;
9519
+ if (typeof matcher === "function") {
9520
+ return matcher(currentPath, href);
9521
+ }
9522
+ switch (matcher) {
9523
+ case "exact":
9524
+ return currentPath === href;
9525
+ case "startsWith":
9526
+ return currentPath === href || currentPath.startsWith(`${href}/`);
9527
+ default:
9528
+ return false;
9529
+ }
9530
+ }
9531
+ const sizeStyles = {
9532
+ sm: "px-2 py-1.5 text-xs gap-2",
9533
+ md: "px-3 py-2.5 text-sm gap-3",
9534
+ lg: "px-4 py-3 text-base gap-3"
9535
+ };
9536
+ const iconSizeStyles = {
9537
+ sm: "h-4 w-4",
9538
+ md: "h-5 w-5",
9539
+ lg: "h-6 w-6"
9540
+ };
9541
+ const DefaultLink = ({
9542
+ to,
9543
+ children,
9544
+ className,
9545
+ onClick,
9546
+ title,
9547
+ "aria-current": ariaCurrent,
9548
+ "aria-label": ariaLabel
9549
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
9550
+ "a",
9551
+ {
9552
+ href: to,
9553
+ className,
9554
+ onClick,
9555
+ title,
9556
+ "aria-current": ariaCurrent,
9557
+ "aria-label": ariaLabel,
9558
+ children
9559
+ }
9560
+ );
9561
+ function SidebarItem({
9562
+ item,
9563
+ currentPath,
9564
+ size: size2 = "md",
9565
+ collapsed = false,
9566
+ onNavigate,
9567
+ LinkComponent,
9568
+ className,
9569
+ ...props
9570
+ }) {
9571
+ if (!shouldShowItem(item)) {
9572
+ return null;
9573
+ }
9574
+ const isActive = isItemActive(currentPath, item.href, item.activeMatch);
9575
+ const LinkElement = LinkComponent || DefaultLink;
9576
+ const handleClick = () => {
9577
+ if (item.disabled) return;
9578
+ item.onClick?.();
9579
+ onNavigate?.(item.href);
9580
+ };
9581
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9582
+ item.icon && /* @__PURE__ */ jsxRuntime.jsx(
9583
+ "span",
9584
+ {
9585
+ className: utils_index.cn(
9586
+ "flex-shrink-0",
9587
+ iconSizeStyles[size2],
9588
+ "[&>svg]:h-full [&>svg]:w-full"
9589
+ ),
9590
+ "aria-hidden": "true",
9591
+ children: item.icon
9592
+ }
9593
+ ),
9594
+ !collapsed && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: item.label }),
9595
+ !collapsed && item.badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
9596
+ "span",
9597
+ {
9598
+ className: utils_index.cn(
9599
+ "flex-shrink-0 rounded-full px-2 py-0.5 text-xs font-medium",
9600
+ 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"
9601
+ ),
9602
+ children: item.badge
9603
+ }
9604
+ )
9605
+ ] });
9606
+ if (item.onClick && !item.href) {
9607
+ return /* @__PURE__ */ jsxRuntime.jsx(
9608
+ "button",
9609
+ {
9610
+ type: "button",
9611
+ onClick: handleClick,
9612
+ disabled: item.disabled,
9613
+ "aria-label": item["aria-label"] || item.label,
9614
+ title: collapsed ? item.label : void 0,
9615
+ className: utils_index.cn(
9616
+ // Base styles
9617
+ "flex w-full items-center rounded-lg font-medium",
9618
+ "transition-colors duration-150",
9619
+ "focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-2",
9620
+ "dark:focus:ring-offset-primary-900",
9621
+ // Size styles
9622
+ sizeStyles[size2],
9623
+ // State styles
9624
+ item.disabled && "opacity-50 cursor-not-allowed",
9625
+ !item.disabled && !isActive && [
9626
+ "text-primary-600 hover:bg-primary-50 hover:text-primary-900",
9627
+ "dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-100"
9628
+ ],
9629
+ isActive && [
9630
+ "bg-primary-100 text-primary-900",
9631
+ "dark:bg-primary-800 dark:text-primary-100"
9632
+ ],
9633
+ // Collapsed mode
9634
+ collapsed && "justify-center",
9635
+ className
9636
+ ),
9637
+ ...props,
9638
+ children: content
9639
+ }
9640
+ );
9641
+ }
9642
+ return /* @__PURE__ */ jsxRuntime.jsx(
9643
+ LinkElement,
9644
+ {
9645
+ to: item.href,
9646
+ onClick: handleClick,
9647
+ className: utils_index.cn(
9648
+ // Base styles
9649
+ "flex items-center rounded-lg font-medium",
9650
+ "transition-colors duration-150",
9651
+ "focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:ring-offset-2",
9652
+ "dark:focus:ring-offset-primary-900",
9653
+ // Size styles
9654
+ sizeStyles[size2],
9655
+ // State styles
9656
+ item.disabled && "opacity-50 cursor-not-allowed pointer-events-none",
9657
+ !item.disabled && !isActive && [
9658
+ "text-primary-600 hover:bg-primary-50 hover:text-primary-900",
9659
+ "dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-100"
9660
+ ],
9661
+ isActive && [
9662
+ "bg-primary-100 text-primary-900",
9663
+ "dark:bg-primary-800 dark:text-primary-100"
9664
+ ],
9665
+ // Collapsed mode
9666
+ collapsed && "justify-center",
9667
+ className
9668
+ ),
9669
+ "aria-current": isActive ? "page" : void 0,
9670
+ "aria-label": item["aria-label"] || (collapsed ? item.label : void 0),
9671
+ title: collapsed ? item.label : void 0,
9672
+ children: content
9673
+ }
9674
+ );
9675
+ }
9676
+ function shouldShowGroup(group) {
9677
+ if (group.visible === void 0) return true;
9678
+ if (typeof group.visible === "boolean") return group.visible;
9679
+ if (typeof group.visible === "function") return group.visible();
9680
+ return true;
9681
+ }
9682
+ const SidebarGroup = React.forwardRef(
9683
+ ({
9684
+ group,
9685
+ currentPath,
9686
+ size: size2 = "md",
9687
+ collapsed = false,
9688
+ LinkComponent,
9689
+ onNavigate,
9690
+ className,
9691
+ ...props
9692
+ }, ref) => {
9693
+ if (!shouldShowGroup(group)) {
9694
+ return null;
9695
+ }
9696
+ const visibleItems = group.items.filter(shouldShowItem);
9697
+ if (visibleItems.length === 0) {
9698
+ return null;
9699
+ }
9700
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, role: "group", className: utils_index.cn("space-y-1", className), ...props, children: [
9701
+ group.label && !collapsed && /* @__PURE__ */ jsxRuntime.jsx(
9702
+ "h3",
9703
+ {
9704
+ className: utils_index.cn(
9705
+ "px-3 py-2 text-xs font-semibold uppercase tracking-wider",
9706
+ "text-primary-500 dark:text-primary-400"
9707
+ ),
9708
+ children: group.label
9709
+ }
9710
+ ),
9711
+ /* @__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(
9712
+ SidebarItem,
9713
+ {
9714
+ item,
9715
+ currentPath,
9716
+ size: size2,
9717
+ collapsed,
9718
+ LinkComponent,
9719
+ onNavigate
9720
+ }
9721
+ ) }, item.key)) }) })
9722
+ ] });
9723
+ }
9724
+ );
9725
+ SidebarGroup.displayName = "SidebarGroup";
9726
+ const SidebarDivider = React.forwardRef(
9727
+ ({ label, className, ...props }, ref) => {
9728
+ if (label) {
9729
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils_index.cn("relative my-4", className), children: [
9730
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
9731
+ "hr",
9732
+ {
9733
+ ref,
9734
+ className: "w-full border-t border-primary-200 dark:border-primary-700",
9735
+ ...props
9736
+ }
9737
+ ) }),
9738
+ /* @__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 }) })
9739
+ ] });
9740
+ }
9741
+ return /* @__PURE__ */ jsxRuntime.jsx(
9742
+ "hr",
9743
+ {
9744
+ ref,
9745
+ className: utils_index.cn(
9746
+ "my-4 border-t border-primary-200 dark:border-primary-700",
9747
+ className
9748
+ ),
9749
+ ...props
9750
+ }
9751
+ );
9752
+ }
9753
+ );
9754
+ SidebarDivider.displayName = "SidebarDivider";
9755
+ const variantStyles = {
9756
+ default: [
9757
+ "bg-white border-r border-gold-500/40",
9758
+ "dark:bg-primary-900 dark:border-gold-500/20"
9759
+ ].join(" "),
9760
+ minimal: [
9761
+ "bg-white border-r border-primary-200",
9762
+ "dark:bg-primary-900 dark:border-primary-700"
9763
+ ].join(" ")
9764
+ };
9765
+ const Sidebar = React.forwardRef(
9766
+ ({
9767
+ navigation,
9768
+ currentPath,
9769
+ isOpen = false,
9770
+ onClose,
9771
+ collapsed = false,
9772
+ onCollapsedChange,
9773
+ variant = "default",
9774
+ size: size2 = "md",
9775
+ header,
9776
+ footer,
9777
+ LinkComponent,
9778
+ onNavigate,
9779
+ showMobileOverlay = true,
9780
+ width = "16rem",
9781
+ collapsedWidth = "4rem",
9782
+ className,
9783
+ "aria-label": ariaLabel = "Main navigation",
9784
+ ...props
9785
+ }, ref) => {
9786
+ React.useEffect(() => {
9787
+ const handleEscape = (event) => {
9788
+ if (event.key === "Escape" && isOpen) {
9789
+ onClose?.();
9790
+ }
9791
+ };
9792
+ document.addEventListener("keydown", handleEscape);
9793
+ return () => document.removeEventListener("keydown", handleEscape);
9794
+ }, [isOpen, onClose]);
9795
+ React.useEffect(() => {
9796
+ if (isOpen) {
9797
+ document.body.style.overflow = "hidden";
9798
+ } else {
9799
+ document.body.style.overflow = "";
9800
+ }
9801
+ return () => {
9802
+ document.body.style.overflow = "";
9803
+ };
9804
+ }, [isOpen]);
9805
+ const handleNavigate = React.useCallback(
9806
+ (href) => {
9807
+ onNavigate?.(href);
9808
+ onClose?.();
9809
+ },
9810
+ [onNavigate, onClose]
9811
+ );
9812
+ const handleOverlayClick = React.useCallback(() => {
9813
+ onClose?.();
9814
+ }, [onClose]);
9815
+ const handleCollapseToggle = React.useCallback(() => {
9816
+ onCollapsedChange?.(!collapsed);
9817
+ }, [collapsed, onCollapsedChange]);
9818
+ const hasVisibleGroups = (groups) => groups?.some(shouldShowGroup) ?? false;
9819
+ const hasFeatured = hasVisibleGroups(navigation.featured);
9820
+ const hasPrimary = hasVisibleGroups(navigation.primary);
9821
+ const hasSecondary = hasVisibleGroups(navigation.secondary);
9822
+ const hasBottom = hasVisibleGroups(navigation.bottom);
9823
+ const sidebarWidth = collapsed ? collapsedWidth : width;
9824
+ const sidebarContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9825
+ header && /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_index.cn("flex-shrink-0", collapsed && "px-2"), children: header }),
9826
+ 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(
9827
+ SidebarGroup,
9828
+ {
9829
+ group,
9830
+ currentPath,
9831
+ size: size2,
9832
+ collapsed,
9833
+ LinkComponent,
9834
+ onNavigate: handleNavigate
9835
+ },
9836
+ group.key
9837
+ )) }) }),
9838
+ 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(
9839
+ SidebarGroup,
9840
+ {
9841
+ group,
9842
+ currentPath,
9843
+ size: size2,
9844
+ collapsed,
9845
+ LinkComponent,
9846
+ onNavigate: handleNavigate
9847
+ },
9848
+ group.key
9849
+ )) }) }),
9850
+ hasPrimary && hasSecondary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3", children: /* @__PURE__ */ jsxRuntime.jsx(SidebarDivider, {}) }),
9851
+ 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(
9852
+ SidebarGroup,
9853
+ {
9854
+ group,
9855
+ currentPath,
9856
+ size: size2,
9857
+ collapsed,
9858
+ LinkComponent,
9859
+ onNavigate: handleNavigate
9860
+ },
9861
+ group.key
9862
+ )) }) }),
9863
+ !hasPrimary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
9864
+ (hasPrimary || hasSecondary) && hasBottom && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3", children: /* @__PURE__ */ jsxRuntime.jsx(SidebarDivider, {}) }),
9865
+ 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(
9866
+ SidebarGroup,
9867
+ {
9868
+ group,
9869
+ currentPath,
9870
+ size: size2,
9871
+ collapsed,
9872
+ LinkComponent,
9873
+ onNavigate: handleNavigate
9874
+ },
9875
+ group.key
9876
+ )) }) }),
9877
+ footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_index.cn("flex-shrink-0", collapsed && "px-2"), children: footer }),
9878
+ 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(
9879
+ "button",
9880
+ {
9881
+ type: "button",
9882
+ onClick: handleCollapseToggle,
9883
+ className: utils_index.cn(
9884
+ "flex w-full items-center justify-center rounded-lg p-2",
9885
+ "text-primary-500 hover:bg-primary-50 hover:text-primary-700",
9886
+ "dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200",
9887
+ "transition-colors duration-150",
9888
+ "focus:outline-none focus:ring-2 focus:ring-primary-500/20"
9889
+ ),
9890
+ "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
9891
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9892
+ "svg",
9893
+ {
9894
+ className: utils_index.cn(
9895
+ "h-5 w-5 transition-transform duration-200",
9896
+ collapsed && "rotate-180"
9897
+ ),
9898
+ fill: "none",
9899
+ viewBox: "0 0 24 24",
9900
+ stroke: "currentColor",
9901
+ "aria-hidden": "true",
9902
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9903
+ "path",
9904
+ {
9905
+ strokeLinecap: "round",
9906
+ strokeLinejoin: "round",
9907
+ strokeWidth: 2,
9908
+ d: "M11 19l-7-7 7-7m8 14l-7-7 7-7"
9909
+ }
9910
+ )
9911
+ }
9912
+ )
9913
+ }
9914
+ ) })
9915
+ ] });
9916
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9917
+ showMobileOverlay && isOpen && /* @__PURE__ */ jsxRuntime.jsx(
9918
+ "div",
9919
+ {
9920
+ className: "fixed inset-0 z-40 bg-black/20 lg:hidden",
9921
+ onClick: handleOverlayClick,
9922
+ "aria-hidden": "true"
9923
+ }
9924
+ ),
9925
+ /* @__PURE__ */ jsxRuntime.jsx(
9926
+ "aside",
9927
+ {
9928
+ ref,
9929
+ className: utils_index.cn(
9930
+ // Base styles
9931
+ "fixed top-0 left-0 z-50 flex h-full flex-col",
9932
+ "transform transition-all duration-300 ease-in-out",
9933
+ // Desktop styles
9934
+ "lg:static lg:z-auto lg:translate-x-0",
9935
+ // Mobile styles
9936
+ isOpen ? "translate-x-0" : "-translate-x-full",
9937
+ // Variant styles
9938
+ variantStyles[variant],
9939
+ className
9940
+ ),
9941
+ style: { width: sidebarWidth },
9942
+ "aria-label": ariaLabel,
9943
+ ...props,
9944
+ children: sidebarContent
9945
+ }
9946
+ )
9947
+ ] });
9948
+ }
9949
+ );
9950
+ Sidebar.displayName = "Sidebar";
9951
+ exports.useDebounce = useSidebar.useDebounce;
9952
+ exports.useDebouncedCallback = useSidebar.useDebouncedCallback;
9953
+ exports.useDebouncedCallbackWithControl = useSidebar.useDebouncedCallbackWithControl;
9954
+ exports.useSelection = useSidebar.useSelection;
9955
+ exports.useSidebar = useSidebar.useSidebar;
9956
+ exports.useTable = useSidebar.useTable;
9506
9957
  exports.cn = utils_index.cn;
9507
9958
  exports.Badge = Badge;
9508
9959
  exports.Breadcrumbs = Breadcrumbs;
@@ -9521,6 +9972,10 @@ exports.PasswordInput = PasswordInput;
9521
9972
  exports.Radio = Radio;
9522
9973
  exports.RadioGroup = RadioGroup;
9523
9974
  exports.Select = Select;
9975
+ exports.Sidebar = Sidebar;
9976
+ exports.SidebarDivider = SidebarDivider;
9977
+ exports.SidebarGroup = SidebarGroup;
9978
+ exports.SidebarItem = SidebarItem;
9524
9979
  exports.Skeleton = Skeleton;
9525
9980
  exports.Spinner = Spinner;
9526
9981
  exports.TabContentPanels = TabContentPanels;