@sustaina/shared-ui 1.62.3 → 1.64.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 CHANGED
@@ -1329,13 +1329,15 @@ type RichTextProps<T = DefaultMentionItem$1> = {
1329
1329
  mentions?: T[];
1330
1330
  /** Configuration for mapping mention item fields. If not provided, assumes default structure {id, name, fieldName} */
1331
1331
  mentionConfig?: MentionConfig$1<T>;
1332
- /** Optional trigger character for mentions (e.g., "$", "@"). If not provided, suggestions appear when typing matching text */
1332
+ /** Optional trigger character for mentions (e.g., "$", "@", "{{"). If not provided, suggestions appear when typing matching text */
1333
1333
  mentionTrigger?: string;
1334
+ /** If true, suggestions will ONLY appear when the trigger is typed. Text matching is disabled. Requires mentionTrigger to be set. */
1335
+ mentionTriggerOnly?: boolean;
1334
1336
  /** If true, mentions will be rendered as plain text (e.g., {{FIRSTNAME}}) suitable for mail templates. If false, mentions will be styled HTML tags */
1335
1337
  plainTextMentions?: boolean;
1336
1338
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">;
1337
1339
 
1338
- 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, plainTextMentions, className, id, ...rest }: RichTextProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
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;
1339
1341
  declare const RichText: <T = DefaultMentionItem$1>(props: RichTextProps<T> & {
1340
1342
  ref?: React.Ref<HTMLDivElement>;
1341
1343
  }) => ReturnType<typeof RichTextInner>;
@@ -1933,6 +1935,7 @@ type ProgressBarSize = "sm" | "md" | "lg" | number;
1933
1935
  type PercentPosition = {
1934
1936
  align?: "start" | "center" | "end";
1935
1937
  type?: "inner" | "outer";
1938
+ side?: "top" | "bottom" | "left" | "right";
1936
1939
  };
1937
1940
  type SuccessConfig = {
1938
1941
  percent: number;
@@ -2080,13 +2083,15 @@ type InputMentionProps<T = DefaultMentionItem> = {
2080
2083
  mentions?: T[];
2081
2084
  /** Configuration for mapping mention item fields. If not provided, assumes default structure {id, name, fieldName} */
2082
2085
  mentionConfig?: MentionConfig<T>;
2083
- /** Optional trigger character for mentions (e.g., "$", "@"). If not provided, suggestions appear when typing matching text */
2086
+ /** Optional trigger character for mentions (e.g., "$", "@", "{{"). If not provided, suggestions appear when typing matching text */
2084
2087
  mentionTrigger?: string;
2088
+ /** If true, suggestions will ONLY appear when the trigger is typed. Text matching is disabled. Requires mentionTrigger to be set. */
2089
+ mentionTriggerOnly?: boolean;
2085
2090
  /** If true, mentions will be rendered as plain text (e.g., {{FIRSTNAME}}) suitable for mail templates. If false, mentions will be styled HTML tags */
2086
2091
  plainTextMentions?: boolean;
2087
2092
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">;
2088
2093
 
2089
- declare function InputMentionInner<T = DefaultMentionItem>({ value, onChange, placeholder, readOnly, disabled, editorClassName, autoFocus, maxLength, mentions, mentionConfig, mentionTrigger, plainTextMentions, className, id, ...rest }: InputMentionProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2094
+ declare function InputMentionInner<T = DefaultMentionItem>({ value, onChange, placeholder, readOnly, disabled, editorClassName, autoFocus, maxLength, mentions, mentionConfig, mentionTrigger, mentionTriggerOnly, plainTextMentions, className, id, ...rest }: InputMentionProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2090
2095
  declare const InputMention: <T = DefaultMentionItem>(props: InputMentionProps<T> & {
2091
2096
  ref?: React.Ref<HTMLDivElement>;
2092
2097
  }) => ReturnType<typeof InputMentionInner>;
package/dist/index.d.ts CHANGED
@@ -1329,13 +1329,15 @@ type RichTextProps<T = DefaultMentionItem$1> = {
1329
1329
  mentions?: T[];
1330
1330
  /** Configuration for mapping mention item fields. If not provided, assumes default structure {id, name, fieldName} */
1331
1331
  mentionConfig?: MentionConfig$1<T>;
1332
- /** Optional trigger character for mentions (e.g., "$", "@"). If not provided, suggestions appear when typing matching text */
1332
+ /** Optional trigger character for mentions (e.g., "$", "@", "{{"). If not provided, suggestions appear when typing matching text */
1333
1333
  mentionTrigger?: string;
1334
+ /** If true, suggestions will ONLY appear when the trigger is typed. Text matching is disabled. Requires mentionTrigger to be set. */
1335
+ mentionTriggerOnly?: boolean;
1334
1336
  /** If true, mentions will be rendered as plain text (e.g., {{FIRSTNAME}}) suitable for mail templates. If false, mentions will be styled HTML tags */
1335
1337
  plainTextMentions?: boolean;
1336
1338
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">;
1337
1339
 
1338
- 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, plainTextMentions, className, id, ...rest }: RichTextProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
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;
1339
1341
  declare const RichText: <T = DefaultMentionItem$1>(props: RichTextProps<T> & {
1340
1342
  ref?: React.Ref<HTMLDivElement>;
1341
1343
  }) => ReturnType<typeof RichTextInner>;
@@ -1933,6 +1935,7 @@ type ProgressBarSize = "sm" | "md" | "lg" | number;
1933
1935
  type PercentPosition = {
1934
1936
  align?: "start" | "center" | "end";
1935
1937
  type?: "inner" | "outer";
1938
+ side?: "top" | "bottom" | "left" | "right";
1936
1939
  };
1937
1940
  type SuccessConfig = {
1938
1941
  percent: number;
@@ -2080,13 +2083,15 @@ type InputMentionProps<T = DefaultMentionItem> = {
2080
2083
  mentions?: T[];
2081
2084
  /** Configuration for mapping mention item fields. If not provided, assumes default structure {id, name, fieldName} */
2082
2085
  mentionConfig?: MentionConfig<T>;
2083
- /** Optional trigger character for mentions (e.g., "$", "@"). If not provided, suggestions appear when typing matching text */
2086
+ /** Optional trigger character for mentions (e.g., "$", "@", "{{"). If not provided, suggestions appear when typing matching text */
2084
2087
  mentionTrigger?: string;
2088
+ /** If true, suggestions will ONLY appear when the trigger is typed. Text matching is disabled. Requires mentionTrigger to be set. */
2089
+ mentionTriggerOnly?: boolean;
2085
2090
  /** If true, mentions will be rendered as plain text (e.g., {{FIRSTNAME}}) suitable for mail templates. If false, mentions will be styled HTML tags */
2086
2091
  plainTextMentions?: boolean;
2087
2092
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">;
2088
2093
 
2089
- declare function InputMentionInner<T = DefaultMentionItem>({ value, onChange, placeholder, readOnly, disabled, editorClassName, autoFocus, maxLength, mentions, mentionConfig, mentionTrigger, plainTextMentions, className, id, ...rest }: InputMentionProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2094
+ declare function InputMentionInner<T = DefaultMentionItem>({ value, onChange, placeholder, readOnly, disabled, editorClassName, autoFocus, maxLength, mentions, mentionConfig, mentionTrigger, mentionTriggerOnly, plainTextMentions, className, id, ...rest }: InputMentionProps<T>, ref: React.Ref<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2090
2095
  declare const InputMention: <T = DefaultMentionItem>(props: InputMentionProps<T> & {
2091
2096
  ref?: React.Ref<HTMLDivElement>;
2092
2097
  }) => ReturnType<typeof InputMentionInner>;
package/dist/index.js CHANGED
@@ -15719,7 +15719,8 @@ function MentionsTypeaheadMenuItem({
15719
15719
  function MentionsPlugin({
15720
15720
  mentions = [],
15721
15721
  mentionConfig,
15722
- trigger
15722
+ trigger,
15723
+ triggerOnly = false
15723
15724
  }) {
15724
15725
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
15725
15726
  const [queryString, setQueryString] = React.useState(null);
@@ -15894,10 +15895,13 @@ function MentionsPlugin({
15894
15895
  if (triggerMatch) {
15895
15896
  return triggerMatch;
15896
15897
  }
15898
+ if (triggerOnly) {
15899
+ return null;
15900
+ }
15897
15901
  }
15898
15902
  return checkForTextMatch(text, mentions, mentionConfig);
15899
15903
  },
15900
- [trigger, mentions, mentionConfig]
15904
+ [trigger, triggerOnly, mentions, mentionConfig]
15901
15905
  );
15902
15906
  if (mentions.length === 0) {
15903
15907
  return null;
@@ -16090,6 +16094,7 @@ function RichTextInner({
16090
16094
  mentions,
16091
16095
  mentionConfig,
16092
16096
  mentionTrigger,
16097
+ mentionTriggerOnly,
16093
16098
  plainTextMentions = false,
16094
16099
  className,
16095
16100
  id,
@@ -16198,7 +16203,8 @@ function RichTextInner({
16198
16203
  {
16199
16204
  mentions,
16200
16205
  mentionConfig: finalMentionConfig,
16201
- trigger: mentionTrigger
16206
+ trigger: mentionTrigger,
16207
+ triggerOnly: mentionTriggerOnly
16202
16208
  }
16203
16209
  ),
16204
16210
  /* @__PURE__ */ jsxRuntime.jsx(MentionDeletePlugin, {}),
@@ -17618,6 +17624,11 @@ var alignClassMap = {
17618
17624
  center: "justify-center",
17619
17625
  end: "justify-end"
17620
17626
  };
17627
+ var outerAlignClassMap = {
17628
+ start: "self-start",
17629
+ center: "self-center",
17630
+ end: "self-end"
17631
+ };
17621
17632
  var ProgressBar = ({
17622
17633
  percent = 0,
17623
17634
  size = "md",
@@ -17640,7 +17651,11 @@ var ProgressBar = ({
17640
17651
  const linecapClass = linecapMap[strokeLinecap];
17641
17652
  const posType = percentPosition?.type ?? "outer";
17642
17653
  const posAlign = percentPosition?.align ?? "end";
17654
+ const posSide = percentPosition?.side;
17643
17655
  const isInner = posType === "inner";
17656
+ const isTopBottom = posSide === "top" || posSide === "bottom";
17657
+ const isLeftOuter = !isInner && !isTopBottom && (posSide === "left" || !posSide && posAlign === "start");
17658
+ const outerAlignClass = outerAlignClassMap[posAlign];
17644
17659
  const { className: sizeClass, style: sizeStyle } = resolveSize(size);
17645
17660
  const info = React.useMemo(() => {
17646
17661
  if (!showInfo) return null;
@@ -17651,11 +17666,13 @@ var ProgressBar = ({
17651
17666
  "div",
17652
17667
  {
17653
17668
  className: cn(
17654
- "flex w-full items-center gap-2 min-w-0",
17655
- posAlign === "start" && !isInner && "flex-row-reverse",
17669
+ "flex w-full min-w-0",
17670
+ isTopBottom ? "flex-col gap-1" : "items-center gap-2",
17671
+ isLeftOuter && "flex-row-reverse",
17656
17672
  className
17657
17673
  ),
17658
17674
  children: [
17675
+ posSide === "top" && info && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs shrink-0 tabular-nums", outerAlignClass), children: info }),
17659
17676
  /* @__PURE__ */ jsxRuntime.jsxs(
17660
17677
  "div",
17661
17678
  {
@@ -17694,7 +17711,8 @@ var ProgressBar = ({
17694
17711
  ]
17695
17712
  }
17696
17713
  ),
17697
- !isInner && info && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs shrink-0 tabular-nums", children: info })
17714
+ posSide === "bottom" && info && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs shrink-0 tabular-nums", outerAlignClass), children: info }),
17715
+ !isInner && !isTopBottom && info && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs shrink-0 tabular-nums", children: info })
17698
17716
  ]
17699
17717
  }
17700
17718
  );
@@ -18146,7 +18164,8 @@ function MentionsTypeaheadMenuItem2({
18146
18164
  function MentionsPlugin2({
18147
18165
  mentions = [],
18148
18166
  mentionConfig,
18149
- trigger
18167
+ trigger,
18168
+ triggerOnly = false
18150
18169
  }) {
18151
18170
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
18152
18171
  const [queryString, setQueryString] = React.useState(null);
@@ -18324,10 +18343,13 @@ function MentionsPlugin2({
18324
18343
  if (triggerMatch) {
18325
18344
  return triggerMatch;
18326
18345
  }
18346
+ if (triggerOnly) {
18347
+ return null;
18348
+ }
18327
18349
  }
18328
18350
  return checkForTextMatch2(text, mentions, mentionConfig);
18329
18351
  },
18330
- [trigger, mentions, mentionConfig]
18352
+ [trigger, triggerOnly, mentions, mentionConfig]
18331
18353
  );
18332
18354
  if (mentions.length === 0) {
18333
18355
  return null;
@@ -18478,6 +18500,7 @@ function InputMentionInner({
18478
18500
  mentions,
18479
18501
  mentionConfig,
18480
18502
  mentionTrigger,
18503
+ mentionTriggerOnly,
18481
18504
  plainTextMentions = false,
18482
18505
  className,
18483
18506
  id,
@@ -18557,7 +18580,8 @@ function InputMentionInner({
18557
18580
  {
18558
18581
  mentions,
18559
18582
  mentionConfig: finalMentionConfig,
18560
- trigger: mentionTrigger
18583
+ trigger: mentionTrigger,
18584
+ triggerOnly: mentionTriggerOnly
18561
18585
  }
18562
18586
  ),
18563
18587
  /* @__PURE__ */ jsxRuntime.jsx(MentionDeletePlugin2, {}),