@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.css +270 -28
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +87 -85
- package/dist/index.d.ts +87 -85
- package/dist/index.js +861 -518
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +858 -520
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import React49__default, { createContext, forwardRef, useRef, useState, useEffec
|
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { Slot } from '@radix-ui/react-slot';
|
|
8
|
-
import { Loader2Icon, XIcon, EyeOffIcon, EyeIcon, ChevronDownIcon, ChevronUpIcon, CheckIcon, MinusIcon, CircleIcon, X, InboxIcon, ChevronRightIcon, ChevronsUpDownIcon,
|
|
8
|
+
import { Loader2Icon, XIcon, EyeOffIcon, EyeIcon, ChevronDownIcon, ChevronUpIcon, CheckIcon, MinusIcon, CircleIcon, X, InboxIcon, ChevronRightIcon, ChevronsUpDownIcon, CalendarIcon, ArrowLeft, ArrowRight, Calendar as Calendar$1, ChevronLeft, ChevronRight, ChevronDown, Star, RotateCcw, MoreHorizontalIcon, ChevronLeftIcon, ChevronsLeftIcon, ChevronsRightIcon, GripVerticalIcon, PanelLeftIcon, FileDown, SearchIcon, TextAlignJustify, Scaling, Pin, ListFilter, Minus, Plus } from 'lucide-react';
|
|
9
9
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
10
10
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
11
11
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
@@ -439,10 +439,10 @@ function ButtonGroup({
|
|
|
439
439
|
"data-orientation": orientation,
|
|
440
440
|
className: cn(
|
|
441
441
|
"inline-flex",
|
|
442
|
+
className,
|
|
442
443
|
isVertical ? "flex-col" : "flex-row",
|
|
443
444
|
// Join children and normalize border radius so the group looks contiguous
|
|
444
|
-
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"
|
|
445
|
-
className
|
|
445
|
+
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"
|
|
446
446
|
),
|
|
447
447
|
...props
|
|
448
448
|
}
|
|
@@ -553,8 +553,8 @@ var Input = React49.forwardRef(
|
|
|
553
553
|
children: label
|
|
554
554
|
}
|
|
555
555
|
),
|
|
556
|
-
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
557
|
-
leftIcon && /* @__PURE__ */ jsx("div", { className: "absolute left-3
|
|
556
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
|
|
557
|
+
leftIcon && /* @__PURE__ */ jsx("div", { className: "absolute left-3 text-muted-foreground pointer-events-none flex items-center justify-center [&_svg]:size-4", children: leftIcon }),
|
|
558
558
|
/* @__PURE__ */ jsx(
|
|
559
559
|
"input",
|
|
560
560
|
{
|
|
@@ -579,7 +579,7 @@ var Input = React49.forwardRef(
|
|
|
579
579
|
...props
|
|
580
580
|
}
|
|
581
581
|
),
|
|
582
|
-
(showClearButton || showPasswordToggle || rightIcon) && /* @__PURE__ */ jsxs("div", { className: "absolute right-3
|
|
582
|
+
(showClearButton || showPasswordToggle || rightIcon) && /* @__PURE__ */ jsxs("div", { className: "absolute right-3 flex items-center gap-1", children: [
|
|
583
583
|
showClearButton && /* @__PURE__ */ jsx(
|
|
584
584
|
"button",
|
|
585
585
|
{
|
|
@@ -600,7 +600,7 @@ var Input = React49.forwardRef(
|
|
|
600
600
|
children: showPassword ? /* @__PURE__ */ jsx(EyeOffIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(EyeIcon, { className: "h-4 w-4" })
|
|
601
601
|
}
|
|
602
602
|
),
|
|
603
|
-
rightIcon && !showPasswordToggle && !showClearButton && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground [&_svg]:size-4", children: rightIcon })
|
|
603
|
+
rightIcon && !showPasswordToggle && !showClearButton && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground flex items-center justify-center [&_svg]:size-4", children: rightIcon })
|
|
604
604
|
] })
|
|
605
605
|
] }),
|
|
606
606
|
error && /* @__PURE__ */ jsx(
|
|
@@ -795,7 +795,28 @@ Textarea.displayName = "Textarea";
|
|
|
795
795
|
|
|
796
796
|
// src/components/ui/select/index.tsx
|
|
797
797
|
init_utils();
|
|
798
|
-
var Select =
|
|
798
|
+
var Select = React49.forwardRef(
|
|
799
|
+
({ children, value, onValueChange, ...props }, _ref) => {
|
|
800
|
+
const [internalValue, setInternalValue] = React49.useState(value ?? "");
|
|
801
|
+
React49.useEffect(() => {
|
|
802
|
+
setInternalValue(value ?? "");
|
|
803
|
+
}, [value]);
|
|
804
|
+
const handleValueChange = (newValue) => {
|
|
805
|
+
setInternalValue(newValue);
|
|
806
|
+
onValueChange?.(newValue);
|
|
807
|
+
};
|
|
808
|
+
return /* @__PURE__ */ jsx(
|
|
809
|
+
SelectPrimitive.Root,
|
|
810
|
+
{
|
|
811
|
+
value: internalValue,
|
|
812
|
+
onValueChange: handleValueChange,
|
|
813
|
+
...props,
|
|
814
|
+
children
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
Select.displayName = "Select";
|
|
799
820
|
var SelectGroup = SelectPrimitive.Group;
|
|
800
821
|
var SelectValue = SelectPrimitive.Value;
|
|
801
822
|
var triggerVariants = cva(
|
|
@@ -1075,7 +1096,7 @@ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
|
1075
1096
|
|
|
1076
1097
|
// src/components/ui/switch/index.tsx
|
|
1077
1098
|
init_utils();
|
|
1078
|
-
var Switch = React49.forwardRef(({ className, ...props }, ref) => {
|
|
1099
|
+
var Switch = React49.forwardRef(({ className, offNode, onNode, ...props }, ref) => {
|
|
1079
1100
|
return /* @__PURE__ */ jsx(
|
|
1080
1101
|
SwitchPrimitives.Root,
|
|
1081
1102
|
{
|
|
@@ -1088,13 +1109,17 @@ var Switch = React49.forwardRef(({ className, ...props }, ref) => {
|
|
|
1088
1109
|
className
|
|
1089
1110
|
),
|
|
1090
1111
|
...props,
|
|
1091
|
-
children: /* @__PURE__ */
|
|
1112
|
+
children: /* @__PURE__ */ jsxs(
|
|
1092
1113
|
SwitchPrimitives.Thumb,
|
|
1093
1114
|
{
|
|
1094
1115
|
className: cn(
|
|
1095
|
-
"pointer-events-none
|
|
1116
|
+
"group pointer-events-none relative flex items-center justify-center h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
1096
1117
|
"data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
|
|
1097
|
-
)
|
|
1118
|
+
),
|
|
1119
|
+
children: [
|
|
1120
|
+
/* @__PURE__ */ jsx("span", { className: "absolute opacity-0 group-data-[state=checked]:opacity-100 transition-all duration-200", children: onNode }),
|
|
1121
|
+
/* @__PURE__ */ jsx("span", { className: "absolute opacity-100 group-data-[state=checked]:opacity-0 transition-all duration-200", children: offNode })
|
|
1122
|
+
]
|
|
1098
1123
|
}
|
|
1099
1124
|
)
|
|
1100
1125
|
}
|
|
@@ -1157,7 +1182,7 @@ var toggleGroupVariants = cva(
|
|
|
1157
1182
|
}
|
|
1158
1183
|
);
|
|
1159
1184
|
var toggleGroupItemVariants = cva(
|
|
1160
|
-
"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]:
|
|
1185
|
+
"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",
|
|
1161
1186
|
{
|
|
1162
1187
|
variants: {
|
|
1163
1188
|
size: {
|
|
@@ -1172,15 +1197,7 @@ var toggleGroupItemVariants = cva(
|
|
|
1172
1197
|
}
|
|
1173
1198
|
);
|
|
1174
1199
|
var ToggleGroup = React49.forwardRef(
|
|
1175
|
-
({
|
|
1176
|
-
className,
|
|
1177
|
-
size,
|
|
1178
|
-
items,
|
|
1179
|
-
itemClassName,
|
|
1180
|
-
renderItem,
|
|
1181
|
-
children,
|
|
1182
|
-
...props
|
|
1183
|
-
}, ref) => {
|
|
1200
|
+
({ className, size, items, itemClassName, renderItem, children, ...props }, ref) => {
|
|
1184
1201
|
const defaultRenderItem = React49.useCallback(
|
|
1185
1202
|
(item) => /* @__PURE__ */ jsxs(
|
|
1186
1203
|
ToggleGroupPrimitive.Item,
|
|
@@ -1273,21 +1290,18 @@ Slider.displayName = SliderPrimitive.Root.displayName;
|
|
|
1273
1290
|
|
|
1274
1291
|
// src/components/ui/input-group/index.tsx
|
|
1275
1292
|
init_utils();
|
|
1276
|
-
var inputGroupVariants = cva(
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
default: "h-10 text-[0.9375rem]",
|
|
1283
|
-
lg: "h-12 text-base"
|
|
1284
|
-
}
|
|
1285
|
-
},
|
|
1286
|
-
defaultVariants: {
|
|
1287
|
-
size: "default"
|
|
1293
|
+
var inputGroupVariants = cva("flex items-stretch w-full", {
|
|
1294
|
+
variants: {
|
|
1295
|
+
size: {
|
|
1296
|
+
sm: "h-8 text-sm",
|
|
1297
|
+
default: "h-10 text-[0.9375rem]",
|
|
1298
|
+
lg: "h-12 text-base"
|
|
1288
1299
|
}
|
|
1300
|
+
},
|
|
1301
|
+
defaultVariants: {
|
|
1302
|
+
size: "default"
|
|
1289
1303
|
}
|
|
1290
|
-
);
|
|
1304
|
+
});
|
|
1291
1305
|
var InputGroup = React49.forwardRef(
|
|
1292
1306
|
({
|
|
1293
1307
|
className,
|
|
@@ -1329,9 +1343,8 @@ var InputGroup = React49.forwardRef(
|
|
|
1329
1343
|
return React49.cloneElement(child, {
|
|
1330
1344
|
className: cn(
|
|
1331
1345
|
child.props.className,
|
|
1332
|
-
leftAddon && "rounded-l-none border-l-0",
|
|
1333
|
-
rightAddon && "rounded-r-none border-r-0"
|
|
1334
|
-
(leftElement || rightElement) && "rounded-none"
|
|
1346
|
+
(leftAddon || leftElement) && "rounded-l-none border-l-0",
|
|
1347
|
+
(rightAddon || rightElement) && "rounded-r-none border-r-0"
|
|
1335
1348
|
)
|
|
1336
1349
|
});
|
|
1337
1350
|
}
|
|
@@ -1459,7 +1472,7 @@ function deleteValueByPath(obj, path) {
|
|
|
1459
1472
|
|
|
1460
1473
|
// src/components/ui/form/form-instance.ts
|
|
1461
1474
|
var externalMounts = /* @__PURE__ */ new WeakMap();
|
|
1462
|
-
function createFormInstance() {
|
|
1475
|
+
function createFormInstance(name) {
|
|
1463
1476
|
const store = {
|
|
1464
1477
|
values: {},
|
|
1465
1478
|
errors: {}
|
|
@@ -1484,7 +1497,10 @@ function createFormInstance() {
|
|
|
1484
1497
|
};
|
|
1485
1498
|
subscribers.forEach((fn) => fn && fn(snapshot));
|
|
1486
1499
|
fieldMeta.forEach((meta) => meta.onStoreChange && meta.onStoreChange());
|
|
1487
|
-
if (ext)
|
|
1500
|
+
if (ext)
|
|
1501
|
+
ext.forEach(
|
|
1502
|
+
(handler) => handler.onStoreChange && handler.onStoreChange()
|
|
1503
|
+
);
|
|
1488
1504
|
}
|
|
1489
1505
|
function scheduleNotify() {
|
|
1490
1506
|
if (pendingNotify) return;
|
|
@@ -1515,8 +1531,8 @@ function createFormInstance() {
|
|
|
1515
1531
|
if (options && options.clone === false) return store.values;
|
|
1516
1532
|
return cloneDeep(store.values);
|
|
1517
1533
|
},
|
|
1518
|
-
getFieldValue(
|
|
1519
|
-
const path = toNamePath(
|
|
1534
|
+
getFieldValue(name2) {
|
|
1535
|
+
const path = toNamePath(name2);
|
|
1520
1536
|
return getValueByPath(store.values, path);
|
|
1521
1537
|
},
|
|
1522
1538
|
setFieldsValue(vals, options) {
|
|
@@ -1582,24 +1598,27 @@ function createFormInstance() {
|
|
|
1582
1598
|
instance.validateFields(names).catch((validationError) => {
|
|
1583
1599
|
if (validationError && validationError.errorFields) {
|
|
1584
1600
|
mounts.forEach((handler) => {
|
|
1585
|
-
if (handler.onFieldsChange)
|
|
1601
|
+
if (handler.onFieldsChange)
|
|
1602
|
+
handler.onFieldsChange(validationError.errorFields);
|
|
1586
1603
|
});
|
|
1587
1604
|
try {
|
|
1588
1605
|
const ext = externalMounts.get(instance);
|
|
1589
1606
|
if (ext) {
|
|
1590
1607
|
ext.forEach((handler) => {
|
|
1591
|
-
if (handler.onFieldsChange)
|
|
1608
|
+
if (handler.onFieldsChange)
|
|
1609
|
+
handler.onFieldsChange(validationError.errorFields);
|
|
1592
1610
|
});
|
|
1593
1611
|
}
|
|
1594
1612
|
} catch (error) {
|
|
1595
1613
|
}
|
|
1596
|
-
if (instance.onFieldsChange)
|
|
1614
|
+
if (instance.onFieldsChange)
|
|
1615
|
+
instance.onFieldsChange(validationError.errorFields);
|
|
1597
1616
|
}
|
|
1598
1617
|
});
|
|
1599
1618
|
}
|
|
1600
1619
|
},
|
|
1601
|
-
setFieldValue(
|
|
1602
|
-
const path = toNamePath(
|
|
1620
|
+
setFieldValue(name2, value) {
|
|
1621
|
+
const path = toNamePath(name2);
|
|
1603
1622
|
setValueByPath(store.values, path, value);
|
|
1604
1623
|
const key = namePathToString(path);
|
|
1605
1624
|
delete store.errors[key];
|
|
@@ -1724,16 +1743,21 @@ function createFormInstance() {
|
|
|
1724
1743
|
return Promise.resolve({ ...store.values });
|
|
1725
1744
|
});
|
|
1726
1745
|
},
|
|
1727
|
-
submit() {
|
|
1728
|
-
|
|
1746
|
+
async submit() {
|
|
1747
|
+
try {
|
|
1748
|
+
await instance.validateFields();
|
|
1729
1749
|
mounts.forEach((handler) => handler.onSubmit && handler.onSubmit());
|
|
1730
1750
|
try {
|
|
1731
1751
|
const ext = externalMounts.get(instance);
|
|
1732
|
-
if (ext)
|
|
1752
|
+
if (ext)
|
|
1753
|
+
ext.forEach(
|
|
1754
|
+
(external_handler) => external_handler.onSubmit && external_handler.onSubmit()
|
|
1755
|
+
);
|
|
1733
1756
|
} catch (error) {
|
|
1734
1757
|
}
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1758
|
+
} catch (validate_error) {
|
|
1759
|
+
return await Promise.reject(validate_error);
|
|
1760
|
+
}
|
|
1737
1761
|
},
|
|
1738
1762
|
resetFields(names) {
|
|
1739
1763
|
let changed = false;
|
|
@@ -1747,8 +1771,8 @@ function createFormInstance() {
|
|
|
1747
1771
|
scheduleNotify();
|
|
1748
1772
|
return;
|
|
1749
1773
|
}
|
|
1750
|
-
names.forEach((
|
|
1751
|
-
const path = toNamePath(
|
|
1774
|
+
names.forEach((name2) => {
|
|
1775
|
+
const path = toNamePath(name2);
|
|
1752
1776
|
const key = namePathToString(path);
|
|
1753
1777
|
if (getValueByPath(store.values, path) !== void 0) {
|
|
1754
1778
|
changed = true;
|
|
@@ -1762,8 +1786,8 @@ function createFormInstance() {
|
|
|
1762
1786
|
if (changed) version += 1;
|
|
1763
1787
|
scheduleNotify();
|
|
1764
1788
|
},
|
|
1765
|
-
getFieldError(
|
|
1766
|
-
const path = toNamePath(
|
|
1789
|
+
getFieldError(name2) {
|
|
1790
|
+
const path = toNamePath(name2);
|
|
1767
1791
|
const key = namePathToString(path);
|
|
1768
1792
|
return store.errors[key] || [];
|
|
1769
1793
|
},
|
|
@@ -1773,8 +1797,8 @@ function createFormInstance() {
|
|
|
1773
1797
|
return { name: meta.namePath, errors: store.errors[key] || [] };
|
|
1774
1798
|
});
|
|
1775
1799
|
},
|
|
1776
|
-
registerField(
|
|
1777
|
-
const path = toNamePath(
|
|
1800
|
+
registerField(name2, meta) {
|
|
1801
|
+
const path = toNamePath(name2);
|
|
1778
1802
|
const key = namePathToString(path);
|
|
1779
1803
|
fieldMeta.set(key, {
|
|
1780
1804
|
namePath: path,
|
|
@@ -1785,8 +1809,8 @@ function createFormInstance() {
|
|
|
1785
1809
|
getValueFromEvent: meta.getValueFromEvent
|
|
1786
1810
|
});
|
|
1787
1811
|
},
|
|
1788
|
-
unregisterField(
|
|
1789
|
-
const path = toNamePath(
|
|
1812
|
+
unregisterField(name2) {
|
|
1813
|
+
const path = toNamePath(name2);
|
|
1790
1814
|
const key = namePathToString(path);
|
|
1791
1815
|
fieldMeta.delete(key);
|
|
1792
1816
|
if (!preserveOnUnmount) {
|
|
@@ -1810,15 +1834,15 @@ function createFormInstance() {
|
|
|
1810
1834
|
return () => subscribers.delete(fn);
|
|
1811
1835
|
},
|
|
1812
1836
|
INTERNAL: {
|
|
1813
|
-
name
|
|
1837
|
+
name,
|
|
1814
1838
|
itemRef: (nameArr) => (node) => {
|
|
1815
1839
|
const key = namePathToString(nameArr);
|
|
1816
1840
|
if (node) itemsRef[key] = node;
|
|
1817
1841
|
else delete itemsRef[key];
|
|
1818
1842
|
}
|
|
1819
1843
|
},
|
|
1820
|
-
getFieldInstance(
|
|
1821
|
-
const key = namePathToString(toNamePath(
|
|
1844
|
+
getFieldInstance(name2) {
|
|
1845
|
+
const key = namePathToString(toNamePath(name2));
|
|
1822
1846
|
return itemsRef[key];
|
|
1823
1847
|
}
|
|
1824
1848
|
};
|
|
@@ -1827,16 +1851,19 @@ function createFormInstance() {
|
|
|
1827
1851
|
instance.preserveOnUnmount = preserveOnUnmount;
|
|
1828
1852
|
};
|
|
1829
1853
|
instance.preserveOnUnmount = preserveOnUnmount;
|
|
1854
|
+
if (name && instance.INTERNAL) instance.INTERNAL.name = name;
|
|
1830
1855
|
return instance;
|
|
1831
1856
|
}
|
|
1832
1857
|
|
|
1833
1858
|
// src/components/ui/form/form-context.tsx
|
|
1834
1859
|
var FormContext = createContext(null);
|
|
1835
|
-
function useForm() {
|
|
1860
|
+
function useForm(name) {
|
|
1836
1861
|
const ref = useRef();
|
|
1837
1862
|
if (!ref.current) {
|
|
1838
|
-
const instance = createFormInstance();
|
|
1863
|
+
const instance = createFormInstance(name);
|
|
1839
1864
|
ref.current = instance;
|
|
1865
|
+
} else if (name && ref.current.INTERNAL) {
|
|
1866
|
+
ref.current.INTERNAL.name = name;
|
|
1840
1867
|
}
|
|
1841
1868
|
return ref.current;
|
|
1842
1869
|
}
|
|
@@ -1998,7 +2025,7 @@ var Form = forwardRef(function Form2(props, ref) {
|
|
|
1998
2025
|
};
|
|
1999
2026
|
let unregisterMount;
|
|
2000
2027
|
if (form.registerMount) {
|
|
2001
|
-
const mountId = Math.random().toString(36).slice(2);
|
|
2028
|
+
const mountId = form.INTERNAL?.name ?? Math.random().toString(36).slice(2);
|
|
2002
2029
|
if (preserve !== void 0) {
|
|
2003
2030
|
if (form.setPreserve) form.setPreserve(!!preserve);
|
|
2004
2031
|
else form.preserveOnUnmount = !!preserve;
|
|
@@ -2010,7 +2037,7 @@ var Form = forwardRef(function Form2(props, ref) {
|
|
|
2010
2037
|
map = /* @__PURE__ */ new Map();
|
|
2011
2038
|
externalMounts.set(form, map);
|
|
2012
2039
|
}
|
|
2013
|
-
const mountId = Math.random().toString(36).slice(2);
|
|
2040
|
+
const mountId = form.INTERNAL?.name ?? Math.random().toString(36).slice(2);
|
|
2014
2041
|
map.set(mountId, mountHandlers);
|
|
2015
2042
|
if (preserve !== void 0) {
|
|
2016
2043
|
if (form.setPreserve) form.setPreserve(!!preserve);
|
|
@@ -2085,7 +2112,7 @@ var FormItem = (props) => {
|
|
|
2085
2112
|
const requiredIndicator = requiredMark === void 0 ? /* @__PURE__ */ jsx("span", { className: "text-destructive mr-1", "aria-hidden": "true", children: "*" }) : /* @__PURE__ */ jsx("span", { className: "mr-1", "aria-hidden": "true", children: requiredMark });
|
|
2086
2113
|
if (!children || !React49__default.isValidElement(children)) return null;
|
|
2087
2114
|
const childProps = {};
|
|
2088
|
-
|
|
2115
|
+
childProps[valuePropName] = fieldValue;
|
|
2089
2116
|
const childClass = children.props.className;
|
|
2090
2117
|
if (childClass || props.className) {
|
|
2091
2118
|
childProps.className = [childClass, props.className].filter(Boolean).join(" ");
|
|
@@ -2898,27 +2925,45 @@ var DialogOverlay = React49.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2898
2925
|
}
|
|
2899
2926
|
));
|
|
2900
2927
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
2901
|
-
var DialogContent = React49.forwardRef(
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2928
|
+
var DialogContent = React49.forwardRef(
|
|
2929
|
+
({
|
|
2930
|
+
className,
|
|
2931
|
+
children,
|
|
2932
|
+
showClose = true,
|
|
2933
|
+
closeClassName,
|
|
2934
|
+
customClose,
|
|
2935
|
+
...props
|
|
2936
|
+
}, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
2937
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
2938
|
+
/* @__PURE__ */ jsxs(
|
|
2939
|
+
DialogPrimitive.Content,
|
|
2940
|
+
{
|
|
2941
|
+
ref,
|
|
2942
|
+
className: cn(
|
|
2943
|
+
"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",
|
|
2944
|
+
className
|
|
2945
|
+
),
|
|
2946
|
+
...props,
|
|
2947
|
+
children: [
|
|
2948
|
+
children,
|
|
2949
|
+
showClose && (customClose ? customClose : /* @__PURE__ */ jsxs(
|
|
2950
|
+
DialogPrimitive.Close,
|
|
2951
|
+
{
|
|
2952
|
+
className: cn(
|
|
2953
|
+
"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",
|
|
2954
|
+
closeClassName
|
|
2955
|
+
),
|
|
2956
|
+
children: [
|
|
2957
|
+
/* @__PURE__ */ jsx(X, { className: "h-5 w-5" }),
|
|
2958
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
2959
|
+
]
|
|
2960
|
+
}
|
|
2961
|
+
))
|
|
2962
|
+
]
|
|
2963
|
+
}
|
|
2964
|
+
)
|
|
2965
|
+
] })
|
|
2966
|
+
);
|
|
2922
2967
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
2923
2968
|
var DialogHeader = ({
|
|
2924
2969
|
className,
|
|
@@ -2926,10 +2971,7 @@ var DialogHeader = ({
|
|
|
2926
2971
|
}) => /* @__PURE__ */ jsx(
|
|
2927
2972
|
"div",
|
|
2928
2973
|
{
|
|
2929
|
-
className: cn(
|
|
2930
|
-
"flex flex-col space-y-1.5 text-left",
|
|
2931
|
-
className
|
|
2932
|
-
),
|
|
2974
|
+
className: cn("flex flex-col space-y-1.5 text-left", className),
|
|
2933
2975
|
...props
|
|
2934
2976
|
}
|
|
2935
2977
|
);
|
|
@@ -3289,7 +3331,9 @@ var TooltipContent = React49.forwardRef(({ className, sideOffset = 4, ...props }
|
|
|
3289
3331
|
ref,
|
|
3290
3332
|
sideOffset,
|
|
3291
3333
|
className: cn(
|
|
3292
|
-
"z-50 overflow-hidden rounded-md bg-mvn-gray-900 px-3 py-1.5 text-xs text-
|
|
3334
|
+
"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",
|
|
3335
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
3336
|
+
"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",
|
|
3293
3337
|
className
|
|
3294
3338
|
),
|
|
3295
3339
|
...props
|
|
@@ -4291,13 +4335,20 @@ PaginationEllipsis.displayName = "PaginationEllipsis";
|
|
|
4291
4335
|
|
|
4292
4336
|
// src/components/ui/tabs/index.tsx
|
|
4293
4337
|
init_utils();
|
|
4294
|
-
var
|
|
4338
|
+
var TabsContext = React49.createContext({
|
|
4339
|
+
destroyInactiveTabs: true
|
|
4340
|
+
});
|
|
4341
|
+
var Tabs = React49.forwardRef(({ destroyInactiveTabs = true, ...props }, ref) => /* @__PURE__ */ jsx(TabsContext.Provider, { value: { destroyInactiveTabs }, children: /* @__PURE__ */ jsx(TabsPrimitive.Root, { ref, ...props }) }));
|
|
4342
|
+
Tabs.displayName = TabsPrimitive.Root.displayName;
|
|
4295
4343
|
var TabsList = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4296
4344
|
TabsPrimitive.List,
|
|
4297
4345
|
{
|
|
4298
4346
|
ref,
|
|
4299
4347
|
className: cn(
|
|
4300
|
-
"
|
|
4348
|
+
"flex items-stretch gap-0 text-muted-foreground",
|
|
4349
|
+
"data-[orientation=horizontal]:w-full",
|
|
4350
|
+
"data-[orientation=vertical]:w-56 data-[orientation=vertical]:border-r data-[orientation=vertical]:border-border",
|
|
4351
|
+
"data-[orientation=vertical]:flex-col data-[orientation=vertical]:shrink-0",
|
|
4301
4352
|
className
|
|
4302
4353
|
),
|
|
4303
4354
|
...props
|
|
@@ -4309,27 +4360,34 @@ var TabsTrigger = React49.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
4309
4360
|
{
|
|
4310
4361
|
ref,
|
|
4311
4362
|
className: cn(
|
|
4312
|
-
"inline-flex items-center justify-center whitespace-nowrap
|
|
4313
|
-
"
|
|
4314
|
-
"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",
|
|
4315
|
-
className
|
|
4316
|
-
),
|
|
4317
|
-
...props
|
|
4318
|
-
}
|
|
4319
|
-
));
|
|
4320
|
-
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
4321
|
-
var TabsContent = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4322
|
-
TabsPrimitive.Content,
|
|
4323
|
-
{
|
|
4324
|
-
ref,
|
|
4325
|
-
className: cn(
|
|
4363
|
+
"inline-flex min-w-0 items-center justify-center whitespace-nowrap text-sm font-medium",
|
|
4364
|
+
"transition-all duration-150 text-muted-foreground hover:text-primary",
|
|
4326
4365
|
"ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
4327
|
-
"
|
|
4366
|
+
"data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3 data-[orientation=horizontal]:border-b-2 data-[orientation=horizontal]:border-transparent",
|
|
4367
|
+
"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",
|
|
4368
|
+
"data-[state=active]:text-primary data-[state=active]:font-semibold data-[state=active]:border-primary",
|
|
4369
|
+
"disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed",
|
|
4328
4370
|
className
|
|
4329
4371
|
),
|
|
4330
4372
|
...props
|
|
4331
4373
|
}
|
|
4332
4374
|
));
|
|
4375
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
4376
|
+
var TabsContent = React49.forwardRef(({ className, ...props }, ref) => {
|
|
4377
|
+
const { destroyInactiveTabs } = React49.useContext(TabsContext);
|
|
4378
|
+
return /* @__PURE__ */ jsx(
|
|
4379
|
+
TabsPrimitive.Content,
|
|
4380
|
+
{
|
|
4381
|
+
ref,
|
|
4382
|
+
forceMount: destroyInactiveTabs ? void 0 : true,
|
|
4383
|
+
className: cn(
|
|
4384
|
+
"ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",
|
|
4385
|
+
className
|
|
4386
|
+
),
|
|
4387
|
+
...props
|
|
4388
|
+
}
|
|
4389
|
+
);
|
|
4390
|
+
});
|
|
4333
4391
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
4334
4392
|
function SimpleTabs({
|
|
4335
4393
|
items,
|
|
@@ -4340,10 +4398,12 @@ function SimpleTabs({
|
|
|
4340
4398
|
tabsListClassName,
|
|
4341
4399
|
tabsTriggerClassName,
|
|
4342
4400
|
tabsContentClassName,
|
|
4343
|
-
orientation = "horizontal"
|
|
4401
|
+
orientation = "horizontal",
|
|
4402
|
+
destroyInactiveTabs = true
|
|
4344
4403
|
}) {
|
|
4345
|
-
const defaultTabsListClassName = orientation === "vertical" ? "
|
|
4346
|
-
const defaultTabsContentClassName = orientation === "vertical" ? "
|
|
4404
|
+
const defaultTabsListClassName = orientation === "vertical" ? "bg-background/60 p-2" : "w-full";
|
|
4405
|
+
const defaultTabsContentClassName = orientation === "vertical" ? "ml-0 flex-1 min-w-0" : "w-full";
|
|
4406
|
+
const rootLayoutClassName = orientation === "vertical" ? "flex flex-row w-full max-w-full items-start gap-6" : "flex w-full flex-col gap-6";
|
|
4347
4407
|
return /* @__PURE__ */ jsxs(
|
|
4348
4408
|
Tabs,
|
|
4349
4409
|
{
|
|
@@ -4351,20 +4411,15 @@ function SimpleTabs({
|
|
|
4351
4411
|
value,
|
|
4352
4412
|
onValueChange,
|
|
4353
4413
|
orientation,
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
className
|
|
4357
|
-
),
|
|
4414
|
+
destroyInactiveTabs,
|
|
4415
|
+
className: cn(rootLayoutClassName, className),
|
|
4358
4416
|
children: [
|
|
4359
4417
|
/* @__PURE__ */ jsx(TabsList, { className: cn(defaultTabsListClassName, tabsListClassName), children: items.map((item) => /* @__PURE__ */ jsx(
|
|
4360
4418
|
TabsTrigger,
|
|
4361
4419
|
{
|
|
4362
4420
|
value: item.value,
|
|
4363
4421
|
disabled: item.disabled,
|
|
4364
|
-
className: cn(
|
|
4365
|
-
orientation === "vertical" && "mb-1 w-full justify-start",
|
|
4366
|
-
tabsTriggerClassName
|
|
4367
|
-
),
|
|
4422
|
+
className: cn(tabsTriggerClassName),
|
|
4368
4423
|
children: item.label
|
|
4369
4424
|
},
|
|
4370
4425
|
item.value
|
|
@@ -4619,6 +4674,7 @@ var ScrollArea = React49.forwardRef(
|
|
|
4619
4674
|
orientation = "vertical",
|
|
4620
4675
|
scrollbarClassName,
|
|
4621
4676
|
thumbClassName,
|
|
4677
|
+
type = "auto",
|
|
4622
4678
|
...props
|
|
4623
4679
|
}, ref) => {
|
|
4624
4680
|
const showVertical = orientation === "vertical" || orientation === "both";
|
|
@@ -4627,12 +4683,38 @@ var ScrollArea = React49.forwardRef(
|
|
|
4627
4683
|
ScrollAreaPrimitive.Root,
|
|
4628
4684
|
{
|
|
4629
4685
|
ref,
|
|
4686
|
+
type,
|
|
4630
4687
|
className: cn("relative overflow-hidden", className),
|
|
4631
4688
|
...props,
|
|
4632
4689
|
children: [
|
|
4633
|
-
/* @__PURE__ */ jsx(
|
|
4634
|
-
|
|
4635
|
-
|
|
4690
|
+
/* @__PURE__ */ jsx(
|
|
4691
|
+
ScrollAreaPrimitive.Viewport,
|
|
4692
|
+
{
|
|
4693
|
+
className: cn(
|
|
4694
|
+
"h-full w-full rounded-[inherit]",
|
|
4695
|
+
// Fix overflow based on orientation to prevent unwanted scrolling
|
|
4696
|
+
orientation === "vertical" && "!overflow-x-hidden",
|
|
4697
|
+
orientation === "horizontal" && "!overflow-y-hidden"
|
|
4698
|
+
),
|
|
4699
|
+
children
|
|
4700
|
+
}
|
|
4701
|
+
),
|
|
4702
|
+
showVertical && /* @__PURE__ */ jsx(
|
|
4703
|
+
ScrollBar,
|
|
4704
|
+
{
|
|
4705
|
+
orientation: "vertical",
|
|
4706
|
+
className: scrollbarClassName,
|
|
4707
|
+
thumbClassName
|
|
4708
|
+
}
|
|
4709
|
+
),
|
|
4710
|
+
showHorizontal && /* @__PURE__ */ jsx(
|
|
4711
|
+
ScrollBar,
|
|
4712
|
+
{
|
|
4713
|
+
orientation: "horizontal",
|
|
4714
|
+
className: scrollbarClassName,
|
|
4715
|
+
thumbClassName
|
|
4716
|
+
}
|
|
4717
|
+
),
|
|
4636
4718
|
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
4637
4719
|
]
|
|
4638
4720
|
}
|
|
@@ -4656,7 +4738,7 @@ var ScrollBar = React49.forwardRef(({ className, orientation = "vertical", thumb
|
|
|
4656
4738
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4657
4739
|
{
|
|
4658
4740
|
className: cn(
|
|
4659
|
-
"relative flex-1 rounded-full bg-
|
|
4741
|
+
"relative flex-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground transition-colors",
|
|
4660
4742
|
thumbClassName
|
|
4661
4743
|
)
|
|
4662
4744
|
}
|
|
@@ -4667,6 +4749,8 @@ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
|
4667
4749
|
|
|
4668
4750
|
// src/components/ui/sidebar/index.tsx
|
|
4669
4751
|
init_utils();
|
|
4752
|
+
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
4753
|
+
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
4670
4754
|
var SIDEBAR_WIDTH = "16rem";
|
|
4671
4755
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
4672
4756
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
@@ -4678,395 +4762,601 @@ function useSidebar() {
|
|
|
4678
4762
|
}
|
|
4679
4763
|
return context;
|
|
4680
4764
|
}
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
(
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4765
|
+
function SidebarProvider({
|
|
4766
|
+
defaultOpen = true,
|
|
4767
|
+
open: openProp,
|
|
4768
|
+
onOpenChange: setOpenProp,
|
|
4769
|
+
className,
|
|
4770
|
+
style,
|
|
4771
|
+
children,
|
|
4772
|
+
...props
|
|
4773
|
+
}) {
|
|
4774
|
+
const [_open, _setOpen] = React49.useState(defaultOpen);
|
|
4775
|
+
const open = openProp ?? _open;
|
|
4776
|
+
const setOpen = React49.useCallback(
|
|
4777
|
+
(value) => {
|
|
4778
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
4779
|
+
if (setOpenProp) {
|
|
4780
|
+
setOpenProp(openState);
|
|
4781
|
+
} else {
|
|
4782
|
+
_setOpen(openState);
|
|
4783
|
+
}
|
|
4784
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
4785
|
+
},
|
|
4786
|
+
[setOpenProp, open]
|
|
4787
|
+
);
|
|
4788
|
+
const toggleSidebar = React49.useCallback(() => {
|
|
4789
|
+
return setOpen((open2) => !open2);
|
|
4790
|
+
}, [setOpen]);
|
|
4791
|
+
React49.useEffect(() => {
|
|
4792
|
+
const handleKeyDown = (event) => {
|
|
4793
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
4794
|
+
event.preventDefault();
|
|
4795
|
+
toggleSidebar();
|
|
4796
|
+
}
|
|
4797
|
+
};
|
|
4798
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
4799
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
4800
|
+
}, [toggleSidebar]);
|
|
4801
|
+
const state = open ? "expanded" : "collapsed";
|
|
4802
|
+
const contextValue = React49.useMemo(
|
|
4803
|
+
() => ({
|
|
4804
|
+
state,
|
|
4805
|
+
open,
|
|
4806
|
+
setOpen,
|
|
4807
|
+
toggleSidebar
|
|
4808
|
+
}),
|
|
4809
|
+
[state, open, setOpen, toggleSidebar]
|
|
4810
|
+
);
|
|
4811
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(
|
|
4812
|
+
"div",
|
|
4813
|
+
{
|
|
4814
|
+
"data-slot": "sidebar-wrapper",
|
|
4815
|
+
style: {
|
|
4816
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
4817
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
4818
|
+
...style
|
|
4702
4819
|
},
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
};
|
|
4724
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
4725
|
-
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
4726
|
-
}, [toggleSidebar]);
|
|
4727
|
-
const state = open ? "expanded" : "collapsed";
|
|
4728
|
-
const contextValue = React49.useMemo(
|
|
4729
|
-
() => ({
|
|
4730
|
-
state,
|
|
4731
|
-
open,
|
|
4732
|
-
setOpen,
|
|
4733
|
-
isMobile,
|
|
4734
|
-
openMobile,
|
|
4735
|
-
setOpenMobile,
|
|
4736
|
-
toggleSidebar
|
|
4737
|
-
}),
|
|
4738
|
-
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
4739
|
-
);
|
|
4740
|
-
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
4820
|
+
className: cn(
|
|
4821
|
+
"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-full w-full",
|
|
4822
|
+
className
|
|
4823
|
+
),
|
|
4824
|
+
...props,
|
|
4825
|
+
children
|
|
4826
|
+
}
|
|
4827
|
+
) }) });
|
|
4828
|
+
}
|
|
4829
|
+
function Sidebar({
|
|
4830
|
+
side = "left",
|
|
4831
|
+
variant = "sidebar",
|
|
4832
|
+
collapsible = "offcanvas",
|
|
4833
|
+
className,
|
|
4834
|
+
children,
|
|
4835
|
+
...props
|
|
4836
|
+
}) {
|
|
4837
|
+
const { state } = useSidebar();
|
|
4838
|
+
if (collapsible === "none") {
|
|
4839
|
+
return /* @__PURE__ */ jsx(
|
|
4741
4840
|
"div",
|
|
4742
4841
|
{
|
|
4743
|
-
|
|
4744
|
-
"--sidebar-width": SIDEBAR_WIDTH,
|
|
4745
|
-
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
4746
|
-
...style
|
|
4747
|
-
},
|
|
4842
|
+
"data-slot": "sidebar",
|
|
4748
4843
|
className: cn(
|
|
4749
|
-
"
|
|
4844
|
+
"bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",
|
|
4750
4845
|
className
|
|
4751
4846
|
),
|
|
4752
|
-
ref,
|
|
4753
4847
|
...props,
|
|
4754
4848
|
children
|
|
4755
4849
|
}
|
|
4756
|
-
)
|
|
4850
|
+
);
|
|
4757
4851
|
}
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
(
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
return /* @__PURE__ */ jsx(
|
|
4852
|
+
const isCollapsed = state === "collapsed";
|
|
4853
|
+
const isIconMode = collapsible === "icon";
|
|
4854
|
+
const isCollapsedIcon = isCollapsed && isIconMode;
|
|
4855
|
+
return /* @__PURE__ */ jsx(
|
|
4856
|
+
"div",
|
|
4857
|
+
{
|
|
4858
|
+
className: "group peer text-sidebar-foreground hidden md:block relative",
|
|
4859
|
+
"data-state": state,
|
|
4860
|
+
"data-collapsible": isCollapsed ? collapsible : "",
|
|
4861
|
+
"data-variant": variant,
|
|
4862
|
+
"data-side": side,
|
|
4863
|
+
"data-slot": "sidebar",
|
|
4864
|
+
children: /* @__PURE__ */ jsx(
|
|
4772
4865
|
"div",
|
|
4773
4866
|
{
|
|
4867
|
+
"data-slot": "sidebar-container",
|
|
4774
4868
|
className: cn(
|
|
4775
|
-
"
|
|
4869
|
+
"relative z-10 h-full transition-[width] duration-200 ease-linear flex flex-col",
|
|
4870
|
+
// Width handling
|
|
4871
|
+
isCollapsed && collapsible === "offcanvas" && "w-0 overflow-hidden",
|
|
4872
|
+
isCollapsedIcon && "w-[var(--sidebar-width-icon)]",
|
|
4873
|
+
!isCollapsed && "w-[var(--sidebar-width)]",
|
|
4874
|
+
// Border/padding for variants
|
|
4875
|
+
variant === "floating" || variant === "inset" ? "p-2" : "border-r border-sidebar-border",
|
|
4776
4876
|
className
|
|
4777
4877
|
),
|
|
4778
|
-
ref,
|
|
4779
4878
|
...props,
|
|
4780
|
-
children
|
|
4879
|
+
children: /* @__PURE__ */ jsx(
|
|
4880
|
+
"div",
|
|
4881
|
+
{
|
|
4882
|
+
"data-sidebar": "sidebar",
|
|
4883
|
+
"data-slot": "sidebar-inner",
|
|
4884
|
+
"data-collapsible": isCollapsedIcon ? "icon" : void 0,
|
|
4885
|
+
className: cn(
|
|
4886
|
+
"bg-sidebar flex h-full w-full flex-col",
|
|
4887
|
+
variant === "floating" && "rounded-lg border border-sidebar-border shadow-sm",
|
|
4888
|
+
// When in icon mode, center content and add consistent padding
|
|
4889
|
+
isCollapsedIcon && "overflow-hidden items-center py-2"
|
|
4890
|
+
),
|
|
4891
|
+
children
|
|
4892
|
+
}
|
|
4893
|
+
)
|
|
4781
4894
|
}
|
|
4782
|
-
)
|
|
4783
|
-
}
|
|
4784
|
-
if (isMobile) {
|
|
4785
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4786
|
-
openMobile && /* @__PURE__ */ jsx(
|
|
4787
|
-
"div",
|
|
4788
|
-
{
|
|
4789
|
-
className: "fixed inset-0 z-40 bg-overlay-heavy",
|
|
4790
|
-
onClick: () => setOpenMobile(false)
|
|
4791
|
-
}
|
|
4792
|
-
),
|
|
4793
|
-
/* @__PURE__ */ jsx(
|
|
4794
|
-
"div",
|
|
4795
|
-
{
|
|
4796
|
-
ref,
|
|
4797
|
-
className: cn(
|
|
4798
|
-
"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",
|
|
4799
|
-
side === "left" ? "left-0" : "right-0",
|
|
4800
|
-
openMobile && "flex translate-x-0",
|
|
4801
|
-
!openMobile && (side === "left" ? "-translate-x-full" : "translate-x-full"),
|
|
4802
|
-
className
|
|
4803
|
-
),
|
|
4804
|
-
...props,
|
|
4805
|
-
children
|
|
4806
|
-
}
|
|
4807
|
-
)
|
|
4808
|
-
] });
|
|
4895
|
+
)
|
|
4809
4896
|
}
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
"data-side": side,
|
|
4818
|
-
className: cn(
|
|
4819
|
-
"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",
|
|
4820
|
-
state === "collapsed" && collapsible === "icon" && "w-[--sidebar-width-icon]",
|
|
4821
|
-
variant === "floating" && "m-2 rounded-lg border border-line-soft shadow-md",
|
|
4822
|
-
variant === "inset" && "m-2 mr-0 rounded-l-lg border border-line-soft shadow-sm",
|
|
4823
|
-
className
|
|
4824
|
-
),
|
|
4825
|
-
...props,
|
|
4826
|
-
children
|
|
4827
|
-
}
|
|
4828
|
-
);
|
|
4829
|
-
}
|
|
4830
|
-
);
|
|
4831
|
-
Sidebar.displayName = "Sidebar";
|
|
4832
|
-
var SidebarTrigger = React49.forwardRef(({ className, onClick, ...props }, ref) => {
|
|
4897
|
+
);
|
|
4898
|
+
}
|
|
4899
|
+
function SidebarTrigger({
|
|
4900
|
+
className,
|
|
4901
|
+
onClick,
|
|
4902
|
+
...props
|
|
4903
|
+
}) {
|
|
4833
4904
|
const { toggleSidebar } = useSidebar();
|
|
4834
4905
|
return /* @__PURE__ */ jsxs(
|
|
4835
4906
|
Button,
|
|
4836
4907
|
{
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
/* @__PURE__ */ jsx(
|
|
4849
|
-
|
|
4908
|
+
"data-sidebar": "trigger",
|
|
4909
|
+
"data-slot": "sidebar-trigger",
|
|
4910
|
+
variant: "ghost",
|
|
4911
|
+
size: "icon",
|
|
4912
|
+
className: cn("size-7", className),
|
|
4913
|
+
onClick: (event) => {
|
|
4914
|
+
onClick?.(event);
|
|
4915
|
+
toggleSidebar();
|
|
4916
|
+
},
|
|
4917
|
+
...props,
|
|
4918
|
+
children: [
|
|
4919
|
+
/* @__PURE__ */ jsx(PanelLeftIcon, {}),
|
|
4920
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
4921
|
+
]
|
|
4922
|
+
}
|
|
4923
|
+
);
|
|
4924
|
+
}
|
|
4925
|
+
function SidebarRail({ className, ...props }) {
|
|
4926
|
+
const { toggleSidebar } = useSidebar();
|
|
4927
|
+
return /* @__PURE__ */ jsx(
|
|
4928
|
+
"button",
|
|
4929
|
+
{
|
|
4930
|
+
"data-sidebar": "rail",
|
|
4931
|
+
"data-slot": "sidebar-rail",
|
|
4932
|
+
"aria-label": "Toggle Sidebar",
|
|
4933
|
+
tabIndex: -1,
|
|
4934
|
+
onClick: toggleSidebar,
|
|
4935
|
+
title: "Toggle Sidebar",
|
|
4936
|
+
className: cn(
|
|
4937
|
+
"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",
|
|
4938
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
4939
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
4940
|
+
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
4941
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
4942
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
4943
|
+
className
|
|
4944
|
+
),
|
|
4945
|
+
...props
|
|
4946
|
+
}
|
|
4947
|
+
);
|
|
4948
|
+
}
|
|
4949
|
+
function SidebarInset({ className, ...props }) {
|
|
4950
|
+
return /* @__PURE__ */ jsx(
|
|
4951
|
+
"main",
|
|
4952
|
+
{
|
|
4953
|
+
"data-slot": "sidebar-inset",
|
|
4954
|
+
className: cn(
|
|
4955
|
+
"bg-background relative flex w-full flex-1 flex-col",
|
|
4956
|
+
"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",
|
|
4957
|
+
className
|
|
4958
|
+
),
|
|
4959
|
+
...props
|
|
4960
|
+
}
|
|
4961
|
+
);
|
|
4962
|
+
}
|
|
4963
|
+
function SidebarInput({
|
|
4964
|
+
className,
|
|
4965
|
+
...props
|
|
4966
|
+
}) {
|
|
4967
|
+
return /* @__PURE__ */ jsx(
|
|
4968
|
+
Input,
|
|
4969
|
+
{
|
|
4970
|
+
"data-slot": "sidebar-input",
|
|
4971
|
+
"data-sidebar": "input",
|
|
4972
|
+
className: cn("bg-background h-8 w-full shadow-none", className),
|
|
4973
|
+
...props
|
|
4974
|
+
}
|
|
4975
|
+
);
|
|
4976
|
+
}
|
|
4977
|
+
function SidebarHeader({ className, ...props }) {
|
|
4978
|
+
const { state } = useSidebar();
|
|
4979
|
+
const isCollapsed = state === "collapsed";
|
|
4980
|
+
return /* @__PURE__ */ jsx(
|
|
4981
|
+
"div",
|
|
4982
|
+
{
|
|
4983
|
+
"data-slot": "sidebar-header",
|
|
4984
|
+
"data-sidebar": "header",
|
|
4985
|
+
className: cn(
|
|
4986
|
+
"flex flex-col gap-2 p-2",
|
|
4987
|
+
isCollapsed && "items-center",
|
|
4988
|
+
className
|
|
4989
|
+
),
|
|
4990
|
+
...props
|
|
4991
|
+
}
|
|
4992
|
+
);
|
|
4993
|
+
}
|
|
4994
|
+
function SidebarFooter({ className, ...props }) {
|
|
4995
|
+
const { state } = useSidebar();
|
|
4996
|
+
const isCollapsed = state === "collapsed";
|
|
4997
|
+
return /* @__PURE__ */ jsx(
|
|
4998
|
+
"div",
|
|
4999
|
+
{
|
|
5000
|
+
"data-slot": "sidebar-footer",
|
|
5001
|
+
"data-sidebar": "footer",
|
|
5002
|
+
className: cn(
|
|
5003
|
+
"flex flex-col gap-2 p-2 mt-auto",
|
|
5004
|
+
isCollapsed && "items-center",
|
|
5005
|
+
className
|
|
5006
|
+
),
|
|
5007
|
+
...props
|
|
5008
|
+
}
|
|
5009
|
+
);
|
|
5010
|
+
}
|
|
5011
|
+
function SidebarSeparator({
|
|
5012
|
+
className,
|
|
5013
|
+
...props
|
|
5014
|
+
}) {
|
|
5015
|
+
return /* @__PURE__ */ jsx(
|
|
5016
|
+
Separator5,
|
|
5017
|
+
{
|
|
5018
|
+
"data-slot": "sidebar-separator",
|
|
5019
|
+
"data-sidebar": "separator",
|
|
5020
|
+
className: cn("bg-sidebar-border mx-2 w-auto", className),
|
|
5021
|
+
...props
|
|
5022
|
+
}
|
|
5023
|
+
);
|
|
5024
|
+
}
|
|
5025
|
+
function SidebarContent({ className, ...props }) {
|
|
5026
|
+
const { state } = useSidebar();
|
|
5027
|
+
const isCollapsed = state === "collapsed";
|
|
5028
|
+
return /* @__PURE__ */ jsx(
|
|
5029
|
+
"div",
|
|
5030
|
+
{
|
|
5031
|
+
"data-slot": "sidebar-content",
|
|
5032
|
+
"data-sidebar": "content",
|
|
5033
|
+
className: cn(
|
|
5034
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto",
|
|
5035
|
+
isCollapsed && "items-center",
|
|
5036
|
+
className
|
|
5037
|
+
),
|
|
5038
|
+
...props
|
|
5039
|
+
}
|
|
5040
|
+
);
|
|
5041
|
+
}
|
|
5042
|
+
function SidebarGroup({ className, ...props }) {
|
|
5043
|
+
const { state } = useSidebar();
|
|
5044
|
+
const isCollapsed = state === "collapsed";
|
|
5045
|
+
return /* @__PURE__ */ jsx(
|
|
5046
|
+
"div",
|
|
5047
|
+
{
|
|
5048
|
+
"data-slot": "sidebar-group",
|
|
5049
|
+
"data-sidebar": "group",
|
|
5050
|
+
className: cn(
|
|
5051
|
+
"relative flex w-full min-w-0 flex-col p-2",
|
|
5052
|
+
isCollapsed && "items-center",
|
|
5053
|
+
className
|
|
5054
|
+
),
|
|
5055
|
+
...props
|
|
5056
|
+
}
|
|
5057
|
+
);
|
|
5058
|
+
}
|
|
5059
|
+
function SidebarGroupLabel({
|
|
5060
|
+
className,
|
|
5061
|
+
asChild = false,
|
|
5062
|
+
...props
|
|
5063
|
+
}) {
|
|
5064
|
+
const Comp = asChild ? Slot : "div";
|
|
5065
|
+
const { state } = useSidebar();
|
|
5066
|
+
const isCollapsed = state === "collapsed";
|
|
5067
|
+
return /* @__PURE__ */ jsx(
|
|
5068
|
+
Comp,
|
|
5069
|
+
{
|
|
5070
|
+
"data-slot": "sidebar-group-label",
|
|
5071
|
+
"data-sidebar": "group-label",
|
|
5072
|
+
className: cn(
|
|
5073
|
+
"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",
|
|
5074
|
+
isCollapsed && "h-0 opacity-0 overflow-hidden -mt-2",
|
|
5075
|
+
className
|
|
5076
|
+
),
|
|
5077
|
+
...props
|
|
5078
|
+
}
|
|
5079
|
+
);
|
|
5080
|
+
}
|
|
5081
|
+
function SidebarGroupAction({
|
|
5082
|
+
className,
|
|
5083
|
+
asChild = false,
|
|
5084
|
+
...props
|
|
5085
|
+
}) {
|
|
5086
|
+
const Comp = asChild ? Slot : "button";
|
|
5087
|
+
const { state } = useSidebar();
|
|
5088
|
+
const isCollapsed = state === "collapsed";
|
|
5089
|
+
if (isCollapsed) {
|
|
5090
|
+
return null;
|
|
5091
|
+
}
|
|
5092
|
+
return /* @__PURE__ */ jsx(
|
|
5093
|
+
Comp,
|
|
5094
|
+
{
|
|
5095
|
+
"data-slot": "sidebar-group-action",
|
|
5096
|
+
"data-sidebar": "group-action",
|
|
5097
|
+
className: cn(
|
|
5098
|
+
"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",
|
|
5099
|
+
// Increases the hit area of the button on mobile.
|
|
5100
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
5101
|
+
className
|
|
5102
|
+
),
|
|
5103
|
+
...props
|
|
5104
|
+
}
|
|
5105
|
+
);
|
|
5106
|
+
}
|
|
5107
|
+
function SidebarGroupContent({
|
|
5108
|
+
className,
|
|
5109
|
+
...props
|
|
5110
|
+
}) {
|
|
5111
|
+
return /* @__PURE__ */ jsx(
|
|
5112
|
+
"div",
|
|
5113
|
+
{
|
|
5114
|
+
"data-slot": "sidebar-group-content",
|
|
5115
|
+
"data-sidebar": "group-content",
|
|
5116
|
+
className: cn("w-full text-sm", className),
|
|
5117
|
+
...props
|
|
4850
5118
|
}
|
|
4851
5119
|
);
|
|
4852
|
-
}
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
const
|
|
5120
|
+
}
|
|
5121
|
+
function SidebarMenu({ className, ...props }) {
|
|
5122
|
+
const { state } = useSidebar();
|
|
5123
|
+
const isCollapsed = state === "collapsed";
|
|
4856
5124
|
return /* @__PURE__ */ jsx(
|
|
4857
|
-
"
|
|
5125
|
+
"ul",
|
|
4858
5126
|
{
|
|
4859
|
-
|
|
4860
|
-
"
|
|
4861
|
-
tabIndex: -1,
|
|
4862
|
-
onClick: toggleSidebar,
|
|
4863
|
-
title: "Toggle Sidebar",
|
|
5127
|
+
"data-slot": "sidebar-menu",
|
|
5128
|
+
"data-sidebar": "menu",
|
|
4864
5129
|
className: cn(
|
|
4865
|
-
"
|
|
5130
|
+
"flex w-full min-w-0 flex-col gap-2 p-2",
|
|
5131
|
+
isCollapsed && "items-center",
|
|
4866
5132
|
className
|
|
4867
5133
|
),
|
|
4868
5134
|
...props
|
|
4869
5135
|
}
|
|
4870
5136
|
);
|
|
4871
|
-
}
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
"
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
5137
|
+
}
|
|
5138
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
5139
|
+
return /* @__PURE__ */ jsx(
|
|
5140
|
+
"li",
|
|
5141
|
+
{
|
|
5142
|
+
"data-slot": "sidebar-menu-item",
|
|
5143
|
+
"data-sidebar": "menu-item",
|
|
5144
|
+
className: cn("group/menu-item relative", className),
|
|
5145
|
+
...props
|
|
5146
|
+
}
|
|
5147
|
+
);
|
|
5148
|
+
}
|
|
5149
|
+
var sidebarMenuButtonStyle = cn(
|
|
5150
|
+
"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",
|
|
5151
|
+
"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",
|
|
5152
|
+
"data-[active=true]:bg-muted data-[active=true]:text-primary [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0"
|
|
4887
5153
|
);
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
"
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
5154
|
+
var sidebarMenuButtonVariants = cva(sidebarMenuButtonStyle, {
|
|
5155
|
+
variants: {
|
|
5156
|
+
variant: {
|
|
5157
|
+
default: "hover:bg-muted hover:text-foreground",
|
|
5158
|
+
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))]"
|
|
5159
|
+
},
|
|
5160
|
+
size: {
|
|
5161
|
+
default: "h-8 text-sm",
|
|
5162
|
+
sm: "h-7 text-xs",
|
|
5163
|
+
lg: "h-12 text-sm"
|
|
5164
|
+
}
|
|
5165
|
+
},
|
|
5166
|
+
defaultVariants: {
|
|
5167
|
+
variant: "default",
|
|
5168
|
+
size: "default"
|
|
4899
5169
|
}
|
|
4900
|
-
);
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
5170
|
+
});
|
|
5171
|
+
function SidebarMenuButton({
|
|
5172
|
+
asChild = false,
|
|
5173
|
+
isActive = false,
|
|
5174
|
+
variant = "default",
|
|
5175
|
+
size = "default",
|
|
5176
|
+
tooltip,
|
|
5177
|
+
className,
|
|
5178
|
+
children,
|
|
5179
|
+
...props
|
|
5180
|
+
}) {
|
|
5181
|
+
const Comp = asChild ? Slot : "button";
|
|
5182
|
+
const { state } = useSidebar();
|
|
5183
|
+
const isCollapsed = state === "collapsed";
|
|
5184
|
+
const button = /* @__PURE__ */ jsx(
|
|
5185
|
+
Comp,
|
|
5186
|
+
{
|
|
5187
|
+
"data-slot": "sidebar-menu-button",
|
|
5188
|
+
"data-sidebar": "menu-button",
|
|
5189
|
+
"data-size": size,
|
|
5190
|
+
"data-active": isActive,
|
|
5191
|
+
className: cn(
|
|
5192
|
+
sidebarMenuButtonVariants({ variant, size }),
|
|
5193
|
+
// When collapsed in icon mode, make button square and center icon
|
|
5194
|
+
isCollapsed && "w-8 h-8 p-2 justify-center [&>span]:hidden [&>:not(svg)]:hidden [&>svg:not(:first-child)]:hidden",
|
|
5195
|
+
className
|
|
5196
|
+
),
|
|
5197
|
+
...props,
|
|
5198
|
+
children
|
|
5199
|
+
}
|
|
5200
|
+
);
|
|
5201
|
+
if (!isCollapsed || !tooltip) {
|
|
5202
|
+
return button;
|
|
4912
5203
|
}
|
|
4913
|
-
);
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
5204
|
+
return /* @__PURE__ */ jsx(SimpleTooltip, { content: tooltip, side: "right", delayDuration: 0, children: button });
|
|
5205
|
+
}
|
|
5206
|
+
function SidebarMenuAction({
|
|
5207
|
+
className,
|
|
5208
|
+
asChild = false,
|
|
5209
|
+
showOnHover = false,
|
|
5210
|
+
...props
|
|
5211
|
+
}) {
|
|
5212
|
+
const Comp = asChild ? Slot : "button";
|
|
5213
|
+
const { state } = useSidebar();
|
|
5214
|
+
const isCollapsed = state === "collapsed";
|
|
5215
|
+
if (isCollapsed) {
|
|
5216
|
+
return null;
|
|
4925
5217
|
}
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
5218
|
+
return /* @__PURE__ */ jsx(
|
|
5219
|
+
Comp,
|
|
5220
|
+
{
|
|
5221
|
+
"data-slot": "sidebar-menu-action",
|
|
5222
|
+
"data-sidebar": "menu-action",
|
|
5223
|
+
className: cn(
|
|
5224
|
+
"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",
|
|
5225
|
+
// Increases the hit area of the button on mobile.
|
|
5226
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
5227
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
5228
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
5229
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
5230
|
+
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",
|
|
5231
|
+
className
|
|
5232
|
+
),
|
|
5233
|
+
...props
|
|
5234
|
+
}
|
|
5235
|
+
);
|
|
5236
|
+
}
|
|
5237
|
+
function SidebarMenuBadge({
|
|
5238
|
+
className,
|
|
5239
|
+
...props
|
|
5240
|
+
}) {
|
|
5241
|
+
const { state } = useSidebar();
|
|
5242
|
+
const isCollapsed = state === "collapsed";
|
|
5243
|
+
if (isCollapsed) {
|
|
5244
|
+
return null;
|
|
4938
5245
|
}
|
|
4939
|
-
);
|
|
4940
|
-
SidebarGroup.displayName = "SidebarGroup";
|
|
4941
|
-
var SidebarGroupLabel = React49.forwardRef(({ className, ...props }, ref) => {
|
|
4942
5246
|
return /* @__PURE__ */ jsx(
|
|
4943
5247
|
"div",
|
|
4944
5248
|
{
|
|
4945
|
-
|
|
5249
|
+
"data-slot": "sidebar-menu-badge",
|
|
5250
|
+
"data-sidebar": "menu-badge",
|
|
4946
5251
|
className: cn(
|
|
4947
|
-
"px-
|
|
5252
|
+
"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",
|
|
5253
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
5254
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
5255
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
5256
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
4948
5257
|
className
|
|
4949
5258
|
),
|
|
4950
5259
|
...props
|
|
4951
5260
|
}
|
|
4952
5261
|
);
|
|
4953
|
-
}
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
)
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
sm: "h-8 text-xs",
|
|
4989
|
-
lg: "h-12"
|
|
4990
|
-
},
|
|
4991
|
-
isActive: {
|
|
4992
|
-
true: "bg-surface-2 text-foreground font-semibold"
|
|
4993
|
-
}
|
|
4994
|
-
},
|
|
4995
|
-
defaultVariants: {
|
|
4996
|
-
variant: "default",
|
|
4997
|
-
size: "default"
|
|
5262
|
+
}
|
|
5263
|
+
function SidebarMenuSkeleton({
|
|
5264
|
+
className,
|
|
5265
|
+
showIcon = false,
|
|
5266
|
+
...props
|
|
5267
|
+
}) {
|
|
5268
|
+
const width = React49.useMemo(() => {
|
|
5269
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
5270
|
+
}, []);
|
|
5271
|
+
return /* @__PURE__ */ jsxs(
|
|
5272
|
+
"div",
|
|
5273
|
+
{
|
|
5274
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
5275
|
+
"data-sidebar": "menu-skeleton",
|
|
5276
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
5277
|
+
...props,
|
|
5278
|
+
children: [
|
|
5279
|
+
showIcon && /* @__PURE__ */ jsx(
|
|
5280
|
+
Skeleton,
|
|
5281
|
+
{
|
|
5282
|
+
className: "size-4 rounded-md",
|
|
5283
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
5284
|
+
}
|
|
5285
|
+
),
|
|
5286
|
+
/* @__PURE__ */ jsx(
|
|
5287
|
+
Skeleton,
|
|
5288
|
+
{
|
|
5289
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
5290
|
+
"data-sidebar": "menu-skeleton-text",
|
|
5291
|
+
style: {
|
|
5292
|
+
"--skeleton-width": width
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
)
|
|
5296
|
+
]
|
|
4998
5297
|
}
|
|
5298
|
+
);
|
|
5299
|
+
}
|
|
5300
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
5301
|
+
const { state } = useSidebar();
|
|
5302
|
+
const isCollapsed = state === "collapsed";
|
|
5303
|
+
if (isCollapsed) {
|
|
5304
|
+
return null;
|
|
4999
5305
|
}
|
|
5000
|
-
);
|
|
5001
|
-
var SidebarMenuButton = React49.forwardRef(
|
|
5002
|
-
({
|
|
5003
|
-
asChild = false,
|
|
5004
|
-
isActive = false,
|
|
5005
|
-
variant,
|
|
5006
|
-
size,
|
|
5007
|
-
className,
|
|
5008
|
-
...props
|
|
5009
|
-
}, ref) => {
|
|
5010
|
-
const Comp = asChild ? "span" : "button";
|
|
5011
|
-
return /* @__PURE__ */ jsx(
|
|
5012
|
-
Comp,
|
|
5013
|
-
{
|
|
5014
|
-
ref,
|
|
5015
|
-
className: cn(sidebarMenuButtonVariants({ variant, size, isActive }), className),
|
|
5016
|
-
...props
|
|
5017
|
-
}
|
|
5018
|
-
);
|
|
5019
|
-
}
|
|
5020
|
-
);
|
|
5021
|
-
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
5022
|
-
var SidebarMenuAction = React49.forwardRef(({ className, ...props }, ref) => {
|
|
5023
5306
|
return /* @__PURE__ */ jsx(
|
|
5024
|
-
"
|
|
5307
|
+
"ul",
|
|
5025
5308
|
{
|
|
5026
|
-
|
|
5309
|
+
"data-slot": "sidebar-menu-sub",
|
|
5310
|
+
"data-sidebar": "menu-sub",
|
|
5027
5311
|
className: cn(
|
|
5028
|
-
"flex
|
|
5312
|
+
"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-2 border-l p-2",
|
|
5029
5313
|
className
|
|
5030
5314
|
),
|
|
5031
5315
|
...props
|
|
5032
5316
|
}
|
|
5033
5317
|
);
|
|
5034
|
-
}
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
"ul",
|
|
5040
|
-
{
|
|
5041
|
-
ref,
|
|
5042
|
-
className: cn("ml-3 flex flex-col gap-1 border-l border-line-soft pl-3", className),
|
|
5043
|
-
...props
|
|
5044
|
-
}
|
|
5045
|
-
);
|
|
5046
|
-
}
|
|
5047
|
-
);
|
|
5048
|
-
SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
5049
|
-
var SidebarMenuSubItem = React49.forwardRef(
|
|
5050
|
-
({ className, ...props }, ref) => {
|
|
5051
|
-
return /* @__PURE__ */ jsx("li", { ref, className: cn("list-none", className), ...props });
|
|
5052
|
-
}
|
|
5053
|
-
);
|
|
5054
|
-
SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
5055
|
-
var SidebarMenuSubButton = React49.forwardRef(({ className, isActive, ...props }, ref) => {
|
|
5318
|
+
}
|
|
5319
|
+
function SidebarMenuSubItem({
|
|
5320
|
+
className,
|
|
5321
|
+
...props
|
|
5322
|
+
}) {
|
|
5056
5323
|
return /* @__PURE__ */ jsx(
|
|
5057
|
-
"
|
|
5324
|
+
"li",
|
|
5058
5325
|
{
|
|
5059
|
-
|
|
5326
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
5327
|
+
"data-sidebar": "menu-sub-item",
|
|
5328
|
+
className: cn("group/menu-sub-item relative", className),
|
|
5329
|
+
...props
|
|
5330
|
+
}
|
|
5331
|
+
);
|
|
5332
|
+
}
|
|
5333
|
+
function SidebarMenuSubButton({
|
|
5334
|
+
asChild = false,
|
|
5335
|
+
size = "md",
|
|
5336
|
+
isActive = false,
|
|
5337
|
+
className,
|
|
5338
|
+
...props
|
|
5339
|
+
}) {
|
|
5340
|
+
const Comp = asChild ? Slot : "a";
|
|
5341
|
+
return /* @__PURE__ */ jsx(
|
|
5342
|
+
Comp,
|
|
5343
|
+
{
|
|
5344
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
5345
|
+
"data-sidebar": "menu-sub-button",
|
|
5346
|
+
"data-size": size,
|
|
5347
|
+
"data-active": isActive,
|
|
5060
5348
|
className: cn(
|
|
5061
|
-
"flex w-
|
|
5062
|
-
|
|
5349
|
+
"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 ",
|
|
5350
|
+
"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",
|
|
5351
|
+
"data-[active=true]:bg-muted data-[active=true]:text-primary",
|
|
5352
|
+
size === "sm" && "text-xs",
|
|
5353
|
+
size === "md" && "text-sm",
|
|
5063
5354
|
className
|
|
5064
5355
|
),
|
|
5065
5356
|
...props
|
|
5066
5357
|
}
|
|
5067
5358
|
);
|
|
5068
|
-
}
|
|
5069
|
-
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
5359
|
+
}
|
|
5070
5360
|
|
|
5071
5361
|
// src/components/ui/table/index.tsx
|
|
5072
5362
|
init_utils();
|
|
@@ -5094,20 +5384,14 @@ var tableVariants = cva("w-full caption-bottom text-sm", {
|
|
|
5094
5384
|
size: "default"
|
|
5095
5385
|
}
|
|
5096
5386
|
});
|
|
5097
|
-
var Table = React49.forwardRef(({ className, variant, size, wrapperClassName, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
5098
|
-
"
|
|
5387
|
+
var Table = React49.forwardRef(({ className, variant, size, wrapperClassName, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: cn("relative w-full overflow-auto", wrapperClassName), children: /* @__PURE__ */ jsx(
|
|
5388
|
+
"table",
|
|
5099
5389
|
{
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
{
|
|
5104
|
-
ref,
|
|
5105
|
-
className: cn(tableVariants({ variant, size, className })),
|
|
5106
|
-
...props
|
|
5107
|
-
}
|
|
5108
|
-
)
|
|
5390
|
+
ref,
|
|
5391
|
+
className: cn(tableVariants({ variant, size, className })),
|
|
5392
|
+
...props
|
|
5109
5393
|
}
|
|
5110
|
-
));
|
|
5394
|
+
) }));
|
|
5111
5395
|
Table.displayName = "Table";
|
|
5112
5396
|
var TableHeader = React49.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
5113
5397
|
TableHeader.displayName = "TableHeader";
|
|
@@ -6166,6 +6450,8 @@ function useTableVirtualization({
|
|
|
6166
6450
|
});
|
|
6167
6451
|
return arr;
|
|
6168
6452
|
}, [rows, expandable]);
|
|
6453
|
+
const virtualRowPointersRef = useRef(virtualRowPointers);
|
|
6454
|
+
virtualRowPointersRef.current = virtualRowPointers;
|
|
6169
6455
|
const cacheBackingRef = useRef(
|
|
6170
6456
|
/* @__PURE__ */ new Map()
|
|
6171
6457
|
);
|
|
@@ -6199,6 +6485,12 @@ function useTableVirtualization({
|
|
|
6199
6485
|
null
|
|
6200
6486
|
);
|
|
6201
6487
|
const measurementIdleRef = useRef(null);
|
|
6488
|
+
const prefixSumCacheRef = useRef({
|
|
6489
|
+
count: 0,
|
|
6490
|
+
itemSizes: [],
|
|
6491
|
+
offsets: [],
|
|
6492
|
+
totalSize: 0
|
|
6493
|
+
});
|
|
6202
6494
|
const cleanupRaf = useCallback(() => {
|
|
6203
6495
|
if (debounceTimeoutRef.current != null) {
|
|
6204
6496
|
clearTimeout(debounceTimeoutRef.current);
|
|
@@ -6223,10 +6515,16 @@ function useTableVirtualization({
|
|
|
6223
6515
|
measurementIdleRef.current = null;
|
|
6224
6516
|
}
|
|
6225
6517
|
measurementQueueRef.current.clear();
|
|
6518
|
+
prefixSumCacheRef.current = {
|
|
6519
|
+
count: 0,
|
|
6520
|
+
itemSizes: [],
|
|
6521
|
+
offsets: [],
|
|
6522
|
+
totalSize: 0
|
|
6523
|
+
};
|
|
6226
6524
|
}, []);
|
|
6227
6525
|
const estimateSize = useCallback(
|
|
6228
6526
|
(index) => {
|
|
6229
|
-
const item =
|
|
6527
|
+
const item = virtualRowPointersRef.current[index];
|
|
6230
6528
|
if (!item) return baseRowEstimateSize;
|
|
6231
6529
|
const key = item.key;
|
|
6232
6530
|
if (item.kind === "expanded" && !rows[item.rowIndex]?.getIsExpanded()) {
|
|
@@ -6239,21 +6537,23 @@ function useTableVirtualization({
|
|
|
6239
6537
|
if (cached != null) return cached;
|
|
6240
6538
|
return item.kind === "expanded" ? expandContentEstimateSize : baseRowEstimateSize;
|
|
6241
6539
|
},
|
|
6242
|
-
[
|
|
6540
|
+
[baseRowEstimateSize, expandContentEstimateSize]
|
|
6243
6541
|
);
|
|
6244
6542
|
const recomputeVirtualWindow = useCallback(() => {
|
|
6245
6543
|
if (!shouldVirtualize) {
|
|
6246
6544
|
setVirtualWindow(EMPTY_WINDOW);
|
|
6247
6545
|
return;
|
|
6248
6546
|
}
|
|
6547
|
+
const pointers = virtualRowPointersRef.current;
|
|
6249
6548
|
const nextWindow = computeVirtualizedRows({
|
|
6250
|
-
count:
|
|
6549
|
+
count: pointers.length,
|
|
6251
6550
|
getScrollElement: () => tableContainerRef.current,
|
|
6252
6551
|
estimateSize,
|
|
6253
6552
|
overScan,
|
|
6254
6553
|
cache: cacheRef.current,
|
|
6255
6554
|
heightCacheByKey: heightCacheByKeyRef.current,
|
|
6256
|
-
getItemKey: (index) =>
|
|
6555
|
+
getItemKey: (index) => pointers[index]?.key ?? "",
|
|
6556
|
+
prefixSumCache: prefixSumCacheRef.current
|
|
6257
6557
|
});
|
|
6258
6558
|
setVirtualWindow(nextWindow);
|
|
6259
6559
|
}, [estimateSize, overScan]);
|
|
@@ -6286,7 +6586,7 @@ function useTableVirtualization({
|
|
|
6286
6586
|
const { startIndex, endIndex } = virtualWindowRef.current;
|
|
6287
6587
|
if (index < startIndex || index > endIndex) return;
|
|
6288
6588
|
}
|
|
6289
|
-
const item =
|
|
6589
|
+
const item = virtualRowPointersRef.current[index];
|
|
6290
6590
|
if (!item) return;
|
|
6291
6591
|
if (!Number.isFinite(height)) return;
|
|
6292
6592
|
const size = normalizeVirtualSize(height);
|
|
@@ -6340,7 +6640,7 @@ function useTableVirtualization({
|
|
|
6340
6640
|
const { startIndex, endIndex } = virtualWindowRef.current;
|
|
6341
6641
|
if (index < startIndex || index > endIndex) return;
|
|
6342
6642
|
}
|
|
6343
|
-
const item =
|
|
6643
|
+
const item = virtualRowPointersRef.current[index];
|
|
6344
6644
|
const key = item?.key;
|
|
6345
6645
|
if (key != null && heightCacheByKeyRef.current.has(key) || heightCacheByIndexRef.current.has(index)) {
|
|
6346
6646
|
return;
|
|
@@ -6360,7 +6660,7 @@ function useTableVirtualization({
|
|
|
6360
6660
|
return;
|
|
6361
6661
|
}
|
|
6362
6662
|
cacheRef.current.forEach((index, _, key) => {
|
|
6363
|
-
if (index >=
|
|
6663
|
+
if (index >= virtualRowPointersRef.current.length) {
|
|
6364
6664
|
cacheRef.current.remove(index);
|
|
6365
6665
|
heightCacheByIndexRef.current.delete(index);
|
|
6366
6666
|
if (key != null) heightCacheByKeyRef.current.delete(key);
|
|
@@ -6450,7 +6750,8 @@ var computeVirtualizedRows = (config) => {
|
|
|
6450
6750
|
cache,
|
|
6451
6751
|
getItemKey,
|
|
6452
6752
|
getHorizontalScrollElement,
|
|
6453
|
-
heightCacheByKey
|
|
6753
|
+
heightCacheByKey,
|
|
6754
|
+
prefixSumCache
|
|
6454
6755
|
} = config;
|
|
6455
6756
|
if (count <= 0) return EMPTY_WINDOW;
|
|
6456
6757
|
const scrollElement = getScrollElement() ?? null;
|
|
@@ -6464,24 +6765,60 @@ var computeVirtualizedRows = (config) => {
|
|
|
6464
6765
|
Math.max(rawHorizontalScrollOffset, 0),
|
|
6465
6766
|
horizontalTotalSize - horizontalViewportSize
|
|
6466
6767
|
) : Math.max(rawHorizontalScrollOffset, 0);
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
let totalSize
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6768
|
+
let itemSizes;
|
|
6769
|
+
let offsets;
|
|
6770
|
+
let totalSize;
|
|
6771
|
+
const cachedCount = prefixSumCache?.count ?? 0;
|
|
6772
|
+
if (prefixSumCache && cachedCount > 0 && count >= cachedCount) {
|
|
6773
|
+
itemSizes = prefixSumCache.itemSizes.slice(0, cachedCount);
|
|
6774
|
+
offsets = prefixSumCache.offsets.slice(0, cachedCount);
|
|
6775
|
+
totalSize = prefixSumCache.totalSize;
|
|
6776
|
+
if (count > cachedCount) {
|
|
6777
|
+
itemSizes.length = count;
|
|
6778
|
+
offsets.length = count;
|
|
6779
|
+
for (let index = cachedCount; index < count; index++) {
|
|
6780
|
+
offsets[index] = totalSize;
|
|
6781
|
+
const key = getItemKey(index);
|
|
6782
|
+
let size = cache.get(index);
|
|
6783
|
+
if (size == null && key != null) {
|
|
6784
|
+
size = heightCacheByKey.get(key);
|
|
6785
|
+
}
|
|
6786
|
+
if (size == null) {
|
|
6787
|
+
const estimate = estimateSize(index);
|
|
6788
|
+
size = normalizeVirtualSize(estimate);
|
|
6789
|
+
} else {
|
|
6790
|
+
size = normalizeVirtualSize(size);
|
|
6791
|
+
}
|
|
6792
|
+
itemSizes[index] = size;
|
|
6793
|
+
totalSize += size;
|
|
6794
|
+
}
|
|
6795
|
+
}
|
|
6796
|
+
} else {
|
|
6797
|
+
itemSizes = new Array(count);
|
|
6798
|
+
offsets = new Array(count);
|
|
6799
|
+
totalSize = 0;
|
|
6800
|
+
for (let index = 0; index < count; index++) {
|
|
6801
|
+
offsets[index] = totalSize;
|
|
6802
|
+
const key = getItemKey(index);
|
|
6803
|
+
let size = cache.get(index);
|
|
6804
|
+
if (size == null && key != null) {
|
|
6805
|
+
size = heightCacheByKey.get(key);
|
|
6806
|
+
}
|
|
6807
|
+
if (size == null) {
|
|
6808
|
+
const estimate = estimateSize(index);
|
|
6809
|
+
size = normalizeVirtualSize(estimate);
|
|
6810
|
+
} else {
|
|
6811
|
+
size = normalizeVirtualSize(size);
|
|
6812
|
+
}
|
|
6813
|
+
itemSizes[index] = size;
|
|
6814
|
+
totalSize += size;
|
|
6482
6815
|
}
|
|
6483
|
-
|
|
6484
|
-
|
|
6816
|
+
}
|
|
6817
|
+
if (prefixSumCache) {
|
|
6818
|
+
prefixSumCache.count = count;
|
|
6819
|
+
prefixSumCache.itemSizes = itemSizes;
|
|
6820
|
+
prefixSumCache.offsets = offsets;
|
|
6821
|
+
prefixSumCache.totalSize = totalSize;
|
|
6485
6822
|
}
|
|
6486
6823
|
const viewportActive = clientHeight > 0;
|
|
6487
6824
|
const scrollOffset = viewportActive ? Math.min(scrollTop, Math.max(totalSize - clientHeight, 0)) : 0;
|
|
@@ -6489,19 +6826,28 @@ var computeVirtualizedRows = (config) => {
|
|
|
6489
6826
|
let visibleStartIndex = 0;
|
|
6490
6827
|
let visibleEndIndex = 0;
|
|
6491
6828
|
if (viewportActive && totalSize > 0) {
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6829
|
+
let low = 0;
|
|
6830
|
+
let high = count - 1;
|
|
6831
|
+
while (low < high) {
|
|
6832
|
+
const mid = Math.floor((low + high) / 2);
|
|
6833
|
+
if (offsets[mid] + itemSizes[mid] > scrollOffset) {
|
|
6834
|
+
high = mid;
|
|
6835
|
+
} else {
|
|
6836
|
+
low = mid + 1;
|
|
6496
6837
|
}
|
|
6497
6838
|
}
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6839
|
+
visibleStartIndex = low;
|
|
6840
|
+
low = visibleStartIndex;
|
|
6841
|
+
high = count - 1;
|
|
6842
|
+
while (low < high) {
|
|
6843
|
+
const mid = Math.ceil((low + high) / 2);
|
|
6844
|
+
if (offsets[mid] >= viewportLimit) {
|
|
6845
|
+
high = mid - 1;
|
|
6846
|
+
} else {
|
|
6847
|
+
low = mid;
|
|
6502
6848
|
}
|
|
6503
|
-
visibleEndIndex = index;
|
|
6504
6849
|
}
|
|
6850
|
+
visibleEndIndex = Math.max(visibleStartIndex, low);
|
|
6505
6851
|
}
|
|
6506
6852
|
const overScanCount = Math.max(0, Math.ceil(overScan));
|
|
6507
6853
|
const startIndex = Math.max(0, visibleStartIndex - overScanCount);
|
|
@@ -6563,7 +6909,7 @@ function SimpleTable({
|
|
|
6563
6909
|
getRowExpandable,
|
|
6564
6910
|
onExpandedChange,
|
|
6565
6911
|
onLazyScrollLoad,
|
|
6566
|
-
scrollLoadThreshold =
|
|
6912
|
+
scrollLoadThreshold = 42,
|
|
6567
6913
|
numberOfPageButtons = 5,
|
|
6568
6914
|
onClickExport,
|
|
6569
6915
|
baseRowEstimateSize = 42,
|
|
@@ -6577,7 +6923,7 @@ function SimpleTable({
|
|
|
6577
6923
|
manualFiltering = false,
|
|
6578
6924
|
lazyLoadIndicatorType = "overlay",
|
|
6579
6925
|
maxHeight = 500,
|
|
6580
|
-
maxWidth
|
|
6926
|
+
maxWidth,
|
|
6581
6927
|
maxRecords,
|
|
6582
6928
|
loadingText,
|
|
6583
6929
|
pagingPosition = "right",
|
|
@@ -6648,6 +6994,10 @@ function SimpleTable({
|
|
|
6648
6994
|
if (typeof maxRecords === "number" && data.length >= maxRecords) return;
|
|
6649
6995
|
void handleLazyLoad();
|
|
6650
6996
|
}, [recordPerChunk, data.length, handleLazyLoad, chunkCount, maxRecords]);
|
|
6997
|
+
const onLoadChunkRef = useRef(onLoadChunk);
|
|
6998
|
+
useEffect(() => {
|
|
6999
|
+
onLoadChunkRef.current = onLoadChunk;
|
|
7000
|
+
}, [onLoadChunk]);
|
|
6651
7001
|
const rows = useMemo(
|
|
6652
7002
|
() => table.getRowModel().rows,
|
|
6653
7003
|
[paginationState, sorting, columnFilters]
|
|
@@ -6689,7 +7039,7 @@ function SimpleTable({
|
|
|
6689
7039
|
rafRef.current = null;
|
|
6690
7040
|
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
6691
7041
|
if (scrollHeight - (scrollTop + clientHeight) <= scrollLoadThreshold && scrollTop !== 0 && scrollHeight > clientHeight) {
|
|
6692
|
-
|
|
7042
|
+
onLoadChunkRef.current();
|
|
6693
7043
|
}
|
|
6694
7044
|
});
|
|
6695
7045
|
};
|
|
@@ -6702,7 +7052,7 @@ function SimpleTable({
|
|
|
6702
7052
|
rafRef.current = null;
|
|
6703
7053
|
}
|
|
6704
7054
|
};
|
|
6705
|
-
}, [scrollLoadThreshold,
|
|
7055
|
+
}, [scrollLoadThreshold, virtualizationActive]);
|
|
6706
7056
|
useEffect(() => {
|
|
6707
7057
|
if (virtualizationActive) return;
|
|
6708
7058
|
if (table.getState().pagination.pageIndex === 0) {
|
|
@@ -6711,23 +7061,10 @@ function SimpleTable({
|
|
|
6711
7061
|
}, [virtualizationActive]);
|
|
6712
7062
|
useEffect(() => {
|
|
6713
7063
|
if (!virtualItems.length || !virtualizationActive) return;
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
if (paddingBottom <= scrollLoadThreshold) {
|
|
6719
|
-
onLoadChunk();
|
|
6720
|
-
}
|
|
6721
|
-
});
|
|
6722
|
-
};
|
|
6723
|
-
scheduleCheck();
|
|
6724
|
-
return () => {
|
|
6725
|
-
if (rafRef.current != null) {
|
|
6726
|
-
cancelAnimationFrame(rafRef.current);
|
|
6727
|
-
rafRef.current = null;
|
|
6728
|
-
}
|
|
6729
|
-
};
|
|
6730
|
-
}, [paddingBottom]);
|
|
7064
|
+
if (paddingBottom <= scrollLoadThreshold) {
|
|
7065
|
+
onLoadChunkRef.current();
|
|
7066
|
+
}
|
|
7067
|
+
}, [paddingBottom, scrollLoadThreshold, virtualizationActive]);
|
|
6731
7068
|
const columnCount = table.getAllLeafColumns().length;
|
|
6732
7069
|
useEffect(() => {
|
|
6733
7070
|
if (!selectable || !onSelectionChange) return;
|
|
@@ -10082,8 +10419,9 @@ function SimpleCarousel({
|
|
|
10082
10419
|
}
|
|
10083
10420
|
),
|
|
10084
10421
|
showDots && /* @__PURE__ */ jsx("div", { className: "flex justify-center space-x-2 mt-4", children: Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsx(
|
|
10085
|
-
|
|
10422
|
+
Button,
|
|
10086
10423
|
{
|
|
10424
|
+
variant: "ghost",
|
|
10087
10425
|
className: cn(
|
|
10088
10426
|
"h-2 w-2 rounded-full transition-colors",
|
|
10089
10427
|
current === index + 1 ? "bg-primary" : "bg-primary/20 hover:bg-primary/40"
|
|
@@ -10261,6 +10599,6 @@ var TypographyGroup = {
|
|
|
10261
10599
|
// src/index.ts
|
|
10262
10600
|
init_utils();
|
|
10263
10601
|
|
|
10264
|
-
export { Accordion, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AspectRatio, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Blockquote, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapsible, CollapsibleContent, CollapsibleItem, CollapsibleTrigger, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DatePicker, DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DotsSpinner, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, Field, Form, FormItem, FormList, H1, H2, H3, H4, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, InlineCode, Input, InputGroup, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item9 as Item, ItemGroup, ItemList, ItemSeparator, Label, Lead, List3 as List, ListItem, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Muted, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, P, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProductCard, ProfileCard, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator5 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, SimpleAvatar, SimpleCard, SimpleCarousel, SimpleTable, SimpleTabs, SimpleTooltip, Skeleton, SkeletonCard, Slider, Small, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, TypographyGroup, alertVariants, avatarVariants, badgeVariants, buttonVariants, cardVariants, checkboxVariants, cn, composeRules, emailRule, emptyVariants, fieldVariants, getInitials, inputGroupVariants, inputVariants, itemVariants, labelVariants, maxLengthRule, maxValueRule, minLengthRule, minValueRule, navigationMenuTriggerStyle, numberRule, patternRule, progressVariants, radioGroupVariants, requiredRule, separatorVariants, skeletonVariants, spinnerVariants, tableVariants, textareaVariants, toastVariants, toggleGroupVariants, toggleVariants, urlRule, useCarousel, useForm, useSidebar, useToast, useWatch };
|
|
10602
|
+
export { Accordion, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AspectRatio, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Blockquote, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapsible, CollapsibleContent, CollapsibleItem, CollapsibleTrigger, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DatePicker, DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DotsSpinner, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, Field, Form, FormItem, FormList, H1, H2, H3, H4, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, InlineCode, Input, InputGroup, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item9 as Item, ItemGroup, ItemList, ItemSeparator, Label, Lead, List3 as List, ListItem, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Muted, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, P, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProductCard, ProfileCard, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator5 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SimpleAvatar, SimpleCard, SimpleCarousel, SimpleTable, SimpleTabs, SimpleTooltip, Skeleton, SkeletonCard, Slider, Small, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, TypographyGroup, alertVariants, avatarVariants, badgeVariants, buttonVariants, cardVariants, checkboxVariants, cn, composeRules, emailRule, emptyVariants, fieldVariants, getInitials, inputGroupVariants, inputVariants, itemVariants, labelVariants, maxLengthRule, maxValueRule, minLengthRule, minValueRule, navigationMenuTriggerStyle, numberRule, patternRule, progressVariants, radioGroupVariants, requiredRule, separatorVariants, skeletonVariants, spinnerVariants, tableVariants, textareaVariants, toastVariants, toggleGroupVariants, toggleVariants, urlRule, useCarousel, useForm, useSidebar, useToast, useWatch };
|
|
10265
10603
|
//# sourceMappingURL=index.mjs.map
|
|
10266
10604
|
//# sourceMappingURL=index.mjs.map
|