@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.js
CHANGED
|
@@ -4,7 +4,7 @@ var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
|
4
4
|
var clsx2 = require('clsx');
|
|
5
5
|
var tailwindMerge = require('tailwind-merge');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
7
|
+
var React4 = require('react');
|
|
8
8
|
var dateFns = require('date-fns');
|
|
9
9
|
var lucideReact = require('lucide-react');
|
|
10
10
|
var reactDom = require('react-dom');
|
|
@@ -73,7 +73,7 @@ function _interopNamespace(e) {
|
|
|
73
73
|
|
|
74
74
|
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
75
75
|
var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
|
|
76
|
-
var
|
|
76
|
+
var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
|
|
77
77
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
78
78
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
79
79
|
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
@@ -583,7 +583,7 @@ function AccordionContent({
|
|
|
583
583
|
);
|
|
584
584
|
}
|
|
585
585
|
var ExpandCollapse = ({ title, children, portalId }) => {
|
|
586
|
-
const [isOpen, setIsOpen] =
|
|
586
|
+
const [isOpen, setIsOpen] = React4.useState(false);
|
|
587
587
|
const Panel = /* @__PURE__ */ jsxRuntime.jsx(
|
|
588
588
|
"div",
|
|
589
589
|
{
|
|
@@ -677,31 +677,31 @@ function makeNewRow(field) {
|
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
679
|
function useAdvanceSearch({ fields, limitRows }) {
|
|
680
|
-
const [rows, setRows] =
|
|
681
|
-
const updateRows =
|
|
680
|
+
const [rows, setRows] = React4.useState([makeNewRow(fields[0])]);
|
|
681
|
+
const updateRows = React4.useCallback((next) => {
|
|
682
682
|
setRows(next);
|
|
683
683
|
}, []);
|
|
684
|
-
const operatorsForField =
|
|
684
|
+
const operatorsForField = React4.useCallback(
|
|
685
685
|
(fieldName) => {
|
|
686
686
|
const t = getFieldType(fields, fieldName);
|
|
687
687
|
return OPERATOR_MAP[t];
|
|
688
688
|
},
|
|
689
689
|
[fields]
|
|
690
690
|
);
|
|
691
|
-
const addRow =
|
|
691
|
+
const addRow = React4.useCallback(() => {
|
|
692
692
|
if (limitRows && rows.length >= limitRows) return;
|
|
693
693
|
const lastRow = rows[rows.length - 1];
|
|
694
694
|
const lastField = fields.find((f) => f.name === lastRow?.fieldName) ?? fields[0];
|
|
695
695
|
updateRows([...rows, makeNewRow(lastField)]);
|
|
696
696
|
}, [rows, fields, updateRows, limitRows]);
|
|
697
|
-
const removeRow =
|
|
697
|
+
const removeRow = React4.useCallback(
|
|
698
698
|
(id) => {
|
|
699
699
|
if (rows.length === 1) return;
|
|
700
700
|
updateRows(rows.filter((r) => r.id !== id));
|
|
701
701
|
},
|
|
702
702
|
[rows, updateRows]
|
|
703
703
|
);
|
|
704
|
-
const clearRow =
|
|
704
|
+
const clearRow = React4.useCallback(
|
|
705
705
|
(id) => {
|
|
706
706
|
updateRows(
|
|
707
707
|
rows.map((r) => {
|
|
@@ -730,10 +730,10 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
730
730
|
},
|
|
731
731
|
[rows, fields, updateRows]
|
|
732
732
|
);
|
|
733
|
-
const clearAllRow =
|
|
733
|
+
const clearAllRow = React4.useCallback(() => {
|
|
734
734
|
updateRows([makeNewRow(fields[0])]);
|
|
735
735
|
}, [fields, updateRows]);
|
|
736
|
-
const changeField =
|
|
736
|
+
const changeField = React4.useCallback(
|
|
737
737
|
(id, fieldName) => {
|
|
738
738
|
updateRows(
|
|
739
739
|
rows.map((r) => {
|
|
@@ -745,7 +745,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
745
745
|
},
|
|
746
746
|
[rows, fields, updateRows]
|
|
747
747
|
);
|
|
748
|
-
const changeOperator =
|
|
748
|
+
const changeOperator = React4.useCallback(
|
|
749
749
|
(id, operator) => {
|
|
750
750
|
updateRows(
|
|
751
751
|
rows.map((r) => {
|
|
@@ -776,7 +776,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
776
776
|
},
|
|
777
777
|
[rows, updateRows]
|
|
778
778
|
);
|
|
779
|
-
const changeValue =
|
|
779
|
+
const changeValue = React4.useCallback(
|
|
780
780
|
(id, which, val) => {
|
|
781
781
|
updateRows(
|
|
782
782
|
rows.map((r) => {
|
|
@@ -788,7 +788,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
788
788
|
},
|
|
789
789
|
[rows, updateRows]
|
|
790
790
|
);
|
|
791
|
-
const fieldOptions =
|
|
791
|
+
const fieldOptions = React4.useMemo(
|
|
792
792
|
() => fields.map((f) => ({
|
|
793
793
|
value: f.name,
|
|
794
794
|
label: f.label ?? f.name
|
|
@@ -976,7 +976,7 @@ var OPERATOR_LABEL = {
|
|
|
976
976
|
containsAll: "Contains all of"
|
|
977
977
|
};
|
|
978
978
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
979
|
-
|
|
979
|
+
React4__namespace.default.useEffect(() => {
|
|
980
980
|
if (!operators.length) return;
|
|
981
981
|
if (!operators.includes(row.operator)) {
|
|
982
982
|
onChangeOperator(operators[0]);
|
|
@@ -1011,15 +1011,15 @@ function Label2({ className, ...props }) {
|
|
|
1011
1011
|
);
|
|
1012
1012
|
}
|
|
1013
1013
|
var Form = reactHookForm.FormProvider;
|
|
1014
|
-
var FormFieldContext =
|
|
1014
|
+
var FormFieldContext = React4__namespace.createContext({});
|
|
1015
1015
|
var FormField = ({
|
|
1016
1016
|
...props
|
|
1017
1017
|
}) => {
|
|
1018
1018
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
1019
1019
|
};
|
|
1020
1020
|
var useFormField = () => {
|
|
1021
|
-
const fieldContext =
|
|
1022
|
-
const itemContext =
|
|
1021
|
+
const fieldContext = React4__namespace.useContext(FormFieldContext);
|
|
1022
|
+
const itemContext = React4__namespace.useContext(FormItemContext);
|
|
1023
1023
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
1024
1024
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
1025
1025
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1036,18 +1036,17 @@ var useFormField = () => {
|
|
|
1036
1036
|
...fieldState
|
|
1037
1037
|
};
|
|
1038
1038
|
};
|
|
1039
|
-
var FormItemContext =
|
|
1039
|
+
var FormItemContext = React4__namespace.createContext({});
|
|
1040
1040
|
function FormItem({ className, ...props }) {
|
|
1041
|
-
const id =
|
|
1041
|
+
const id = React4__namespace.useId();
|
|
1042
1042
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1043
1043
|
}
|
|
1044
1044
|
function FormLabel({ className, ...props }) {
|
|
1045
|
-
const {
|
|
1045
|
+
const { formItemId } = useFormField();
|
|
1046
1046
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1047
1047
|
Label2,
|
|
1048
1048
|
{
|
|
1049
1049
|
"data-slot": "form-label",
|
|
1050
|
-
"data-error": !!error,
|
|
1051
1050
|
className: cn("data-[error=true]:text-destructive", className),
|
|
1052
1051
|
htmlFor: formItemId,
|
|
1053
1052
|
...props
|
|
@@ -1097,23 +1096,6 @@ function FormMessage({ className, ...props }) {
|
|
|
1097
1096
|
}
|
|
1098
1097
|
);
|
|
1099
1098
|
}
|
|
1100
|
-
var InputPrimitive = React5__namespace.forwardRef(
|
|
1101
|
-
({ className, type = "text", ...props }, ref) => {
|
|
1102
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1103
|
-
"input",
|
|
1104
|
-
{
|
|
1105
|
-
ref,
|
|
1106
|
-
type,
|
|
1107
|
-
className: cn(
|
|
1108
|
-
"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",
|
|
1109
|
-
className
|
|
1110
|
-
),
|
|
1111
|
-
...props
|
|
1112
|
-
}
|
|
1113
|
-
);
|
|
1114
|
-
}
|
|
1115
|
-
);
|
|
1116
|
-
InputPrimitive.displayName = "InputPrimitive";
|
|
1117
1099
|
var spinnerVariants = classVarianceAuthority.cva("relative inline-block aspect-square transform-gpu", {
|
|
1118
1100
|
variants: {
|
|
1119
1101
|
variant: {
|
|
@@ -1160,6 +1142,23 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
1160
1142
|
]
|
|
1161
1143
|
}
|
|
1162
1144
|
);
|
|
1145
|
+
var InputPrimitive = React4__namespace.forwardRef(
|
|
1146
|
+
({ className, type = "text", ...props }, ref) => {
|
|
1147
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1148
|
+
"input",
|
|
1149
|
+
{
|
|
1150
|
+
ref,
|
|
1151
|
+
type,
|
|
1152
|
+
className: cn(
|
|
1153
|
+
"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",
|
|
1154
|
+
className
|
|
1155
|
+
),
|
|
1156
|
+
...props
|
|
1157
|
+
}
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
);
|
|
1161
|
+
InputPrimitive.displayName = "InputPrimitive";
|
|
1163
1162
|
var inputVariants = classVarianceAuthority.cva("", {
|
|
1164
1163
|
variants: {
|
|
1165
1164
|
controlSize: {
|
|
@@ -1182,7 +1181,7 @@ var inputVariants = classVarianceAuthority.cva("", {
|
|
|
1182
1181
|
appearance: "filled"
|
|
1183
1182
|
}
|
|
1184
1183
|
});
|
|
1185
|
-
var Input =
|
|
1184
|
+
var Input = React4__namespace.forwardRef(
|
|
1186
1185
|
({
|
|
1187
1186
|
className,
|
|
1188
1187
|
wrapperClassName,
|
|
@@ -1191,14 +1190,17 @@ var Input = React5__namespace.forwardRef(
|
|
|
1191
1190
|
appearance,
|
|
1192
1191
|
prefix,
|
|
1193
1192
|
prefixProps,
|
|
1193
|
+
prefixInteractive,
|
|
1194
1194
|
suffix,
|
|
1195
1195
|
suffixProps,
|
|
1196
|
+
suffixInteractive,
|
|
1196
1197
|
invalid,
|
|
1197
1198
|
loading,
|
|
1198
1199
|
loadingIcon,
|
|
1199
1200
|
validationMessage,
|
|
1200
1201
|
validationIcon,
|
|
1201
1202
|
validationMessageProps,
|
|
1203
|
+
onValueChange,
|
|
1202
1204
|
type = "text",
|
|
1203
1205
|
...rest
|
|
1204
1206
|
}, ref) => {
|
|
@@ -1208,10 +1210,18 @@ var Input = React5__namespace.forwardRef(
|
|
|
1208
1210
|
const {
|
|
1209
1211
|
"aria-invalid": ariaInvalidProp,
|
|
1210
1212
|
"aria-describedby": ariaDescribedByProp,
|
|
1213
|
+
onChange: onChangeProp,
|
|
1211
1214
|
...inputProps
|
|
1212
1215
|
} = rest;
|
|
1213
1216
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
1214
|
-
const messageId =
|
|
1217
|
+
const messageId = React4__namespace.useId();
|
|
1218
|
+
const handleChange = React4__namespace.useCallback(
|
|
1219
|
+
(event) => {
|
|
1220
|
+
onChangeProp?.(event);
|
|
1221
|
+
onValueChange?.(event.target.value);
|
|
1222
|
+
},
|
|
1223
|
+
[onChangeProp, onValueChange]
|
|
1224
|
+
);
|
|
1215
1225
|
const resolvedAriaInvalid = typeof ariaInvalid === "string" ? ariaInvalid : ariaInvalid ? true : void 0;
|
|
1216
1226
|
const describedBy = validationMessage ? [ariaDescribedByProp, messageId].filter(Boolean).join(" ") : ariaDescribedByProp;
|
|
1217
1227
|
const controlWrapperClassName = cn(
|
|
@@ -1233,6 +1243,7 @@ var Input = React5__namespace.forwardRef(
|
|
|
1233
1243
|
),
|
|
1234
1244
|
"aria-invalid": resolvedAriaInvalid,
|
|
1235
1245
|
"aria-describedby": describedBy || void 0,
|
|
1246
|
+
onChange: handleChange,
|
|
1236
1247
|
...inputProps
|
|
1237
1248
|
}
|
|
1238
1249
|
);
|
|
@@ -1252,7 +1263,8 @@ var Input = React5__namespace.forwardRef(
|
|
|
1252
1263
|
{
|
|
1253
1264
|
...prefixRest,
|
|
1254
1265
|
className: cn(
|
|
1255
|
-
"
|
|
1266
|
+
"absolute left-3 top-1/2 -translate-y-1/2 inline-flex items-center text-muted-foreground",
|
|
1267
|
+
!prefixInteractive && "pointer-events-none",
|
|
1256
1268
|
prefixClassName
|
|
1257
1269
|
),
|
|
1258
1270
|
children: prefix
|
|
@@ -1264,7 +1276,8 @@ var Input = React5__namespace.forwardRef(
|
|
|
1264
1276
|
{
|
|
1265
1277
|
...suffixRest,
|
|
1266
1278
|
className: cn(
|
|
1267
|
-
"
|
|
1279
|
+
"absolute right-3 top-1/2 -translate-y-1/2 inline-flex items-center gap-2 text-muted-foreground",
|
|
1280
|
+
!suffixInteractive && "pointer-events-none",
|
|
1268
1281
|
suffixClassName
|
|
1269
1282
|
),
|
|
1270
1283
|
children: suffixContent
|
|
@@ -1527,20 +1540,20 @@ function DatePicker({
|
|
|
1527
1540
|
className,
|
|
1528
1541
|
...props
|
|
1529
1542
|
}) {
|
|
1530
|
-
const today =
|
|
1531
|
-
const [displayed, setDisplayed] =
|
|
1543
|
+
const today = React4__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1544
|
+
const [displayed, setDisplayed] = React4__namespace.useState(
|
|
1532
1545
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
1533
1546
|
);
|
|
1534
1547
|
minDate = clampToDay(minDate);
|
|
1535
1548
|
maxDate = clampToDay(maxDate);
|
|
1536
|
-
const disabledSet =
|
|
1549
|
+
const disabledSet = React4__namespace.useMemo(() => {
|
|
1537
1550
|
const s = /* @__PURE__ */ new Set();
|
|
1538
1551
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
1539
1552
|
return s;
|
|
1540
1553
|
}, [disabledDates]);
|
|
1541
1554
|
const displayYear = displayed.getFullYear();
|
|
1542
1555
|
const displayMonth = displayed.getMonth();
|
|
1543
|
-
const weekdays =
|
|
1556
|
+
const weekdays = React4__namespace.useMemo(() => {
|
|
1544
1557
|
const labels = [];
|
|
1545
1558
|
for (let i = 0; i < 7; i++) {
|
|
1546
1559
|
const idx = i;
|
|
@@ -1549,7 +1562,7 @@ function DatePicker({
|
|
|
1549
1562
|
}
|
|
1550
1563
|
return labels;
|
|
1551
1564
|
}, [callbacks]);
|
|
1552
|
-
const grid =
|
|
1565
|
+
const grid = React4__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
1553
1566
|
const isDateDisabled = (date) => {
|
|
1554
1567
|
const d = startOfDay(date);
|
|
1555
1568
|
if (minDate && d < minDate) return true;
|
|
@@ -1559,7 +1572,7 @@ function DatePicker({
|
|
|
1559
1572
|
};
|
|
1560
1573
|
const minYear = minDate?.getFullYear();
|
|
1561
1574
|
const maxYear = maxDate?.getFullYear();
|
|
1562
|
-
const getMonthLabel =
|
|
1575
|
+
const getMonthLabel = React4__namespace.useCallback(
|
|
1563
1576
|
(year, monthIndex) => {
|
|
1564
1577
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
1565
1578
|
if (label === null || label === void 0) {
|
|
@@ -1569,7 +1582,7 @@ function DatePicker({
|
|
|
1569
1582
|
},
|
|
1570
1583
|
[callbacks]
|
|
1571
1584
|
);
|
|
1572
|
-
const getYearLabel =
|
|
1585
|
+
const getYearLabel = React4__namespace.useCallback(
|
|
1573
1586
|
(year) => {
|
|
1574
1587
|
const label = callbacks?.yearLabel?.(year);
|
|
1575
1588
|
if (label === null || label === void 0) return String(year);
|
|
@@ -1577,7 +1590,7 @@ function DatePicker({
|
|
|
1577
1590
|
},
|
|
1578
1591
|
[callbacks]
|
|
1579
1592
|
);
|
|
1580
|
-
const clampMonthToBounds =
|
|
1593
|
+
const clampMonthToBounds = React4__namespace.useCallback(
|
|
1581
1594
|
(year, monthIndex) => {
|
|
1582
1595
|
let output = monthIndex;
|
|
1583
1596
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -1592,7 +1605,7 @@ function DatePicker({
|
|
|
1592
1605
|
},
|
|
1593
1606
|
[maxDate, minDate, maxYear, minYear]
|
|
1594
1607
|
);
|
|
1595
|
-
const yearOptions =
|
|
1608
|
+
const yearOptions = React4__namespace.useMemo(() => {
|
|
1596
1609
|
const fallbackWindow = 50;
|
|
1597
1610
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
1598
1611
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -1613,7 +1626,7 @@ function DatePicker({
|
|
|
1613
1626
|
}
|
|
1614
1627
|
return years;
|
|
1615
1628
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
1616
|
-
const monthOptions =
|
|
1629
|
+
const monthOptions = React4__namespace.useMemo(() => {
|
|
1617
1630
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
1618
1631
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
1619
1632
|
return {
|
|
@@ -1632,7 +1645,7 @@ function DatePicker({
|
|
|
1632
1645
|
}
|
|
1633
1646
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
1634
1647
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
1635
|
-
const handleMonthSelect =
|
|
1648
|
+
const handleMonthSelect = React4__namespace.useCallback((nextValue) => {
|
|
1636
1649
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
1637
1650
|
if (Number.isNaN(nextMonth)) return;
|
|
1638
1651
|
setDisplayed((prev) => {
|
|
@@ -1642,7 +1655,7 @@ function DatePicker({
|
|
|
1642
1655
|
return next;
|
|
1643
1656
|
});
|
|
1644
1657
|
}, []);
|
|
1645
|
-
const handleYearSelect =
|
|
1658
|
+
const handleYearSelect = React4__namespace.useCallback(
|
|
1646
1659
|
(nextValue) => {
|
|
1647
1660
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
1648
1661
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -1790,14 +1803,14 @@ var DatePicker2 = ({
|
|
|
1790
1803
|
ariaLabel,
|
|
1791
1804
|
...calendarProps
|
|
1792
1805
|
}) => {
|
|
1793
|
-
const [open, setOpen] =
|
|
1794
|
-
const parser =
|
|
1795
|
-
const outputFormatter =
|
|
1796
|
-
const labelFormatter =
|
|
1806
|
+
const [open, setOpen] = React4__namespace.default.useState(false);
|
|
1807
|
+
const parser = React4__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
1808
|
+
const outputFormatter = React4__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
1809
|
+
const labelFormatter = React4__namespace.default.useMemo(
|
|
1797
1810
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
1798
1811
|
[displayFormatter]
|
|
1799
1812
|
);
|
|
1800
|
-
const parsedValue =
|
|
1813
|
+
const parsedValue = React4__namespace.default.useMemo(() => {
|
|
1801
1814
|
if (value === null || value === void 0) return void 0;
|
|
1802
1815
|
if (value instanceof Date) return value;
|
|
1803
1816
|
const parsed = parser(value);
|
|
@@ -1806,26 +1819,26 @@ var DatePicker2 = ({
|
|
|
1806
1819
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
|
|
1807
1820
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
1808
1821
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
1809
|
-
const handleClose =
|
|
1810
|
-
const emitChange =
|
|
1822
|
+
const handleClose = React4__namespace.default.useCallback(() => setOpen(false), []);
|
|
1823
|
+
const emitChange = React4__namespace.default.useCallback(
|
|
1811
1824
|
(next) => {
|
|
1812
1825
|
onChange?.(next);
|
|
1813
1826
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
1814
1827
|
},
|
|
1815
1828
|
[onChange, onValueChange, outputFormatter]
|
|
1816
1829
|
);
|
|
1817
|
-
const handleSelect =
|
|
1830
|
+
const handleSelect = React4__namespace.default.useCallback(
|
|
1818
1831
|
(next) => {
|
|
1819
1832
|
emitChange(next);
|
|
1820
1833
|
if (closeOnSelect && next) handleClose();
|
|
1821
1834
|
},
|
|
1822
1835
|
[closeOnSelect, emitChange, handleClose]
|
|
1823
1836
|
);
|
|
1824
|
-
const handleClear =
|
|
1837
|
+
const handleClear = React4__namespace.default.useCallback(() => {
|
|
1825
1838
|
emitChange(void 0);
|
|
1826
1839
|
handleClose();
|
|
1827
1840
|
}, [emitChange, handleClose]);
|
|
1828
|
-
const handleOpenChange =
|
|
1841
|
+
const handleOpenChange = React4__namespace.default.useCallback(
|
|
1829
1842
|
(nextOpen) => {
|
|
1830
1843
|
if (disabled && nextOpen) return;
|
|
1831
1844
|
setOpen(nextOpen);
|
|
@@ -1997,15 +2010,15 @@ function MonthCal({
|
|
|
1997
2010
|
onYearBackward,
|
|
1998
2011
|
onYearForward
|
|
1999
2012
|
}) {
|
|
2000
|
-
const today =
|
|
2013
|
+
const today = React4__namespace.useMemo(() => {
|
|
2001
2014
|
const now = /* @__PURE__ */ new Date();
|
|
2002
2015
|
now.setDate(1);
|
|
2003
2016
|
now.setHours(0, 0, 0, 0);
|
|
2004
2017
|
return now;
|
|
2005
2018
|
}, []);
|
|
2006
|
-
const selectedMonthDate =
|
|
2007
|
-
const min =
|
|
2008
|
-
const max =
|
|
2019
|
+
const selectedMonthDate = React4__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
2020
|
+
const min = React4__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
2021
|
+
const max = React4__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
2009
2022
|
let effectiveMin = min;
|
|
2010
2023
|
if (min && max && min > max) {
|
|
2011
2024
|
effectiveMin = max;
|
|
@@ -2014,10 +2027,10 @@ function MonthCal({
|
|
|
2014
2027
|
const minMonth = effectiveMin?.getMonth();
|
|
2015
2028
|
const maxYear = max?.getFullYear();
|
|
2016
2029
|
const maxMonth = max?.getMonth();
|
|
2017
|
-
const [menuYear, setMenuYear] =
|
|
2030
|
+
const [menuYear, setMenuYear] = React4__namespace.useState(
|
|
2018
2031
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
2019
2032
|
);
|
|
2020
|
-
|
|
2033
|
+
React4__namespace.useEffect(() => {
|
|
2021
2034
|
if (selectedMonthDate) {
|
|
2022
2035
|
const year = selectedMonthDate.getFullYear();
|
|
2023
2036
|
if (year !== menuYear) {
|
|
@@ -2025,7 +2038,7 @@ function MonthCal({
|
|
|
2025
2038
|
}
|
|
2026
2039
|
}
|
|
2027
2040
|
}, [selectedMonthDate, menuYear]);
|
|
2028
|
-
|
|
2041
|
+
React4__namespace.useEffect(() => {
|
|
2029
2042
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
2030
2043
|
setMenuYear(minYear);
|
|
2031
2044
|
return;
|
|
@@ -2036,7 +2049,7 @@ function MonthCal({
|
|
|
2036
2049
|
}, [minYear, maxYear, menuYear]);
|
|
2037
2050
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
2038
2051
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
2039
|
-
const yearOptions =
|
|
2052
|
+
const yearOptions = React4__namespace.useMemo(() => {
|
|
2040
2053
|
const fallbackWindow = 50;
|
|
2041
2054
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
2042
2055
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -2050,7 +2063,7 @@ function MonthCal({
|
|
|
2050
2063
|
}
|
|
2051
2064
|
return years;
|
|
2052
2065
|
}, [maxYear, menuYear, minYear]);
|
|
2053
|
-
const formatYearLabel =
|
|
2066
|
+
const formatYearLabel = React4__namespace.useCallback(
|
|
2054
2067
|
(year) => {
|
|
2055
2068
|
const raw = callbacks?.yearLabel?.(year);
|
|
2056
2069
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -2058,7 +2071,7 @@ function MonthCal({
|
|
|
2058
2071
|
},
|
|
2059
2072
|
[callbacks]
|
|
2060
2073
|
);
|
|
2061
|
-
const handleYearSelect =
|
|
2074
|
+
const handleYearSelect = React4__namespace.useCallback(
|
|
2062
2075
|
(nextValue) => {
|
|
2063
2076
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
2064
2077
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -2068,7 +2081,7 @@ function MonthCal({
|
|
|
2068
2081
|
},
|
|
2069
2082
|
[maxYear, minYear]
|
|
2070
2083
|
);
|
|
2071
|
-
const disabledPairs =
|
|
2084
|
+
const disabledPairs = React4__namespace.useMemo(() => {
|
|
2072
2085
|
if (!disabledDates?.length) return [];
|
|
2073
2086
|
const pairs = [];
|
|
2074
2087
|
disabledDates.forEach((date) => {
|
|
@@ -2213,14 +2226,14 @@ var MonthPicker2 = ({
|
|
|
2213
2226
|
ariaLabel,
|
|
2214
2227
|
...calendarProps
|
|
2215
2228
|
}) => {
|
|
2216
|
-
const [open, setOpen] =
|
|
2217
|
-
const parser =
|
|
2218
|
-
const outputFormatter =
|
|
2219
|
-
const labelFormatter =
|
|
2229
|
+
const [open, setOpen] = React4__namespace.default.useState(false);
|
|
2230
|
+
const parser = React4__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
2231
|
+
const outputFormatter = React4__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
2232
|
+
const labelFormatter = React4__namespace.default.useMemo(
|
|
2220
2233
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
2221
2234
|
[displayFormatter]
|
|
2222
2235
|
);
|
|
2223
|
-
const parsedValue =
|
|
2236
|
+
const parsedValue = React4__namespace.default.useMemo(() => {
|
|
2224
2237
|
if (value === null || value === void 0) return void 0;
|
|
2225
2238
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
2226
2239
|
if (typeof value === "string") {
|
|
@@ -2232,8 +2245,8 @@ var MonthPicker2 = ({
|
|
|
2232
2245
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
|
|
2233
2246
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
2234
2247
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
2235
|
-
const handleClose =
|
|
2236
|
-
const emitChange =
|
|
2248
|
+
const handleClose = React4__namespace.default.useCallback(() => setOpen(false), []);
|
|
2249
|
+
const emitChange = React4__namespace.default.useCallback(
|
|
2237
2250
|
(next) => {
|
|
2238
2251
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
2239
2252
|
onChange?.(normalized);
|
|
@@ -2241,18 +2254,18 @@ var MonthPicker2 = ({
|
|
|
2241
2254
|
},
|
|
2242
2255
|
[onChange, onValueChange, outputFormatter]
|
|
2243
2256
|
);
|
|
2244
|
-
const handleSelect =
|
|
2257
|
+
const handleSelect = React4__namespace.default.useCallback(
|
|
2245
2258
|
(next) => {
|
|
2246
2259
|
emitChange(next);
|
|
2247
2260
|
if (closeOnSelect && next) handleClose();
|
|
2248
2261
|
},
|
|
2249
2262
|
[closeOnSelect, emitChange, handleClose]
|
|
2250
2263
|
);
|
|
2251
|
-
const handleClear =
|
|
2264
|
+
const handleClear = React4__namespace.default.useCallback(() => {
|
|
2252
2265
|
emitChange(void 0);
|
|
2253
2266
|
handleClose();
|
|
2254
2267
|
}, [emitChange, handleClose]);
|
|
2255
|
-
const handleOpenChange =
|
|
2268
|
+
const handleOpenChange = React4__namespace.default.useCallback(
|
|
2256
2269
|
(nextOpen) => {
|
|
2257
2270
|
if (disabled && nextOpen) return;
|
|
2258
2271
|
setOpen(nextOpen);
|
|
@@ -2458,21 +2471,21 @@ var LookupSelect = ({
|
|
|
2458
2471
|
loadingMessage = "Loading...",
|
|
2459
2472
|
dropdownPortalId
|
|
2460
2473
|
}) => {
|
|
2461
|
-
const [inputValue, setInputValue] =
|
|
2462
|
-
const [suggestions, setSuggestions] =
|
|
2463
|
-
const [optionLabels, setOptionLabels] =
|
|
2464
|
-
const [loading, setLoading] =
|
|
2465
|
-
const [fetchError, setFetchError] =
|
|
2466
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
2467
|
-
const containerRef =
|
|
2468
|
-
const fetchDelayRef =
|
|
2469
|
-
const requestIdRef =
|
|
2470
|
-
const [dropdownStyles, setDropdownStyles] =
|
|
2471
|
-
const dropdownContentRef =
|
|
2472
|
-
const assignDropdownContentRef =
|
|
2474
|
+
const [inputValue, setInputValue] = React4.useState("");
|
|
2475
|
+
const [suggestions, setSuggestions] = React4.useState([]);
|
|
2476
|
+
const [optionLabels, setOptionLabels] = React4.useState({});
|
|
2477
|
+
const [loading, setLoading] = React4.useState(false);
|
|
2478
|
+
const [fetchError, setFetchError] = React4.useState(null);
|
|
2479
|
+
const [isDropdownOpen, setIsDropdownOpen] = React4.useState(false);
|
|
2480
|
+
const containerRef = React4.useRef(null);
|
|
2481
|
+
const fetchDelayRef = React4.useRef(null);
|
|
2482
|
+
const requestIdRef = React4.useRef(0);
|
|
2483
|
+
const [dropdownStyles, setDropdownStyles] = React4.useState();
|
|
2484
|
+
const dropdownContentRef = React4.useRef(null);
|
|
2485
|
+
const assignDropdownContentRef = React4.useCallback((node) => {
|
|
2473
2486
|
dropdownContentRef.current = node;
|
|
2474
2487
|
}, []);
|
|
2475
|
-
const dropdownPortalElement =
|
|
2488
|
+
const dropdownPortalElement = React4.useMemo(() => {
|
|
2476
2489
|
if (typeof document === "undefined") return null;
|
|
2477
2490
|
if (dropdownPortalId) {
|
|
2478
2491
|
const element = document.getElementById(dropdownPortalId);
|
|
@@ -2481,7 +2494,7 @@ var LookupSelect = ({
|
|
|
2481
2494
|
return document.body;
|
|
2482
2495
|
}, [dropdownPortalId]);
|
|
2483
2496
|
const limitReached = value.length >= maxTags;
|
|
2484
|
-
const upsertOptionLabels =
|
|
2497
|
+
const upsertOptionLabels = React4.useCallback((options) => {
|
|
2485
2498
|
setOptionLabels((prev) => {
|
|
2486
2499
|
let next = null;
|
|
2487
2500
|
options.forEach((opt) => {
|
|
@@ -2494,7 +2507,7 @@ var LookupSelect = ({
|
|
|
2494
2507
|
return next ?? prev;
|
|
2495
2508
|
});
|
|
2496
2509
|
}, []);
|
|
2497
|
-
const addTag =
|
|
2510
|
+
const addTag = React4.useCallback(
|
|
2498
2511
|
(val) => {
|
|
2499
2512
|
const trimmed = val.trim();
|
|
2500
2513
|
if (!trimmed) return;
|
|
@@ -2507,7 +2520,7 @@ var LookupSelect = ({
|
|
|
2507
2520
|
},
|
|
2508
2521
|
[value, onChange, maxTags]
|
|
2509
2522
|
);
|
|
2510
|
-
const removeTag =
|
|
2523
|
+
const removeTag = React4.useCallback(
|
|
2511
2524
|
(index) => {
|
|
2512
2525
|
if (index < 0) return;
|
|
2513
2526
|
const newTags = value.filter((_, i) => i !== index);
|
|
@@ -2515,7 +2528,7 @@ var LookupSelect = ({
|
|
|
2515
2528
|
},
|
|
2516
2529
|
[value, onChange]
|
|
2517
2530
|
);
|
|
2518
|
-
const handleKeyDown =
|
|
2531
|
+
const handleKeyDown = React4.useCallback(
|
|
2519
2532
|
(e) => {
|
|
2520
2533
|
if (e.key === "Enter" || e.key === ",") {
|
|
2521
2534
|
e.preventDefault();
|
|
@@ -2526,21 +2539,21 @@ var LookupSelect = ({
|
|
|
2526
2539
|
},
|
|
2527
2540
|
[inputValue, removeTag, value.length]
|
|
2528
2541
|
);
|
|
2529
|
-
const handleClear =
|
|
2542
|
+
const handleClear = React4.useCallback(() => {
|
|
2530
2543
|
setInputValue("");
|
|
2531
2544
|
setSuggestions([]);
|
|
2532
2545
|
setIsDropdownOpen(false);
|
|
2533
2546
|
setFetchError(null);
|
|
2534
2547
|
if (onClear) onClear();
|
|
2535
2548
|
}, [onClear]);
|
|
2536
|
-
const handleSuggestionSelect =
|
|
2549
|
+
const handleSuggestionSelect = React4.useCallback(
|
|
2537
2550
|
(option) => {
|
|
2538
2551
|
upsertOptionLabels([option]);
|
|
2539
2552
|
addTag(option.value);
|
|
2540
2553
|
},
|
|
2541
2554
|
[addTag, upsertOptionLabels]
|
|
2542
2555
|
);
|
|
2543
|
-
const updateDropdownPosition =
|
|
2556
|
+
const updateDropdownPosition = React4.useCallback(() => {
|
|
2544
2557
|
if (!dropdownPortalElement || !containerRef.current) return;
|
|
2545
2558
|
const rect = containerRef.current.getBoundingClientRect();
|
|
2546
2559
|
setDropdownStyles({
|
|
@@ -2551,7 +2564,7 @@ var LookupSelect = ({
|
|
|
2551
2564
|
zIndex: 50
|
|
2552
2565
|
});
|
|
2553
2566
|
}, [dropdownPortalElement]);
|
|
2554
|
-
|
|
2567
|
+
React4.useEffect(() => {
|
|
2555
2568
|
if (!fetchSuggestions) return;
|
|
2556
2569
|
if (fetchDelayRef.current) {
|
|
2557
2570
|
clearTimeout(fetchDelayRef.current);
|
|
@@ -2591,7 +2604,7 @@ var LookupSelect = ({
|
|
|
2591
2604
|
}
|
|
2592
2605
|
};
|
|
2593
2606
|
}, [inputValue, fetchSuggestions, suggestionDebounce, upsertOptionLabels]);
|
|
2594
|
-
|
|
2607
|
+
React4.useEffect(() => {
|
|
2595
2608
|
const handleDocumentClick = (event) => {
|
|
2596
2609
|
const target = event.target;
|
|
2597
2610
|
if (containerRef.current?.contains(target)) return;
|
|
@@ -2603,11 +2616,11 @@ var LookupSelect = ({
|
|
|
2603
2616
|
document.removeEventListener("mousedown", handleDocumentClick);
|
|
2604
2617
|
};
|
|
2605
2618
|
}, []);
|
|
2606
|
-
|
|
2619
|
+
React4.useEffect(() => {
|
|
2607
2620
|
if (!limitReached) return;
|
|
2608
2621
|
setIsDropdownOpen(false);
|
|
2609
2622
|
}, [limitReached]);
|
|
2610
|
-
|
|
2623
|
+
React4.useEffect(() => {
|
|
2611
2624
|
if (!dropdownPortalElement) return;
|
|
2612
2625
|
if (!isDropdownOpen) return;
|
|
2613
2626
|
updateDropdownPosition();
|
|
@@ -3292,7 +3305,7 @@ var AdvanceSearch = ({
|
|
|
3292
3305
|
onSearch,
|
|
3293
3306
|
onClear
|
|
3294
3307
|
}) => {
|
|
3295
|
-
const fieldsData =
|
|
3308
|
+
const fieldsData = React4.useMemo(() => {
|
|
3296
3309
|
if (fields.length === 0) throw new Error("fields cannot be an empty array");
|
|
3297
3310
|
return fields || [];
|
|
3298
3311
|
}, [fields]);
|
|
@@ -3312,8 +3325,8 @@ var AdvanceSearch = ({
|
|
|
3312
3325
|
defaultValues: {}
|
|
3313
3326
|
});
|
|
3314
3327
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
3315
|
-
const [operatorErrors, setOperatorErrors] =
|
|
3316
|
-
const clearOperatorError =
|
|
3328
|
+
const [operatorErrors, setOperatorErrors] = React4__namespace.default.useState({});
|
|
3329
|
+
const clearOperatorError = React4.useCallback(
|
|
3317
3330
|
(rowId) => {
|
|
3318
3331
|
setOperatorErrors((prev) => {
|
|
3319
3332
|
if (!(rowId in prev)) return prev;
|
|
@@ -3323,7 +3336,7 @@ var AdvanceSearch = ({
|
|
|
3323
3336
|
},
|
|
3324
3337
|
[setOperatorErrors]
|
|
3325
3338
|
);
|
|
3326
|
-
const clearValue =
|
|
3339
|
+
const clearValue = React4.useCallback(
|
|
3327
3340
|
(rowId, which) => {
|
|
3328
3341
|
const fieldName = `${which}_${rowId}`;
|
|
3329
3342
|
resetField(fieldName, { defaultValue: void 0 });
|
|
@@ -3333,13 +3346,13 @@ var AdvanceSearch = ({
|
|
|
3333
3346
|
},
|
|
3334
3347
|
[resetField, clearErrors]
|
|
3335
3348
|
);
|
|
3336
|
-
const parseRangeValue =
|
|
3349
|
+
const parseRangeValue = React4.useCallback((raw, fieldType) => {
|
|
3337
3350
|
if (!raw) return void 0;
|
|
3338
3351
|
const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
|
|
3339
3352
|
const parsed = dateFns.parseISO(normalized);
|
|
3340
3353
|
return dateFns.isValid(parsed) ? parsed : void 0;
|
|
3341
3354
|
}, []);
|
|
3342
|
-
const onSubmit =
|
|
3355
|
+
const onSubmit = React4.useCallback(() => {
|
|
3343
3356
|
const operatorValidation = {};
|
|
3344
3357
|
rows.forEach((r) => {
|
|
3345
3358
|
const availableOperators = operatorsForField(r.fieldName);
|
|
@@ -3557,11 +3570,11 @@ function selectValueToBoolean(value) {
|
|
|
3557
3570
|
return void 0;
|
|
3558
3571
|
}
|
|
3559
3572
|
var useHover = () => {
|
|
3560
|
-
const [hovering, setHovering] =
|
|
3561
|
-
const prevRef =
|
|
3562
|
-
const onMouseEnter =
|
|
3563
|
-
const onMouseLeave =
|
|
3564
|
-
const nodeRefCallback =
|
|
3573
|
+
const [hovering, setHovering] = React4.useState(false);
|
|
3574
|
+
const prevRef = React4.useRef(null);
|
|
3575
|
+
const onMouseEnter = React4.useCallback(() => setHovering(true), []);
|
|
3576
|
+
const onMouseLeave = React4.useCallback(() => setHovering(false), []);
|
|
3577
|
+
const nodeRefCallback = React4.useCallback(
|
|
3565
3578
|
(node) => {
|
|
3566
3579
|
if (prevRef.current) {
|
|
3567
3580
|
prevRef.current.removeEventListener("mouseenter", onMouseEnter);
|
|
@@ -3589,15 +3602,15 @@ var useIntersectionObserver = ({
|
|
|
3589
3602
|
initialIsIntersecting = false,
|
|
3590
3603
|
onChange
|
|
3591
3604
|
} = {}) => {
|
|
3592
|
-
const [ref, setRef] =
|
|
3593
|
-
const [state, setState] =
|
|
3605
|
+
const [ref, setRef] = React4.useState(null);
|
|
3606
|
+
const [state, setState] = React4.useState(() => ({
|
|
3594
3607
|
isIntersecting: initialIsIntersecting,
|
|
3595
3608
|
entry: void 0
|
|
3596
3609
|
}));
|
|
3597
|
-
const callbackRef =
|
|
3610
|
+
const callbackRef = React4.useRef(null);
|
|
3598
3611
|
callbackRef.current = onChange;
|
|
3599
3612
|
const frozen = state.entry?.isIntersecting && freezeOnceVisible;
|
|
3600
|
-
|
|
3613
|
+
React4.useEffect(() => {
|
|
3601
3614
|
if (!ref) return;
|
|
3602
3615
|
if (!("IntersectionObserver" in window)) return;
|
|
3603
3616
|
if (frozen) return;
|
|
@@ -3627,8 +3640,8 @@ var useIntersectionObserver = ({
|
|
|
3627
3640
|
frozen,
|
|
3628
3641
|
freezeOnceVisible
|
|
3629
3642
|
]);
|
|
3630
|
-
const prevRef =
|
|
3631
|
-
|
|
3643
|
+
const prevRef = React4.useRef(null);
|
|
3644
|
+
React4.useEffect(() => {
|
|
3632
3645
|
if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
|
|
3633
3646
|
prevRef.current = state.entry.target;
|
|
3634
3647
|
setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
|
|
@@ -3645,8 +3658,8 @@ var isValidMediaQueryString = (query) => {
|
|
|
3645
3658
|
return query !== "not all";
|
|
3646
3659
|
};
|
|
3647
3660
|
var useMediaQuery = ({ query }) => {
|
|
3648
|
-
const [matches, setMatches] =
|
|
3649
|
-
|
|
3661
|
+
const [matches, setMatches] = React4.useState(false);
|
|
3662
|
+
React4.useEffect(() => {
|
|
3650
3663
|
if (typeof window === "undefined") {
|
|
3651
3664
|
return;
|
|
3652
3665
|
}
|
|
@@ -3682,8 +3695,8 @@ var useTruncated = ({
|
|
|
3682
3695
|
onChange,
|
|
3683
3696
|
resizeDetectDelay = 150
|
|
3684
3697
|
}) => {
|
|
3685
|
-
const [isTruncated, setIsTruncated] =
|
|
3686
|
-
|
|
3698
|
+
const [isTruncated, setIsTruncated] = React4.useState(false);
|
|
3699
|
+
React4.useEffect(() => {
|
|
3687
3700
|
const element = elementRef.current;
|
|
3688
3701
|
if (!element) return;
|
|
3689
3702
|
const checkTruncate = debounce(() => {
|
|
@@ -3903,7 +3916,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
3903
3916
|
}
|
|
3904
3917
|
);
|
|
3905
3918
|
};
|
|
3906
|
-
var ColumnSeparator_default =
|
|
3919
|
+
var ColumnSeparator_default = React4__namespace.default.memo(ColumnSeparator);
|
|
3907
3920
|
var StatusContentSlot = ({
|
|
3908
3921
|
content,
|
|
3909
3922
|
icon,
|
|
@@ -3922,7 +3935,7 @@ var StatusContentSlot = ({
|
|
|
3922
3935
|
content
|
|
3923
3936
|
] });
|
|
3924
3937
|
};
|
|
3925
|
-
var StatusContentSlot_default =
|
|
3938
|
+
var StatusContentSlot_default = React4__namespace.default.memo(StatusContentSlot);
|
|
3926
3939
|
var stateOptions = [
|
|
3927
3940
|
"columnFilters",
|
|
3928
3941
|
"globalFilter",
|
|
@@ -3975,9 +3988,9 @@ var modelOptions = [
|
|
|
3975
3988
|
"getCenterVisibleLeafColumns"
|
|
3976
3989
|
];
|
|
3977
3990
|
var DataTableDevTool = ({ table }) => {
|
|
3978
|
-
const [open, setOpen] =
|
|
3979
|
-
const [visibleStates, setVisibleStates] =
|
|
3980
|
-
const [visibleModels, setVisibleModels] =
|
|
3991
|
+
const [open, setOpen] = React4.useState(false);
|
|
3992
|
+
const [visibleStates, setVisibleStates] = React4.useState([]);
|
|
3993
|
+
const [visibleModels, setVisibleModels] = React4.useState([]);
|
|
3981
3994
|
const tableState = table.getState();
|
|
3982
3995
|
const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
|
|
3983
3996
|
const getCircularReplacer = () => {
|
|
@@ -4237,14 +4250,14 @@ var DataTable = ({
|
|
|
4237
4250
|
if (isDefined(tableRef) && !isDefined(tableRef?.current)) {
|
|
4238
4251
|
tableRef.current = table;
|
|
4239
4252
|
}
|
|
4240
|
-
const tableContainerRef =
|
|
4253
|
+
const tableContainerRef = React4.useRef(null);
|
|
4241
4254
|
const isTableEmpty = table.getCoreRowModel().rows.length === 0;
|
|
4242
4255
|
const isTableEmptyAfterFiltering = table.getRowModel().rows.length === 0;
|
|
4243
4256
|
const isFiltering = table.getState().columnFilters.length > 0 || !!table.getState().globalFilter;
|
|
4244
4257
|
const leftVisibleLeftColumns = table.getLeftVisibleLeafColumns();
|
|
4245
4258
|
const centerVisibleLeafColumns = table.getCenterVisibleLeafColumns();
|
|
4246
4259
|
const rightVisibleLeafColumns = table.getRightVisibleLeafColumns();
|
|
4247
|
-
const { isSomeColumnsFilterable, filterableColumns } =
|
|
4260
|
+
const { isSomeColumnsFilterable, filterableColumns } = React4.useMemo(() => {
|
|
4248
4261
|
const mergedColumns = [
|
|
4249
4262
|
...leftVisibleLeftColumns,
|
|
4250
4263
|
...centerVisibleLeafColumns,
|
|
@@ -4255,7 +4268,7 @@ var DataTable = ({
|
|
|
4255
4268
|
);
|
|
4256
4269
|
return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
|
|
4257
4270
|
}, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
|
|
4258
|
-
const autoStatusKey =
|
|
4271
|
+
const autoStatusKey = React4.useMemo(() => {
|
|
4259
4272
|
if (isInitialLoading) return "initialLoading";
|
|
4260
4273
|
if (isTableEmpty) return "emptyData";
|
|
4261
4274
|
if (isTableEmptyAfterFiltering) return "emptyFilteredData";
|
|
@@ -4273,14 +4286,14 @@ var DataTable = ({
|
|
|
4273
4286
|
scrollFetch?.hasMore,
|
|
4274
4287
|
scrollFetch?.isFetchingMore
|
|
4275
4288
|
]);
|
|
4276
|
-
const activeStatusContentComputed =
|
|
4289
|
+
const activeStatusContentComputed = React4.useMemo(() => {
|
|
4277
4290
|
if (!activeStatusContent) return autoStatusKey;
|
|
4278
4291
|
if (typeof activeStatusContent === "function") {
|
|
4279
4292
|
return activeStatusContent({ defaultComputedValue: autoStatusKey });
|
|
4280
4293
|
}
|
|
4281
4294
|
return activeStatusContent;
|
|
4282
4295
|
}, [activeStatusContent, autoStatusKey]);
|
|
4283
|
-
const fetchMoreOnScrollReached =
|
|
4296
|
+
const fetchMoreOnScrollReached = React4.useCallback(
|
|
4284
4297
|
(containerRefElement) => {
|
|
4285
4298
|
if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
|
|
4286
4299
|
return;
|
|
@@ -4314,7 +4327,7 @@ var DataTable = ({
|
|
|
4314
4327
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4315
4328
|
[scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
|
|
4316
4329
|
);
|
|
4317
|
-
|
|
4330
|
+
React4.useEffect(() => {
|
|
4318
4331
|
fetchMoreOnScrollReached(tableContainerRef.current);
|
|
4319
4332
|
}, [fetchMoreOnScrollReached]);
|
|
4320
4333
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4444,7 +4457,7 @@ var DataTable = ({
|
|
|
4444
4457
|
),
|
|
4445
4458
|
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: table.getRowModel().rows.map((row) => {
|
|
4446
4459
|
const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
|
|
4447
|
-
return /* @__PURE__ */
|
|
4460
|
+
return /* @__PURE__ */ React4.createElement(
|
|
4448
4461
|
TableRow,
|
|
4449
4462
|
{
|
|
4450
4463
|
"data-testid": `table-data-row-${row.id}`,
|
|
@@ -4807,11 +4820,11 @@ function DialogAlert({
|
|
|
4807
4820
|
persistent = false
|
|
4808
4821
|
}) {
|
|
4809
4822
|
const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
|
|
4810
|
-
const handleCancel =
|
|
4823
|
+
const handleCancel = React4.useCallback(() => {
|
|
4811
4824
|
onCancel?.();
|
|
4812
4825
|
onOpenChange(false);
|
|
4813
4826
|
}, [onCancel, onOpenChange]);
|
|
4814
|
-
const handleConfirm =
|
|
4827
|
+
const handleConfirm = React4.useCallback(() => {
|
|
4815
4828
|
onConfirm?.();
|
|
4816
4829
|
}, [onConfirm]);
|
|
4817
4830
|
return /* @__PURE__ */ jsxRuntime.jsx(Dialog2, { open, onOpenChange: persistent ? () => {
|
|
@@ -4897,7 +4910,7 @@ function SortableRow({
|
|
|
4897
4910
|
id: value,
|
|
4898
4911
|
disabled: name === "columns.0.id"
|
|
4899
4912
|
});
|
|
4900
|
-
const style =
|
|
4913
|
+
const style = React4__namespace.useMemo(
|
|
4901
4914
|
() => ({
|
|
4902
4915
|
transform: utilities.CSS.Transform.toString(transform),
|
|
4903
4916
|
transition
|
|
@@ -5009,8 +5022,8 @@ var GridSettingsModal = ({
|
|
|
5009
5022
|
onClose,
|
|
5010
5023
|
onSaveColumns
|
|
5011
5024
|
}) => {
|
|
5012
|
-
const [isDragging, setIsDragging] =
|
|
5013
|
-
const scrollRef =
|
|
5025
|
+
const [isDragging, setIsDragging] = React4.useState(false);
|
|
5026
|
+
const scrollRef = React4.useRef(null);
|
|
5014
5027
|
const form = reactHookForm.useForm({
|
|
5015
5028
|
resolver: zod$1.zodResolver(GridSettingsSchema),
|
|
5016
5029
|
defaultValues: { columns: currentColumns },
|
|
@@ -5022,7 +5035,7 @@ var GridSettingsModal = ({
|
|
|
5022
5035
|
name: "columns",
|
|
5023
5036
|
keyName: "fieldId"
|
|
5024
5037
|
});
|
|
5025
|
-
|
|
5038
|
+
React4.useEffect(() => {
|
|
5026
5039
|
if (isOpen) {
|
|
5027
5040
|
form.reset({ columns: currentColumns });
|
|
5028
5041
|
}
|
|
@@ -5239,7 +5252,7 @@ var useGridSettingsStore = zustand.create(
|
|
|
5239
5252
|
);
|
|
5240
5253
|
var useGridSettingsStore_default = useGridSettingsStore;
|
|
5241
5254
|
var ListTable = ({ onTableReady, children }) => {
|
|
5242
|
-
|
|
5255
|
+
React4__namespace.useEffect(() => {
|
|
5243
5256
|
if (onTableReady) {
|
|
5244
5257
|
onTableReady({ ready: true });
|
|
5245
5258
|
}
|
|
@@ -5343,26 +5356,48 @@ var InfoIcon = (props) => {
|
|
|
5343
5356
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5344
5357
|
"svg",
|
|
5345
5358
|
{
|
|
5346
|
-
width: "
|
|
5347
|
-
height: "
|
|
5348
|
-
viewBox: "0 0
|
|
5359
|
+
width: "20",
|
|
5360
|
+
height: "20",
|
|
5361
|
+
viewBox: "0 0 20 20",
|
|
5349
5362
|
fill: "none",
|
|
5350
5363
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5351
5364
|
...props,
|
|
5352
5365
|
children: [
|
|
5353
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6.98438", cy: "6.63281", r: "6.25", fill: "white" }),
|
|
5354
5366
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5355
5367
|
"path",
|
|
5356
5368
|
{
|
|
5357
|
-
d: "
|
|
5358
|
-
|
|
5369
|
+
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",
|
|
5370
|
+
stroke: "white",
|
|
5371
|
+
"stroke-width": "1.5",
|
|
5372
|
+
"stroke-linecap": "round",
|
|
5373
|
+
"stroke-linejoin": "round"
|
|
5374
|
+
}
|
|
5375
|
+
),
|
|
5376
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5377
|
+
"path",
|
|
5378
|
+
{
|
|
5379
|
+
d: "M10 13.3333V10",
|
|
5380
|
+
stroke: "white",
|
|
5381
|
+
"stroke-width": "1.5",
|
|
5382
|
+
"stroke-linecap": "round",
|
|
5383
|
+
"stroke-linejoin": "round"
|
|
5384
|
+
}
|
|
5385
|
+
),
|
|
5386
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5387
|
+
"path",
|
|
5388
|
+
{
|
|
5389
|
+
d: "M10 6.66602H10.0083",
|
|
5390
|
+
stroke: "white",
|
|
5391
|
+
"stroke-width": "1.5",
|
|
5392
|
+
"stroke-linecap": "round",
|
|
5393
|
+
"stroke-linejoin": "round"
|
|
5359
5394
|
}
|
|
5360
5395
|
)
|
|
5361
5396
|
]
|
|
5362
5397
|
}
|
|
5363
5398
|
);
|
|
5364
5399
|
};
|
|
5365
|
-
var InfoIcon_default =
|
|
5400
|
+
var InfoIcon_default = React4__namespace.default.memo(InfoIcon);
|
|
5366
5401
|
var Navbar = ({
|
|
5367
5402
|
className,
|
|
5368
5403
|
title,
|
|
@@ -5387,7 +5422,7 @@ var Navbar = ({
|
|
|
5387
5422
|
}) => {
|
|
5388
5423
|
const { isMobile, isTablet, isDesktop } = useScreenSize_default();
|
|
5389
5424
|
const Icon2 = lucideReact.CircleHelp;
|
|
5390
|
-
const shouldShowSeparator = !separatorDisable &&
|
|
5425
|
+
const shouldShowSeparator = !separatorDisable && React4.isValidElement(searchButton);
|
|
5391
5426
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5392
5427
|
"nav",
|
|
5393
5428
|
{
|
|
@@ -5398,8 +5433,8 @@ var Navbar = ({
|
|
|
5398
5433
|
children: [
|
|
5399
5434
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
5400
5435
|
headImageURL !== "" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: headImageURL, alt: "", className: cn("w-full h-full", headImageURLClassName) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
5401
|
-
|
|
5402
|
-
|
|
5436
|
+
React4.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
|
|
5437
|
+
React4.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
|
|
5403
5438
|
] }),
|
|
5404
5439
|
tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
|
|
5405
5440
|
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "text-white hover:opacity-80 ", children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon_default, { className: "w-4" }) }) }),
|
|
@@ -5430,10 +5465,10 @@ var Navbar = ({
|
|
|
5430
5465
|
),
|
|
5431
5466
|
children: [
|
|
5432
5467
|
tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
5433
|
-
|
|
5468
|
+
React4.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
|
|
5434
5469
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
|
|
5435
5470
|
] }),
|
|
5436
|
-
|
|
5471
|
+
React4.isValidElement(tooltipdescription) && tooltipdescription
|
|
5437
5472
|
]
|
|
5438
5473
|
}
|
|
5439
5474
|
),
|
|
@@ -5487,13 +5522,13 @@ var Navbar = ({
|
|
|
5487
5522
|
}
|
|
5488
5523
|
),
|
|
5489
5524
|
shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
|
|
5490
|
-
|
|
5525
|
+
React4.isValidElement(searchButton) ? searchButton : ""
|
|
5491
5526
|
] })
|
|
5492
5527
|
]
|
|
5493
5528
|
}
|
|
5494
5529
|
);
|
|
5495
5530
|
};
|
|
5496
|
-
var navbar_default =
|
|
5531
|
+
var navbar_default = React4__namespace.default.memo(Navbar);
|
|
5497
5532
|
function Sheet({ ...props }) {
|
|
5498
5533
|
return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Root, { "data-slot": "sheet", ...props });
|
|
5499
5534
|
}
|
|
@@ -5596,7 +5631,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
|
|
|
5596
5631
|
// src/components/prevent-page-leave/PreventPageLeave.tsx
|
|
5597
5632
|
var PreventPageLeave = ({ children }) => {
|
|
5598
5633
|
const { isPreventing } = usePreventPageLeaveStore();
|
|
5599
|
-
|
|
5634
|
+
React4.useEffect(() => {
|
|
5600
5635
|
if (!isPreventing || typeof window === "undefined") {
|
|
5601
5636
|
return;
|
|
5602
5637
|
}
|
|
@@ -5614,7 +5649,7 @@ var PreventPageLeave = ({ children }) => {
|
|
|
5614
5649
|
var PreventPageLeave_default = PreventPageLeave;
|
|
5615
5650
|
var usePreventPageLeave = ({ isPrevening }) => {
|
|
5616
5651
|
const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
|
|
5617
|
-
|
|
5652
|
+
React4.useEffect(() => {
|
|
5618
5653
|
setPreventing(isPrevening);
|
|
5619
5654
|
}, [isPrevening, setPreventing]);
|
|
5620
5655
|
};
|
|
@@ -5893,21 +5928,21 @@ function ToolbarPlugin({
|
|
|
5893
5928
|
acceptImageMimeTypes
|
|
5894
5929
|
}) {
|
|
5895
5930
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
5896
|
-
const [state, setState] =
|
|
5897
|
-
const fileInputRef =
|
|
5898
|
-
const [isLinkDialogOpen, setLinkDialogOpen] =
|
|
5899
|
-
const [editingExistingLink, setEditingExistingLink] =
|
|
5900
|
-
const [linkNodeKey, setLinkNodeKey] =
|
|
5901
|
-
const [isImageDialogOpen, setImageDialogOpen] =
|
|
5902
|
-
const [editingExistingImage, setEditingExistingImage] =
|
|
5903
|
-
const [imageNodeKey, setImageNodeKey] =
|
|
5931
|
+
const [state, setState] = React4.useState(initialToolbarState);
|
|
5932
|
+
const fileInputRef = React4.useRef(null);
|
|
5933
|
+
const [isLinkDialogOpen, setLinkDialogOpen] = React4.useState(false);
|
|
5934
|
+
const [editingExistingLink, setEditingExistingLink] = React4.useState(false);
|
|
5935
|
+
const [linkNodeKey, setLinkNodeKey] = React4.useState(null);
|
|
5936
|
+
const [isImageDialogOpen, setImageDialogOpen] = React4.useState(false);
|
|
5937
|
+
const [editingExistingImage, setEditingExistingImage] = React4.useState(false);
|
|
5938
|
+
const [imageNodeKey, setImageNodeKey] = React4.useState(null);
|
|
5904
5939
|
const linkForm = reactHookForm.useForm({
|
|
5905
5940
|
defaultValues: { url: "", label: "" }
|
|
5906
5941
|
});
|
|
5907
5942
|
const imageForm = reactHookForm.useForm({
|
|
5908
5943
|
defaultValues: { url: "", alt: "", width: "", height: "" }
|
|
5909
5944
|
});
|
|
5910
|
-
const openImageDialog =
|
|
5945
|
+
const openImageDialog = React4.useCallback(() => {
|
|
5911
5946
|
if (disabled || !allowImageUrlInsert) {
|
|
5912
5947
|
return;
|
|
5913
5948
|
}
|
|
@@ -5941,7 +5976,7 @@ function ToolbarPlugin({
|
|
|
5941
5976
|
setImageNodeKey(targetImage?.getKey() ?? null);
|
|
5942
5977
|
setImageDialogOpen(true);
|
|
5943
5978
|
}, [allowImageUrlInsert, disabled, editor, imageForm]);
|
|
5944
|
-
const closeImageDialog =
|
|
5979
|
+
const closeImageDialog = React4.useCallback(() => {
|
|
5945
5980
|
setImageDialogOpen(false);
|
|
5946
5981
|
setEditingExistingImage(false);
|
|
5947
5982
|
setImageNodeKey(null);
|
|
@@ -5950,7 +5985,7 @@ function ToolbarPlugin({
|
|
|
5950
5985
|
editor.focus();
|
|
5951
5986
|
}, 0);
|
|
5952
5987
|
}, [editor, imageForm]);
|
|
5953
|
-
const openLinkDialog =
|
|
5988
|
+
const openLinkDialog = React4.useCallback(() => {
|
|
5954
5989
|
if (disabled) {
|
|
5955
5990
|
return;
|
|
5956
5991
|
}
|
|
@@ -5990,7 +6025,7 @@ function ToolbarPlugin({
|
|
|
5990
6025
|
setLinkNodeKey(detectedLink?.getKey() ?? null);
|
|
5991
6026
|
setLinkDialogOpen(true);
|
|
5992
6027
|
}, [disabled, editor, linkForm]);
|
|
5993
|
-
const closeLinkDialog =
|
|
6028
|
+
const closeLinkDialog = React4.useCallback(() => {
|
|
5994
6029
|
setLinkDialogOpen(false);
|
|
5995
6030
|
setEditingExistingLink(false);
|
|
5996
6031
|
setLinkNodeKey(null);
|
|
@@ -6031,7 +6066,7 @@ function ToolbarPlugin({
|
|
|
6031
6066
|
});
|
|
6032
6067
|
closeLinkDialog();
|
|
6033
6068
|
});
|
|
6034
|
-
const handleRemoveLink =
|
|
6069
|
+
const handleRemoveLink = React4.useCallback(() => {
|
|
6035
6070
|
editor.focus();
|
|
6036
6071
|
editor.update(() => {
|
|
6037
6072
|
if (linkNodeKey) {
|
|
@@ -6048,7 +6083,7 @@ function ToolbarPlugin({
|
|
|
6048
6083
|
});
|
|
6049
6084
|
closeLinkDialog();
|
|
6050
6085
|
}, [closeLinkDialog, editor, linkNodeKey]);
|
|
6051
|
-
const handleLinkDialogOpenChange =
|
|
6086
|
+
const handleLinkDialogOpenChange = React4.useCallback(
|
|
6052
6087
|
(open) => {
|
|
6053
6088
|
if (open) {
|
|
6054
6089
|
setLinkDialogOpen(true);
|
|
@@ -6058,7 +6093,7 @@ function ToolbarPlugin({
|
|
|
6058
6093
|
},
|
|
6059
6094
|
[closeLinkDialog]
|
|
6060
6095
|
);
|
|
6061
|
-
const updateToolbar =
|
|
6096
|
+
const updateToolbar = React4.useCallback(() => {
|
|
6062
6097
|
const selection = lexical.$getSelection();
|
|
6063
6098
|
if (!lexical.$isRangeSelection(selection)) {
|
|
6064
6099
|
return;
|
|
@@ -6098,7 +6133,7 @@ function ToolbarPlugin({
|
|
|
6098
6133
|
isLink: hasLink
|
|
6099
6134
|
}));
|
|
6100
6135
|
}, []);
|
|
6101
|
-
|
|
6136
|
+
React4__namespace.useEffect(() => {
|
|
6102
6137
|
return utils.mergeRegister(
|
|
6103
6138
|
editor.registerCommand(
|
|
6104
6139
|
lexical.CAN_UNDO_COMMAND,
|
|
@@ -6129,7 +6164,7 @@ function ToolbarPlugin({
|
|
|
6129
6164
|
})
|
|
6130
6165
|
);
|
|
6131
6166
|
}, [editor, updateToolbar]);
|
|
6132
|
-
const applyBlock =
|
|
6167
|
+
const applyBlock = React4.useCallback(
|
|
6133
6168
|
(nextBlock) => {
|
|
6134
6169
|
if (disabled) {
|
|
6135
6170
|
return;
|
|
@@ -6191,7 +6226,7 @@ function ToolbarPlugin({
|
|
|
6191
6226
|
},
|
|
6192
6227
|
[disabled, editor, state.blockType]
|
|
6193
6228
|
);
|
|
6194
|
-
const toggleFormat =
|
|
6229
|
+
const toggleFormat = React4.useCallback(
|
|
6195
6230
|
(format5) => {
|
|
6196
6231
|
if (disabled) {
|
|
6197
6232
|
return;
|
|
@@ -6200,10 +6235,10 @@ function ToolbarPlugin({
|
|
|
6200
6235
|
},
|
|
6201
6236
|
[disabled, editor]
|
|
6202
6237
|
);
|
|
6203
|
-
const toggleLink =
|
|
6238
|
+
const toggleLink = React4.useCallback(() => {
|
|
6204
6239
|
openLinkDialog();
|
|
6205
6240
|
}, [openLinkDialog]);
|
|
6206
|
-
const applyElementFormat =
|
|
6241
|
+
const applyElementFormat = React4.useCallback(
|
|
6207
6242
|
(format5) => {
|
|
6208
6243
|
if (disabled) {
|
|
6209
6244
|
return;
|
|
@@ -6214,7 +6249,7 @@ function ToolbarPlugin({
|
|
|
6214
6249
|
);
|
|
6215
6250
|
const canInsertImage = allowImageUrlInsert || Boolean(onImageUpload);
|
|
6216
6251
|
const imageAccept = acceptImageMimeTypes ?? DEFAULT_IMAGE_ACCEPT;
|
|
6217
|
-
const handleInsertImage =
|
|
6252
|
+
const handleInsertImage = React4.useCallback(() => {
|
|
6218
6253
|
if (disabled || !canInsertImage) {
|
|
6219
6254
|
return;
|
|
6220
6255
|
}
|
|
@@ -6225,7 +6260,7 @@ function ToolbarPlugin({
|
|
|
6225
6260
|
}
|
|
6226
6261
|
openImageDialog();
|
|
6227
6262
|
}, [canInsertImage, disabled, editor, onImageUpload, openImageDialog]);
|
|
6228
|
-
const handleFileChange =
|
|
6263
|
+
const handleFileChange = React4.useCallback(
|
|
6229
6264
|
async (event) => {
|
|
6230
6265
|
if (!onImageUpload) {
|
|
6231
6266
|
return;
|
|
@@ -6315,7 +6350,7 @@ function ToolbarPlugin({
|
|
|
6315
6350
|
});
|
|
6316
6351
|
closeImageDialog();
|
|
6317
6352
|
});
|
|
6318
|
-
const handleImageDialogOpenChange =
|
|
6353
|
+
const handleImageDialogOpenChange = React4.useCallback(
|
|
6319
6354
|
(open) => {
|
|
6320
6355
|
if (open) {
|
|
6321
6356
|
setImageDialogOpen(true);
|
|
@@ -6325,7 +6360,7 @@ function ToolbarPlugin({
|
|
|
6325
6360
|
},
|
|
6326
6361
|
[closeImageDialog]
|
|
6327
6362
|
);
|
|
6328
|
-
const handleRemoveImage =
|
|
6363
|
+
const handleRemoveImage = React4.useCallback(() => {
|
|
6329
6364
|
if (!imageNodeKey) {
|
|
6330
6365
|
closeImageDialog();
|
|
6331
6366
|
return;
|
|
@@ -6684,7 +6719,7 @@ function ControlledValuePlugin({
|
|
|
6684
6719
|
trackAppliedValue
|
|
6685
6720
|
}) {
|
|
6686
6721
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
6687
|
-
|
|
6722
|
+
React4__namespace.useEffect(() => {
|
|
6688
6723
|
if (value == null || trackAppliedValue.current === value) {
|
|
6689
6724
|
return;
|
|
6690
6725
|
}
|
|
@@ -6708,14 +6743,14 @@ function ControlledValuePlugin({
|
|
|
6708
6743
|
}
|
|
6709
6744
|
function EditableStatePlugin({ editable }) {
|
|
6710
6745
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
6711
|
-
|
|
6746
|
+
React4__namespace.useEffect(() => {
|
|
6712
6747
|
editor.setEditable(editable);
|
|
6713
6748
|
}, [editor, editable]);
|
|
6714
6749
|
return null;
|
|
6715
6750
|
}
|
|
6716
6751
|
function ImagesPlugin() {
|
|
6717
6752
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
6718
|
-
|
|
6753
|
+
React4__namespace.useEffect(() => {
|
|
6719
6754
|
return editor.registerCommand(
|
|
6720
6755
|
INSERT_IMAGE_COMMAND,
|
|
6721
6756
|
(payload) => {
|
|
@@ -6734,7 +6769,7 @@ function ImagesPlugin() {
|
|
|
6734
6769
|
}, [editor]);
|
|
6735
6770
|
return null;
|
|
6736
6771
|
}
|
|
6737
|
-
var RichText =
|
|
6772
|
+
var RichText = React4.forwardRef(function RichText2({
|
|
6738
6773
|
value,
|
|
6739
6774
|
defaultValue,
|
|
6740
6775
|
onChange,
|
|
@@ -6753,11 +6788,11 @@ var RichText = React5.forwardRef(function RichText2({
|
|
|
6753
6788
|
id,
|
|
6754
6789
|
...rest
|
|
6755
6790
|
}, ref) {
|
|
6756
|
-
const initialSerializedStateRef =
|
|
6791
|
+
const initialSerializedStateRef = React4.useRef(void 0);
|
|
6757
6792
|
if (initialSerializedStateRef.current === void 0) {
|
|
6758
6793
|
initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
|
|
6759
6794
|
}
|
|
6760
|
-
const initialConfig =
|
|
6795
|
+
const initialConfig = React4.useMemo(
|
|
6761
6796
|
() => ({
|
|
6762
6797
|
namespace: "RichTextEditor",
|
|
6763
6798
|
editable: !(readOnly || disabled),
|
|
@@ -6770,8 +6805,8 @@ var RichText = React5.forwardRef(function RichText2({
|
|
|
6770
6805
|
}),
|
|
6771
6806
|
[disabled, readOnly]
|
|
6772
6807
|
);
|
|
6773
|
-
const appliedValueRef =
|
|
6774
|
-
const handleChange =
|
|
6808
|
+
const appliedValueRef = React4.useRef(value ?? defaultValue);
|
|
6809
|
+
const handleChange = React4.useCallback(
|
|
6775
6810
|
(editorState, editor) => {
|
|
6776
6811
|
const serialized = JSON.stringify(editorState.toJSON());
|
|
6777
6812
|
appliedValueRef.current = serialized;
|
|
@@ -6867,13 +6902,13 @@ function Separator2({
|
|
|
6867
6902
|
);
|
|
6868
6903
|
}
|
|
6869
6904
|
function useIsMobile(breakpoint = 768) {
|
|
6870
|
-
const [isMobile, setIsMobile] =
|
|
6905
|
+
const [isMobile, setIsMobile] = React4.useState(() => {
|
|
6871
6906
|
if (typeof window === "undefined") {
|
|
6872
6907
|
return false;
|
|
6873
6908
|
}
|
|
6874
6909
|
return window.innerWidth < breakpoint;
|
|
6875
6910
|
});
|
|
6876
|
-
|
|
6911
|
+
React4.useEffect(() => {
|
|
6877
6912
|
function onResize() {
|
|
6878
6913
|
setIsMobile(window.innerWidth < breakpoint);
|
|
6879
6914
|
}
|
|
@@ -6925,6 +6960,7 @@ __export(ui_exports, {
|
|
|
6925
6960
|
FormItem: () => FormItem,
|
|
6926
6961
|
FormLabel: () => FormLabel,
|
|
6927
6962
|
FormMessage: () => FormMessage,
|
|
6963
|
+
Input: () => Input,
|
|
6928
6964
|
InputPrimitive: () => InputPrimitive,
|
|
6929
6965
|
Label: () => Label2,
|
|
6930
6966
|
MonthPicker: () => MonthPicker,
|
|
@@ -6998,6 +7034,7 @@ __export(ui_exports, {
|
|
|
6998
7034
|
TooltipProvider: () => TooltipProvider2,
|
|
6999
7035
|
TooltipTrigger: () => TooltipTrigger2,
|
|
7000
7036
|
buttonVariants: () => buttonVariants,
|
|
7037
|
+
inputVariants: () => inputVariants,
|
|
7001
7038
|
spinnerVariants: () => spinnerVariants,
|
|
7002
7039
|
useFormField: () => useFormField,
|
|
7003
7040
|
useSidebar: () => useSidebar
|
|
@@ -7096,9 +7133,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
7096
7133
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
7097
7134
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
7098
7135
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
7099
|
-
var SidebarContext =
|
|
7136
|
+
var SidebarContext = React4__namespace.createContext(null);
|
|
7100
7137
|
function useSidebar() {
|
|
7101
|
-
const context =
|
|
7138
|
+
const context = React4__namespace.useContext(SidebarContext);
|
|
7102
7139
|
if (!context) {
|
|
7103
7140
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
7104
7141
|
}
|
|
@@ -7114,10 +7151,10 @@ function SidebarProvider({
|
|
|
7114
7151
|
...props
|
|
7115
7152
|
}) {
|
|
7116
7153
|
const isMobile = useIsMobile();
|
|
7117
|
-
const [openMobile, setOpenMobile] =
|
|
7118
|
-
const [_open, _setOpen] =
|
|
7154
|
+
const [openMobile, setOpenMobile] = React4__namespace.useState(false);
|
|
7155
|
+
const [_open, _setOpen] = React4__namespace.useState(defaultOpen);
|
|
7119
7156
|
const open = openProp ?? _open;
|
|
7120
|
-
const setOpen =
|
|
7157
|
+
const setOpen = React4__namespace.useCallback(
|
|
7121
7158
|
(value) => {
|
|
7122
7159
|
const openState = typeof value === "function" ? value(open) : value;
|
|
7123
7160
|
if (setOpenProp) {
|
|
@@ -7129,10 +7166,10 @@ function SidebarProvider({
|
|
|
7129
7166
|
},
|
|
7130
7167
|
[setOpenProp, open]
|
|
7131
7168
|
);
|
|
7132
|
-
const toggleSidebar =
|
|
7169
|
+
const toggleSidebar = React4__namespace.useCallback(() => {
|
|
7133
7170
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
7134
7171
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
7135
|
-
|
|
7172
|
+
React4__namespace.useEffect(() => {
|
|
7136
7173
|
const handleKeyDown = (event) => {
|
|
7137
7174
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
7138
7175
|
event.preventDefault();
|
|
@@ -7143,7 +7180,7 @@ function SidebarProvider({
|
|
|
7143
7180
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
7144
7181
|
}, [toggleSidebar]);
|
|
7145
7182
|
const state = open ? "expanded" : "collapsed";
|
|
7146
|
-
const contextValue =
|
|
7183
|
+
const contextValue = React4__namespace.useMemo(
|
|
7147
7184
|
() => ({
|
|
7148
7185
|
state,
|
|
7149
7186
|
open,
|
|
@@ -7585,7 +7622,7 @@ function SidebarMenuSkeleton({
|
|
|
7585
7622
|
showIcon = false,
|
|
7586
7623
|
...props
|
|
7587
7624
|
}) {
|
|
7588
|
-
const width =
|
|
7625
|
+
const width = React4__namespace.useMemo(() => {
|
|
7589
7626
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
7590
7627
|
}, []);
|
|
7591
7628
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -7738,20 +7775,20 @@ var CropperModal = ({
|
|
|
7738
7775
|
title,
|
|
7739
7776
|
props
|
|
7740
7777
|
}) => {
|
|
7741
|
-
const [isLoading, setIsLoading] =
|
|
7742
|
-
const [crop, setCrop] =
|
|
7743
|
-
const [zoom, setZoom] =
|
|
7744
|
-
const [croppedAreaPixels, setCroppedAreaPixels] =
|
|
7745
|
-
const handleClose =
|
|
7778
|
+
const [isLoading, setIsLoading] = React4.useState(false);
|
|
7779
|
+
const [crop, setCrop] = React4.useState({ x: 0, y: 0 });
|
|
7780
|
+
const [zoom, setZoom] = React4.useState();
|
|
7781
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = React4.useState(null);
|
|
7782
|
+
const handleClose = React4.useCallback(() => {
|
|
7746
7783
|
onOpenChange(false);
|
|
7747
7784
|
}, [onOpenChange]);
|
|
7748
|
-
const handleCancel =
|
|
7785
|
+
const handleCancel = React4.useCallback(() => {
|
|
7749
7786
|
if (onCancel) {
|
|
7750
7787
|
onCancel();
|
|
7751
7788
|
}
|
|
7752
7789
|
handleClose();
|
|
7753
7790
|
}, [handleClose, onCancel]);
|
|
7754
|
-
const handleCropComplete =
|
|
7791
|
+
const handleCropComplete = React4.useCallback((_, croppedAreaPixels2) => {
|
|
7755
7792
|
setCroppedAreaPixels(croppedAreaPixels2);
|
|
7756
7793
|
}, []);
|
|
7757
7794
|
const handleConfirm = async () => {
|