@sustaina/shared-ui 1.11.0 → 1.12.0
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.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +253 -216
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +137 -100
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
|
2
2
|
import clsx2, { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
5
|
+
import * as React4 from 'react';
|
|
6
|
+
import React4__default, { forwardRef, useRef, useMemo, useCallback, isValidElement, useState, useEffect, createElement } from 'react';
|
|
7
7
|
import { format, isValid, parseISO, isAfter, compareAsc, parse } from 'date-fns';
|
|
8
8
|
import { CircleX, CircleHelp, Undo, Redo, Bold, Italic, Underline, Strikethrough, Code, Pilcrow, Heading1, Heading2, Heading3, List as List$1, ListOrdered, Quote, CodeSquare, Link, Link2Off, Image as Image$1, AlignLeft, AlignCenter, AlignRight, XIcon, ChevronRight, CheckIcon, Triangle, CalendarIcon, X, Search, ChevronUp, ChevronDown, Plus, ChevronLeft, CircleUserRound, PanelLeftIcon, Bug, GripVertical, Info, CircleMinus, Minus } from 'lucide-react';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
@@ -940,7 +940,7 @@ var OPERATOR_LABEL = {
|
|
|
940
940
|
containsAll: "Contains all of"
|
|
941
941
|
};
|
|
942
942
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
943
|
-
|
|
943
|
+
React4__default.useEffect(() => {
|
|
944
944
|
if (!operators.length) return;
|
|
945
945
|
if (!operators.includes(row.operator)) {
|
|
946
946
|
onChangeOperator(operators[0]);
|
|
@@ -975,15 +975,15 @@ function Label2({ className, ...props }) {
|
|
|
975
975
|
);
|
|
976
976
|
}
|
|
977
977
|
var Form = FormProvider;
|
|
978
|
-
var FormFieldContext =
|
|
978
|
+
var FormFieldContext = React4.createContext({});
|
|
979
979
|
var FormField = ({
|
|
980
980
|
...props
|
|
981
981
|
}) => {
|
|
982
982
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
983
983
|
};
|
|
984
984
|
var useFormField = () => {
|
|
985
|
-
const fieldContext =
|
|
986
|
-
const itemContext =
|
|
985
|
+
const fieldContext = React4.useContext(FormFieldContext);
|
|
986
|
+
const itemContext = React4.useContext(FormItemContext);
|
|
987
987
|
const { getFieldState } = useFormContext();
|
|
988
988
|
const formState = useFormState({ name: fieldContext.name });
|
|
989
989
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1000,18 +1000,17 @@ var useFormField = () => {
|
|
|
1000
1000
|
...fieldState
|
|
1001
1001
|
};
|
|
1002
1002
|
};
|
|
1003
|
-
var FormItemContext =
|
|
1003
|
+
var FormItemContext = React4.createContext({});
|
|
1004
1004
|
function FormItem({ className, ...props }) {
|
|
1005
|
-
const id =
|
|
1005
|
+
const id = React4.useId();
|
|
1006
1006
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1007
1007
|
}
|
|
1008
1008
|
function FormLabel({ className, ...props }) {
|
|
1009
|
-
const {
|
|
1009
|
+
const { formItemId } = useFormField();
|
|
1010
1010
|
return /* @__PURE__ */ jsx(
|
|
1011
1011
|
Label2,
|
|
1012
1012
|
{
|
|
1013
1013
|
"data-slot": "form-label",
|
|
1014
|
-
"data-error": !!error,
|
|
1015
1014
|
className: cn("data-[error=true]:text-destructive", className),
|
|
1016
1015
|
htmlFor: formItemId,
|
|
1017
1016
|
...props
|
|
@@ -1061,23 +1060,6 @@ function FormMessage({ className, ...props }) {
|
|
|
1061
1060
|
}
|
|
1062
1061
|
);
|
|
1063
1062
|
}
|
|
1064
|
-
var InputPrimitive = React5.forwardRef(
|
|
1065
|
-
({ className, type = "text", ...props }, ref) => {
|
|
1066
|
-
return /* @__PURE__ */ jsx(
|
|
1067
|
-
"input",
|
|
1068
|
-
{
|
|
1069
|
-
ref,
|
|
1070
|
-
type,
|
|
1071
|
-
className: cn(
|
|
1072
|
-
"placeholder:text-neutral-400 text-neutral-900 flex h-10 w-full min-w-0 items-center rounded-lg border bg-white px-4 text-sm transition-colors outline-none file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:px-2 file:text-sm file:font-medium hover:border-neutral-500 focus-visible:border-neutral-900 focus-visible:ring-0 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-400 disabled:border-neutral-200 aria-invalid:border-destructive",
|
|
1073
|
-
className
|
|
1074
|
-
),
|
|
1075
|
-
...props
|
|
1076
|
-
}
|
|
1077
|
-
);
|
|
1078
|
-
}
|
|
1079
|
-
);
|
|
1080
|
-
InputPrimitive.displayName = "InputPrimitive";
|
|
1081
1063
|
var spinnerVariants = cva("relative inline-block aspect-square transform-gpu", {
|
|
1082
1064
|
variants: {
|
|
1083
1065
|
variant: {
|
|
@@ -1124,6 +1106,23 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
1124
1106
|
]
|
|
1125
1107
|
}
|
|
1126
1108
|
);
|
|
1109
|
+
var InputPrimitive = React4.forwardRef(
|
|
1110
|
+
({ className, type = "text", ...props }, ref) => {
|
|
1111
|
+
return /* @__PURE__ */ jsx(
|
|
1112
|
+
"input",
|
|
1113
|
+
{
|
|
1114
|
+
ref,
|
|
1115
|
+
type,
|
|
1116
|
+
className: cn(
|
|
1117
|
+
"placeholder:text-neutral-400 text-neutral-900 flex h-10 w-full min-w-0 items-center rounded-lg border bg-white px-4 text-sm transition-colors outline-none file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:px-2 file:text-sm file:font-medium hover:border-neutral-500 focus-visible:border-neutral-900 focus-visible:ring-0 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-400 disabled:border-neutral-200 aria-invalid:border-destructive",
|
|
1118
|
+
className
|
|
1119
|
+
),
|
|
1120
|
+
...props
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
}
|
|
1124
|
+
);
|
|
1125
|
+
InputPrimitive.displayName = "InputPrimitive";
|
|
1127
1126
|
var inputVariants = cva("", {
|
|
1128
1127
|
variants: {
|
|
1129
1128
|
controlSize: {
|
|
@@ -1146,7 +1145,7 @@ var inputVariants = cva("", {
|
|
|
1146
1145
|
appearance: "filled"
|
|
1147
1146
|
}
|
|
1148
1147
|
});
|
|
1149
|
-
var Input =
|
|
1148
|
+
var Input = React4.forwardRef(
|
|
1150
1149
|
({
|
|
1151
1150
|
className,
|
|
1152
1151
|
wrapperClassName,
|
|
@@ -1155,14 +1154,17 @@ var Input = React5.forwardRef(
|
|
|
1155
1154
|
appearance,
|
|
1156
1155
|
prefix,
|
|
1157
1156
|
prefixProps,
|
|
1157
|
+
prefixInteractive,
|
|
1158
1158
|
suffix,
|
|
1159
1159
|
suffixProps,
|
|
1160
|
+
suffixInteractive,
|
|
1160
1161
|
invalid,
|
|
1161
1162
|
loading,
|
|
1162
1163
|
loadingIcon,
|
|
1163
1164
|
validationMessage,
|
|
1164
1165
|
validationIcon,
|
|
1165
1166
|
validationMessageProps,
|
|
1167
|
+
onValueChange,
|
|
1166
1168
|
type = "text",
|
|
1167
1169
|
...rest
|
|
1168
1170
|
}, ref) => {
|
|
@@ -1172,10 +1174,18 @@ var Input = React5.forwardRef(
|
|
|
1172
1174
|
const {
|
|
1173
1175
|
"aria-invalid": ariaInvalidProp,
|
|
1174
1176
|
"aria-describedby": ariaDescribedByProp,
|
|
1177
|
+
onChange: onChangeProp,
|
|
1175
1178
|
...inputProps
|
|
1176
1179
|
} = rest;
|
|
1177
1180
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
1178
|
-
const messageId =
|
|
1181
|
+
const messageId = React4.useId();
|
|
1182
|
+
const handleChange = React4.useCallback(
|
|
1183
|
+
(event) => {
|
|
1184
|
+
onChangeProp?.(event);
|
|
1185
|
+
onValueChange?.(event.target.value);
|
|
1186
|
+
},
|
|
1187
|
+
[onChangeProp, onValueChange]
|
|
1188
|
+
);
|
|
1179
1189
|
const resolvedAriaInvalid = typeof ariaInvalid === "string" ? ariaInvalid : ariaInvalid ? true : void 0;
|
|
1180
1190
|
const describedBy = validationMessage ? [ariaDescribedByProp, messageId].filter(Boolean).join(" ") : ariaDescribedByProp;
|
|
1181
1191
|
const controlWrapperClassName = cn(
|
|
@@ -1197,6 +1207,7 @@ var Input = React5.forwardRef(
|
|
|
1197
1207
|
),
|
|
1198
1208
|
"aria-invalid": resolvedAriaInvalid,
|
|
1199
1209
|
"aria-describedby": describedBy || void 0,
|
|
1210
|
+
onChange: handleChange,
|
|
1200
1211
|
...inputProps
|
|
1201
1212
|
}
|
|
1202
1213
|
);
|
|
@@ -1216,7 +1227,8 @@ var Input = React5.forwardRef(
|
|
|
1216
1227
|
{
|
|
1217
1228
|
...prefixRest,
|
|
1218
1229
|
className: cn(
|
|
1219
|
-
"
|
|
1230
|
+
"absolute left-3 top-1/2 -translate-y-1/2 inline-flex items-center text-muted-foreground",
|
|
1231
|
+
!prefixInteractive && "pointer-events-none",
|
|
1220
1232
|
prefixClassName
|
|
1221
1233
|
),
|
|
1222
1234
|
children: prefix
|
|
@@ -1228,7 +1240,8 @@ var Input = React5.forwardRef(
|
|
|
1228
1240
|
{
|
|
1229
1241
|
...suffixRest,
|
|
1230
1242
|
className: cn(
|
|
1231
|
-
"
|
|
1243
|
+
"absolute right-3 top-1/2 -translate-y-1/2 inline-flex items-center gap-2 text-muted-foreground",
|
|
1244
|
+
!suffixInteractive && "pointer-events-none",
|
|
1232
1245
|
suffixClassName
|
|
1233
1246
|
),
|
|
1234
1247
|
children: suffixContent
|
|
@@ -1491,20 +1504,20 @@ function DatePicker({
|
|
|
1491
1504
|
className,
|
|
1492
1505
|
...props
|
|
1493
1506
|
}) {
|
|
1494
|
-
const today =
|
|
1495
|
-
const [displayed, setDisplayed] =
|
|
1507
|
+
const today = React4.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1508
|
+
const [displayed, setDisplayed] = React4.useState(
|
|
1496
1509
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
1497
1510
|
);
|
|
1498
1511
|
minDate = clampToDay(minDate);
|
|
1499
1512
|
maxDate = clampToDay(maxDate);
|
|
1500
|
-
const disabledSet =
|
|
1513
|
+
const disabledSet = React4.useMemo(() => {
|
|
1501
1514
|
const s = /* @__PURE__ */ new Set();
|
|
1502
1515
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
1503
1516
|
return s;
|
|
1504
1517
|
}, [disabledDates]);
|
|
1505
1518
|
const displayYear = displayed.getFullYear();
|
|
1506
1519
|
const displayMonth = displayed.getMonth();
|
|
1507
|
-
const weekdays =
|
|
1520
|
+
const weekdays = React4.useMemo(() => {
|
|
1508
1521
|
const labels = [];
|
|
1509
1522
|
for (let i = 0; i < 7; i++) {
|
|
1510
1523
|
const idx = i;
|
|
@@ -1513,7 +1526,7 @@ function DatePicker({
|
|
|
1513
1526
|
}
|
|
1514
1527
|
return labels;
|
|
1515
1528
|
}, [callbacks]);
|
|
1516
|
-
const grid =
|
|
1529
|
+
const grid = React4.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
1517
1530
|
const isDateDisabled = (date) => {
|
|
1518
1531
|
const d = startOfDay(date);
|
|
1519
1532
|
if (minDate && d < minDate) return true;
|
|
@@ -1523,7 +1536,7 @@ function DatePicker({
|
|
|
1523
1536
|
};
|
|
1524
1537
|
const minYear = minDate?.getFullYear();
|
|
1525
1538
|
const maxYear = maxDate?.getFullYear();
|
|
1526
|
-
const getMonthLabel =
|
|
1539
|
+
const getMonthLabel = React4.useCallback(
|
|
1527
1540
|
(year, monthIndex) => {
|
|
1528
1541
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
1529
1542
|
if (label === null || label === void 0) {
|
|
@@ -1533,7 +1546,7 @@ function DatePicker({
|
|
|
1533
1546
|
},
|
|
1534
1547
|
[callbacks]
|
|
1535
1548
|
);
|
|
1536
|
-
const getYearLabel =
|
|
1549
|
+
const getYearLabel = React4.useCallback(
|
|
1537
1550
|
(year) => {
|
|
1538
1551
|
const label = callbacks?.yearLabel?.(year);
|
|
1539
1552
|
if (label === null || label === void 0) return String(year);
|
|
@@ -1541,7 +1554,7 @@ function DatePicker({
|
|
|
1541
1554
|
},
|
|
1542
1555
|
[callbacks]
|
|
1543
1556
|
);
|
|
1544
|
-
const clampMonthToBounds =
|
|
1557
|
+
const clampMonthToBounds = React4.useCallback(
|
|
1545
1558
|
(year, monthIndex) => {
|
|
1546
1559
|
let output = monthIndex;
|
|
1547
1560
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -1556,7 +1569,7 @@ function DatePicker({
|
|
|
1556
1569
|
},
|
|
1557
1570
|
[maxDate, minDate, maxYear, minYear]
|
|
1558
1571
|
);
|
|
1559
|
-
const yearOptions =
|
|
1572
|
+
const yearOptions = React4.useMemo(() => {
|
|
1560
1573
|
const fallbackWindow = 50;
|
|
1561
1574
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
1562
1575
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -1577,7 +1590,7 @@ function DatePicker({
|
|
|
1577
1590
|
}
|
|
1578
1591
|
return years;
|
|
1579
1592
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
1580
|
-
const monthOptions =
|
|
1593
|
+
const monthOptions = React4.useMemo(() => {
|
|
1581
1594
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
1582
1595
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
1583
1596
|
return {
|
|
@@ -1596,7 +1609,7 @@ function DatePicker({
|
|
|
1596
1609
|
}
|
|
1597
1610
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
1598
1611
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
1599
|
-
const handleMonthSelect =
|
|
1612
|
+
const handleMonthSelect = React4.useCallback((nextValue) => {
|
|
1600
1613
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
1601
1614
|
if (Number.isNaN(nextMonth)) return;
|
|
1602
1615
|
setDisplayed((prev) => {
|
|
@@ -1606,7 +1619,7 @@ function DatePicker({
|
|
|
1606
1619
|
return next;
|
|
1607
1620
|
});
|
|
1608
1621
|
}, []);
|
|
1609
|
-
const handleYearSelect =
|
|
1622
|
+
const handleYearSelect = React4.useCallback(
|
|
1610
1623
|
(nextValue) => {
|
|
1611
1624
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
1612
1625
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -1754,14 +1767,14 @@ var DatePicker2 = ({
|
|
|
1754
1767
|
ariaLabel,
|
|
1755
1768
|
...calendarProps
|
|
1756
1769
|
}) => {
|
|
1757
|
-
const [open, setOpen] =
|
|
1758
|
-
const parser =
|
|
1759
|
-
const outputFormatter =
|
|
1760
|
-
const labelFormatter =
|
|
1770
|
+
const [open, setOpen] = React4__default.useState(false);
|
|
1771
|
+
const parser = React4__default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
1772
|
+
const outputFormatter = React4__default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
1773
|
+
const labelFormatter = React4__default.useMemo(
|
|
1761
1774
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
1762
1775
|
[displayFormatter]
|
|
1763
1776
|
);
|
|
1764
|
-
const parsedValue =
|
|
1777
|
+
const parsedValue = React4__default.useMemo(() => {
|
|
1765
1778
|
if (value === null || value === void 0) return void 0;
|
|
1766
1779
|
if (value instanceof Date) return value;
|
|
1767
1780
|
const parsed = parser(value);
|
|
@@ -1770,26 +1783,26 @@ var DatePicker2 = ({
|
|
|
1770
1783
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
|
|
1771
1784
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
1772
1785
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
1773
|
-
const handleClose =
|
|
1774
|
-
const emitChange =
|
|
1786
|
+
const handleClose = React4__default.useCallback(() => setOpen(false), []);
|
|
1787
|
+
const emitChange = React4__default.useCallback(
|
|
1775
1788
|
(next) => {
|
|
1776
1789
|
onChange?.(next);
|
|
1777
1790
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
1778
1791
|
},
|
|
1779
1792
|
[onChange, onValueChange, outputFormatter]
|
|
1780
1793
|
);
|
|
1781
|
-
const handleSelect =
|
|
1794
|
+
const handleSelect = React4__default.useCallback(
|
|
1782
1795
|
(next) => {
|
|
1783
1796
|
emitChange(next);
|
|
1784
1797
|
if (closeOnSelect && next) handleClose();
|
|
1785
1798
|
},
|
|
1786
1799
|
[closeOnSelect, emitChange, handleClose]
|
|
1787
1800
|
);
|
|
1788
|
-
const handleClear =
|
|
1801
|
+
const handleClear = React4__default.useCallback(() => {
|
|
1789
1802
|
emitChange(void 0);
|
|
1790
1803
|
handleClose();
|
|
1791
1804
|
}, [emitChange, handleClose]);
|
|
1792
|
-
const handleOpenChange =
|
|
1805
|
+
const handleOpenChange = React4__default.useCallback(
|
|
1793
1806
|
(nextOpen) => {
|
|
1794
1807
|
if (disabled && nextOpen) return;
|
|
1795
1808
|
setOpen(nextOpen);
|
|
@@ -1961,15 +1974,15 @@ function MonthCal({
|
|
|
1961
1974
|
onYearBackward,
|
|
1962
1975
|
onYearForward
|
|
1963
1976
|
}) {
|
|
1964
|
-
const today =
|
|
1977
|
+
const today = React4.useMemo(() => {
|
|
1965
1978
|
const now = /* @__PURE__ */ new Date();
|
|
1966
1979
|
now.setDate(1);
|
|
1967
1980
|
now.setHours(0, 0, 0, 0);
|
|
1968
1981
|
return now;
|
|
1969
1982
|
}, []);
|
|
1970
|
-
const selectedMonthDate =
|
|
1971
|
-
const min =
|
|
1972
|
-
const max =
|
|
1983
|
+
const selectedMonthDate = React4.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
1984
|
+
const min = React4.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
1985
|
+
const max = React4.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
1973
1986
|
let effectiveMin = min;
|
|
1974
1987
|
if (min && max && min > max) {
|
|
1975
1988
|
effectiveMin = max;
|
|
@@ -1978,10 +1991,10 @@ function MonthCal({
|
|
|
1978
1991
|
const minMonth = effectiveMin?.getMonth();
|
|
1979
1992
|
const maxYear = max?.getFullYear();
|
|
1980
1993
|
const maxMonth = max?.getMonth();
|
|
1981
|
-
const [menuYear, setMenuYear] =
|
|
1994
|
+
const [menuYear, setMenuYear] = React4.useState(
|
|
1982
1995
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
1983
1996
|
);
|
|
1984
|
-
|
|
1997
|
+
React4.useEffect(() => {
|
|
1985
1998
|
if (selectedMonthDate) {
|
|
1986
1999
|
const year = selectedMonthDate.getFullYear();
|
|
1987
2000
|
if (year !== menuYear) {
|
|
@@ -1989,7 +2002,7 @@ function MonthCal({
|
|
|
1989
2002
|
}
|
|
1990
2003
|
}
|
|
1991
2004
|
}, [selectedMonthDate, menuYear]);
|
|
1992
|
-
|
|
2005
|
+
React4.useEffect(() => {
|
|
1993
2006
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
1994
2007
|
setMenuYear(minYear);
|
|
1995
2008
|
return;
|
|
@@ -2000,7 +2013,7 @@ function MonthCal({
|
|
|
2000
2013
|
}, [minYear, maxYear, menuYear]);
|
|
2001
2014
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
2002
2015
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
2003
|
-
const yearOptions =
|
|
2016
|
+
const yearOptions = React4.useMemo(() => {
|
|
2004
2017
|
const fallbackWindow = 50;
|
|
2005
2018
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
2006
2019
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -2014,7 +2027,7 @@ function MonthCal({
|
|
|
2014
2027
|
}
|
|
2015
2028
|
return years;
|
|
2016
2029
|
}, [maxYear, menuYear, minYear]);
|
|
2017
|
-
const formatYearLabel =
|
|
2030
|
+
const formatYearLabel = React4.useCallback(
|
|
2018
2031
|
(year) => {
|
|
2019
2032
|
const raw = callbacks?.yearLabel?.(year);
|
|
2020
2033
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -2022,7 +2035,7 @@ function MonthCal({
|
|
|
2022
2035
|
},
|
|
2023
2036
|
[callbacks]
|
|
2024
2037
|
);
|
|
2025
|
-
const handleYearSelect =
|
|
2038
|
+
const handleYearSelect = React4.useCallback(
|
|
2026
2039
|
(nextValue) => {
|
|
2027
2040
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
2028
2041
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -2032,7 +2045,7 @@ function MonthCal({
|
|
|
2032
2045
|
},
|
|
2033
2046
|
[maxYear, minYear]
|
|
2034
2047
|
);
|
|
2035
|
-
const disabledPairs =
|
|
2048
|
+
const disabledPairs = React4.useMemo(() => {
|
|
2036
2049
|
if (!disabledDates?.length) return [];
|
|
2037
2050
|
const pairs = [];
|
|
2038
2051
|
disabledDates.forEach((date) => {
|
|
@@ -2177,14 +2190,14 @@ var MonthPicker2 = ({
|
|
|
2177
2190
|
ariaLabel,
|
|
2178
2191
|
...calendarProps
|
|
2179
2192
|
}) => {
|
|
2180
|
-
const [open, setOpen] =
|
|
2181
|
-
const parser =
|
|
2182
|
-
const outputFormatter =
|
|
2183
|
-
const labelFormatter =
|
|
2193
|
+
const [open, setOpen] = React4__default.useState(false);
|
|
2194
|
+
const parser = React4__default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
2195
|
+
const outputFormatter = React4__default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
2196
|
+
const labelFormatter = React4__default.useMemo(
|
|
2184
2197
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
2185
2198
|
[displayFormatter]
|
|
2186
2199
|
);
|
|
2187
|
-
const parsedValue =
|
|
2200
|
+
const parsedValue = React4__default.useMemo(() => {
|
|
2188
2201
|
if (value === null || value === void 0) return void 0;
|
|
2189
2202
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
2190
2203
|
if (typeof value === "string") {
|
|
@@ -2196,8 +2209,8 @@ var MonthPicker2 = ({
|
|
|
2196
2209
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
|
|
2197
2210
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
2198
2211
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
2199
|
-
const handleClose =
|
|
2200
|
-
const emitChange =
|
|
2212
|
+
const handleClose = React4__default.useCallback(() => setOpen(false), []);
|
|
2213
|
+
const emitChange = React4__default.useCallback(
|
|
2201
2214
|
(next) => {
|
|
2202
2215
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
2203
2216
|
onChange?.(normalized);
|
|
@@ -2205,18 +2218,18 @@ var MonthPicker2 = ({
|
|
|
2205
2218
|
},
|
|
2206
2219
|
[onChange, onValueChange, outputFormatter]
|
|
2207
2220
|
);
|
|
2208
|
-
const handleSelect =
|
|
2221
|
+
const handleSelect = React4__default.useCallback(
|
|
2209
2222
|
(next) => {
|
|
2210
2223
|
emitChange(next);
|
|
2211
2224
|
if (closeOnSelect && next) handleClose();
|
|
2212
2225
|
},
|
|
2213
2226
|
[closeOnSelect, emitChange, handleClose]
|
|
2214
2227
|
);
|
|
2215
|
-
const handleClear =
|
|
2228
|
+
const handleClear = React4__default.useCallback(() => {
|
|
2216
2229
|
emitChange(void 0);
|
|
2217
2230
|
handleClose();
|
|
2218
2231
|
}, [emitChange, handleClose]);
|
|
2219
|
-
const handleOpenChange =
|
|
2232
|
+
const handleOpenChange = React4__default.useCallback(
|
|
2220
2233
|
(nextOpen) => {
|
|
2221
2234
|
if (disabled && nextOpen) return;
|
|
2222
2235
|
setOpen(nextOpen);
|
|
@@ -3276,7 +3289,7 @@ var AdvanceSearch = ({
|
|
|
3276
3289
|
defaultValues: {}
|
|
3277
3290
|
});
|
|
3278
3291
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
3279
|
-
const [operatorErrors, setOperatorErrors] =
|
|
3292
|
+
const [operatorErrors, setOperatorErrors] = React4__default.useState({});
|
|
3280
3293
|
const clearOperatorError = useCallback(
|
|
3281
3294
|
(rowId) => {
|
|
3282
3295
|
setOperatorErrors((prev) => {
|
|
@@ -3867,7 +3880,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
3867
3880
|
}
|
|
3868
3881
|
);
|
|
3869
3882
|
};
|
|
3870
|
-
var ColumnSeparator_default =
|
|
3883
|
+
var ColumnSeparator_default = React4__default.memo(ColumnSeparator);
|
|
3871
3884
|
var StatusContentSlot = ({
|
|
3872
3885
|
content,
|
|
3873
3886
|
icon,
|
|
@@ -3886,7 +3899,7 @@ var StatusContentSlot = ({
|
|
|
3886
3899
|
content
|
|
3887
3900
|
] });
|
|
3888
3901
|
};
|
|
3889
|
-
var StatusContentSlot_default =
|
|
3902
|
+
var StatusContentSlot_default = React4__default.memo(StatusContentSlot);
|
|
3890
3903
|
var stateOptions = [
|
|
3891
3904
|
"columnFilters",
|
|
3892
3905
|
"globalFilter",
|
|
@@ -4861,7 +4874,7 @@ function SortableRow({
|
|
|
4861
4874
|
id: value,
|
|
4862
4875
|
disabled: name === "columns.0.id"
|
|
4863
4876
|
});
|
|
4864
|
-
const style =
|
|
4877
|
+
const style = React4.useMemo(
|
|
4865
4878
|
() => ({
|
|
4866
4879
|
transform: CSS.Transform.toString(transform),
|
|
4867
4880
|
transition
|
|
@@ -5203,7 +5216,7 @@ var useGridSettingsStore = create(
|
|
|
5203
5216
|
);
|
|
5204
5217
|
var useGridSettingsStore_default = useGridSettingsStore;
|
|
5205
5218
|
var ListTable = ({ onTableReady, children }) => {
|
|
5206
|
-
|
|
5219
|
+
React4.useEffect(() => {
|
|
5207
5220
|
if (onTableReady) {
|
|
5208
5221
|
onTableReady({ ready: true });
|
|
5209
5222
|
}
|
|
@@ -5307,26 +5320,48 @@ var InfoIcon = (props) => {
|
|
|
5307
5320
|
return /* @__PURE__ */ jsxs(
|
|
5308
5321
|
"svg",
|
|
5309
5322
|
{
|
|
5310
|
-
width: "
|
|
5311
|
-
height: "
|
|
5312
|
-
viewBox: "0 0
|
|
5323
|
+
width: "20",
|
|
5324
|
+
height: "20",
|
|
5325
|
+
viewBox: "0 0 20 20",
|
|
5313
5326
|
fill: "none",
|
|
5314
5327
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5315
5328
|
...props,
|
|
5316
5329
|
children: [
|
|
5317
|
-
/* @__PURE__ */ jsx("circle", { cx: "6.98438", cy: "6.63281", r: "6.25", fill: "white" }),
|
|
5318
5330
|
/* @__PURE__ */ jsx(
|
|
5319
5331
|
"path",
|
|
5320
5332
|
{
|
|
5321
|
-
d: "
|
|
5322
|
-
|
|
5333
|
+
d: "M10.0013 18.3327C14.6037 18.3327 18.3346 14.6017 18.3346 9.99935C18.3346 5.39698 14.6037 1.66602 10.0013 1.66602C5.39893 1.66602 1.66797 5.39698 1.66797 9.99935C1.66797 14.6017 5.39893 18.3327 10.0013 18.3327Z",
|
|
5334
|
+
stroke: "white",
|
|
5335
|
+
"stroke-width": "1.5",
|
|
5336
|
+
"stroke-linecap": "round",
|
|
5337
|
+
"stroke-linejoin": "round"
|
|
5338
|
+
}
|
|
5339
|
+
),
|
|
5340
|
+
/* @__PURE__ */ jsx(
|
|
5341
|
+
"path",
|
|
5342
|
+
{
|
|
5343
|
+
d: "M10 13.3333V10",
|
|
5344
|
+
stroke: "white",
|
|
5345
|
+
"stroke-width": "1.5",
|
|
5346
|
+
"stroke-linecap": "round",
|
|
5347
|
+
"stroke-linejoin": "round"
|
|
5348
|
+
}
|
|
5349
|
+
),
|
|
5350
|
+
/* @__PURE__ */ jsx(
|
|
5351
|
+
"path",
|
|
5352
|
+
{
|
|
5353
|
+
d: "M10 6.66602H10.0083",
|
|
5354
|
+
stroke: "white",
|
|
5355
|
+
"stroke-width": "1.5",
|
|
5356
|
+
"stroke-linecap": "round",
|
|
5357
|
+
"stroke-linejoin": "round"
|
|
5323
5358
|
}
|
|
5324
5359
|
)
|
|
5325
5360
|
]
|
|
5326
5361
|
}
|
|
5327
5362
|
);
|
|
5328
5363
|
};
|
|
5329
|
-
var InfoIcon_default =
|
|
5364
|
+
var InfoIcon_default = React4__default.memo(InfoIcon);
|
|
5330
5365
|
var Navbar = ({
|
|
5331
5366
|
className,
|
|
5332
5367
|
title,
|
|
@@ -5457,7 +5492,7 @@ var Navbar = ({
|
|
|
5457
5492
|
}
|
|
5458
5493
|
);
|
|
5459
5494
|
};
|
|
5460
|
-
var navbar_default =
|
|
5495
|
+
var navbar_default = React4__default.memo(Navbar);
|
|
5461
5496
|
function Sheet({ ...props }) {
|
|
5462
5497
|
return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
5463
5498
|
}
|
|
@@ -6062,7 +6097,7 @@ function ToolbarPlugin({
|
|
|
6062
6097
|
isLink: hasLink
|
|
6063
6098
|
}));
|
|
6064
6099
|
}, []);
|
|
6065
|
-
|
|
6100
|
+
React4.useEffect(() => {
|
|
6066
6101
|
return mergeRegister(
|
|
6067
6102
|
editor.registerCommand(
|
|
6068
6103
|
CAN_UNDO_COMMAND,
|
|
@@ -6648,7 +6683,7 @@ function ControlledValuePlugin({
|
|
|
6648
6683
|
trackAppliedValue
|
|
6649
6684
|
}) {
|
|
6650
6685
|
const [editor] = useLexicalComposerContext();
|
|
6651
|
-
|
|
6686
|
+
React4.useEffect(() => {
|
|
6652
6687
|
if (value == null || trackAppliedValue.current === value) {
|
|
6653
6688
|
return;
|
|
6654
6689
|
}
|
|
@@ -6672,14 +6707,14 @@ function ControlledValuePlugin({
|
|
|
6672
6707
|
}
|
|
6673
6708
|
function EditableStatePlugin({ editable }) {
|
|
6674
6709
|
const [editor] = useLexicalComposerContext();
|
|
6675
|
-
|
|
6710
|
+
React4.useEffect(() => {
|
|
6676
6711
|
editor.setEditable(editable);
|
|
6677
6712
|
}, [editor, editable]);
|
|
6678
6713
|
return null;
|
|
6679
6714
|
}
|
|
6680
6715
|
function ImagesPlugin() {
|
|
6681
6716
|
const [editor] = useLexicalComposerContext();
|
|
6682
|
-
|
|
6717
|
+
React4.useEffect(() => {
|
|
6683
6718
|
return editor.registerCommand(
|
|
6684
6719
|
INSERT_IMAGE_COMMAND,
|
|
6685
6720
|
(payload) => {
|
|
@@ -6889,6 +6924,7 @@ __export(ui_exports, {
|
|
|
6889
6924
|
FormItem: () => FormItem,
|
|
6890
6925
|
FormLabel: () => FormLabel,
|
|
6891
6926
|
FormMessage: () => FormMessage,
|
|
6927
|
+
Input: () => Input,
|
|
6892
6928
|
InputPrimitive: () => InputPrimitive,
|
|
6893
6929
|
Label: () => Label2,
|
|
6894
6930
|
MonthPicker: () => MonthPicker,
|
|
@@ -6962,6 +6998,7 @@ __export(ui_exports, {
|
|
|
6962
6998
|
TooltipProvider: () => TooltipProvider2,
|
|
6963
6999
|
TooltipTrigger: () => TooltipTrigger2,
|
|
6964
7000
|
buttonVariants: () => buttonVariants,
|
|
7001
|
+
inputVariants: () => inputVariants,
|
|
6965
7002
|
spinnerVariants: () => spinnerVariants,
|
|
6966
7003
|
useFormField: () => useFormField,
|
|
6967
7004
|
useSidebar: () => useSidebar
|
|
@@ -7060,9 +7097,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
7060
7097
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
7061
7098
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
7062
7099
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
7063
|
-
var SidebarContext =
|
|
7100
|
+
var SidebarContext = React4.createContext(null);
|
|
7064
7101
|
function useSidebar() {
|
|
7065
|
-
const context =
|
|
7102
|
+
const context = React4.useContext(SidebarContext);
|
|
7066
7103
|
if (!context) {
|
|
7067
7104
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
7068
7105
|
}
|
|
@@ -7078,10 +7115,10 @@ function SidebarProvider({
|
|
|
7078
7115
|
...props
|
|
7079
7116
|
}) {
|
|
7080
7117
|
const isMobile = useIsMobile();
|
|
7081
|
-
const [openMobile, setOpenMobile] =
|
|
7082
|
-
const [_open, _setOpen] =
|
|
7118
|
+
const [openMobile, setOpenMobile] = React4.useState(false);
|
|
7119
|
+
const [_open, _setOpen] = React4.useState(defaultOpen);
|
|
7083
7120
|
const open = openProp ?? _open;
|
|
7084
|
-
const setOpen =
|
|
7121
|
+
const setOpen = React4.useCallback(
|
|
7085
7122
|
(value) => {
|
|
7086
7123
|
const openState = typeof value === "function" ? value(open) : value;
|
|
7087
7124
|
if (setOpenProp) {
|
|
@@ -7093,10 +7130,10 @@ function SidebarProvider({
|
|
|
7093
7130
|
},
|
|
7094
7131
|
[setOpenProp, open]
|
|
7095
7132
|
);
|
|
7096
|
-
const toggleSidebar =
|
|
7133
|
+
const toggleSidebar = React4.useCallback(() => {
|
|
7097
7134
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
7098
7135
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
7099
|
-
|
|
7136
|
+
React4.useEffect(() => {
|
|
7100
7137
|
const handleKeyDown = (event) => {
|
|
7101
7138
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
7102
7139
|
event.preventDefault();
|
|
@@ -7107,7 +7144,7 @@ function SidebarProvider({
|
|
|
7107
7144
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
7108
7145
|
}, [toggleSidebar]);
|
|
7109
7146
|
const state = open ? "expanded" : "collapsed";
|
|
7110
|
-
const contextValue =
|
|
7147
|
+
const contextValue = React4.useMemo(
|
|
7111
7148
|
() => ({
|
|
7112
7149
|
state,
|
|
7113
7150
|
open,
|
|
@@ -7549,7 +7586,7 @@ function SidebarMenuSkeleton({
|
|
|
7549
7586
|
showIcon = false,
|
|
7550
7587
|
...props
|
|
7551
7588
|
}) {
|
|
7552
|
-
const width =
|
|
7589
|
+
const width = React4.useMemo(() => {
|
|
7553
7590
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
7554
7591
|
}, []);
|
|
7555
7592
|
return /* @__PURE__ */ jsxs(
|