@sustaina/shared-ui 1.20.0 → 1.21.1
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +47 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4356,9 +4356,6 @@ var DataTable = ({
|
|
|
4356
4356
|
columnResizeMode: columnResizing?.enabled ? columnResizing?.resizeMode ?? "onChange" : "onChange"
|
|
4357
4357
|
})
|
|
4358
4358
|
});
|
|
4359
|
-
if (isDefined(tableRef) && !isDefined(tableRef?.current)) {
|
|
4360
|
-
tableRef.current = table;
|
|
4361
|
-
}
|
|
4362
4359
|
const tableContainerRef = useRef(null);
|
|
4363
4360
|
const isTableEmpty = table.getCoreRowModel().rows.length === 0;
|
|
4364
4361
|
const isTableEmptyAfterFiltering = table.getRowModel().rows.length === 0;
|
|
@@ -4436,6 +4433,13 @@ var DataTable = ({
|
|
|
4436
4433
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4437
4434
|
[scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
|
|
4438
4435
|
);
|
|
4436
|
+
useEffect(() => {
|
|
4437
|
+
if (!tableRef) return;
|
|
4438
|
+
tableRef.current = table;
|
|
4439
|
+
return () => {
|
|
4440
|
+
tableRef.current = null;
|
|
4441
|
+
};
|
|
4442
|
+
}, [tableRef, table]);
|
|
4439
4443
|
useEffect(() => {
|
|
4440
4444
|
fetchMoreOnScrollReached(tableContainerRef.current);
|
|
4441
4445
|
}, [fetchMoreOnScrollReached]);
|
|
@@ -5089,7 +5093,8 @@ function DialogAlert({
|
|
|
5089
5093
|
}, [onCancel, onOpenChange]);
|
|
5090
5094
|
const handleConfirm = useCallback(() => {
|
|
5091
5095
|
onConfirm?.();
|
|
5092
|
-
|
|
5096
|
+
onOpenChange(false);
|
|
5097
|
+
}, [onConfirm, onOpenChange]);
|
|
5093
5098
|
return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: persistent ? () => {
|
|
5094
5099
|
} : onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
|
|
5095
5100
|
/* @__PURE__ */ jsxs(DialogHeader2, { children: [
|
|
@@ -5351,6 +5356,26 @@ var getDialogAlertControls = () => ({
|
|
|
5351
5356
|
closeDialogAlert,
|
|
5352
5357
|
openErrorDialogAlert
|
|
5353
5358
|
});
|
|
5359
|
+
function LoadingOverlay({
|
|
5360
|
+
className,
|
|
5361
|
+
fullscreen = true,
|
|
5362
|
+
spinnerClassName,
|
|
5363
|
+
...props
|
|
5364
|
+
}) {
|
|
5365
|
+
return /* @__PURE__ */ jsx(
|
|
5366
|
+
"div",
|
|
5367
|
+
{
|
|
5368
|
+
"data-slot": "loading-overlay",
|
|
5369
|
+
className: cn(
|
|
5370
|
+
fullscreen ? "fixed z-100" : "absolute z-10",
|
|
5371
|
+
"inset-0 flex items-center justify-center transition-opacity duration-300",
|
|
5372
|
+
className
|
|
5373
|
+
),
|
|
5374
|
+
...props,
|
|
5375
|
+
children: /* @__PURE__ */ jsx(Spinner, { className: cn("size-50", spinnerClassName) })
|
|
5376
|
+
}
|
|
5377
|
+
);
|
|
5378
|
+
}
|
|
5354
5379
|
|
|
5355
5380
|
// src/components/formulaEditor/constants/formulaOperation.ts
|
|
5356
5381
|
var defaultOperators = [
|
|
@@ -6149,6 +6174,7 @@ var buildDocFromRaw = (raw, prefixMap, configLookup) => {
|
|
|
6149
6174
|
var FormulaEditor = ({
|
|
6150
6175
|
value,
|
|
6151
6176
|
disabled,
|
|
6177
|
+
loading = false,
|
|
6152
6178
|
className,
|
|
6153
6179
|
editorClassName,
|
|
6154
6180
|
errorMessage,
|
|
@@ -6183,6 +6209,7 @@ var FormulaEditor = ({
|
|
|
6183
6209
|
const allowedOperators = useMemo(() => operators.map((operator) => operator.value), [operators]);
|
|
6184
6210
|
const displayError = errorMessage ?? fieldState?.error?.message;
|
|
6185
6211
|
const hasError = Boolean(displayError);
|
|
6212
|
+
const isInteractionDisabled = Boolean(disabled || loading);
|
|
6186
6213
|
const convertValueToContent = useCallback(
|
|
6187
6214
|
(input) => {
|
|
6188
6215
|
if (!input) return "";
|
|
@@ -6225,16 +6252,17 @@ var FormulaEditor = ({
|
|
|
6225
6252
|
hasError ? "border border-destructive" : "border focus-visible:border-ring",
|
|
6226
6253
|
"w-full rounded-lg bg-white px-4 py-3",
|
|
6227
6254
|
"overflow-y-auto whitespace-pre-wrap wrap-break-word focus:outline-none",
|
|
6228
|
-
|
|
6255
|
+
isInteractionDisabled && "pointer-events-none opacity-60",
|
|
6229
6256
|
editorClassName
|
|
6230
|
-
)
|
|
6257
|
+
),
|
|
6258
|
+
...loading ? { "aria-busy": "true" } : {}
|
|
6231
6259
|
}
|
|
6232
6260
|
}
|
|
6233
6261
|
});
|
|
6234
6262
|
useEffect(() => {
|
|
6235
6263
|
if (!editor) return;
|
|
6236
|
-
editor.setEditable(!
|
|
6237
|
-
}, [
|
|
6264
|
+
editor.setEditable(!isInteractionDisabled);
|
|
6265
|
+
}, [editor, isInteractionDisabled]);
|
|
6238
6266
|
useEffect(() => {
|
|
6239
6267
|
if (!editor || resolvedContent === void 0) return;
|
|
6240
6268
|
if (ignorePropValueRef.current && typeof value === "string" && value === lastEmittedValueRef.current) {
|
|
@@ -6266,6 +6294,7 @@ var FormulaEditor = ({
|
|
|
6266
6294
|
onBlur: field?.onBlur,
|
|
6267
6295
|
tabIndex: 0,
|
|
6268
6296
|
className: "relative",
|
|
6297
|
+
"aria-busy": loading,
|
|
6269
6298
|
onFocus: () => {
|
|
6270
6299
|
if (editor && !editor.isFocused) {
|
|
6271
6300
|
editor.chain().focus().run();
|
|
@@ -6273,6 +6302,14 @@ var FormulaEditor = ({
|
|
|
6273
6302
|
},
|
|
6274
6303
|
children: [
|
|
6275
6304
|
/* @__PURE__ */ jsx(EditorContent, { editor }),
|
|
6305
|
+
loading && /* @__PURE__ */ jsx(
|
|
6306
|
+
LoadingOverlay,
|
|
6307
|
+
{
|
|
6308
|
+
fullscreen: false,
|
|
6309
|
+
className: "rounded-lg bg-white/80 backdrop-blur-sm",
|
|
6310
|
+
spinnerClassName: "size-6 text-sus-blue-3"
|
|
6311
|
+
}
|
|
6312
|
+
),
|
|
6276
6313
|
/* @__PURE__ */ jsx(
|
|
6277
6314
|
Button,
|
|
6278
6315
|
{
|
|
@@ -6280,6 +6317,7 @@ var FormulaEditor = ({
|
|
|
6280
6317
|
variant: "ghost",
|
|
6281
6318
|
size: "icon",
|
|
6282
6319
|
className: "absolute bottom-2 right-4 h-6 w-6 rounded-full bg-white shadow",
|
|
6320
|
+
disabled: isInteractionDisabled,
|
|
6283
6321
|
onClick: () => setIsExpanded((prev) => !prev),
|
|
6284
6322
|
children: isExpanded ? /* @__PURE__ */ jsx(Minimize2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Maximize2, { className: "h-4 w-4" })
|
|
6285
6323
|
}
|
|
@@ -6294,7 +6332,7 @@ var FormulaEditor = ({
|
|
|
6294
6332
|
type: "button",
|
|
6295
6333
|
onClick: () => insertOperator(operator.value),
|
|
6296
6334
|
className: "min-w-10 rounded-sm px-3 bg-sus-blue-3",
|
|
6297
|
-
disabled,
|
|
6335
|
+
disabled: isInteractionDisabled,
|
|
6298
6336
|
children: operator.label
|
|
6299
6337
|
},
|
|
6300
6338
|
operator.value
|
|
@@ -6700,26 +6738,6 @@ var useGridSettingsStore = create(
|
|
|
6700
6738
|
})
|
|
6701
6739
|
);
|
|
6702
6740
|
var useGridSettingsStore_default = useGridSettingsStore;
|
|
6703
|
-
function LoadingOverlay({
|
|
6704
|
-
className,
|
|
6705
|
-
fullscreen = true,
|
|
6706
|
-
spinnerClassName,
|
|
6707
|
-
...props
|
|
6708
|
-
}) {
|
|
6709
|
-
return /* @__PURE__ */ jsx(
|
|
6710
|
-
"div",
|
|
6711
|
-
{
|
|
6712
|
-
"data-slot": "loading-overlay",
|
|
6713
|
-
className: cn(
|
|
6714
|
-
fullscreen ? "fixed z-100" : "absolute z-10",
|
|
6715
|
-
"inset-0 flex items-center justify-center transition-opacity duration-300",
|
|
6716
|
-
className
|
|
6717
|
-
),
|
|
6718
|
-
...props,
|
|
6719
|
-
children: /* @__PURE__ */ jsx(Spinner, { className: cn("size-50", spinnerClassName) })
|
|
6720
|
-
}
|
|
6721
|
-
);
|
|
6722
|
-
}
|
|
6723
6741
|
var DEVICE_SIZES = [320, 420, 640, 768, 1024, 1280, 1536, 1920];
|
|
6724
6742
|
var IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
6725
6743
|
var defaultLoader = ({ src }) => src;
|