@sustaina/shared-ui 1.64.2 → 1.65.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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +60 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1321,6 +1321,7 @@ type RichTextProps<T = DefaultMentionItem$1> = {
|
|
|
1321
1321
|
onImageUploadError?: (error: unknown) => void;
|
|
1322
1322
|
onImageDialogUpload?: (file: File) => Promise<string>;
|
|
1323
1323
|
onImageDialogUploadError?: (error: unknown) => void;
|
|
1324
|
+
hideImageUploadButton?: boolean;
|
|
1324
1325
|
acceptImageMimeTypes?: string;
|
|
1325
1326
|
allowImageUrlInsert?: boolean;
|
|
1326
1327
|
/** Maximum number of characters allowed in the editor */
|
|
@@ -1337,7 +1338,7 @@ type RichTextProps<T = DefaultMentionItem$1> = {
|
|
|
1337
1338
|
plainTextMentions?: boolean;
|
|
1338
1339
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">;
|
|
1339
1340
|
|
|
1340
|
-
declare function RichTextInner<T = DefaultMentionItem$1>({ value, defaultValue, onChange, onHtmlChange, onTextChange, placeholder, readOnly, disabled, editorClassName, toolbarClassName, autoFocus, onImageUpload, onImageUploadError, onImageDialogUpload, onImageDialogUploadError, acceptImageMimeTypes, allowImageUrlInsert, maxLength, mentions, mentionConfig, mentionTrigger, mentionTriggerOnly, plainTextMentions, className, id, ...rest }: RichTextProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
1341
|
+
declare function RichTextInner<T = DefaultMentionItem$1>({ value, defaultValue, onChange, onHtmlChange, onTextChange, placeholder, readOnly, disabled, editorClassName, toolbarClassName, autoFocus, onImageUpload, onImageUploadError, onImageDialogUpload, onImageDialogUploadError, acceptImageMimeTypes, allowImageUrlInsert, hideImageUploadButton, maxLength, mentions, mentionConfig, mentionTrigger, mentionTriggerOnly, plainTextMentions, className, id, ...rest }: RichTextProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
1341
1342
|
declare const RichText: <T = DefaultMentionItem$1>(props: RichTextProps<T> & {
|
|
1342
1343
|
ref?: React.Ref<HTMLDivElement>;
|
|
1343
1344
|
}) => ReturnType<typeof RichTextInner>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1321,6 +1321,7 @@ type RichTextProps<T = DefaultMentionItem$1> = {
|
|
|
1321
1321
|
onImageUploadError?: (error: unknown) => void;
|
|
1322
1322
|
onImageDialogUpload?: (file: File) => Promise<string>;
|
|
1323
1323
|
onImageDialogUploadError?: (error: unknown) => void;
|
|
1324
|
+
hideImageUploadButton?: boolean;
|
|
1324
1325
|
acceptImageMimeTypes?: string;
|
|
1325
1326
|
allowImageUrlInsert?: boolean;
|
|
1326
1327
|
/** Maximum number of characters allowed in the editor */
|
|
@@ -1337,7 +1338,7 @@ type RichTextProps<T = DefaultMentionItem$1> = {
|
|
|
1337
1338
|
plainTextMentions?: boolean;
|
|
1338
1339
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">;
|
|
1339
1340
|
|
|
1340
|
-
declare function RichTextInner<T = DefaultMentionItem$1>({ value, defaultValue, onChange, onHtmlChange, onTextChange, placeholder, readOnly, disabled, editorClassName, toolbarClassName, autoFocus, onImageUpload, onImageUploadError, onImageDialogUpload, onImageDialogUploadError, acceptImageMimeTypes, allowImageUrlInsert, maxLength, mentions, mentionConfig, mentionTrigger, mentionTriggerOnly, plainTextMentions, className, id, ...rest }: RichTextProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
1341
|
+
declare function RichTextInner<T = DefaultMentionItem$1>({ value, defaultValue, onChange, onHtmlChange, onTextChange, placeholder, readOnly, disabled, editorClassName, toolbarClassName, autoFocus, onImageUpload, onImageUploadError, onImageDialogUpload, onImageDialogUploadError, acceptImageMimeTypes, allowImageUrlInsert, hideImageUploadButton, maxLength, mentions, mentionConfig, mentionTrigger, mentionTriggerOnly, plainTextMentions, className, id, ...rest }: RichTextProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
1341
1342
|
declare const RichText: <T = DefaultMentionItem$1>(props: RichTextProps<T> & {
|
|
1342
1343
|
ref?: React.Ref<HTMLDivElement>;
|
|
1343
1344
|
}) => ReturnType<typeof RichTextInner>;
|
package/dist/index.js
CHANGED
|
@@ -7204,6 +7204,10 @@ var ComboboxInner = ({
|
|
|
7204
7204
|
...props
|
|
7205
7205
|
}, ref) => {
|
|
7206
7206
|
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
7207
|
+
const isFocusedRef = React__namespace.useRef(false);
|
|
7208
|
+
const isPopoverOpenRef = React__namespace.useRef(false);
|
|
7209
|
+
const suppressNextFocusRef = React__namespace.useRef(false);
|
|
7210
|
+
const lastFocusEventRef = React__namespace.useRef(null);
|
|
7207
7211
|
const { value: openPopover, setValue: setOpenPopover } = useControllableState_default({
|
|
7208
7212
|
defaultValue: false,
|
|
7209
7213
|
value: open
|
|
@@ -7231,18 +7235,27 @@ var ComboboxInner = ({
|
|
|
7231
7235
|
}
|
|
7232
7236
|
return null;
|
|
7233
7237
|
}, [
|
|
7234
|
-
|
|
7235
|
-
getLabelField,
|
|
7236
|
-
placeholder2,
|
|
7238
|
+
isLoading,
|
|
7237
7239
|
selectedValue,
|
|
7240
|
+
placeholder2,
|
|
7241
|
+
currentSelectedOption,
|
|
7238
7242
|
showValueWhenNoMatch,
|
|
7239
|
-
|
|
7240
|
-
|
|
7243
|
+
loadingContent,
|
|
7244
|
+
valueRender,
|
|
7245
|
+
getLabelField
|
|
7241
7246
|
]);
|
|
7247
|
+
const signalBlur = React__namespace.useCallback(() => {
|
|
7248
|
+
if (!isFocusedRef.current || !lastFocusEventRef.current) return;
|
|
7249
|
+
isFocusedRef.current = false;
|
|
7250
|
+
suppressNextFocusRef.current = true;
|
|
7251
|
+
onBlur?.(lastFocusEventRef.current);
|
|
7252
|
+
}, [onBlur]);
|
|
7242
7253
|
const handleSelect = React__namespace.useCallback(
|
|
7243
7254
|
(selected, option) => {
|
|
7244
7255
|
setSelectedValue(selected);
|
|
7245
7256
|
setOpenPopover(false);
|
|
7257
|
+
isPopoverOpenRef.current = false;
|
|
7258
|
+
signalBlur();
|
|
7246
7259
|
if (typeof onSelect === "function") {
|
|
7247
7260
|
onSelect(selected, option);
|
|
7248
7261
|
}
|
|
@@ -7250,17 +7263,43 @@ var ComboboxInner = ({
|
|
|
7250
7263
|
onOpenChange(false);
|
|
7251
7264
|
}
|
|
7252
7265
|
},
|
|
7253
|
-
[onOpenChange, onSelect, setOpenPopover, setSelectedValue]
|
|
7266
|
+
[onOpenChange, onSelect, setOpenPopover, setSelectedValue, signalBlur]
|
|
7254
7267
|
);
|
|
7255
7268
|
const handleOpenPopover = React__namespace.useCallback(
|
|
7256
7269
|
(isOpen) => {
|
|
7257
7270
|
if (disabled || isLoading) return;
|
|
7271
|
+
isPopoverOpenRef.current = isOpen;
|
|
7258
7272
|
setOpenPopover(isOpen);
|
|
7273
|
+
if (!isOpen) {
|
|
7274
|
+
signalBlur();
|
|
7275
|
+
}
|
|
7259
7276
|
if (typeof onOpenChange === "function") {
|
|
7260
7277
|
onOpenChange(isOpen);
|
|
7261
7278
|
}
|
|
7262
7279
|
},
|
|
7263
|
-
[disabled, isLoading, onOpenChange, setOpenPopover]
|
|
7280
|
+
[disabled, isLoading, onOpenChange, setOpenPopover, signalBlur]
|
|
7281
|
+
);
|
|
7282
|
+
const handleFocus = React__namespace.useCallback(
|
|
7283
|
+
(event) => {
|
|
7284
|
+
lastFocusEventRef.current = event;
|
|
7285
|
+
if (suppressNextFocusRef.current) {
|
|
7286
|
+
suppressNextFocusRef.current = false;
|
|
7287
|
+
return;
|
|
7288
|
+
}
|
|
7289
|
+
if (isFocusedRef.current) return;
|
|
7290
|
+
isFocusedRef.current = true;
|
|
7291
|
+
onFocus?.(event);
|
|
7292
|
+
},
|
|
7293
|
+
[onFocus]
|
|
7294
|
+
);
|
|
7295
|
+
const handleBlur = React__namespace.useCallback(
|
|
7296
|
+
(event) => {
|
|
7297
|
+
if (isPopoverOpenRef.current) return;
|
|
7298
|
+
if (!isFocusedRef.current) return;
|
|
7299
|
+
isFocusedRef.current = false;
|
|
7300
|
+
onBlur?.(event);
|
|
7301
|
+
},
|
|
7302
|
+
[onBlur]
|
|
7264
7303
|
);
|
|
7265
7304
|
const handleClear = React__namespace.useCallback(
|
|
7266
7305
|
(event) => {
|
|
@@ -7293,8 +7332,8 @@ var ComboboxInner = ({
|
|
|
7293
7332
|
"data-state": openPopover ? "open" : "closed",
|
|
7294
7333
|
"data-loading": isLoading,
|
|
7295
7334
|
disabled: disabled || isLoading,
|
|
7296
|
-
onFocus,
|
|
7297
|
-
onBlur,
|
|
7335
|
+
onFocus: handleFocus,
|
|
7336
|
+
onBlur: handleBlur,
|
|
7298
7337
|
"data-testid": `combobox-trigger-${name}`,
|
|
7299
7338
|
...props,
|
|
7300
7339
|
children: [
|
|
@@ -7330,6 +7369,11 @@ var ComboboxInner = ({
|
|
|
7330
7369
|
align: "start",
|
|
7331
7370
|
sideOffset: 4,
|
|
7332
7371
|
...popoverContentProps,
|
|
7372
|
+
onCloseAutoFocus: (event) => {
|
|
7373
|
+
event.preventDefault();
|
|
7374
|
+
suppressNextFocusRef.current = false;
|
|
7375
|
+
popoverContentProps?.onCloseAutoFocus?.(event);
|
|
7376
|
+
},
|
|
7333
7377
|
onWheel: (e) => {
|
|
7334
7378
|
e.stopPropagation();
|
|
7335
7379
|
popoverContentProps?.onWheel?.(e);
|
|
@@ -7338,6 +7382,9 @@ var ComboboxInner = ({
|
|
|
7338
7382
|
"p-0 w-(--radix-popper-anchor-width) min-w-(--radix-popper-anchor-width) max-w-(--radix-popper-available-width) rounded-md",
|
|
7339
7383
|
popoverContentProps?.className
|
|
7340
7384
|
),
|
|
7385
|
+
onInteractOutside: (event) => {
|
|
7386
|
+
popoverContentProps?.onInteractOutside?.(event);
|
|
7387
|
+
},
|
|
7341
7388
|
children: virtual ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
7342
7389
|
VirtualizedCommand_default,
|
|
7343
7390
|
{
|
|
@@ -14279,6 +14326,7 @@ function UploadImagePlugin({
|
|
|
14279
14326
|
onImageUploadError,
|
|
14280
14327
|
onImageDialogUpload,
|
|
14281
14328
|
onImageDialogUploadError,
|
|
14329
|
+
hideImageUploadButton,
|
|
14282
14330
|
acceptImageMimeTypes
|
|
14283
14331
|
}) {
|
|
14284
14332
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
@@ -14563,7 +14611,7 @@ function UploadImagePlugin({
|
|
|
14563
14611
|
disabled: imageDialogLoading
|
|
14564
14612
|
}
|
|
14565
14613
|
),
|
|
14566
|
-
onImageDialogUpload && /* @__PURE__ */ jsxRuntime.jsx(
|
|
14614
|
+
onImageDialogUpload && !hideImageUploadButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
14567
14615
|
Button,
|
|
14568
14616
|
{
|
|
14569
14617
|
type: "button",
|
|
@@ -16090,6 +16138,7 @@ function RichTextInner({
|
|
|
16090
16138
|
onImageDialogUploadError,
|
|
16091
16139
|
acceptImageMimeTypes = "image/*",
|
|
16092
16140
|
allowImageUrlInsert = true,
|
|
16141
|
+
hideImageUploadButton = false,
|
|
16093
16142
|
maxLength,
|
|
16094
16143
|
mentions,
|
|
16095
16144
|
mentionConfig,
|
|
@@ -16172,6 +16221,7 @@ function RichTextInner({
|
|
|
16172
16221
|
onImageUploadError,
|
|
16173
16222
|
allowImageUrlInsert,
|
|
16174
16223
|
acceptImageMimeTypes,
|
|
16224
|
+
hideImageUploadButton,
|
|
16175
16225
|
onImageDialogUpload,
|
|
16176
16226
|
onImageDialogUploadError
|
|
16177
16227
|
}
|