@sustaina/shared-ui 1.50.0 → 1.51.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { forwardRef, useRef, useEffect, useMemo, useCallback, isValidElement, useState, useLayoutEffect, createElement } from 'react';
2
+ import React__default, { forwardRef, isValidElement, useMemo, useRef, useEffect, useCallback, useState, useLayoutEffect, createElement } from 'react';
3
3
  import { useRouter } from '@tanstack/react-router';
4
4
  import { create } from 'zustand';
5
5
  import clsx2, { clsx } from 'clsx';
@@ -7,7 +7,7 @@ import { twMerge } from 'tailwind-merge';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
9
9
  import useEmblaCarousel from 'embla-carousel-react';
10
- import { ChevronLeft, ChevronRight, CircleX, CircleHelp, Undo, Redo, ChevronDown, X, Pencil, BaselineIcon, Bold, Italic, Underline, Strikethrough, Code, Pilcrow, Heading1, Heading2, Heading3, List, ListOrdered, QuoteIcon, CodeSquare, LinkIcon, Link2Off, ImageIcon, AlignLeft, AlignCenter, AlignRight, Check, ExternalLink, SearchIcon as SearchIcon$1, XIcon, CheckIcon, Triangle, CalendarIcon, Search, ChevronUp, PanelLeftIcon, Minimize2, Maximize2, Plus, MoreVertical, Bug, GripVertical, Info, CircleMinus, Minus } from 'lucide-react';
10
+ import { ChevronLeft, ChevronRight, CircleX, CircleHelp, Clock, ChevronDown, X, Undo, Redo, Check, Pencil, BaselineIcon, Bold, Italic, Underline, Strikethrough, Code, Pilcrow, Heading1, Heading2, Heading3, List, ListOrdered, QuoteIcon, CodeSquare, LinkIcon, Link2Off, ImageIcon, AlignLeft, AlignCenter, AlignRight, SearchIcon as SearchIcon$1, ExternalLink, XIcon, CheckIcon, Triangle, CalendarIcon, Search, ChevronUp, PanelLeftIcon, Minimize2, Maximize2, Plus, MoreVertical, Bug, GripVertical, Info, CircleMinus, Minus } from 'lucide-react';
11
11
  import Autoplay from 'embla-carousel-autoplay';
12
12
  import { Slot } from '@radix-ui/react-slot';
13
13
  import { cva } from 'class-variance-authority';
@@ -12316,6 +12316,13 @@ var usePreventPageLeave = ({ isPrevening }) => {
12316
12316
  };
12317
12317
  var usePreventPageLeave_default = usePreventPageLeave;
12318
12318
 
12319
+ // src/components/richtext/types.ts
12320
+ var createDefaultMentionConfig = () => ({
12321
+ getId: (item) => item.id,
12322
+ getName: (item) => item.name,
12323
+ getLabel: (item) => item.fieldName
12324
+ });
12325
+
12319
12326
  // src/components/richtext/utils/index.ts
12320
12327
  function parseSerializedEditorState(raw) {
12321
12328
  if (!raw) {
@@ -12602,7 +12609,7 @@ var MentionNode = class _MentionNode extends TextNode {
12602
12609
  }
12603
12610
  createDOM(config) {
12604
12611
  const dom = super.createDOM(config);
12605
- dom.className = "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-sm font-medium text-primary border border-sus-green-2 my-0.5 cursor-default";
12612
+ dom.className = "inline-flex items-center gap-1 rounded px-2 py-0.5 text-sm font-medium text-primary border border-sus-green-2 my-0.5 cursor-default";
12606
12613
  dom.setAttribute("data-mention-key", this.__mentionKey);
12607
12614
  dom.setAttribute("data-mention-label", this.__mentionLabel);
12608
12615
  dom.setAttribute("data-mention-node-key", this.__key);
@@ -14099,13 +14106,13 @@ function checkForTriggerMatch(text, trigger) {
14099
14106
  }
14100
14107
  return null;
14101
14108
  }
14102
- function checkForTextMatch(text, mentions) {
14109
+ function checkForTextMatch(text, mentions, config) {
14103
14110
  const wordMatch = /([A-Z_]+)$/i.exec(text);
14104
14111
  if (wordMatch) {
14105
14112
  const typedText = wordMatch[1].toLowerCase();
14106
14113
  const hasMatch = mentions.some((item) => {
14107
- const keyWithoutBraces = item.key.replace(/^\{\{|\}\}$/g, "").toLowerCase();
14108
- return keyWithoutBraces.startsWith(typedText) || keyWithoutBraces.includes(typedText) || item.label.toLowerCase().startsWith(typedText) || item.label.toLowerCase().includes(typedText);
14114
+ const keyWithoutBraces = config.getName(item).replace(/^\{\{|\}\}$/g, "").toLowerCase();
14115
+ return keyWithoutBraces.startsWith(typedText) || keyWithoutBraces.includes(typedText) || config.getLabel(item).toLowerCase().startsWith(typedText) || config.getLabel(item).toLowerCase().includes(typedText);
14109
14116
  });
14110
14117
  if (hasMatch) {
14111
14118
  return {
@@ -14118,10 +14125,10 @@ function checkForTextMatch(text, mentions) {
14118
14125
  return null;
14119
14126
  }
14120
14127
  var MentionTypeaheadOption = class extends MenuOption {
14121
- constructor(key, label) {
14122
- super(key);
14123
- this.key = key;
14124
- this.label = label;
14128
+ constructor(name, fieldName) {
14129
+ super(name);
14130
+ this.name = name;
14131
+ this.fieldName = fieldName;
14125
14132
  }
14126
14133
  };
14127
14134
  function MentionsTypeaheadMenuItem({
@@ -14137,7 +14144,7 @@ function MentionsTypeaheadMenuItem({
14137
14144
  tabIndex: -1,
14138
14145
  className: cn(
14139
14146
  "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
14140
- isSelected && "bg-accent text-accent-foreground"
14147
+ isSelected && "bg-sus-secondary-green-3 text-accent-foreground"
14141
14148
  ),
14142
14149
  ref: (el) => {
14143
14150
  option.setRefElement(el);
@@ -14147,26 +14154,27 @@ function MentionsTypeaheadMenuItem({
14147
14154
  id: `typeahead-item-${index}`,
14148
14155
  onMouseEnter,
14149
14156
  onClick,
14150
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
14151
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: option.label }),
14152
- /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: option.key })
14153
- ] })
14157
+ children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: option.name })
14154
14158
  },
14155
- option.key
14159
+ option.name
14156
14160
  );
14157
14161
  }
14158
- function MentionsPlugin({ mentions = [], trigger }) {
14162
+ function MentionsPlugin({
14163
+ mentions = [],
14164
+ mentionConfig,
14165
+ trigger
14166
+ }) {
14159
14167
  const [editor] = useLexicalComposerContext();
14160
14168
  const [queryString, setQueryString] = useState(null);
14161
14169
  const mentionKeyMap = useMemo(() => {
14162
14170
  const map = /* @__PURE__ */ new Map();
14163
14171
  mentions.forEach((item) => {
14164
- const keyWithoutBraces = item.key.replace(/^\{\{|\}\}$/g, "").toUpperCase();
14172
+ const keyWithoutBraces = mentionConfig.getName(item).replace(/^\{\{|\}\}$/g, "").toUpperCase();
14165
14173
  map.set(keyWithoutBraces, item);
14166
- map.set(item.key.toUpperCase(), item);
14174
+ map.set(mentionConfig.getName(item).toUpperCase(), item);
14167
14175
  });
14168
14176
  return map;
14169
- }, [mentions]);
14177
+ }, [mentions, mentionConfig]);
14170
14178
  useEffect(() => {
14171
14179
  if (mentions.length === 0) return;
14172
14180
  let isUpdating = false;
@@ -14207,11 +14215,17 @@ function MentionsPlugin({ mentions = [], trigger }) {
14207
14215
  }
14208
14216
  const [before, after] = node.splitText(startIndex, startIndex + fullMatch.length);
14209
14217
  if (after) {
14210
- const mentionNode = $createMentionNode(mentionItem.key, mentionItem.label);
14218
+ const mentionNode = $createMentionNode(
14219
+ mentionConfig.getName(mentionItem),
14220
+ mentionConfig.getLabel(mentionItem)
14221
+ );
14211
14222
  after.replace(mentionNode);
14212
14223
  mentionNode.selectNext();
14213
14224
  } else if (before && before.getTextContent() === fullMatch) {
14214
- const mentionNode = $createMentionNode(mentionItem.key, mentionItem.label);
14225
+ const mentionNode = $createMentionNode(
14226
+ mentionConfig.getName(mentionItem),
14227
+ mentionConfig.getLabel(mentionItem)
14228
+ );
14215
14229
  before.replace(mentionNode);
14216
14230
  mentionNode.selectNext();
14217
14231
  }
@@ -14225,21 +14239,25 @@ function MentionsPlugin({ mentions = [], trigger }) {
14225
14239
  }
14226
14240
  });
14227
14241
  });
14228
- }, [editor, mentions, mentionKeyMap]);
14242
+ }, [editor, mentions, mentionKeyMap, mentionConfig]);
14229
14243
  const options = useMemo(() => {
14230
14244
  if (!queryString) {
14231
- return mentions.map((item) => new MentionTypeaheadOption(item.key, item.label));
14245
+ return mentions.map(
14246
+ (item) => new MentionTypeaheadOption(mentionConfig.getName(item), mentionConfig.getLabel(item))
14247
+ );
14232
14248
  }
14233
14249
  const lowerQuery = queryString.toLowerCase();
14234
14250
  return mentions.filter((item) => {
14235
- const keyWithoutBraces = item.key.replace(/^\{\{|\}\}$/g, "").toLowerCase();
14236
- return item.label.toLowerCase().includes(lowerQuery) || keyWithoutBraces.includes(lowerQuery) || item.key.toLowerCase().includes(lowerQuery);
14237
- }).map((item) => new MentionTypeaheadOption(item.key, item.label));
14238
- }, [mentions, queryString]);
14251
+ const keyWithoutBraces = mentionConfig.getName(item).replace(/^\{\{|\}\}$/g, "").toLowerCase();
14252
+ return mentionConfig.getLabel(item).toLowerCase().includes(lowerQuery) || keyWithoutBraces.includes(lowerQuery) || mentionConfig.getName(item).toLowerCase().includes(lowerQuery);
14253
+ }).map(
14254
+ (item) => new MentionTypeaheadOption(mentionConfig.getName(item), mentionConfig.getLabel(item))
14255
+ );
14256
+ }, [mentions, queryString, mentionConfig]);
14239
14257
  const onSelectOption = useCallback(
14240
14258
  (selectedOption, nodeToReplace, closeMenu) => {
14241
14259
  editor.update(() => {
14242
- const mentionNode = $createMentionNode(selectedOption.key, selectedOption.label);
14260
+ const mentionNode = $createMentionNode(selectedOption.name, selectedOption.fieldName);
14243
14261
  if (nodeToReplace) {
14244
14262
  nodeToReplace.replace(mentionNode);
14245
14263
  }
@@ -14261,9 +14279,9 @@ function MentionsPlugin({ mentions = [], trigger }) {
14261
14279
  return triggerMatch;
14262
14280
  }
14263
14281
  }
14264
- return checkForTextMatch(text, mentions);
14282
+ return checkForTextMatch(text, mentions, mentionConfig);
14265
14283
  },
14266
- [trigger, mentions]
14284
+ [trigger, mentions, mentionConfig]
14267
14285
  );
14268
14286
  if (mentions.length === 0) {
14269
14287
  return null;
@@ -14286,7 +14304,7 @@ function MentionsPlugin({ mentions = [], trigger }) {
14286
14304
  /* @__PURE__ */ jsx(
14287
14305
  "div",
14288
14306
  {
14289
- className: "absolute z-[9999] min-w-[200px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
14307
+ className: "absolute z-9999 min-w-[200px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
14290
14308
  style: {
14291
14309
  top: `${top}px`,
14292
14310
  left: `${left}px`
@@ -14399,7 +14417,7 @@ var nodes = [
14399
14417
  ImageNode,
14400
14418
  MentionNode
14401
14419
  ];
14402
- var RichText = forwardRef(function RichText2({
14420
+ function RichTextInner({
14403
14421
  value,
14404
14422
  defaultValue,
14405
14423
  onChange,
@@ -14418,12 +14436,17 @@ var RichText = forwardRef(function RichText2({
14418
14436
  acceptImageMimeTypes = "image/*",
14419
14437
  allowImageUrlInsert = true,
14420
14438
  mentions,
14439
+ mentionConfig,
14421
14440
  mentionTrigger,
14422
14441
  plainTextMentions = false,
14423
14442
  className,
14424
14443
  id,
14425
14444
  ...rest
14426
14445
  }, ref) {
14446
+ const finalMentionConfig = useMemo(
14447
+ () => mentionConfig || createDefaultMentionConfig(),
14448
+ [mentionConfig]
14449
+ );
14427
14450
  const initialSerializedStateRef = useRef(void 0);
14428
14451
  if (initialSerializedStateRef.current === void 0) {
14429
14452
  initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
@@ -14518,7 +14541,14 @@ var RichText = forwardRef(function RichText2({
14518
14541
  /* @__PURE__ */ jsx(ListPlugin, {}),
14519
14542
  /* @__PURE__ */ jsx(LinkPlugin$1, {}),
14520
14543
  /* @__PURE__ */ jsx(ImagesPlugin, {}),
14521
- /* @__PURE__ */ jsx(MentionsPlugin, { mentions, trigger: mentionTrigger }),
14544
+ /* @__PURE__ */ jsx(
14545
+ MentionsPlugin,
14546
+ {
14547
+ mentions,
14548
+ mentionConfig: finalMentionConfig,
14549
+ trigger: mentionTrigger
14550
+ }
14551
+ ),
14522
14552
  /* @__PURE__ */ jsx(MentionDeletePlugin, {}),
14523
14553
  /* @__PURE__ */ jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }),
14524
14554
  autoFocus ? /* @__PURE__ */ jsx(AutoFocusPlugin, {}) : null,
@@ -14529,8 +14559,8 @@ var RichText = forwardRef(function RichText2({
14529
14559
  ]
14530
14560
  }
14531
14561
  ) });
14532
- });
14533
- RichText.displayName = "RichText";
14562
+ }
14563
+ var RichText = forwardRef(RichTextInner);
14534
14564
  var DefaultHeader = ({
14535
14565
  title,
14536
14566
  subtitle,
@@ -14620,6 +14650,305 @@ var RightPanelContainer = ({
14620
14650
  );
14621
14651
  };
14622
14652
  var RightPanelContainer_default = RightPanelContainer;
14653
+ var TimePicker = React.forwardRef(
14654
+ ({
14655
+ value = "",
14656
+ onChange,
14657
+ disabled = false,
14658
+ className,
14659
+ placeholder: placeholder2,
14660
+ use24Hour = false,
14661
+ iconPosition = "start",
14662
+ icon
14663
+ }, ref) => {
14664
+ const [open, setOpen] = React.useState(false);
14665
+ const [hours, setHours] = React.useState("12");
14666
+ const [minutes, setMinutes] = React.useState("00");
14667
+ const [period, setPeriod] = React.useState("AM");
14668
+ React.useEffect(() => {
14669
+ if (value) {
14670
+ let h, m;
14671
+ if (value.includes("Z") || value.match(/^\d{2}:\d{2}:\d{2}/)) {
14672
+ const [hour, min] = value.split(":");
14673
+ const hour24 = parseInt(hour);
14674
+ const minute = parseInt(min);
14675
+ if (use24Hour) {
14676
+ h = String(hour24);
14677
+ m = String(minute);
14678
+ } else {
14679
+ const newPeriod = hour24 >= 12 ? "PM" : "AM";
14680
+ const hour12 = hour24 === 0 ? 12 : hour24 > 12 ? hour24 - 12 : hour24;
14681
+ h = String(hour12);
14682
+ m = String(minute);
14683
+ setPeriod(newPeriod);
14684
+ }
14685
+ } else {
14686
+ const [time, meridiem] = value.split(" ");
14687
+ const [hour, min] = time.split(":");
14688
+ h = hour;
14689
+ m = min;
14690
+ if (meridiem) {
14691
+ setPeriod(meridiem);
14692
+ }
14693
+ }
14694
+ setHours(h.padStart(2, "0"));
14695
+ setMinutes(m.padStart(2, "0"));
14696
+ }
14697
+ }, [value, use24Hour]);
14698
+ const formatTime = (h, m, p) => {
14699
+ if (use24Hour) {
14700
+ return `${h.padStart(2, "0")}:${m.padStart(2, "0")}`;
14701
+ }
14702
+ return `${h.padStart(2, "0")}:${m.padStart(2, "0")} ${p}`;
14703
+ };
14704
+ const toISOTime = (h, m, p) => {
14705
+ let hour = parseInt(h) || 0;
14706
+ const minute = parseInt(m) || 0;
14707
+ if (!use24Hour) {
14708
+ if (p === "PM" && hour !== 12) {
14709
+ hour += 12;
14710
+ } else if (p === "AM" && hour === 12) {
14711
+ hour = 0;
14712
+ }
14713
+ }
14714
+ return `${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}:00.000Z`;
14715
+ };
14716
+ const handleHourChange = (newHour) => {
14717
+ const hour = parseInt(newHour) || 0;
14718
+ const maxHour = use24Hour ? 23 : 12;
14719
+ const minHour = use24Hour ? 0 : 1;
14720
+ if (hour <= maxHour && hour >= minHour) {
14721
+ setHours(newHour);
14722
+ onChange?.(toISOTime(newHour, minutes, period));
14723
+ }
14724
+ };
14725
+ const handleMinuteChange = (newMinute) => {
14726
+ const minute = parseInt(newMinute) || 0;
14727
+ if (minute <= 59 && minute >= 0) {
14728
+ setMinutes(newMinute);
14729
+ onChange?.(toISOTime(hours, newMinute, period));
14730
+ }
14731
+ };
14732
+ const handlePeriodToggle = () => {
14733
+ const newPeriod = period === "AM" ? "PM" : "AM";
14734
+ setPeriod(newPeriod);
14735
+ onChange?.(toISOTime(hours, minutes, newPeriod));
14736
+ };
14737
+ const incrementHour = () => {
14738
+ const hour = parseInt(hours) || 0;
14739
+ const maxHour = use24Hour ? 23 : 12;
14740
+ const minHour = use24Hour ? 0 : 1;
14741
+ const newHour = hour >= maxHour ? minHour : hour + 1;
14742
+ handleHourChange(String(newHour));
14743
+ };
14744
+ const decrementHour = () => {
14745
+ const hour = parseInt(hours) || 0;
14746
+ const maxHour = use24Hour ? 23 : 12;
14747
+ const minHour = use24Hour ? 0 : 1;
14748
+ const newHour = hour <= minHour ? maxHour : hour - 1;
14749
+ handleHourChange(String(newHour));
14750
+ };
14751
+ const incrementMinute = () => {
14752
+ const minute = parseInt(minutes) || 0;
14753
+ const newMinute = minute >= 59 ? 0 : minute + 1;
14754
+ handleMinuteChange(String(newMinute));
14755
+ };
14756
+ const decrementMinute = () => {
14757
+ const minute = parseInt(minutes) || 0;
14758
+ const newMinute = minute <= 0 ? 59 : minute - 1;
14759
+ handleMinuteChange(String(newMinute));
14760
+ };
14761
+ const displayValue = formatTime(hours, minutes, period);
14762
+ const displayIcon = icon || /* @__PURE__ */ jsx(Clock, { className: "h-4 w-4" });
14763
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
14764
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
14765
+ Button,
14766
+ {
14767
+ variant: "outline",
14768
+ disabled,
14769
+ className: cn(
14770
+ "w-full justify-between text-left font-normal",
14771
+ !value && "text-muted-foreground",
14772
+ className
14773
+ ),
14774
+ children: [
14775
+ iconPosition === "start" && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: displayIcon }),
14776
+ /* @__PURE__ */ jsx(
14777
+ "span",
14778
+ {
14779
+ className: cn(
14780
+ "flex-1",
14781
+ iconPosition === "start" && "ml-2",
14782
+ iconPosition === "end" && "mr-2"
14783
+ ),
14784
+ children: value ? displayValue : placeholder2 || displayValue
14785
+ }
14786
+ ),
14787
+ iconPosition === "end" && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: displayIcon })
14788
+ ]
14789
+ }
14790
+ ) }),
14791
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-4", align: "start", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
14792
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
14793
+ /* @__PURE__ */ jsx(
14794
+ Button,
14795
+ {
14796
+ variant: "ghost",
14797
+ size: "icon",
14798
+ className: "h-8 w-8",
14799
+ onClick: incrementHour,
14800
+ type: "button",
14801
+ children: /* @__PURE__ */ jsx(
14802
+ "svg",
14803
+ {
14804
+ xmlns: "http://www.w3.org/2000/svg",
14805
+ width: "16",
14806
+ height: "16",
14807
+ viewBox: "0 0 24 24",
14808
+ fill: "none",
14809
+ stroke: "currentColor",
14810
+ strokeWidth: "2",
14811
+ strokeLinecap: "round",
14812
+ strokeLinejoin: "round",
14813
+ children: /* @__PURE__ */ jsx("polyline", { points: "18 15 12 9 6 15" })
14814
+ }
14815
+ )
14816
+ }
14817
+ ),
14818
+ /* @__PURE__ */ jsx(
14819
+ Input,
14820
+ {
14821
+ ref,
14822
+ type: "text",
14823
+ inputMode: "numeric",
14824
+ value: hours,
14825
+ onChange: (e) => handleHourChange(e.target.value),
14826
+ className: "w-16 text-center",
14827
+ maxLength: 2
14828
+ }
14829
+ ),
14830
+ /* @__PURE__ */ jsx(
14831
+ Button,
14832
+ {
14833
+ variant: "ghost",
14834
+ size: "icon",
14835
+ className: "h-8 w-8",
14836
+ onClick: decrementHour,
14837
+ type: "button",
14838
+ children: /* @__PURE__ */ jsx(
14839
+ "svg",
14840
+ {
14841
+ xmlns: "http://www.w3.org/2000/svg",
14842
+ width: "16",
14843
+ height: "16",
14844
+ viewBox: "0 0 24 24",
14845
+ fill: "none",
14846
+ stroke: "currentColor",
14847
+ strokeWidth: "2",
14848
+ strokeLinecap: "round",
14849
+ strokeLinejoin: "round",
14850
+ children: /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" })
14851
+ }
14852
+ )
14853
+ }
14854
+ )
14855
+ ] }),
14856
+ /* @__PURE__ */ jsx("span", { className: "text-2xl font-semibold", children: ":" }),
14857
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
14858
+ /* @__PURE__ */ jsx(
14859
+ Button,
14860
+ {
14861
+ variant: "ghost",
14862
+ size: "icon",
14863
+ className: "h-8 w-8",
14864
+ onClick: incrementMinute,
14865
+ type: "button",
14866
+ children: /* @__PURE__ */ jsx(
14867
+ "svg",
14868
+ {
14869
+ xmlns: "http://www.w3.org/2000/svg",
14870
+ width: "16",
14871
+ height: "16",
14872
+ viewBox: "0 0 24 24",
14873
+ fill: "none",
14874
+ stroke: "currentColor",
14875
+ strokeWidth: "2",
14876
+ strokeLinecap: "round",
14877
+ strokeLinejoin: "round",
14878
+ children: /* @__PURE__ */ jsx("polyline", { points: "18 15 12 9 6 15" })
14879
+ }
14880
+ )
14881
+ }
14882
+ ),
14883
+ /* @__PURE__ */ jsx(
14884
+ Input,
14885
+ {
14886
+ type: "text",
14887
+ inputMode: "numeric",
14888
+ value: minutes,
14889
+ onChange: (e) => handleMinuteChange(e.target.value),
14890
+ className: "w-16 text-center",
14891
+ maxLength: 2
14892
+ }
14893
+ ),
14894
+ /* @__PURE__ */ jsx(
14895
+ Button,
14896
+ {
14897
+ variant: "ghost",
14898
+ size: "icon",
14899
+ className: "h-8 w-8",
14900
+ onClick: decrementMinute,
14901
+ type: "button",
14902
+ children: /* @__PURE__ */ jsx(
14903
+ "svg",
14904
+ {
14905
+ xmlns: "http://www.w3.org/2000/svg",
14906
+ width: "16",
14907
+ height: "16",
14908
+ viewBox: "0 0 24 24",
14909
+ fill: "none",
14910
+ stroke: "currentColor",
14911
+ strokeWidth: "2",
14912
+ strokeLinecap: "round",
14913
+ strokeLinejoin: "round",
14914
+ children: /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" })
14915
+ }
14916
+ )
14917
+ }
14918
+ )
14919
+ ] }),
14920
+ !use24Hour && /* @__PURE__ */ jsxs(Fragment, { children: [
14921
+ /* @__PURE__ */ jsx("div", { className: "w-px h-16 bg-border mx-1" }),
14922
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
14923
+ /* @__PURE__ */ jsx(
14924
+ Button,
14925
+ {
14926
+ variant: period === "AM" ? "default" : "outline",
14927
+ size: "sm",
14928
+ className: "w-14 h-12",
14929
+ onClick: handlePeriodToggle,
14930
+ type: "button",
14931
+ children: "AM"
14932
+ }
14933
+ ),
14934
+ /* @__PURE__ */ jsx(
14935
+ Button,
14936
+ {
14937
+ variant: period === "PM" ? "default" : "outline",
14938
+ size: "sm",
14939
+ className: "w-14 h-12",
14940
+ onClick: handlePeriodToggle,
14941
+ type: "button",
14942
+ children: "PM"
14943
+ }
14944
+ )
14945
+ ] })
14946
+ ] })
14947
+ ] }) })
14948
+ ] });
14949
+ }
14950
+ );
14951
+ TimePicker.displayName = "TimePicker";
14623
14952
 
14624
14953
  // src/components/cropperModal/type.ts
14625
14954
  var CropperModalError = class extends Error {
@@ -15988,6 +16317,90 @@ var VirtualizedCommand = ({
15988
16317
  ] });
15989
16318
  };
15990
16319
  var VirtualizedCommand_default = VirtualizedCommand;
16320
+ var NonVirtualizedCommand = ({
16321
+ name,
16322
+ height = 292,
16323
+ options,
16324
+ emptyContent = "No data.",
16325
+ searchPlaceholder,
16326
+ value,
16327
+ notFoundContent = "No item found.",
16328
+ showSearch = true,
16329
+ fieldNames,
16330
+ disabledOption,
16331
+ filterOption,
16332
+ onSelect,
16333
+ labelRender
16334
+ }) => {
16335
+ const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
16336
+ const internalOptions = React.useMemo(() => options ?? [], [options]);
16337
+ const [filteredOptions, setFilteredOptions] = React.useState(internalOptions);
16338
+ const handleSearch = React.useCallback(
16339
+ (search) => {
16340
+ setFilteredOptions(
16341
+ internalOptions.filter((option) => {
16342
+ if (typeof filterOption === "function") {
16343
+ return filterOption(search, option);
16344
+ }
16345
+ const labelValue = getLabelField(option);
16346
+ return labelValue?.toString()?.toLowerCase()?.includes?.(search.toLowerCase());
16347
+ })
16348
+ );
16349
+ },
16350
+ [filterOption, getLabelField, internalOptions]
16351
+ );
16352
+ return /* @__PURE__ */ jsxs(Command, { shouldFilter: false, children: [
16353
+ showSearch && /* @__PURE__ */ jsx(
16354
+ CommandInput,
16355
+ {
16356
+ onValueChange: handleSearch,
16357
+ placeholder: searchPlaceholder,
16358
+ "data-testid": `command-input-${name}`
16359
+ }
16360
+ ),
16361
+ /* @__PURE__ */ jsxs(
16362
+ CommandList,
16363
+ {
16364
+ style: {
16365
+ maxHeight: height,
16366
+ overflow: "auto"
16367
+ },
16368
+ children: [
16369
+ /* @__PURE__ */ jsx(CommandEmpty, { "data-testid": `command-item-empty-${name}`, children: internalOptions.length === 0 ? emptyContent : notFoundContent }),
16370
+ /* @__PURE__ */ jsx(CommandGroup, { children: filteredOptions.map((option, index) => {
16371
+ const optionLabel = getLabelField(option);
16372
+ const optionValue = getValueField(option);
16373
+ const labelRendered = labelRender ? labelRender(option) : optionLabel;
16374
+ return /* @__PURE__ */ jsxs(
16375
+ CommandItem,
16376
+ {
16377
+ className: "flex items-center justify-between",
16378
+ value: optionValue,
16379
+ onSelect: (selectedValue) => onSelect?.(selectedValue, option),
16380
+ disabled: disabledOption?.(option),
16381
+ "data-testid": `command-item-${index}-${optionValue}`,
16382
+ children: [
16383
+ typeof labelRendered === "string" ? /* @__PURE__ */ jsx(truncated_default, { tooltipProps: { disabled: true }, children: labelRendered }) : labelRendered,
16384
+ /* @__PURE__ */ jsx(
16385
+ Check,
16386
+ {
16387
+ className: cn(
16388
+ "mr-2 size-2 hover:text-sus-green-2",
16389
+ value === optionValue ? "opacity-100" : "opacity-0"
16390
+ )
16391
+ }
16392
+ )
16393
+ ]
16394
+ },
16395
+ optionValue
16396
+ );
16397
+ }) })
16398
+ ]
16399
+ }
16400
+ )
16401
+ ] });
16402
+ };
16403
+ var NonVirtualizedCommand_default = NonVirtualizedCommand;
15991
16404
  var ComboboxInner = ({
15992
16405
  name,
15993
16406
  dropdownName,
@@ -16014,6 +16427,7 @@ var ComboboxInner = ({
16014
16427
  showValueWhenNoMatch,
16015
16428
  onOpenChange,
16016
16429
  onClear,
16430
+ virtual = true,
16017
16431
  ...props
16018
16432
  }, ref) => {
16019
16433
  const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
@@ -16131,7 +16545,7 @@ var ComboboxInner = ({
16131
16545
  className: "p-0 w-(--radix-popper-anchor-width) min-w-(--radix-popper-anchor-width) max-w-(--radix-popper-available-width) rounded-md",
16132
16546
  align: "start",
16133
16547
  sideOffset: 4,
16134
- children: /* @__PURE__ */ jsx(
16548
+ children: virtual ? /* @__PURE__ */ jsx(
16135
16549
  VirtualizedCommand_default,
16136
16550
  {
16137
16551
  name: dropdownName,
@@ -16148,6 +16562,23 @@ var ComboboxInner = ({
16148
16562
  labelRender,
16149
16563
  onSelect: handleSelect
16150
16564
  }
16565
+ ) : /* @__PURE__ */ jsx(
16566
+ NonVirtualizedCommand_default,
16567
+ {
16568
+ name: dropdownName,
16569
+ emptyContent,
16570
+ height,
16571
+ notFoundContent,
16572
+ searchPlaceholder,
16573
+ showSearch,
16574
+ fieldNames,
16575
+ options,
16576
+ value: selectedValue,
16577
+ disabledOption,
16578
+ filterOption,
16579
+ labelRender,
16580
+ onSelect: handleSelect
16581
+ }
16151
16582
  )
16152
16583
  }
16153
16584
  )
@@ -16278,17 +16709,87 @@ var TabSelect = ({
16278
16709
  );
16279
16710
  };
16280
16711
 
16712
+ // src/components/inputMention/types.ts
16713
+ var createDefaultMentionConfig2 = () => ({
16714
+ getId: (item) => item.id,
16715
+ getName: (item) => item.name,
16716
+ getLabel: (item) => item.fieldName
16717
+ });
16718
+
16281
16719
  // src/components/inputMention/utils/index.ts
16282
- function parseSerializedEditorState2(raw) {
16720
+ function parseSerializedEditorState2(raw, mentions, mentionConfig) {
16283
16721
  if (!raw) {
16284
16722
  return void 0;
16285
16723
  }
16286
- try {
16287
- return JSON.parse(raw);
16288
- } catch (error) {
16289
- console.error("[InputMention] Failed to parse editor state:", error);
16290
- return void 0;
16724
+ const mentionMap = /* @__PURE__ */ new Map();
16725
+ if (mentions && mentionConfig) {
16726
+ mentions.forEach((item) => {
16727
+ const name = mentionConfig.getName(item);
16728
+ const label = mentionConfig.getLabel(item);
16729
+ mentionMap.set(name.toUpperCase(), label);
16730
+ });
16731
+ }
16732
+ const mentionRegex = /(\{\{[A-Z_]+\}\})/g;
16733
+ const parts = raw.split(mentionRegex);
16734
+ const children = [];
16735
+ for (const part of parts) {
16736
+ if (!part) continue;
16737
+ if (mentionRegex.test(part)) {
16738
+ const label = mentionMap.get(part.toUpperCase()) || part;
16739
+ children.push({
16740
+ type: "mention",
16741
+ version: 1,
16742
+ mentionKey: part,
16743
+ mentionLabel: label,
16744
+ detail: 0,
16745
+ format: 0,
16746
+ mode: "normal",
16747
+ style: "",
16748
+ text: part
16749
+ });
16750
+ mentionRegex.lastIndex = 0;
16751
+ } else {
16752
+ children.push({
16753
+ detail: 0,
16754
+ format: 0,
16755
+ mode: "normal",
16756
+ style: "",
16757
+ text: part,
16758
+ type: "text",
16759
+ version: 1
16760
+ });
16761
+ }
16291
16762
  }
16763
+ if (children.length === 0) {
16764
+ children.push({
16765
+ detail: 0,
16766
+ format: 0,
16767
+ mode: "normal",
16768
+ style: "",
16769
+ text: "",
16770
+ type: "text",
16771
+ version: 1
16772
+ });
16773
+ }
16774
+ return {
16775
+ root: {
16776
+ children: [
16777
+ {
16778
+ children,
16779
+ direction: null,
16780
+ format: "",
16781
+ indent: 0,
16782
+ type: "paragraph",
16783
+ version: 1
16784
+ }
16785
+ ],
16786
+ direction: null,
16787
+ format: "",
16788
+ indent: 0,
16789
+ type: "root",
16790
+ version: 1
16791
+ }
16792
+ };
16292
16793
  }
16293
16794
  function convertMentionElement2(domNode) {
16294
16795
  const mentionKey = domNode.getAttribute("data-mention-key");
@@ -16339,7 +16840,7 @@ var MentionNode2 = class _MentionNode extends TextNode {
16339
16840
  }
16340
16841
  createDOM(config) {
16341
16842
  const dom = super.createDOM(config);
16342
- dom.className = "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-sm font-medium text-primary border border-sus-green-2 my-0.5 cursor-default";
16843
+ dom.className = "inline-flex items-center gap-1 rounded px-2 py-0.5 text-sm font-medium text-primary border border-sus-green-2 my-0.5 cursor-default";
16343
16844
  dom.setAttribute("data-mention-key", this.__mentionKey);
16344
16845
  dom.setAttribute("data-mention-label", this.__mentionLabel);
16345
16846
  dom.setAttribute("data-mention-node-key", this.__key);
@@ -16428,18 +16929,18 @@ function $createMentionNode2(mentionKey, mentionLabel) {
16428
16929
  }
16429
16930
  function ControlledValuePlugin2({
16430
16931
  value,
16431
- trackAppliedValue
16932
+ trackAppliedValue,
16933
+ mentions,
16934
+ mentionConfig
16432
16935
  }) {
16433
16936
  const [editor] = useLexicalComposerContext();
16434
16937
  useEffect(() => {
16435
16938
  if (value == null || trackAppliedValue.current === value) {
16436
16939
  return;
16437
16940
  }
16438
- let parsed;
16439
- try {
16440
- parsed = JSON.parse(value);
16441
- } catch (error) {
16442
- console.error("[InputMention] Failed to sync controlled value:", error);
16941
+ const parsed = parseSerializedEditorState2(value, mentions, mentionConfig);
16942
+ if (!parsed) {
16943
+ console.error("[InputMention] Failed to parse value:", value);
16443
16944
  return;
16444
16945
  }
16445
16946
  trackAppliedValue.current = value;
@@ -16475,13 +16976,13 @@ function checkForTriggerMatch2(text, trigger) {
16475
16976
  }
16476
16977
  return null;
16477
16978
  }
16478
- function checkForTextMatch2(text, mentions) {
16979
+ function checkForTextMatch2(text, mentions, config) {
16479
16980
  const wordMatch = /([A-Z_]{2,})$/i.exec(text);
16480
16981
  if (wordMatch) {
16481
16982
  const typedText = wordMatch[1].toLowerCase();
16482
16983
  const hasMatch = mentions.some((item) => {
16483
- const keyWithoutBraces = item.key.replace(/^\{\{|\}\}$/g, "").toLowerCase();
16484
- return keyWithoutBraces.startsWith(typedText) || keyWithoutBraces.includes(typedText) || item.label.toLowerCase().startsWith(typedText) || item.label.toLowerCase().includes(typedText);
16984
+ const keyWithoutBraces = config.getName(item).replace(/^\{\{|\}\}$/g, "").toLowerCase();
16985
+ return keyWithoutBraces.startsWith(typedText) || keyWithoutBraces.includes(typedText) || config.getLabel(item).toLowerCase().startsWith(typedText) || config.getLabel(item).toLowerCase().includes(typedText);
16485
16986
  });
16486
16987
  if (hasMatch) {
16487
16988
  return {
@@ -16494,10 +16995,10 @@ function checkForTextMatch2(text, mentions) {
16494
16995
  return null;
16495
16996
  }
16496
16997
  var MentionTypeaheadOption2 = class extends MenuOption {
16497
- constructor(key, label) {
16498
- super(key);
16499
- this.key = key;
16500
- this.label = label;
16998
+ constructor(name, fieldName) {
16999
+ super(name);
17000
+ this.name = name;
17001
+ this.fieldName = fieldName;
16501
17002
  }
16502
17003
  };
16503
17004
  function MentionsTypeaheadMenuItem2({
@@ -16513,7 +17014,7 @@ function MentionsTypeaheadMenuItem2({
16513
17014
  tabIndex: -1,
16514
17015
  className: cn(
16515
17016
  "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
16516
- isSelected && "bg-accent text-accent-foreground"
17017
+ isSelected && "bg-sus-secondary-green-3 text-accent-foreground"
16517
17018
  ),
16518
17019
  ref: (el) => {
16519
17020
  option.setRefElement(el);
@@ -16523,26 +17024,27 @@ function MentionsTypeaheadMenuItem2({
16523
17024
  id: `typeahead-item-${index}`,
16524
17025
  onMouseEnter,
16525
17026
  onClick,
16526
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
16527
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: option.label }),
16528
- /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: option.key })
16529
- ] })
17027
+ children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: option.name })
16530
17028
  },
16531
- option.key
17029
+ option.name
16532
17030
  );
16533
17031
  }
16534
- function MentionsPlugin2({ mentions = [], trigger }) {
17032
+ function MentionsPlugin2({
17033
+ mentions = [],
17034
+ mentionConfig,
17035
+ trigger
17036
+ }) {
16535
17037
  const [editor] = useLexicalComposerContext();
16536
17038
  const [queryString, setQueryString] = useState(null);
16537
17039
  const mentionKeyMap = useMemo(() => {
16538
17040
  const map = /* @__PURE__ */ new Map();
16539
17041
  mentions.forEach((item) => {
16540
- const keyWithoutBraces = item.key.replace(/^\{\{|\}\}$/g, "").toUpperCase();
17042
+ const keyWithoutBraces = mentionConfig.getName(item).replace(/^\{\{|\}\}$/g, "").toUpperCase();
16541
17043
  map.set(keyWithoutBraces, item);
16542
- map.set(item.key.toUpperCase(), item);
17044
+ map.set(mentionConfig.getName(item).toUpperCase(), item);
16543
17045
  });
16544
17046
  return map;
16545
- }, [mentions]);
17047
+ }, [mentions, mentionConfig]);
16546
17048
  useEffect(() => {
16547
17049
  if (mentions.length === 0) return;
16548
17050
  let isUpdating = false;
@@ -16583,11 +17085,17 @@ function MentionsPlugin2({ mentions = [], trigger }) {
16583
17085
  }
16584
17086
  const [before, after] = node.splitText(startIndex, startIndex + fullMatch.length);
16585
17087
  if (after) {
16586
- const mentionNode = $createMentionNode2(mentionItem.key, mentionItem.label);
17088
+ const mentionNode = $createMentionNode2(
17089
+ mentionConfig.getName(mentionItem),
17090
+ mentionConfig.getLabel(mentionItem)
17091
+ );
16587
17092
  after.replace(mentionNode);
16588
17093
  mentionNode.selectNext();
16589
17094
  } else if (before && before.getTextContent() === fullMatch) {
16590
- const mentionNode = $createMentionNode2(mentionItem.key, mentionItem.label);
17095
+ const mentionNode = $createMentionNode2(
17096
+ mentionConfig.getName(mentionItem),
17097
+ mentionConfig.getLabel(mentionItem)
17098
+ );
16591
17099
  before.replace(mentionNode);
16592
17100
  mentionNode.selectNext();
16593
17101
  }
@@ -16601,22 +17109,26 @@ function MentionsPlugin2({ mentions = [], trigger }) {
16601
17109
  }
16602
17110
  });
16603
17111
  });
16604
- }, [editor, mentions, mentionKeyMap]);
17112
+ }, [editor, mentions, mentionKeyMap, mentionConfig]);
16605
17113
  const options = useMemo(() => {
16606
17114
  if (!queryString) {
16607
- return mentions.map((item) => new MentionTypeaheadOption2(item.key, item.label));
17115
+ return mentions.map(
17116
+ (item) => new MentionTypeaheadOption2(mentionConfig.getName(item), mentionConfig.getLabel(item))
17117
+ );
16608
17118
  }
16609
17119
  const lowerQuery = queryString.toLowerCase();
16610
17120
  return mentions.filter((item) => {
16611
- const keyWithoutBraces = item.key.replace(/^\{\{|\}\}$/g, "").toLowerCase();
16612
- return item.label.toLowerCase().includes(lowerQuery) || keyWithoutBraces.includes(lowerQuery) || item.key.toLowerCase().includes(lowerQuery);
16613
- }).map((item) => new MentionTypeaheadOption2(item.key, item.label));
16614
- }, [mentions, queryString]);
17121
+ const keyWithoutBraces = mentionConfig.getName(item).replace(/^\{\{|\}\}$/g, "").toLowerCase();
17122
+ return mentionConfig.getLabel(item).toLowerCase().includes(lowerQuery) || keyWithoutBraces.includes(lowerQuery) || mentionConfig.getName(item).toLowerCase().includes(lowerQuery);
17123
+ }).map(
17124
+ (item) => new MentionTypeaheadOption2(mentionConfig.getName(item), mentionConfig.getLabel(item))
17125
+ );
17126
+ }, [mentions, queryString, mentionConfig]);
16615
17127
  const onSelectOption = useCallback(
16616
17128
  (selectedOption, nodeToReplace, closeMenu) => {
16617
17129
  editor.update(
16618
17130
  () => {
16619
- const mentionNode = $createMentionNode2(selectedOption.key, selectedOption.label);
17131
+ const mentionNode = $createMentionNode2(selectedOption.name, selectedOption.fieldName);
16620
17132
  if (nodeToReplace) {
16621
17133
  nodeToReplace.replace(mentionNode);
16622
17134
  }
@@ -16640,9 +17152,9 @@ function MentionsPlugin2({ mentions = [], trigger }) {
16640
17152
  return triggerMatch;
16641
17153
  }
16642
17154
  }
16643
- return checkForTextMatch2(text, mentions);
17155
+ return checkForTextMatch2(text, mentions, mentionConfig);
16644
17156
  },
16645
- [trigger, mentions]
17157
+ [trigger, mentions, mentionConfig]
16646
17158
  );
16647
17159
  if (mentions.length === 0) {
16648
17160
  return null;
@@ -16665,7 +17177,7 @@ function MentionsPlugin2({ mentions = [], trigger }) {
16665
17177
  /* @__PURE__ */ jsx(
16666
17178
  "div",
16667
17179
  {
16668
- className: "absolute z-[9999] min-w-[200px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
17180
+ className: "absolute z-9999 min-w-[200px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
16669
17181
  style: {
16670
17182
  top: `${top}px`,
16671
17183
  left: `${left}px`
@@ -16746,27 +17258,29 @@ var theme2 = {
16746
17258
  placeholder: "pointer-events-none absolute left-0 top-0 px-3 py-2 text-sm text-muted-foreground select-none"
16747
17259
  };
16748
17260
  var nodes2 = [MentionNode2];
16749
- var InputMention = forwardRef(function InputMention2({
17261
+ function InputMentionInner({
16750
17262
  value,
16751
- defaultValue,
16752
17263
  onChange,
16753
- onHtmlChange,
16754
- onTextChange,
16755
17264
  placeholder: placeholder2,
16756
17265
  readOnly,
16757
17266
  disabled,
16758
17267
  editorClassName,
16759
17268
  autoFocus,
16760
17269
  mentions,
17270
+ mentionConfig,
16761
17271
  mentionTrigger,
16762
17272
  plainTextMentions = false,
16763
17273
  className,
16764
17274
  id,
16765
17275
  ...rest
16766
17276
  }, ref) {
17277
+ const finalMentionConfig = useMemo(
17278
+ () => mentionConfig || createDefaultMentionConfig2(),
17279
+ [mentionConfig]
17280
+ );
16767
17281
  const initialSerializedStateRef = useRef(void 0);
16768
17282
  if (initialSerializedStateRef.current === void 0) {
16769
- initialSerializedStateRef.current = parseSerializedEditorState2(value ?? defaultValue);
17283
+ initialSerializedStateRef.current = parseSerializedEditorState2(value, mentions, finalMentionConfig);
16770
17284
  }
16771
17285
  useEffect(() => {
16772
17286
  MentionNode2.plainTextMode = plainTextMentions;
@@ -16784,30 +17298,18 @@ var InputMention = forwardRef(function InputMention2({
16784
17298
  }),
16785
17299
  [disabled, readOnly]
16786
17300
  );
16787
- const appliedValueRef = useRef(value ?? defaultValue);
17301
+ const appliedValueRef = useRef(value);
16788
17302
  const handleChange = useCallback(
16789
- (editorState, editor) => {
16790
- const serialized = JSON.stringify(editorState.toJSON());
16791
- appliedValueRef.current = serialized;
16792
- if (onChange) {
16793
- onChange(serialized, editorState);
16794
- }
16795
- if (onHtmlChange) {
16796
- let html = "";
16797
- editorState.read(() => {
16798
- html = $generateHtmlFromNodes(editor, null);
16799
- });
16800
- onHtmlChange(html, editorState);
16801
- }
16802
- if (onTextChange) {
16803
- let text = "";
16804
- editorState.read(() => {
16805
- text = $getRoot().getTextContent();
16806
- });
16807
- onTextChange(text, editorState);
16808
- }
17303
+ (editorState) => {
17304
+ let plainText = "";
17305
+ editorState.read(() => {
17306
+ const root = $getRoot();
17307
+ plainText = root.getTextContent();
17308
+ });
17309
+ appliedValueRef.current = plainText;
17310
+ onChange?.(plainText);
16809
17311
  },
16810
- [onChange, onHtmlChange, onTextChange]
17312
+ [onChange]
16811
17313
  );
16812
17314
  return /* @__PURE__ */ jsx(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsxs(
16813
17315
  "div",
@@ -16841,17 +17343,32 @@ var InputMention = forwardRef(function InputMention2({
16841
17343
  }
16842
17344
  ),
16843
17345
  /* @__PURE__ */ jsx(HistoryPlugin, {}),
16844
- /* @__PURE__ */ jsx(MentionsPlugin2, { mentions, trigger: mentionTrigger }),
17346
+ /* @__PURE__ */ jsx(
17347
+ MentionsPlugin2,
17348
+ {
17349
+ mentions,
17350
+ mentionConfig: finalMentionConfig,
17351
+ trigger: mentionTrigger
17352
+ }
17353
+ ),
16845
17354
  /* @__PURE__ */ jsx(MentionDeletePlugin2, {}),
16846
17355
  autoFocus && /* @__PURE__ */ jsx(AutoFocusPlugin, {}),
16847
- /* @__PURE__ */ jsx(ControlledValuePlugin2, { value, trackAppliedValue: appliedValueRef }),
17356
+ /* @__PURE__ */ jsx(
17357
+ ControlledValuePlugin2,
17358
+ {
17359
+ value,
17360
+ trackAppliedValue: appliedValueRef,
17361
+ mentions,
17362
+ mentionConfig: finalMentionConfig
17363
+ }
17364
+ ),
16848
17365
  /* @__PURE__ */ jsx(OnChangePluginFiltered2, { onChange: handleChange, ignoreSelectionChange: true })
16849
17366
  ]
16850
17367
  }
16851
17368
  ) });
16852
- });
16853
- InputMention.displayName = "InputMention";
17369
+ }
17370
+ var InputMention = forwardRef(InputMentionInner);
16854
17371
 
16855
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionMenu, AdministrationIcon, AdvanceSearch_default as AdvanceSearch, AnalyticsIcon, ApplicationLogIcon, ArrowIcon, AuditFooter, BookmarkIcon, BriefcaseBusinessIcon, Button, SuiCalendarIcon2 as Calendar2Icon, CalendarDaysIcon, CardIcon, Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, CarouselThumbnails, Checkbox, CircleUserIcon, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Combobox_default as Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CopyUserRightsIcon, CropperModal, CropperModalError, CustomActionStatusIcon, CustomFieldIcon, DIALOG_ALERT_I18N_SUBNAMESPACE, DIALOG_ALERT_TEMPLATES, DashboardIcon, DataEntryIcon, DataTable_default as DataTable, DatePicker2 as DatePicker, DecreaseIcon, Dialog, DialogAlert, DialogAlertProvider, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, EllipsisBoxIcon, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, FactoryIcon, FileCogIcon, FileSpreadsheet, FileTextIcon, FiltersIcon, FolderIcon, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, GridSettingsModal_default as GridSettingsModal, HamburgerMenuIcon, HandymanIcon, header_default as Header, HeaderCell_default as HeaderCell, HelpIcon, HomeIcon, HomePlusIcon, Image2 as Image, ImagePlaceholderIcon, InformationIcon, Input, InputMention, InputNumber_default as InputNumber, Label2 as Label, LookupSelect, MailIcon, MainListContainer_default as MainListContainer, ManIcon, ManagementIcon, MenuIcon, MessageIcon, MessageIconInverse, MessageSquareIcon, MonthPicker2 as MonthPicker, navbar_default as Navbar, NotFoundIcon, OutlineArrowIcon, PlusIcon, PlusSearchIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PowerIcon, PreventPageLeave_default as PreventPageLeave, QuestionIcon, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, RightPanelContainer_default as RightPanelContainer, RoleIcon, SearchIcon, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, SetupIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, SuiCalendarIcon, SuiCalendarIcon2, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, TabSelect, Table, TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableOfContents, TableRow, TagListViewIcon, TextArea, ToolBoxIcon, Tooltip2 as Tooltip, TooltipArrow, TooltipContent2 as TooltipContent, TooltipProvider2 as TooltipProvider, TooltipTrigger2 as TooltipTrigger, TransferUserRightsIcon, TrashIcon, truncated_default as Truncated, truncatedMouseEnterDiv_default as TruncatedMouseEnterDiv, ui_exports as UI, UserActiveIcon, UserAloneIcon, UserFriendIcon, UserGroupIcon, UserIcon, UserInactiveIcon, UserNameIcon, UserProtectIcon, UsersIcon, VirtualizedCommand_default as VirtualizedCommand, WorkFlowIcon, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, resetVisibleTableState, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, useBindRef_default as useBindRef, useCarousel, useControllableState_default as useControllableState, useDraftGuardStore, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useIsomorphicLayoutEffect, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useSafeBlocker, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated, validateTokenPrefixes };
17372
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionMenu, AdministrationIcon, AdvanceSearch_default as AdvanceSearch, AnalyticsIcon, ApplicationLogIcon, ArrowIcon, AuditFooter, BookmarkIcon, BriefcaseBusinessIcon, Button, SuiCalendarIcon2 as Calendar2Icon, CalendarDaysIcon, CardIcon, Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, CarouselThumbnails, Checkbox, CircleUserIcon, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Combobox_default as Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CopyUserRightsIcon, CropperModal, CropperModalError, CustomActionStatusIcon, CustomFieldIcon, DIALOG_ALERT_I18N_SUBNAMESPACE, DIALOG_ALERT_TEMPLATES, DashboardIcon, DataEntryIcon, DataTable_default as DataTable, DatePicker2 as DatePicker, DecreaseIcon, Dialog, DialogAlert, DialogAlertProvider, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, EllipsisBoxIcon, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, FactoryIcon, FileCogIcon, FileSpreadsheet, FileTextIcon, FiltersIcon, FolderIcon, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, GridSettingsModal_default as GridSettingsModal, HamburgerMenuIcon, HandymanIcon, header_default as Header, HeaderCell_default as HeaderCell, HelpIcon, HomeIcon, HomePlusIcon, Image2 as Image, ImagePlaceholderIcon, InformationIcon, Input, InputMention, InputNumber_default as InputNumber, Label2 as Label, LookupSelect, MailIcon, MainListContainer_default as MainListContainer, ManIcon, ManagementIcon, MenuIcon, MessageIcon, MessageIconInverse, MessageSquareIcon, MonthPicker2 as MonthPicker, navbar_default as Navbar, NotFoundIcon, OutlineArrowIcon, PlusIcon, PlusSearchIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PowerIcon, PreventPageLeave_default as PreventPageLeave, QuestionIcon, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, RightPanelContainer_default as RightPanelContainer, RoleIcon, SearchIcon, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, SetupIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, SuiCalendarIcon, SuiCalendarIcon2, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, TabSelect, Table, TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableOfContents, TableRow, TagListViewIcon, TextArea, TimePicker, ToolBoxIcon, Tooltip2 as Tooltip, TooltipArrow, TooltipContent2 as TooltipContent, TooltipProvider2 as TooltipProvider, TooltipTrigger2 as TooltipTrigger, TransferUserRightsIcon, TrashIcon, truncated_default as Truncated, truncatedMouseEnterDiv_default as TruncatedMouseEnterDiv, ui_exports as UI, UserActiveIcon, UserAloneIcon, UserFriendIcon, UserGroupIcon, UserIcon, UserInactiveIcon, UserNameIcon, UserProtectIcon, UsersIcon, VirtualizedCommand_default as VirtualizedCommand, WorkFlowIcon, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, resetVisibleTableState, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, useBindRef_default as useBindRef, useCarousel, useControllableState_default as useControllableState, useDraftGuardStore, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useIsomorphicLayoutEffect, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useSafeBlocker, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated, validateTokenPrefixes };
16856
17373
  //# sourceMappingURL=index.mjs.map
16857
17374
  //# sourceMappingURL=index.mjs.map