@sustaina/shared-ui 1.20.0 → 1.21.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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +40 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5089,7 +5089,8 @@ function DialogAlert({
|
|
|
5089
5089
|
}, [onCancel, onOpenChange]);
|
|
5090
5090
|
const handleConfirm = useCallback(() => {
|
|
5091
5091
|
onConfirm?.();
|
|
5092
|
-
|
|
5092
|
+
onOpenChange(false);
|
|
5093
|
+
}, [onConfirm, onOpenChange]);
|
|
5093
5094
|
return /* @__PURE__ */ jsx(Dialog2, { open, onOpenChange: persistent ? () => {
|
|
5094
5095
|
} : onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent2, { className: "max-w-md", showCloseButton: !persistent, children: [
|
|
5095
5096
|
/* @__PURE__ */ jsxs(DialogHeader2, { children: [
|
|
@@ -5351,6 +5352,26 @@ var getDialogAlertControls = () => ({
|
|
|
5351
5352
|
closeDialogAlert,
|
|
5352
5353
|
openErrorDialogAlert
|
|
5353
5354
|
});
|
|
5355
|
+
function LoadingOverlay({
|
|
5356
|
+
className,
|
|
5357
|
+
fullscreen = true,
|
|
5358
|
+
spinnerClassName,
|
|
5359
|
+
...props
|
|
5360
|
+
}) {
|
|
5361
|
+
return /* @__PURE__ */ jsx(
|
|
5362
|
+
"div",
|
|
5363
|
+
{
|
|
5364
|
+
"data-slot": "loading-overlay",
|
|
5365
|
+
className: cn(
|
|
5366
|
+
fullscreen ? "fixed z-100" : "absolute z-10",
|
|
5367
|
+
"inset-0 flex items-center justify-center transition-opacity duration-300",
|
|
5368
|
+
className
|
|
5369
|
+
),
|
|
5370
|
+
...props,
|
|
5371
|
+
children: /* @__PURE__ */ jsx(Spinner, { className: cn("size-50", spinnerClassName) })
|
|
5372
|
+
}
|
|
5373
|
+
);
|
|
5374
|
+
}
|
|
5354
5375
|
|
|
5355
5376
|
// src/components/formulaEditor/constants/formulaOperation.ts
|
|
5356
5377
|
var defaultOperators = [
|
|
@@ -6149,6 +6170,7 @@ var buildDocFromRaw = (raw, prefixMap, configLookup) => {
|
|
|
6149
6170
|
var FormulaEditor = ({
|
|
6150
6171
|
value,
|
|
6151
6172
|
disabled,
|
|
6173
|
+
loading = false,
|
|
6152
6174
|
className,
|
|
6153
6175
|
editorClassName,
|
|
6154
6176
|
errorMessage,
|
|
@@ -6183,6 +6205,7 @@ var FormulaEditor = ({
|
|
|
6183
6205
|
const allowedOperators = useMemo(() => operators.map((operator) => operator.value), [operators]);
|
|
6184
6206
|
const displayError = errorMessage ?? fieldState?.error?.message;
|
|
6185
6207
|
const hasError = Boolean(displayError);
|
|
6208
|
+
const isInteractionDisabled = Boolean(disabled || loading);
|
|
6186
6209
|
const convertValueToContent = useCallback(
|
|
6187
6210
|
(input) => {
|
|
6188
6211
|
if (!input) return "";
|
|
@@ -6225,16 +6248,17 @@ var FormulaEditor = ({
|
|
|
6225
6248
|
hasError ? "border border-destructive" : "border focus-visible:border-ring",
|
|
6226
6249
|
"w-full rounded-lg bg-white px-4 py-3",
|
|
6227
6250
|
"overflow-y-auto whitespace-pre-wrap wrap-break-word focus:outline-none",
|
|
6228
|
-
|
|
6251
|
+
isInteractionDisabled && "pointer-events-none opacity-60",
|
|
6229
6252
|
editorClassName
|
|
6230
|
-
)
|
|
6253
|
+
),
|
|
6254
|
+
...loading ? { "aria-busy": "true" } : {}
|
|
6231
6255
|
}
|
|
6232
6256
|
}
|
|
6233
6257
|
});
|
|
6234
6258
|
useEffect(() => {
|
|
6235
6259
|
if (!editor) return;
|
|
6236
|
-
editor.setEditable(!
|
|
6237
|
-
}, [
|
|
6260
|
+
editor.setEditable(!isInteractionDisabled);
|
|
6261
|
+
}, [editor, isInteractionDisabled]);
|
|
6238
6262
|
useEffect(() => {
|
|
6239
6263
|
if (!editor || resolvedContent === void 0) return;
|
|
6240
6264
|
if (ignorePropValueRef.current && typeof value === "string" && value === lastEmittedValueRef.current) {
|
|
@@ -6266,6 +6290,7 @@ var FormulaEditor = ({
|
|
|
6266
6290
|
onBlur: field?.onBlur,
|
|
6267
6291
|
tabIndex: 0,
|
|
6268
6292
|
className: "relative",
|
|
6293
|
+
"aria-busy": loading,
|
|
6269
6294
|
onFocus: () => {
|
|
6270
6295
|
if (editor && !editor.isFocused) {
|
|
6271
6296
|
editor.chain().focus().run();
|
|
@@ -6273,6 +6298,14 @@ var FormulaEditor = ({
|
|
|
6273
6298
|
},
|
|
6274
6299
|
children: [
|
|
6275
6300
|
/* @__PURE__ */ jsx(EditorContent, { editor }),
|
|
6301
|
+
loading && /* @__PURE__ */ jsx(
|
|
6302
|
+
LoadingOverlay,
|
|
6303
|
+
{
|
|
6304
|
+
fullscreen: false,
|
|
6305
|
+
className: "rounded-lg bg-white/80 backdrop-blur-sm",
|
|
6306
|
+
spinnerClassName: "size-6 text-sus-blue-3"
|
|
6307
|
+
}
|
|
6308
|
+
),
|
|
6276
6309
|
/* @__PURE__ */ jsx(
|
|
6277
6310
|
Button,
|
|
6278
6311
|
{
|
|
@@ -6280,6 +6313,7 @@ var FormulaEditor = ({
|
|
|
6280
6313
|
variant: "ghost",
|
|
6281
6314
|
size: "icon",
|
|
6282
6315
|
className: "absolute bottom-2 right-4 h-6 w-6 rounded-full bg-white shadow",
|
|
6316
|
+
disabled: isInteractionDisabled,
|
|
6283
6317
|
onClick: () => setIsExpanded((prev) => !prev),
|
|
6284
6318
|
children: isExpanded ? /* @__PURE__ */ jsx(Minimize2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Maximize2, { className: "h-4 w-4" })
|
|
6285
6319
|
}
|
|
@@ -6294,7 +6328,7 @@ var FormulaEditor = ({
|
|
|
6294
6328
|
type: "button",
|
|
6295
6329
|
onClick: () => insertOperator(operator.value),
|
|
6296
6330
|
className: "min-w-10 rounded-sm px-3 bg-sus-blue-3",
|
|
6297
|
-
disabled,
|
|
6331
|
+
disabled: isInteractionDisabled,
|
|
6298
6332
|
children: operator.label
|
|
6299
6333
|
},
|
|
6300
6334
|
operator.value
|
|
@@ -6700,26 +6734,6 @@ var useGridSettingsStore = create(
|
|
|
6700
6734
|
})
|
|
6701
6735
|
);
|
|
6702
6736
|
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
6737
|
var DEVICE_SIZES = [320, 420, 640, 768, 1024, 1280, 1536, 1920];
|
|
6724
6738
|
var IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
6725
6739
|
var defaultLoader = ({ src }) => src;
|