@sustaina/shared-ui 1.33.1 → 1.34.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 +62 -9
- package/dist/index.d.ts +62 -9
- package/dist/index.js +723 -310
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +564 -155
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
4
3
|
var clsx2 = require('clsx');
|
|
5
4
|
var tailwindMerge = require('tailwind-merge');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
6
|
+
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
7
|
+
var React26 = require('react');
|
|
8
8
|
var lucideReact = require('lucide-react');
|
|
9
9
|
var reactDom = require('react-dom');
|
|
10
10
|
var SelectPrimitive = require('@radix-ui/react-select');
|
|
@@ -82,9 +82,9 @@ function _interopNamespace(e) {
|
|
|
82
82
|
return Object.freeze(n);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
86
85
|
var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
|
|
87
|
-
var
|
|
86
|
+
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
87
|
+
var React26__namespace = /*#__PURE__*/_interopNamespace(React26);
|
|
88
88
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
89
89
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
90
90
|
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
@@ -777,6 +777,120 @@ var SuiWarningIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
|
777
777
|
}
|
|
778
778
|
);
|
|
779
779
|
var warning_default = SuiWarningIcon;
|
|
780
|
+
var TrashIcon = ({
|
|
781
|
+
size = 16,
|
|
782
|
+
color = "currentColor",
|
|
783
|
+
className,
|
|
784
|
+
...props
|
|
785
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
786
|
+
"svg",
|
|
787
|
+
{
|
|
788
|
+
viewBox: "0 0 17 15",
|
|
789
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
790
|
+
width: size,
|
|
791
|
+
height: size,
|
|
792
|
+
fill: "none",
|
|
793
|
+
className,
|
|
794
|
+
...props,
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#clip0_336_302483)", children: [
|
|
797
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
798
|
+
"path",
|
|
799
|
+
{
|
|
800
|
+
d: "M3.49371 2.12043C3.38318 1.44249 3.66212 0.708651 4.43068 0.529533C4.94459 0.409578 7.77168 0.42749 8.38456 0.492081C9.25207 0.583811 9.64966 1.36813 9.5125 2.12097C10.3748 2.22627 11.9484 1.85067 12.6087 2.44664C13.1053 2.89498 13.1452 3.75638 12.64 4.21232C12.2707 4.54558 12.1422 4.28179 12.0664 4.92282C11.7412 7.68938 11.6509 10.4907 11.3494 13.2605C11.2452 13.9135 10.7718 14.3401 10.0646 14.3895C7.73175 14.5534 5.1836 14.2619 2.8276 14.3873C2.09203 14.2587 1.75116 13.8364 1.64178 13.1655L0.878435 4.54558C0.710025 4.38221 0.481427 4.33281 0.310702 4.15532C-0.221151 3.60006 -0.0434807 2.66593 0.639999 2.29358C0.702502 2.25938 0.998811 2.12043 1.03411 2.12043H3.49371ZM4.30394 2.12043H8.70228C8.71964 1.8333 8.70691 1.36813 8.32321 1.30951C7.19122 1.38116 5.90586 1.20367 4.79238 1.30246C4.28831 1.34696 4.29815 1.71931 4.30394 2.12043ZM12.0415 3.0589C12.0172 3.03068 11.8812 2.9574 11.8419 2.94926L1.26329 2.93243C0.749379 2.95794 0.749379 3.72598 1.26329 3.75149H11.7429C12.1029 3.75312 12.2429 3.29338 12.0415 3.0589ZM11.2487 4.56295H1.75753L2.51508 13.1612C2.5608 13.4597 2.68754 13.5498 2.9989 13.5759C5.22817 13.762 7.7468 13.4293 10.0073 13.5759L10.3823 13.4391L11.2487 4.56295Z",
|
|
801
|
+
fill: color
|
|
802
|
+
}
|
|
803
|
+
),
|
|
804
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
805
|
+
"path",
|
|
806
|
+
{
|
|
807
|
+
d: "M4.22952 5.50209C4.41761 5.72137 4.34006 6.27067 4.36263 6.54477C4.51599 8.36961 4.73649 10.3719 4.77121 12.1892C4.78568 12.9404 3.98125 12.8953 3.90254 12.4047C3.84698 10.417 3.54836 8.42443 3.49164 6.43947C3.48586 6.23159 3.45576 5.67469 3.54894 5.52542C3.66411 5.34088 4.08426 5.33274 4.22952 5.50263V5.50209Z",
|
|
808
|
+
fill: color
|
|
809
|
+
}
|
|
810
|
+
),
|
|
811
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
812
|
+
"path",
|
|
813
|
+
{
|
|
814
|
+
d: "M9.43711 5.50146C9.55575 5.63933 9.52045 6.22879 9.51466 6.43776C9.45852 8.42272 9.15932 10.4153 9.10376 12.4029C9.02447 12.8936 8.21946 12.9381 8.23509 12.1875C8.27213 10.3681 8.48973 8.37007 8.64367 6.54306C8.67492 6.17234 8.50941 5.28598 9.18941 5.37771C9.24497 5.38531 9.40412 5.46238 9.43711 5.50092V5.50146Z",
|
|
815
|
+
fill: color
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
819
|
+
"path",
|
|
820
|
+
{
|
|
821
|
+
d: "M6.83313 5.50252C6.90547 5.58611 6.90142 5.68218 6.91068 5.78314C7.10224 7.89891 6.76253 10.266 6.90837 12.4083C6.88985 12.8822 6.11551 12.8806 6.09814 12.4083L6.15312 5.52478C6.31575 5.34783 6.6734 5.31689 6.83313 5.50252Z",
|
|
822
|
+
fill: color
|
|
823
|
+
}
|
|
824
|
+
)
|
|
825
|
+
] }),
|
|
826
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_3678_200811", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "17", height: "15", fill: "white", transform: "translate(0.728516 0.726562)" }) }) })
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
);
|
|
830
|
+
var trash_default = TrashIcon;
|
|
831
|
+
var AuditFooter = ({
|
|
832
|
+
createdAt,
|
|
833
|
+
createdBy,
|
|
834
|
+
updatedAt,
|
|
835
|
+
updatedBy,
|
|
836
|
+
onDelete,
|
|
837
|
+
canDelete = true,
|
|
838
|
+
emptyValue = "-",
|
|
839
|
+
labels,
|
|
840
|
+
classNames,
|
|
841
|
+
formatters,
|
|
842
|
+
deleteAriaLabel = "Delete",
|
|
843
|
+
deleteIcon
|
|
844
|
+
}) => {
|
|
845
|
+
const resolvedLabels = {
|
|
846
|
+
createdOn: "Created on :",
|
|
847
|
+
createdAtTime: "at Time :",
|
|
848
|
+
createdBy: "by :",
|
|
849
|
+
updatedOn: "Last Update :",
|
|
850
|
+
updatedAtTime: "at Time :",
|
|
851
|
+
updatedBy: "by :",
|
|
852
|
+
...labels
|
|
853
|
+
};
|
|
854
|
+
const dateFormatter = formatters?.date ?? ((value) => formatISODate(value, "DD/MM/YYYY"));
|
|
855
|
+
const timeFormatter = formatters?.time ?? ((value) => formatISODate(value, "H:i"));
|
|
856
|
+
const userFormatter = formatters?.user ?? ((value) => value ?? emptyValue);
|
|
857
|
+
const resolvedDeleteIcon = deleteIcon ?? /* @__PURE__ */ jsxRuntime.jsx(trash_default, { className: "w-5 h-5" });
|
|
858
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex w-full h-14 mt-12 justify-between items-end px-3", classNames?.root), children: [
|
|
859
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
860
|
+
"div",
|
|
861
|
+
{
|
|
862
|
+
className: cn(
|
|
863
|
+
"grid grid-cols-[auto_1fr_auto_1fr] gap-x-3 gap-y-1 text-[10px]",
|
|
864
|
+
classNames?.grid
|
|
865
|
+
),
|
|
866
|
+
children: [
|
|
867
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.createdOn }),
|
|
868
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: classNames?.value, children: createdAt ? dateFormatter(createdAt) : emptyValue }),
|
|
869
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.createdAtTime }),
|
|
870
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: classNames?.value, children: createdAt ? timeFormatter(createdAt) : emptyValue }),
|
|
871
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.createdBy }),
|
|
872
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("col-span-3", classNames?.value), children: userFormatter(createdBy) }),
|
|
873
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.updatedOn }),
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: classNames?.value, children: updatedAt ? dateFormatter(updatedAt) : emptyValue }),
|
|
875
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.updatedAtTime }),
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: classNames?.value, children: updatedAt ? timeFormatter(updatedAt) : emptyValue }),
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("font-bold italic text-[#3B4256]", classNames?.label), children: resolvedLabels.updatedBy }),
|
|
878
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("col-span-3", classNames?.value), children: userFormatter(updatedBy) })
|
|
879
|
+
]
|
|
880
|
+
}
|
|
881
|
+
),
|
|
882
|
+
onDelete && /* @__PURE__ */ jsxRuntime.jsx(
|
|
883
|
+
"div",
|
|
884
|
+
{
|
|
885
|
+
className: canDelete ? cn("w-5 h-5 cursor-pointer text-red-500", classNames?.deleteButton) : cn("w-5 h-5 text-gray-300 cursor-not-allowed", classNames?.deleteButtonDisabled),
|
|
886
|
+
onClick: canDelete ? onDelete : void 0,
|
|
887
|
+
"aria-label": deleteAriaLabel,
|
|
888
|
+
role: "button",
|
|
889
|
+
children: resolvedDeleteIcon
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
] });
|
|
893
|
+
};
|
|
780
894
|
function Accordion({ ...props }) {
|
|
781
895
|
return /* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Root, { "data-slot": "accordion", ...props });
|
|
782
896
|
}
|
|
@@ -820,7 +934,7 @@ function AccordionContent({
|
|
|
820
934
|
);
|
|
821
935
|
}
|
|
822
936
|
var ExpandCollapse = ({ title, children, portalId }) => {
|
|
823
|
-
const [isOpen, setIsOpen] =
|
|
937
|
+
const [isOpen, setIsOpen] = React26.useState(false);
|
|
824
938
|
const Panel = /* @__PURE__ */ jsxRuntime.jsx(
|
|
825
939
|
"div",
|
|
826
940
|
{
|
|
@@ -930,31 +1044,31 @@ function makeNewRow(field) {
|
|
|
930
1044
|
};
|
|
931
1045
|
}
|
|
932
1046
|
function useAdvanceSearch({ fields, limitRows }) {
|
|
933
|
-
const [rows, setRows] =
|
|
934
|
-
const updateRows =
|
|
1047
|
+
const [rows, setRows] = React26.useState([makeNewRow(fields[0])]);
|
|
1048
|
+
const updateRows = React26.useCallback((next) => {
|
|
935
1049
|
setRows(next);
|
|
936
1050
|
}, []);
|
|
937
|
-
const operatorsForField =
|
|
1051
|
+
const operatorsForField = React26.useCallback(
|
|
938
1052
|
(fieldName) => {
|
|
939
1053
|
const t = getFieldType(fields, fieldName);
|
|
940
1054
|
return OPERATOR_MAP[t];
|
|
941
1055
|
},
|
|
942
1056
|
[fields]
|
|
943
1057
|
);
|
|
944
|
-
const addRow =
|
|
1058
|
+
const addRow = React26.useCallback(() => {
|
|
945
1059
|
if (limitRows && rows.length >= limitRows) return;
|
|
946
1060
|
const lastRow = rows[rows.length - 1];
|
|
947
1061
|
const lastField = fields.find((f) => f.name === lastRow?.fieldName) ?? fields[0];
|
|
948
1062
|
updateRows([...rows, makeNewRow(lastField)]);
|
|
949
1063
|
}, [rows, fields, updateRows, limitRows]);
|
|
950
|
-
const removeRow =
|
|
1064
|
+
const removeRow = React26.useCallback(
|
|
951
1065
|
(id) => {
|
|
952
1066
|
if (rows.length === 1) return;
|
|
953
1067
|
updateRows(rows.filter((r) => r.id !== id));
|
|
954
1068
|
},
|
|
955
1069
|
[rows, updateRows]
|
|
956
1070
|
);
|
|
957
|
-
const clearRow =
|
|
1071
|
+
const clearRow = React26.useCallback(
|
|
958
1072
|
(id) => {
|
|
959
1073
|
updateRows(
|
|
960
1074
|
rows.map((r) => {
|
|
@@ -987,10 +1101,10 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
987
1101
|
},
|
|
988
1102
|
[rows, fields, updateRows]
|
|
989
1103
|
);
|
|
990
|
-
const clearAllRow =
|
|
1104
|
+
const clearAllRow = React26.useCallback(() => {
|
|
991
1105
|
updateRows([makeNewRow(fields[0])]);
|
|
992
1106
|
}, [fields, updateRows]);
|
|
993
|
-
const changeField =
|
|
1107
|
+
const changeField = React26.useCallback(
|
|
994
1108
|
(id, fieldName) => {
|
|
995
1109
|
updateRows(
|
|
996
1110
|
rows.map((r) => {
|
|
@@ -1002,7 +1116,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
1002
1116
|
},
|
|
1003
1117
|
[rows, fields, updateRows]
|
|
1004
1118
|
);
|
|
1005
|
-
const changeOperator =
|
|
1119
|
+
const changeOperator = React26.useCallback(
|
|
1006
1120
|
(id, operator) => {
|
|
1007
1121
|
updateRows(
|
|
1008
1122
|
rows.map((r) => {
|
|
@@ -1036,7 +1150,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
1036
1150
|
},
|
|
1037
1151
|
[rows, updateRows]
|
|
1038
1152
|
);
|
|
1039
|
-
const changeValue =
|
|
1153
|
+
const changeValue = React26.useCallback(
|
|
1040
1154
|
(id, which, val) => {
|
|
1041
1155
|
updateRows(
|
|
1042
1156
|
rows.map((r) => {
|
|
@@ -1048,7 +1162,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
1048
1162
|
},
|
|
1049
1163
|
[rows, updateRows]
|
|
1050
1164
|
);
|
|
1051
|
-
const fieldOptions =
|
|
1165
|
+
const fieldOptions = React26.useMemo(
|
|
1052
1166
|
() => fields.map((f) => ({
|
|
1053
1167
|
value: f.name,
|
|
1054
1168
|
label: f.label ?? f.name
|
|
@@ -1243,7 +1357,7 @@ var OPERATOR_LABEL = {
|
|
|
1243
1357
|
containsAll: "Contains all of"
|
|
1244
1358
|
};
|
|
1245
1359
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
1246
|
-
|
|
1360
|
+
React26__namespace.default.useEffect(() => {
|
|
1247
1361
|
if (!operators.length) return;
|
|
1248
1362
|
if (!operators.includes(row.operator)) {
|
|
1249
1363
|
onChangeOperator(operators[0]);
|
|
@@ -1279,15 +1393,15 @@ function Label2({ className, ...props }) {
|
|
|
1279
1393
|
);
|
|
1280
1394
|
}
|
|
1281
1395
|
var Form = reactHookForm.FormProvider;
|
|
1282
|
-
var FormFieldContext =
|
|
1396
|
+
var FormFieldContext = React26__namespace.createContext({});
|
|
1283
1397
|
var FormField = ({
|
|
1284
1398
|
...props
|
|
1285
1399
|
}) => {
|
|
1286
1400
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
1287
1401
|
};
|
|
1288
1402
|
var useFormField = () => {
|
|
1289
|
-
const fieldContext =
|
|
1290
|
-
const itemContext =
|
|
1403
|
+
const fieldContext = React26__namespace.useContext(FormFieldContext);
|
|
1404
|
+
const itemContext = React26__namespace.useContext(FormItemContext);
|
|
1291
1405
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
1292
1406
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
1293
1407
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1304,9 +1418,9 @@ var useFormField = () => {
|
|
|
1304
1418
|
...fieldState
|
|
1305
1419
|
};
|
|
1306
1420
|
};
|
|
1307
|
-
var FormItemContext =
|
|
1421
|
+
var FormItemContext = React26__namespace.createContext({});
|
|
1308
1422
|
function FormItem({ className, ...props }) {
|
|
1309
|
-
const id =
|
|
1423
|
+
const id = React26__namespace.useId();
|
|
1310
1424
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1311
1425
|
}
|
|
1312
1426
|
function FormLabel({ className, ...props }) {
|
|
@@ -1410,7 +1524,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
1410
1524
|
]
|
|
1411
1525
|
}
|
|
1412
1526
|
);
|
|
1413
|
-
var InputPrimitive =
|
|
1527
|
+
var InputPrimitive = React26__namespace.forwardRef(
|
|
1414
1528
|
({ className, type = "text", ...props }, ref) => {
|
|
1415
1529
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1416
1530
|
"input",
|
|
@@ -1449,7 +1563,7 @@ var inputVariants = classVarianceAuthority.cva("", {
|
|
|
1449
1563
|
appearance: "filled"
|
|
1450
1564
|
}
|
|
1451
1565
|
});
|
|
1452
|
-
var Input =
|
|
1566
|
+
var Input = React26__namespace.forwardRef(
|
|
1453
1567
|
({
|
|
1454
1568
|
className,
|
|
1455
1569
|
wrapperClassName,
|
|
@@ -1482,8 +1596,8 @@ var Input = React4__namespace.forwardRef(
|
|
|
1482
1596
|
onChange: onChangeProp
|
|
1483
1597
|
} = rest;
|
|
1484
1598
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
1485
|
-
const messageId =
|
|
1486
|
-
const handleChange =
|
|
1599
|
+
const messageId = React26__namespace.useId();
|
|
1600
|
+
const handleChange = React26__namespace.useCallback(
|
|
1487
1601
|
(event) => {
|
|
1488
1602
|
onChangeProp?.(event);
|
|
1489
1603
|
onValueChange?.(event.target.value);
|
|
@@ -1826,20 +1940,20 @@ function DatePicker({
|
|
|
1826
1940
|
className,
|
|
1827
1941
|
...props
|
|
1828
1942
|
}) {
|
|
1829
|
-
const today =
|
|
1830
|
-
const [displayed, setDisplayed] =
|
|
1943
|
+
const today = React26__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1944
|
+
const [displayed, setDisplayed] = React26__namespace.useState(
|
|
1831
1945
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
1832
1946
|
);
|
|
1833
1947
|
minDate = clampToDay(minDate);
|
|
1834
1948
|
maxDate = clampToDay(maxDate);
|
|
1835
|
-
const disabledSet =
|
|
1949
|
+
const disabledSet = React26__namespace.useMemo(() => {
|
|
1836
1950
|
const s = /* @__PURE__ */ new Set();
|
|
1837
1951
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
1838
1952
|
return s;
|
|
1839
1953
|
}, [disabledDates]);
|
|
1840
1954
|
const displayYear = displayed.getFullYear();
|
|
1841
1955
|
const displayMonth = displayed.getMonth();
|
|
1842
|
-
const weekdays =
|
|
1956
|
+
const weekdays = React26__namespace.useMemo(() => {
|
|
1843
1957
|
const labels = [];
|
|
1844
1958
|
for (let i = 0; i < 7; i++) {
|
|
1845
1959
|
const idx = i;
|
|
@@ -1848,7 +1962,7 @@ function DatePicker({
|
|
|
1848
1962
|
}
|
|
1849
1963
|
return labels;
|
|
1850
1964
|
}, [callbacks]);
|
|
1851
|
-
const grid =
|
|
1965
|
+
const grid = React26__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
1852
1966
|
const isDateDisabled = (date) => {
|
|
1853
1967
|
const d = startOfDay(date);
|
|
1854
1968
|
if (minDate && d < minDate) return true;
|
|
@@ -1858,7 +1972,7 @@ function DatePicker({
|
|
|
1858
1972
|
};
|
|
1859
1973
|
const minYear = minDate?.getFullYear();
|
|
1860
1974
|
const maxYear = maxDate?.getFullYear();
|
|
1861
|
-
const getMonthLabel =
|
|
1975
|
+
const getMonthLabel = React26__namespace.useCallback(
|
|
1862
1976
|
(year, monthIndex) => {
|
|
1863
1977
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
1864
1978
|
if (label === null || label === void 0) {
|
|
@@ -1868,7 +1982,7 @@ function DatePicker({
|
|
|
1868
1982
|
},
|
|
1869
1983
|
[callbacks]
|
|
1870
1984
|
);
|
|
1871
|
-
const getYearLabel =
|
|
1985
|
+
const getYearLabel = React26__namespace.useCallback(
|
|
1872
1986
|
(year) => {
|
|
1873
1987
|
const label = callbacks?.yearLabel?.(year);
|
|
1874
1988
|
if (label === null || label === void 0) return String(year);
|
|
@@ -1876,7 +1990,7 @@ function DatePicker({
|
|
|
1876
1990
|
},
|
|
1877
1991
|
[callbacks]
|
|
1878
1992
|
);
|
|
1879
|
-
const clampMonthToBounds =
|
|
1993
|
+
const clampMonthToBounds = React26__namespace.useCallback(
|
|
1880
1994
|
(year, monthIndex) => {
|
|
1881
1995
|
let output = monthIndex;
|
|
1882
1996
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -1891,7 +2005,7 @@ function DatePicker({
|
|
|
1891
2005
|
},
|
|
1892
2006
|
[maxDate, minDate, maxYear, minYear]
|
|
1893
2007
|
);
|
|
1894
|
-
const yearOptions =
|
|
2008
|
+
const yearOptions = React26__namespace.useMemo(() => {
|
|
1895
2009
|
const fallbackWindow = 50;
|
|
1896
2010
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
1897
2011
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -1912,7 +2026,7 @@ function DatePicker({
|
|
|
1912
2026
|
}
|
|
1913
2027
|
return years;
|
|
1914
2028
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
1915
|
-
const monthOptions =
|
|
2029
|
+
const monthOptions = React26__namespace.useMemo(() => {
|
|
1916
2030
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
1917
2031
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
1918
2032
|
return {
|
|
@@ -1931,7 +2045,7 @@ function DatePicker({
|
|
|
1931
2045
|
}
|
|
1932
2046
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
1933
2047
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
1934
|
-
const handleMonthSelect =
|
|
2048
|
+
const handleMonthSelect = React26__namespace.useCallback((nextValue) => {
|
|
1935
2049
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
1936
2050
|
if (Number.isNaN(nextMonth)) return;
|
|
1937
2051
|
setDisplayed((prev) => {
|
|
@@ -1941,7 +2055,7 @@ function DatePicker({
|
|
|
1941
2055
|
return next;
|
|
1942
2056
|
});
|
|
1943
2057
|
}, []);
|
|
1944
|
-
const handleYearSelect =
|
|
2058
|
+
const handleYearSelect = React26__namespace.useCallback(
|
|
1945
2059
|
(nextValue) => {
|
|
1946
2060
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
1947
2061
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -2089,14 +2203,14 @@ var DatePicker2 = ({
|
|
|
2089
2203
|
ariaLabel,
|
|
2090
2204
|
...calendarProps
|
|
2091
2205
|
}) => {
|
|
2092
|
-
const [open, setOpen] =
|
|
2093
|
-
const parser =
|
|
2094
|
-
const outputFormatter =
|
|
2095
|
-
const labelFormatter =
|
|
2206
|
+
const [open, setOpen] = React26__namespace.default.useState(false);
|
|
2207
|
+
const parser = React26__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
2208
|
+
const outputFormatter = React26__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
2209
|
+
const labelFormatter = React26__namespace.default.useMemo(
|
|
2096
2210
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
2097
2211
|
[displayFormatter]
|
|
2098
2212
|
);
|
|
2099
|
-
const parsedValue =
|
|
2213
|
+
const parsedValue = React26__namespace.default.useMemo(() => {
|
|
2100
2214
|
if (value === null || value === void 0) return void 0;
|
|
2101
2215
|
if (value instanceof Date) return value;
|
|
2102
2216
|
const parsed = parser(value);
|
|
@@ -2105,26 +2219,26 @@ var DatePicker2 = ({
|
|
|
2105
2219
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
2106
2220
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
2107
2221
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
2108
|
-
const handleClose =
|
|
2109
|
-
const emitChange =
|
|
2222
|
+
const handleClose = React26__namespace.default.useCallback(() => setOpen(false), []);
|
|
2223
|
+
const emitChange = React26__namespace.default.useCallback(
|
|
2110
2224
|
(next) => {
|
|
2111
2225
|
onChange?.(next);
|
|
2112
2226
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
2113
2227
|
},
|
|
2114
2228
|
[onChange, onValueChange, outputFormatter]
|
|
2115
2229
|
);
|
|
2116
|
-
const handleSelect =
|
|
2230
|
+
const handleSelect = React26__namespace.default.useCallback(
|
|
2117
2231
|
(next) => {
|
|
2118
2232
|
emitChange(next);
|
|
2119
2233
|
if (closeOnSelect && next) handleClose();
|
|
2120
2234
|
},
|
|
2121
2235
|
[closeOnSelect, emitChange, handleClose]
|
|
2122
2236
|
);
|
|
2123
|
-
const handleClear =
|
|
2237
|
+
const handleClear = React26__namespace.default.useCallback(() => {
|
|
2124
2238
|
emitChange(void 0);
|
|
2125
2239
|
handleClose();
|
|
2126
2240
|
}, [emitChange, handleClose]);
|
|
2127
|
-
const handleOpenChange =
|
|
2241
|
+
const handleOpenChange = React26__namespace.default.useCallback(
|
|
2128
2242
|
(nextOpen) => {
|
|
2129
2243
|
if (disabled && nextOpen) return;
|
|
2130
2244
|
setOpen(nextOpen);
|
|
@@ -2314,15 +2428,15 @@ function MonthCal({
|
|
|
2314
2428
|
onYearBackward,
|
|
2315
2429
|
onYearForward
|
|
2316
2430
|
}) {
|
|
2317
|
-
const today =
|
|
2431
|
+
const today = React26__namespace.useMemo(() => {
|
|
2318
2432
|
const now = /* @__PURE__ */ new Date();
|
|
2319
2433
|
now.setDate(1);
|
|
2320
2434
|
now.setHours(0, 0, 0, 0);
|
|
2321
2435
|
return now;
|
|
2322
2436
|
}, []);
|
|
2323
|
-
const selectedMonthDate =
|
|
2324
|
-
const min =
|
|
2325
|
-
const max =
|
|
2437
|
+
const selectedMonthDate = React26__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
2438
|
+
const min = React26__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
2439
|
+
const max = React26__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
2326
2440
|
let effectiveMin = min;
|
|
2327
2441
|
if (min && max && min > max) {
|
|
2328
2442
|
effectiveMin = max;
|
|
@@ -2331,10 +2445,10 @@ function MonthCal({
|
|
|
2331
2445
|
const minMonth = effectiveMin?.getMonth();
|
|
2332
2446
|
const maxYear = max?.getFullYear();
|
|
2333
2447
|
const maxMonth = max?.getMonth();
|
|
2334
|
-
const [menuYear, setMenuYear] =
|
|
2448
|
+
const [menuYear, setMenuYear] = React26__namespace.useState(
|
|
2335
2449
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
2336
2450
|
);
|
|
2337
|
-
|
|
2451
|
+
React26__namespace.useEffect(() => {
|
|
2338
2452
|
if (selectedMonthDate) {
|
|
2339
2453
|
const year = selectedMonthDate.getFullYear();
|
|
2340
2454
|
if (year !== menuYear) {
|
|
@@ -2342,7 +2456,7 @@ function MonthCal({
|
|
|
2342
2456
|
}
|
|
2343
2457
|
}
|
|
2344
2458
|
}, [selectedMonthDate, menuYear]);
|
|
2345
|
-
|
|
2459
|
+
React26__namespace.useEffect(() => {
|
|
2346
2460
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
2347
2461
|
setMenuYear(minYear);
|
|
2348
2462
|
return;
|
|
@@ -2353,7 +2467,7 @@ function MonthCal({
|
|
|
2353
2467
|
}, [minYear, maxYear, menuYear]);
|
|
2354
2468
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
2355
2469
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
2356
|
-
const yearOptions =
|
|
2470
|
+
const yearOptions = React26__namespace.useMemo(() => {
|
|
2357
2471
|
const fallbackWindow = 50;
|
|
2358
2472
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
2359
2473
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -2367,7 +2481,7 @@ function MonthCal({
|
|
|
2367
2481
|
}
|
|
2368
2482
|
return years;
|
|
2369
2483
|
}, [maxYear, menuYear, minYear]);
|
|
2370
|
-
const formatYearLabel =
|
|
2484
|
+
const formatYearLabel = React26__namespace.useCallback(
|
|
2371
2485
|
(year) => {
|
|
2372
2486
|
const raw = callbacks?.yearLabel?.(year);
|
|
2373
2487
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -2375,7 +2489,7 @@ function MonthCal({
|
|
|
2375
2489
|
},
|
|
2376
2490
|
[callbacks]
|
|
2377
2491
|
);
|
|
2378
|
-
const handleYearSelect =
|
|
2492
|
+
const handleYearSelect = React26__namespace.useCallback(
|
|
2379
2493
|
(nextValue) => {
|
|
2380
2494
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
2381
2495
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -2385,7 +2499,7 @@ function MonthCal({
|
|
|
2385
2499
|
},
|
|
2386
2500
|
[maxYear, minYear]
|
|
2387
2501
|
);
|
|
2388
|
-
const disabledPairs =
|
|
2502
|
+
const disabledPairs = React26__namespace.useMemo(() => {
|
|
2389
2503
|
if (!disabledDates?.length) return [];
|
|
2390
2504
|
const pairs = [];
|
|
2391
2505
|
disabledDates.forEach((date) => {
|
|
@@ -2530,14 +2644,14 @@ var MonthPicker2 = ({
|
|
|
2530
2644
|
ariaLabel,
|
|
2531
2645
|
...calendarProps
|
|
2532
2646
|
}) => {
|
|
2533
|
-
const [open, setOpen] =
|
|
2534
|
-
const parser =
|
|
2535
|
-
const outputFormatter =
|
|
2536
|
-
const labelFormatter =
|
|
2647
|
+
const [open, setOpen] = React26__namespace.default.useState(false);
|
|
2648
|
+
const parser = React26__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
2649
|
+
const outputFormatter = React26__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
2650
|
+
const labelFormatter = React26__namespace.default.useMemo(
|
|
2537
2651
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
2538
2652
|
[displayFormatter]
|
|
2539
2653
|
);
|
|
2540
|
-
const parsedValue =
|
|
2654
|
+
const parsedValue = React26__namespace.default.useMemo(() => {
|
|
2541
2655
|
if (value === null || value === void 0) return void 0;
|
|
2542
2656
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
2543
2657
|
if (typeof value === "string") {
|
|
@@ -2549,8 +2663,8 @@ var MonthPicker2 = ({
|
|
|
2549
2663
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
2550
2664
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
2551
2665
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
2552
|
-
const handleClose =
|
|
2553
|
-
const emitChange =
|
|
2666
|
+
const handleClose = React26__namespace.default.useCallback(() => setOpen(false), []);
|
|
2667
|
+
const emitChange = React26__namespace.default.useCallback(
|
|
2554
2668
|
(next) => {
|
|
2555
2669
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
2556
2670
|
onChange?.(normalized);
|
|
@@ -2558,18 +2672,18 @@ var MonthPicker2 = ({
|
|
|
2558
2672
|
},
|
|
2559
2673
|
[onChange, onValueChange, outputFormatter]
|
|
2560
2674
|
);
|
|
2561
|
-
const handleSelect =
|
|
2675
|
+
const handleSelect = React26__namespace.default.useCallback(
|
|
2562
2676
|
(next) => {
|
|
2563
2677
|
emitChange(next);
|
|
2564
2678
|
if (closeOnSelect && next) handleClose();
|
|
2565
2679
|
},
|
|
2566
2680
|
[closeOnSelect, emitChange, handleClose]
|
|
2567
2681
|
);
|
|
2568
|
-
const handleClear =
|
|
2682
|
+
const handleClear = React26__namespace.default.useCallback(() => {
|
|
2569
2683
|
emitChange(void 0);
|
|
2570
2684
|
handleClose();
|
|
2571
2685
|
}, [emitChange, handleClose]);
|
|
2572
|
-
const handleOpenChange =
|
|
2686
|
+
const handleOpenChange = React26__namespace.default.useCallback(
|
|
2573
2687
|
(nextOpen) => {
|
|
2574
2688
|
if (disabled && nextOpen) return;
|
|
2575
2689
|
setOpen(nextOpen);
|
|
@@ -2780,23 +2894,23 @@ var LookupSelect = ({
|
|
|
2780
2894
|
dropdownPortalId,
|
|
2781
2895
|
multiple = false
|
|
2782
2896
|
}) => {
|
|
2783
|
-
const [inputValue, setInputValue] =
|
|
2784
|
-
const inputRef =
|
|
2785
|
-
const [suggestions, setSuggestions] =
|
|
2786
|
-
const [optionLabels, setOptionLabels] =
|
|
2787
|
-
const [loading, setLoading] =
|
|
2788
|
-
const [fetchError, setFetchError] =
|
|
2789
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
2790
|
-
const containerRef =
|
|
2791
|
-
const fetchDelayRef =
|
|
2792
|
-
const requestIdRef =
|
|
2793
|
-
const [dropdownStyles, setDropdownStyles] =
|
|
2794
|
-
const dropdownContentRef =
|
|
2795
|
-
const assignDropdownContentRef =
|
|
2897
|
+
const [inputValue, setInputValue] = React26.useState("");
|
|
2898
|
+
const inputRef = React26.useRef(null);
|
|
2899
|
+
const [suggestions, setSuggestions] = React26.useState([]);
|
|
2900
|
+
const [optionLabels, setOptionLabels] = React26.useState({});
|
|
2901
|
+
const [loading, setLoading] = React26.useState(false);
|
|
2902
|
+
const [fetchError, setFetchError] = React26.useState(null);
|
|
2903
|
+
const [isDropdownOpen, setIsDropdownOpen] = React26.useState(false);
|
|
2904
|
+
const containerRef = React26.useRef(null);
|
|
2905
|
+
const fetchDelayRef = React26.useRef(null);
|
|
2906
|
+
const requestIdRef = React26.useRef(0);
|
|
2907
|
+
const [dropdownStyles, setDropdownStyles] = React26.useState();
|
|
2908
|
+
const dropdownContentRef = React26.useRef(null);
|
|
2909
|
+
const assignDropdownContentRef = React26.useCallback((node) => {
|
|
2796
2910
|
dropdownContentRef.current = node;
|
|
2797
2911
|
}, []);
|
|
2798
|
-
const [activeSuggestionIndex, setActiveSuggestionIndex] =
|
|
2799
|
-
const dropdownPortalElement =
|
|
2912
|
+
const [activeSuggestionIndex, setActiveSuggestionIndex] = React26.useState(-1);
|
|
2913
|
+
const dropdownPortalElement = React26.useMemo(() => {
|
|
2800
2914
|
if (typeof document === "undefined") return null;
|
|
2801
2915
|
if (dropdownPortalId) {
|
|
2802
2916
|
const element = document.getElementById(dropdownPortalId);
|
|
@@ -2807,7 +2921,7 @@ var LookupSelect = ({
|
|
|
2807
2921
|
const limitReached = multiple && value.length >= maxTags;
|
|
2808
2922
|
const selectedValue = !multiple && value.length > 0 ? value[0] : void 0;
|
|
2809
2923
|
const selectedLabel = selectedValue ? optionLabels[selectedValue] ?? selectedValue : void 0;
|
|
2810
|
-
const upsertOptionLabels =
|
|
2924
|
+
const upsertOptionLabels = React26.useCallback((options) => {
|
|
2811
2925
|
setOptionLabels((prev) => {
|
|
2812
2926
|
let next = null;
|
|
2813
2927
|
options.forEach((opt) => {
|
|
@@ -2820,7 +2934,7 @@ var LookupSelect = ({
|
|
|
2820
2934
|
return next ?? prev;
|
|
2821
2935
|
});
|
|
2822
2936
|
}, []);
|
|
2823
|
-
const addTag =
|
|
2937
|
+
const addTag = React26.useCallback(
|
|
2824
2938
|
(val) => {
|
|
2825
2939
|
const trimmed = val.trim();
|
|
2826
2940
|
if (!trimmed) return;
|
|
@@ -2837,7 +2951,7 @@ var LookupSelect = ({
|
|
|
2837
2951
|
},
|
|
2838
2952
|
[value, onChange, maxTags, multiple]
|
|
2839
2953
|
);
|
|
2840
|
-
const removeTag =
|
|
2954
|
+
const removeTag = React26.useCallback(
|
|
2841
2955
|
(index) => {
|
|
2842
2956
|
if (index < 0) return;
|
|
2843
2957
|
const newTags = value.filter((_, i) => i !== index);
|
|
@@ -2845,14 +2959,14 @@ var LookupSelect = ({
|
|
|
2845
2959
|
},
|
|
2846
2960
|
[value, onChange]
|
|
2847
2961
|
);
|
|
2848
|
-
const handleClear =
|
|
2962
|
+
const handleClear = React26.useCallback(() => {
|
|
2849
2963
|
setInputValue("");
|
|
2850
2964
|
setSuggestions([]);
|
|
2851
2965
|
setIsDropdownOpen(false);
|
|
2852
2966
|
setFetchError(null);
|
|
2853
2967
|
if (onClear) onClear();
|
|
2854
2968
|
}, [onClear]);
|
|
2855
|
-
const handleSuggestionSelect =
|
|
2969
|
+
const handleSuggestionSelect = React26.useCallback(
|
|
2856
2970
|
(option) => {
|
|
2857
2971
|
upsertOptionLabels([option]);
|
|
2858
2972
|
addTag(option.value);
|
|
@@ -2867,7 +2981,7 @@ var LookupSelect = ({
|
|
|
2867
2981
|
},
|
|
2868
2982
|
[addTag, multiple, upsertOptionLabels]
|
|
2869
2983
|
);
|
|
2870
|
-
const handleKeyDown =
|
|
2984
|
+
const handleKeyDown = React26.useCallback(
|
|
2871
2985
|
(e) => {
|
|
2872
2986
|
if (e.key === "ArrowDown" && suggestions.length > 0) {
|
|
2873
2987
|
e.preventDefault();
|
|
@@ -2894,7 +3008,7 @@ var LookupSelect = ({
|
|
|
2894
3008
|
},
|
|
2895
3009
|
[suggestions, activeSuggestionIndex, handleSuggestionSelect, inputValue, removeTag, value.length]
|
|
2896
3010
|
);
|
|
2897
|
-
const updateDropdownPosition =
|
|
3011
|
+
const updateDropdownPosition = React26.useCallback(() => {
|
|
2898
3012
|
if (!dropdownPortalElement || !containerRef.current) return;
|
|
2899
3013
|
const rect = containerRef.current.getBoundingClientRect();
|
|
2900
3014
|
setDropdownStyles({
|
|
@@ -2905,7 +3019,7 @@ var LookupSelect = ({
|
|
|
2905
3019
|
zIndex: 50
|
|
2906
3020
|
});
|
|
2907
3021
|
}, [dropdownPortalElement]);
|
|
2908
|
-
|
|
3022
|
+
React26.useEffect(() => {
|
|
2909
3023
|
if (!fetchSuggestions) return;
|
|
2910
3024
|
if (fetchDelayRef.current) {
|
|
2911
3025
|
clearTimeout(fetchDelayRef.current);
|
|
@@ -2946,7 +3060,7 @@ var LookupSelect = ({
|
|
|
2946
3060
|
}
|
|
2947
3061
|
};
|
|
2948
3062
|
}, [inputValue, fetchSuggestions, suggestionDebounce, upsertOptionLabels]);
|
|
2949
|
-
|
|
3063
|
+
React26.useEffect(() => {
|
|
2950
3064
|
if (!fetchSuggestions) return;
|
|
2951
3065
|
if (value.length === 0) return;
|
|
2952
3066
|
const unresolvedValues = value.filter((v) => !optionLabels[v]);
|
|
@@ -2956,7 +3070,7 @@ var LookupSelect = ({
|
|
|
2956
3070
|
}).catch(() => {
|
|
2957
3071
|
});
|
|
2958
3072
|
}, [value, fetchSuggestions, optionLabels, upsertOptionLabels]);
|
|
2959
|
-
|
|
3073
|
+
React26.useEffect(() => {
|
|
2960
3074
|
const handleDocumentClick = (event) => {
|
|
2961
3075
|
const target = event.target;
|
|
2962
3076
|
if (containerRef.current?.contains(target)) return;
|
|
@@ -2968,11 +3082,11 @@ var LookupSelect = ({
|
|
|
2968
3082
|
document.removeEventListener("mousedown", handleDocumentClick);
|
|
2969
3083
|
};
|
|
2970
3084
|
}, []);
|
|
2971
|
-
|
|
3085
|
+
React26.useEffect(() => {
|
|
2972
3086
|
if (!limitReached) return;
|
|
2973
3087
|
setIsDropdownOpen(false);
|
|
2974
3088
|
}, [limitReached]);
|
|
2975
|
-
|
|
3089
|
+
React26.useEffect(() => {
|
|
2976
3090
|
if (!dropdownPortalElement) return;
|
|
2977
3091
|
if (!isDropdownOpen) return;
|
|
2978
3092
|
updateDropdownPosition();
|
|
@@ -2984,7 +3098,7 @@ var LookupSelect = ({
|
|
|
2984
3098
|
window.removeEventListener("scroll", handleReposition, true);
|
|
2985
3099
|
};
|
|
2986
3100
|
}, [dropdownPortalElement, isDropdownOpen, updateDropdownPosition]);
|
|
2987
|
-
|
|
3101
|
+
React26.useEffect(() => {
|
|
2988
3102
|
if (suggestions.length === 0) {
|
|
2989
3103
|
setActiveSuggestionIndex(-1);
|
|
2990
3104
|
return;
|
|
@@ -3819,7 +3933,7 @@ var AdvanceSearch = ({
|
|
|
3819
3933
|
shortDateFormat,
|
|
3820
3934
|
filterFieldMap = FILTER_FIELD_MAP
|
|
3821
3935
|
}) => {
|
|
3822
|
-
const fieldsData =
|
|
3936
|
+
const fieldsData = React26.useMemo(() => {
|
|
3823
3937
|
if (fields.length === 0) throw new Error("fields cannot be an empty array");
|
|
3824
3938
|
return fields || [];
|
|
3825
3939
|
}, [fields]);
|
|
@@ -3839,8 +3953,8 @@ var AdvanceSearch = ({
|
|
|
3839
3953
|
defaultValues: {}
|
|
3840
3954
|
});
|
|
3841
3955
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
3842
|
-
const [operatorErrors, setOperatorErrors] =
|
|
3843
|
-
const clearOperatorError =
|
|
3956
|
+
const [operatorErrors, setOperatorErrors] = React26__namespace.default.useState({});
|
|
3957
|
+
const clearOperatorError = React26.useCallback(
|
|
3844
3958
|
(rowId) => {
|
|
3845
3959
|
setOperatorErrors((prev) => {
|
|
3846
3960
|
if (!(rowId in prev)) return prev;
|
|
@@ -3850,7 +3964,7 @@ var AdvanceSearch = ({
|
|
|
3850
3964
|
},
|
|
3851
3965
|
[setOperatorErrors]
|
|
3852
3966
|
);
|
|
3853
|
-
const clearValue =
|
|
3967
|
+
const clearValue = React26.useCallback(
|
|
3854
3968
|
(rowId, which) => {
|
|
3855
3969
|
const fieldName = `${which}_${rowId}`;
|
|
3856
3970
|
resetField(fieldName, { defaultValue: void 0 });
|
|
@@ -3860,14 +3974,14 @@ var AdvanceSearch = ({
|
|
|
3860
3974
|
},
|
|
3861
3975
|
[resetField, clearErrors]
|
|
3862
3976
|
);
|
|
3863
|
-
const parseRangeValue =
|
|
3977
|
+
const parseRangeValue = React26.useCallback((raw, fieldType) => {
|
|
3864
3978
|
if (!raw) return void 0;
|
|
3865
3979
|
if (Array.isArray(raw)) return void 0;
|
|
3866
3980
|
const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
|
|
3867
3981
|
const parsed = dateFns.parseISO(normalized);
|
|
3868
3982
|
return dateFns.isValid(parsed) ? parsed : void 0;
|
|
3869
3983
|
}, []);
|
|
3870
|
-
const onSubmit =
|
|
3984
|
+
const onSubmit = React26.useCallback(() => {
|
|
3871
3985
|
const operatorValidation = {};
|
|
3872
3986
|
rows.forEach((r) => {
|
|
3873
3987
|
const ops = operatorsForField(r.fieldName);
|
|
@@ -4103,11 +4217,11 @@ function resetVisibleTableState(payload) {
|
|
|
4103
4217
|
table.setSorting(prevState.sorting.filter((s) => isVisible(s.id)));
|
|
4104
4218
|
}
|
|
4105
4219
|
var useHover = () => {
|
|
4106
|
-
const [hovering, setHovering] =
|
|
4107
|
-
const prevRef =
|
|
4108
|
-
const onMouseEnter =
|
|
4109
|
-
const onMouseLeave =
|
|
4110
|
-
const nodeRefCallback =
|
|
4220
|
+
const [hovering, setHovering] = React26.useState(false);
|
|
4221
|
+
const prevRef = React26.useRef(null);
|
|
4222
|
+
const onMouseEnter = React26.useCallback(() => setHovering(true), []);
|
|
4223
|
+
const onMouseLeave = React26.useCallback(() => setHovering(false), []);
|
|
4224
|
+
const nodeRefCallback = React26.useCallback(
|
|
4111
4225
|
(node) => {
|
|
4112
4226
|
if (prevRef.current) {
|
|
4113
4227
|
prevRef.current.removeEventListener("mouseenter", onMouseEnter);
|
|
@@ -4135,15 +4249,15 @@ var useIntersectionObserver = ({
|
|
|
4135
4249
|
initialIsIntersecting = false,
|
|
4136
4250
|
onChange
|
|
4137
4251
|
} = {}) => {
|
|
4138
|
-
const [ref, setRef] =
|
|
4139
|
-
const [state, setState] =
|
|
4252
|
+
const [ref, setRef] = React26.useState(null);
|
|
4253
|
+
const [state, setState] = React26.useState(() => ({
|
|
4140
4254
|
isIntersecting: initialIsIntersecting,
|
|
4141
4255
|
entry: void 0
|
|
4142
4256
|
}));
|
|
4143
|
-
const callbackRef =
|
|
4257
|
+
const callbackRef = React26.useRef(null);
|
|
4144
4258
|
callbackRef.current = onChange;
|
|
4145
4259
|
const frozen = state.entry?.isIntersecting && freezeOnceVisible;
|
|
4146
|
-
|
|
4260
|
+
React26.useEffect(() => {
|
|
4147
4261
|
if (!ref) return;
|
|
4148
4262
|
if (!("IntersectionObserver" in window)) return;
|
|
4149
4263
|
if (frozen) return;
|
|
@@ -4173,8 +4287,8 @@ var useIntersectionObserver = ({
|
|
|
4173
4287
|
frozen,
|
|
4174
4288
|
freezeOnceVisible
|
|
4175
4289
|
]);
|
|
4176
|
-
const prevRef =
|
|
4177
|
-
|
|
4290
|
+
const prevRef = React26.useRef(null);
|
|
4291
|
+
React26.useEffect(() => {
|
|
4178
4292
|
if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
|
|
4179
4293
|
prevRef.current = state.entry.target;
|
|
4180
4294
|
setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
|
|
@@ -4191,8 +4305,8 @@ var isValidMediaQueryString = (query) => {
|
|
|
4191
4305
|
return query !== "not all";
|
|
4192
4306
|
};
|
|
4193
4307
|
var useMediaQuery = ({ query }) => {
|
|
4194
|
-
const [matches, setMatches] =
|
|
4195
|
-
|
|
4308
|
+
const [matches, setMatches] = React26.useState(false);
|
|
4309
|
+
React26.useEffect(() => {
|
|
4196
4310
|
if (typeof window === "undefined") {
|
|
4197
4311
|
return;
|
|
4198
4312
|
}
|
|
@@ -4228,8 +4342,8 @@ var useTruncated = ({
|
|
|
4228
4342
|
onChange,
|
|
4229
4343
|
resizeDetectDelay = 150
|
|
4230
4344
|
}) => {
|
|
4231
|
-
const [isTruncated, setIsTruncated] =
|
|
4232
|
-
|
|
4345
|
+
const [isTruncated, setIsTruncated] = React26.useState(false);
|
|
4346
|
+
React26.useEffect(() => {
|
|
4233
4347
|
const element = elementRef.current;
|
|
4234
4348
|
if (!element) return;
|
|
4235
4349
|
const checkTruncate = debounce(() => {
|
|
@@ -4257,13 +4371,13 @@ var useControllableState = ({
|
|
|
4257
4371
|
defaultValue,
|
|
4258
4372
|
value
|
|
4259
4373
|
}) => {
|
|
4260
|
-
const [internalValue, setInternalValue] =
|
|
4261
|
-
|
|
4374
|
+
const [internalValue, setInternalValue] = React26__namespace.useState(value ?? defaultValue);
|
|
4375
|
+
React26__namespace.useEffect(() => {
|
|
4262
4376
|
if (value !== internalValue) {
|
|
4263
4377
|
setInternalValue(value);
|
|
4264
4378
|
}
|
|
4265
4379
|
}, [value]);
|
|
4266
|
-
const updateState =
|
|
4380
|
+
const updateState = React26__namespace.useCallback((nextValue) => {
|
|
4267
4381
|
setInternalValue(nextValue);
|
|
4268
4382
|
}, []);
|
|
4269
4383
|
return {
|
|
@@ -4272,6 +4386,7 @@ var useControllableState = ({
|
|
|
4272
4386
|
};
|
|
4273
4387
|
};
|
|
4274
4388
|
var useControllableState_default = useControllableState;
|
|
4389
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React26.useLayoutEffect : React26.useEffect;
|
|
4275
4390
|
var HeaderCell = ({
|
|
4276
4391
|
rootClassName,
|
|
4277
4392
|
labelClassName,
|
|
@@ -4469,7 +4584,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
4469
4584
|
}
|
|
4470
4585
|
);
|
|
4471
4586
|
};
|
|
4472
|
-
var ColumnSeparator_default =
|
|
4587
|
+
var ColumnSeparator_default = React26__namespace.default.memo(ColumnSeparator);
|
|
4473
4588
|
var StatusContentSlot = ({
|
|
4474
4589
|
content,
|
|
4475
4590
|
icon,
|
|
@@ -4488,7 +4603,7 @@ var StatusContentSlot = ({
|
|
|
4488
4603
|
content
|
|
4489
4604
|
] });
|
|
4490
4605
|
};
|
|
4491
|
-
var StatusContentSlot_default =
|
|
4606
|
+
var StatusContentSlot_default = React26__namespace.default.memo(StatusContentSlot);
|
|
4492
4607
|
var stateOptions = [
|
|
4493
4608
|
"columnFilters",
|
|
4494
4609
|
"globalFilter",
|
|
@@ -4541,9 +4656,9 @@ var modelOptions = [
|
|
|
4541
4656
|
"getCenterVisibleLeafColumns"
|
|
4542
4657
|
];
|
|
4543
4658
|
var DataTableDevTool = ({ table }) => {
|
|
4544
|
-
const [open, setOpen] =
|
|
4545
|
-
const [visibleStates, setVisibleStates] =
|
|
4546
|
-
const [visibleModels, setVisibleModels] =
|
|
4659
|
+
const [open, setOpen] = React26.useState(false);
|
|
4660
|
+
const [visibleStates, setVisibleStates] = React26.useState([]);
|
|
4661
|
+
const [visibleModels, setVisibleModels] = React26.useState([]);
|
|
4547
4662
|
const tableState = table.getState();
|
|
4548
4663
|
const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
|
|
4549
4664
|
const getCircularReplacer = () => {
|
|
@@ -4800,14 +4915,14 @@ var DataTable = ({
|
|
|
4800
4915
|
columnResizeMode: columnResizing?.enabled ? columnResizing?.resizeMode ?? "onChange" : "onChange"
|
|
4801
4916
|
})
|
|
4802
4917
|
});
|
|
4803
|
-
const tableContainerRef =
|
|
4918
|
+
const tableContainerRef = React26.useRef(null);
|
|
4804
4919
|
const isTableEmpty = table.getCoreRowModel().rows.length === 0;
|
|
4805
4920
|
const isTableEmptyAfterFiltering = table.getRowModel().rows.length === 0;
|
|
4806
4921
|
const isFiltering = table.getState().columnFilters.length > 0 || !!table.getState().globalFilter;
|
|
4807
4922
|
const leftVisibleLeftColumns = table.getLeftVisibleLeafColumns();
|
|
4808
4923
|
const centerVisibleLeafColumns = table.getCenterVisibleLeafColumns();
|
|
4809
4924
|
const rightVisibleLeafColumns = table.getRightVisibleLeafColumns();
|
|
4810
|
-
const { isSomeColumnsFilterable, filterableColumns } =
|
|
4925
|
+
const { isSomeColumnsFilterable, filterableColumns } = React26.useMemo(() => {
|
|
4811
4926
|
const mergedColumns = [
|
|
4812
4927
|
...leftVisibleLeftColumns,
|
|
4813
4928
|
...centerVisibleLeafColumns,
|
|
@@ -4818,7 +4933,7 @@ var DataTable = ({
|
|
|
4818
4933
|
);
|
|
4819
4934
|
return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
|
|
4820
4935
|
}, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
|
|
4821
|
-
const autoStatusKey =
|
|
4936
|
+
const autoStatusKey = React26.useMemo(() => {
|
|
4822
4937
|
if (isInitialLoading) return "initialLoading";
|
|
4823
4938
|
if (isTableEmpty) return "emptyData";
|
|
4824
4939
|
if (isTableEmptyAfterFiltering) return "emptyFilteredData";
|
|
@@ -4836,14 +4951,14 @@ var DataTable = ({
|
|
|
4836
4951
|
scrollFetch?.hasMore,
|
|
4837
4952
|
scrollFetch?.isFetchingMore
|
|
4838
4953
|
]);
|
|
4839
|
-
const activeStatusContentComputed =
|
|
4954
|
+
const activeStatusContentComputed = React26.useMemo(() => {
|
|
4840
4955
|
if (!activeStatusContent) return autoStatusKey;
|
|
4841
4956
|
if (typeof activeStatusContent === "function") {
|
|
4842
4957
|
return activeStatusContent({ defaultComputedValue: autoStatusKey });
|
|
4843
4958
|
}
|
|
4844
4959
|
return activeStatusContent;
|
|
4845
4960
|
}, [activeStatusContent, autoStatusKey]);
|
|
4846
|
-
const fetchMoreOnScrollReached =
|
|
4961
|
+
const fetchMoreOnScrollReached = React26.useCallback(
|
|
4847
4962
|
(containerRefElement) => {
|
|
4848
4963
|
if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
|
|
4849
4964
|
return;
|
|
@@ -4877,14 +4992,14 @@ var DataTable = ({
|
|
|
4877
4992
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4878
4993
|
[scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
|
|
4879
4994
|
);
|
|
4880
|
-
|
|
4995
|
+
React26.useEffect(() => {
|
|
4881
4996
|
if (!tableRef) return;
|
|
4882
4997
|
tableRef.current = table;
|
|
4883
4998
|
return () => {
|
|
4884
4999
|
tableRef.current = null;
|
|
4885
5000
|
};
|
|
4886
5001
|
}, [tableRef, table]);
|
|
4887
|
-
|
|
5002
|
+
React26.useEffect(() => {
|
|
4888
5003
|
fetchMoreOnScrollReached(tableContainerRef.current);
|
|
4889
5004
|
}, [fetchMoreOnScrollReached]);
|
|
4890
5005
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -5014,7 +5129,7 @@ var DataTable = ({
|
|
|
5014
5129
|
),
|
|
5015
5130
|
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: table.getRowModel().rows.map((row) => {
|
|
5016
5131
|
const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
|
|
5017
|
-
return /* @__PURE__ */
|
|
5132
|
+
return /* @__PURE__ */ React26.createElement(
|
|
5018
5133
|
TableRow,
|
|
5019
5134
|
{
|
|
5020
5135
|
"data-testid": `table-data-row-${row.id}`,
|
|
@@ -5487,14 +5602,18 @@ function DialogAlert({
|
|
|
5487
5602
|
}) {
|
|
5488
5603
|
const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
|
|
5489
5604
|
const { t } = reactI18next.useTranslation();
|
|
5490
|
-
const handleCancel =
|
|
5605
|
+
const handleCancel = React26.useCallback(() => {
|
|
5491
5606
|
onCancel?.();
|
|
5492
5607
|
onOpenChange(false);
|
|
5493
5608
|
}, [onCancel, onOpenChange]);
|
|
5494
|
-
const handleConfirm =
|
|
5495
|
-
onConfirm
|
|
5609
|
+
const handleConfirm = React26.useCallback(() => {
|
|
5610
|
+
let func = onConfirm;
|
|
5611
|
+
if (variant === "success" && showCancel === false) {
|
|
5612
|
+
func = onConfirm ?? onCancel;
|
|
5613
|
+
}
|
|
5614
|
+
func?.();
|
|
5496
5615
|
onOpenChange(false);
|
|
5497
|
-
}, [onConfirm, onOpenChange]);
|
|
5616
|
+
}, [onCancel, onConfirm, onOpenChange, showCancel, variant]);
|
|
5498
5617
|
return /* @__PURE__ */ jsxRuntime.jsx(Dialog2, { open, onOpenChange: persistent ? () => {
|
|
5499
5618
|
} : onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
|
|
5500
5619
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader2, { children: [
|
|
@@ -5711,7 +5830,7 @@ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
|
|
|
5711
5830
|
const open = useDialogAlertStore((state) => state.open);
|
|
5712
5831
|
const setOpen = useDialogAlertStore((state) => state.setOpen);
|
|
5713
5832
|
const dialogProps = useDialogAlertStore((state) => state.dialogProps);
|
|
5714
|
-
|
|
5833
|
+
React26.useEffect(() => {
|
|
5715
5834
|
if (!i18nResource) {
|
|
5716
5835
|
i18n_default.changeLanguage("sharedui");
|
|
5717
5836
|
return;
|
|
@@ -5821,8 +5940,8 @@ var defaultOperatorShortcuts = {
|
|
|
5821
5940
|
};
|
|
5822
5941
|
var DEFAULT_DEBOUNCE = 200;
|
|
5823
5942
|
function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
|
|
5824
|
-
const [selectedIndex, setSelectedIndex] =
|
|
5825
|
-
|
|
5943
|
+
const [selectedIndex, setSelectedIndex] = React26.useState(0);
|
|
5944
|
+
React26.useEffect(() => {
|
|
5826
5945
|
const handler = (event) => {
|
|
5827
5946
|
if (event.key === "ArrowDown") {
|
|
5828
5947
|
event.preventDefault();
|
|
@@ -5845,10 +5964,10 @@ function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
|
|
|
5845
5964
|
return [selectedIndex, setSelectedIndex];
|
|
5846
5965
|
}
|
|
5847
5966
|
function useDropdownPosition(clientRect, itemsCount) {
|
|
5848
|
-
const [rect, setRect] =
|
|
5849
|
-
const [style, setStyle] =
|
|
5850
|
-
const ref =
|
|
5851
|
-
|
|
5967
|
+
const [rect, setRect] = React26.useState(null);
|
|
5968
|
+
const [style, setStyle] = React26.useState({});
|
|
5969
|
+
const ref = React26.useRef(null);
|
|
5970
|
+
React26.useEffect(() => {
|
|
5852
5971
|
if (!clientRect) return;
|
|
5853
5972
|
const update = () => {
|
|
5854
5973
|
const nextRect = clientRect();
|
|
@@ -5865,7 +5984,7 @@ function useDropdownPosition(clientRect, itemsCount) {
|
|
|
5865
5984
|
resizeObserver.disconnect();
|
|
5866
5985
|
};
|
|
5867
5986
|
}, [clientRect]);
|
|
5868
|
-
|
|
5987
|
+
React26.useLayoutEffect(() => {
|
|
5869
5988
|
if (!rect || !ref.current) return;
|
|
5870
5989
|
const dropdown = ref.current;
|
|
5871
5990
|
const dropdownRect = dropdown.getBoundingClientRect();
|
|
@@ -5892,15 +6011,15 @@ var SuggestionList = ({
|
|
|
5892
6011
|
debounceMs = DEFAULT_DEBOUNCE,
|
|
5893
6012
|
query
|
|
5894
6013
|
}) => {
|
|
5895
|
-
const [items, setItems] =
|
|
5896
|
-
const [isLoading, setIsLoading] =
|
|
5897
|
-
const fetchId =
|
|
5898
|
-
const debounceHandle =
|
|
5899
|
-
const itemRefs =
|
|
6014
|
+
const [items, setItems] = React26.useState([]);
|
|
6015
|
+
const [isLoading, setIsLoading] = React26.useState(false);
|
|
6016
|
+
const fetchId = React26.useRef(0);
|
|
6017
|
+
const debounceHandle = React26.useRef(null);
|
|
6018
|
+
const itemRefs = React26.useRef([]);
|
|
5900
6019
|
const { ref, style, rect } = useDropdownPosition(clientRect, items.length);
|
|
5901
|
-
const normalizedMap =
|
|
5902
|
-
const normalizeItem =
|
|
5903
|
-
|
|
6020
|
+
const normalizedMap = React26.useMemo(() => mapItem, [mapItem]);
|
|
6021
|
+
const normalizeItem = React26.useMemo(() => normalizeToken, [normalizeToken]);
|
|
6022
|
+
React26.useEffect(() => {
|
|
5904
6023
|
const runFetch = (input) => {
|
|
5905
6024
|
fetchId.current += 1;
|
|
5906
6025
|
const currentId = fetchId.current;
|
|
@@ -5931,7 +6050,7 @@ var SuggestionList = ({
|
|
|
5931
6050
|
fetchId.current += 1;
|
|
5932
6051
|
};
|
|
5933
6052
|
}, [query, fetchItems, normalizedMap, normalizeItem, debounceMs]);
|
|
5934
|
-
const handleSelect =
|
|
6053
|
+
const handleSelect = React26.useMemo(
|
|
5935
6054
|
() => (item) => {
|
|
5936
6055
|
if (isLoading) return;
|
|
5937
6056
|
command(item);
|
|
@@ -5946,10 +6065,10 @@ var SuggestionList = ({
|
|
|
5946
6065
|
},
|
|
5947
6066
|
isLoading
|
|
5948
6067
|
);
|
|
5949
|
-
|
|
6068
|
+
React26.useEffect(() => {
|
|
5950
6069
|
setSelectedIndex(0);
|
|
5951
6070
|
}, [items, setSelectedIndex]);
|
|
5952
|
-
|
|
6071
|
+
React26.useEffect(() => {
|
|
5953
6072
|
const element = itemRefs.current[selectedIndex];
|
|
5954
6073
|
if (element) element.scrollIntoView({ block: "nearest" });
|
|
5955
6074
|
}, [selectedIndex]);
|
|
@@ -5997,8 +6116,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
|
|
|
5997
6116
|
var SUGGESTION_DEBOUNCE = 200;
|
|
5998
6117
|
var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
|
|
5999
6118
|
var TokenView = ({ node, editor, getPos }) => {
|
|
6000
|
-
const [isFocused, setIsFocused] =
|
|
6001
|
-
|
|
6119
|
+
const [isFocused, setIsFocused] = React26__namespace.default.useState(false);
|
|
6120
|
+
React26__namespace.default.useEffect(() => {
|
|
6002
6121
|
const handler = () => {
|
|
6003
6122
|
const { from, to } = editor.state.selection;
|
|
6004
6123
|
const position = getPos();
|
|
@@ -6913,21 +7032,21 @@ function ToolbarPlugin({
|
|
|
6913
7032
|
acceptImageMimeTypes
|
|
6914
7033
|
}) {
|
|
6915
7034
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
6916
|
-
const [state, setState] =
|
|
6917
|
-
const fileInputRef =
|
|
6918
|
-
const [isLinkDialogOpen, setLinkDialogOpen] =
|
|
6919
|
-
const [editingExistingLink, setEditingExistingLink] =
|
|
6920
|
-
const [linkNodeKey, setLinkNodeKey] =
|
|
6921
|
-
const [isImageDialogOpen, setImageDialogOpen] =
|
|
6922
|
-
const [editingExistingImage, setEditingExistingImage] =
|
|
6923
|
-
const [imageNodeKey, setImageNodeKey] =
|
|
7035
|
+
const [state, setState] = React26.useState(initialToolbarState);
|
|
7036
|
+
const fileInputRef = React26.useRef(null);
|
|
7037
|
+
const [isLinkDialogOpen, setLinkDialogOpen] = React26.useState(false);
|
|
7038
|
+
const [editingExistingLink, setEditingExistingLink] = React26.useState(false);
|
|
7039
|
+
const [linkNodeKey, setLinkNodeKey] = React26.useState(null);
|
|
7040
|
+
const [isImageDialogOpen, setImageDialogOpen] = React26.useState(false);
|
|
7041
|
+
const [editingExistingImage, setEditingExistingImage] = React26.useState(false);
|
|
7042
|
+
const [imageNodeKey, setImageNodeKey] = React26.useState(null);
|
|
6924
7043
|
const linkForm = reactHookForm.useForm({
|
|
6925
7044
|
defaultValues: { url: "", label: "" }
|
|
6926
7045
|
});
|
|
6927
7046
|
const imageForm = reactHookForm.useForm({
|
|
6928
7047
|
defaultValues: { url: "", alt: "", width: "", height: "" }
|
|
6929
7048
|
});
|
|
6930
|
-
const openImageDialog =
|
|
7049
|
+
const openImageDialog = React26.useCallback(() => {
|
|
6931
7050
|
if (disabled || !allowImageUrlInsert) {
|
|
6932
7051
|
return;
|
|
6933
7052
|
}
|
|
@@ -6961,7 +7080,7 @@ function ToolbarPlugin({
|
|
|
6961
7080
|
setImageNodeKey(targetImage?.getKey() ?? null);
|
|
6962
7081
|
setImageDialogOpen(true);
|
|
6963
7082
|
}, [allowImageUrlInsert, disabled, editor, imageForm]);
|
|
6964
|
-
const closeImageDialog =
|
|
7083
|
+
const closeImageDialog = React26.useCallback(() => {
|
|
6965
7084
|
setImageDialogOpen(false);
|
|
6966
7085
|
setEditingExistingImage(false);
|
|
6967
7086
|
setImageNodeKey(null);
|
|
@@ -6970,7 +7089,7 @@ function ToolbarPlugin({
|
|
|
6970
7089
|
editor.focus();
|
|
6971
7090
|
}, 0);
|
|
6972
7091
|
}, [editor, imageForm]);
|
|
6973
|
-
const openLinkDialog =
|
|
7092
|
+
const openLinkDialog = React26.useCallback(() => {
|
|
6974
7093
|
if (disabled) {
|
|
6975
7094
|
return;
|
|
6976
7095
|
}
|
|
@@ -7010,7 +7129,7 @@ function ToolbarPlugin({
|
|
|
7010
7129
|
setLinkNodeKey(detectedLink?.getKey() ?? null);
|
|
7011
7130
|
setLinkDialogOpen(true);
|
|
7012
7131
|
}, [disabled, editor, linkForm]);
|
|
7013
|
-
const closeLinkDialog =
|
|
7132
|
+
const closeLinkDialog = React26.useCallback(() => {
|
|
7014
7133
|
setLinkDialogOpen(false);
|
|
7015
7134
|
setEditingExistingLink(false);
|
|
7016
7135
|
setLinkNodeKey(null);
|
|
@@ -7051,7 +7170,7 @@ function ToolbarPlugin({
|
|
|
7051
7170
|
});
|
|
7052
7171
|
closeLinkDialog();
|
|
7053
7172
|
});
|
|
7054
|
-
const handleRemoveLink =
|
|
7173
|
+
const handleRemoveLink = React26.useCallback(() => {
|
|
7055
7174
|
editor.focus();
|
|
7056
7175
|
editor.update(() => {
|
|
7057
7176
|
if (linkNodeKey) {
|
|
@@ -7068,7 +7187,7 @@ function ToolbarPlugin({
|
|
|
7068
7187
|
});
|
|
7069
7188
|
closeLinkDialog();
|
|
7070
7189
|
}, [closeLinkDialog, editor, linkNodeKey]);
|
|
7071
|
-
const handleLinkDialogOpenChange =
|
|
7190
|
+
const handleLinkDialogOpenChange = React26.useCallback(
|
|
7072
7191
|
(open) => {
|
|
7073
7192
|
if (open) {
|
|
7074
7193
|
setLinkDialogOpen(true);
|
|
@@ -7078,7 +7197,7 @@ function ToolbarPlugin({
|
|
|
7078
7197
|
},
|
|
7079
7198
|
[closeLinkDialog]
|
|
7080
7199
|
);
|
|
7081
|
-
const updateToolbar =
|
|
7200
|
+
const updateToolbar = React26.useCallback(() => {
|
|
7082
7201
|
const selection = lexical.$getSelection();
|
|
7083
7202
|
if (!lexical.$isRangeSelection(selection)) {
|
|
7084
7203
|
return;
|
|
@@ -7118,7 +7237,7 @@ function ToolbarPlugin({
|
|
|
7118
7237
|
isLink: hasLink
|
|
7119
7238
|
}));
|
|
7120
7239
|
}, []);
|
|
7121
|
-
|
|
7240
|
+
React26__namespace.useEffect(() => {
|
|
7122
7241
|
return utils.mergeRegister(
|
|
7123
7242
|
editor.registerCommand(
|
|
7124
7243
|
lexical.CAN_UNDO_COMMAND,
|
|
@@ -7149,7 +7268,7 @@ function ToolbarPlugin({
|
|
|
7149
7268
|
})
|
|
7150
7269
|
);
|
|
7151
7270
|
}, [editor, updateToolbar]);
|
|
7152
|
-
const applyBlock =
|
|
7271
|
+
const applyBlock = React26.useCallback(
|
|
7153
7272
|
(nextBlock) => {
|
|
7154
7273
|
if (disabled) {
|
|
7155
7274
|
return;
|
|
@@ -7211,7 +7330,7 @@ function ToolbarPlugin({
|
|
|
7211
7330
|
},
|
|
7212
7331
|
[disabled, editor, state.blockType]
|
|
7213
7332
|
);
|
|
7214
|
-
const toggleFormat =
|
|
7333
|
+
const toggleFormat = React26.useCallback(
|
|
7215
7334
|
(format5) => {
|
|
7216
7335
|
if (disabled) {
|
|
7217
7336
|
return;
|
|
@@ -7220,10 +7339,10 @@ function ToolbarPlugin({
|
|
|
7220
7339
|
},
|
|
7221
7340
|
[disabled, editor]
|
|
7222
7341
|
);
|
|
7223
|
-
const toggleLink =
|
|
7342
|
+
const toggleLink = React26.useCallback(() => {
|
|
7224
7343
|
openLinkDialog();
|
|
7225
7344
|
}, [openLinkDialog]);
|
|
7226
|
-
const applyElementFormat =
|
|
7345
|
+
const applyElementFormat = React26.useCallback(
|
|
7227
7346
|
(format5) => {
|
|
7228
7347
|
if (disabled) {
|
|
7229
7348
|
return;
|
|
@@ -7234,7 +7353,7 @@ function ToolbarPlugin({
|
|
|
7234
7353
|
);
|
|
7235
7354
|
const canInsertImage = allowImageUrlInsert || Boolean(onImageUpload);
|
|
7236
7355
|
const imageAccept = acceptImageMimeTypes ?? DEFAULT_IMAGE_ACCEPT;
|
|
7237
|
-
const handleInsertImage =
|
|
7356
|
+
const handleInsertImage = React26.useCallback(() => {
|
|
7238
7357
|
if (disabled || !canInsertImage) {
|
|
7239
7358
|
return;
|
|
7240
7359
|
}
|
|
@@ -7245,7 +7364,7 @@ function ToolbarPlugin({
|
|
|
7245
7364
|
}
|
|
7246
7365
|
openImageDialog();
|
|
7247
7366
|
}, [canInsertImage, disabled, editor, onImageUpload, openImageDialog]);
|
|
7248
|
-
const handleFileChange =
|
|
7367
|
+
const handleFileChange = React26.useCallback(
|
|
7249
7368
|
async (event) => {
|
|
7250
7369
|
if (!onImageUpload) {
|
|
7251
7370
|
return;
|
|
@@ -7335,7 +7454,7 @@ function ToolbarPlugin({
|
|
|
7335
7454
|
});
|
|
7336
7455
|
closeImageDialog();
|
|
7337
7456
|
});
|
|
7338
|
-
const handleImageDialogOpenChange =
|
|
7457
|
+
const handleImageDialogOpenChange = React26.useCallback(
|
|
7339
7458
|
(open) => {
|
|
7340
7459
|
if (open) {
|
|
7341
7460
|
setImageDialogOpen(true);
|
|
@@ -7345,7 +7464,7 @@ function ToolbarPlugin({
|
|
|
7345
7464
|
},
|
|
7346
7465
|
[closeImageDialog]
|
|
7347
7466
|
);
|
|
7348
|
-
const handleRemoveImage =
|
|
7467
|
+
const handleRemoveImage = React26.useCallback(() => {
|
|
7349
7468
|
if (!imageNodeKey) {
|
|
7350
7469
|
closeImageDialog();
|
|
7351
7470
|
return;
|
|
@@ -7704,7 +7823,7 @@ function ControlledValuePlugin({
|
|
|
7704
7823
|
trackAppliedValue
|
|
7705
7824
|
}) {
|
|
7706
7825
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
7707
|
-
|
|
7826
|
+
React26__namespace.useEffect(() => {
|
|
7708
7827
|
if (value == null || trackAppliedValue.current === value) {
|
|
7709
7828
|
return;
|
|
7710
7829
|
}
|
|
@@ -7728,14 +7847,14 @@ function ControlledValuePlugin({
|
|
|
7728
7847
|
}
|
|
7729
7848
|
function EditableStatePlugin({ editable }) {
|
|
7730
7849
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
7731
|
-
|
|
7850
|
+
React26__namespace.useEffect(() => {
|
|
7732
7851
|
editor.setEditable(editable);
|
|
7733
7852
|
}, [editor, editable]);
|
|
7734
7853
|
return null;
|
|
7735
7854
|
}
|
|
7736
7855
|
function ImagesPlugin() {
|
|
7737
7856
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
7738
|
-
|
|
7857
|
+
React26__namespace.useEffect(() => {
|
|
7739
7858
|
return editor.registerCommand(
|
|
7740
7859
|
INSERT_IMAGE_COMMAND,
|
|
7741
7860
|
(payload) => {
|
|
@@ -7754,7 +7873,7 @@ function ImagesPlugin() {
|
|
|
7754
7873
|
}, [editor]);
|
|
7755
7874
|
return null;
|
|
7756
7875
|
}
|
|
7757
|
-
var RichText =
|
|
7876
|
+
var RichText = React26.forwardRef(function RichText2({
|
|
7758
7877
|
value,
|
|
7759
7878
|
defaultValue,
|
|
7760
7879
|
onChange,
|
|
@@ -7773,11 +7892,11 @@ var RichText = React4.forwardRef(function RichText2({
|
|
|
7773
7892
|
id,
|
|
7774
7893
|
...rest
|
|
7775
7894
|
}, ref) {
|
|
7776
|
-
const initialSerializedStateRef =
|
|
7895
|
+
const initialSerializedStateRef = React26.useRef(void 0);
|
|
7777
7896
|
if (initialSerializedStateRef.current === void 0) {
|
|
7778
7897
|
initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
|
|
7779
7898
|
}
|
|
7780
|
-
const initialConfig =
|
|
7899
|
+
const initialConfig = React26.useMemo(
|
|
7781
7900
|
() => ({
|
|
7782
7901
|
namespace: "RichTextEditor",
|
|
7783
7902
|
editable: !(readOnly || disabled),
|
|
@@ -7790,8 +7909,8 @@ var RichText = React4.forwardRef(function RichText2({
|
|
|
7790
7909
|
}),
|
|
7791
7910
|
[disabled, readOnly]
|
|
7792
7911
|
);
|
|
7793
|
-
const appliedValueRef =
|
|
7794
|
-
const handleChange =
|
|
7912
|
+
const appliedValueRef = React26.useRef(value ?? defaultValue);
|
|
7913
|
+
const handleChange = React26.useCallback(
|
|
7795
7914
|
(editorState, editor) => {
|
|
7796
7915
|
const serialized = JSON.stringify(editorState.toJSON());
|
|
7797
7916
|
appliedValueRef.current = serialized;
|
|
@@ -7980,13 +8099,13 @@ function SheetDescription({
|
|
|
7980
8099
|
);
|
|
7981
8100
|
}
|
|
7982
8101
|
function useIsMobile(breakpoint = 768) {
|
|
7983
|
-
const [isMobile, setIsMobile] =
|
|
8102
|
+
const [isMobile, setIsMobile] = React26.useState(() => {
|
|
7984
8103
|
if (typeof window === "undefined") {
|
|
7985
8104
|
return false;
|
|
7986
8105
|
}
|
|
7987
8106
|
return window.innerWidth < breakpoint;
|
|
7988
8107
|
});
|
|
7989
|
-
|
|
8108
|
+
React26.useEffect(() => {
|
|
7990
8109
|
function onResize() {
|
|
7991
8110
|
setIsMobile(window.innerWidth < breakpoint);
|
|
7992
8111
|
}
|
|
@@ -8016,9 +8135,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
8016
8135
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
8017
8136
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
8018
8137
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
8019
|
-
var SidebarContext =
|
|
8138
|
+
var SidebarContext = React26__namespace.createContext(null);
|
|
8020
8139
|
function useSidebar() {
|
|
8021
|
-
const context =
|
|
8140
|
+
const context = React26__namespace.useContext(SidebarContext);
|
|
8022
8141
|
if (!context) {
|
|
8023
8142
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
8024
8143
|
}
|
|
@@ -8034,10 +8153,10 @@ function SidebarProvider({
|
|
|
8034
8153
|
...props
|
|
8035
8154
|
}) {
|
|
8036
8155
|
const isMobile = useIsMobile();
|
|
8037
|
-
const [openMobile, setOpenMobile] =
|
|
8038
|
-
const [_open, _setOpen] =
|
|
8156
|
+
const [openMobile, setOpenMobile] = React26__namespace.useState(false);
|
|
8157
|
+
const [_open, _setOpen] = React26__namespace.useState(defaultOpen);
|
|
8039
8158
|
const open = openProp ?? _open;
|
|
8040
|
-
const setOpen =
|
|
8159
|
+
const setOpen = React26__namespace.useCallback(
|
|
8041
8160
|
(value) => {
|
|
8042
8161
|
const openState = typeof value === "function" ? value(open) : value;
|
|
8043
8162
|
if (setOpenProp) {
|
|
@@ -8049,10 +8168,10 @@ function SidebarProvider({
|
|
|
8049
8168
|
},
|
|
8050
8169
|
[setOpenProp, open]
|
|
8051
8170
|
);
|
|
8052
|
-
const toggleSidebar =
|
|
8171
|
+
const toggleSidebar = React26__namespace.useCallback(() => {
|
|
8053
8172
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
8054
8173
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
8055
|
-
|
|
8174
|
+
React26__namespace.useEffect(() => {
|
|
8056
8175
|
const handleKeyDown = (event) => {
|
|
8057
8176
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
8058
8177
|
event.preventDefault();
|
|
@@ -8063,7 +8182,7 @@ function SidebarProvider({
|
|
|
8063
8182
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
8064
8183
|
}, [toggleSidebar]);
|
|
8065
8184
|
const state = open ? "expanded" : "collapsed";
|
|
8066
|
-
const contextValue =
|
|
8185
|
+
const contextValue = React26__namespace.useMemo(
|
|
8067
8186
|
() => ({
|
|
8068
8187
|
state,
|
|
8069
8188
|
open,
|
|
@@ -8505,7 +8624,7 @@ function SidebarMenuSkeleton({
|
|
|
8505
8624
|
showIcon = false,
|
|
8506
8625
|
...props
|
|
8507
8626
|
}) {
|
|
8508
|
-
const width =
|
|
8627
|
+
const width = React26__namespace.useMemo(() => {
|
|
8509
8628
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
8510
8629
|
}, []);
|
|
8511
8630
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -8770,10 +8889,10 @@ var FormulaEditor = ({
|
|
|
8770
8889
|
fieldState,
|
|
8771
8890
|
mode = "edit"
|
|
8772
8891
|
}) => {
|
|
8773
|
-
const [isExpanded, setIsExpanded] =
|
|
8774
|
-
const lastEmittedValueRef =
|
|
8775
|
-
const ignorePropValueRef =
|
|
8776
|
-
const normalizedConfigs =
|
|
8892
|
+
const [isExpanded, setIsExpanded] = React26.useState(false);
|
|
8893
|
+
const lastEmittedValueRef = React26.useRef(null);
|
|
8894
|
+
const ignorePropValueRef = React26.useRef(false);
|
|
8895
|
+
const normalizedConfigs = React26.useMemo(() => {
|
|
8777
8896
|
const configsToUse = tokenConfigs?.length ? tokenConfigs : DEFAULT_TOKEN_CONFIGS;
|
|
8778
8897
|
return configsToUse.map((config) => ({
|
|
8779
8898
|
...config,
|
|
@@ -8782,18 +8901,18 @@ var FormulaEditor = ({
|
|
|
8782
8901
|
outputType: config.outputType ?? config.type
|
|
8783
8902
|
}));
|
|
8784
8903
|
}, [tokenConfigs]);
|
|
8785
|
-
const prefixMap =
|
|
8786
|
-
const configLookup =
|
|
8904
|
+
const prefixMap = React26.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
|
|
8905
|
+
const configLookup = React26.useMemo(() => {
|
|
8787
8906
|
const lookup = /* @__PURE__ */ new Map();
|
|
8788
8907
|
normalizedConfigs.forEach((config) => lookup.set(config.prefix, config));
|
|
8789
8908
|
return lookup;
|
|
8790
8909
|
}, [normalizedConfigs]);
|
|
8791
|
-
const allowedOperators =
|
|
8910
|
+
const allowedOperators = React26.useMemo(() => operators.map((operator) => operator.value), [operators]);
|
|
8792
8911
|
const displayError = errorMessage ?? fieldState?.error?.message;
|
|
8793
8912
|
const hasError = Boolean(displayError);
|
|
8794
8913
|
const isEditorReadOnly = mode === "display";
|
|
8795
8914
|
const isEditorDisabled = disabled || loading || isEditorReadOnly;
|
|
8796
|
-
const convertValueToContent =
|
|
8915
|
+
const convertValueToContent = React26.useCallback(
|
|
8797
8916
|
(input) => {
|
|
8798
8917
|
if (!input) return "";
|
|
8799
8918
|
const trimmed = input.trim();
|
|
@@ -8805,8 +8924,8 @@ var FormulaEditor = ({
|
|
|
8805
8924
|
},
|
|
8806
8925
|
[configLookup, prefixMap]
|
|
8807
8926
|
);
|
|
8808
|
-
const resolvedContent =
|
|
8809
|
-
const extensions =
|
|
8927
|
+
const resolvedContent = React26.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
|
|
8928
|
+
const extensions = React26.useMemo(
|
|
8810
8929
|
() => [
|
|
8811
8930
|
StarterKit__default.default.configure({ bold: false, italic: false }),
|
|
8812
8931
|
Token.configure({ configs: normalizedConfigs, onSelect: onSelectSuggestion }),
|
|
@@ -8838,11 +8957,11 @@ var FormulaEditor = ({
|
|
|
8838
8957
|
}
|
|
8839
8958
|
}
|
|
8840
8959
|
});
|
|
8841
|
-
|
|
8960
|
+
React26.useEffect(() => {
|
|
8842
8961
|
if (!editor) return;
|
|
8843
8962
|
editor.setEditable(!isEditorDisabled);
|
|
8844
8963
|
}, [editor, isEditorDisabled]);
|
|
8845
|
-
|
|
8964
|
+
React26.useEffect(() => {
|
|
8846
8965
|
if (!editor || resolvedContent === void 0) return;
|
|
8847
8966
|
if (ignorePropValueRef.current && typeof value === "string" && value === lastEmittedValueRef.current) {
|
|
8848
8967
|
ignorePropValueRef.current = false;
|
|
@@ -8974,7 +9093,7 @@ function SortableRow({
|
|
|
8974
9093
|
id: value,
|
|
8975
9094
|
disabled: name === "columns.0.id"
|
|
8976
9095
|
});
|
|
8977
|
-
const style =
|
|
9096
|
+
const style = React26__namespace.useMemo(
|
|
8978
9097
|
() => ({
|
|
8979
9098
|
transform: utilities.CSS.Transform.toString(transform),
|
|
8980
9099
|
transition
|
|
@@ -9086,8 +9205,8 @@ var GridSettingsModal = ({
|
|
|
9086
9205
|
onClose,
|
|
9087
9206
|
onSaveColumns
|
|
9088
9207
|
}) => {
|
|
9089
|
-
const [isDragging, setIsDragging] =
|
|
9090
|
-
const scrollRef =
|
|
9208
|
+
const [isDragging, setIsDragging] = React26.useState(false);
|
|
9209
|
+
const scrollRef = React26.useRef(null);
|
|
9091
9210
|
const form = reactHookForm.useForm({
|
|
9092
9211
|
resolver: zod$1.zodResolver(GridSettingsSchema),
|
|
9093
9212
|
defaultValues: { columns: currentColumns },
|
|
@@ -9099,7 +9218,7 @@ var GridSettingsModal = ({
|
|
|
9099
9218
|
name: "columns",
|
|
9100
9219
|
keyName: "fieldId"
|
|
9101
9220
|
});
|
|
9102
|
-
|
|
9221
|
+
React26.useEffect(() => {
|
|
9103
9222
|
if (isOpen) {
|
|
9104
9223
|
form.reset({ columns: currentColumns });
|
|
9105
9224
|
}
|
|
@@ -9376,7 +9495,7 @@ function getCandidateWidths({
|
|
|
9376
9495
|
}
|
|
9377
9496
|
return DEVICE_SIZES;
|
|
9378
9497
|
}
|
|
9379
|
-
var Image2 =
|
|
9498
|
+
var Image2 = React26__namespace.forwardRef(function Image3({
|
|
9380
9499
|
src,
|
|
9381
9500
|
alt,
|
|
9382
9501
|
width,
|
|
@@ -9406,34 +9525,34 @@ var Image2 = React4__namespace.forwardRef(function Image3({
|
|
|
9406
9525
|
} = imgProps;
|
|
9407
9526
|
const widthNumber = toNumber(width);
|
|
9408
9527
|
const heightNumber = toNumber(height);
|
|
9409
|
-
|
|
9528
|
+
React26__namespace.useEffect(() => {
|
|
9410
9529
|
if (!fill && (!widthNumber || !heightNumber)) {
|
|
9411
9530
|
console.warn(
|
|
9412
9531
|
"[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
|
|
9413
9532
|
);
|
|
9414
9533
|
}
|
|
9415
9534
|
}, [fill, heightNumber, widthNumber]);
|
|
9416
|
-
const candidateWidths =
|
|
9535
|
+
const candidateWidths = React26__namespace.useMemo(
|
|
9417
9536
|
() => getCandidateWidths({ width: widthNumber, sizes, fill }),
|
|
9418
9537
|
[fill, sizes, widthNumber]
|
|
9419
9538
|
);
|
|
9420
9539
|
const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
|
|
9421
|
-
const computedSrc =
|
|
9540
|
+
const computedSrc = React26__namespace.useMemo(() => {
|
|
9422
9541
|
if (unoptimized) {
|
|
9423
9542
|
return src;
|
|
9424
9543
|
}
|
|
9425
9544
|
return loader({ src, width: largestWidth, quality });
|
|
9426
9545
|
}, [largestWidth, loader, quality, src, unoptimized]);
|
|
9427
|
-
const computedSrcSet =
|
|
9546
|
+
const computedSrcSet = React26__namespace.useMemo(() => {
|
|
9428
9547
|
if (unoptimized) {
|
|
9429
9548
|
return void 0;
|
|
9430
9549
|
}
|
|
9431
9550
|
return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
|
|
9432
9551
|
}, [candidateWidths, loader, quality, src, unoptimized]);
|
|
9433
9552
|
const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
|
|
9434
|
-
const [isLoaded, setIsLoaded] =
|
|
9435
|
-
const internalRef =
|
|
9436
|
-
const setRefs =
|
|
9553
|
+
const [isLoaded, setIsLoaded] = React26__namespace.useState(false);
|
|
9554
|
+
const internalRef = React26__namespace.useRef(null);
|
|
9555
|
+
const setRefs = React26__namespace.useCallback(
|
|
9437
9556
|
(node) => {
|
|
9438
9557
|
internalRef.current = node;
|
|
9439
9558
|
if (!ref) {
|
|
@@ -9447,7 +9566,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
|
|
|
9447
9566
|
},
|
|
9448
9567
|
[ref]
|
|
9449
9568
|
);
|
|
9450
|
-
|
|
9569
|
+
React26__namespace.useEffect(() => {
|
|
9451
9570
|
const image = internalRef.current;
|
|
9452
9571
|
if (!image) {
|
|
9453
9572
|
return;
|
|
@@ -9459,7 +9578,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
|
|
|
9459
9578
|
setIsLoaded(false);
|
|
9460
9579
|
}
|
|
9461
9580
|
}, [onLoadingComplete, src]);
|
|
9462
|
-
const handleLoad =
|
|
9581
|
+
const handleLoad = React26__namespace.useCallback(
|
|
9463
9582
|
(event) => {
|
|
9464
9583
|
setIsLoaded(true);
|
|
9465
9584
|
onLoadProp?.(event);
|
|
@@ -9471,7 +9590,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
|
|
|
9471
9590
|
const fetchPriority = priority ? "high" : fetchPriorityProp;
|
|
9472
9591
|
const decoding = decodingProp ?? "async";
|
|
9473
9592
|
const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
|
|
9474
|
-
const wrapperStyle =
|
|
9593
|
+
const wrapperStyle = React26__namespace.useMemo(
|
|
9475
9594
|
() => ({
|
|
9476
9595
|
position: "relative",
|
|
9477
9596
|
display: fill ? "block" : "inline-block",
|
|
@@ -9481,7 +9600,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
|
|
|
9481
9600
|
}),
|
|
9482
9601
|
[fill, height, width]
|
|
9483
9602
|
);
|
|
9484
|
-
const imageStyle =
|
|
9603
|
+
const imageStyle = React26__namespace.useMemo(
|
|
9485
9604
|
() => ({
|
|
9486
9605
|
width: fill ? "100%" : formatDimension(width) ?? void 0,
|
|
9487
9606
|
height: fill ? "100%" : formatDimension(height) ?? void 0,
|
|
@@ -9543,7 +9662,7 @@ var Image2 = React4__namespace.forwardRef(function Image3({
|
|
|
9543
9662
|
});
|
|
9544
9663
|
Image2.displayName = "Image";
|
|
9545
9664
|
var ListTable = ({ onTableReady, children }) => {
|
|
9546
|
-
|
|
9665
|
+
React26__namespace.useEffect(() => {
|
|
9547
9666
|
if (onTableReady) {
|
|
9548
9667
|
onTableReady({ ready: true });
|
|
9549
9668
|
}
|
|
@@ -9588,7 +9707,7 @@ var ListHeader = ({
|
|
|
9588
9707
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "list-header", className: cn("rounded-t-lg px-4 py-2", bgColor, className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9589
9708
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2 text-lg", textClassName), children: [
|
|
9590
9709
|
titleIcon,
|
|
9591
|
-
|
|
9710
|
+
title
|
|
9592
9711
|
] }),
|
|
9593
9712
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: rightActions ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9594
9713
|
onSettingClick && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -9688,7 +9807,7 @@ var InfoIcon = (props) => {
|
|
|
9688
9807
|
}
|
|
9689
9808
|
);
|
|
9690
9809
|
};
|
|
9691
|
-
var InfoIcon_default =
|
|
9810
|
+
var InfoIcon_default = React26__namespace.default.memo(InfoIcon);
|
|
9692
9811
|
var Navbar = ({
|
|
9693
9812
|
className,
|
|
9694
9813
|
title,
|
|
@@ -9713,7 +9832,7 @@ var Navbar = ({
|
|
|
9713
9832
|
}) => {
|
|
9714
9833
|
const { isMobile, isTablet, isDesktop } = useScreenSize_default();
|
|
9715
9834
|
const Icon2 = lucideReact.CircleHelp;
|
|
9716
|
-
const shouldShowSeparator = !separatorDisable &&
|
|
9835
|
+
const shouldShowSeparator = !separatorDisable && React26.isValidElement(searchButton);
|
|
9717
9836
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9718
9837
|
"nav",
|
|
9719
9838
|
{
|
|
@@ -9724,8 +9843,8 @@ var Navbar = ({
|
|
|
9724
9843
|
children: [
|
|
9725
9844
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
9726
9845
|
headImageURL !== "" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: headImageURL, alt: "", className: cn("w-full h-full", headImageURLClassName) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
9727
|
-
|
|
9728
|
-
|
|
9846
|
+
React26.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
|
|
9847
|
+
React26.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
|
|
9729
9848
|
] }),
|
|
9730
9849
|
tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
9731
9850
|
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "text-white hover:opacity-80 ", children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon_default, { className: "w-4" }) }) }),
|
|
@@ -9756,10 +9875,10 @@ var Navbar = ({
|
|
|
9756
9875
|
),
|
|
9757
9876
|
children: [
|
|
9758
9877
|
tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
9759
|
-
|
|
9878
|
+
React26.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
|
|
9760
9879
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
|
|
9761
9880
|
] }),
|
|
9762
|
-
|
|
9881
|
+
React26.isValidElement(tooltipdescription) && tooltipdescription
|
|
9763
9882
|
]
|
|
9764
9883
|
}
|
|
9765
9884
|
),
|
|
@@ -9814,13 +9933,13 @@ var Navbar = ({
|
|
|
9814
9933
|
}
|
|
9815
9934
|
),
|
|
9816
9935
|
shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
|
|
9817
|
-
|
|
9936
|
+
React26.isValidElement(searchButton) ? searchButton : ""
|
|
9818
9937
|
] })
|
|
9819
9938
|
]
|
|
9820
9939
|
}
|
|
9821
9940
|
);
|
|
9822
9941
|
};
|
|
9823
|
-
var navbar_default =
|
|
9942
|
+
var navbar_default = React26__namespace.default.memo(Navbar);
|
|
9824
9943
|
var usePreventPageLeaveStore = zustand.create((set) => ({
|
|
9825
9944
|
isPreventing: false,
|
|
9826
9945
|
setPreventing: (value) => set({ isPreventing: value })
|
|
@@ -9830,7 +9949,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
|
|
|
9830
9949
|
// src/components/prevent-page-leave/PreventPageLeave.tsx
|
|
9831
9950
|
var PreventPageLeave = ({ children }) => {
|
|
9832
9951
|
const { isPreventing } = usePreventPageLeaveStore();
|
|
9833
|
-
|
|
9952
|
+
React26.useEffect(() => {
|
|
9834
9953
|
if (!isPreventing || typeof window === "undefined") {
|
|
9835
9954
|
return;
|
|
9836
9955
|
}
|
|
@@ -9848,7 +9967,7 @@ var PreventPageLeave = ({ children }) => {
|
|
|
9848
9967
|
var PreventPageLeave_default = PreventPageLeave;
|
|
9849
9968
|
var usePreventPageLeave = ({ isPrevening }) => {
|
|
9850
9969
|
const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
|
|
9851
|
-
|
|
9970
|
+
React26.useEffect(() => {
|
|
9852
9971
|
setPreventing(isPrevening);
|
|
9853
9972
|
}, [isPrevening, setPreventing]);
|
|
9854
9973
|
};
|
|
@@ -9989,20 +10108,20 @@ var CropperModal = ({
|
|
|
9989
10108
|
title,
|
|
9990
10109
|
props
|
|
9991
10110
|
}) => {
|
|
9992
|
-
const [isLoading, setIsLoading] =
|
|
9993
|
-
const [crop, setCrop] =
|
|
9994
|
-
const [zoom, setZoom] =
|
|
9995
|
-
const [croppedAreaPixels, setCroppedAreaPixels] =
|
|
9996
|
-
const handleClose =
|
|
10111
|
+
const [isLoading, setIsLoading] = React26.useState(false);
|
|
10112
|
+
const [crop, setCrop] = React26.useState({ x: 0, y: 0 });
|
|
10113
|
+
const [zoom, setZoom] = React26.useState();
|
|
10114
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = React26.useState(null);
|
|
10115
|
+
const handleClose = React26.useCallback(() => {
|
|
9997
10116
|
onOpenChange(false);
|
|
9998
10117
|
}, [onOpenChange]);
|
|
9999
|
-
const handleCancel =
|
|
10118
|
+
const handleCancel = React26.useCallback(() => {
|
|
10000
10119
|
if (onCancel) {
|
|
10001
10120
|
onCancel();
|
|
10002
10121
|
}
|
|
10003
10122
|
handleClose();
|
|
10004
10123
|
}, [handleClose, onCancel]);
|
|
10005
|
-
const handleCropComplete =
|
|
10124
|
+
const handleCropComplete = React26.useCallback((_, croppedAreaPixels2) => {
|
|
10006
10125
|
setCroppedAreaPixels(croppedAreaPixels2);
|
|
10007
10126
|
}, []);
|
|
10008
10127
|
const handleConfirm = async () => {
|
|
@@ -10096,6 +10215,231 @@ var CropperModal = ({
|
|
|
10096
10215
|
}
|
|
10097
10216
|
);
|
|
10098
10217
|
};
|
|
10218
|
+
var REACT_ELEMENT_TYPE_18 = /* @__PURE__ */ Symbol.for("react.element");
|
|
10219
|
+
var REACT_ELEMENT_TYPE_19 = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
10220
|
+
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
10221
|
+
function isFragment(object) {
|
|
10222
|
+
return (
|
|
10223
|
+
// Base object type
|
|
10224
|
+
object && typeof object === "object" && // React Element type
|
|
10225
|
+
(object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) && // React Fragment type
|
|
10226
|
+
object.type === REACT_FRAGMENT_TYPE
|
|
10227
|
+
);
|
|
10228
|
+
}
|
|
10229
|
+
var isValidText = (val) => ["string", "number"].includes(typeof val);
|
|
10230
|
+
function toArray(children, option = {}) {
|
|
10231
|
+
let ret = [];
|
|
10232
|
+
React26__namespace.Children.forEach(children, (child) => {
|
|
10233
|
+
if ((child === void 0 || child === null) && !option.keepEmpty) {
|
|
10234
|
+
return;
|
|
10235
|
+
}
|
|
10236
|
+
if (Array.isArray(child)) {
|
|
10237
|
+
ret = ret.concat(toArray(child));
|
|
10238
|
+
} else if (isFragment(child) && child.props) {
|
|
10239
|
+
ret = ret.concat(toArray(child.props.children, option));
|
|
10240
|
+
} else {
|
|
10241
|
+
ret.push(child);
|
|
10242
|
+
}
|
|
10243
|
+
});
|
|
10244
|
+
return ret;
|
|
10245
|
+
}
|
|
10246
|
+
var MeasureText = React26__namespace.forwardRef(({ style, children }, ref) => {
|
|
10247
|
+
const spanRef = React26__namespace.useRef(null);
|
|
10248
|
+
React26__namespace.useImperativeHandle(ref, () => ({
|
|
10249
|
+
isExceed: () => {
|
|
10250
|
+
const span = spanRef.current;
|
|
10251
|
+
return span.scrollHeight > span.clientHeight;
|
|
10252
|
+
},
|
|
10253
|
+
getHeight: () => spanRef.current.clientHeight
|
|
10254
|
+
}));
|
|
10255
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10256
|
+
"span",
|
|
10257
|
+
{
|
|
10258
|
+
"aria-hidden": true,
|
|
10259
|
+
ref: spanRef,
|
|
10260
|
+
style: {
|
|
10261
|
+
position: "fixed",
|
|
10262
|
+
display: "block",
|
|
10263
|
+
left: 0,
|
|
10264
|
+
top: 0,
|
|
10265
|
+
pointerEvents: "none",
|
|
10266
|
+
...style
|
|
10267
|
+
},
|
|
10268
|
+
children
|
|
10269
|
+
}
|
|
10270
|
+
);
|
|
10271
|
+
});
|
|
10272
|
+
var getNodesLen = (nodeList) => nodeList.reduce((totalLen, node) => totalLen + (isValidText(node) ? String(node).length : 1), 0);
|
|
10273
|
+
function sliceNodes(nodeList, len) {
|
|
10274
|
+
let currLen = 0;
|
|
10275
|
+
const currentNodeList = [];
|
|
10276
|
+
for (let i = 0; i < nodeList.length; i += 1) {
|
|
10277
|
+
if (currLen === len) {
|
|
10278
|
+
return currentNodeList;
|
|
10279
|
+
}
|
|
10280
|
+
const node = nodeList[i];
|
|
10281
|
+
const canCut = isValidText(node);
|
|
10282
|
+
const nodeLen = canCut ? String(node).length : 1;
|
|
10283
|
+
const nextLen = currLen + nodeLen;
|
|
10284
|
+
if (nextLen > len) {
|
|
10285
|
+
const restLen = len - currLen;
|
|
10286
|
+
currentNodeList.push(String(node).slice(0, restLen));
|
|
10287
|
+
return currentNodeList;
|
|
10288
|
+
}
|
|
10289
|
+
currentNodeList.push(node);
|
|
10290
|
+
currLen = nextLen;
|
|
10291
|
+
}
|
|
10292
|
+
return nodeList;
|
|
10293
|
+
}
|
|
10294
|
+
var STATUS_MEASURE_NONE = 0;
|
|
10295
|
+
var STATUS_MEASURE_PREPARE = 1;
|
|
10296
|
+
var STATUS_MEASURE_START = 2;
|
|
10297
|
+
var STATUS_MEASURE_NEED_ELLIPSIS = 3;
|
|
10298
|
+
var STATUS_MEASURE_NO_NEED_ELLIPSIS = 4;
|
|
10299
|
+
var lineClipStyle = {
|
|
10300
|
+
display: "-webkit-box",
|
|
10301
|
+
overflow: "hidden",
|
|
10302
|
+
WebkitBoxOrient: "vertical"
|
|
10303
|
+
};
|
|
10304
|
+
function EllipsisMeasure(props) {
|
|
10305
|
+
const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
|
|
10306
|
+
const nodeList = React26__namespace.useMemo(() => toArray(text), [text]);
|
|
10307
|
+
const nodeLen = React26__namespace.useMemo(() => getNodesLen(nodeList), [text]);
|
|
10308
|
+
const fullContent = React26__namespace.useMemo(() => children(nodeList, false), [text]);
|
|
10309
|
+
const [ellipsisCutIndex, setEllipsisCutIndex] = React26__namespace.useState(null);
|
|
10310
|
+
const cutMidRef = React26__namespace.useRef(null);
|
|
10311
|
+
const measureWhiteSpaceRef = React26__namespace.useRef(null);
|
|
10312
|
+
const needEllipsisRef = React26__namespace.useRef(null);
|
|
10313
|
+
const descRowsEllipsisRef = React26__namespace.useRef(null);
|
|
10314
|
+
const symbolRowEllipsisRef = React26__namespace.useRef(null);
|
|
10315
|
+
const [canEllipsis, setCanEllipsis] = React26__namespace.useState(false);
|
|
10316
|
+
const [needEllipsis, setNeedEllipsis] = React26__namespace.useState(STATUS_MEASURE_NONE);
|
|
10317
|
+
const [ellipsisHeight, setEllipsisHeight] = React26__namespace.useState(0);
|
|
10318
|
+
const [parentWhiteSpace, setParentWhiteSpace] = React26__namespace.useState(null);
|
|
10319
|
+
useIsomorphicLayoutEffect(() => {
|
|
10320
|
+
if (enableMeasure && width && nodeLen) {
|
|
10321
|
+
setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
10322
|
+
} else {
|
|
10323
|
+
setNeedEllipsis(STATUS_MEASURE_NONE);
|
|
10324
|
+
}
|
|
10325
|
+
}, [width, text, rows, enableMeasure, nodeList]);
|
|
10326
|
+
useIsomorphicLayoutEffect(() => {
|
|
10327
|
+
if (needEllipsis === STATUS_MEASURE_PREPARE) {
|
|
10328
|
+
setNeedEllipsis(STATUS_MEASURE_START);
|
|
10329
|
+
const nextWhiteSpace = measureWhiteSpaceRef.current && getComputedStyle(measureWhiteSpaceRef.current).whiteSpace;
|
|
10330
|
+
setParentWhiteSpace(nextWhiteSpace);
|
|
10331
|
+
} else if (needEllipsis === STATUS_MEASURE_START) {
|
|
10332
|
+
const isOverflow = !!needEllipsisRef.current?.isExceed();
|
|
10333
|
+
setNeedEllipsis(isOverflow ? STATUS_MEASURE_NEED_ELLIPSIS : STATUS_MEASURE_NO_NEED_ELLIPSIS);
|
|
10334
|
+
setEllipsisCutIndex(isOverflow ? [0, nodeLen] : null);
|
|
10335
|
+
setCanEllipsis(isOverflow);
|
|
10336
|
+
const baseRowsEllipsisHeight = needEllipsisRef.current?.getHeight() || 0;
|
|
10337
|
+
const descRowsEllipsisHeight = rows === 1 ? 0 : descRowsEllipsisRef.current?.getHeight() || 0;
|
|
10338
|
+
const symbolRowEllipsisHeight = symbolRowEllipsisRef.current?.getHeight() || 0;
|
|
10339
|
+
const maxRowsHeight = Math.max(
|
|
10340
|
+
baseRowsEllipsisHeight,
|
|
10341
|
+
// height of rows with ellipsis
|
|
10342
|
+
descRowsEllipsisHeight + symbolRowEllipsisHeight
|
|
10343
|
+
);
|
|
10344
|
+
setEllipsisHeight(maxRowsHeight + 1);
|
|
10345
|
+
onEllipsis(isOverflow);
|
|
10346
|
+
}
|
|
10347
|
+
}, [needEllipsis]);
|
|
10348
|
+
const cutMidIndex = ellipsisCutIndex ? Math.ceil((ellipsisCutIndex[0] + ellipsisCutIndex[1]) / 2) : 0;
|
|
10349
|
+
useIsomorphicLayoutEffect(() => {
|
|
10350
|
+
const [minIndex, maxIndex] = ellipsisCutIndex || [0, 0];
|
|
10351
|
+
if (minIndex !== maxIndex) {
|
|
10352
|
+
const midHeight = cutMidRef.current?.getHeight() || 0;
|
|
10353
|
+
const isOverflow = midHeight > ellipsisHeight;
|
|
10354
|
+
let targetMidIndex = cutMidIndex;
|
|
10355
|
+
if (maxIndex - minIndex === 1) {
|
|
10356
|
+
targetMidIndex = isOverflow ? minIndex : maxIndex;
|
|
10357
|
+
}
|
|
10358
|
+
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
|
|
10359
|
+
}
|
|
10360
|
+
}, [ellipsisCutIndex, cutMidIndex]);
|
|
10361
|
+
const finalContent = React26__namespace.useMemo(() => {
|
|
10362
|
+
if (!enableMeasure) {
|
|
10363
|
+
return children(nodeList, false);
|
|
10364
|
+
}
|
|
10365
|
+
if (needEllipsis !== STATUS_MEASURE_NEED_ELLIPSIS || !ellipsisCutIndex || ellipsisCutIndex[0] !== ellipsisCutIndex[1]) {
|
|
10366
|
+
const content = children(nodeList, false);
|
|
10367
|
+
if ([STATUS_MEASURE_NO_NEED_ELLIPSIS, STATUS_MEASURE_NONE].includes(needEllipsis)) {
|
|
10368
|
+
return content;
|
|
10369
|
+
}
|
|
10370
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10371
|
+
"span",
|
|
10372
|
+
{
|
|
10373
|
+
style: {
|
|
10374
|
+
...lineClipStyle,
|
|
10375
|
+
WebkitLineClamp: rows
|
|
10376
|
+
},
|
|
10377
|
+
children: content
|
|
10378
|
+
}
|
|
10379
|
+
);
|
|
10380
|
+
}
|
|
10381
|
+
return children(expanded ? nodeList : sliceNodes(nodeList, ellipsisCutIndex[0]), canEllipsis);
|
|
10382
|
+
}, [expanded, needEllipsis, ellipsisCutIndex, nodeList, ...miscDeps]);
|
|
10383
|
+
const measureStyle = {
|
|
10384
|
+
width,
|
|
10385
|
+
margin: 0,
|
|
10386
|
+
padding: 0,
|
|
10387
|
+
whiteSpace: parentWhiteSpace === "nowrap" ? "normal" : "inherit"
|
|
10388
|
+
};
|
|
10389
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10390
|
+
finalContent,
|
|
10391
|
+
needEllipsis === STATUS_MEASURE_START && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10392
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10393
|
+
MeasureText,
|
|
10394
|
+
{
|
|
10395
|
+
style: {
|
|
10396
|
+
...measureStyle,
|
|
10397
|
+
...lineClipStyle,
|
|
10398
|
+
WebkitLineClamp: rows
|
|
10399
|
+
},
|
|
10400
|
+
ref: needEllipsisRef,
|
|
10401
|
+
children: fullContent
|
|
10402
|
+
}
|
|
10403
|
+
),
|
|
10404
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10405
|
+
MeasureText,
|
|
10406
|
+
{
|
|
10407
|
+
style: {
|
|
10408
|
+
...measureStyle,
|
|
10409
|
+
...lineClipStyle,
|
|
10410
|
+
WebkitLineClamp: rows - 1
|
|
10411
|
+
},
|
|
10412
|
+
ref: descRowsEllipsisRef,
|
|
10413
|
+
children: fullContent
|
|
10414
|
+
}
|
|
10415
|
+
),
|
|
10416
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10417
|
+
MeasureText,
|
|
10418
|
+
{
|
|
10419
|
+
style: {
|
|
10420
|
+
...measureStyle,
|
|
10421
|
+
...lineClipStyle,
|
|
10422
|
+
WebkitLineClamp: 1
|
|
10423
|
+
},
|
|
10424
|
+
ref: symbolRowEllipsisRef,
|
|
10425
|
+
children: children([], true)
|
|
10426
|
+
}
|
|
10427
|
+
)
|
|
10428
|
+
] }),
|
|
10429
|
+
needEllipsis === STATUS_MEASURE_NEED_ELLIPSIS && ellipsisCutIndex && ellipsisCutIndex[0] !== ellipsisCutIndex[1] && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10430
|
+
MeasureText,
|
|
10431
|
+
{
|
|
10432
|
+
style: {
|
|
10433
|
+
...measureStyle,
|
|
10434
|
+
top: 400
|
|
10435
|
+
},
|
|
10436
|
+
ref: cutMidRef,
|
|
10437
|
+
children: children(sliceNodes(nodeList, cutMidIndex), true)
|
|
10438
|
+
}
|
|
10439
|
+
),
|
|
10440
|
+
needEllipsis === STATUS_MEASURE_PREPARE && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { whiteSpace: "inherit" }, ref: measureWhiteSpaceRef })
|
|
10441
|
+
] });
|
|
10442
|
+
}
|
|
10099
10443
|
var Truncated = ({
|
|
10100
10444
|
children,
|
|
10101
10445
|
className,
|
|
@@ -10105,49 +10449,41 @@ var Truncated = ({
|
|
|
10105
10449
|
tooltipProps,
|
|
10106
10450
|
tooltipContentProps
|
|
10107
10451
|
}) => {
|
|
10108
|
-
const elementRef =
|
|
10109
|
-
const [open, setOpen] =
|
|
10110
|
-
const [isTruncated, setIsTruncated] =
|
|
10452
|
+
const elementRef = React26__namespace.useRef(null);
|
|
10453
|
+
const [open, setOpen] = React26__namespace.useState(false);
|
|
10454
|
+
const [isTruncated, setIsTruncated] = React26__namespace.useState(false);
|
|
10455
|
+
const [measureWidth, setMeasureWidth] = React26__namespace.useState(0);
|
|
10111
10456
|
const Comp = as;
|
|
10112
10457
|
const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
|
|
10113
10458
|
const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
|
|
10114
|
-
|
|
10459
|
+
const enableMeasure = Boolean(ellipsis) && !tooltipProps?.disabled;
|
|
10460
|
+
useIsomorphicLayoutEffect(() => {
|
|
10115
10461
|
const el = elementRef.current;
|
|
10116
10462
|
if (!el) return;
|
|
10117
|
-
const
|
|
10118
|
-
if (!ellipsis) {
|
|
10119
|
-
setIsTruncated(false);
|
|
10120
|
-
return;
|
|
10121
|
-
}
|
|
10463
|
+
const updateWidth = () => {
|
|
10122
10464
|
const rect = el.getBoundingClientRect();
|
|
10123
|
-
const width = el.clientWidth || el.offsetWidth || rect.width;
|
|
10124
|
-
|
|
10125
|
-
if (!width || !height) {
|
|
10126
|
-
setIsTruncated(false);
|
|
10127
|
-
return;
|
|
10128
|
-
}
|
|
10129
|
-
const epsilon = 1;
|
|
10130
|
-
const overflowWidth = el.scrollWidth - width > epsilon;
|
|
10131
|
-
const overflowHeight = el.scrollHeight - height > epsilon;
|
|
10132
|
-
setIsTruncated(overflowWidth || overflowHeight);
|
|
10465
|
+
const width = el.clientWidth || el.offsetWidth || rect.width || 0;
|
|
10466
|
+
setMeasureWidth(width);
|
|
10133
10467
|
};
|
|
10134
|
-
|
|
10468
|
+
updateWidth();
|
|
10469
|
+
const resizeObserver = new ResizeObserver(() => requestAnimationFrame(updateWidth));
|
|
10135
10470
|
resizeObserver.observe(el);
|
|
10136
|
-
const mutationObserver = new MutationObserver(() => measure());
|
|
10137
|
-
mutationObserver.observe(el, { childList: true, subtree: true, characterData: true });
|
|
10138
|
-
requestAnimationFrame(measure);
|
|
10139
10471
|
return () => {
|
|
10140
10472
|
resizeObserver.disconnect();
|
|
10141
|
-
mutationObserver.disconnect();
|
|
10142
10473
|
};
|
|
10143
|
-
}, [
|
|
10144
|
-
|
|
10474
|
+
}, []);
|
|
10475
|
+
useIsomorphicLayoutEffect(() => {
|
|
10476
|
+
if (!enableMeasure) {
|
|
10477
|
+
setIsTruncated(false);
|
|
10478
|
+
}
|
|
10479
|
+
}, [enableMeasure]);
|
|
10480
|
+
const truncationClass = React26__namespace.useMemo(() => {
|
|
10145
10481
|
if (!ellipsis) return "";
|
|
10146
10482
|
if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
|
|
10147
10483
|
if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
|
|
10148
10484
|
return "truncate";
|
|
10149
10485
|
}, [ellipsis, lineClampLines]);
|
|
10150
|
-
const clampedStyle =
|
|
10486
|
+
const clampedStyle = React26__namespace.useMemo(() => {
|
|
10151
10487
|
if (!lineClampLines) return style;
|
|
10152
10488
|
return {
|
|
10153
10489
|
...style,
|
|
@@ -10157,7 +10493,19 @@ var Truncated = ({
|
|
|
10157
10493
|
overflow: "hidden"
|
|
10158
10494
|
};
|
|
10159
10495
|
}, [lineClampLines, style]);
|
|
10160
|
-
const baseContent = /* @__PURE__ */ jsxRuntime.jsx(Comp, { ref: elementRef, className: cn(truncationClass, className), style: clampedStyle, children:
|
|
10496
|
+
const baseContent = /* @__PURE__ */ jsxRuntime.jsx(Comp, { ref: elementRef, className: cn(truncationClass, className), style: clampedStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10497
|
+
EllipsisMeasure,
|
|
10498
|
+
{
|
|
10499
|
+
enableMeasure,
|
|
10500
|
+
text: normalizedChildren,
|
|
10501
|
+
width: measureWidth,
|
|
10502
|
+
rows: lineClampLines ?? 1,
|
|
10503
|
+
expanded: false,
|
|
10504
|
+
miscDeps: [truncationClass],
|
|
10505
|
+
onEllipsis: setIsTruncated,
|
|
10506
|
+
children: () => normalizedChildren
|
|
10507
|
+
}
|
|
10508
|
+
) });
|
|
10161
10509
|
let tooltipContent = normalizedChildren;
|
|
10162
10510
|
if (typeof ellipsis === "object") {
|
|
10163
10511
|
tooltipContent = ellipsis?.content ?? normalizedChildren;
|
|
@@ -10184,10 +10532,10 @@ var Truncated = ({
|
|
|
10184
10532
|
{
|
|
10185
10533
|
side: tooltipSide,
|
|
10186
10534
|
className: cn(
|
|
10187
|
-
"text-white bg-
|
|
10535
|
+
"text-white bg-sus-secondary-gray-10 max-w-xs sm:max-w-md wrap-break-word shadow-lg",
|
|
10188
10536
|
tooltipContentClassName
|
|
10189
10537
|
),
|
|
10190
|
-
arrowClassName: cn("bg-
|
|
10538
|
+
arrowClassName: cn("bg-sus-secondary-gray-10 fill-sus-secondary-gray-10", tooltipArrowClassName),
|
|
10191
10539
|
...tooltipContentRest,
|
|
10192
10540
|
children: tooltipContent
|
|
10193
10541
|
}
|
|
@@ -10197,7 +10545,7 @@ var Truncated = ({
|
|
|
10197
10545
|
);
|
|
10198
10546
|
};
|
|
10199
10547
|
var truncated_default = Truncated;
|
|
10200
|
-
var InputPrimitive2 =
|
|
10548
|
+
var InputPrimitive2 = React26__namespace.forwardRef(
|
|
10201
10549
|
({ className, type = "text", ...props }, ref) => {
|
|
10202
10550
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10203
10551
|
"input",
|
|
@@ -10236,7 +10584,7 @@ var inputVariants2 = classVarianceAuthority.cva("", {
|
|
|
10236
10584
|
appearance: "filled"
|
|
10237
10585
|
}
|
|
10238
10586
|
});
|
|
10239
|
-
var Input2 =
|
|
10587
|
+
var Input2 = React26__namespace.forwardRef(
|
|
10240
10588
|
({
|
|
10241
10589
|
className,
|
|
10242
10590
|
wrapperClassName,
|
|
@@ -10269,8 +10617,8 @@ var Input2 = React4__namespace.forwardRef(
|
|
|
10269
10617
|
onChange: onChangeProp
|
|
10270
10618
|
} = rest;
|
|
10271
10619
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
10272
|
-
const messageId =
|
|
10273
|
-
const handleChange =
|
|
10620
|
+
const messageId = React26__namespace.useId();
|
|
10621
|
+
const handleChange = React26__namespace.useCallback(
|
|
10274
10622
|
(event) => {
|
|
10275
10623
|
onChangeProp?.(event);
|
|
10276
10624
|
onValueChange?.(event.target.value);
|
|
@@ -10398,8 +10746,8 @@ var ActionMenu = ({
|
|
|
10398
10746
|
actionButtonClassName,
|
|
10399
10747
|
separatorClassName
|
|
10400
10748
|
}) => {
|
|
10401
|
-
const [open, setOpen] =
|
|
10402
|
-
const isAllowed =
|
|
10749
|
+
const [open, setOpen] = React26.useState(false);
|
|
10750
|
+
const isAllowed = React26.useCallback(
|
|
10403
10751
|
(requiredPermission) => {
|
|
10404
10752
|
if (!checkPermissionFunc || requiredPermission === void 0) {
|
|
10405
10753
|
return true;
|
|
@@ -10408,7 +10756,7 @@ var ActionMenu = ({
|
|
|
10408
10756
|
},
|
|
10409
10757
|
[checkPermissionFunc]
|
|
10410
10758
|
);
|
|
10411
|
-
const filteredButtons =
|
|
10759
|
+
const filteredButtons = React26.useMemo(() => {
|
|
10412
10760
|
return buttons.filter((btn) => isAllowed(btn.requiredPermission));
|
|
10413
10761
|
}, [buttons, isAllowed]);
|
|
10414
10762
|
if (buttons.length === 0) {
|
|
@@ -10663,13 +11011,13 @@ var useFieldNames = ({
|
|
|
10663
11011
|
fieldNames
|
|
10664
11012
|
}) => {
|
|
10665
11013
|
const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
|
|
10666
|
-
const getLabelField =
|
|
11014
|
+
const getLabelField = React26__namespace.default.useCallback(
|
|
10667
11015
|
(option) => {
|
|
10668
11016
|
return option?.[labelFieldKey];
|
|
10669
11017
|
},
|
|
10670
11018
|
[labelFieldKey]
|
|
10671
11019
|
);
|
|
10672
|
-
const getValueField =
|
|
11020
|
+
const getValueField = React26__namespace.default.useCallback(
|
|
10673
11021
|
(option) => {
|
|
10674
11022
|
return option?.[valueFieldKey];
|
|
10675
11023
|
},
|
|
@@ -10690,7 +11038,7 @@ var VirtualizedCommand = ({
|
|
|
10690
11038
|
emptyContent = "No data.",
|
|
10691
11039
|
searchPlaceholder,
|
|
10692
11040
|
value,
|
|
10693
|
-
notFoundContent = "
|
|
11041
|
+
notFoundContent = "No item found.",
|
|
10694
11042
|
showSearch = true,
|
|
10695
11043
|
fieldNames,
|
|
10696
11044
|
disabledOption,
|
|
@@ -10701,11 +11049,11 @@ var VirtualizedCommand = ({
|
|
|
10701
11049
|
onFocus
|
|
10702
11050
|
}) => {
|
|
10703
11051
|
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
10704
|
-
const internalOptions =
|
|
10705
|
-
const [filteredOptions, setFilteredOptions] =
|
|
10706
|
-
const [focusedIndex, setFocusedIndex] =
|
|
10707
|
-
const [isKeyboardNavActive, setIsKeyboardNavActive] =
|
|
10708
|
-
const parentRef =
|
|
11052
|
+
const internalOptions = React26__namespace.useMemo(() => options ?? [], [options]);
|
|
11053
|
+
const [filteredOptions, setFilteredOptions] = React26__namespace.useState(internalOptions);
|
|
11054
|
+
const [focusedIndex, setFocusedIndex] = React26__namespace.useState(0);
|
|
11055
|
+
const [isKeyboardNavActive, setIsKeyboardNavActive] = React26__namespace.useState(false);
|
|
11056
|
+
const parentRef = React26__namespace.useRef(null);
|
|
10709
11057
|
const virtualizer = reactVirtual.useVirtualizer({
|
|
10710
11058
|
count: filteredOptions.length,
|
|
10711
11059
|
getScrollElement: () => parentRef.current,
|
|
@@ -10713,14 +11061,14 @@ var VirtualizedCommand = ({
|
|
|
10713
11061
|
overscan: 2
|
|
10714
11062
|
});
|
|
10715
11063
|
const virtualOptions = virtualizer.getVirtualItems();
|
|
10716
|
-
const dynamicHeight =
|
|
11064
|
+
const dynamicHeight = React26__namespace.useMemo(() => {
|
|
10717
11065
|
const contentHeight = filteredOptions.length * ROW_HEIGHT;
|
|
10718
11066
|
if (contentHeight <= 0) {
|
|
10719
11067
|
return MIN_HEIGHT_EMPTY;
|
|
10720
11068
|
}
|
|
10721
11069
|
return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
|
|
10722
11070
|
}, [filteredOptions.length, height]);
|
|
10723
|
-
const scrollToIndex =
|
|
11071
|
+
const scrollToIndex = React26__namespace.useCallback(
|
|
10724
11072
|
(index) => {
|
|
10725
11073
|
virtualizer.scrollToIndex(index, {
|
|
10726
11074
|
align: "center"
|
|
@@ -10728,7 +11076,7 @@ var VirtualizedCommand = ({
|
|
|
10728
11076
|
},
|
|
10729
11077
|
[virtualizer]
|
|
10730
11078
|
);
|
|
10731
|
-
const handleSearch =
|
|
11079
|
+
const handleSearch = React26__namespace.useCallback(
|
|
10732
11080
|
(search) => {
|
|
10733
11081
|
setIsKeyboardNavActive(false);
|
|
10734
11082
|
setFilteredOptions(
|
|
@@ -10743,7 +11091,7 @@ var VirtualizedCommand = ({
|
|
|
10743
11091
|
},
|
|
10744
11092
|
[filterOption, getLabelField, internalOptions]
|
|
10745
11093
|
);
|
|
10746
|
-
const handleKeyDown =
|
|
11094
|
+
const handleKeyDown = React26__namespace.useCallback(
|
|
10747
11095
|
(event) => {
|
|
10748
11096
|
switch (event.key) {
|
|
10749
11097
|
case "ArrowDown": {
|
|
@@ -10778,7 +11126,7 @@ var VirtualizedCommand = ({
|
|
|
10778
11126
|
},
|
|
10779
11127
|
[filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
|
|
10780
11128
|
);
|
|
10781
|
-
|
|
11129
|
+
React26__namespace.useEffect(() => {
|
|
10782
11130
|
if (value) {
|
|
10783
11131
|
const option = filteredOptions.find((option2) => {
|
|
10784
11132
|
const optionValue = getValueField(option2);
|
|
@@ -10892,21 +11240,21 @@ var ComboboxInner = ({
|
|
|
10892
11240
|
showSearch,
|
|
10893
11241
|
...props
|
|
10894
11242
|
}, ref) => {
|
|
10895
|
-
const { getValueField } = useFieldNames_default({ fieldNames });
|
|
10896
|
-
const [open, setOpen] =
|
|
11243
|
+
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
11244
|
+
const [open, setOpen] = React26__namespace.useState(false);
|
|
10897
11245
|
const { value: selectedValue, updateState: setSelectedValue } = useControllableState_default({
|
|
10898
11246
|
defaultValue,
|
|
10899
11247
|
value
|
|
10900
11248
|
});
|
|
10901
|
-
const renderValue =
|
|
11249
|
+
const renderValue = React26__namespace.useMemo(() => {
|
|
10902
11250
|
if (!selectedValue) return placeholder2;
|
|
10903
11251
|
const selectedOptionFound = options?.find((option) => {
|
|
10904
11252
|
const optionValue = getValueField(option);
|
|
10905
11253
|
return optionValue === selectedValue;
|
|
10906
11254
|
});
|
|
10907
|
-
return selectedOptionFound ?
|
|
10908
|
-
}, [getValueField, options, placeholder2, selectedValue]);
|
|
10909
|
-
const handleSelect =
|
|
11255
|
+
return selectedOptionFound ? getLabelField(selectedOptionFound) : null;
|
|
11256
|
+
}, [getLabelField, getValueField, options, placeholder2, selectedValue]);
|
|
11257
|
+
const handleSelect = React26__namespace.useCallback(
|
|
10910
11258
|
(selected, option) => {
|
|
10911
11259
|
setSelectedValue(selected);
|
|
10912
11260
|
setOpen(false);
|
|
@@ -10916,7 +11264,7 @@ var ComboboxInner = ({
|
|
|
10916
11264
|
},
|
|
10917
11265
|
[onSelect, setSelectedValue]
|
|
10918
11266
|
);
|
|
10919
|
-
const handleClear =
|
|
11267
|
+
const handleClear = React26__namespace.useCallback(
|
|
10920
11268
|
(event) => {
|
|
10921
11269
|
event.stopPropagation();
|
|
10922
11270
|
setSelectedValue(void 0);
|
|
@@ -10933,9 +11281,11 @@ var ComboboxInner = ({
|
|
|
10933
11281
|
role: "combobox",
|
|
10934
11282
|
"aria-expanded": open,
|
|
10935
11283
|
className: cn(
|
|
10936
|
-
"flex
|
|
10937
|
-
"
|
|
10938
|
-
"
|
|
11284
|
+
"flex items-center justify-between gap-2 rounded-md border bg-white px-3 h-9 text-sm whitespace-nowrap shadow-xs outline-none border-input",
|
|
11285
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
11286
|
+
"focus-visible:border-ring focus-visible:ring-ring/50",
|
|
11287
|
+
"aria-invalid:ring-destructive/20 aria-invalid:border-destructive",
|
|
11288
|
+
"data-[state=open]:border-ring",
|
|
10939
11289
|
"transition-all",
|
|
10940
11290
|
className
|
|
10941
11291
|
),
|
|
@@ -11000,8 +11350,67 @@ var ComboboxInner = ({
|
|
|
11000
11350
|
)
|
|
11001
11351
|
] });
|
|
11002
11352
|
};
|
|
11003
|
-
var Combobox =
|
|
11353
|
+
var Combobox = React26__namespace.forwardRef(ComboboxInner);
|
|
11004
11354
|
var Combobox_default = Combobox;
|
|
11355
|
+
var TruncatedMouseEnterDiv = ({
|
|
11356
|
+
value,
|
|
11357
|
+
className,
|
|
11358
|
+
tooltipProps,
|
|
11359
|
+
tooltipContentProps,
|
|
11360
|
+
arrowClassName
|
|
11361
|
+
}) => {
|
|
11362
|
+
const textRef = React26.useRef(null);
|
|
11363
|
+
const [isTruncated, setIsTruncated] = React26.useState(false);
|
|
11364
|
+
const checkTruncation = () => {
|
|
11365
|
+
if (textRef.current) {
|
|
11366
|
+
const { scrollWidth, clientWidth } = textRef.current;
|
|
11367
|
+
setIsTruncated(scrollWidth > clientWidth);
|
|
11368
|
+
}
|
|
11369
|
+
};
|
|
11370
|
+
const {
|
|
11371
|
+
className: tooltipContentClassName,
|
|
11372
|
+
side: tooltipContentSide,
|
|
11373
|
+
sideOffset: tooltipContentSideOffset,
|
|
11374
|
+
...tooltipContentRest
|
|
11375
|
+
} = tooltipContentProps ?? {};
|
|
11376
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { open: isTruncated, ...tooltipProps, children: [
|
|
11377
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11378
|
+
"div",
|
|
11379
|
+
{
|
|
11380
|
+
ref: textRef,
|
|
11381
|
+
onMouseEnter: checkTruncation,
|
|
11382
|
+
onMouseLeave: () => setIsTruncated(false),
|
|
11383
|
+
className: cn("truncate", className),
|
|
11384
|
+
children: value
|
|
11385
|
+
}
|
|
11386
|
+
) }),
|
|
11387
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11388
|
+
TooltipContent2,
|
|
11389
|
+
{
|
|
11390
|
+
side: tooltipContentSide ?? "bottom",
|
|
11391
|
+
className: cn(
|
|
11392
|
+
"text-white bg-sus-secondary-gray-10 max-w-xs sm:max-w-md wrap-break-word shadow-lg",
|
|
11393
|
+
tooltipContentClassName
|
|
11394
|
+
),
|
|
11395
|
+
sideOffset: tooltipContentSideOffset ?? 10,
|
|
11396
|
+
...tooltipContentRest,
|
|
11397
|
+
children: [
|
|
11398
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11399
|
+
TooltipArrow,
|
|
11400
|
+
{
|
|
11401
|
+
className: cn(
|
|
11402
|
+
"bg-sus-secondary-gray-10 fill-sus-secondary-gray-10 z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]",
|
|
11403
|
+
arrowClassName
|
|
11404
|
+
)
|
|
11405
|
+
}
|
|
11406
|
+
),
|
|
11407
|
+
value
|
|
11408
|
+
]
|
|
11409
|
+
}
|
|
11410
|
+
)
|
|
11411
|
+
] });
|
|
11412
|
+
};
|
|
11413
|
+
var truncatedMouseEnterDiv_default = TruncatedMouseEnterDiv;
|
|
11005
11414
|
|
|
11006
11415
|
exports.Accordion = Accordion;
|
|
11007
11416
|
exports.AccordionContent = AccordionContent;
|
|
@@ -11010,6 +11419,7 @@ exports.AccordionTrigger = AccordionTrigger;
|
|
|
11010
11419
|
exports.ActionMenu = ActionMenu;
|
|
11011
11420
|
exports.AdvanceSearch = AdvanceSearch_default;
|
|
11012
11421
|
exports.ArrowIcon = arrow_default;
|
|
11422
|
+
exports.AuditFooter = AuditFooter;
|
|
11013
11423
|
exports.Button = Button;
|
|
11014
11424
|
exports.Checkbox = Checkbox;
|
|
11015
11425
|
exports.Collapsible = Collapsible;
|
|
@@ -11139,7 +11549,9 @@ exports.TooltipArrow = TooltipArrow;
|
|
|
11139
11549
|
exports.TooltipContent = TooltipContent2;
|
|
11140
11550
|
exports.TooltipProvider = TooltipProvider2;
|
|
11141
11551
|
exports.TooltipTrigger = TooltipTrigger2;
|
|
11552
|
+
exports.TrashIcon = trash_default;
|
|
11142
11553
|
exports.Truncated = truncated_default;
|
|
11554
|
+
exports.TruncatedMouseEnterDiv = truncatedMouseEnterDiv_default;
|
|
11143
11555
|
exports.UI = ui_exports;
|
|
11144
11556
|
exports.VirtualizedCommand = VirtualizedCommand_default;
|
|
11145
11557
|
exports.booleanToSelectValue = booleanToSelectValue;
|
|
@@ -11171,6 +11583,7 @@ exports.useFormField = useFormField;
|
|
|
11171
11583
|
exports.useGridSettingsStore = useGridSettingsStore_default;
|
|
11172
11584
|
exports.useHover = useHover_default;
|
|
11173
11585
|
exports.useIntersectionObserver = useIntersectionObserver_default;
|
|
11586
|
+
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
11174
11587
|
exports.useMediaQuery = useMediaQuery_default;
|
|
11175
11588
|
exports.usePreventPageLeave = usePreventPageLeave_default;
|
|
11176
11589
|
exports.usePreventPageLeaveStore = usePreventPageLeaveStore_default;
|