@mvn-ui/react 0.1.1 → 0.1.2

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
@@ -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(
@@ -1207,7 +1228,7 @@ var toggleGroupVariants = classVarianceAuthority.cva(
1207
1228
  }
1208
1229
  );
1209
1230
  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",
1231
+ "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
1232
  {
1212
1233
  variants: {
1213
1234
  size: {
@@ -1222,15 +1243,7 @@ var toggleGroupItemVariants = classVarianceAuthority.cva(
1222
1243
  }
1223
1244
  );
1224
1245
  var ToggleGroup = React49__namespace.forwardRef(
1225
- ({
1226
- className,
1227
- size,
1228
- items,
1229
- itemClassName,
1230
- renderItem,
1231
- children,
1232
- ...props
1233
- }, ref) => {
1246
+ ({ className, size, items, itemClassName, renderItem, children, ...props }, ref) => {
1234
1247
  const defaultRenderItem = React49__namespace.useCallback(
1235
1248
  (item) => /* @__PURE__ */ jsxRuntime.jsxs(
1236
1249
  ToggleGroupPrimitive__namespace.Item,
@@ -1323,21 +1336,18 @@ Slider.displayName = SliderPrimitive__namespace.Root.displayName;
1323
1336
 
1324
1337
  // src/components/ui/input-group/index.tsx
1325
1338
  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"
1339
+ var inputGroupVariants = classVarianceAuthority.cva("flex items-stretch w-full", {
1340
+ variants: {
1341
+ size: {
1342
+ sm: "h-8 text-sm",
1343
+ default: "h-10 text-[0.9375rem]",
1344
+ lg: "h-12 text-base"
1338
1345
  }
1346
+ },
1347
+ defaultVariants: {
1348
+ size: "default"
1339
1349
  }
1340
- );
1350
+ });
1341
1351
  var InputGroup = React49__namespace.forwardRef(
1342
1352
  ({
1343
1353
  className,
@@ -1379,9 +1389,8 @@ var InputGroup = React49__namespace.forwardRef(
1379
1389
  return React49__namespace.cloneElement(child, {
1380
1390
  className: cn(
1381
1391
  child.props.className,
1382
- leftAddon && "rounded-l-none border-l-0",
1383
- rightAddon && "rounded-r-none border-r-0",
1384
- (leftElement || rightElement) && "rounded-none"
1392
+ (leftAddon || leftElement) && "rounded-l-none border-l-0",
1393
+ (rightAddon || rightElement) && "rounded-r-none border-r-0"
1385
1394
  )
1386
1395
  });
1387
1396
  }
@@ -1509,7 +1518,7 @@ function deleteValueByPath(obj, path) {
1509
1518
 
1510
1519
  // src/components/ui/form/form-instance.ts
1511
1520
  var externalMounts = /* @__PURE__ */ new WeakMap();
1512
- function createFormInstance() {
1521
+ function createFormInstance(name) {
1513
1522
  const store = {
1514
1523
  values: {},
1515
1524
  errors: {}
@@ -1534,7 +1543,10 @@ function createFormInstance() {
1534
1543
  };
1535
1544
  subscribers.forEach((fn) => fn && fn(snapshot));
1536
1545
  fieldMeta.forEach((meta) => meta.onStoreChange && meta.onStoreChange());
1537
- if (ext) ext.forEach((handler) => handler.onStoreChange && handler.onStoreChange());
1546
+ if (ext)
1547
+ ext.forEach(
1548
+ (handler) => handler.onStoreChange && handler.onStoreChange()
1549
+ );
1538
1550
  }
1539
1551
  function scheduleNotify() {
1540
1552
  if (pendingNotify) return;
@@ -1565,8 +1577,8 @@ function createFormInstance() {
1565
1577
  if (options && options.clone === false) return store.values;
1566
1578
  return cloneDeep(store.values);
1567
1579
  },
1568
- getFieldValue(name) {
1569
- const path = toNamePath(name);
1580
+ getFieldValue(name2) {
1581
+ const path = toNamePath(name2);
1570
1582
  return getValueByPath(store.values, path);
1571
1583
  },
1572
1584
  setFieldsValue(vals, options) {
@@ -1632,24 +1644,27 @@ function createFormInstance() {
1632
1644
  instance.validateFields(names).catch((validationError) => {
1633
1645
  if (validationError && validationError.errorFields) {
1634
1646
  mounts.forEach((handler) => {
1635
- if (handler.onFieldsChange) handler.onFieldsChange(validationError.errorFields);
1647
+ if (handler.onFieldsChange)
1648
+ handler.onFieldsChange(validationError.errorFields);
1636
1649
  });
1637
1650
  try {
1638
1651
  const ext = externalMounts.get(instance);
1639
1652
  if (ext) {
1640
1653
  ext.forEach((handler) => {
1641
- if (handler.onFieldsChange) handler.onFieldsChange(validationError.errorFields);
1654
+ if (handler.onFieldsChange)
1655
+ handler.onFieldsChange(validationError.errorFields);
1642
1656
  });
1643
1657
  }
1644
1658
  } catch (error) {
1645
1659
  }
1646
- if (instance.onFieldsChange) instance.onFieldsChange(validationError.errorFields);
1660
+ if (instance.onFieldsChange)
1661
+ instance.onFieldsChange(validationError.errorFields);
1647
1662
  }
1648
1663
  });
1649
1664
  }
1650
1665
  },
1651
- setFieldValue(name, value) {
1652
- const path = toNamePath(name);
1666
+ setFieldValue(name2, value) {
1667
+ const path = toNamePath(name2);
1653
1668
  setValueByPath(store.values, path, value);
1654
1669
  const key = namePathToString(path);
1655
1670
  delete store.errors[key];
@@ -1774,16 +1789,21 @@ function createFormInstance() {
1774
1789
  return Promise.resolve({ ...store.values });
1775
1790
  });
1776
1791
  },
1777
- submit() {
1778
- instance.validateFields().then(() => {
1792
+ async submit() {
1793
+ try {
1794
+ await instance.validateFields();
1779
1795
  mounts.forEach((handler) => handler.onSubmit && handler.onSubmit());
1780
1796
  try {
1781
1797
  const ext = externalMounts.get(instance);
1782
- if (ext) ext.forEach((handler) => handler.onSubmit && handler.onSubmit());
1798
+ if (ext)
1799
+ ext.forEach(
1800
+ (external_handler) => external_handler.onSubmit && external_handler.onSubmit()
1801
+ );
1783
1802
  } catch (error) {
1784
1803
  }
1785
- }).catch(() => {
1786
- });
1804
+ } catch (validate_error) {
1805
+ return await Promise.reject(validate_error);
1806
+ }
1787
1807
  },
1788
1808
  resetFields(names) {
1789
1809
  let changed = false;
@@ -1797,8 +1817,8 @@ function createFormInstance() {
1797
1817
  scheduleNotify();
1798
1818
  return;
1799
1819
  }
1800
- names.forEach((name) => {
1801
- const path = toNamePath(name);
1820
+ names.forEach((name2) => {
1821
+ const path = toNamePath(name2);
1802
1822
  const key = namePathToString(path);
1803
1823
  if (getValueByPath(store.values, path) !== void 0) {
1804
1824
  changed = true;
@@ -1812,8 +1832,8 @@ function createFormInstance() {
1812
1832
  if (changed) version += 1;
1813
1833
  scheduleNotify();
1814
1834
  },
1815
- getFieldError(name) {
1816
- const path = toNamePath(name);
1835
+ getFieldError(name2) {
1836
+ const path = toNamePath(name2);
1817
1837
  const key = namePathToString(path);
1818
1838
  return store.errors[key] || [];
1819
1839
  },
@@ -1823,8 +1843,8 @@ function createFormInstance() {
1823
1843
  return { name: meta.namePath, errors: store.errors[key] || [] };
1824
1844
  });
1825
1845
  },
1826
- registerField(name, meta) {
1827
- const path = toNamePath(name);
1846
+ registerField(name2, meta) {
1847
+ const path = toNamePath(name2);
1828
1848
  const key = namePathToString(path);
1829
1849
  fieldMeta.set(key, {
1830
1850
  namePath: path,
@@ -1835,8 +1855,8 @@ function createFormInstance() {
1835
1855
  getValueFromEvent: meta.getValueFromEvent
1836
1856
  });
1837
1857
  },
1838
- unregisterField(name) {
1839
- const path = toNamePath(name);
1858
+ unregisterField(name2) {
1859
+ const path = toNamePath(name2);
1840
1860
  const key = namePathToString(path);
1841
1861
  fieldMeta.delete(key);
1842
1862
  if (!preserveOnUnmount) {
@@ -1860,15 +1880,15 @@ function createFormInstance() {
1860
1880
  return () => subscribers.delete(fn);
1861
1881
  },
1862
1882
  INTERNAL: {
1863
- name: void 0,
1883
+ name,
1864
1884
  itemRef: (nameArr) => (node) => {
1865
1885
  const key = namePathToString(nameArr);
1866
1886
  if (node) itemsRef[key] = node;
1867
1887
  else delete itemsRef[key];
1868
1888
  }
1869
1889
  },
1870
- getFieldInstance(name) {
1871
- const key = namePathToString(toNamePath(name));
1890
+ getFieldInstance(name2) {
1891
+ const key = namePathToString(toNamePath(name2));
1872
1892
  return itemsRef[key];
1873
1893
  }
1874
1894
  };
@@ -1877,16 +1897,19 @@ function createFormInstance() {
1877
1897
  instance.preserveOnUnmount = preserveOnUnmount;
1878
1898
  };
1879
1899
  instance.preserveOnUnmount = preserveOnUnmount;
1900
+ if (name && instance.INTERNAL) instance.INTERNAL.name = name;
1880
1901
  return instance;
1881
1902
  }
1882
1903
 
1883
1904
  // src/components/ui/form/form-context.tsx
1884
1905
  var FormContext = React49.createContext(null);
1885
- function useForm() {
1906
+ function useForm(name) {
1886
1907
  const ref = React49.useRef();
1887
1908
  if (!ref.current) {
1888
- const instance = createFormInstance();
1909
+ const instance = createFormInstance(name);
1889
1910
  ref.current = instance;
1911
+ } else if (name && ref.current.INTERNAL) {
1912
+ ref.current.INTERNAL.name = name;
1890
1913
  }
1891
1914
  return ref.current;
1892
1915
  }
@@ -2048,7 +2071,7 @@ var Form = React49.forwardRef(function Form2(props, ref) {
2048
2071
  };
2049
2072
  let unregisterMount;
2050
2073
  if (form.registerMount) {
2051
- const mountId = Math.random().toString(36).slice(2);
2074
+ const mountId = form.INTERNAL?.name ?? Math.random().toString(36).slice(2);
2052
2075
  if (preserve !== void 0) {
2053
2076
  if (form.setPreserve) form.setPreserve(!!preserve);
2054
2077
  else form.preserveOnUnmount = !!preserve;
@@ -2060,7 +2083,7 @@ var Form = React49.forwardRef(function Form2(props, ref) {
2060
2083
  map = /* @__PURE__ */ new Map();
2061
2084
  externalMounts.set(form, map);
2062
2085
  }
2063
- const mountId = Math.random().toString(36).slice(2);
2086
+ const mountId = form.INTERNAL?.name ?? Math.random().toString(36).slice(2);
2064
2087
  map.set(mountId, mountHandlers);
2065
2088
  if (preserve !== void 0) {
2066
2089
  if (form.setPreserve) form.setPreserve(!!preserve);
@@ -2135,7 +2158,7 @@ var FormItem = (props) => {
2135
2158
  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
2159
  if (!children || !React49__namespace.default.isValidElement(children)) return null;
2137
2160
  const childProps = {};
2138
- if (fieldValue !== void 0) childProps[valuePropName] = fieldValue;
2161
+ childProps[valuePropName] = fieldValue;
2139
2162
  const childClass = children.props.className;
2140
2163
  if (childClass || props.className) {
2141
2164
  childProps.className = [childClass, props.className].filter(Boolean).join(" ");
@@ -4341,13 +4364,20 @@ PaginationEllipsis.displayName = "PaginationEllipsis";
4341
4364
 
4342
4365
  // src/components/ui/tabs/index.tsx
4343
4366
  init_utils();
4344
- var Tabs = TabsPrimitive__namespace.Root;
4367
+ var TabsContext = React49__namespace.createContext({
4368
+ destroyInactiveTabs: true
4369
+ });
4370
+ 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 }) }));
4371
+ Tabs.displayName = TabsPrimitive__namespace.Root.displayName;
4345
4372
  var TabsList = React49__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4346
4373
  TabsPrimitive__namespace.List,
4347
4374
  {
4348
4375
  ref,
4349
4376
  className: cn(
4350
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
4377
+ "flex items-stretch gap-0 text-muted-foreground",
4378
+ "data-[orientation=horizontal]:w-full data-[orientation=horizontal]:border-b data-[orientation=vertical]:border-border",
4379
+ "data-[orientation=vertical]:w-56 data-[orientation=vertical]:border-r data-[orientation=vertical]:border-border",
4380
+ "data-[orientation=vertical]:flex-col data-[orientation=vertical]:shrink-0",
4351
4381
  className
4352
4382
  ),
4353
4383
  ...props
@@ -4359,27 +4389,34 @@ var TabsTrigger = React49__namespace.forwardRef(({ className, ...props }, ref) =
4359
4389
  {
4360
4390
  ref,
4361
4391
  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(
4392
+ "inline-flex min-w-0 items-center justify-center whitespace-nowrap text-sm font-medium",
4393
+ "transition-all duration-150 text-muted-foreground hover:text-primary",
4376
4394
  "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",
4395
+ "data-[orientation=horizontal]:flex-1 data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3 data-[orientation=horizontal]:border-b-2 data-[orientation=horizontal]:border-border",
4396
+ "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",
4397
+ "data-[state=active]:text-primary data-[state=active]:font-semibold data-[state=active]:bg-muted/60 data-[state=active]:border-primary",
4398
+ "disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed",
4378
4399
  className
4379
4400
  ),
4380
4401
  ...props
4381
4402
  }
4382
4403
  ));
4404
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
4405
+ var TabsContent = React49__namespace.forwardRef(({ className, ...props }, ref) => {
4406
+ const { destroyInactiveTabs } = React49__namespace.useContext(TabsContext);
4407
+ return /* @__PURE__ */ jsxRuntime.jsx(
4408
+ TabsPrimitive__namespace.Content,
4409
+ {
4410
+ ref,
4411
+ forceMount: destroyInactiveTabs ? void 0 : true,
4412
+ className: cn(
4413
+ "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",
4414
+ className
4415
+ ),
4416
+ ...props
4417
+ }
4418
+ );
4419
+ });
4383
4420
  TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
4384
4421
  function SimpleTabs({
4385
4422
  items,
@@ -4390,10 +4427,12 @@ function SimpleTabs({
4390
4427
  tabsListClassName,
4391
4428
  tabsTriggerClassName,
4392
4429
  tabsContentClassName,
4393
- orientation = "horizontal"
4430
+ orientation = "horizontal",
4431
+ destroyInactiveTabs = true
4394
4432
  }) {
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" : "";
4433
+ const defaultTabsListClassName = orientation === "vertical" ? "bg-background/60 p-2" : "w-full";
4434
+ const defaultTabsContentClassName = orientation === "vertical" ? "ml-0 flex-1 min-w-0" : "w-full";
4435
+ const rootLayoutClassName = orientation === "vertical" ? "flex flex-row w-full max-w-full items-start gap-6" : "flex w-full flex-col gap-6";
4397
4436
  return /* @__PURE__ */ jsxRuntime.jsxs(
4398
4437
  Tabs,
4399
4438
  {
@@ -4401,20 +4440,15 @@ function SimpleTabs({
4401
4440
  value,
4402
4441
  onValueChange,
4403
4442
  orientation,
4404
- className: cn(
4405
- orientation === "vertical" ? "flex flex-row" : "",
4406
- className
4407
- ),
4443
+ destroyInactiveTabs,
4444
+ className: cn(rootLayoutClassName, className),
4408
4445
  children: [
4409
4446
  /* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: cn(defaultTabsListClassName, tabsListClassName), children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
4410
4447
  TabsTrigger,
4411
4448
  {
4412
4449
  value: item.value,
4413
4450
  disabled: item.disabled,
4414
- className: cn(
4415
- orientation === "vertical" && "mb-1 w-full justify-start",
4416
- tabsTriggerClassName
4417
- ),
4451
+ className: cn(tabsTriggerClassName),
4418
4452
  children: item.label
4419
4453
  },
4420
4454
  item.value
@@ -4717,6 +4751,8 @@ ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displ
4717
4751
 
4718
4752
  // src/components/ui/sidebar/index.tsx
4719
4753
  init_utils();
4754
+ var SIDEBAR_COOKIE_NAME = "sidebar_state";
4755
+ var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
4720
4756
  var SIDEBAR_WIDTH = "16rem";
4721
4757
  var SIDEBAR_WIDTH_ICON = "3rem";
4722
4758
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
@@ -4728,395 +4764,601 @@ function useSidebar() {
4728
4764
  }
4729
4765
  return context;
4730
4766
  }
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
- }
4767
+ function SidebarProvider({
4768
+ defaultOpen = true,
4769
+ open: openProp,
4770
+ onOpenChange: setOpenProp,
4771
+ className,
4772
+ style,
4773
+ children,
4774
+ ...props
4775
+ }) {
4776
+ const [_open, _setOpen] = React49__namespace.useState(defaultOpen);
4777
+ const open = openProp ?? _open;
4778
+ const setOpen = React49__namespace.useCallback(
4779
+ (value) => {
4780
+ const openState = typeof value === "function" ? value(open) : value;
4781
+ if (setOpenProp) {
4782
+ setOpenProp(openState);
4783
+ } else {
4784
+ _setOpen(openState);
4785
+ }
4786
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
4787
+ },
4788
+ [setOpenProp, open]
4789
+ );
4790
+ const toggleSidebar = React49__namespace.useCallback(() => {
4791
+ return setOpen((open2) => !open2);
4792
+ }, [setOpen]);
4793
+ React49__namespace.useEffect(() => {
4794
+ const handleKeyDown = (event) => {
4795
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
4796
+ event.preventDefault();
4797
+ toggleSidebar();
4798
+ }
4799
+ };
4800
+ window.addEventListener("keydown", handleKeyDown);
4801
+ return () => window.removeEventListener("keydown", handleKeyDown);
4802
+ }, [toggleSidebar]);
4803
+ const state = open ? "expanded" : "collapsed";
4804
+ const contextValue = React49__namespace.useMemo(
4805
+ () => ({
4806
+ state,
4807
+ open,
4808
+ setOpen,
4809
+ toggleSidebar
4810
+ }),
4811
+ [state, open, setOpen, toggleSidebar]
4812
+ );
4813
+ return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsx(
4814
+ "div",
4815
+ {
4816
+ "data-slot": "sidebar-wrapper",
4817
+ style: {
4818
+ "--sidebar-width": SIDEBAR_WIDTH,
4819
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
4820
+ ...style
4752
4821
  },
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(
4822
+ className: cn(
4823
+ "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-full w-full",
4824
+ className
4825
+ ),
4826
+ ...props,
4827
+ children
4828
+ }
4829
+ ) }) });
4830
+ }
4831
+ function Sidebar({
4832
+ side = "left",
4833
+ variant = "sidebar",
4834
+ collapsible = "offcanvas",
4835
+ className,
4836
+ children,
4837
+ ...props
4838
+ }) {
4839
+ const { state } = useSidebar();
4840
+ if (collapsible === "none") {
4841
+ return /* @__PURE__ */ jsxRuntime.jsx(
4791
4842
  "div",
4792
4843
  {
4793
- style: {
4794
- "--sidebar-width": SIDEBAR_WIDTH,
4795
- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
4796
- ...style
4797
- },
4844
+ "data-slot": "sidebar",
4798
4845
  className: cn(
4799
- "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-surface-1",
4846
+ "bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",
4800
4847
  className
4801
4848
  ),
4802
- ref,
4803
4849
  ...props,
4804
4850
  children
4805
4851
  }
4806
- ) });
4852
+ );
4807
4853
  }
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(
4854
+ const isCollapsed = state === "collapsed";
4855
+ const isIconMode = collapsible === "icon";
4856
+ const isCollapsedIcon = isCollapsed && isIconMode;
4857
+ return /* @__PURE__ */ jsxRuntime.jsx(
4858
+ "div",
4859
+ {
4860
+ className: "group peer text-sidebar-foreground hidden md:block relative",
4861
+ "data-state": state,
4862
+ "data-collapsible": isCollapsed ? collapsible : "",
4863
+ "data-variant": variant,
4864
+ "data-side": side,
4865
+ "data-slot": "sidebar",
4866
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4822
4867
  "div",
4823
4868
  {
4869
+ "data-slot": "sidebar-container",
4824
4870
  className: cn(
4825
- "flex h-full w-[--sidebar-width] flex-col bg-surface-1 text-foreground border-r border-line-soft",
4871
+ "relative z-10 h-full transition-[width] duration-200 ease-linear flex flex-col",
4872
+ // Width handling
4873
+ isCollapsed && collapsible === "offcanvas" && "w-0 overflow-hidden",
4874
+ isCollapsedIcon && "w-[var(--sidebar-width-icon)]",
4875
+ !isCollapsed && "w-[var(--sidebar-width)]",
4876
+ // Border/padding for variants
4877
+ variant === "floating" || variant === "inset" ? "p-2" : "border-r border-sidebar-border",
4826
4878
  className
4827
4879
  ),
4828
- ref,
4829
4880
  ...props,
4830
- children
4881
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4882
+ "div",
4883
+ {
4884
+ "data-sidebar": "sidebar",
4885
+ "data-slot": "sidebar-inner",
4886
+ "data-collapsible": isCollapsedIcon ? "icon" : void 0,
4887
+ className: cn(
4888
+ "bg-sidebar flex h-full w-full flex-col",
4889
+ variant === "floating" && "rounded-lg border border-sidebar-border shadow-sm",
4890
+ // When in icon mode, center content and add consistent padding
4891
+ isCollapsedIcon && "overflow-hidden items-center py-2"
4892
+ ),
4893
+ children
4894
+ }
4895
+ )
4831
4896
  }
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
- ] });
4897
+ )
4859
4898
  }
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) => {
4899
+ );
4900
+ }
4901
+ function SidebarTrigger({
4902
+ className,
4903
+ onClick,
4904
+ ...props
4905
+ }) {
4883
4906
  const { toggleSidebar } = useSidebar();
4884
4907
  return /* @__PURE__ */ jsxRuntime.jsxs(
4885
4908
  Button,
4886
4909
  {
4887
- ref,
4910
+ "data-sidebar": "trigger",
4911
+ "data-slot": "sidebar-trigger",
4888
4912
  variant: "ghost",
4889
4913
  size: "icon",
4890
- className: cn("h-9 w-9", className),
4914
+ className: cn("size-7", className),
4891
4915
  onClick: (event) => {
4892
4916
  onClick?.(event);
4893
4917
  toggleSidebar();
4894
4918
  },
4895
4919
  ...props,
4896
4920
  children: [
4897
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftIcon, { className: "h-4 w-4" }),
4921
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftIcon, {}),
4898
4922
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
4899
4923
  ]
4900
4924
  }
4901
4925
  );
4902
- });
4903
- SidebarTrigger.displayName = "SidebarTrigger";
4904
- var SidebarRail = React49__namespace.forwardRef(({ className, ...props }, ref) => {
4926
+ }
4927
+ function SidebarRail({ className, ...props }) {
4905
4928
  const { toggleSidebar } = useSidebar();
4906
4929
  return /* @__PURE__ */ jsxRuntime.jsx(
4907
4930
  "button",
4908
4931
  {
4909
- ref,
4932
+ "data-sidebar": "rail",
4933
+ "data-slot": "sidebar-rail",
4910
4934
  "aria-label": "Toggle Sidebar",
4911
4935
  tabIndex: -1,
4912
4936
  onClick: toggleSidebar,
4913
4937
  title: "Toggle Sidebar",
4914
4938
  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",
4939
+ "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",
4940
+ "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
4941
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
4942
+ "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
4943
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
4944
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
4916
4945
  className
4917
4946
  ),
4918
4947
  ...props
4919
4948
  }
4920
4949
  );
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
- }
4937
- );
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
- );
4949
- }
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
- );
4962
- }
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
- );
4975
- }
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
- );
4988
- }
4989
- );
4990
- SidebarGroup.displayName = "SidebarGroup";
4991
- var SidebarGroupLabel = React49__namespace.forwardRef(({ className, ...props }, ref) => {
4950
+ }
4951
+ function SidebarInset({ className, ...props }) {
4952
+ return /* @__PURE__ */ jsxRuntime.jsx(
4953
+ "main",
4954
+ {
4955
+ "data-slot": "sidebar-inset",
4956
+ className: cn(
4957
+ "bg-background relative flex w-full flex-1 flex-col",
4958
+ "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",
4959
+ className
4960
+ ),
4961
+ ...props
4962
+ }
4963
+ );
4964
+ }
4965
+ function SidebarInput({
4966
+ className,
4967
+ ...props
4968
+ }) {
4969
+ return /* @__PURE__ */ jsxRuntime.jsx(
4970
+ Input,
4971
+ {
4972
+ "data-slot": "sidebar-input",
4973
+ "data-sidebar": "input",
4974
+ className: cn("bg-background h-8 w-full shadow-none", className),
4975
+ ...props
4976
+ }
4977
+ );
4978
+ }
4979
+ function SidebarHeader({ className, ...props }) {
4980
+ const { state } = useSidebar();
4981
+ const isCollapsed = state === "collapsed";
4992
4982
  return /* @__PURE__ */ jsxRuntime.jsx(
4993
4983
  "div",
4994
4984
  {
4995
- ref,
4985
+ "data-slot": "sidebar-header",
4986
+ "data-sidebar": "header",
4996
4987
  className: cn(
4997
- "px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",
4988
+ "flex flex-col gap-2 p-2",
4989
+ isCollapsed && "items-center",
4998
4990
  className
4999
4991
  ),
5000
4992
  ...props
5001
4993
  }
5002
4994
  );
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 });
4995
+ }
4996
+ function SidebarFooter({ className, ...props }) {
4997
+ const { state } = useSidebar();
4998
+ const isCollapsed = state === "collapsed";
4999
+ return /* @__PURE__ */ jsxRuntime.jsx(
5000
+ "div",
5001
+ {
5002
+ "data-slot": "sidebar-footer",
5003
+ "data-sidebar": "footer",
5004
+ className: cn(
5005
+ "flex flex-col gap-2 p-2 mt-auto",
5006
+ isCollapsed && "items-center",
5007
+ className
5008
+ ),
5009
+ ...props
5010
+ }
5011
+ );
5012
+ }
5013
+ function SidebarSeparator({
5014
+ className,
5015
+ ...props
5016
+ }) {
5017
+ return /* @__PURE__ */ jsxRuntime.jsx(
5018
+ Separator5,
5019
+ {
5020
+ "data-slot": "sidebar-separator",
5021
+ "data-sidebar": "separator",
5022
+ className: cn("bg-sidebar-border mx-2 w-auto", className),
5023
+ ...props
5024
+ }
5025
+ );
5026
+ }
5027
+ function SidebarContent({ className, ...props }) {
5028
+ const { state } = useSidebar();
5029
+ const isCollapsed = state === "collapsed";
5030
+ return /* @__PURE__ */ jsxRuntime.jsx(
5031
+ "div",
5032
+ {
5033
+ "data-slot": "sidebar-content",
5034
+ "data-sidebar": "content",
5035
+ className: cn(
5036
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-auto",
5037
+ isCollapsed && "items-center",
5038
+ className
5039
+ ),
5040
+ ...props
5041
+ }
5042
+ );
5043
+ }
5044
+ function SidebarGroup({ className, ...props }) {
5045
+ const { state } = useSidebar();
5046
+ const isCollapsed = state === "collapsed";
5047
+ return /* @__PURE__ */ jsxRuntime.jsx(
5048
+ "div",
5049
+ {
5050
+ "data-slot": "sidebar-group",
5051
+ "data-sidebar": "group",
5052
+ className: cn(
5053
+ "relative flex w-full min-w-0 flex-col p-2",
5054
+ isCollapsed && "items-center",
5055
+ className
5056
+ ),
5057
+ ...props
5058
+ }
5059
+ );
5060
+ }
5061
+ function SidebarGroupLabel({
5062
+ className,
5063
+ asChild = false,
5064
+ ...props
5065
+ }) {
5066
+ const Comp = asChild ? reactSlot.Slot : "div";
5067
+ const { state } = useSidebar();
5068
+ const isCollapsed = state === "collapsed";
5069
+ return /* @__PURE__ */ jsxRuntime.jsx(
5070
+ Comp,
5071
+ {
5072
+ "data-slot": "sidebar-group-label",
5073
+ "data-sidebar": "group-label",
5074
+ className: cn(
5075
+ "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",
5076
+ isCollapsed && "h-0 opacity-0 overflow-hidden -mt-2",
5077
+ className
5078
+ ),
5079
+ ...props
5080
+ }
5081
+ );
5082
+ }
5083
+ function SidebarGroupAction({
5084
+ className,
5085
+ asChild = false,
5086
+ ...props
5087
+ }) {
5088
+ const Comp = asChild ? reactSlot.Slot : "button";
5089
+ const { state } = useSidebar();
5090
+ const isCollapsed = state === "collapsed";
5091
+ if (isCollapsed) {
5092
+ return null;
5025
5093
  }
5094
+ return /* @__PURE__ */ jsxRuntime.jsx(
5095
+ Comp,
5096
+ {
5097
+ "data-slot": "sidebar-group-action",
5098
+ "data-sidebar": "group-action",
5099
+ className: cn(
5100
+ "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",
5101
+ // Increases the hit area of the button on mobile.
5102
+ "after:absolute after:-inset-2 md:after:hidden",
5103
+ className
5104
+ ),
5105
+ ...props
5106
+ }
5107
+ );
5108
+ }
5109
+ function SidebarGroupContent({
5110
+ className,
5111
+ ...props
5112
+ }) {
5113
+ return /* @__PURE__ */ jsxRuntime.jsx(
5114
+ "div",
5115
+ {
5116
+ "data-slot": "sidebar-group-content",
5117
+ "data-sidebar": "group-content",
5118
+ className: cn("w-full text-sm", className),
5119
+ ...props
5120
+ }
5121
+ );
5122
+ }
5123
+ function SidebarMenu({ className, ...props }) {
5124
+ const { state } = useSidebar();
5125
+ const isCollapsed = state === "collapsed";
5126
+ return /* @__PURE__ */ jsxRuntime.jsx(
5127
+ "ul",
5128
+ {
5129
+ "data-slot": "sidebar-menu",
5130
+ "data-sidebar": "menu",
5131
+ className: cn(
5132
+ "flex w-full min-w-0 flex-col gap-2 p-2",
5133
+ isCollapsed && "items-center",
5134
+ className
5135
+ ),
5136
+ ...props
5137
+ }
5138
+ );
5139
+ }
5140
+ function SidebarMenuItem({ className, ...props }) {
5141
+ return /* @__PURE__ */ jsxRuntime.jsx(
5142
+ "li",
5143
+ {
5144
+ "data-slot": "sidebar-menu-item",
5145
+ "data-sidebar": "menu-item",
5146
+ className: cn("group/menu-item relative", className),
5147
+ ...props
5148
+ }
5149
+ );
5150
+ }
5151
+ var sidebarMenuButtonStyle = cn(
5152
+ "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",
5153
+ "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",
5154
+ "data-[active=true]:bg-muted data-[active=true]:text-primary [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0"
5026
5155
  );
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
- }
5156
+ var sidebarMenuButtonVariants = classVarianceAuthority.cva(sidebarMenuButtonStyle, {
5157
+ variants: {
5158
+ variant: {
5159
+ default: "hover:bg-muted hover:text-foreground",
5160
+ 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))]"
5044
5161
  },
5045
- defaultVariants: {
5046
- variant: "default",
5047
- size: "default"
5162
+ size: {
5163
+ default: "h-8 text-sm",
5164
+ sm: "h-7 text-xs",
5165
+ lg: "h-12 text-sm"
5048
5166
  }
5167
+ },
5168
+ defaultVariants: {
5169
+ variant: "default",
5170
+ size: "default"
5049
5171
  }
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
- );
5172
+ });
5173
+ function SidebarMenuButton({
5174
+ asChild = false,
5175
+ isActive = false,
5176
+ variant = "default",
5177
+ size = "default",
5178
+ tooltip,
5179
+ className,
5180
+ children,
5181
+ ...props
5182
+ }) {
5183
+ const Comp = asChild ? reactSlot.Slot : "button";
5184
+ const { state } = useSidebar();
5185
+ const isCollapsed = state === "collapsed";
5186
+ const button = /* @__PURE__ */ jsxRuntime.jsx(
5187
+ Comp,
5188
+ {
5189
+ "data-slot": "sidebar-menu-button",
5190
+ "data-sidebar": "menu-button",
5191
+ "data-size": size,
5192
+ "data-active": isActive,
5193
+ className: cn(
5194
+ sidebarMenuButtonVariants({ variant, size }),
5195
+ // When collapsed in icon mode, make button square and center icon
5196
+ isCollapsed && "w-8 h-8 p-2 justify-center [&>span]:hidden [&>:not(svg)]:hidden [&>svg:not(:first-child)]:hidden",
5197
+ className
5198
+ ),
5199
+ ...props,
5200
+ children
5201
+ }
5202
+ );
5203
+ if (!isCollapsed || !tooltip) {
5204
+ return button;
5205
+ }
5206
+ return /* @__PURE__ */ jsxRuntime.jsx(SimpleTooltip, { content: tooltip, side: "right", delayDuration: 0, children: button });
5207
+ }
5208
+ function SidebarMenuAction({
5209
+ className,
5210
+ asChild = false,
5211
+ showOnHover = false,
5212
+ ...props
5213
+ }) {
5214
+ const Comp = asChild ? reactSlot.Slot : "button";
5215
+ const { state } = useSidebar();
5216
+ const isCollapsed = state === "collapsed";
5217
+ if (isCollapsed) {
5218
+ return null;
5069
5219
  }
5070
- );
5071
- SidebarMenuButton.displayName = "SidebarMenuButton";
5072
- var SidebarMenuAction = React49__namespace.forwardRef(({ className, ...props }, ref) => {
5073
5220
  return /* @__PURE__ */ jsxRuntime.jsx(
5074
- "button",
5221
+ Comp,
5075
5222
  {
5076
- ref,
5223
+ "data-slot": "sidebar-menu-action",
5224
+ "data-sidebar": "menu-action",
5077
5225
  className: cn(
5078
- "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-2 hover:text-foreground",
5226
+ "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",
5227
+ // Increases the hit area of the button on mobile.
5228
+ "after:absolute after:-inset-2 md:after:hidden",
5229
+ "peer-data-[size=sm]/menu-button:top-1",
5230
+ "peer-data-[size=default]/menu-button:top-1.5",
5231
+ "peer-data-[size=lg]/menu-button:top-2.5",
5232
+ 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",
5079
5233
  className
5080
5234
  ),
5081
5235
  ...props
5082
5236
  }
5083
5237
  );
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
- );
5238
+ }
5239
+ function SidebarMenuBadge({
5240
+ className,
5241
+ ...props
5242
+ }) {
5243
+ const { state } = useSidebar();
5244
+ const isCollapsed = state === "collapsed";
5245
+ if (isCollapsed) {
5246
+ return null;
5096
5247
  }
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 });
5248
+ return /* @__PURE__ */ jsxRuntime.jsx(
5249
+ "div",
5250
+ {
5251
+ "data-slot": "sidebar-menu-badge",
5252
+ "data-sidebar": "menu-badge",
5253
+ className: cn(
5254
+ "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",
5255
+ "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
5256
+ "peer-data-[size=sm]/menu-button:top-1",
5257
+ "peer-data-[size=default]/menu-button:top-1.5",
5258
+ "peer-data-[size=lg]/menu-button:top-2.5",
5259
+ className
5260
+ ),
5261
+ ...props
5262
+ }
5263
+ );
5264
+ }
5265
+ function SidebarMenuSkeleton({
5266
+ className,
5267
+ showIcon = false,
5268
+ ...props
5269
+ }) {
5270
+ const width = React49__namespace.useMemo(() => {
5271
+ return `${Math.floor(Math.random() * 40) + 50}%`;
5272
+ }, []);
5273
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5274
+ "div",
5275
+ {
5276
+ "data-slot": "sidebar-menu-skeleton",
5277
+ "data-sidebar": "menu-skeleton",
5278
+ className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
5279
+ ...props,
5280
+ children: [
5281
+ showIcon && /* @__PURE__ */ jsxRuntime.jsx(
5282
+ Skeleton,
5283
+ {
5284
+ className: "size-4 rounded-md",
5285
+ "data-sidebar": "menu-skeleton-icon"
5286
+ }
5287
+ ),
5288
+ /* @__PURE__ */ jsxRuntime.jsx(
5289
+ Skeleton,
5290
+ {
5291
+ className: "h-4 max-w-(--skeleton-width) flex-1",
5292
+ "data-sidebar": "menu-skeleton-text",
5293
+ style: {
5294
+ "--skeleton-width": width
5295
+ }
5296
+ }
5297
+ )
5298
+ ]
5299
+ }
5300
+ );
5301
+ }
5302
+ function SidebarMenuSub({ className, ...props }) {
5303
+ const { state } = useSidebar();
5304
+ const isCollapsed = state === "collapsed";
5305
+ if (isCollapsed) {
5306
+ return null;
5102
5307
  }
5103
- );
5104
- SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
5105
- var SidebarMenuSubButton = React49__namespace.forwardRef(({ className, isActive, ...props }, ref) => {
5106
5308
  return /* @__PURE__ */ jsxRuntime.jsx(
5107
- "button",
5309
+ "ul",
5108
5310
  {
5109
- ref,
5311
+ "data-slot": "sidebar-menu-sub",
5312
+ "data-sidebar": "menu-sub",
5110
5313
  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",
5314
+ "border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-2 border-l p-2",
5113
5315
  className
5114
5316
  ),
5115
5317
  ...props
5116
5318
  }
5117
5319
  );
5118
- });
5119
- SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
5320
+ }
5321
+ function SidebarMenuSubItem({
5322
+ className,
5323
+ ...props
5324
+ }) {
5325
+ return /* @__PURE__ */ jsxRuntime.jsx(
5326
+ "li",
5327
+ {
5328
+ "data-slot": "sidebar-menu-sub-item",
5329
+ "data-sidebar": "menu-sub-item",
5330
+ className: cn("group/menu-sub-item relative", className),
5331
+ ...props
5332
+ }
5333
+ );
5334
+ }
5335
+ function SidebarMenuSubButton({
5336
+ asChild = false,
5337
+ size = "md",
5338
+ isActive = false,
5339
+ className,
5340
+ ...props
5341
+ }) {
5342
+ const Comp = asChild ? reactSlot.Slot : "a";
5343
+ return /* @__PURE__ */ jsxRuntime.jsx(
5344
+ Comp,
5345
+ {
5346
+ "data-slot": "sidebar-menu-sub-button",
5347
+ "data-sidebar": "menu-sub-button",
5348
+ "data-size": size,
5349
+ "data-active": isActive,
5350
+ className: cn(
5351
+ "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 ",
5352
+ "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",
5353
+ "data-[active=true]:bg-muted data-[active=true]:text-primary",
5354
+ size === "sm" && "text-xs",
5355
+ size === "md" && "text-sm",
5356
+ className
5357
+ ),
5358
+ ...props
5359
+ }
5360
+ );
5361
+ }
5120
5362
 
5121
5363
  // src/components/ui/table/index.tsx
5122
5364
  init_utils();
@@ -6627,7 +6869,7 @@ function SimpleTable({
6627
6869
  manualFiltering = false,
6628
6870
  lazyLoadIndicatorType = "overlay",
6629
6871
  maxHeight = 500,
6630
- maxWidth = 900,
6872
+ maxWidth,
6631
6873
  maxRecords,
6632
6874
  loadingText,
6633
6875
  pagingPosition = "right",
@@ -10524,19 +10766,24 @@ exports.Sidebar = Sidebar;
10524
10766
  exports.SidebarContent = SidebarContent;
10525
10767
  exports.SidebarFooter = SidebarFooter;
10526
10768
  exports.SidebarGroup = SidebarGroup;
10769
+ exports.SidebarGroupAction = SidebarGroupAction;
10527
10770
  exports.SidebarGroupContent = SidebarGroupContent;
10528
10771
  exports.SidebarGroupLabel = SidebarGroupLabel;
10529
10772
  exports.SidebarHeader = SidebarHeader;
10773
+ exports.SidebarInput = SidebarInput;
10530
10774
  exports.SidebarInset = SidebarInset;
10531
10775
  exports.SidebarMenu = SidebarMenu;
10532
10776
  exports.SidebarMenuAction = SidebarMenuAction;
10777
+ exports.SidebarMenuBadge = SidebarMenuBadge;
10533
10778
  exports.SidebarMenuButton = SidebarMenuButton;
10534
10779
  exports.SidebarMenuItem = SidebarMenuItem;
10780
+ exports.SidebarMenuSkeleton = SidebarMenuSkeleton;
10535
10781
  exports.SidebarMenuSub = SidebarMenuSub;
10536
10782
  exports.SidebarMenuSubButton = SidebarMenuSubButton;
10537
10783
  exports.SidebarMenuSubItem = SidebarMenuSubItem;
10538
10784
  exports.SidebarProvider = SidebarProvider;
10539
10785
  exports.SidebarRail = SidebarRail;
10786
+ exports.SidebarSeparator = SidebarSeparator;
10540
10787
  exports.SidebarTrigger = SidebarTrigger;
10541
10788
  exports.SimpleAvatar = SimpleAvatar;
10542
10789
  exports.SimpleCard = SimpleCard;