@uniformdev/design-system 19.25.0 → 19.26.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/esm/index.js CHANGED
@@ -12488,47 +12488,52 @@ var summaryIconVisiblyHidden = css38`
12488
12488
 
12489
12489
  // src/components/Details/Details.tsx
12490
12490
  import { jsx as jsx38, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
12491
- var Details = ({ summary: summary2, children, isOpenByDefault = false, ...props }) => {
12491
+ var Details = ({
12492
+ summary: summary2,
12493
+ children,
12494
+ isOpenByDefault = false,
12495
+ isOpen,
12496
+ onChange,
12497
+ ...props
12498
+ }) => {
12492
12499
  const detailsRef = React9.useRef(null);
12493
- const [open, setOpen] = React9.useState(isOpenByDefault);
12494
- React9.useEffect(() => {
12495
- var _a;
12496
- if (!detailsRef) {
12497
- return;
12500
+ const [internalOpen, setInternalOpen] = React9.useState(isOpenByDefault);
12501
+ const memoizedIsOpen = React9.useMemo(() => {
12502
+ return isOpen !== void 0 ? isOpen : internalOpen;
12503
+ }, [internalOpen, isOpen]);
12504
+ return /* @__PURE__ */ jsxs21(
12505
+ "details",
12506
+ {
12507
+ "data-testid": "details",
12508
+ onToggle: (e) => {
12509
+ setInternalOpen(e.currentTarget.open);
12510
+ onChange == null ? void 0 : onChange(e.currentTarget.open);
12511
+ },
12512
+ css: details,
12513
+ open: memoizedIsOpen,
12514
+ ref: detailsRef,
12515
+ ...props,
12516
+ children: [
12517
+ /* @__PURE__ */ jsxs21("summary", { "data-testid": "summary", css: summary, children: [
12518
+ /* @__PURE__ */ jsx38(
12519
+ Icon,
12520
+ {
12521
+ css: [!children ? summaryIconVisiblyHidden : void 0, summaryIcon],
12522
+ icon: "chevron-down",
12523
+ iconColor: "currentColor",
12524
+ size: "1.25rem"
12525
+ }
12526
+ ),
12527
+ summary2
12528
+ ] }),
12529
+ memoizedIsOpen ? /* @__PURE__ */ jsx38("div", { "data-testid": "details-content", css: detailsContent, children }) : null
12530
+ ]
12498
12531
  }
12499
- const toggleEvent = () => {
12500
- var _a2;
12501
- const toggle = Boolean((_a2 = detailsRef == null ? void 0 : detailsRef.current) == null ? void 0 : _a2.open);
12502
- setOpen(toggle);
12503
- };
12504
- (_a = detailsRef.current) == null ? void 0 : _a.addEventListener("toggle", toggleEvent);
12505
- () => {
12506
- var _a2;
12507
- return (_a2 = detailsRef.current) == null ? void 0 : _a2.removeEventListener("toggle", toggleEvent);
12508
- };
12509
- }, [detailsRef]);
12510
- React9.useEffect(() => {
12511
- setOpen(isOpenByDefault);
12512
- }, [isOpenByDefault]);
12513
- return /* @__PURE__ */ jsxs21("details", { "data-testid": "details", css: details, open, ref: detailsRef, ...props, children: [
12514
- /* @__PURE__ */ jsxs21("summary", { "data-testid": "summary", css: summary, children: [
12515
- /* @__PURE__ */ jsx38(
12516
- Icon,
12517
- {
12518
- css: [!children ? summaryIconVisiblyHidden : void 0, summaryIcon],
12519
- icon: "chevron-down",
12520
- iconColor: "currentColor",
12521
- size: "1.25rem"
12522
- }
12523
- ),
12524
- summary2
12525
- ] }),
12526
- open ? /* @__PURE__ */ jsx38("div", { "data-testid": "details-content", css: detailsContent, children }) : null
12527
- ] });
12532
+ );
12528
12533
  };
12529
12534
 
12530
12535
  // src/components/Drawer/Drawer.tsx
12531
- import React12, { useEffect as useEffect6, useMemo, useRef as useRef2 } from "react";
12536
+ import React12, { useEffect as useEffect5, useMemo as useMemo2, useRef as useRef2 } from "react";
12532
12537
  import { CgChevronRight } from "react-icons/cg";
12533
12538
 
12534
12539
  // src/components/Drawer/Drawer.styles.ts
@@ -12804,7 +12809,7 @@ var DrawerInner = ({
12804
12809
  }) => {
12805
12810
  const { registerDrawer, unregisterDrawer } = useDrawer();
12806
12811
  const closeButtonRef = useRef2(null);
12807
- const component = useMemo(() => {
12812
+ const component = useMemo2(() => {
12808
12813
  const headerId = `dialog-header-${stackId}-${id}`;
12809
12814
  return /* @__PURE__ */ jsxs23(
12810
12815
  "div",
@@ -12845,7 +12850,7 @@ var DrawerInner = ({
12845
12850
  }
12846
12851
  );
12847
12852
  }, [children, header, id, stackId, bgColor, onRequestClose, ref, testId]);
12848
- useEffect6(() => {
12853
+ useEffect5(() => {
12849
12854
  registerDrawer({
12850
12855
  drawer: {
12851
12856
  id,
@@ -12864,7 +12869,7 @@ var DrawerInner = ({
12864
12869
  }
12865
12870
  });
12866
12871
  }, [component, instanceKey, registerDrawer]);
12867
- useEffect6(() => {
12872
+ useEffect5(() => {
12868
12873
  return () => unregisterDrawer({ id, stackId, instanceKey });
12869
12874
  }, [id, stackId, instanceKey, unregisterDrawer]);
12870
12875
  return null;
@@ -14072,7 +14077,7 @@ var LoadingIndicator = ({ ...props }) => {
14072
14077
  };
14073
14078
 
14074
14079
  // src/components/LoadingOverlay/LoadingOverlay.tsx
14075
- import { useCallback as useCallback2, useEffect as useEffect7, useRef as useRef4 } from "react";
14080
+ import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef4 } from "react";
14076
14081
 
14077
14082
  // src/components/LoadingOverlay/LoadingOverlay.styles.ts
14078
14083
  import { css as css55 } from "@emotion/react";
@@ -14125,7 +14130,7 @@ var LoadingOverlay = ({
14125
14130
  (_c = lottieRef.current) == null ? void 0 : _c.stop();
14126
14131
  }
14127
14132
  }, [isPaused]);
14128
- useEffect7(() => {
14133
+ useEffect6(() => {
14129
14134
  var _a, _b, _c, _d, _e, _f;
14130
14135
  if (!isPaused && ((_b = (_a = lottieRef.current) == null ? void 0 : _a.animationItem) == null ? void 0 : _b.isPaused)) {
14131
14136
  (_c = lottieRef.current) == null ? void 0 : _c.play();
@@ -14454,7 +14459,7 @@ var EditTeamIntegrationTile = ({
14454
14459
 
14455
14460
  // src/components/Tiles/IntegrationComingSoon.tsx
14456
14461
  import { css as css58 } from "@emotion/react";
14457
- import { useEffect as useEffect8, useState as useState6 } from "react";
14462
+ import { useEffect as useEffect7, useState as useState6 } from "react";
14458
14463
  import { CgHeart } from "react-icons/cg";
14459
14464
  import { jsx as jsx70, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
14460
14465
  var IntegrationComingSoon = ({
@@ -14470,7 +14475,7 @@ var IntegrationComingSoon = ({
14470
14475
  setUpVote((prev) => !prev);
14471
14476
  onUpVoteClick();
14472
14477
  };
14473
- useEffect8(() => {
14478
+ useEffect7(() => {
14474
14479
  if (upVote) {
14475
14480
  const timer = setTimeout(() => setUpVote(false), timing);
14476
14481
  return () => {
@@ -15317,7 +15322,7 @@ var ParameterGroup = forwardRef8(
15317
15322
  );
15318
15323
 
15319
15324
  // src/components/ParameterInputs/ParameterImage.tsx
15320
- import { forwardRef as forwardRef10, useCallback as useCallback3, useDeferredValue, useEffect as useEffect9, useState as useState8 } from "react";
15325
+ import { forwardRef as forwardRef10, useCallback as useCallback3, useDeferredValue, useEffect as useEffect8, useState as useState8 } from "react";
15321
15326
 
15322
15327
  // src/components/ParameterInputs/ParameterShell.tsx
15323
15328
  import { useState as useState7 } from "react";
@@ -15559,7 +15564,7 @@ var ParameterImageInner = forwardRef10(
15559
15564
  handleManuallySetErrorMessage(errorText);
15560
15565
  }
15561
15566
  };
15562
- useEffect9(() => {
15567
+ useEffect8(() => {
15563
15568
  updateImageSrc();
15564
15569
  }, [deferredValue]);
15565
15570
  return /* @__PURE__ */ jsxs56(Fragment11, { children: [
@@ -15878,7 +15883,7 @@ var getLabelForElement = (type) => {
15878
15883
  // src/components/ParameterInputs/ParameterRichText.tsx
15879
15884
  import { deepEqual as deepEqual2 } from "fast-equals";
15880
15885
  import { ParagraphNode } from "lexical";
15881
- import { useEffect as useEffect13, useRef as useRef6 } from "react";
15886
+ import { useEffect as useEffect12, useRef as useRef6 } from "react";
15882
15887
 
15883
15888
  // src/components/ParameterInputs/rich-text/editorStyles.ts
15884
15889
  import { css as css71 } from "@emotion/css";
@@ -16072,7 +16077,7 @@ import {
16072
16077
  ElementNode as ElementNode2,
16073
16078
  FOCUS_COMMAND
16074
16079
  } from "lexical";
16075
- import { useCallback as useCallback4, useEffect as useEffect10, useRef as useRef5, useState as useState9 } from "react";
16080
+ import { useCallback as useCallback4, useEffect as useEffect9, useRef as useRef5, useState as useState9 } from "react";
16076
16081
 
16077
16082
  // src/components/Popover/Popover.styles.ts
16078
16083
  import { css as css72 } from "@emotion/react";
@@ -16332,6 +16337,26 @@ function removeLinkNode(node) {
16332
16337
  }
16333
16338
  node.remove();
16334
16339
  }
16340
+ function removeLinkNodeFromSelection() {
16341
+ const selection = $getSelection();
16342
+ if (!$isRangeSelection(selection)) {
16343
+ return;
16344
+ }
16345
+ const nodes = selection.extract();
16346
+ const linkNodesFound = /* @__PURE__ */ new Set();
16347
+ for (const node of nodes) {
16348
+ if ($isElementNode2(node) && !node.isInline()) {
16349
+ continue;
16350
+ }
16351
+ const linkNodeAncestor = getLinkAncestor(node);
16352
+ if (linkNodeAncestor) {
16353
+ linkNodesFound.add(linkNodeAncestor);
16354
+ }
16355
+ }
16356
+ for (const node of linkNodesFound) {
16357
+ removeLinkNode(node);
16358
+ }
16359
+ }
16335
16360
  function upsertLinkNode(props) {
16336
16361
  var _a, _b, _c, _d, _e;
16337
16362
  const selection = $getSelection();
@@ -16389,6 +16414,7 @@ function upsertLinkNode(props) {
16389
16414
  }
16390
16415
  }
16391
16416
  }
16417
+ var REMOVE_LINK_NODE_COMMAND = createCommand("REMOVE_LINK_NODE_COMMAND");
16392
16418
  var UPSERT_LINK_NODE_COMMAND = createCommand("UPSERT_LINK_NODE_COMMAND");
16393
16419
  var OPEN_LINK_NODE_MODAL_COMMAND = createCommand(
16394
16420
  "OPEN_LINK_NODE_MODAL_COMMAND"
@@ -16414,13 +16440,13 @@ function LinkNodePlugin({ onConnectLink }) {
16414
16440
  const linkPopoverElRef = useRef5(null);
16415
16441
  const [isEditorFocused, setIsEditorFocused] = useState9(false);
16416
16442
  const [isLinkPopoverFocused, setIsLinkPopoverFocused] = useState9(false);
16417
- useEffect10(() => {
16443
+ useEffect9(() => {
16418
16444
  if (!isEditorFocused && !isLinkPopoverFocused) {
16419
16445
  setLinkPopoverState(void 0);
16420
16446
  return;
16421
16447
  }
16422
16448
  }, [isEditorFocused, isLinkPopoverFocused]);
16423
- useEffect10(() => {
16449
+ useEffect9(() => {
16424
16450
  if (!editor.hasNodes([LinkNode])) {
16425
16451
  throw new Error("LinkNode not registered on editor");
16426
16452
  }
@@ -16433,6 +16459,14 @@ function LinkNodePlugin({ onConnectLink }) {
16433
16459
  },
16434
16460
  COMMAND_PRIORITY_EDITOR
16435
16461
  ),
16462
+ editor.registerCommand(
16463
+ REMOVE_LINK_NODE_COMMAND,
16464
+ () => {
16465
+ removeLinkNodeFromSelection();
16466
+ return true;
16467
+ },
16468
+ COMMAND_PRIORITY_EDITOR
16469
+ ),
16436
16470
  editor.registerCommand(
16437
16471
  OPEN_LINK_NODE_MODAL_COMMAND,
16438
16472
  () => {
@@ -16513,7 +16547,7 @@ function LinkNodePlugin({ onConnectLink }) {
16513
16547
  }
16514
16548
  });
16515
16549
  }, [editor]);
16516
- useEffect10(() => {
16550
+ useEffect9(() => {
16517
16551
  return editor.registerUpdateListener(({ editorState }) => {
16518
16552
  requestAnimationFrame(() => {
16519
16553
  editorState.read(() => {
@@ -16603,7 +16637,7 @@ import {
16603
16637
  COMMAND_PRIORITY_CRITICAL,
16604
16638
  INDENT_CONTENT_COMMAND
16605
16639
  } from "lexical";
16606
- import { useEffect as useEffect11 } from "react";
16640
+ import { useEffect as useEffect10 } from "react";
16607
16641
  import { jsx as jsx91 } from "@emotion/react/jsx-runtime";
16608
16642
  function isIndentPermitted(maxDepth) {
16609
16643
  const selection = $getSelection2();
@@ -16627,7 +16661,7 @@ function isIndentPermitted(maxDepth) {
16627
16661
  }
16628
16662
  function ListIndentPlugin({ maxDepth }) {
16629
16663
  const [editor] = useLexicalComposerContext2();
16630
- useEffect11(() => {
16664
+ useEffect10(() => {
16631
16665
  return editor.registerCommand(
16632
16666
  INDENT_CONTENT_COMMAND,
16633
16667
  () => !isIndentPermitted(maxDepth),
@@ -16648,30 +16682,19 @@ import {
16648
16682
  REMOVE_LIST_COMMAND
16649
16683
  } from "@lexical/list";
16650
16684
  import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
16651
- import { $isDecoratorBlockNode } from "@lexical/react/LexicalDecoratorBlockNode";
16652
- import {
16653
- $createHeadingNode,
16654
- $createQuoteNode,
16655
- $isHeadingNode,
16656
- $isQuoteNode
16657
- } from "@lexical/rich-text";
16685
+ import { $createHeadingNode, $createQuoteNode, $isHeadingNode } from "@lexical/rich-text";
16658
16686
  import { $setBlocksType } from "@lexical/selection";
16659
- import {
16660
- $findMatchingParent,
16661
- $getNearestBlockElementAncestorOrThrow,
16662
- $getNearestNodeOfType
16663
- } from "@lexical/utils";
16687
+ import { $findMatchingParent, $getNearestNodeOfType } from "@lexical/utils";
16664
16688
  import {
16665
16689
  $createParagraphNode,
16666
16690
  $getSelection as $getSelection3,
16667
16691
  $isRangeSelection as $isRangeSelection3,
16668
16692
  $isRootOrShadowRoot,
16669
- $isTextNode,
16670
16693
  COMMAND_PRIORITY_CRITICAL as COMMAND_PRIORITY_CRITICAL2,
16671
16694
  FORMAT_TEXT_COMMAND,
16672
16695
  SELECTION_CHANGE_COMMAND
16673
16696
  } from "lexical";
16674
- import { useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo2, useState as useState10 } from "react";
16697
+ import { useCallback as useCallback5, useEffect as useEffect11, useMemo as useMemo3, useState as useState10 } from "react";
16675
16698
  import { Fragment as Fragment14, jsx as jsx92, jsxs as jsxs60 } from "@emotion/react/jsx-runtime";
16676
16699
  var toolbar = css74`
16677
16700
  background: var(--gray-50);
@@ -16726,40 +16749,35 @@ var toolbarChevron = css74`
16726
16749
  var ToolbarIcon = ({ icon }) => {
16727
16750
  return /* @__PURE__ */ jsx92(Icon, { icon, css: toolbarIcon, size: "1rem" });
16728
16751
  };
16752
+ var FORMATS_WITH_ICON = /* @__PURE__ */ new Map([
16753
+ ["bold", "format-bold"],
16754
+ ["italic", "format-italic"],
16755
+ ["underline", "format-underline"],
16756
+ ["strikethrough", "format-strike"],
16757
+ ["code", "format-code"],
16758
+ ["superscript", "format-superscript"],
16759
+ ["subscript", "format-subscript"]
16760
+ ]);
16761
+ var HEADING_ELEMENTS = ["h1", "h2", "h3", "h4", "h5", "h6"];
16762
+ var TEXTUAL_ELEMENTS = HEADING_ELEMENTS;
16729
16763
  var RichTextToolbar = ({ config }) => {
16730
16764
  const [editor] = useLexicalComposerContext3();
16731
- const enabledBuiltInFormats = richTextBuiltInFormats.filter(
16732
- (format) => {
16733
- var _a, _b;
16734
- return (_b = (_a = config == null ? void 0 : config.formatting) == null ? void 0 : _a.builtIn) == null ? void 0 : _b.includes(format.type);
16735
- }
16736
- );
16737
- const enabledBuiltInElements = richTextBuiltInElements.filter(
16738
- (element) => {
16739
- var _a, _b;
16740
- return (_b = (_a = config == null ? void 0 : config.elements) == null ? void 0 : _a.builtIn) == null ? void 0 : _b.includes(element.type);
16741
- }
16742
- );
16743
- const formatsWithIcon = /* @__PURE__ */ new Map([
16744
- ["bold", "format-bold"],
16745
- ["italic", "format-italic"],
16746
- ["underline", "format-underline"],
16747
- ["strikethrough", "format-strike"],
16748
- ["code", "format-code"],
16749
- ["superscript", "format-superscript"],
16750
- ["subscript", "format-subscript"]
16751
- ]);
16752
- const enabledBuiltInFormatsWithIcon = enabledBuiltInFormats.filter(
16753
- (format) => formatsWithIcon.has(format.type)
16754
- );
16755
- const enabledBuiltInFormatsWithoutIcon = enabledBuiltInFormats.filter(
16756
- (format) => !formatsWithIcon.has(format.type)
16757
- );
16758
- const [activeFormats, setActiveFormats] = useState10([]);
16759
- const [activeElement, setActiveElement] = useState10("paragraph");
16760
- const enabledTextualElements = enabledBuiltInElements.filter(
16761
- (element) => ["h1", "h2", "h3", "h4", "h5", "h6"].includes(element.type)
16762
- );
16765
+ const {
16766
+ activeElement,
16767
+ setActiveElement,
16768
+ activeFormats,
16769
+ setActiveFormats,
16770
+ visibleFormatsWithIcon,
16771
+ visibleFormatsWithoutIcon,
16772
+ visibleTextualElements,
16773
+ isLink,
16774
+ setIsLink,
16775
+ linkElementVisible,
16776
+ visibleLists,
16777
+ codeElementVisible,
16778
+ quoteElementVisible,
16779
+ visibleElementsWithIcons
16780
+ } = useRichTextToolbarState({ config });
16763
16781
  const onSelectElement = (type) => {
16764
16782
  if (activeElement === type) {
16765
16783
  return;
@@ -16769,7 +16787,7 @@ var RichTextToolbar = ({ config }) => {
16769
16787
  if (!$isRangeSelection3(selection)) {
16770
16788
  return;
16771
16789
  }
16772
- if (["h1", "h2", "h3", "h4", "h5", "h6"].includes(type)) {
16790
+ if (HEADING_ELEMENTS.includes(type)) {
16773
16791
  $setBlocksType(selection, () => $createHeadingNode(type));
16774
16792
  } else if (type === "paragraph") {
16775
16793
  $setBlocksType(selection, () => $createParagraphNode());
@@ -16780,28 +16798,13 @@ var RichTextToolbar = ({ config }) => {
16780
16798
  }
16781
16799
  });
16782
16800
  };
16783
- const [isLink, setIsLink] = useState10(false);
16784
- const linkElementEnabled = useMemo2(() => {
16785
- return enabledBuiltInElements.some((element) => element.type === "link");
16786
- }, [enabledBuiltInElements]);
16787
- const enabledLists = useMemo2(() => {
16788
- return new Set(
16789
- enabledBuiltInElements.filter((element) => ["orderedList", "unorderedList"].includes(element.type)).map((element) => element.type)
16790
- );
16791
- }, [enabledBuiltInElements]);
16792
- const quoteElementEnabled = useMemo2(() => {
16793
- return enabledBuiltInElements.some((element) => element.type === "quote");
16794
- }, [enabledBuiltInElements]);
16795
- const codeElementEnabled = useMemo2(() => {
16796
- return enabledBuiltInElements.some((element) => element.type === "code");
16797
- }, [enabledBuiltInElements]);
16798
16801
  const updateToolbar = useCallback5(() => {
16799
16802
  const selection = $getSelection3();
16800
16803
  if (!$isRangeSelection3(selection)) {
16801
16804
  return;
16802
16805
  }
16803
16806
  const newActiveFormats = [];
16804
- for (const format of enabledBuiltInFormats) {
16807
+ for (const format of richTextBuiltInFormats) {
16805
16808
  if (selection.hasFormat(format.type)) {
16806
16809
  newActiveFormats.push(format.type);
16807
16810
  }
@@ -16833,8 +16836,8 @@ var RichTextToolbar = ({ config }) => {
16833
16836
  } else {
16834
16837
  setIsLink(false);
16835
16838
  }
16836
- }, [editor, enabledBuiltInFormats]);
16837
- useEffect12(() => {
16839
+ }, [editor, setActiveElement, setActiveFormats, setIsLink]);
16840
+ useEffect11(() => {
16838
16841
  return editor.registerCommand(
16839
16842
  SELECTION_CHANGE_COMMAND,
16840
16843
  (_payload) => {
@@ -16844,7 +16847,7 @@ var RichTextToolbar = ({ config }) => {
16844
16847
  COMMAND_PRIORITY_CRITICAL2
16845
16848
  );
16846
16849
  }, [editor, updateToolbar]);
16847
- useEffect12(() => {
16850
+ useEffect11(() => {
16848
16851
  return editor.registerUpdateListener(({ editorState }) => {
16849
16852
  requestAnimationFrame(() => {
16850
16853
  editorState.read(() => {
@@ -16853,103 +16856,56 @@ var RichTextToolbar = ({ config }) => {
16853
16856
  });
16854
16857
  });
16855
16858
  }, [editor, updateToolbar]);
16856
- const clearFormatting2 = useCallback5(() => {
16857
- editor.update(() => {
16858
- const selection = $getSelection3();
16859
- if ($isRangeSelection3(selection)) {
16860
- const anchor = selection.anchor;
16861
- const focus = selection.focus;
16862
- const nodes = selection.getNodes();
16863
- if (anchor.key === focus.key && anchor.offset === focus.offset) {
16864
- return;
16865
- }
16866
- nodes.forEach((node, idx) => {
16867
- if ($isTextNode(node)) {
16868
- if (idx === 0 && anchor.offset !== 0) {
16869
- node = node.splitText(anchor.offset)[1] || node;
16870
- }
16871
- if (idx === nodes.length - 1) {
16872
- node = node.splitText(focus.offset)[0] || node;
16873
- }
16874
- if (node.__style !== "") {
16875
- node.setStyle("");
16876
- }
16877
- if (node.__format !== 0) {
16878
- node.setFormat(0);
16879
- $getNearestBlockElementAncestorOrThrow(node).setFormat("");
16880
- }
16881
- } else if ($isHeadingNode(node) || $isQuoteNode(node)) {
16882
- node.replace($createParagraphNode(), true);
16883
- } else if ($isDecoratorBlockNode(node)) {
16884
- node.setFormat("");
16885
- }
16886
- });
16887
- }
16888
- updateToolbar();
16889
- });
16890
- }, [editor, updateToolbar]);
16891
- const elementsThatShouldBeVisibleInDropdown = useMemo2(() => {
16892
- if (activeElement === "paragraph") {
16893
- return enabledTextualElements;
16894
- }
16895
- if (enabledBuiltInElements.some((element) => element.type === activeElement)) {
16896
- return enabledTextualElements;
16897
- }
16898
- return [
16899
- ...enabledTextualElements,
16900
- {
16901
- label: getLabelForElement(activeElement),
16902
- type: activeElement
16903
- }
16904
- ];
16905
- }, [enabledBuiltInElements, enabledTextualElements, activeElement]);
16906
16859
  return /* @__PURE__ */ jsxs60("div", { css: toolbar, children: [
16907
- elementsThatShouldBeVisibleInDropdown.length > 0 ? /* @__PURE__ */ jsx92(
16860
+ /* @__PURE__ */ jsxs60(
16908
16861
  Menu,
16909
16862
  {
16910
16863
  menuLabel: "Elements",
16911
- menuTrigger: /* @__PURE__ */ jsxs60("button", { css: toolbarButton, title: "Text formatting", children: [
16912
- elementsThatShouldBeVisibleInDropdown.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
16864
+ menuTrigger: /* @__PURE__ */ jsxs60("button", { css: toolbarButton, title: "Text styles", children: [
16865
+ visibleTextualElements.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
16913
16866
  " ",
16914
16867
  /* @__PURE__ */ jsx92(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
16915
16868
  ] }),
16916
16869
  placement: "bottom-start",
16917
16870
  children: [
16918
- {
16919
- label: "Normal",
16920
- type: "paragraph"
16921
- },
16922
- ...elementsThatShouldBeVisibleInDropdown
16923
- ].map((element) => /* @__PURE__ */ jsx92(
16924
- MenuItem,
16925
- {
16926
- onClick: () => {
16927
- onSelectElement(element.type);
16871
+ [
16872
+ {
16873
+ label: "Normal",
16874
+ type: "paragraph"
16928
16875
  },
16929
- children: element.label
16930
- },
16931
- element.type
16932
- ))
16876
+ ...visibleTextualElements
16877
+ ].map((element) => /* @__PURE__ */ jsx92(
16878
+ MenuItem,
16879
+ {
16880
+ onClick: () => {
16881
+ onSelectElement(element.type);
16882
+ },
16883
+ children: element.label
16884
+ },
16885
+ element.type
16886
+ )),
16887
+ visibleTextualElements.length === 0 ? /* @__PURE__ */ jsx92(MenuItem, { disabled: true, children: "Alternative text styles are not available" }) : null
16888
+ ]
16933
16889
  }
16934
- ) : null,
16935
- enabledBuiltInFormatsWithIcon.length > 0 || enabledBuiltInFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ jsxs60("div", { css: toolbarGroup, children: [
16936
- enabledBuiltInFormatsWithIcon.map((format) => /* @__PURE__ */ jsx92(Tooltip, { title: format.label, placement: "top", children: /* @__PURE__ */ jsx92(
16890
+ ),
16891
+ visibleFormatsWithIcon.length > 0 || visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ jsxs60("div", { css: toolbarGroup, children: [
16892
+ visibleFormatsWithIcon.map((format) => /* @__PURE__ */ jsx92(Tooltip, { title: format.label, placement: "top", children: /* @__PURE__ */ jsx92(
16937
16893
  "button",
16938
16894
  {
16939
16895
  onClick: () => {
16940
16896
  editor.dispatchCommand(FORMAT_TEXT_COMMAND, format.type);
16941
16897
  },
16942
16898
  css: [toolbarButton, activeFormats.includes(format.type) ? toolbarButtonActive : null],
16943
- children: /* @__PURE__ */ jsx92(ToolbarIcon, { icon: formatsWithIcon.get(format.type) })
16899
+ children: /* @__PURE__ */ jsx92(ToolbarIcon, { icon: FORMATS_WITH_ICON.get(format.type) })
16944
16900
  }
16945
16901
  ) }, format.type)),
16946
- enabledBuiltInFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ jsx92(
16902
+ visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ jsx92(
16947
16903
  Menu,
16948
16904
  {
16949
- menuLabel: "Text formatting",
16950
- menuTrigger: /* @__PURE__ */ jsx92("button", { css: toolbarButton, title: "Text formatting", children: /* @__PURE__ */ jsx92(Icon, { icon: "more-alt", css: toolbarIcon }) }),
16905
+ menuLabel: "Alternative text styles",
16906
+ menuTrigger: /* @__PURE__ */ jsx92("button", { css: toolbarButton, title: "Alternative text styles", children: /* @__PURE__ */ jsx92(Icon, { icon: "more-alt", css: toolbarIcon }) }),
16951
16907
  placement: "bottom-start",
16952
- children: enabledBuiltInFormatsWithoutIcon.map((format) => /* @__PURE__ */ jsx92(
16908
+ children: visibleFormatsWithoutIcon.map((format) => /* @__PURE__ */ jsx92(
16953
16909
  MenuItem,
16954
16910
  {
16955
16911
  onClick: () => {
@@ -16962,19 +16918,19 @@ var RichTextToolbar = ({ config }) => {
16962
16918
  }
16963
16919
  ) : null
16964
16920
  ] }) : null,
16965
- linkElementEnabled || enabledLists.size > 0 || quoteElementEnabled || codeElementEnabled ? /* @__PURE__ */ jsxs60("div", { css: toolbarGroup, children: [
16966
- linkElementEnabled ? /* @__PURE__ */ jsx92(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ jsx92(
16921
+ visibleElementsWithIcons.size > 0 ? /* @__PURE__ */ jsxs60("div", { css: toolbarGroup, children: [
16922
+ linkElementVisible ? /* @__PURE__ */ jsx92(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ jsx92(
16967
16923
  "button",
16968
16924
  {
16969
16925
  onClick: () => {
16970
- editor.dispatchCommand(OPEN_LINK_NODE_MODAL_COMMAND, {});
16926
+ isLink ? editor.dispatchCommand(REMOVE_LINK_NODE_COMMAND, {}) : editor.dispatchCommand(OPEN_LINK_NODE_MODAL_COMMAND, {});
16971
16927
  },
16972
16928
  css: [toolbarButton, isLink ? toolbarButtonActive : null],
16973
16929
  children: /* @__PURE__ */ jsx92(ToolbarIcon, { icon: "link" })
16974
16930
  }
16975
16931
  ) }) : null,
16976
- enabledLists.size > 0 ? /* @__PURE__ */ jsxs60(Fragment14, { children: [
16977
- enabledLists.has("unorderedList") ? /* @__PURE__ */ jsx92(Tooltip, { title: "Bullet list", placement: "top", children: /* @__PURE__ */ jsx92(
16932
+ visibleLists.size > 0 ? /* @__PURE__ */ jsxs60(Fragment14, { children: [
16933
+ visibleLists.has("unorderedList") ? /* @__PURE__ */ jsx92(Tooltip, { title: "Bullet List", placement: "top", children: /* @__PURE__ */ jsx92(
16978
16934
  "button",
16979
16935
  {
16980
16936
  onClick: () => {
@@ -16984,7 +16940,7 @@ var RichTextToolbar = ({ config }) => {
16984
16940
  children: /* @__PURE__ */ jsx92(ToolbarIcon, { icon: "layout-list" })
16985
16941
  }
16986
16942
  ) }) : null,
16987
- enabledLists.has("orderedList") ? /* @__PURE__ */ jsx92(Tooltip, { title: "Numbered list", placement: "top", children: /* @__PURE__ */ jsx92(
16943
+ visibleLists.has("orderedList") ? /* @__PURE__ */ jsx92(Tooltip, { title: "Ordered List", placement: "top", children: /* @__PURE__ */ jsx92(
16988
16944
  "button",
16989
16945
  {
16990
16946
  onClick: () => {
@@ -16995,7 +16951,7 @@ var RichTextToolbar = ({ config }) => {
16995
16951
  }
16996
16952
  ) }) : null
16997
16953
  ] }) : null,
16998
- quoteElementEnabled ? /* @__PURE__ */ jsx92(Tooltip, { title: "Blockquote", placement: "top", children: /* @__PURE__ */ jsx92(
16954
+ quoteElementVisible ? /* @__PURE__ */ jsx92(Tooltip, { title: "Blockquote", placement: "top", children: /* @__PURE__ */ jsx92(
16999
16955
  "button",
17000
16956
  {
17001
16957
  onClick: () => {
@@ -17005,7 +16961,7 @@ var RichTextToolbar = ({ config }) => {
17005
16961
  children: /* @__PURE__ */ jsx92(ToolbarIcon, { icon: "quote" })
17006
16962
  }
17007
16963
  ) }) : null,
17008
- codeElementEnabled ? /* @__PURE__ */ jsx92(Tooltip, { title: "Code", placement: "top", children: /* @__PURE__ */ jsx92(
16964
+ codeElementVisible ? /* @__PURE__ */ jsx92(Tooltip, { title: "Code Block", placement: "top", children: /* @__PURE__ */ jsx92(
17009
16965
  "button",
17010
16966
  {
17011
16967
  onClick: () => {
@@ -17015,31 +16971,118 @@ var RichTextToolbar = ({ config }) => {
17015
16971
  children: /* @__PURE__ */ jsx92(ToolbarIcon, { icon: "code-slash" })
17016
16972
  }
17017
16973
  ) }) : null
17018
- ] }) : null,
17019
- /* @__PURE__ */ jsx92(
17020
- "div",
17021
- {
17022
- css: [
17023
- toolbarGroup,
17024
- {
17025
- marginLeft: "auto"
17026
- }
17027
- ],
17028
- children: /* @__PURE__ */ jsx92(Tooltip, { title: "Clear formatting", placement: "top", children: /* @__PURE__ */ jsx92(
17029
- "button",
17030
- {
17031
- onClick: () => {
17032
- clearFormatting2();
17033
- },
17034
- css: [toolbarButton],
17035
- children: /* @__PURE__ */ jsx92(ToolbarIcon, { icon: "clear-formatting" })
17036
- }
17037
- ) })
17038
- }
17039
- )
16974
+ ] }) : null
17040
16975
  ] });
17041
16976
  };
17042
16977
  var RichTextToolbar_default = RichTextToolbar;
16978
+ var useRichTextToolbarState = ({ config }) => {
16979
+ var _a;
16980
+ const enabledBuiltInFormats = useMemo3(() => {
16981
+ return richTextBuiltInFormats.filter((format) => {
16982
+ var _a2, _b;
16983
+ return (_b = (_a2 = config == null ? void 0 : config.formatting) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(format.type);
16984
+ });
16985
+ }, [config]);
16986
+ const enabledBuiltInElements = useMemo3(() => {
16987
+ return richTextBuiltInElements.filter((element) => {
16988
+ var _a2, _b;
16989
+ return (_b = (_a2 = config == null ? void 0 : config.elements) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(element.type);
16990
+ });
16991
+ }, [config]);
16992
+ const enabledBuiltInFormatsWithIcon = useMemo3(() => {
16993
+ return enabledBuiltInFormats.filter((format) => FORMATS_WITH_ICON.has(format.type));
16994
+ }, [enabledBuiltInFormats]);
16995
+ const enabledBuiltInFormatsWithoutIcon = enabledBuiltInFormats.filter(
16996
+ (format) => !FORMATS_WITH_ICON.has(format.type)
16997
+ );
16998
+ const [activeFormats, setActiveFormats] = useState10([]);
16999
+ const visibleFormatsWithIcon = useMemo3(() => {
17000
+ const visibleFormats = /* @__PURE__ */ new Set();
17001
+ activeFormats.filter((type) => FORMATS_WITH_ICON.has(type)).forEach((type) => {
17002
+ visibleFormats.add(type);
17003
+ });
17004
+ enabledBuiltInFormatsWithIcon.forEach((format) => {
17005
+ visibleFormats.add(format.type);
17006
+ });
17007
+ return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
17008
+ }, [activeFormats, enabledBuiltInFormatsWithIcon]);
17009
+ const visibleFormatsWithoutIcon = useMemo3(() => {
17010
+ const visibleFormats = /* @__PURE__ */ new Set();
17011
+ activeFormats.filter((type) => !FORMATS_WITH_ICON.has(type)).forEach((type) => {
17012
+ visibleFormats.add(type);
17013
+ });
17014
+ enabledBuiltInFormatsWithoutIcon.forEach((format) => {
17015
+ visibleFormats.add(format.type);
17016
+ });
17017
+ return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
17018
+ }, [activeFormats, enabledBuiltInFormatsWithoutIcon]);
17019
+ const [activeElement, setActiveElement] = useState10("paragraph");
17020
+ const enabledTextualElements = enabledBuiltInElements.filter(
17021
+ (element) => TEXTUAL_ELEMENTS.includes(element.type)
17022
+ );
17023
+ const visibleTextualElements = useMemo3(() => {
17024
+ if (!TEXTUAL_ELEMENTS.includes(activeElement)) {
17025
+ return enabledTextualElements;
17026
+ }
17027
+ return richTextBuiltInElements.filter(
17028
+ (element) => {
17029
+ var _a2, _b;
17030
+ return TEXTUAL_ELEMENTS.includes(element.type) && (((_b = (_a2 = config == null ? void 0 : config.elements) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(element.type)) || element.type === activeElement);
17031
+ }
17032
+ );
17033
+ }, [activeElement, (_a = config == null ? void 0 : config.elements) == null ? void 0 : _a.builtIn, enabledTextualElements]);
17034
+ const [isLink, setIsLink] = useState10(false);
17035
+ const linkElementVisible = useMemo3(() => {
17036
+ return enabledBuiltInElements.some((element) => element.type === "link") || isLink;
17037
+ }, [isLink, enabledBuiltInElements]);
17038
+ const visibleLists = useMemo3(() => {
17039
+ return new Set(
17040
+ ["orderedList", "unorderedList"].filter(
17041
+ (type) => enabledBuiltInElements.some((element) => element.type === type) || activeElement === type
17042
+ )
17043
+ );
17044
+ }, [activeElement, enabledBuiltInElements]);
17045
+ const quoteElementVisible = useMemo3(() => {
17046
+ return enabledBuiltInElements.some((element) => element.type === "quote") || activeElement === "quote";
17047
+ }, [activeElement, enabledBuiltInElements]);
17048
+ const codeElementVisible = useMemo3(() => {
17049
+ return enabledBuiltInElements.some((element) => element.type === "code") || activeElement === "code";
17050
+ }, [activeElement, enabledBuiltInElements]);
17051
+ const visibleElementsWithIcons = useMemo3(() => {
17052
+ const visibleElements = /* @__PURE__ */ new Set();
17053
+ if (linkElementVisible) {
17054
+ visibleElements.add("link");
17055
+ }
17056
+ if (visibleLists.size > 0) {
17057
+ visibleLists.forEach((type) => {
17058
+ visibleElements.add(type);
17059
+ });
17060
+ }
17061
+ if (quoteElementVisible) {
17062
+ visibleElements.add("quote");
17063
+ }
17064
+ if (codeElementVisible) {
17065
+ visibleElements.add("code");
17066
+ }
17067
+ return visibleElements;
17068
+ }, [codeElementVisible, linkElementVisible, quoteElementVisible, visibleLists]);
17069
+ return {
17070
+ activeFormats,
17071
+ setActiveFormats,
17072
+ activeElement,
17073
+ setActiveElement,
17074
+ visibleFormatsWithIcon,
17075
+ visibleFormatsWithoutIcon,
17076
+ visibleTextualElements,
17077
+ isLink,
17078
+ setIsLink,
17079
+ linkElementVisible,
17080
+ visibleLists,
17081
+ quoteElementVisible,
17082
+ codeElementVisible,
17083
+ visibleElementsWithIcons
17084
+ };
17085
+ };
17043
17086
 
17044
17087
  // src/components/ParameterInputs/ParameterRichText.tsx
17045
17088
  import { Fragment as Fragment15, jsx as jsx93, jsxs as jsxs61 } from "@emotion/react/jsx-runtime";
@@ -17223,12 +17266,12 @@ var RichText = ({
17223
17266
  }) => {
17224
17267
  const editorContainerRef = useRef6(null);
17225
17268
  const [editor] = useLexicalComposerContext4();
17226
- useEffect13(() => {
17269
+ useEffect12(() => {
17227
17270
  if (onRichTextInit) {
17228
17271
  onRichTextInit(editor);
17229
17272
  }
17230
17273
  }, [editor, onRichTextInit]);
17231
- useEffect13(() => {
17274
+ useEffect12(() => {
17232
17275
  const removeUpdateListener = editor.registerUpdateListener(({ editorState, prevEditorState }) => {
17233
17276
  requestAnimationFrame(() => {
17234
17277
  if (!deepEqual2(editorState.toJSON(), prevEditorState.toJSON())) {
@@ -17360,7 +17403,7 @@ var Popover2 = ({
17360
17403
 
17361
17404
  // src/components/ProgressList/ProgressList.tsx
17362
17405
  import { css as css77 } from "@emotion/react";
17363
- import { useMemo as useMemo3 } from "react";
17406
+ import { useMemo as useMemo4 } from "react";
17364
17407
  import { CgCheckO as CgCheckO2, CgRadioCheck, CgRecord } from "react-icons/cg";
17365
17408
 
17366
17409
  // src/components/ProgressList/styles/ProgressList.styles.ts
@@ -17380,7 +17423,7 @@ var progressListItemStyles = css76`
17380
17423
  // src/components/ProgressList/ProgressList.tsx
17381
17424
  import { jsx as jsx98, jsxs as jsxs65 } from "@emotion/react/jsx-runtime";
17382
17425
  var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
17383
- const itemsWithStatus = useMemo3(() => {
17426
+ const itemsWithStatus = useMemo4(() => {
17384
17427
  const indexOfInProgressItem = items.findIndex(({ id }) => id === inProgressId);
17385
17428
  return items.map((item, index) => {
17386
17429
  let status = "queued";
@@ -17413,7 +17456,7 @@ var ProgressListItem = ({
17413
17456
  errorLevel = "danger",
17414
17457
  autoEllipsis = false
17415
17458
  }) => {
17416
- const Icon2 = useMemo3(() => {
17459
+ const Icon2 = useMemo4(() => {
17417
17460
  if (error) {
17418
17461
  return warningIcon;
17419
17462
  }
@@ -17424,7 +17467,7 @@ var ProgressListItem = ({
17424
17467
  };
17425
17468
  return iconPerStatus[status];
17426
17469
  }, [status, error]);
17427
- const statusStyles = useMemo3(() => {
17470
+ const statusStyles = useMemo4(() => {
17428
17471
  if (error) {
17429
17472
  return errorLevel === "caution" ? css77`
17430
17473
  color: rgb(161, 98, 7);
@@ -17462,7 +17505,7 @@ var ProgressListItem = ({
17462
17505
 
17463
17506
  // src/components/SegmentedControl/SegmentedControl.tsx
17464
17507
  import { css as css79 } from "@emotion/react";
17465
- import { useCallback as useCallback6, useMemo as useMemo4 } from "react";
17508
+ import { useCallback as useCallback6, useMemo as useMemo5 } from "react";
17466
17509
  import { CgCheck as CgCheck4 } from "react-icons/cg";
17467
17510
 
17468
17511
  // src/components/SegmentedControl/SegmentedControl.styles.ts
@@ -17577,7 +17620,7 @@ var SegmentedControl = ({
17577
17620
  },
17578
17621
  [options, onChange]
17579
17622
  );
17580
- const sizeStyles = useMemo4(() => {
17623
+ const sizeStyles = useMemo5(() => {
17581
17624
  const map = {
17582
17625
  sm: css79({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
17583
17626
  md: css79({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
@@ -17585,7 +17628,7 @@ var SegmentedControl = ({
17585
17628
  };
17586
17629
  return map[size];
17587
17630
  }, [size]);
17588
- const isIconOnly = useMemo4(() => {
17631
+ const isIconOnly = useMemo5(() => {
17589
17632
  return options.every((option) => option.icon && !option.label);
17590
17633
  }, [options]);
17591
17634
  return /* @__PURE__ */ jsx99(
@@ -17852,7 +17895,7 @@ var TableCellData = React21.forwardRef(
17852
17895
  );
17853
17896
 
17854
17897
  // src/components/Tabs/Tabs.tsx
17855
- import { createContext as createContext6, useContext as useContext7, useEffect as useEffect14, useMemo as useMemo5 } from "react";
17898
+ import { createContext as createContext6, useContext as useContext7, useEffect as useEffect13, useMemo as useMemo6 } from "react";
17856
17899
  import {
17857
17900
  Tab as ReakitTab,
17858
17901
  TabList as ReakitTabList,
@@ -17896,13 +17939,13 @@ var useCurrentTab = () => {
17896
17939
  return context;
17897
17940
  };
17898
17941
  var Tabs = ({ children, onSelectedIdChange, useHashForState, selectedId, ...props }) => {
17899
- const selected = useMemo5(() => {
17942
+ const selected = useMemo6(() => {
17900
17943
  if (selectedId)
17901
17944
  return selectedId;
17902
17945
  return useHashForState && typeof window !== "undefined" && window.location.hash ? window.location.hash.substring(1) : void 0;
17903
17946
  }, [selectedId, useHashForState]);
17904
17947
  const tab = useTabState({ ...props, selectedId: selected });
17905
- useEffect14(() => {
17948
+ useEffect13(() => {
17906
17949
  var _a;
17907
17950
  const selectedValueWithoutNull = (_a = tab.selectedId) != null ? _a : void 0;
17908
17951
  onSelectedIdChange == null ? void 0 : onSelectedIdChange(selectedValueWithoutNull);
@@ -17910,7 +17953,7 @@ var Tabs = ({ children, onSelectedIdChange, useHashForState, selectedId, ...prop
17910
17953
  window.location.hash = selectedValueWithoutNull != null ? selectedValueWithoutNull : "";
17911
17954
  }
17912
17955
  }, [tab.selectedId, onSelectedIdChange, useHashForState]);
17913
- useEffect14(() => {
17956
+ useEffect13(() => {
17914
17957
  if (selected && selected !== tab.selectedId) {
17915
17958
  tab.setSelectedId(selected);
17916
17959
  }