@mvn-ui/react 0.1.1 → 0.1.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/index.js CHANGED
@@ -489,10 +489,10 @@ function ButtonGroup({
489
489
  "data-orientation": orientation,
490
490
  className: cn(
491
491
  "inline-flex",
492
+ className,
492
493
  isVertical ? "flex-col" : "flex-row",
493
494
  // Join children and normalize border radius so the group looks contiguous
494
- isVertical ? "[&>*]:rounded-none [&>*]:-mt-px [&>:first-child]:mt-0 [&>:first-child]:rounded-t-md [&>:last-child]:rounded-b-md" : "[&>*]:rounded-none [&>*]:-ml-px [&>:first-child]:ml-0 [&>:first-child]:rounded-l-md [&>:last-child]:rounded-r-md",
495
- className
495
+ isVertical ? "[&>*]:rounded-none [&>*]:-mt-px [&>:first-child]:mt-0 [&>:first-child]:rounded-t-md [&>:last-child]:rounded-b-md" : "[&>*]:rounded-none [&>*]:-ml-px [&>:first-child]:ml-0 [&>:first-child]:rounded-l-md [&>:last-child]:rounded-r-md"
496
496
  ),
497
497
  ...props
498
498
  }
@@ -603,8 +603,8 @@ var Input = React49__namespace.forwardRef(
603
603
  children: label
604
604
  }
605
605
  ),
606
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
607
- leftIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none [&_svg]:size-4", children: leftIcon }),
606
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
607
+ leftIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-3 text-muted-foreground pointer-events-none flex items-center justify-center [&_svg]:size-4", children: leftIcon }),
608
608
  /* @__PURE__ */ jsxRuntime.jsx(
609
609
  "input",
610
610
  {
@@ -629,7 +629,7 @@ var Input = React49__namespace.forwardRef(
629
629
  ...props
630
630
  }
631
631
  ),
632
- (showClearButton || showPasswordToggle || rightIcon) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1", children: [
632
+ (showClearButton || showPasswordToggle || rightIcon) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute right-3 flex items-center gap-1", children: [
633
633
  showClearButton && /* @__PURE__ */ jsxRuntime.jsx(
634
634
  "button",
635
635
  {
@@ -650,7 +650,7 @@ var Input = React49__namespace.forwardRef(
650
650
  children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOffIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeIcon, { className: "h-4 w-4" })
651
651
  }
652
652
  ),
653
- rightIcon && !showPasswordToggle && !showClearButton && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground [&_svg]:size-4", children: rightIcon })
653
+ rightIcon && !showPasswordToggle && !showClearButton && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground flex items-center justify-center [&_svg]:size-4", children: rightIcon })
654
654
  ] })
655
655
  ] }),
656
656
  error && /* @__PURE__ */ jsxRuntime.jsx(
@@ -845,7 +845,28 @@ Textarea.displayName = "Textarea";
845
845
 
846
846
  // src/components/ui/select/index.tsx
847
847
  init_utils();
848
- var Select = SelectPrimitive__namespace.Root;
848
+ var Select = React49__namespace.forwardRef(
849
+ ({ children, value, onValueChange, ...props }, _ref) => {
850
+ const [internalValue, setInternalValue] = React49__namespace.useState(value ?? "");
851
+ React49__namespace.useEffect(() => {
852
+ setInternalValue(value ?? "");
853
+ }, [value]);
854
+ const handleValueChange = (newValue) => {
855
+ setInternalValue(newValue);
856
+ onValueChange?.(newValue);
857
+ };
858
+ return /* @__PURE__ */ jsxRuntime.jsx(
859
+ SelectPrimitive__namespace.Root,
860
+ {
861
+ value: internalValue,
862
+ onValueChange: handleValueChange,
863
+ ...props,
864
+ children
865
+ }
866
+ );
867
+ }
868
+ );
869
+ Select.displayName = "Select";
849
870
  var SelectGroup = SelectPrimitive__namespace.Group;
850
871
  var SelectValue = SelectPrimitive__namespace.Value;
851
872
  var triggerVariants = classVarianceAuthority.cva(
@@ -1125,7 +1146,7 @@ RadioGroupItem.displayName = RadioGroupPrimitive__namespace.Item.displayName;
1125
1146
 
1126
1147
  // src/components/ui/switch/index.tsx
1127
1148
  init_utils();
1128
- var Switch = React49__namespace.forwardRef(({ className, ...props }, ref) => {
1149
+ var Switch = React49__namespace.forwardRef(({ className, offNode, onNode, ...props }, ref) => {
1129
1150
  return /* @__PURE__ */ jsxRuntime.jsx(
1130
1151
  SwitchPrimitives__namespace.Root,
1131
1152
  {
@@ -1138,13 +1159,17 @@ var Switch = React49__namespace.forwardRef(({ className, ...props }, ref) => {
1138
1159
  className
1139
1160
  ),
1140
1161
  ...props,
1141
- children: /* @__PURE__ */ jsxRuntime.jsx(
1162
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1142
1163
  SwitchPrimitives__namespace.Thumb,
1143
1164
  {
1144
1165
  className: cn(
1145
- "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
1166
+ "group pointer-events-none relative flex items-center justify-center h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
1146
1167
  "data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
1147
- )
1168
+ ),
1169
+ children: [
1170
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute opacity-0 group-data-[state=checked]:opacity-100 transition-all duration-200", children: onNode }),
1171
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute opacity-100 group-data-[state=checked]:opacity-0 transition-all duration-200", children: offNode })
1172
+ ]
1148
1173
  }
1149
1174
  )
1150
1175
  }
@@ -1207,7 +1232,7 @@ var toggleGroupVariants = classVarianceAuthority.cva(
1207
1232
  }
1208
1233
  );
1209
1234
  var toggleGroupItemVariants = classVarianceAuthority.cva(
1210
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm hover:bg-surface-3 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
1235
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md border-b border-line-strong font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:border-primary data-[state=on]:text-primary hover:bg-surface-3 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
1211
1236
  {
1212
1237
  variants: {
1213
1238
  size: {
@@ -1222,15 +1247,7 @@ var toggleGroupItemVariants = classVarianceAuthority.cva(
1222
1247
  }
1223
1248
  );
1224
1249
  var ToggleGroup = React49__namespace.forwardRef(
1225
- ({
1226
- className,
1227
- size,
1228
- items,
1229
- itemClassName,
1230
- renderItem,
1231
- children,
1232
- ...props
1233
- }, ref) => {
1250
+ ({ className, size, items, itemClassName, renderItem, children, ...props }, ref) => {
1234
1251
  const defaultRenderItem = React49__namespace.useCallback(
1235
1252
  (item) => /* @__PURE__ */ jsxRuntime.jsxs(
1236
1253
  ToggleGroupPrimitive__namespace.Item,
@@ -1323,21 +1340,18 @@ Slider.displayName = SliderPrimitive__namespace.Root.displayName;
1323
1340
 
1324
1341
  // src/components/ui/input-group/index.tsx
1325
1342
  init_utils();
1326
- var inputGroupVariants = classVarianceAuthority.cva(
1327
- "flex items-stretch w-full",
1328
- {
1329
- variants: {
1330
- size: {
1331
- sm: "h-8 text-sm",
1332
- default: "h-10 text-[0.9375rem]",
1333
- lg: "h-12 text-base"
1334
- }
1335
- },
1336
- defaultVariants: {
1337
- size: "default"
1343
+ var inputGroupVariants = classVarianceAuthority.cva("flex items-stretch w-full", {
1344
+ variants: {
1345
+ size: {
1346
+ sm: "h-8 text-sm",
1347
+ default: "h-10 text-[0.9375rem]",
1348
+ lg: "h-12 text-base"
1338
1349
  }
1350
+ },
1351
+ defaultVariants: {
1352
+ size: "default"
1339
1353
  }
1340
- );
1354
+ });
1341
1355
  var InputGroup = React49__namespace.forwardRef(
1342
1356
  ({
1343
1357
  className,
@@ -1379,9 +1393,8 @@ var InputGroup = React49__namespace.forwardRef(
1379
1393
  return React49__namespace.cloneElement(child, {
1380
1394
  className: cn(
1381
1395
  child.props.className,
1382
- leftAddon && "rounded-l-none border-l-0",
1383
- rightAddon && "rounded-r-none border-r-0",
1384
- (leftElement || rightElement) && "rounded-none"
1396
+ (leftAddon || leftElement) && "rounded-l-none border-l-0",
1397
+ (rightAddon || rightElement) && "rounded-r-none border-r-0"
1385
1398
  )
1386
1399
  });
1387
1400
  }
@@ -1509,7 +1522,7 @@ function deleteValueByPath(obj, path) {
1509
1522
 
1510
1523
  // src/components/ui/form/form-instance.ts
1511
1524
  var externalMounts = /* @__PURE__ */ new WeakMap();
1512
- function createFormInstance() {
1525
+ function createFormInstance(name) {
1513
1526
  const store = {
1514
1527
  values: {},
1515
1528
  errors: {}
@@ -1534,7 +1547,10 @@ function createFormInstance() {
1534
1547
  };
1535
1548
  subscribers.forEach((fn) => fn && fn(snapshot));
1536
1549
  fieldMeta.forEach((meta) => meta.onStoreChange && meta.onStoreChange());
1537
- if (ext) ext.forEach((handler) => handler.onStoreChange && handler.onStoreChange());
1550
+ if (ext)
1551
+ ext.forEach(
1552
+ (handler) => handler.onStoreChange && handler.onStoreChange()
1553
+ );
1538
1554
  }
1539
1555
  function scheduleNotify() {
1540
1556
  if (pendingNotify) return;
@@ -1565,8 +1581,8 @@ function createFormInstance() {
1565
1581
  if (options && options.clone === false) return store.values;
1566
1582
  return cloneDeep(store.values);
1567
1583
  },
1568
- getFieldValue(name) {
1569
- const path = toNamePath(name);
1584
+ getFieldValue(name2) {
1585
+ const path = toNamePath(name2);
1570
1586
  return getValueByPath(store.values, path);
1571
1587
  },
1572
1588
  setFieldsValue(vals, options) {
@@ -1632,24 +1648,27 @@ function createFormInstance() {
1632
1648
  instance.validateFields(names).catch((validationError) => {
1633
1649
  if (validationError && validationError.errorFields) {
1634
1650
  mounts.forEach((handler) => {
1635
- if (handler.onFieldsChange) handler.onFieldsChange(validationError.errorFields);
1651
+ if (handler.onFieldsChange)
1652
+ handler.onFieldsChange(validationError.errorFields);
1636
1653
  });
1637
1654
  try {
1638
1655
  const ext = externalMounts.get(instance);
1639
1656
  if (ext) {
1640
1657
  ext.forEach((handler) => {
1641
- if (handler.onFieldsChange) handler.onFieldsChange(validationError.errorFields);
1658
+ if (handler.onFieldsChange)
1659
+ handler.onFieldsChange(validationError.errorFields);
1642
1660
  });
1643
1661
  }
1644
1662
  } catch (error) {
1645
1663
  }
1646
- if (instance.onFieldsChange) instance.onFieldsChange(validationError.errorFields);
1664
+ if (instance.onFieldsChange)
1665
+ instance.onFieldsChange(validationError.errorFields);
1647
1666
  }
1648
1667
  });
1649
1668
  }
1650
1669
  },
1651
- setFieldValue(name, value) {
1652
- const path = toNamePath(name);
1670
+ setFieldValue(name2, value) {
1671
+ const path = toNamePath(name2);
1653
1672
  setValueByPath(store.values, path, value);
1654
1673
  const key = namePathToString(path);
1655
1674
  delete store.errors[key];
@@ -1774,16 +1793,21 @@ function createFormInstance() {
1774
1793
  return Promise.resolve({ ...store.values });
1775
1794
  });
1776
1795
  },
1777
- submit() {
1778
- instance.validateFields().then(() => {
1796
+ async submit() {
1797
+ try {
1798
+ await instance.validateFields();
1779
1799
  mounts.forEach((handler) => handler.onSubmit && handler.onSubmit());
1780
1800
  try {
1781
1801
  const ext = externalMounts.get(instance);
1782
- if (ext) ext.forEach((handler) => handler.onSubmit && handler.onSubmit());
1802
+ if (ext)
1803
+ ext.forEach(
1804
+ (external_handler) => external_handler.onSubmit && external_handler.onSubmit()
1805
+ );
1783
1806
  } catch (error) {
1784
1807
  }
1785
- }).catch(() => {
1786
- });
1808
+ } catch (validate_error) {
1809
+ return await Promise.reject(validate_error);
1810
+ }
1787
1811
  },
1788
1812
  resetFields(names) {
1789
1813
  let changed = false;
@@ -1797,8 +1821,8 @@ function createFormInstance() {
1797
1821
  scheduleNotify();
1798
1822
  return;
1799
1823
  }
1800
- names.forEach((name) => {
1801
- const path = toNamePath(name);
1824
+ names.forEach((name2) => {
1825
+ const path = toNamePath(name2);
1802
1826
  const key = namePathToString(path);
1803
1827
  if (getValueByPath(store.values, path) !== void 0) {
1804
1828
  changed = true;
@@ -1812,8 +1836,8 @@ function createFormInstance() {
1812
1836
  if (changed) version += 1;
1813
1837
  scheduleNotify();
1814
1838
  },
1815
- getFieldError(name) {
1816
- const path = toNamePath(name);
1839
+ getFieldError(name2) {
1840
+ const path = toNamePath(name2);
1817
1841
  const key = namePathToString(path);
1818
1842
  return store.errors[key] || [];
1819
1843
  },
@@ -1823,8 +1847,8 @@ function createFormInstance() {
1823
1847
  return { name: meta.namePath, errors: store.errors[key] || [] };
1824
1848
  });
1825
1849
  },
1826
- registerField(name, meta) {
1827
- const path = toNamePath(name);
1850
+ registerField(name2, meta) {
1851
+ const path = toNamePath(name2);
1828
1852
  const key = namePathToString(path);
1829
1853
  fieldMeta.set(key, {
1830
1854
  namePath: path,
@@ -1835,8 +1859,8 @@ function createFormInstance() {
1835
1859
  getValueFromEvent: meta.getValueFromEvent
1836
1860
  });
1837
1861
  },
1838
- unregisterField(name) {
1839
- const path = toNamePath(name);
1862
+ unregisterField(name2) {
1863
+ const path = toNamePath(name2);
1840
1864
  const key = namePathToString(path);
1841
1865
  fieldMeta.delete(key);
1842
1866
  if (!preserveOnUnmount) {
@@ -1860,15 +1884,15 @@ function createFormInstance() {
1860
1884
  return () => subscribers.delete(fn);
1861
1885
  },
1862
1886
  INTERNAL: {
1863
- name: void 0,
1887
+ name,
1864
1888
  itemRef: (nameArr) => (node) => {
1865
1889
  const key = namePathToString(nameArr);
1866
1890
  if (node) itemsRef[key] = node;
1867
1891
  else delete itemsRef[key];
1868
1892
  }
1869
1893
  },
1870
- getFieldInstance(name) {
1871
- const key = namePathToString(toNamePath(name));
1894
+ getFieldInstance(name2) {
1895
+ const key = namePathToString(toNamePath(name2));
1872
1896
  return itemsRef[key];
1873
1897
  }
1874
1898
  };
@@ -1877,16 +1901,19 @@ function createFormInstance() {
1877
1901
  instance.preserveOnUnmount = preserveOnUnmount;
1878
1902
  };
1879
1903
  instance.preserveOnUnmount = preserveOnUnmount;
1904
+ if (name && instance.INTERNAL) instance.INTERNAL.name = name;
1880
1905
  return instance;
1881
1906
  }
1882
1907
 
1883
1908
  // src/components/ui/form/form-context.tsx
1884
1909
  var FormContext = React49.createContext(null);
1885
- function useForm() {
1910
+ function useForm(name) {
1886
1911
  const ref = React49.useRef();
1887
1912
  if (!ref.current) {
1888
- const instance = createFormInstance();
1913
+ const instance = createFormInstance(name);
1889
1914
  ref.current = instance;
1915
+ } else if (name && ref.current.INTERNAL) {
1916
+ ref.current.INTERNAL.name = name;
1890
1917
  }
1891
1918
  return ref.current;
1892
1919
  }
@@ -2048,7 +2075,7 @@ var Form = React49.forwardRef(function Form2(props, ref) {
2048
2075
  };
2049
2076
  let unregisterMount;
2050
2077
  if (form.registerMount) {
2051
- const mountId = Math.random().toString(36).slice(2);
2078
+ const mountId = form.INTERNAL?.name ?? Math.random().toString(36).slice(2);
2052
2079
  if (preserve !== void 0) {
2053
2080
  if (form.setPreserve) form.setPreserve(!!preserve);
2054
2081
  else form.preserveOnUnmount = !!preserve;
@@ -2060,7 +2087,7 @@ var Form = React49.forwardRef(function Form2(props, ref) {
2060
2087
  map = /* @__PURE__ */ new Map();
2061
2088
  externalMounts.set(form, map);
2062
2089
  }
2063
- const mountId = Math.random().toString(36).slice(2);
2090
+ const mountId = form.INTERNAL?.name ?? Math.random().toString(36).slice(2);
2064
2091
  map.set(mountId, mountHandlers);
2065
2092
  if (preserve !== void 0) {
2066
2093
  if (form.setPreserve) form.setPreserve(!!preserve);
@@ -2135,7 +2162,7 @@ var FormItem = (props) => {
2135
2162
  const requiredIndicator = requiredMark === void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive mr-1", "aria-hidden": "true", children: "*" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1", "aria-hidden": "true", children: requiredMark });
2136
2163
  if (!children || !React49__namespace.default.isValidElement(children)) return null;
2137
2164
  const childProps = {};
2138
- if (fieldValue !== void 0) childProps[valuePropName] = fieldValue;
2165
+ childProps[valuePropName] = fieldValue;
2139
2166
  const childClass = children.props.className;
2140
2167
  if (childClass || props.className) {
2141
2168
  childProps.className = [childClass, props.className].filter(Boolean).join(" ");
@@ -2948,27 +2975,45 @@ var DialogOverlay = React49__namespace.forwardRef(({ className, ...props }, ref)
2948
2975
  }
2949
2976
  ));
2950
2977
  DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
2951
- var DialogContent = React49__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
2952
- /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
2953
- /* @__PURE__ */ jsxRuntime.jsxs(
2954
- DialogPrimitive__namespace.Content,
2955
- {
2956
- ref,
2957
- className: cn(
2958
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-mvn-gray-200 bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",
2959
- className
2960
- ),
2961
- ...props,
2962
- children: [
2963
- children,
2964
- /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none data-[state=open]:bg-mvn-gray-100", children: [
2965
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "h-4 w-4" }),
2966
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "\uB2EB\uAE30" })
2967
- ] })
2968
- ]
2969
- }
2970
- )
2971
- ] }));
2978
+ var DialogContent = React49__namespace.forwardRef(
2979
+ ({
2980
+ className,
2981
+ children,
2982
+ showClose = true,
2983
+ closeClassName,
2984
+ customClose,
2985
+ ...props
2986
+ }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
2987
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
2988
+ /* @__PURE__ */ jsxRuntime.jsxs(
2989
+ DialogPrimitive__namespace.Content,
2990
+ {
2991
+ ref,
2992
+ className: cn(
2993
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-mvn-gray-200 bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",
2994
+ className
2995
+ ),
2996
+ ...props,
2997
+ children: [
2998
+ children,
2999
+ showClose && (customClose ? customClose : /* @__PURE__ */ jsxRuntime.jsxs(
3000
+ DialogPrimitive__namespace.Close,
3001
+ {
3002
+ className: cn(
3003
+ "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none data-[state=open]:bg-mvn-gray-100",
3004
+ closeClassName
3005
+ ),
3006
+ children: [
3007
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-5 w-5" }),
3008
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
3009
+ ]
3010
+ }
3011
+ ))
3012
+ ]
3013
+ }
3014
+ )
3015
+ ] })
3016
+ );
2972
3017
  DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
2973
3018
  var DialogHeader = ({
2974
3019
  className,
@@ -2976,10 +3021,7 @@ var DialogHeader = ({
2976
3021
  }) => /* @__PURE__ */ jsxRuntime.jsx(
2977
3022
  "div",
2978
3023
  {
2979
- className: cn(
2980
- "flex flex-col space-y-1.5 text-left",
2981
- className
2982
- ),
3024
+ className: cn("flex flex-col space-y-1.5 text-left", className),
2983
3025
  ...props
2984
3026
  }
2985
3027
  );
@@ -3339,7 +3381,9 @@ var TooltipContent = React49__namespace.forwardRef(({ className, sideOffset = 4,
3339
3381
  ref,
3340
3382
  sideOffset,
3341
3383
  className: cn(
3342
- "z-50 overflow-hidden rounded-md bg-mvn-gray-900 px-3 py-1.5 text-xs text-white animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
3384
+ "z-50 overflow-hidden rounded-md bg-mvn-gray-900 px-3 py-1.5 text-xs text-primary-50 dark:bg-primary-50 dark:text-mvn-gray-900 animate-in fade-in-0 zoom-in-95",
3385
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
3386
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
3343
3387
  className
3344
3388
  ),
3345
3389
  ...props
@@ -4341,13 +4385,20 @@ PaginationEllipsis.displayName = "PaginationEllipsis";
4341
4385
 
4342
4386
  // src/components/ui/tabs/index.tsx
4343
4387
  init_utils();
4344
- var Tabs = TabsPrimitive__namespace.Root;
4388
+ var TabsContext = React49__namespace.createContext({
4389
+ destroyInactiveTabs: true
4390
+ });
4391
+ var Tabs = React49__namespace.forwardRef(({ destroyInactiveTabs = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(TabsContext.Provider, { value: { destroyInactiveTabs }, children: /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Root, { ref, ...props }) }));
4392
+ Tabs.displayName = TabsPrimitive__namespace.Root.displayName;
4345
4393
  var TabsList = React49__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4346
4394
  TabsPrimitive__namespace.List,
4347
4395
  {
4348
4396
  ref,
4349
4397
  className: cn(
4350
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
4398
+ "flex items-stretch gap-0 text-muted-foreground",
4399
+ "data-[orientation=horizontal]:w-full",
4400
+ "data-[orientation=vertical]:w-56 data-[orientation=vertical]:border-r data-[orientation=vertical]:border-border",
4401
+ "data-[orientation=vertical]:flex-col data-[orientation=vertical]:shrink-0",
4351
4402
  className
4352
4403
  ),
4353
4404
  ...props
@@ -4359,27 +4410,34 @@ var TabsTrigger = React49__namespace.forwardRef(({ className, ...props }, ref) =
4359
4410
  {
4360
4411
  ref,
4361
4412
  className: cn(
4362
- "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-4 py-2 text-sm font-medium ring-offset-background transition-all",
4363
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
4364
- "disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
4365
- className
4366
- ),
4367
- ...props
4368
- }
4369
- ));
4370
- TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
4371
- var TabsContent = React49__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4372
- TabsPrimitive__namespace.Content,
4373
- {
4374
- ref,
4375
- className: cn(
4413
+ "inline-flex min-w-0 items-center justify-center whitespace-nowrap text-sm font-medium",
4414
+ "transition-all duration-150 text-muted-foreground hover:text-primary",
4376
4415
  "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
4377
- "p-4 rounded-md border bg-card",
4416
+ "data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3 data-[orientation=horizontal]:border-b-2 data-[orientation=horizontal]:border-transparent",
4417
+ "data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-3 data-[orientation=vertical]:py-2 data-[orientation=vertical]:border-l-2 data-[orientation=vertical]:border-border",
4418
+ "data-[state=active]:text-primary data-[state=active]:font-semibold data-[state=active]:border-primary",
4419
+ "disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed",
4378
4420
  className
4379
4421
  ),
4380
4422
  ...props
4381
4423
  }
4382
4424
  ));
4425
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
4426
+ var TabsContent = React49__namespace.forwardRef(({ className, ...props }, ref) => {
4427
+ const { destroyInactiveTabs } = React49__namespace.useContext(TabsContext);
4428
+ return /* @__PURE__ */ jsxRuntime.jsx(
4429
+ TabsPrimitive__namespace.Content,
4430
+ {
4431
+ ref,
4432
+ forceMount: destroyInactiveTabs ? void 0 : true,
4433
+ className: cn(
4434
+ "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",
4435
+ className
4436
+ ),
4437
+ ...props
4438
+ }
4439
+ );
4440
+ });
4383
4441
  TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
4384
4442
  function SimpleTabs({
4385
4443
  items,
@@ -4390,10 +4448,12 @@ function SimpleTabs({
4390
4448
  tabsListClassName,
4391
4449
  tabsTriggerClassName,
4392
4450
  tabsContentClassName,
4393
- orientation = "horizontal"
4451
+ orientation = "horizontal",
4452
+ destroyInactiveTabs = true
4394
4453
  }) {
4395
- const defaultTabsListClassName = orientation === "vertical" ? "flex-col h-auto w-auto p-2 mr-4" : "mb-4";
4396
- const defaultTabsContentClassName = orientation === "vertical" ? "mt-0 ml-4" : "";
4454
+ const defaultTabsListClassName = orientation === "vertical" ? "bg-background/60 p-2" : "w-full";
4455
+ const defaultTabsContentClassName = orientation === "vertical" ? "ml-0 flex-1 min-w-0" : "w-full";
4456
+ const rootLayoutClassName = orientation === "vertical" ? "flex flex-row w-full max-w-full items-start gap-6" : "flex w-full flex-col gap-6";
4397
4457
  return /* @__PURE__ */ jsxRuntime.jsxs(
4398
4458
  Tabs,
4399
4459
  {
@@ -4401,20 +4461,15 @@ function SimpleTabs({
4401
4461
  value,
4402
4462
  onValueChange,
4403
4463
  orientation,
4404
- className: cn(
4405
- orientation === "vertical" ? "flex flex-row" : "",
4406
- className
4407
- ),
4464
+ destroyInactiveTabs,
4465
+ className: cn(rootLayoutClassName, className),
4408
4466
  children: [
4409
4467
  /* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: cn(defaultTabsListClassName, tabsListClassName), children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
4410
4468
  TabsTrigger,
4411
4469
  {
4412
4470
  value: item.value,
4413
4471
  disabled: item.disabled,
4414
- className: cn(
4415
- orientation === "vertical" && "mb-1 w-full justify-start",
4416
- tabsTriggerClassName
4417
- ),
4472
+ className: cn(tabsTriggerClassName),
4418
4473
  children: item.label
4419
4474
  },
4420
4475
  item.value
@@ -4669,6 +4724,7 @@ var ScrollArea = React49__namespace.forwardRef(
4669
4724
  orientation = "vertical",
4670
4725
  scrollbarClassName,
4671
4726
  thumbClassName,
4727
+ type = "auto",
4672
4728
  ...props
4673
4729
  }, ref) => {
4674
4730
  const showVertical = orientation === "vertical" || orientation === "both";
@@ -4677,12 +4733,38 @@ var ScrollArea = React49__namespace.forwardRef(
4677
4733
  ScrollAreaPrimitive__namespace.Root,
4678
4734
  {
4679
4735
  ref,
4736
+ type,
4680
4737
  className: cn("relative overflow-hidden", className),
4681
4738
  ...props,
4682
4739
  children: [
4683
- /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
4684
- showVertical && /* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "vertical", className: scrollbarClassName, thumbClassName }),
4685
- showHorizontal && /* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "horizontal", className: scrollbarClassName, thumbClassName }),
4740
+ /* @__PURE__ */ jsxRuntime.jsx(
4741
+ ScrollAreaPrimitive__namespace.Viewport,
4742
+ {
4743
+ className: cn(
4744
+ "h-full w-full rounded-[inherit]",
4745
+ // Fix overflow based on orientation to prevent unwanted scrolling
4746
+ orientation === "vertical" && "!overflow-x-hidden",
4747
+ orientation === "horizontal" && "!overflow-y-hidden"
4748
+ ),
4749
+ children
4750
+ }
4751
+ ),
4752
+ showVertical && /* @__PURE__ */ jsxRuntime.jsx(
4753
+ ScrollBar,
4754
+ {
4755
+ orientation: "vertical",
4756
+ className: scrollbarClassName,
4757
+ thumbClassName
4758
+ }
4759
+ ),
4760
+ showHorizontal && /* @__PURE__ */ jsxRuntime.jsx(
4761
+ ScrollBar,
4762
+ {
4763
+ orientation: "horizontal",
4764
+ className: scrollbarClassName,
4765
+ thumbClassName
4766
+ }
4767
+ ),
4686
4768
  /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Corner, {})
4687
4769
  ]
4688
4770
  }
@@ -4706,7 +4788,7 @@ var ScrollBar = React49__namespace.forwardRef(({ className, orientation = "verti
4706
4788
  ScrollAreaPrimitive__namespace.ScrollAreaThumb,
4707
4789
  {
4708
4790
  className: cn(
4709
- "relative flex-1 rounded-full bg-line-normal hover:bg-line-strong transition-colors",
4791
+ "relative flex-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground transition-colors",
4710
4792
  thumbClassName
4711
4793
  )
4712
4794
  }
@@ -4717,6 +4799,8 @@ ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displ
4717
4799
 
4718
4800
  // src/components/ui/sidebar/index.tsx
4719
4801
  init_utils();
4802
+ var SIDEBAR_COOKIE_NAME = "sidebar_state";
4803
+ var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
4720
4804
  var SIDEBAR_WIDTH = "16rem";
4721
4805
  var SIDEBAR_WIDTH_ICON = "3rem";
4722
4806
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
@@ -4728,395 +4812,601 @@ function useSidebar() {
4728
4812
  }
4729
4813
  return context;
4730
4814
  }
4731
- var SidebarProvider = React49__namespace.forwardRef(
4732
- ({
4733
- defaultOpen = true,
4734
- open: openProp,
4735
- onOpenChange: setOpenProp,
4736
- className,
4737
- style,
4738
- children,
4739
- ...props
4740
- }, ref) => {
4741
- const [openMobile, setOpenMobile] = React49__namespace.useState(false);
4742
- const [_open, _setOpen] = React49__namespace.useState(defaultOpen);
4743
- const open = openProp ?? _open;
4744
- const setOpen = React49__namespace.useCallback(
4745
- (value) => {
4746
- const openState = typeof value === "function" ? value(open) : value;
4747
- if (setOpenProp) {
4748
- setOpenProp(openState);
4749
- } else {
4750
- _setOpen(openState);
4751
- }
4815
+ function SidebarProvider({
4816
+ defaultOpen = true,
4817
+ open: openProp,
4818
+ onOpenChange: setOpenProp,
4819
+ className,
4820
+ style,
4821
+ children,
4822
+ ...props
4823
+ }) {
4824
+ const [_open, _setOpen] = React49__namespace.useState(defaultOpen);
4825
+ const open = openProp ?? _open;
4826
+ const setOpen = React49__namespace.useCallback(
4827
+ (value) => {
4828
+ const openState = typeof value === "function" ? value(open) : value;
4829
+ if (setOpenProp) {
4830
+ setOpenProp(openState);
4831
+ } else {
4832
+ _setOpen(openState);
4833
+ }
4834
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
4835
+ },
4836
+ [setOpenProp, open]
4837
+ );
4838
+ const toggleSidebar = React49__namespace.useCallback(() => {
4839
+ return setOpen((open2) => !open2);
4840
+ }, [setOpen]);
4841
+ React49__namespace.useEffect(() => {
4842
+ const handleKeyDown = (event) => {
4843
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
4844
+ event.preventDefault();
4845
+ toggleSidebar();
4846
+ }
4847
+ };
4848
+ window.addEventListener("keydown", handleKeyDown);
4849
+ return () => window.removeEventListener("keydown", handleKeyDown);
4850
+ }, [toggleSidebar]);
4851
+ const state = open ? "expanded" : "collapsed";
4852
+ const contextValue = React49__namespace.useMemo(
4853
+ () => ({
4854
+ state,
4855
+ open,
4856
+ setOpen,
4857
+ toggleSidebar
4858
+ }),
4859
+ [state, open, setOpen, toggleSidebar]
4860
+ );
4861
+ return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsx(
4862
+ "div",
4863
+ {
4864
+ "data-slot": "sidebar-wrapper",
4865
+ style: {
4866
+ "--sidebar-width": SIDEBAR_WIDTH,
4867
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
4868
+ ...style
4752
4869
  },
4753
- [setOpenProp, open]
4754
- );
4755
- const [isMobile, setIsMobile] = React49__namespace.useState(false);
4756
- React49__namespace.useEffect(() => {
4757
- const checkMobile = () => {
4758
- setIsMobile(window.innerWidth < 768);
4759
- };
4760
- checkMobile();
4761
- window.addEventListener("resize", checkMobile);
4762
- return () => window.removeEventListener("resize", checkMobile);
4763
- }, []);
4764
- const toggleSidebar = React49__namespace.useCallback(() => {
4765
- return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
4766
- }, [isMobile, setOpen, setOpenMobile]);
4767
- React49__namespace.useEffect(() => {
4768
- const handleKeyDown = (event) => {
4769
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
4770
- event.preventDefault();
4771
- toggleSidebar();
4772
- }
4773
- };
4774
- window.addEventListener("keydown", handleKeyDown);
4775
- return () => window.removeEventListener("keydown", handleKeyDown);
4776
- }, [toggleSidebar]);
4777
- const state = open ? "expanded" : "collapsed";
4778
- const contextValue = React49__namespace.useMemo(
4779
- () => ({
4780
- state,
4781
- open,
4782
- setOpen,
4783
- isMobile,
4784
- openMobile,
4785
- setOpenMobile,
4786
- toggleSidebar
4787
- }),
4788
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
4789
- );
4790
- return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
4870
+ className: cn(
4871
+ "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-full w-full",
4872
+ className
4873
+ ),
4874
+ ...props,
4875
+ children
4876
+ }
4877
+ ) }) });
4878
+ }
4879
+ function Sidebar({
4880
+ side = "left",
4881
+ variant = "sidebar",
4882
+ collapsible = "offcanvas",
4883
+ className,
4884
+ children,
4885
+ ...props
4886
+ }) {
4887
+ const { state } = useSidebar();
4888
+ if (collapsible === "none") {
4889
+ return /* @__PURE__ */ jsxRuntime.jsx(
4791
4890
  "div",
4792
4891
  {
4793
- style: {
4794
- "--sidebar-width": SIDEBAR_WIDTH,
4795
- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
4796
- ...style
4797
- },
4892
+ "data-slot": "sidebar",
4798
4893
  className: cn(
4799
- "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-surface-1",
4894
+ "bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",
4800
4895
  className
4801
4896
  ),
4802
- ref,
4803
4897
  ...props,
4804
4898
  children
4805
4899
  }
4806
- ) });
4900
+ );
4807
4901
  }
4808
- );
4809
- SidebarProvider.displayName = "SidebarProvider";
4810
- var Sidebar = React49__namespace.forwardRef(
4811
- ({
4812
- side = "left",
4813
- variant = "sidebar",
4814
- collapsible = "offcanvas",
4815
- className,
4816
- children,
4817
- ...props
4818
- }, ref) => {
4819
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
4820
- if (collapsible === "none") {
4821
- return /* @__PURE__ */ jsxRuntime.jsx(
4902
+ const isCollapsed = state === "collapsed";
4903
+ const isIconMode = collapsible === "icon";
4904
+ const isCollapsedIcon = isCollapsed && isIconMode;
4905
+ return /* @__PURE__ */ jsxRuntime.jsx(
4906
+ "div",
4907
+ {
4908
+ className: "group peer text-sidebar-foreground hidden md:block relative",
4909
+ "data-state": state,
4910
+ "data-collapsible": isCollapsed ? collapsible : "",
4911
+ "data-variant": variant,
4912
+ "data-side": side,
4913
+ "data-slot": "sidebar",
4914
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4822
4915
  "div",
4823
4916
  {
4917
+ "data-slot": "sidebar-container",
4824
4918
  className: cn(
4825
- "flex h-full w-[--sidebar-width] flex-col bg-surface-1 text-foreground border-r border-line-soft",
4919
+ "relative z-10 h-full transition-[width] duration-200 ease-linear flex flex-col",
4920
+ // Width handling
4921
+ isCollapsed && collapsible === "offcanvas" && "w-0 overflow-hidden",
4922
+ isCollapsedIcon && "w-[var(--sidebar-width-icon)]",
4923
+ !isCollapsed && "w-[var(--sidebar-width)]",
4924
+ // Border/padding for variants
4925
+ variant === "floating" || variant === "inset" ? "p-2" : "border-r border-sidebar-border",
4826
4926
  className
4827
4927
  ),
4828
- ref,
4829
4928
  ...props,
4830
- children
4929
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4930
+ "div",
4931
+ {
4932
+ "data-sidebar": "sidebar",
4933
+ "data-slot": "sidebar-inner",
4934
+ "data-collapsible": isCollapsedIcon ? "icon" : void 0,
4935
+ className: cn(
4936
+ "bg-sidebar flex h-full w-full flex-col",
4937
+ variant === "floating" && "rounded-lg border border-sidebar-border shadow-sm",
4938
+ // When in icon mode, center content and add consistent padding
4939
+ isCollapsedIcon && "overflow-hidden items-center py-2"
4940
+ ),
4941
+ children
4942
+ }
4943
+ )
4831
4944
  }
4832
- );
4833
- }
4834
- if (isMobile) {
4835
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4836
- openMobile && /* @__PURE__ */ jsxRuntime.jsx(
4837
- "div",
4838
- {
4839
- className: "fixed inset-0 z-40 bg-overlay-heavy",
4840
- onClick: () => setOpenMobile(false)
4841
- }
4842
- ),
4843
- /* @__PURE__ */ jsxRuntime.jsx(
4844
- "div",
4845
- {
4846
- ref,
4847
- className: cn(
4848
- "fixed inset-y-0 z-50 hidden w-[--sidebar-width] flex-col bg-surface-1 text-foreground border-r border-line-soft transition-transform duration-200",
4849
- side === "left" ? "left-0" : "right-0",
4850
- openMobile && "flex translate-x-0",
4851
- !openMobile && (side === "left" ? "-translate-x-full" : "translate-x-full"),
4852
- className
4853
- ),
4854
- ...props,
4855
- children
4856
- }
4857
- )
4858
- ] });
4945
+ )
4859
4946
  }
4860
- return /* @__PURE__ */ jsxRuntime.jsx(
4861
- "div",
4862
- {
4863
- ref,
4864
- "data-state": state,
4865
- "data-collapsible": collapsible,
4866
- "data-variant": variant,
4867
- "data-side": side,
4868
- className: cn(
4869
- "group/sidebar relative flex h-full w-[--sidebar-width] flex-col bg-surface-1 text-foreground border-r border-line-soft transition-all duration-200",
4870
- state === "collapsed" && collapsible === "icon" && "w-[--sidebar-width-icon]",
4871
- variant === "floating" && "m-2 rounded-lg border border-line-soft shadow-md",
4872
- variant === "inset" && "m-2 mr-0 rounded-l-lg border border-line-soft shadow-sm",
4873
- className
4874
- ),
4875
- ...props,
4876
- children
4877
- }
4878
- );
4879
- }
4880
- );
4881
- Sidebar.displayName = "Sidebar";
4882
- var SidebarTrigger = React49__namespace.forwardRef(({ className, onClick, ...props }, ref) => {
4947
+ );
4948
+ }
4949
+ function SidebarTrigger({
4950
+ className,
4951
+ onClick,
4952
+ ...props
4953
+ }) {
4883
4954
  const { toggleSidebar } = useSidebar();
4884
4955
  return /* @__PURE__ */ jsxRuntime.jsxs(
4885
4956
  Button,
4886
4957
  {
4887
- ref,
4888
- variant: "ghost",
4889
- size: "icon",
4890
- className: cn("h-9 w-9", className),
4891
- onClick: (event) => {
4892
- onClick?.(event);
4893
- toggleSidebar();
4894
- },
4895
- ...props,
4896
- children: [
4897
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftIcon, { className: "h-4 w-4" }),
4898
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
4899
- ]
4958
+ "data-sidebar": "trigger",
4959
+ "data-slot": "sidebar-trigger",
4960
+ variant: "ghost",
4961
+ size: "icon",
4962
+ className: cn("size-7", className),
4963
+ onClick: (event) => {
4964
+ onClick?.(event);
4965
+ toggleSidebar();
4966
+ },
4967
+ ...props,
4968
+ children: [
4969
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftIcon, {}),
4970
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
4971
+ ]
4972
+ }
4973
+ );
4974
+ }
4975
+ function SidebarRail({ className, ...props }) {
4976
+ const { toggleSidebar } = useSidebar();
4977
+ return /* @__PURE__ */ jsxRuntime.jsx(
4978
+ "button",
4979
+ {
4980
+ "data-sidebar": "rail",
4981
+ "data-slot": "sidebar-rail",
4982
+ "aria-label": "Toggle Sidebar",
4983
+ tabIndex: -1,
4984
+ onClick: toggleSidebar,
4985
+ title: "Toggle Sidebar",
4986
+ className: cn(
4987
+ "hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
4988
+ "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
4989
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
4990
+ "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
4991
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
4992
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
4993
+ className
4994
+ ),
4995
+ ...props
4996
+ }
4997
+ );
4998
+ }
4999
+ function SidebarInset({ className, ...props }) {
5000
+ return /* @__PURE__ */ jsxRuntime.jsx(
5001
+ "main",
5002
+ {
5003
+ "data-slot": "sidebar-inset",
5004
+ className: cn(
5005
+ "bg-background relative flex w-full flex-1 flex-col",
5006
+ "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
5007
+ className
5008
+ ),
5009
+ ...props
5010
+ }
5011
+ );
5012
+ }
5013
+ function SidebarInput({
5014
+ className,
5015
+ ...props
5016
+ }) {
5017
+ return /* @__PURE__ */ jsxRuntime.jsx(
5018
+ Input,
5019
+ {
5020
+ "data-slot": "sidebar-input",
5021
+ "data-sidebar": "input",
5022
+ className: cn("bg-background h-8 w-full shadow-none", className),
5023
+ ...props
5024
+ }
5025
+ );
5026
+ }
5027
+ function SidebarHeader({ className, ...props }) {
5028
+ const { state } = useSidebar();
5029
+ const isCollapsed = state === "collapsed";
5030
+ return /* @__PURE__ */ jsxRuntime.jsx(
5031
+ "div",
5032
+ {
5033
+ "data-slot": "sidebar-header",
5034
+ "data-sidebar": "header",
5035
+ className: cn(
5036
+ "flex flex-col gap-2 p-2",
5037
+ isCollapsed && "items-center",
5038
+ className
5039
+ ),
5040
+ ...props
5041
+ }
5042
+ );
5043
+ }
5044
+ function SidebarFooter({ className, ...props }) {
5045
+ const { state } = useSidebar();
5046
+ const isCollapsed = state === "collapsed";
5047
+ return /* @__PURE__ */ jsxRuntime.jsx(
5048
+ "div",
5049
+ {
5050
+ "data-slot": "sidebar-footer",
5051
+ "data-sidebar": "footer",
5052
+ className: cn(
5053
+ "flex flex-col gap-2 p-2 mt-auto",
5054
+ isCollapsed && "items-center",
5055
+ className
5056
+ ),
5057
+ ...props
5058
+ }
5059
+ );
5060
+ }
5061
+ function SidebarSeparator({
5062
+ className,
5063
+ ...props
5064
+ }) {
5065
+ return /* @__PURE__ */ jsxRuntime.jsx(
5066
+ Separator5,
5067
+ {
5068
+ "data-slot": "sidebar-separator",
5069
+ "data-sidebar": "separator",
5070
+ className: cn("bg-sidebar-border mx-2 w-auto", className),
5071
+ ...props
5072
+ }
5073
+ );
5074
+ }
5075
+ function SidebarContent({ className, ...props }) {
5076
+ const { state } = useSidebar();
5077
+ const isCollapsed = state === "collapsed";
5078
+ return /* @__PURE__ */ jsxRuntime.jsx(
5079
+ "div",
5080
+ {
5081
+ "data-slot": "sidebar-content",
5082
+ "data-sidebar": "content",
5083
+ className: cn(
5084
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-auto",
5085
+ isCollapsed && "items-center",
5086
+ className
5087
+ ),
5088
+ ...props
5089
+ }
5090
+ );
5091
+ }
5092
+ function SidebarGroup({ className, ...props }) {
5093
+ const { state } = useSidebar();
5094
+ const isCollapsed = state === "collapsed";
5095
+ return /* @__PURE__ */ jsxRuntime.jsx(
5096
+ "div",
5097
+ {
5098
+ "data-slot": "sidebar-group",
5099
+ "data-sidebar": "group",
5100
+ className: cn(
5101
+ "relative flex w-full min-w-0 flex-col p-2",
5102
+ isCollapsed && "items-center",
5103
+ className
5104
+ ),
5105
+ ...props
5106
+ }
5107
+ );
5108
+ }
5109
+ function SidebarGroupLabel({
5110
+ className,
5111
+ asChild = false,
5112
+ ...props
5113
+ }) {
5114
+ const Comp = asChild ? reactSlot.Slot : "div";
5115
+ const { state } = useSidebar();
5116
+ const isCollapsed = state === "collapsed";
5117
+ return /* @__PURE__ */ jsxRuntime.jsx(
5118
+ Comp,
5119
+ {
5120
+ "data-slot": "sidebar-group-label",
5121
+ "data-sidebar": "group-label",
5122
+ className: cn(
5123
+ "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
5124
+ isCollapsed && "h-0 opacity-0 overflow-hidden -mt-2",
5125
+ className
5126
+ ),
5127
+ ...props
5128
+ }
5129
+ );
5130
+ }
5131
+ function SidebarGroupAction({
5132
+ className,
5133
+ asChild = false,
5134
+ ...props
5135
+ }) {
5136
+ const Comp = asChild ? reactSlot.Slot : "button";
5137
+ const { state } = useSidebar();
5138
+ const isCollapsed = state === "collapsed";
5139
+ if (isCollapsed) {
5140
+ return null;
5141
+ }
5142
+ return /* @__PURE__ */ jsxRuntime.jsx(
5143
+ Comp,
5144
+ {
5145
+ "data-slot": "sidebar-group-action",
5146
+ "data-sidebar": "group-action",
5147
+ className: cn(
5148
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
5149
+ // Increases the hit area of the button on mobile.
5150
+ "after:absolute after:-inset-2 md:after:hidden",
5151
+ className
5152
+ ),
5153
+ ...props
5154
+ }
5155
+ );
5156
+ }
5157
+ function SidebarGroupContent({
5158
+ className,
5159
+ ...props
5160
+ }) {
5161
+ return /* @__PURE__ */ jsxRuntime.jsx(
5162
+ "div",
5163
+ {
5164
+ "data-slot": "sidebar-group-content",
5165
+ "data-sidebar": "group-content",
5166
+ className: cn("w-full text-sm", className),
5167
+ ...props
4900
5168
  }
4901
5169
  );
4902
- });
4903
- SidebarTrigger.displayName = "SidebarTrigger";
4904
- var SidebarRail = React49__namespace.forwardRef(({ className, ...props }, ref) => {
4905
- const { toggleSidebar } = useSidebar();
5170
+ }
5171
+ function SidebarMenu({ className, ...props }) {
5172
+ const { state } = useSidebar();
5173
+ const isCollapsed = state === "collapsed";
4906
5174
  return /* @__PURE__ */ jsxRuntime.jsx(
4907
- "button",
5175
+ "ul",
4908
5176
  {
4909
- ref,
4910
- "aria-label": "Toggle Sidebar",
4911
- tabIndex: -1,
4912
- onClick: toggleSidebar,
4913
- title: "Toggle Sidebar",
5177
+ "data-slot": "sidebar-menu",
5178
+ "data-sidebar": "menu",
4914
5179
  className: cn(
4915
- "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-line-strong group-data-[side=left]:right-0 group-data-[side=right]:left-0 [[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize [[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-surface-2 [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 sm:flex",
5180
+ "flex w-full min-w-0 flex-col gap-2 p-2",
5181
+ isCollapsed && "items-center",
4916
5182
  className
4917
5183
  ),
4918
5184
  ...props
4919
5185
  }
4920
5186
  );
4921
- });
4922
- SidebarRail.displayName = "SidebarRail";
4923
- var SidebarInset = React49__namespace.forwardRef(
4924
- ({ className, ...props }, ref) => {
4925
- return /* @__PURE__ */ jsxRuntime.jsx(
4926
- "main",
4927
- {
4928
- ref,
4929
- className: cn(
4930
- "relative flex min-h-svh flex-1 flex-col bg-background peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-r-lg md:peer-data-[variant=inset]:border md:peer-data-[variant=inset]:border-line-soft md:peer-data-[variant=inset]:shadow-sm",
4931
- className
4932
- ),
4933
- ...props
4934
- }
4935
- );
4936
- }
5187
+ }
5188
+ function SidebarMenuItem({ className, ...props }) {
5189
+ return /* @__PURE__ */ jsxRuntime.jsx(
5190
+ "li",
5191
+ {
5192
+ "data-slot": "sidebar-menu-item",
5193
+ "data-sidebar": "menu-item",
5194
+ className: cn("group/menu-item relative", className),
5195
+ ...props
5196
+ }
5197
+ );
5198
+ }
5199
+ var sidebarMenuButtonStyle = cn(
5200
+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-all duration-150",
5201
+ "hover:bg-muted focus-visible:ring-2 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",
5202
+ "data-[active=true]:bg-muted data-[active=true]:text-primary [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0"
4937
5203
  );
4938
- SidebarInset.displayName = "SidebarInset";
4939
- var SidebarHeader = React49__namespace.forwardRef(
4940
- ({ className, ...props }, ref) => {
4941
- return /* @__PURE__ */ jsxRuntime.jsx(
4942
- "div",
4943
- {
4944
- ref,
4945
- className: cn("flex flex-col gap-2 p-4 border-b border-line-soft", className),
4946
- ...props
4947
- }
4948
- );
5204
+ var sidebarMenuButtonVariants = classVarianceAuthority.cva(sidebarMenuButtonStyle, {
5205
+ variants: {
5206
+ variant: {
5207
+ default: "hover:bg-muted hover:text-foreground",
5208
+ outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-muted hover:text-foreground hover:shadow-[0_0_0_1px_hsl(var(--border))]"
5209
+ },
5210
+ size: {
5211
+ default: "h-8 text-sm",
5212
+ sm: "h-7 text-xs",
5213
+ lg: "h-12 text-sm"
5214
+ }
5215
+ },
5216
+ defaultVariants: {
5217
+ variant: "default",
5218
+ size: "default"
4949
5219
  }
4950
- );
4951
- SidebarHeader.displayName = "SidebarHeader";
4952
- var SidebarFooter = React49__namespace.forwardRef(
4953
- ({ className, ...props }, ref) => {
4954
- return /* @__PURE__ */ jsxRuntime.jsx(
4955
- "div",
4956
- {
4957
- ref,
4958
- className: cn("flex flex-col gap-2 p-4 border-t border-line-soft", className),
4959
- ...props
4960
- }
4961
- );
5220
+ });
5221
+ function SidebarMenuButton({
5222
+ asChild = false,
5223
+ isActive = false,
5224
+ variant = "default",
5225
+ size = "default",
5226
+ tooltip,
5227
+ className,
5228
+ children,
5229
+ ...props
5230
+ }) {
5231
+ const Comp = asChild ? reactSlot.Slot : "button";
5232
+ const { state } = useSidebar();
5233
+ const isCollapsed = state === "collapsed";
5234
+ const button = /* @__PURE__ */ jsxRuntime.jsx(
5235
+ Comp,
5236
+ {
5237
+ "data-slot": "sidebar-menu-button",
5238
+ "data-sidebar": "menu-button",
5239
+ "data-size": size,
5240
+ "data-active": isActive,
5241
+ className: cn(
5242
+ sidebarMenuButtonVariants({ variant, size }),
5243
+ // When collapsed in icon mode, make button square and center icon
5244
+ isCollapsed && "w-8 h-8 p-2 justify-center [&>span]:hidden [&>:not(svg)]:hidden [&>svg:not(:first-child)]:hidden",
5245
+ className
5246
+ ),
5247
+ ...props,
5248
+ children
5249
+ }
5250
+ );
5251
+ if (!isCollapsed || !tooltip) {
5252
+ return button;
4962
5253
  }
4963
- );
4964
- SidebarFooter.displayName = "SidebarFooter";
4965
- var SidebarContent = React49__namespace.forwardRef(
4966
- ({ className, ...props }, ref) => {
4967
- return /* @__PURE__ */ jsxRuntime.jsx(
4968
- "div",
4969
- {
4970
- ref,
4971
- className: cn("flex flex-1 flex-col gap-4 overflow-auto p-4", className),
4972
- ...props
4973
- }
4974
- );
5254
+ return /* @__PURE__ */ jsxRuntime.jsx(SimpleTooltip, { content: tooltip, side: "right", delayDuration: 0, children: button });
5255
+ }
5256
+ function SidebarMenuAction({
5257
+ className,
5258
+ asChild = false,
5259
+ showOnHover = false,
5260
+ ...props
5261
+ }) {
5262
+ const Comp = asChild ? reactSlot.Slot : "button";
5263
+ const { state } = useSidebar();
5264
+ const isCollapsed = state === "collapsed";
5265
+ if (isCollapsed) {
5266
+ return null;
4975
5267
  }
4976
- );
4977
- SidebarContent.displayName = "SidebarContent";
4978
- var SidebarGroup = React49__namespace.forwardRef(
4979
- ({ className, ...props }, ref) => {
4980
- return /* @__PURE__ */ jsxRuntime.jsx(
4981
- "div",
4982
- {
4983
- ref,
4984
- className: cn("flex flex-col gap-2", className),
4985
- ...props
4986
- }
4987
- );
5268
+ return /* @__PURE__ */ jsxRuntime.jsx(
5269
+ Comp,
5270
+ {
5271
+ "data-slot": "sidebar-menu-action",
5272
+ "data-sidebar": "menu-action",
5273
+ className: cn(
5274
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
5275
+ // Increases the hit area of the button on mobile.
5276
+ "after:absolute after:-inset-2 md:after:hidden",
5277
+ "peer-data-[size=sm]/menu-button:top-1",
5278
+ "peer-data-[size=default]/menu-button:top-1.5",
5279
+ "peer-data-[size=lg]/menu-button:top-2.5",
5280
+ showOnHover && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
5281
+ className
5282
+ ),
5283
+ ...props
5284
+ }
5285
+ );
5286
+ }
5287
+ function SidebarMenuBadge({
5288
+ className,
5289
+ ...props
5290
+ }) {
5291
+ const { state } = useSidebar();
5292
+ const isCollapsed = state === "collapsed";
5293
+ if (isCollapsed) {
5294
+ return null;
4988
5295
  }
4989
- );
4990
- SidebarGroup.displayName = "SidebarGroup";
4991
- var SidebarGroupLabel = React49__namespace.forwardRef(({ className, ...props }, ref) => {
4992
5296
  return /* @__PURE__ */ jsxRuntime.jsx(
4993
5297
  "div",
4994
5298
  {
4995
- ref,
5299
+ "data-slot": "sidebar-menu-badge",
5300
+ "data-sidebar": "menu-badge",
4996
5301
  className: cn(
4997
- "px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",
5302
+ "text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none",
5303
+ "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
5304
+ "peer-data-[size=sm]/menu-button:top-1",
5305
+ "peer-data-[size=default]/menu-button:top-1.5",
5306
+ "peer-data-[size=lg]/menu-button:top-2.5",
4998
5307
  className
4999
5308
  ),
5000
5309
  ...props
5001
5310
  }
5002
5311
  );
5003
- });
5004
- SidebarGroupLabel.displayName = "SidebarGroupLabel";
5005
- var SidebarGroupContent = React49__namespace.forwardRef(({ className, ...props }, ref) => {
5006
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col gap-1", className), ...props });
5007
- });
5008
- SidebarGroupContent.displayName = "SidebarGroupContent";
5009
- var SidebarMenu = React49__namespace.forwardRef(
5010
- ({ className, ...props }, ref) => {
5011
- return /* @__PURE__ */ jsxRuntime.jsx(
5012
- "ul",
5013
- {
5014
- ref,
5015
- className: cn("flex flex-col gap-1", className),
5016
- ...props
5017
- }
5018
- );
5019
- }
5020
- );
5021
- SidebarMenu.displayName = "SidebarMenu";
5022
- var SidebarMenuItem = React49__namespace.forwardRef(
5023
- ({ className, ...props }, ref) => {
5024
- return /* @__PURE__ */ jsxRuntime.jsx("li", { ref, className: cn("list-none", className), ...props });
5025
- }
5026
- );
5027
- SidebarMenuItem.displayName = "SidebarMenuItem";
5028
- var sidebarMenuButtonVariants = classVarianceAuthority.cva(
5029
- "group/menu-button flex w-full items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors hover:bg-surface-2 active:bg-surface-3 disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",
5030
- {
5031
- variants: {
5032
- variant: {
5033
- default: "text-foreground hover:text-foreground",
5034
- outline: "border border-line-soft bg-background shadow-sm hover:bg-surface-2"
5035
- },
5036
- size: {
5037
- default: "h-10",
5038
- sm: "h-8 text-xs",
5039
- lg: "h-12"
5040
- },
5041
- isActive: {
5042
- true: "bg-surface-2 text-foreground font-semibold"
5043
- }
5044
- },
5045
- defaultVariants: {
5046
- variant: "default",
5047
- size: "default"
5312
+ }
5313
+ function SidebarMenuSkeleton({
5314
+ className,
5315
+ showIcon = false,
5316
+ ...props
5317
+ }) {
5318
+ const width = React49__namespace.useMemo(() => {
5319
+ return `${Math.floor(Math.random() * 40) + 50}%`;
5320
+ }, []);
5321
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5322
+ "div",
5323
+ {
5324
+ "data-slot": "sidebar-menu-skeleton",
5325
+ "data-sidebar": "menu-skeleton",
5326
+ className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
5327
+ ...props,
5328
+ children: [
5329
+ showIcon && /* @__PURE__ */ jsxRuntime.jsx(
5330
+ Skeleton,
5331
+ {
5332
+ className: "size-4 rounded-md",
5333
+ "data-sidebar": "menu-skeleton-icon"
5334
+ }
5335
+ ),
5336
+ /* @__PURE__ */ jsxRuntime.jsx(
5337
+ Skeleton,
5338
+ {
5339
+ className: "h-4 max-w-(--skeleton-width) flex-1",
5340
+ "data-sidebar": "menu-skeleton-text",
5341
+ style: {
5342
+ "--skeleton-width": width
5343
+ }
5344
+ }
5345
+ )
5346
+ ]
5048
5347
  }
5348
+ );
5349
+ }
5350
+ function SidebarMenuSub({ className, ...props }) {
5351
+ const { state } = useSidebar();
5352
+ const isCollapsed = state === "collapsed";
5353
+ if (isCollapsed) {
5354
+ return null;
5049
5355
  }
5050
- );
5051
- var SidebarMenuButton = React49__namespace.forwardRef(
5052
- ({
5053
- asChild = false,
5054
- isActive = false,
5055
- variant,
5056
- size,
5057
- className,
5058
- ...props
5059
- }, ref) => {
5060
- const Comp = asChild ? "span" : "button";
5061
- return /* @__PURE__ */ jsxRuntime.jsx(
5062
- Comp,
5063
- {
5064
- ref,
5065
- className: cn(sidebarMenuButtonVariants({ variant, size, isActive }), className),
5066
- ...props
5067
- }
5068
- );
5069
- }
5070
- );
5071
- SidebarMenuButton.displayName = "SidebarMenuButton";
5072
- var SidebarMenuAction = React49__namespace.forwardRef(({ className, ...props }, ref) => {
5073
5356
  return /* @__PURE__ */ jsxRuntime.jsx(
5074
- "button",
5357
+ "ul",
5075
5358
  {
5076
- ref,
5359
+ "data-slot": "sidebar-menu-sub",
5360
+ "data-sidebar": "menu-sub",
5077
5361
  className: cn(
5078
- "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-2 hover:text-foreground",
5362
+ "border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-2 border-l p-2",
5079
5363
  className
5080
5364
  ),
5081
5365
  ...props
5082
5366
  }
5083
5367
  );
5084
- });
5085
- SidebarMenuAction.displayName = "SidebarMenuAction";
5086
- var SidebarMenuSub = React49__namespace.forwardRef(
5087
- ({ className, ...props }, ref) => {
5088
- return /* @__PURE__ */ jsxRuntime.jsx(
5089
- "ul",
5090
- {
5091
- ref,
5092
- className: cn("ml-3 flex flex-col gap-1 border-l border-line-soft pl-3", className),
5093
- ...props
5094
- }
5095
- );
5096
- }
5097
- );
5098
- SidebarMenuSub.displayName = "SidebarMenuSub";
5099
- var SidebarMenuSubItem = React49__namespace.forwardRef(
5100
- ({ className, ...props }, ref) => {
5101
- return /* @__PURE__ */ jsxRuntime.jsx("li", { ref, className: cn("list-none", className), ...props });
5102
- }
5103
- );
5104
- SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
5105
- var SidebarMenuSubButton = React49__namespace.forwardRef(({ className, isActive, ...props }, ref) => {
5368
+ }
5369
+ function SidebarMenuSubItem({
5370
+ className,
5371
+ ...props
5372
+ }) {
5106
5373
  return /* @__PURE__ */ jsxRuntime.jsx(
5107
- "button",
5374
+ "li",
5108
5375
  {
5109
- ref,
5376
+ "data-slot": "sidebar-menu-sub-item",
5377
+ "data-sidebar": "menu-sub-item",
5378
+ className: cn("group/menu-sub-item relative", className),
5379
+ ...props
5380
+ }
5381
+ );
5382
+ }
5383
+ function SidebarMenuSubButton({
5384
+ asChild = false,
5385
+ size = "md",
5386
+ isActive = false,
5387
+ className,
5388
+ ...props
5389
+ }) {
5390
+ const Comp = asChild ? reactSlot.Slot : "a";
5391
+ return /* @__PURE__ */ jsxRuntime.jsx(
5392
+ Comp,
5393
+ {
5394
+ "data-slot": "sidebar-menu-sub-button",
5395
+ "data-sidebar": "menu-sub-button",
5396
+ "data-size": size,
5397
+ "data-active": isActive,
5110
5398
  className: cn(
5111
- "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-surface-2 active:bg-surface-3",
5112
- isActive && "bg-surface-2 font-medium",
5399
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-muted hover:text-foreground active:bg-muted [&>svg]:text-muted-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden ",
5400
+ "transition-all duration-150 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
5401
+ "data-[active=true]:bg-muted data-[active=true]:text-primary",
5402
+ size === "sm" && "text-xs",
5403
+ size === "md" && "text-sm",
5113
5404
  className
5114
5405
  ),
5115
5406
  ...props
5116
5407
  }
5117
5408
  );
5118
- });
5119
- SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
5409
+ }
5120
5410
 
5121
5411
  // src/components/ui/table/index.tsx
5122
5412
  init_utils();
@@ -5144,20 +5434,14 @@ var tableVariants = classVarianceAuthority.cva("w-full caption-bottom text-sm",
5144
5434
  size: "default"
5145
5435
  }
5146
5436
  });
5147
- var Table = React49__namespace.forwardRef(({ className, variant, size, wrapperClassName, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
5148
- "div",
5437
+ var Table = React49__namespace.forwardRef(({ className, variant, size, wrapperClassName, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative w-full overflow-auto", wrapperClassName), children: /* @__PURE__ */ jsxRuntime.jsx(
5438
+ "table",
5149
5439
  {
5150
- className: cn("relative w-full overflow-auto", wrapperClassName),
5151
- children: /* @__PURE__ */ jsxRuntime.jsx(
5152
- "table",
5153
- {
5154
- ref,
5155
- className: cn(tableVariants({ variant, size, className })),
5156
- ...props
5157
- }
5158
- )
5440
+ ref,
5441
+ className: cn(tableVariants({ variant, size, className })),
5442
+ ...props
5159
5443
  }
5160
- ));
5444
+ ) }));
5161
5445
  Table.displayName = "Table";
5162
5446
  var TableHeader = React49__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
5163
5447
  TableHeader.displayName = "TableHeader";
@@ -6216,6 +6500,8 @@ function useTableVirtualization({
6216
6500
  });
6217
6501
  return arr;
6218
6502
  }, [rows, expandable]);
6503
+ const virtualRowPointersRef = React49.useRef(virtualRowPointers);
6504
+ virtualRowPointersRef.current = virtualRowPointers;
6219
6505
  const cacheBackingRef = React49.useRef(
6220
6506
  /* @__PURE__ */ new Map()
6221
6507
  );
@@ -6249,6 +6535,12 @@ function useTableVirtualization({
6249
6535
  null
6250
6536
  );
6251
6537
  const measurementIdleRef = React49.useRef(null);
6538
+ const prefixSumCacheRef = React49.useRef({
6539
+ count: 0,
6540
+ itemSizes: [],
6541
+ offsets: [],
6542
+ totalSize: 0
6543
+ });
6252
6544
  const cleanupRaf = React49.useCallback(() => {
6253
6545
  if (debounceTimeoutRef.current != null) {
6254
6546
  clearTimeout(debounceTimeoutRef.current);
@@ -6273,10 +6565,16 @@ function useTableVirtualization({
6273
6565
  measurementIdleRef.current = null;
6274
6566
  }
6275
6567
  measurementQueueRef.current.clear();
6568
+ prefixSumCacheRef.current = {
6569
+ count: 0,
6570
+ itemSizes: [],
6571
+ offsets: [],
6572
+ totalSize: 0
6573
+ };
6276
6574
  }, []);
6277
6575
  const estimateSize = React49.useCallback(
6278
6576
  (index) => {
6279
- const item = virtualRowPointers[index];
6577
+ const item = virtualRowPointersRef.current[index];
6280
6578
  if (!item) return baseRowEstimateSize;
6281
6579
  const key = item.key;
6282
6580
  if (item.kind === "expanded" && !rows[item.rowIndex]?.getIsExpanded()) {
@@ -6289,21 +6587,23 @@ function useTableVirtualization({
6289
6587
  if (cached != null) return cached;
6290
6588
  return item.kind === "expanded" ? expandContentEstimateSize : baseRowEstimateSize;
6291
6589
  },
6292
- [virtualRowPointers, baseRowEstimateSize, expandContentEstimateSize]
6590
+ [baseRowEstimateSize, expandContentEstimateSize]
6293
6591
  );
6294
6592
  const recomputeVirtualWindow = React49.useCallback(() => {
6295
6593
  if (!shouldVirtualize) {
6296
6594
  setVirtualWindow(EMPTY_WINDOW);
6297
6595
  return;
6298
6596
  }
6597
+ const pointers = virtualRowPointersRef.current;
6299
6598
  const nextWindow = computeVirtualizedRows({
6300
- count: virtualRowPointers.length,
6599
+ count: pointers.length,
6301
6600
  getScrollElement: () => tableContainerRef.current,
6302
6601
  estimateSize,
6303
6602
  overScan,
6304
6603
  cache: cacheRef.current,
6305
6604
  heightCacheByKey: heightCacheByKeyRef.current,
6306
- getItemKey: (index) => virtualRowPointers[index]?.key ?? ""
6605
+ getItemKey: (index) => pointers[index]?.key ?? "",
6606
+ prefixSumCache: prefixSumCacheRef.current
6307
6607
  });
6308
6608
  setVirtualWindow(nextWindow);
6309
6609
  }, [estimateSize, overScan]);
@@ -6336,7 +6636,7 @@ function useTableVirtualization({
6336
6636
  const { startIndex, endIndex } = virtualWindowRef.current;
6337
6637
  if (index < startIndex || index > endIndex) return;
6338
6638
  }
6339
- const item = virtualRowPointers[index];
6639
+ const item = virtualRowPointersRef.current[index];
6340
6640
  if (!item) return;
6341
6641
  if (!Number.isFinite(height)) return;
6342
6642
  const size = normalizeVirtualSize(height);
@@ -6390,7 +6690,7 @@ function useTableVirtualization({
6390
6690
  const { startIndex, endIndex } = virtualWindowRef.current;
6391
6691
  if (index < startIndex || index > endIndex) return;
6392
6692
  }
6393
- const item = virtualRowPointers[index];
6693
+ const item = virtualRowPointersRef.current[index];
6394
6694
  const key = item?.key;
6395
6695
  if (key != null && heightCacheByKeyRef.current.has(key) || heightCacheByIndexRef.current.has(index)) {
6396
6696
  return;
@@ -6410,7 +6710,7 @@ function useTableVirtualization({
6410
6710
  return;
6411
6711
  }
6412
6712
  cacheRef.current.forEach((index, _, key) => {
6413
- if (index >= virtualRowPointers.length) {
6713
+ if (index >= virtualRowPointersRef.current.length) {
6414
6714
  cacheRef.current.remove(index);
6415
6715
  heightCacheByIndexRef.current.delete(index);
6416
6716
  if (key != null) heightCacheByKeyRef.current.delete(key);
@@ -6500,7 +6800,8 @@ var computeVirtualizedRows = (config) => {
6500
6800
  cache,
6501
6801
  getItemKey,
6502
6802
  getHorizontalScrollElement,
6503
- heightCacheByKey
6803
+ heightCacheByKey,
6804
+ prefixSumCache
6504
6805
  } = config;
6505
6806
  if (count <= 0) return EMPTY_WINDOW;
6506
6807
  const scrollElement = getScrollElement() ?? null;
@@ -6514,24 +6815,60 @@ var computeVirtualizedRows = (config) => {
6514
6815
  Math.max(rawHorizontalScrollOffset, 0),
6515
6816
  horizontalTotalSize - horizontalViewportSize
6516
6817
  ) : Math.max(rawHorizontalScrollOffset, 0);
6517
- const itemSizes = new Array(count);
6518
- const offsets = new Array(count);
6519
- let totalSize = 0;
6520
- for (let index = 0; index < count; index++) {
6521
- offsets[index] = totalSize;
6522
- const key = getItemKey(index);
6523
- let size = cache.get(index);
6524
- if (size == null && key != null) {
6525
- size = heightCacheByKey.get(key);
6526
- }
6527
- if (size == null) {
6528
- const estimate = estimateSize(index);
6529
- size = normalizeVirtualSize(estimate);
6530
- } else {
6531
- size = normalizeVirtualSize(size);
6818
+ let itemSizes;
6819
+ let offsets;
6820
+ let totalSize;
6821
+ const cachedCount = prefixSumCache?.count ?? 0;
6822
+ if (prefixSumCache && cachedCount > 0 && count >= cachedCount) {
6823
+ itemSizes = prefixSumCache.itemSizes.slice(0, cachedCount);
6824
+ offsets = prefixSumCache.offsets.slice(0, cachedCount);
6825
+ totalSize = prefixSumCache.totalSize;
6826
+ if (count > cachedCount) {
6827
+ itemSizes.length = count;
6828
+ offsets.length = count;
6829
+ for (let index = cachedCount; index < count; index++) {
6830
+ offsets[index] = totalSize;
6831
+ const key = getItemKey(index);
6832
+ let size = cache.get(index);
6833
+ if (size == null && key != null) {
6834
+ size = heightCacheByKey.get(key);
6835
+ }
6836
+ if (size == null) {
6837
+ const estimate = estimateSize(index);
6838
+ size = normalizeVirtualSize(estimate);
6839
+ } else {
6840
+ size = normalizeVirtualSize(size);
6841
+ }
6842
+ itemSizes[index] = size;
6843
+ totalSize += size;
6844
+ }
6845
+ }
6846
+ } else {
6847
+ itemSizes = new Array(count);
6848
+ offsets = new Array(count);
6849
+ totalSize = 0;
6850
+ for (let index = 0; index < count; index++) {
6851
+ offsets[index] = totalSize;
6852
+ const key = getItemKey(index);
6853
+ let size = cache.get(index);
6854
+ if (size == null && key != null) {
6855
+ size = heightCacheByKey.get(key);
6856
+ }
6857
+ if (size == null) {
6858
+ const estimate = estimateSize(index);
6859
+ size = normalizeVirtualSize(estimate);
6860
+ } else {
6861
+ size = normalizeVirtualSize(size);
6862
+ }
6863
+ itemSizes[index] = size;
6864
+ totalSize += size;
6532
6865
  }
6533
- itemSizes[index] = size;
6534
- totalSize += size;
6866
+ }
6867
+ if (prefixSumCache) {
6868
+ prefixSumCache.count = count;
6869
+ prefixSumCache.itemSizes = itemSizes;
6870
+ prefixSumCache.offsets = offsets;
6871
+ prefixSumCache.totalSize = totalSize;
6535
6872
  }
6536
6873
  const viewportActive = clientHeight > 0;
6537
6874
  const scrollOffset = viewportActive ? Math.min(scrollTop, Math.max(totalSize - clientHeight, 0)) : 0;
@@ -6539,19 +6876,28 @@ var computeVirtualizedRows = (config) => {
6539
6876
  let visibleStartIndex = 0;
6540
6877
  let visibleEndIndex = 0;
6541
6878
  if (viewportActive && totalSize > 0) {
6542
- for (let index = 0; index < count; index++) {
6543
- if (offsets[index] + itemSizes[index] > scrollOffset) {
6544
- visibleStartIndex = index;
6545
- break;
6879
+ let low = 0;
6880
+ let high = count - 1;
6881
+ while (low < high) {
6882
+ const mid = Math.floor((low + high) / 2);
6883
+ if (offsets[mid] + itemSizes[mid] > scrollOffset) {
6884
+ high = mid;
6885
+ } else {
6886
+ low = mid + 1;
6546
6887
  }
6547
6888
  }
6548
- for (let index = visibleStartIndex; index < count; index++) {
6549
- if (offsets[index] >= viewportLimit) {
6550
- visibleEndIndex = Math.max(visibleStartIndex, index - 1);
6551
- break;
6889
+ visibleStartIndex = low;
6890
+ low = visibleStartIndex;
6891
+ high = count - 1;
6892
+ while (low < high) {
6893
+ const mid = Math.ceil((low + high) / 2);
6894
+ if (offsets[mid] >= viewportLimit) {
6895
+ high = mid - 1;
6896
+ } else {
6897
+ low = mid;
6552
6898
  }
6553
- visibleEndIndex = index;
6554
6899
  }
6900
+ visibleEndIndex = Math.max(visibleStartIndex, low);
6555
6901
  }
6556
6902
  const overScanCount = Math.max(0, Math.ceil(overScan));
6557
6903
  const startIndex = Math.max(0, visibleStartIndex - overScanCount);
@@ -6613,7 +6959,7 @@ function SimpleTable({
6613
6959
  getRowExpandable,
6614
6960
  onExpandedChange,
6615
6961
  onLazyScrollLoad,
6616
- scrollLoadThreshold = 5,
6962
+ scrollLoadThreshold = 42,
6617
6963
  numberOfPageButtons = 5,
6618
6964
  onClickExport,
6619
6965
  baseRowEstimateSize = 42,
@@ -6627,7 +6973,7 @@ function SimpleTable({
6627
6973
  manualFiltering = false,
6628
6974
  lazyLoadIndicatorType = "overlay",
6629
6975
  maxHeight = 500,
6630
- maxWidth = 900,
6976
+ maxWidth,
6631
6977
  maxRecords,
6632
6978
  loadingText,
6633
6979
  pagingPosition = "right",
@@ -6698,6 +7044,10 @@ function SimpleTable({
6698
7044
  if (typeof maxRecords === "number" && data.length >= maxRecords) return;
6699
7045
  void handleLazyLoad();
6700
7046
  }, [recordPerChunk, data.length, handleLazyLoad, chunkCount, maxRecords]);
7047
+ const onLoadChunkRef = React49.useRef(onLoadChunk);
7048
+ React49.useEffect(() => {
7049
+ onLoadChunkRef.current = onLoadChunk;
7050
+ }, [onLoadChunk]);
6701
7051
  const rows = React49.useMemo(
6702
7052
  () => table.getRowModel().rows,
6703
7053
  [paginationState, sorting, columnFilters]
@@ -6739,7 +7089,7 @@ function SimpleTable({
6739
7089
  rafRef.current = null;
6740
7090
  const { scrollTop, scrollHeight, clientHeight } = container;
6741
7091
  if (scrollHeight - (scrollTop + clientHeight) <= scrollLoadThreshold && scrollTop !== 0 && scrollHeight > clientHeight) {
6742
- onLoadChunk();
7092
+ onLoadChunkRef.current();
6743
7093
  }
6744
7094
  });
6745
7095
  };
@@ -6752,7 +7102,7 @@ function SimpleTable({
6752
7102
  rafRef.current = null;
6753
7103
  }
6754
7104
  };
6755
- }, [scrollLoadThreshold, onLoadChunk]);
7105
+ }, [scrollLoadThreshold, virtualizationActive]);
6756
7106
  React49.useEffect(() => {
6757
7107
  if (virtualizationActive) return;
6758
7108
  if (table.getState().pagination.pageIndex === 0) {
@@ -6761,23 +7111,10 @@ function SimpleTable({
6761
7111
  }, [virtualizationActive]);
6762
7112
  React49.useEffect(() => {
6763
7113
  if (!virtualItems.length || !virtualizationActive) return;
6764
- const scheduleCheck = () => {
6765
- if (rafRef.current != null) return;
6766
- rafRef.current = requestAnimationFrame(() => {
6767
- rafRef.current = null;
6768
- if (paddingBottom <= scrollLoadThreshold) {
6769
- onLoadChunk();
6770
- }
6771
- });
6772
- };
6773
- scheduleCheck();
6774
- return () => {
6775
- if (rafRef.current != null) {
6776
- cancelAnimationFrame(rafRef.current);
6777
- rafRef.current = null;
6778
- }
6779
- };
6780
- }, [paddingBottom]);
7114
+ if (paddingBottom <= scrollLoadThreshold) {
7115
+ onLoadChunkRef.current();
7116
+ }
7117
+ }, [paddingBottom, scrollLoadThreshold, virtualizationActive]);
6781
7118
  const columnCount = table.getAllLeafColumns().length;
6782
7119
  React49.useEffect(() => {
6783
7120
  if (!selectable || !onSelectionChange) return;
@@ -10132,8 +10469,9 @@ function SimpleCarousel({
10132
10469
  }
10133
10470
  ),
10134
10471
  showDots && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center space-x-2 mt-4", children: Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
10135
- "button",
10472
+ Button,
10136
10473
  {
10474
+ variant: "ghost",
10137
10475
  className: cn(
10138
10476
  "h-2 w-2 rounded-full transition-colors",
10139
10477
  current === index + 1 ? "bg-primary" : "bg-primary/20 hover:bg-primary/40"
@@ -10524,19 +10862,24 @@ exports.Sidebar = Sidebar;
10524
10862
  exports.SidebarContent = SidebarContent;
10525
10863
  exports.SidebarFooter = SidebarFooter;
10526
10864
  exports.SidebarGroup = SidebarGroup;
10865
+ exports.SidebarGroupAction = SidebarGroupAction;
10527
10866
  exports.SidebarGroupContent = SidebarGroupContent;
10528
10867
  exports.SidebarGroupLabel = SidebarGroupLabel;
10529
10868
  exports.SidebarHeader = SidebarHeader;
10869
+ exports.SidebarInput = SidebarInput;
10530
10870
  exports.SidebarInset = SidebarInset;
10531
10871
  exports.SidebarMenu = SidebarMenu;
10532
10872
  exports.SidebarMenuAction = SidebarMenuAction;
10873
+ exports.SidebarMenuBadge = SidebarMenuBadge;
10533
10874
  exports.SidebarMenuButton = SidebarMenuButton;
10534
10875
  exports.SidebarMenuItem = SidebarMenuItem;
10876
+ exports.SidebarMenuSkeleton = SidebarMenuSkeleton;
10535
10877
  exports.SidebarMenuSub = SidebarMenuSub;
10536
10878
  exports.SidebarMenuSubButton = SidebarMenuSubButton;
10537
10879
  exports.SidebarMenuSubItem = SidebarMenuSubItem;
10538
10880
  exports.SidebarProvider = SidebarProvider;
10539
10881
  exports.SidebarRail = SidebarRail;
10882
+ exports.SidebarSeparator = SidebarSeparator;
10540
10883
  exports.SidebarTrigger = SidebarTrigger;
10541
10884
  exports.SimpleAvatar = SimpleAvatar;
10542
10885
  exports.SimpleCard = SimpleCard;