@uniformdev/design-system 19.186.4-alpha.4 → 19.187.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.js CHANGED
@@ -1676,6 +1676,7 @@ var Theme = ({ disableReset = false, disableGlobalReset = false }) => {
1676
1676
  --purple-rain-600: #6340a9;
1677
1677
 
1678
1678
  /* raspberry spectrum*/
1679
+ --raspberry-beret-50: #fefafc;
1679
1680
  --raspberry-beret-100: #ffbee1;
1680
1681
  --raspberry-beret-200: #ff94ce;
1681
1682
  --raspberry-beret-300: #ff6aba;
@@ -13510,6 +13511,9 @@ var avatarImageStyles = import_react27.css`
13510
13511
  height: 100%;
13511
13512
  object-fit: cover;
13512
13513
  `;
13514
+ var avatarSize2xsStyles = import_react27.css`
13515
+ width: 1rem;
13516
+ `;
13513
13517
  var avatarSizeXsStyles = import_react27.css`
13514
13518
  width: 1.5rem;
13515
13519
  `;
@@ -13523,20 +13527,26 @@ var avatarSizeLgStyles = import_react27.css`
13523
13527
  width: 3rem;
13524
13528
  `;
13525
13529
  var avatarSizeXlStyles = import_react27.css`
13526
- width: 3.5rem;
13530
+ width: 4rem;
13531
+ `;
13532
+ var avatarSize2xlStyles = import_react27.css`
13533
+ width: 5rem;
13527
13534
  `;
13528
13535
 
13529
13536
  // src/components/Avatar/Avatar.tsx
13530
13537
  var import_jsx_runtime19 = require("@emotion/react/jsx-runtime");
13531
13538
  var avatarSizeStylesMap = {
13539
+ "2xs": avatarSize2xsStyles,
13532
13540
  xs: avatarSizeXsStyles,
13533
13541
  sm: avatarSizeSmStyles,
13534
13542
  md: avatarSizeMdStyles,
13535
13543
  lg: avatarSizeLgStyles,
13536
- xl: avatarSizeXlStyles
13544
+ xl: avatarSizeXlStyles,
13545
+ "2xl": avatarSize2xlStyles
13537
13546
  };
13538
- var Avatar = ({ src, label = "", children, size = "md", ...props }) => {
13539
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tooltip, { title: label, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { css: [avatarStyles, avatarSizeStylesMap[size]], ...props, children: [
13547
+ var Avatar = ({ src, label = "", children, size = "md", as = "div", ...props }) => {
13548
+ const Element = as;
13549
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Tooltip, { title: label, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Element, { css: [avatarStyles, avatarSizeStylesMap[size]], ...props, children: [
13540
13550
  !src ? null : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", { role: "presentation", src, css: avatarImageStyles }),
13541
13551
  children
13542
13552
  ] }) });
@@ -14065,7 +14075,7 @@ var menuItem = (textTheme, forceActive) => import_react34.css`
14065
14075
  align-items: center;
14066
14076
  border-radius: var(--rounded-base);
14067
14077
  background: none;
14068
- color: ${textTheme === "base" ? "var(--typography-base)" : "var(--brand-secondary-5)"};
14078
+ color: ${textTheme === "base" ? "var(--typography-base)" : textTheme === "accent-alt" ? "var(--accent-alt-dark)" : "var(--brand-secondary-5)"};
14069
14079
  display: flex;
14070
14080
  padding: var(--spacing-3);
14071
14081
  font-weight: var(--fw-regular);
@@ -18203,6 +18213,7 @@ var DrawerContentInner = import_react85.css`
18203
18213
  height: 100%;
18204
18214
  overflow-y: auto;
18205
18215
  ${scrollbarStyles}
18216
+ border-radius: var(--rounded-base);
18206
18217
  `;
18207
18218
  var DrawerContentBtnGroup = import_react85.css`
18208
18219
  display: flex;
@@ -20018,10 +20029,10 @@ var loader = import_react111.css`
20018
20029
  display: inline-flex;
20019
20030
  justify-content: center;
20020
20031
  `;
20021
- function loadingDot(size) {
20032
+ function loadingDot(size, backgroundColor) {
20022
20033
  const dotSize = size === "lg" ? 8 : 4;
20023
20034
  return import_react111.css`
20024
- background-color: var(--gray-700);
20035
+ background-color: ${backgroundColor};
20025
20036
  display: block;
20026
20037
  border-radius: var(--rounded-full);
20027
20038
  animation: ${bounceFade(size)} 0.75s infinite ease-in-out;
@@ -20046,11 +20057,13 @@ function loadingDot(size) {
20046
20057
 
20047
20058
  // src/components/LoadingIndicator/LoadingIndicator.tsx
20048
20059
  var import_jsx_runtime98 = require("@emotion/react/jsx-runtime");
20049
- var LoadingIndicator = ({
20050
- size = "lg",
20051
- ...props
20052
- }) => {
20053
- const dotStyle = loadingDot(size);
20060
+ var cssColorMap = {
20061
+ gray: "var(--gray-700)",
20062
+ "accent-alt": "var(--accent-alt-dark)"
20063
+ };
20064
+ var LoadingIndicator = ({ size = "lg", color = "gray", ...props }) => {
20065
+ const cssColor = cssColorMap[color];
20066
+ const dotStyle = loadingDot(size, cssColor);
20054
20067
  return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { role: "alert", css: loader, "data-testid": "loading-indicator", ...props, children: [
20055
20068
  /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { css: dotStyle }),
20056
20069
  /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { css: dotStyle }),
@@ -22292,11 +22305,11 @@ var ParameterNameAndPublicIdInput = ({
22292
22305
 
22293
22306
  // src/components/ParameterInputs/ParameterRichText.tsx
22294
22307
  init_emotion_jsx_shim();
22295
- var import_react156 = require("@emotion/react");
22308
+ var import_react158 = require("@emotion/react");
22296
22309
  var import_list3 = require("@lexical/list");
22297
22310
  var import_markdown = require("@lexical/markdown");
22298
22311
  var import_LexicalComposer = require("@lexical/react/LexicalComposer");
22299
- var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
22312
+ var import_LexicalComposerContext9 = require("@lexical/react/LexicalComposerContext");
22300
22313
  var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
22301
22314
  var import_LexicalErrorBoundary = __toESM(require("@lexical/react/LexicalErrorBoundary"));
22302
22315
  var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
@@ -22309,6 +22322,12 @@ var import_table5 = require("@lexical/table");
22309
22322
 
22310
22323
  // ../richtext/dist/index.mjs
22311
22324
  init_emotion_jsx_shim();
22325
+ function isRichTextNode(node) {
22326
+ return !!node && typeof node === "object" && "type" in node;
22327
+ }
22328
+ function isRichTextNodeType(node, type) {
22329
+ return isRichTextNode(node) && node.type === type;
22330
+ }
22312
22331
  var richTextBuiltInElements = [
22313
22332
  {
22314
22333
  label: "Heading 1",
@@ -22358,6 +22377,10 @@ var richTextBuiltInElements = [
22358
22377
  label: "Table",
22359
22378
  type: "table"
22360
22379
  },
22380
+ {
22381
+ label: "Asset",
22382
+ type: "asset"
22383
+ },
22361
22384
  {
22362
22385
  label: "Dynamic Token",
22363
22386
  type: "variable"
@@ -22404,8 +22427,8 @@ var getLabelForElement = (type) => {
22404
22427
 
22405
22428
  // src/components/ParameterInputs/ParameterRichText.tsx
22406
22429
  var import_fast_equals2 = require("fast-equals");
22407
- var import_lexical9 = require("lexical");
22408
- var import_react157 = require("react");
22430
+ var import_lexical10 = require("lexical");
22431
+ var import_react159 = require("react");
22409
22432
 
22410
22433
  // src/components/ParameterInputs/rich-text/CustomCodeNode.ts
22411
22434
  init_emotion_jsx_shim();
@@ -22687,20 +22710,75 @@ var tableHeaderElement = import_css2.css`
22687
22710
  width: 7rem;
22688
22711
  `;
22689
22712
 
22690
- // src/components/ParameterInputs/rich-text/LinkNodePlugin.tsx
22713
+ // src/components/ParameterInputs/rich-text/ImprovedAssetSelectionPlugin.tsx
22691
22714
  init_emotion_jsx_shim();
22692
- var import_react146 = require("@emotion/react");
22693
22715
  var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerContext");
22694
- var import_LexicalNodeEventPlugin = require("@lexical/react/LexicalNodeEventPlugin");
22695
22716
  var import_utils6 = require("@lexical/utils");
22717
+ var import_lexical2 = require("lexical");
22718
+ var import_react146 = require("react");
22719
+ var ImprovedAssetSelectionPlugin = () => {
22720
+ const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
22721
+ (0, import_react146.useEffect)(() => {
22722
+ editor.getRootElement();
22723
+ const onRootClick = (event) => {
22724
+ if (event.target !== editor.getRootElement()) {
22725
+ return;
22726
+ }
22727
+ const clickArea = event.offsetY <= 60 ? "top" : "bottom";
22728
+ const state = editor.getEditorState().toJSON();
22729
+ const firstNode = state.root.children[0];
22730
+ const lastNode = state.root.children.at(-1);
22731
+ if (isRichTextNodeType(firstNode, "asset") && clickArea === "top") {
22732
+ editor.update(() => {
22733
+ (0, import_utils6.$insertFirst)((0, import_lexical2.$getRoot)(), (0, import_lexical2.$createParagraphNode)());
22734
+ requestAnimationFrame(() => {
22735
+ var _a, _b;
22736
+ (_b = (_a = editor.getRootElement()) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.scrollTo({
22737
+ top: 0,
22738
+ behavior: "instant"
22739
+ });
22740
+ });
22741
+ });
22742
+ } else if (isRichTextNodeType(lastNode, "asset") && clickArea === "bottom") {
22743
+ editor.update(() => {
22744
+ (0, import_lexical2.$getRoot)().selectEnd();
22745
+ (0, import_lexical2.$insertNodes)([(0, import_lexical2.$createParagraphNode)()]);
22746
+ requestAnimationFrame(() => {
22747
+ var _a, _b, _c, _d;
22748
+ (_d = (_a = editor.getRootElement()) == null ? void 0 : _a.parentElement) == null ? void 0 : _d.scrollTo({
22749
+ top: (_c = (_b = editor.getRootElement()) == null ? void 0 : _b.parentElement) == null ? void 0 : _c.scrollHeight,
22750
+ behavior: "instant"
22751
+ });
22752
+ });
22753
+ });
22754
+ }
22755
+ };
22756
+ const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {
22757
+ rootElement == null ? void 0 : rootElement.addEventListener("click", onRootClick);
22758
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("click", onRootClick);
22759
+ });
22760
+ return () => {
22761
+ removeRootListener();
22762
+ };
22763
+ }, [editor]);
22764
+ return null;
22765
+ };
22766
+ var ImprovedAssetSelectionPlugin_default = ImprovedAssetSelectionPlugin;
22767
+
22768
+ // src/components/ParameterInputs/rich-text/LinkNodePlugin.tsx
22769
+ init_emotion_jsx_shim();
22770
+ var import_react147 = require("@emotion/react");
22771
+ var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
22772
+ var import_LexicalNodeEventPlugin = require("@lexical/react/LexicalNodeEventPlugin");
22773
+ var import_utils7 = require("@lexical/utils");
22696
22774
  var import_fast_equals = require("fast-equals");
22697
- var import_lexical3 = require("lexical");
22698
- var import_react147 = require("react");
22775
+ var import_lexical4 = require("lexical");
22776
+ var import_react148 = require("react");
22699
22777
 
22700
22778
  // src/components/ParameterInputs/rich-text/utils.ts
22701
22779
  init_emotion_jsx_shim();
22702
22780
  var import_selection = require("@lexical/selection");
22703
- var import_lexical2 = require("lexical");
22781
+ var import_lexical3 = require("lexical");
22704
22782
  var getElementNodesInSelection = (selection) => {
22705
22783
  const nodesInSelection = selection.getNodes();
22706
22784
  if (nodesInSelection.length === 0) {
@@ -22709,7 +22787,7 @@ var getElementNodesInSelection = (selection) => {
22709
22787
  selection.focus.getNode().getParentOrThrow()
22710
22788
  ]);
22711
22789
  }
22712
- return new Set(nodesInSelection.map((node) => (0, import_lexical2.$isElementNode)(node) ? node : node.getParentOrThrow()));
22790
+ return new Set(nodesInSelection.map((node) => (0, import_lexical3.$isElementNode)(node) ? node : node.getParentOrThrow()));
22713
22791
  };
22714
22792
  var getAncestor = (node, predicate) => {
22715
22793
  let parent = node;
@@ -22756,7 +22834,7 @@ var guessLinkTypeFromPath = (path) => {
22756
22834
  };
22757
22835
  function convertAnchorElement(domNode) {
22758
22836
  let node = null;
22759
- if (!(0, import_utils6.isHTMLAnchorElement)(domNode)) {
22837
+ if (!(0, import_utils7.isHTMLAnchorElement)(domNode)) {
22760
22838
  return { node };
22761
22839
  }
22762
22840
  const textContent = domNode.textContent;
@@ -22813,14 +22891,12 @@ function convertAnchorElement(domNode) {
22813
22891
  nodeId,
22814
22892
  dynamicInputValues
22815
22893
  };
22816
- if (isProjectMapLinkValue(value)) {
22817
- node = $createLinkNode(value);
22818
- } else if (isNonProjectMapLinkValue(value)) {
22894
+ if (isProjectMapLinkValue(value) || isNonProjectMapLinkValue(value)) {
22819
22895
  node = $createLinkNode(value);
22820
22896
  }
22821
22897
  return { node };
22822
22898
  }
22823
- var LinkNode = class _LinkNode extends import_lexical3.ElementNode {
22899
+ var LinkNode = class _LinkNode extends import_lexical4.ElementNode {
22824
22900
  static getType() {
22825
22901
  return "link";
22826
22902
  }
@@ -22865,7 +22941,7 @@ var LinkNode = class _LinkNode extends import_lexical3.ElementNode {
22865
22941
  element.setAttribute("href", `mailto:${this.__link.path}`);
22866
22942
  }
22867
22943
  }
22868
- (0, import_utils6.addClassNamesToElement)(element, config.theme.link);
22944
+ (0, import_utils7.addClassNamesToElement)(element, config.theme.link);
22869
22945
  return element;
22870
22946
  }
22871
22947
  updateDOM(prevNode, a) {
@@ -22893,7 +22969,7 @@ var LinkNode = class _LinkNode extends import_lexical3.ElementNode {
22893
22969
  }
22894
22970
  insertNewAfter(selection, restoreSelection = true) {
22895
22971
  const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection);
22896
- if ((0, import_lexical3.$isElementNode)(element)) {
22972
+ if ((0, import_lexical4.$isElementNode)(element)) {
22897
22973
  const linkNode = $createLinkNode(
22898
22974
  "nodeId" in this.__link ? {
22899
22975
  nodeId: this.__link.nodeId,
@@ -22924,7 +23000,7 @@ var LinkNode = class _LinkNode extends import_lexical3.ElementNode {
22924
23000
  }
22925
23001
  };
22926
23002
  function $createLinkNode(props) {
22927
- return (0, import_lexical3.$applyNodeReplacement)(new LinkNode(props));
23003
+ return (0, import_lexical4.$applyNodeReplacement)(new LinkNode(props));
22928
23004
  }
22929
23005
  function $isLinkNode(node) {
22930
23006
  return node instanceof LinkNode;
@@ -22937,14 +23013,14 @@ function removeLinkNode(node) {
22937
23013
  node.remove();
22938
23014
  }
22939
23015
  function removeLinkNodeFromSelection() {
22940
- const selection = (0, import_lexical3.$getSelection)();
22941
- if (!(0, import_lexical3.$isRangeSelection)(selection)) {
23016
+ const selection = (0, import_lexical4.$getSelection)();
23017
+ if (!(0, import_lexical4.$isRangeSelection)(selection)) {
22942
23018
  return;
22943
23019
  }
22944
23020
  const nodes = selection.extract();
22945
23021
  const linkNodesFound = /* @__PURE__ */ new Set();
22946
23022
  for (const node of nodes) {
22947
- if ((0, import_lexical3.$isElementNode)(node) && !node.isInline()) {
23023
+ if ((0, import_lexical4.$isElementNode)(node) && !node.isInline()) {
22948
23024
  continue;
22949
23025
  }
22950
23026
  const linkNodeAncestor = getLinkAncestor(node);
@@ -22958,17 +23034,21 @@ function removeLinkNodeFromSelection() {
22958
23034
  }
22959
23035
  function upsertLinkNode(props) {
22960
23036
  var _a, _b, _c, _d, _e;
22961
- const selection = (0, import_lexical3.$getSelection)();
22962
- if (!(0, import_lexical3.$isRangeSelection)(selection)) {
23037
+ const selection = (0, import_lexical4.$getSelection)();
23038
+ if (!(0, import_lexical4.$isRangeSelection)(selection)) {
22963
23039
  return;
22964
23040
  }
22965
23041
  const nodes = selection.extract();
22966
23042
  const touchedNodes = [];
22967
23043
  for (const node of nodes) {
22968
- if ((0, import_lexical3.$isElementNode)(node) && !node.isInline()) {
23044
+ if ((0, import_lexical4.$isElementNode)(node) && !node.isInline()) {
22969
23045
  continue;
22970
23046
  }
22971
23047
  const linkNodeAncestor = getLinkAncestor(node);
23048
+ if ($isLinkNode(node)) {
23049
+ node.setLink(props);
23050
+ continue;
23051
+ }
22972
23052
  if (!linkNodeAncestor) {
22973
23053
  const newLinkNode = $createLinkNode(props);
22974
23054
  node.insertBefore(newLinkNode);
@@ -23013,23 +23093,23 @@ function upsertLinkNode(props) {
23013
23093
  }
23014
23094
  }
23015
23095
  }
23016
- var REMOVE_LINK_NODE_COMMAND = (0, import_lexical3.createCommand)("REMOVE_LINK_NODE_COMMAND");
23017
- var UPSERT_LINK_NODE_COMMAND = (0, import_lexical3.createCommand)("UPSERT_LINK_NODE_COMMAND");
23018
- var OPEN_LINK_NODE_MODAL_COMMAND = (0, import_lexical3.createCommand)(
23096
+ var REMOVE_LINK_NODE_COMMAND = (0, import_lexical4.createCommand)("REMOVE_LINK_NODE_COMMAND");
23097
+ var UPSERT_LINK_NODE_COMMAND = (0, import_lexical4.createCommand)("UPSERT_LINK_NODE_COMMAND");
23098
+ var OPEN_LINK_NODE_MODAL_COMMAND = (0, import_lexical4.createCommand)(
23019
23099
  "OPEN_LINK_NODE_MODAL_COMMAND"
23020
23100
  );
23021
23101
  var LINK_POPOVER_OFFSET_X = 0;
23022
23102
  var LINK_POPOVER_OFFSET_Y = 8;
23023
- var linkPopover = import_react146.css`
23103
+ var linkPopover = import_react147.css`
23024
23104
  position: absolute;
23025
23105
  z-index: 11;
23026
23106
  `;
23027
- var linkPopoverContainer = import_react146.css`
23107
+ var linkPopoverContainer = import_react147.css`
23028
23108
  ${Popover()};
23029
23109
  align-items: center;
23030
23110
  display: flex;
23031
23111
  `;
23032
- var linkPopoverAnchor = import_react146.css`
23112
+ var linkPopoverAnchor = import_react147.css`
23033
23113
  ${link}
23034
23114
  ${linkColorDefault}
23035
23115
  `;
@@ -23041,29 +23121,29 @@ function LinkNodePlugin({
23041
23121
  const parsePath = getBoundPath != null ? getBoundPath : function(path) {
23042
23122
  return path;
23043
23123
  };
23044
- const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
23045
- const [linkPopoverState, setLinkPopoverState] = (0, import_react147.useState)();
23046
- const linkPopoverElRef = (0, import_react147.useRef)(null);
23047
- const [isEditorFocused, setIsEditorFocused] = (0, import_react147.useState)(false);
23048
- const [isLinkPopoverFocused, setIsLinkPopoverFocused] = (0, import_react147.useState)(false);
23049
- (0, import_react147.useEffect)(() => {
23124
+ const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
23125
+ const [linkPopoverState, setLinkPopoverState] = (0, import_react148.useState)();
23126
+ const linkPopoverElRef = (0, import_react148.useRef)(null);
23127
+ const [isEditorFocused, setIsEditorFocused] = (0, import_react148.useState)(false);
23128
+ const [isLinkPopoverFocused, setIsLinkPopoverFocused] = (0, import_react148.useState)(false);
23129
+ (0, import_react148.useEffect)(() => {
23050
23130
  if (!isEditorFocused && !isLinkPopoverFocused) {
23051
23131
  setLinkPopoverState(void 0);
23052
23132
  return;
23053
23133
  }
23054
23134
  }, [isEditorFocused, isLinkPopoverFocused]);
23055
- (0, import_react147.useEffect)(() => {
23135
+ (0, import_react148.useEffect)(() => {
23056
23136
  if (!editor.hasNodes([LinkNode])) {
23057
23137
  throw new Error("LinkNode not registered on editor");
23058
23138
  }
23059
- return (0, import_utils6.mergeRegister)(
23139
+ return (0, import_utils7.mergeRegister)(
23060
23140
  editor.registerCommand(
23061
23141
  UPSERT_LINK_NODE_COMMAND,
23062
23142
  (payload) => {
23063
23143
  upsertLinkNode(payload);
23064
23144
  return true;
23065
23145
  },
23066
- import_lexical3.COMMAND_PRIORITY_EDITOR
23146
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23067
23147
  ),
23068
23148
  editor.registerCommand(
23069
23149
  REMOVE_LINK_NODE_COMMAND,
@@ -23071,7 +23151,7 @@ function LinkNodePlugin({
23071
23151
  removeLinkNodeFromSelection();
23072
23152
  return true;
23073
23153
  },
23074
- import_lexical3.COMMAND_PRIORITY_EDITOR
23154
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23075
23155
  ),
23076
23156
  editor.registerCommand(
23077
23157
  OPEN_LINK_NODE_MODAL_COMMAND,
@@ -23090,18 +23170,18 @@ function LinkNodePlugin({
23090
23170
  });
23091
23171
  return true;
23092
23172
  },
23093
- import_lexical3.COMMAND_PRIORITY_EDITOR
23173
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23094
23174
  ),
23095
23175
  editor.registerCommand(
23096
- import_lexical3.FOCUS_COMMAND,
23176
+ import_lexical4.FOCUS_COMMAND,
23097
23177
  () => {
23098
23178
  setIsEditorFocused(true);
23099
23179
  return true;
23100
23180
  },
23101
- import_lexical3.COMMAND_PRIORITY_EDITOR
23181
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23102
23182
  ),
23103
23183
  editor.registerCommand(
23104
- import_lexical3.BLUR_COMMAND,
23184
+ import_lexical4.BLUR_COMMAND,
23105
23185
  () => {
23106
23186
  requestAnimationFrame(() => {
23107
23187
  if (linkPopoverElRef.current !== null) {
@@ -23117,16 +23197,51 @@ function LinkNodePlugin({
23117
23197
  });
23118
23198
  return true;
23119
23199
  },
23120
- import_lexical3.COMMAND_PRIORITY_EDITOR
23200
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23201
+ ),
23202
+ // Support pasting of links from clipboard
23203
+ editor.registerCommand(
23204
+ import_lexical4.PASTE_COMMAND,
23205
+ (event) => {
23206
+ const selection = (0, import_lexical4.$getSelection)();
23207
+ if (!(0, import_lexical4.$isRangeSelection)(selection) || selection.isCollapsed() || !(0, import_utils7.objectKlassEquals)(event, ClipboardEvent)) {
23208
+ return false;
23209
+ }
23210
+ const clipboardEvent = event;
23211
+ if (clipboardEvent.clipboardData === null) {
23212
+ return false;
23213
+ }
23214
+ const clipboardText = clipboardEvent.clipboardData.getData("text");
23215
+ if (!isValidUrl(clipboardText)) {
23216
+ return false;
23217
+ }
23218
+ if (selection.getNodes().some((node) => (0, import_lexical4.$isElementNode)(node) && !$isLinkNode(node))) {
23219
+ return false;
23220
+ }
23221
+ let path = clipboardText;
23222
+ const type = guessLinkTypeFromPath(path);
23223
+ if (type === "email" && path.startsWith("mailto:")) {
23224
+ path = path.replace("mailto:", "");
23225
+ } else if (type === "tel" && path.startsWith("tel:")) {
23226
+ path = path.replace("tel:", "");
23227
+ }
23228
+ upsertLinkNode({
23229
+ path,
23230
+ type
23231
+ });
23232
+ event.preventDefault();
23233
+ return true;
23234
+ },
23235
+ import_lexical4.COMMAND_PRIORITY_LOW
23121
23236
  )
23122
23237
  );
23123
23238
  }, [editor, onConnectLink]);
23124
- const maybeShowLinkToolbar = (0, import_react147.useCallback)(() => {
23239
+ const maybeShowLinkToolbar = (0, import_react148.useCallback)(() => {
23125
23240
  if (!editor.isEditable()) {
23126
23241
  return;
23127
23242
  }
23128
- const selection = (0, import_lexical3.$getSelection)();
23129
- if (!(0, import_lexical3.$isRangeSelection)(selection)) {
23243
+ const selection = (0, import_lexical4.$getSelection)();
23244
+ if (!(0, import_lexical4.$isRangeSelection)(selection)) {
23130
23245
  setLinkPopoverState(void 0);
23131
23246
  return;
23132
23247
  }
@@ -23155,7 +23270,7 @@ function LinkNodePlugin({
23155
23270
  }
23156
23271
  });
23157
23272
  }, [editor, positioningAnchorEl]);
23158
- (0, import_react147.useEffect)(() => {
23273
+ (0, import_react148.useEffect)(() => {
23159
23274
  return editor.registerUpdateListener(({ editorState }) => {
23160
23275
  requestAnimationFrame(() => {
23161
23276
  editorState.read(() => {
@@ -23240,13 +23355,13 @@ function getLinkAncestor(node) {
23240
23355
  // src/components/ParameterInputs/rich-text/ListIndentPlugin.tsx
23241
23356
  init_emotion_jsx_shim();
23242
23357
  var import_list = require("@lexical/list");
23243
- var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
23244
- var import_utils8 = require("@lexical/utils");
23245
- var import_lexical4 = require("lexical");
23246
- var import_react148 = require("react");
23358
+ var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerContext");
23359
+ var import_utils10 = require("@lexical/utils");
23360
+ var import_lexical5 = require("lexical");
23361
+ var import_react149 = require("react");
23247
23362
  function isIndentPermitted(maxDepth) {
23248
- const selection = (0, import_lexical4.$getSelection)();
23249
- if (!(0, import_lexical4.$isRangeSelection)(selection)) {
23363
+ const selection = (0, import_lexical5.$getSelection)();
23364
+ if (!(0, import_lexical5.$isRangeSelection)(selection)) {
23250
23365
  return false;
23251
23366
  }
23252
23367
  const elementNodesInSelection = getElementNodesInSelection(selection);
@@ -23266,12 +23381,12 @@ function isIndentPermitted(maxDepth) {
23266
23381
  }
23267
23382
  function $isAnyOfSelectedNodesAListItemNode(selection) {
23268
23383
  const nodes = selection.getNodes();
23269
- return (0, import_utils8.$filter)(nodes, (node) => (0, import_list.$isListItemNode)(node) ? node : null).length > 0;
23384
+ return (0, import_utils10.$filter)(nodes, (node) => (0, import_list.$isListItemNode)(node) ? node : null).length > 0;
23270
23385
  }
23271
23386
  function $indentOverTab(selection) {
23272
23387
  const nodes = selection.getNodes();
23273
- const canIndentBlockNodes = (0, import_utils8.$filter)(nodes, (node) => {
23274
- if ((0, import_lexical4.$isBlockElementNode)(node) && node.canIndent()) {
23388
+ const canIndentBlockNodes = (0, import_utils10.$filter)(nodes, (node) => {
23389
+ if ((0, import_lexical5.$isBlockElementNode)(node) && node.canIndent()) {
23275
23390
  return node;
23276
23391
  }
23277
23392
  return null;
@@ -23283,13 +23398,13 @@ function $indentOverTab(selection) {
23283
23398
  const focus = selection.focus;
23284
23399
  const first = focus.isBefore(anchor) ? focus : anchor;
23285
23400
  const firstNode = first.getNode();
23286
- const firstBlock = (0, import_utils8.$getNearestBlockElementAncestorOrThrow)(firstNode);
23401
+ const firstBlock = (0, import_utils10.$getNearestBlockElementAncestorOrThrow)(firstNode);
23287
23402
  if (firstBlock.canIndent()) {
23288
23403
  const firstBlockKey = firstBlock.getKey();
23289
- let selectionAtStart = (0, import_lexical4.$createRangeSelection)();
23404
+ let selectionAtStart = (0, import_lexical5.$createRangeSelection)();
23290
23405
  selectionAtStart.anchor.set(firstBlockKey, 0, "element");
23291
23406
  selectionAtStart.focus.set(firstBlockKey, 0, "element");
23292
- selectionAtStart = (0, import_lexical4.$normalizeSelection__EXPERIMENTAL)(selectionAtStart);
23407
+ selectionAtStart = (0, import_lexical5.$normalizeSelection__EXPERIMENTAL)(selectionAtStart);
23293
23408
  if (selectionAtStart.anchor.is(first)) {
23294
23409
  return true;
23295
23410
  }
@@ -23297,1251 +23412,1280 @@ function $indentOverTab(selection) {
23297
23412
  return false;
23298
23413
  }
23299
23414
  function ListIndentPlugin({ maxDepth }) {
23300
- const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
23301
- const isInListItemNode = (0, import_react148.useRef)(false);
23302
- (0, import_react148.useEffect)(() => {
23415
+ const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
23416
+ const isInListItemNode = (0, import_react149.useRef)(false);
23417
+ (0, import_react149.useEffect)(() => {
23303
23418
  return editor.registerCommand(
23304
- import_lexical4.SELECTION_CHANGE_COMMAND,
23419
+ import_lexical5.SELECTION_CHANGE_COMMAND,
23305
23420
  () => {
23306
23421
  editor.read(() => {
23307
- const selection = (0, import_lexical4.$getSelection)();
23308
- if (!(0, import_lexical4.$isRangeSelection)(selection) || !selection.isCollapsed()) {
23422
+ const selection = (0, import_lexical5.$getSelection)();
23423
+ if (!(0, import_lexical5.$isRangeSelection)(selection) || !selection.isCollapsed()) {
23309
23424
  isInListItemNode.current = false;
23310
23425
  return false;
23311
23426
  }
23312
- isInListItemNode.current = (0, import_utils8.$getNearestNodeOfType)(selection.anchor.getNode(), import_list.ListNode) !== null;
23427
+ isInListItemNode.current = (0, import_utils10.$getNearestNodeOfType)(selection.anchor.getNode(), import_list.ListNode) !== null;
23313
23428
  });
23314
23429
  return false;
23315
23430
  },
23316
- import_lexical4.COMMAND_PRIORITY_NORMAL
23431
+ import_lexical5.COMMAND_PRIORITY_NORMAL
23317
23432
  );
23318
23433
  }, [editor]);
23319
- (0, import_react148.useEffect)(() => {
23320
- return (0, import_utils8.mergeRegister)(
23434
+ (0, import_react149.useEffect)(() => {
23435
+ return (0, import_utils10.mergeRegister)(
23321
23436
  editor.registerCommand(
23322
- import_lexical4.INDENT_CONTENT_COMMAND,
23437
+ import_lexical5.INDENT_CONTENT_COMMAND,
23323
23438
  () => !isIndentPermitted(maxDepth),
23324
- import_lexical4.COMMAND_PRIORITY_CRITICAL
23439
+ import_lexical5.COMMAND_PRIORITY_CRITICAL
23325
23440
  ),
23326
23441
  editor.registerCommand(
23327
- import_lexical4.KEY_TAB_COMMAND,
23442
+ import_lexical5.KEY_TAB_COMMAND,
23328
23443
  (event) => {
23329
- const selection = (0, import_lexical4.$getSelection)();
23330
- if (!(0, import_lexical4.$isRangeSelection)(selection) || !isInListItemNode.current && !$isAnyOfSelectedNodesAListItemNode(selection)) {
23444
+ const selection = (0, import_lexical5.$getSelection)();
23445
+ if (!(0, import_lexical5.$isRangeSelection)(selection) || !isInListItemNode.current && !$isAnyOfSelectedNodesAListItemNode(selection)) {
23331
23446
  return false;
23332
23447
  }
23333
23448
  event.preventDefault();
23334
23449
  if ($indentOverTab(selection)) {
23335
- const command = event.shiftKey ? import_lexical4.OUTDENT_CONTENT_COMMAND : import_lexical4.INDENT_CONTENT_COMMAND;
23450
+ const command = event.shiftKey ? import_lexical5.OUTDENT_CONTENT_COMMAND : import_lexical5.INDENT_CONTENT_COMMAND;
23336
23451
  return editor.dispatchCommand(command, void 0);
23337
23452
  }
23338
23453
  return false;
23339
23454
  },
23340
- import_lexical4.COMMAND_PRIORITY_CRITICAL
23455
+ import_lexical5.COMMAND_PRIORITY_CRITICAL
23341
23456
  )
23342
23457
  );
23343
23458
  }, [editor, maxDepth]);
23344
23459
  return null;
23345
23460
  }
23346
23461
 
23347
- // src/components/ParameterInputs/rich-text/RichTextToolbar.tsx
23462
+ // src/components/ParameterInputs/rich-text/TableActionMenuPlugin.tsx
23348
23463
  init_emotion_jsx_shim();
23349
- var import_react149 = require("@emotion/react");
23350
- var import_code2 = require("@lexical/code");
23351
- var import_list2 = require("@lexical/list");
23352
- var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerContext");
23353
- var import_rich_text = require("@lexical/rich-text");
23354
- var import_selection2 = require("@lexical/selection");
23464
+ var import_react150 = require("@emotion/react");
23465
+ var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
23466
+ var import_useLexicalEditable = require("@lexical/react/useLexicalEditable");
23355
23467
  var import_table = require("@lexical/table");
23356
- var import_utils10 = require("@lexical/utils");
23357
- var import_lexical5 = require("lexical");
23358
- var import_react150 = require("react");
23468
+ var import_lexical6 = require("lexical");
23469
+ var import_react151 = require("react");
23359
23470
  var import_jsx_runtime130 = require("@emotion/react/jsx-runtime");
23360
- var toolbar = import_react149.css`
23361
- ${scrollbarStyles}
23362
- background: var(--gray-50);
23363
- border-radius: var(--rounded-base);
23364
- display: flex;
23365
- /* We add 1px because we use a 1px wide separator */
23366
- gap: calc(var(--spacing-sm) + 1px);
23367
- margin: 0 0 calc(var(--spacing-sm) + var(--spacing-xs)) 0;
23368
- overflow: auto;
23369
- padding: var(--spacing-sm);
23370
- position: sticky;
23371
- top: calc(var(--spacing-sm) * -2);
23372
- z-index: 10;
23373
- `;
23374
- var toolbarGroup = import_react149.css`
23375
- display: flex;
23376
- flex-shrink: 0;
23377
- gap: var(--spacing-xs);
23378
- position: relative;
23379
-
23380
- &:not(:first-child)::before {
23381
- background-color: var(--gray-300);
23382
- content: '';
23383
- display: block;
23384
- height: 24px;
23385
- left: calc(var(--spacing-xs) * -1);
23386
- position: absolute;
23387
- top: 4px;
23388
- width: 1px;
23389
- }
23390
- `;
23391
- var richTextToolbarButton = import_react149.css`
23392
- align-items: center;
23393
- appearance: none;
23394
- border: 0;
23395
- border-radius: var(--rounded-sm);
23396
- box-shadow: none;
23397
- color: var(--gray-900);
23398
- display: flex;
23399
- flex-shrink: 0;
23400
- height: 32px;
23401
- justify-content: center;
23402
- min-width: 32px;
23403
- padding: 0 var(--spacing-sm);
23404
- `;
23405
- var richTextToolbarButtonActive = import_react149.css`
23406
- background: var(--gray-200);
23407
- `;
23408
- var textStyleButton = import_react149.css`
23409
- justify-content: space-between;
23410
- min-width: 7rem;
23411
- `;
23412
- var toolbarIcon = import_react149.css`
23413
- color: inherit;
23414
- `;
23415
- var toolbarChevron = import_react149.css`
23416
- margin-left: var(--spacing-xs);
23471
+ function computeSelectionCount(selection) {
23472
+ const selectionShape = selection.getShape();
23473
+ return {
23474
+ columns: selectionShape.toX - selectionShape.fromX + 1,
23475
+ rows: selectionShape.toY - selectionShape.fromY + 1
23476
+ };
23477
+ }
23478
+ var tableActionMenuTrigger = import_react150.css`
23479
+ position: absolute;
23480
+ transform: translate(calc(-100% - 1px), 1px);
23417
23481
  `;
23418
- var RichTextToolbarIcon = ({ icon }) => {
23419
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon, css: toolbarIcon, size: "1rem" });
23420
- };
23421
- var FORMATS_WITH_ICON = /* @__PURE__ */ new Map([
23422
- ["bold", "format-bold"],
23423
- ["italic", "format-italic"],
23424
- ["underline", "format-underline"],
23425
- ["strikethrough", "format-strike"],
23426
- ["code", "format-code"],
23427
- ["superscript", "format-superscript"],
23428
- ["subscript", "format-subscript"]
23429
- ]);
23430
- var HEADING_ELEMENTS = ["h1", "h2", "h3", "h4", "h5", "h6"];
23431
- var TEXTUAL_ELEMENTS = HEADING_ELEMENTS;
23432
- var RichTextToolbar = ({ config, customControls, onInsertTable }) => {
23433
- const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
23434
- const {
23435
- activeElement,
23436
- setActiveElement,
23437
- activeFormats,
23438
- setActiveFormats,
23439
- visibleFormatsWithIcon,
23440
- visibleFormatsWithoutIcon,
23441
- visibleTextualElements,
23442
- isLink,
23443
- setIsLink,
23444
- linkElementVisible,
23445
- visibleLists,
23446
- codeElementVisible,
23447
- quoteElementVisible,
23448
- visibleElementsWithIcons,
23449
- visibleInsertElementsWithIcons,
23450
- tableElementVisible
23451
- } = useRichTextToolbarState({ config });
23452
- const onSelectElement = (type) => {
23453
- if (activeElement === type) {
23454
- return;
23455
- }
23456
- editor.focus(() => {
23457
- editor.update(() => {
23458
- const selection = (0, import_lexical5.$getSelection)();
23459
- if (HEADING_ELEMENTS.includes(type)) {
23460
- (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createHeadingNode)(type));
23461
- } else if (type === "paragraph") {
23462
- (0, import_selection2.$setBlocksType)(selection, () => (0, import_lexical5.$createParagraphNode)());
23463
- } else if (type === "quote") {
23464
- (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createQuoteNode)());
23465
- } else if (type === "code") {
23466
- (0, import_selection2.$setBlocksType)(selection, () => (0, import_code2.$createCodeNode)());
23467
- } else if (type === "table" && onInsertTable) {
23468
- onInsertTable().then((dimensions) => {
23469
- if (!dimensions) {
23470
- return;
23471
- }
23472
- const { rows, columns } = dimensions;
23473
- editor.focus(() => {
23474
- editor.update(() => {
23475
- (0, import_lexical5.$insertNodes)([(0, import_table.$createTableNodeWithDimensions)(rows, columns, false)]);
23476
- });
23477
- });
23478
- });
23482
+ var TableActionMenuTrigger = (0, import_react151.forwardRef)((props, ref) => {
23483
+ const { tableCellEl, positioningAnchorEl, ...rest } = props;
23484
+ const [coordinates, setCoordinates] = (0, import_react151.useState)({ x: 0, y: 0 });
23485
+ (0, import_react151.useLayoutEffect)(() => {
23486
+ const rect = tableCellEl.getBoundingClientRect();
23487
+ const parentRect = positioningAnchorEl.getBoundingClientRect();
23488
+ const relativeX = rect.right - parentRect.left + positioningAnchorEl.scrollLeft;
23489
+ const relativeY = rect.top - parentRect.top + positioningAnchorEl.scrollTop;
23490
+ setCoordinates({ x: relativeX, y: relativeY });
23491
+ }, [tableCellEl, positioningAnchorEl]);
23492
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23493
+ IconButton,
23494
+ {
23495
+ ref,
23496
+ css: [
23497
+ tableActionMenuTrigger,
23498
+ {
23499
+ top: coordinates.y,
23500
+ left: coordinates.x
23479
23501
  }
23480
- });
23481
- });
23482
- };
23483
- const updateToolbar = (0, import_react150.useCallback)(() => {
23484
- const selection = (0, import_lexical5.$getSelection)();
23485
- if (!(0, import_lexical5.$isRangeSelection)(selection)) {
23486
- return;
23487
- }
23488
- const newActiveFormats = [];
23489
- for (const format of richTextBuiltInFormats) {
23490
- if (selection.hasFormat(format.type)) {
23491
- newActiveFormats.push(format.type);
23492
- }
23502
+ ],
23503
+ size: "xs",
23504
+ buttonType: "unimportant",
23505
+ ...rest,
23506
+ children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "chevron-down", size: "1rem", iconColor: "currentColor" })
23493
23507
  }
23494
- setActiveFormats(newActiveFormats);
23495
- const anchorNode = selection.anchor.getNode();
23496
- let element = anchorNode.getKey() === "root" ? anchorNode : (0, import_utils10.$findMatchingParent)(anchorNode, (e) => {
23497
- const parent = e.getParent();
23498
- return parent !== null && (0, import_lexical5.$isRootOrShadowRoot)(parent);
23499
- });
23500
- if (element === null) {
23501
- element = anchorNode.getTopLevelElementOrThrow();
23502
- }
23503
- const elementKey = element.getKey();
23504
- const elementDOM = editor.getElementByKey(elementKey);
23505
- if (elementDOM !== null) {
23506
- if ((0, import_list2.$isListNode)(element)) {
23507
- const parentList = (0, import_utils10.$getNearestNodeOfType)(anchorNode, import_list2.ListNode);
23508
- const type = parentList ? parentList.getListType() : element.getListType();
23509
- setActiveElement(type === "bullet" ? "unorderedList" : "orderedList");
23510
- } else {
23511
- const type = (0, import_rich_text.$isHeadingNode)(element) ? element.getTag() : element.getType();
23512
- setActiveElement(type);
23513
- }
23514
- }
23515
- const node = getSelectedNode(selection);
23516
- if (getLinkAncestor(node) !== null) {
23517
- setIsLink(true);
23518
- } else {
23519
- setIsLink(false);
23520
- }
23521
- }, [editor, setActiveElement, setActiveFormats, setIsLink]);
23522
- (0, import_react150.useEffect)(() => {
23523
- return editor.registerCommand(
23524
- import_lexical5.SELECTION_CHANGE_COMMAND,
23525
- (_payload) => {
23526
- updateToolbar();
23527
- return false;
23508
+ );
23509
+ });
23510
+ TableActionMenuTrigger.displayName = "TableActionMenuTrigger";
23511
+ function TableActionMenu({
23512
+ tableCellNode: _tableCellNode,
23513
+ menuPortalEl,
23514
+ tableCellEl,
23515
+ positioningAnchorEl
23516
+ }) {
23517
+ const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
23518
+ const [tableCellNode, updateTableCellNode] = (0, import_react151.useState)(_tableCellNode);
23519
+ const [selectionCounts, updateSelectionCounts] = (0, import_react151.useState)({
23520
+ columns: 1,
23521
+ rows: 1
23522
+ });
23523
+ const [menuTriggerKey, setMenuTriggerKey] = (0, import_react151.useState)(0);
23524
+ const incrementMenuTriggerKey = () => {
23525
+ setMenuTriggerKey((key) => key += 1);
23526
+ };
23527
+ (0, import_react151.useEffect)(() => {
23528
+ return editor.registerMutationListener(
23529
+ import_table.TableCellNode,
23530
+ (nodeMutations) => {
23531
+ const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
23532
+ if (nodeUpdated) {
23533
+ editor.getEditorState().read(() => {
23534
+ updateTableCellNode(tableCellNode.getLatest());
23535
+ });
23536
+ }
23528
23537
  },
23529
- import_lexical5.COMMAND_PRIORITY_CRITICAL
23538
+ { skipInitialization: true }
23530
23539
  );
23531
- }, [editor, updateToolbar]);
23532
- (0, import_react150.useEffect)(() => {
23533
- return editor.registerUpdateListener(({ editorState }) => {
23534
- requestAnimationFrame(() => {
23535
- editorState.read(() => {
23536
- updateToolbar();
23537
- });
23540
+ }, [editor, tableCellNode]);
23541
+ (0, import_react151.useEffect)(() => {
23542
+ editor.getEditorState().read(() => {
23543
+ const selection = (0, import_lexical6.$getSelection)();
23544
+ if ((0, import_table.$isTableSelection)(selection)) {
23545
+ updateSelectionCounts(computeSelectionCount(selection));
23546
+ }
23547
+ });
23548
+ }, [editor]);
23549
+ const clearTableSelection = (0, import_react151.useCallback)(() => {
23550
+ editor.update(() => {
23551
+ if (tableCellNode.isAttached()) {
23552
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23553
+ const tableElement2 = editor.getElementByKey(
23554
+ tableNode.getKey()
23555
+ );
23556
+ if (!tableElement2) {
23557
+ throw new Error("Expected to find tableElement in DOM");
23558
+ }
23559
+ const tableSelection = (0, import_table.getTableObserverFromTableElement)(tableElement2);
23560
+ if (tableSelection !== null) {
23561
+ tableSelection.clearHighlight();
23562
+ }
23563
+ tableNode.markDirty();
23564
+ updateTableCellNode(tableCellNode.getLatest());
23565
+ }
23566
+ const rootNode = (0, import_lexical6.$getRoot)();
23567
+ rootNode.selectStart();
23568
+ });
23569
+ }, [editor, tableCellNode]);
23570
+ const insertTableRowAtSelection = (0, import_react151.useCallback)(
23571
+ (shouldInsertAfter) => {
23572
+ editor.update(() => {
23573
+ (0, import_table.$insertTableRow__EXPERIMENTAL)(shouldInsertAfter);
23574
+ });
23575
+ incrementMenuTriggerKey();
23576
+ },
23577
+ [editor]
23578
+ );
23579
+ const insertTableColumnAtSelection = (0, import_react151.useCallback)(
23580
+ (shouldInsertAfter) => {
23581
+ editor.update(() => {
23582
+ for (let i = 0; i < selectionCounts.columns; i++) {
23583
+ (0, import_table.$insertTableColumn__EXPERIMENTAL)(shouldInsertAfter);
23584
+ }
23538
23585
  });
23586
+ incrementMenuTriggerKey();
23587
+ },
23588
+ [editor, selectionCounts.columns]
23589
+ );
23590
+ const deleteTableRowAtSelection = (0, import_react151.useCallback)(() => {
23591
+ editor.update(() => {
23592
+ (0, import_table.$deleteTableRow__EXPERIMENTAL)();
23539
23593
  });
23540
- }, [editor, updateToolbar]);
23541
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { css: toolbar, children: [
23542
- /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
23543
- Menu,
23544
- {
23545
- menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("button", { css: [richTextToolbarButton, textStyleButton], title: "Text styles", children: [
23546
- visibleTextualElements.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
23547
- " ",
23548
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
23549
- ] }),
23550
- placement: "bottom-start",
23551
- children: [
23552
- [
23553
- {
23554
- label: "Normal",
23555
- type: "paragraph"
23556
- },
23557
- ...visibleTextualElements
23558
- ].map((element) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23559
- MenuItem,
23560
- {
23561
- onClick: () => {
23562
- onSelectElement(element.type);
23563
- },
23564
- children: element.label
23565
- },
23566
- element.type
23567
- )),
23568
- visibleTextualElements.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { disabled: true, children: "Alternative text styles are not available" }) : null
23569
- ]
23594
+ incrementMenuTriggerKey();
23595
+ }, [editor]);
23596
+ const deleteTableAtSelection = (0, import_react151.useCallback)(() => {
23597
+ editor.update(() => {
23598
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23599
+ tableNode.remove();
23600
+ clearTableSelection();
23601
+ });
23602
+ }, [editor, tableCellNode, clearTableSelection]);
23603
+ const deleteTableColumnAtSelection = (0, import_react151.useCallback)(() => {
23604
+ editor.update(() => {
23605
+ (0, import_table.$deleteTableColumn__EXPERIMENTAL)();
23606
+ });
23607
+ incrementMenuTriggerKey();
23608
+ }, [editor]);
23609
+ const toggleTableRowIsHeader = (0, import_react151.useCallback)(() => {
23610
+ editor.update(() => {
23611
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23612
+ const tableRowIndex = (0, import_table.$getTableRowIndexFromTableCellNode)(tableCellNode);
23613
+ const tableRows = tableNode.getChildren();
23614
+ if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
23615
+ throw new Error("Expected table cell to be inside of table row.");
23570
23616
  }
23571
- ),
23572
- visibleFormatsWithIcon.length > 0 || visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { css: toolbarGroup, children: [
23573
- visibleFormatsWithIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Tooltip, { title: format.label, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23574
- "button",
23575
- {
23576
- onClick: () => {
23577
- editor.dispatchCommand(import_lexical5.FORMAT_TEXT_COMMAND, format.type);
23578
- },
23579
- css: [
23580
- richTextToolbarButton,
23581
- activeFormats.includes(format.type) ? richTextToolbarButtonActive : null
23582
- ],
23583
- children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(RichTextToolbarIcon, { icon: FORMATS_WITH_ICON.get(format.type) })
23617
+ const tableRow2 = tableRows[tableRowIndex];
23618
+ if (!(0, import_table.$isTableRowNode)(tableRow2)) {
23619
+ throw new Error("Expected table row");
23620
+ }
23621
+ tableRow2.getChildren().forEach((tableCell) => {
23622
+ if (!(0, import_table.$isTableCellNode)(tableCell)) {
23623
+ throw new Error("Expected table cell");
23584
23624
  }
23585
- ) }, format.type)),
23586
- visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23587
- Menu,
23588
- {
23589
- menuLabel: "Alternative text styles",
23590
- menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("button", { css: richTextToolbarButton, title: "Alternative text styles", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "more-alt", css: toolbarIcon }) }),
23591
- placement: "bottom-start",
23592
- children: visibleFormatsWithoutIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23593
- MenuItem,
23594
- {
23595
- onClick: () => {
23596
- editor.dispatchCommand(import_lexical5.FORMAT_TEXT_COMMAND, format.type);
23597
- },
23598
- children: format.label
23599
- },
23600
- format.type
23601
- ))
23625
+ tableCell.toggleHeaderStyle(import_table.TableCellHeaderStates.ROW);
23626
+ });
23627
+ clearTableSelection();
23628
+ });
23629
+ }, [editor, tableCellNode, clearTableSelection]);
23630
+ const toggleTableColumnIsHeader = (0, import_react151.useCallback)(() => {
23631
+ editor.update(() => {
23632
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23633
+ const tableColumnIndex = (0, import_table.$getTableColumnIndexFromTableCellNode)(tableCellNode);
23634
+ const tableRows = tableNode.getChildren();
23635
+ const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length));
23636
+ if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {
23637
+ throw new Error("Expected table cell to be inside of table row.");
23638
+ }
23639
+ for (let r = 0; r < tableRows.length; r++) {
23640
+ const tableRow2 = tableRows[r];
23641
+ if (!(0, import_table.$isTableRowNode)(tableRow2)) {
23642
+ throw new Error("Expected table row");
23602
23643
  }
23603
- ) : null
23604
- ] }) : null,
23605
- visibleElementsWithIcons.size > 0 || customControls ? /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { css: toolbarGroup, children: [
23606
- linkElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23607
- "button",
23608
- {
23609
- onClick: () => {
23610
- isLink ? editor.dispatchCommand(REMOVE_LINK_NODE_COMMAND, {}) : editor.dispatchCommand(OPEN_LINK_NODE_MODAL_COMMAND, {});
23611
- },
23612
- css: [richTextToolbarButton, isLink ? richTextToolbarButtonActive : null],
23613
- children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(RichTextToolbarIcon, { icon: "link" })
23644
+ const tableCells = tableRow2.getChildren();
23645
+ if (tableColumnIndex >= tableCells.length) {
23646
+ continue;
23614
23647
  }
23615
- ) }) : null,
23616
- visibleLists.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_jsx_runtime130.Fragment, { children: [
23617
- visibleLists.has("unorderedList") ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Tooltip, { title: "Bullet List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23618
- "button",
23619
- {
23620
- onClick: () => {
23621
- activeElement === "unorderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_UNORDERED_LIST_COMMAND, void 0);
23622
- },
23623
- css: [
23624
- richTextToolbarButton,
23625
- activeElement === "unorderedList" ? richTextToolbarButtonActive : null
23626
- ],
23627
- children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(RichTextToolbarIcon, { icon: "layout-list" })
23628
- }
23629
- ) }) : null,
23630
- visibleLists.has("orderedList") ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Tooltip, { title: "Ordered List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23631
- "button",
23648
+ const tableCell = tableCells[tableColumnIndex];
23649
+ if (!(0, import_table.$isTableCellNode)(tableCell)) {
23650
+ throw new Error("Expected table cell");
23651
+ }
23652
+ tableCell.toggleHeaderStyle(import_table.TableCellHeaderStates.COLUMN);
23653
+ }
23654
+ clearTableSelection();
23655
+ });
23656
+ }, [editor, tableCellNode, clearTableSelection]);
23657
+ const menuItemCss = (0, import_react150.css)({
23658
+ fontSize: "var(--fs-sm)"
23659
+ });
23660
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
23661
+ Menu,
23662
+ {
23663
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23664
+ TableActionMenuTrigger,
23665
+ {
23666
+ tableCellEl,
23667
+ positioningAnchorEl
23668
+ },
23669
+ menuTriggerKey
23670
+ ),
23671
+ portalElement: menuPortalEl,
23672
+ maxMenuHeight: "300px",
23673
+ children: [
23674
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
23675
+ MenuItem,
23632
23676
  {
23633
23677
  onClick: () => {
23634
- activeElement === "orderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_ORDERED_LIST_COMMAND, void 0);
23678
+ insertTableRowAtSelection(false);
23635
23679
  },
23636
- css: [
23637
- richTextToolbarButton,
23638
- activeElement === "orderedList" ? richTextToolbarButtonActive : null
23639
- ],
23640
- children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(RichTextToolbarIcon, { icon: "layout-list-numbered" })
23680
+ css: menuItemCss,
23681
+ children: [
23682
+ "Insert ",
23683
+ selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
23684
+ " above"
23685
+ ]
23641
23686
  }
23642
- ) }) : null
23643
- ] }) : null,
23644
- customControls ? customControls : null
23645
- ] }) : null,
23646
- visibleInsertElementsWithIcons.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { css: toolbarGroup, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
23647
- Menu,
23648
- {
23649
- menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("button", { css: richTextToolbarButton, title: "Insert block element", children: [
23650
- "Insert",
23651
- /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
23687
+ ),
23688
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableRowAtSelection(true), css: menuItemCss, children: [
23689
+ "Insert ",
23690
+ selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
23691
+ " below"
23652
23692
  ] }),
23653
- placement: "bottom-start",
23654
- children: [
23655
- quoteElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23656
- MenuItem,
23657
- {
23658
- onClick: () => {
23659
- onSelectElement("quote");
23660
- },
23661
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "quote", iconColor: "currentColor" }),
23662
- children: "Quote"
23663
- }
23664
- ) : null,
23665
- codeElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23666
- MenuItem,
23667
- {
23668
- onClick: () => {
23669
- onSelectElement("code");
23670
- },
23671
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "code-slash", iconColor: "currentColor" }),
23672
- children: "Code"
23673
- }
23674
- ) : null,
23675
- tableElementVisible && onInsertTable !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23676
- MenuItem,
23677
- {
23678
- onClick: () => {
23679
- onSelectElement("table");
23680
- },
23681
- icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "view-grid", iconColor: "currentColor" }),
23682
- children: "Table"
23683
- }
23684
- ) : null
23685
- ]
23686
- }
23687
- ) }) : null
23688
- ] });
23689
- };
23690
- var RichTextToolbar_default = RichTextToolbar;
23691
- var useRichTextToolbarState = ({ config }) => {
23692
- var _a;
23693
- const enabledBuiltInFormats = (0, import_react150.useMemo)(() => {
23694
- return richTextBuiltInFormats.filter((format) => {
23695
- var _a2, _b;
23696
- return (_b = (_a2 = config == null ? void 0 : config.formatting) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(format.type);
23697
- });
23698
- }, [config]);
23699
- const enabledBuiltInElements = (0, import_react150.useMemo)(() => {
23700
- return richTextBuiltInElements.filter((element) => {
23701
- var _a2, _b;
23702
- return (_b = (_a2 = config == null ? void 0 : config.elements) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(element.type);
23703
- });
23704
- }, [config]);
23705
- const enabledBuiltInFormatsWithIcon = (0, import_react150.useMemo)(() => {
23706
- return enabledBuiltInFormats.filter((format) => FORMATS_WITH_ICON.has(format.type));
23707
- }, [enabledBuiltInFormats]);
23708
- const enabledBuiltInFormatsWithoutIcon = enabledBuiltInFormats.filter(
23709
- (format) => !FORMATS_WITH_ICON.has(format.type)
23710
- );
23711
- const [activeFormats, setActiveFormats] = (0, import_react150.useState)([]);
23712
- const visibleFormatsWithIcon = (0, import_react150.useMemo)(() => {
23713
- const visibleFormats = /* @__PURE__ */ new Set();
23714
- activeFormats.filter((type) => FORMATS_WITH_ICON.has(type)).forEach((type) => {
23715
- visibleFormats.add(type);
23716
- });
23717
- enabledBuiltInFormatsWithIcon.forEach((format) => {
23718
- visibleFormats.add(format.type);
23719
- });
23720
- return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
23721
- }, [activeFormats, enabledBuiltInFormatsWithIcon]);
23722
- const visibleFormatsWithoutIcon = (0, import_react150.useMemo)(() => {
23723
- const visibleFormats = /* @__PURE__ */ new Set();
23724
- activeFormats.filter((type) => !FORMATS_WITH_ICON.has(type)).forEach((type) => {
23725
- visibleFormats.add(type);
23726
- });
23727
- enabledBuiltInFormatsWithoutIcon.forEach((format) => {
23728
- visibleFormats.add(format.type);
23729
- });
23730
- return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
23731
- }, [activeFormats, enabledBuiltInFormatsWithoutIcon]);
23732
- const [activeElement, setActiveElement] = (0, import_react150.useState)("paragraph");
23733
- const enabledTextualElements = enabledBuiltInElements.filter(
23734
- (element) => TEXTUAL_ELEMENTS.includes(element.type)
23693
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23694
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(false), css: menuItemCss, children: [
23695
+ "Insert ",
23696
+ selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
23697
+ " left"
23698
+ ] }),
23699
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(true), css: menuItemCss, children: [
23700
+ "Insert ",
23701
+ selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
23702
+ " right"
23703
+ ] }),
23704
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23705
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableColumnAtSelection(), css: menuItemCss, children: "Delete column" }),
23706
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableRowAtSelection(), css: menuItemCss, children: "Delete row" }),
23707
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableAtSelection(), css: menuItemCss, children: "Delete table" }),
23708
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23709
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => toggleTableRowIsHeader(), css: menuItemCss, children: [
23710
+ (tableCellNode.__headerState & import_table.TableCellHeaderStates.ROW) === import_table.TableCellHeaderStates.ROW ? "Remove" : "Add",
23711
+ " ",
23712
+ "row header"
23713
+ ] }),
23714
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => toggleTableColumnIsHeader(), css: menuItemCss, children: [
23715
+ (tableCellNode.__headerState & import_table.TableCellHeaderStates.COLUMN) === import_table.TableCellHeaderStates.COLUMN ? "Remove" : "Add",
23716
+ " ",
23717
+ "column header"
23718
+ ] })
23719
+ ]
23720
+ }
23735
23721
  );
23736
- const visibleTextualElements = (0, import_react150.useMemo)(() => {
23737
- if (!TEXTUAL_ELEMENTS.includes(activeElement)) {
23738
- return enabledTextualElements;
23722
+ }
23723
+ function TableCellActionMenuContainer({
23724
+ menuPortalEl,
23725
+ positioningAnchorEl
23726
+ }) {
23727
+ const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
23728
+ const [tableCellNode, setTableMenuCellNode] = (0, import_react151.useState)(null);
23729
+ const [tableCellNodeEl, _setTableMenuCellNodeEl] = (0, import_react151.useState)(null);
23730
+ const [tableCellMenuPortalEl, setTableMenuCellMenuPortalEl] = (0, import_react151.useState)(null);
23731
+ (0, import_react151.useEffect)(() => {
23732
+ const newPortalEl = document.createElement("div");
23733
+ setTableMenuCellMenuPortalEl(newPortalEl);
23734
+ menuPortalEl.appendChild(newPortalEl);
23735
+ return () => {
23736
+ newPortalEl.remove();
23737
+ };
23738
+ }, [menuPortalEl]);
23739
+ const setTableMenuCellNodeElem = (0, import_react151.useCallback)((elem) => {
23740
+ if (elem) {
23741
+ _setTableMenuCellNodeEl(elem);
23742
+ } else {
23743
+ _setTableMenuCellNodeEl(null);
23739
23744
  }
23740
- return richTextBuiltInElements.filter(
23741
- (element) => {
23742
- var _a2, _b;
23743
- 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);
23745
+ }, []);
23746
+ const $moveMenu = (0, import_react151.useCallback)(() => {
23747
+ const selection = (0, import_lexical6.$getSelection)();
23748
+ const nativeSelection = window.getSelection();
23749
+ const activeElement = document.activeElement;
23750
+ if (selection == null) {
23751
+ setTableMenuCellNode(null);
23752
+ return;
23753
+ }
23754
+ const rootElement = editor.getRootElement();
23755
+ if ((0, import_lexical6.$isRangeSelection)(selection) && rootElement !== null && nativeSelection !== null && rootElement.contains(nativeSelection.anchorNode)) {
23756
+ const tableCellNodeFromSelection = (0, import_table.$getTableCellNodeFromLexicalNode)(selection.anchor.getNode());
23757
+ if (tableCellNodeFromSelection == null) {
23758
+ setTableMenuCellNode(null);
23759
+ setTableMenuCellNodeElem(null);
23760
+ return;
23744
23761
  }
23745
- );
23746
- }, [activeElement, (_a = config == null ? void 0 : config.elements) == null ? void 0 : _a.builtIn, enabledTextualElements]);
23747
- const [isLink, setIsLink] = (0, import_react150.useState)(false);
23748
- const linkElementVisible = (0, import_react150.useMemo)(() => {
23749
- return enabledBuiltInElements.some((element) => element.type === "link") || isLink;
23750
- }, [isLink, enabledBuiltInElements]);
23751
- const visibleLists = (0, import_react150.useMemo)(() => {
23752
- return new Set(
23753
- ["orderedList", "unorderedList"].filter(
23754
- (type) => enabledBuiltInElements.some((element) => element.type === type) || activeElement === type
23755
- )
23756
- );
23757
- }, [activeElement, enabledBuiltInElements]);
23758
- const quoteElementVisible = (0, import_react150.useMemo)(() => {
23759
- return enabledBuiltInElements.some((element) => element.type === "quote") || activeElement === "quote";
23760
- }, [activeElement, enabledBuiltInElements]);
23761
- const codeElementVisible = (0, import_react150.useMemo)(() => {
23762
- return enabledBuiltInElements.some((element) => element.type === "code") || activeElement === "code";
23763
- }, [activeElement, enabledBuiltInElements]);
23764
- const tableElementVisible = (0, import_react150.useMemo)(() => {
23765
- return enabledBuiltInElements.some((element) => element.type === "table") || activeElement === "table";
23766
- }, [activeElement, enabledBuiltInElements]);
23767
- const visibleElementsWithIcons = (0, import_react150.useMemo)(() => {
23768
- const visibleElements = /* @__PURE__ */ new Set();
23769
- if (linkElementVisible) {
23770
- visibleElements.add("link");
23762
+ const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
23763
+ if (tableCellParentNodeDOM == null) {
23764
+ setTableMenuCellNode(null);
23765
+ setTableMenuCellNodeElem(null);
23766
+ return;
23767
+ }
23768
+ setTableMenuCellNode(tableCellNodeFromSelection);
23769
+ setTableMenuCellNodeElem(tableCellParentNodeDOM);
23770
+ } else if (!activeElement) {
23771
+ setTableMenuCellNode(null);
23772
+ setTableMenuCellNodeElem(null);
23771
23773
  }
23772
- if (visibleLists.size > 0) {
23773
- visibleLists.forEach((type) => {
23774
- visibleElements.add(type);
23774
+ }, [editor, setTableMenuCellNodeElem]);
23775
+ (0, import_react151.useEffect)(() => {
23776
+ return editor.registerUpdateListener(() => {
23777
+ editor.getEditorState().read(() => {
23778
+ $moveMenu();
23775
23779
  });
23776
- }
23777
- return visibleElements;
23778
- }, [linkElementVisible, visibleLists]);
23779
- const visibleInsertElementsWithIcons = (0, import_react150.useMemo)(() => {
23780
- const visibleElements = /* @__PURE__ */ new Set();
23781
- if (quoteElementVisible) {
23782
- visibleElements.add("quote");
23783
- }
23784
- if (codeElementVisible) {
23785
- visibleElements.add("code");
23786
- }
23787
- if (tableElementVisible) {
23788
- visibleElements.add("table");
23789
- }
23790
- return visibleElements;
23791
- }, [codeElementVisible, quoteElementVisible, tableElementVisible]);
23792
- return {
23793
- activeFormats,
23794
- setActiveFormats,
23795
- activeElement,
23796
- setActiveElement,
23797
- visibleFormatsWithIcon,
23798
- visibleFormatsWithoutIcon,
23799
- visibleTextualElements,
23800
- isLink,
23801
- setIsLink,
23802
- linkElementVisible,
23803
- visibleLists,
23804
- quoteElementVisible,
23805
- codeElementVisible,
23806
- tableElementVisible,
23807
- visibleElementsWithIcons,
23808
- visibleInsertElementsWithIcons
23809
- };
23810
- };
23780
+ });
23781
+ });
23782
+ return tableCellNode != null && tableCellNodeEl != null && tableCellMenuPortalEl != null && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23783
+ TableActionMenu,
23784
+ {
23785
+ tableCellNode,
23786
+ menuPortalEl: tableCellMenuPortalEl,
23787
+ tableCellEl: tableCellNodeEl,
23788
+ positioningAnchorEl
23789
+ },
23790
+ tableCellNode.getKey()
23791
+ );
23792
+ }
23793
+ function TableActionMenuPlugin({
23794
+ positioningAnchorEl,
23795
+ menuPortalEl
23796
+ }) {
23797
+ const isEditable = (0, import_useLexicalEditable.useLexicalEditable)();
23798
+ return isEditable ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(TableCellActionMenuContainer, { menuPortalEl, positioningAnchorEl }) : null;
23799
+ }
23811
23800
 
23812
- // src/components/ParameterInputs/rich-text/TableActionMenuPlugin.tsx
23801
+ // src/components/ParameterInputs/rich-text/TableCellResizerPlugin.tsx
23813
23802
  init_emotion_jsx_shim();
23814
- var import_react151 = require("@emotion/react");
23815
- var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
23816
- var import_useLexicalEditable = require("@lexical/react/useLexicalEditable");
23803
+ var import_react152 = require("@emotion/react");
23804
+ var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
23805
+ var import_useLexicalEditable2 = require("@lexical/react/useLexicalEditable");
23817
23806
  var import_table2 = require("@lexical/table");
23818
- var import_lexical6 = require("lexical");
23819
- var import_react152 = require("react");
23807
+ var import_utils12 = require("@lexical/utils");
23808
+ var import_lexical7 = require("lexical");
23809
+ var import_react153 = require("react");
23810
+ var import_react_dom3 = require("react-dom");
23820
23811
  var import_jsx_runtime131 = require("@emotion/react/jsx-runtime");
23821
- function computeSelectionCount(selection) {
23822
- const selectionShape = selection.getShape();
23823
- return {
23824
- columns: selectionShape.toX - selectionShape.fromX + 1,
23825
- rows: selectionShape.toY - selectionShape.fromY + 1
23826
- };
23827
- }
23828
- var tableActionMenuTrigger = import_react151.css`
23812
+ var MIN_ROW_HEIGHT = 33;
23813
+ var MIN_COLUMN_WIDTH = 50;
23814
+ var tableResizer = import_react152.css`
23829
23815
  position: absolute;
23830
- transform: translate(calc(-100% - 1px), 1px);
23816
+ z-index: var(--z-10);
23831
23817
  `;
23832
- var TableActionMenuTrigger = (0, import_react152.forwardRef)((props, ref) => {
23833
- const { tableCellEl, positioningAnchorEl, ...rest } = props;
23834
- const [coordinates, setCoordinates] = (0, import_react152.useState)({ x: 0, y: 0 });
23835
- (0, import_react152.useLayoutEffect)(() => {
23836
- const rect = tableCellEl.getBoundingClientRect();
23837
- const parentRect = positioningAnchorEl.getBoundingClientRect();
23838
- const relativeX = rect.right - parentRect.left + positioningAnchorEl.scrollLeft;
23839
- const relativeY = rect.top - parentRect.top + positioningAnchorEl.scrollTop;
23840
- setCoordinates({ x: relativeX, y: relativeY });
23841
- }, [tableCellEl, positioningAnchorEl]);
23842
- return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23843
- IconButton,
23844
- {
23845
- ref,
23846
- css: [
23847
- tableActionMenuTrigger,
23848
- {
23849
- top: coordinates.y,
23850
- left: coordinates.x
23851
- }
23852
- ],
23853
- size: "xs",
23854
- buttonType: "unimportant",
23855
- ...rest,
23856
- children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon: "chevron-down", size: "1rem", iconColor: "currentColor" })
23818
+ var fixedGetDOMCellFromTarget = (node) => {
23819
+ let currentNode = node;
23820
+ while (currentNode != null) {
23821
+ const nodeName = currentNode.nodeName;
23822
+ if (nodeName === "TD" || nodeName === "TH") {
23823
+ const cell2 = currentNode._cell;
23824
+ if (cell2 === void 0) {
23825
+ return {
23826
+ elem: currentNode
23827
+ };
23828
+ }
23829
+ return cell2;
23857
23830
  }
23858
- );
23859
- });
23860
- TableActionMenuTrigger.displayName = "TableActionMenuTrigger";
23861
- function TableActionMenu({
23862
- tableCellNode: _tableCellNode,
23863
- menuPortalEl,
23864
- tableCellEl,
23865
- positioningAnchorEl
23866
- }) {
23867
- const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
23868
- const [tableCellNode, updateTableCellNode] = (0, import_react152.useState)(_tableCellNode);
23869
- const [selectionCounts, updateSelectionCounts] = (0, import_react152.useState)({
23870
- columns: 1,
23871
- rows: 1
23872
- });
23873
- const [menuTriggerKey, setMenuTriggerKey] = (0, import_react152.useState)(0);
23874
- const incrementMenuTriggerKey = () => {
23875
- setMenuTriggerKey((key) => key += 1);
23831
+ currentNode = currentNode.parentNode;
23832
+ }
23833
+ return null;
23834
+ };
23835
+ function TableCellResizer({ editor, positioningAnchorEl }) {
23836
+ const targetRef = (0, import_react153.useRef)(null);
23837
+ const resizerRef = (0, import_react153.useRef)(null);
23838
+ const tableRectRef = (0, import_react153.useRef)(null);
23839
+ const mouseStartPosRef = (0, import_react153.useRef)(null);
23840
+ const [mouseCurrentPos, updateMouseCurrentPos] = (0, import_react153.useState)(null);
23841
+ const [activeCell, updateActiveCell] = (0, import_react153.useState)(null);
23842
+ const [isMouseDown, updateIsMouseDown] = (0, import_react153.useState)(false);
23843
+ const [draggingDirection, updateDraggingDirection] = (0, import_react153.useState)(null);
23844
+ const resetState = (0, import_react153.useCallback)(() => {
23845
+ updateActiveCell(null);
23846
+ targetRef.current = null;
23847
+ updateDraggingDirection(null);
23848
+ mouseStartPosRef.current = null;
23849
+ tableRectRef.current = null;
23850
+ }, []);
23851
+ const isMouseDownOnEvent = (event) => {
23852
+ return (event.buttons & 1) === 1;
23876
23853
  };
23877
- (0, import_react152.useEffect)(() => {
23878
- return editor.registerMutationListener(
23879
- import_table2.TableCellNode,
23880
- (nodeMutations) => {
23881
- const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
23882
- if (nodeUpdated) {
23883
- editor.getEditorState().read(() => {
23884
- updateTableCellNode(tableCellNode.getLatest());
23854
+ (0, import_react153.useEffect)(() => {
23855
+ const onMouseMove = (event) => {
23856
+ setTimeout(() => {
23857
+ const target = event.target;
23858
+ if (draggingDirection) {
23859
+ updateMouseCurrentPos({
23860
+ x: event.clientX,
23861
+ y: event.clientY
23885
23862
  });
23863
+ return;
23886
23864
  }
23887
- },
23888
- { skipInitialization: true }
23889
- );
23890
- }, [editor, tableCellNode]);
23891
- (0, import_react152.useEffect)(() => {
23892
- editor.getEditorState().read(() => {
23893
- const selection = (0, import_lexical6.$getSelection)();
23894
- if ((0, import_table2.$isTableSelection)(selection)) {
23895
- updateSelectionCounts(computeSelectionCount(selection));
23896
- }
23897
- });
23898
- }, [editor]);
23899
- const clearTableSelection = (0, import_react152.useCallback)(() => {
23900
- editor.update(() => {
23901
- if (tableCellNode.isAttached()) {
23902
- const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23903
- const tableElement2 = editor.getElementByKey(
23904
- tableNode.getKey()
23905
- );
23906
- if (!tableElement2) {
23907
- throw new Error("Expected to find tableElement in DOM");
23865
+ updateIsMouseDown(isMouseDownOnEvent(event));
23866
+ if (resizerRef.current && resizerRef.current.contains(target)) {
23867
+ return;
23908
23868
  }
23909
- const tableSelection = (0, import_table2.getTableObserverFromTableElement)(tableElement2);
23910
- if (tableSelection !== null) {
23911
- tableSelection.clearHighlight();
23869
+ if (targetRef.current !== target) {
23870
+ targetRef.current = target;
23871
+ const cell2 = fixedGetDOMCellFromTarget(target);
23872
+ if (cell2 && activeCell !== cell2) {
23873
+ editor.update(() => {
23874
+ const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(cell2.elem);
23875
+ if (!tableCellNode) {
23876
+ throw new Error("TableCellResizer: Table cell node not found.");
23877
+ }
23878
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23879
+ const tableElement2 = editor.getElementByKey(tableNode.getKey());
23880
+ if (!tableElement2) {
23881
+ throw new Error("TableCellResizer: Table element not found.");
23882
+ }
23883
+ targetRef.current = target;
23884
+ tableRectRef.current = tableElement2.getBoundingClientRect();
23885
+ updateActiveCell(cell2);
23886
+ });
23887
+ } else if (cell2 == null) {
23888
+ resetState();
23889
+ }
23912
23890
  }
23913
- tableNode.markDirty();
23914
- updateTableCellNode(tableCellNode.getLatest());
23915
- }
23916
- const rootNode = (0, import_lexical6.$getRoot)();
23917
- rootNode.selectStart();
23891
+ }, 0);
23892
+ };
23893
+ const onMouseDown = () => {
23894
+ setTimeout(() => {
23895
+ updateIsMouseDown(true);
23896
+ }, 0);
23897
+ };
23898
+ const onMouseUp = () => {
23899
+ setTimeout(() => {
23900
+ updateIsMouseDown(false);
23901
+ }, 0);
23902
+ };
23903
+ const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {
23904
+ rootElement == null ? void 0 : rootElement.addEventListener("mousemove", onMouseMove);
23905
+ rootElement == null ? void 0 : rootElement.addEventListener("mousedown", onMouseDown);
23906
+ rootElement == null ? void 0 : rootElement.addEventListener("mouseup", onMouseUp);
23907
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousemove", onMouseMove);
23908
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousedown", onMouseDown);
23909
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mouseup", onMouseUp);
23918
23910
  });
23919
- }, [editor, tableCellNode]);
23920
- const insertTableRowAtSelection = (0, import_react152.useCallback)(
23921
- (shouldInsertAfter) => {
23922
- editor.update(() => {
23923
- (0, import_table2.$insertTableRow__EXPERIMENTAL)(shouldInsertAfter);
23924
- });
23925
- incrementMenuTriggerKey();
23911
+ return () => {
23912
+ removeRootListener();
23913
+ };
23914
+ }, [activeCell, draggingDirection, editor, resetState]);
23915
+ const isHeightChanging = (direction) => {
23916
+ if (direction === "bottom") {
23917
+ return true;
23918
+ }
23919
+ return false;
23920
+ };
23921
+ const updateRowHeight = (0, import_react153.useCallback)(
23922
+ (heightChange) => {
23923
+ if (!activeCell) {
23924
+ throw new Error("TableCellResizer: Expected active cell.");
23925
+ }
23926
+ editor.update(
23927
+ () => {
23928
+ const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
23929
+ if (!(0, import_table2.$isTableCellNode)(tableCellNode)) {
23930
+ throw new Error("TableCellResizer: Table cell node not found.");
23931
+ }
23932
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23933
+ const tableRowIndex = (0, import_table2.$getTableRowIndexFromTableCellNode)(tableCellNode);
23934
+ const tableRows = tableNode.getChildren();
23935
+ if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
23936
+ throw new Error("Expected table cell to be inside of table row.");
23937
+ }
23938
+ const tableRow2 = tableRows[tableRowIndex];
23939
+ if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
23940
+ throw new Error("Expected table row");
23941
+ }
23942
+ let height = tableRow2.getHeight();
23943
+ if (height === void 0) {
23944
+ const rowCells = tableRow2.getChildren();
23945
+ height = Math.min(...rowCells.map((cell2) => {
23946
+ var _a;
23947
+ return (_a = getCellNodeHeight(cell2, editor)) != null ? _a : Infinity;
23948
+ }));
23949
+ }
23950
+ const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);
23951
+ tableRow2.setHeight(newHeight);
23952
+ },
23953
+ { tag: "skip-scroll-into-view" }
23954
+ );
23926
23955
  },
23927
- [editor]
23956
+ [activeCell, editor]
23928
23957
  );
23929
- const insertTableColumnAtSelection = (0, import_react152.useCallback)(
23930
- (shouldInsertAfter) => {
23931
- editor.update(() => {
23932
- for (let i = 0; i < selectionCounts.columns; i++) {
23933
- (0, import_table2.$insertTableColumn__EXPERIMENTAL)(shouldInsertAfter);
23958
+ const getCellNodeWidth = (cell2, activeEditor) => {
23959
+ const width = cell2.getWidth();
23960
+ if (width !== void 0) {
23961
+ return width;
23962
+ }
23963
+ const domCellNode = activeEditor.getElementByKey(cell2.getKey());
23964
+ if (domCellNode == null) {
23965
+ return void 0;
23966
+ }
23967
+ const computedStyle = getComputedStyle(domCellNode);
23968
+ return domCellNode.clientWidth - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight);
23969
+ };
23970
+ const getCellNodeHeight = (cell2, activeEditor) => {
23971
+ const domCellNode = activeEditor.getElementByKey(cell2.getKey());
23972
+ return domCellNode == null ? void 0 : domCellNode.clientHeight;
23973
+ };
23974
+ const getCellColumnIndex = (tableCellNode, tableMap) => {
23975
+ for (let row = 0; row < tableMap.length; row++) {
23976
+ for (let column = 0; column < tableMap[row].length; column++) {
23977
+ if (tableMap[row][column].cell === tableCellNode) {
23978
+ return column;
23934
23979
  }
23935
- });
23936
- incrementMenuTriggerKey();
23937
- },
23938
- [editor, selectionCounts.columns]
23939
- );
23940
- const deleteTableRowAtSelection = (0, import_react152.useCallback)(() => {
23941
- editor.update(() => {
23942
- (0, import_table2.$deleteTableRow__EXPERIMENTAL)();
23943
- });
23944
- incrementMenuTriggerKey();
23945
- }, [editor]);
23946
- const deleteTableAtSelection = (0, import_react152.useCallback)(() => {
23947
- editor.update(() => {
23948
- const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23949
- tableNode.remove();
23950
- clearTableSelection();
23951
- });
23952
- }, [editor, tableCellNode, clearTableSelection]);
23953
- const deleteTableColumnAtSelection = (0, import_react152.useCallback)(() => {
23954
- editor.update(() => {
23955
- (0, import_table2.$deleteTableColumn__EXPERIMENTAL)();
23956
- });
23957
- incrementMenuTriggerKey();
23958
- }, [editor]);
23959
- const toggleTableRowIsHeader = (0, import_react152.useCallback)(() => {
23960
- editor.update(() => {
23961
- const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23962
- const tableRowIndex = (0, import_table2.$getTableRowIndexFromTableCellNode)(tableCellNode);
23963
- const tableRows = tableNode.getChildren();
23964
- if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
23965
- throw new Error("Expected table cell to be inside of table row.");
23966
- }
23967
- const tableRow2 = tableRows[tableRowIndex];
23968
- if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
23969
- throw new Error("Expected table row");
23970
23980
  }
23971
- tableRow2.getChildren().forEach((tableCell) => {
23972
- if (!(0, import_table2.$isTableCellNode)(tableCell)) {
23973
- throw new Error("Expected table cell");
23974
- }
23975
- tableCell.toggleHeaderStyle(import_table2.TableCellHeaderStates.ROW);
23976
- });
23977
- clearTableSelection();
23978
- });
23979
- }, [editor, tableCellNode, clearTableSelection]);
23980
- const toggleTableColumnIsHeader = (0, import_react152.useCallback)(() => {
23981
- editor.update(() => {
23982
- const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23983
- const tableColumnIndex = (0, import_table2.$getTableColumnIndexFromTableCellNode)(tableCellNode);
23984
- const tableRows = tableNode.getChildren();
23985
- const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length));
23986
- if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {
23987
- throw new Error("Expected table cell to be inside of table row.");
23981
+ }
23982
+ };
23983
+ const updateColumnWidth = (0, import_react153.useCallback)(
23984
+ (widthChange) => {
23985
+ if (!activeCell) {
23986
+ throw new Error("TableCellResizer: Expected active cell.");
23988
23987
  }
23989
- for (let r = 0; r < tableRows.length; r++) {
23990
- const tableRow2 = tableRows[r];
23991
- if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
23992
- throw new Error("Expected table row");
23988
+ editor.update(
23989
+ () => {
23990
+ const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
23991
+ if (!(0, import_table2.$isTableCellNode)(tableCellNode)) {
23992
+ throw new Error("TableCellResizer: Table cell node not found.");
23993
+ }
23994
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23995
+ const [tableMap] = (0, import_table2.$computeTableMapSkipCellCheck)(tableNode, null, null);
23996
+ const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
23997
+ if (columnIndex === void 0) {
23998
+ throw new Error("TableCellResizer: Table column not found.");
23999
+ }
24000
+ for (let row = 0; row < tableMap.length; row++) {
24001
+ const cell2 = tableMap[row][columnIndex];
24002
+ if (cell2.startRow === row && (columnIndex === tableMap[row].length - 1 || tableMap[row][columnIndex].cell !== tableMap[row][columnIndex + 1].cell)) {
24003
+ const width = getCellNodeWidth(cell2.cell, editor);
24004
+ if (width === void 0) {
24005
+ continue;
24006
+ }
24007
+ const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);
24008
+ cell2.cell.setWidth(newWidth);
24009
+ }
24010
+ }
24011
+ },
24012
+ { tag: "skip-scroll-into-view" }
24013
+ );
24014
+ },
24015
+ [activeCell, editor]
24016
+ );
24017
+ const mouseUpHandler = (0, import_react153.useCallback)(
24018
+ (direction) => {
24019
+ const handler = (event) => {
24020
+ event.preventDefault();
24021
+ event.stopPropagation();
24022
+ if (!activeCell) {
24023
+ throw new Error("TableCellResizer: Expected active cell.");
23993
24024
  }
23994
- const tableCells = tableRow2.getChildren();
23995
- if (tableColumnIndex >= tableCells.length) {
23996
- continue;
23997
- }
23998
- const tableCell = tableCells[tableColumnIndex];
23999
- if (!(0, import_table2.$isTableCellNode)(tableCell)) {
24000
- throw new Error("Expected table cell");
24025
+ if (mouseStartPosRef.current) {
24026
+ const { x, y } = mouseStartPosRef.current;
24027
+ if (activeCell === null) {
24028
+ return;
24029
+ }
24030
+ const zoom = (0, import_utils12.calculateZoomLevel)(event.target);
24031
+ if (isHeightChanging(direction)) {
24032
+ const heightChange = (event.clientY - y) / zoom;
24033
+ updateRowHeight(heightChange);
24034
+ } else {
24035
+ const widthChange = (event.clientX - x) / zoom;
24036
+ updateColumnWidth(widthChange);
24037
+ }
24038
+ resetState();
24039
+ document.removeEventListener("mouseup", handler);
24001
24040
  }
24002
- tableCell.toggleHeaderStyle(import_table2.TableCellHeaderStates.COLUMN);
24041
+ };
24042
+ return handler;
24043
+ },
24044
+ [activeCell, resetState, updateColumnWidth, updateRowHeight]
24045
+ );
24046
+ const toggleResize = (0, import_react153.useCallback)(
24047
+ (direction) => (event) => {
24048
+ event.preventDefault();
24049
+ event.stopPropagation();
24050
+ if (!activeCell) {
24051
+ throw new Error("TableCellResizer: Expected active cell.");
24003
24052
  }
24004
- clearTableSelection();
24005
- });
24006
- }, [editor, tableCellNode, clearTableSelection]);
24007
- const menuItemCss = (0, import_react151.css)({
24008
- fontSize: "var(--fs-sm)"
24009
- });
24010
- return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
24011
- Menu,
24012
- {
24013
- menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
24014
- TableActionMenuTrigger,
24015
- {
24016
- tableCellEl,
24017
- positioningAnchorEl
24053
+ mouseStartPosRef.current = {
24054
+ x: event.clientX,
24055
+ y: event.clientY
24056
+ };
24057
+ updateMouseCurrentPos(mouseStartPosRef.current);
24058
+ updateDraggingDirection(direction);
24059
+ document.addEventListener("mouseup", mouseUpHandler(direction));
24060
+ },
24061
+ [activeCell, mouseUpHandler]
24062
+ );
24063
+ const getResizers = (0, import_react153.useCallback)(() => {
24064
+ if (activeCell) {
24065
+ const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
24066
+ const parentRect = positioningAnchorEl.getBoundingClientRect();
24067
+ const zoom = (0, import_utils12.calculateZoomLevel)(activeCell.elem);
24068
+ const zoneWidth = 10;
24069
+ const styles = {
24070
+ bottom: {
24071
+ backgroundColor: "none",
24072
+ cursor: "row-resize",
24073
+ height: `${zoneWidth}px`,
24074
+ left: `${left - parentRect.left}px`,
24075
+ top: `${top - parentRect.top + positioningAnchorEl.scrollTop + height - zoneWidth / 2}px`,
24076
+ width: `${width}px`
24018
24077
  },
24019
- menuTriggerKey
24020
- ),
24021
- portalElement: menuPortalEl,
24022
- maxMenuHeight: "300px",
24023
- children: [
24024
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
24025
- MenuItem,
24026
- {
24027
- onClick: () => {
24028
- insertTableRowAtSelection(false);
24029
- },
24030
- css: menuItemCss,
24031
- children: [
24032
- "Insert ",
24033
- selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
24034
- " above"
24035
- ]
24036
- }
24037
- ),
24038
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => insertTableRowAtSelection(true), css: menuItemCss, children: [
24039
- "Insert ",
24040
- selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
24041
- " below"
24042
- ] }),
24043
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItemSeparator, {}),
24044
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(false), css: menuItemCss, children: [
24045
- "Insert ",
24046
- selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
24047
- " left"
24048
- ] }),
24049
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(true), css: menuItemCss, children: [
24050
- "Insert ",
24051
- selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
24052
- " right"
24053
- ] }),
24054
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItemSeparator, {}),
24055
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItem, { onClick: () => deleteTableColumnAtSelection(), css: menuItemCss, children: "Delete column" }),
24056
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItem, { onClick: () => deleteTableRowAtSelection(), css: menuItemCss, children: "Delete row" }),
24057
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItem, { onClick: () => deleteTableAtSelection(), css: menuItemCss, children: "Delete table" }),
24058
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItemSeparator, {}),
24059
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => toggleTableRowIsHeader(), css: menuItemCss, children: [
24060
- (tableCellNode.__headerState & import_table2.TableCellHeaderStates.ROW) === import_table2.TableCellHeaderStates.ROW ? "Remove" : "Add",
24061
- " ",
24062
- "row header"
24063
- ] }),
24064
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => toggleTableColumnIsHeader(), css: menuItemCss, children: [
24065
- (tableCellNode.__headerState & import_table2.TableCellHeaderStates.COLUMN) === import_table2.TableCellHeaderStates.COLUMN ? "Remove" : "Add",
24066
- " ",
24067
- "column header"
24068
- ] })
24069
- ]
24078
+ right: {
24079
+ backgroundColor: "none",
24080
+ cursor: "col-resize",
24081
+ height: `${height}px`,
24082
+ left: `${left - parentRect.left + width - zoneWidth / 2}px`,
24083
+ top: `${top - parentRect.top + positioningAnchorEl.scrollTop}px`,
24084
+ width: `${zoneWidth}px`
24085
+ }
24086
+ };
24087
+ const tableRect = tableRectRef.current;
24088
+ if (draggingDirection && mouseCurrentPos && tableRect) {
24089
+ if (isHeightChanging(draggingDirection)) {
24090
+ styles[draggingDirection].left = `${tableRect.left - parentRect.left}px`;
24091
+ styles[draggingDirection].top = `${(mouseCurrentPos.y - parentRect.top + positioningAnchorEl.scrollTop) / zoom}px`;
24092
+ styles[draggingDirection].height = "3px";
24093
+ styles[draggingDirection].width = `${tableRect.width}px`;
24094
+ } else {
24095
+ styles[draggingDirection].top = `${tableRect.top - parentRect.top + positioningAnchorEl.scrollTop}px`;
24096
+ styles[draggingDirection].left = `${(mouseCurrentPos.x - parentRect.left) / zoom}px`;
24097
+ styles[draggingDirection].width = "3px";
24098
+ styles[draggingDirection].height = `${tableRect.height}px`;
24099
+ }
24100
+ styles[draggingDirection].backgroundColor = "#adf";
24101
+ }
24102
+ return styles;
24070
24103
  }
24071
- );
24072
- }
24073
- function TableCellActionMenuContainer({
24074
- menuPortalEl,
24075
- positioningAnchorEl
24076
- }) {
24077
- const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
24078
- const [tableCellNode, setTableMenuCellNode] = (0, import_react152.useState)(null);
24079
- const [tableCellNodeEl, _setTableMenuCellNodeEl] = (0, import_react152.useState)(null);
24080
- const [tableCellMenuPortalEl, setTableMenuCellMenuPortalEl] = (0, import_react152.useState)(null);
24081
- (0, import_react152.useEffect)(() => {
24082
- const newPortalEl = document.createElement("div");
24083
- setTableMenuCellMenuPortalEl(newPortalEl);
24084
- menuPortalEl.appendChild(newPortalEl);
24085
- return () => {
24086
- newPortalEl.remove();
24104
+ return {
24105
+ bottom: null,
24106
+ left: null,
24107
+ right: null,
24108
+ top: null
24087
24109
  };
24088
- }, [menuPortalEl]);
24089
- const setTableMenuCellNodeElem = (0, import_react152.useCallback)((elem) => {
24090
- if (elem) {
24091
- _setTableMenuCellNodeEl(elem);
24092
- } else {
24093
- _setTableMenuCellNodeEl(null);
24094
- }
24095
- }, []);
24096
- const $moveMenu = (0, import_react152.useCallback)(() => {
24097
- const selection = (0, import_lexical6.$getSelection)();
24098
- const nativeSelection = window.getSelection();
24099
- const activeElement = document.activeElement;
24100
- if (selection == null) {
24101
- setTableMenuCellNode(null);
24102
- return;
24103
- }
24104
- const rootElement = editor.getRootElement();
24105
- if ((0, import_lexical6.$isRangeSelection)(selection) && rootElement !== null && nativeSelection !== null && rootElement.contains(nativeSelection.anchorNode)) {
24106
- const tableCellNodeFromSelection = (0, import_table2.$getTableCellNodeFromLexicalNode)(selection.anchor.getNode());
24107
- if (tableCellNodeFromSelection == null) {
24108
- setTableMenuCellNode(null);
24109
- setTableMenuCellNodeElem(null);
24110
- return;
24110
+ }, [activeCell, draggingDirection, mouseCurrentPos, positioningAnchorEl]);
24111
+ const resizerStyles = getResizers();
24112
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { ref: resizerRef, children: activeCell != null && !isMouseDown && /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
24113
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
24114
+ "div",
24115
+ {
24116
+ css: tableResizer,
24117
+ style: resizerStyles.right || void 0,
24118
+ onMouseDown: toggleResize("right")
24111
24119
  }
24112
- const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
24113
- if (tableCellParentNodeDOM == null) {
24114
- setTableMenuCellNode(null);
24115
- setTableMenuCellNodeElem(null);
24116
- return;
24120
+ ),
24121
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
24122
+ "div",
24123
+ {
24124
+ css: tableResizer,
24125
+ style: resizerStyles.bottom || void 0,
24126
+ onMouseDown: toggleResize("bottom")
24117
24127
  }
24118
- setTableMenuCellNode(tableCellNodeFromSelection);
24119
- setTableMenuCellNodeElem(tableCellParentNodeDOM);
24120
- } else if (!activeElement) {
24121
- setTableMenuCellNode(null);
24122
- setTableMenuCellNodeElem(null);
24123
- }
24124
- }, [editor, setTableMenuCellNodeElem]);
24125
- (0, import_react152.useEffect)(() => {
24126
- return editor.registerUpdateListener(() => {
24127
- editor.getEditorState().read(() => {
24128
- $moveMenu();
24129
- });
24130
- });
24131
- });
24132
- return tableCellNode != null && tableCellNodeEl != null && tableCellMenuPortalEl != null && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
24133
- TableActionMenu,
24134
- {
24135
- tableCellNode,
24136
- menuPortalEl: tableCellMenuPortalEl,
24137
- tableCellEl: tableCellNodeEl,
24128
+ )
24129
+ ] }) });
24130
+ }
24131
+ function TableCellResizerPlugin({ positioningAnchorEl }) {
24132
+ const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
24133
+ const isEditable = (0, import_useLexicalEditable2.useLexicalEditable)();
24134
+ return (0, import_react153.useMemo)(
24135
+ () => isEditable ? (0, import_react_dom3.createPortal)(
24136
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(TableCellResizer, { editor, positioningAnchorEl }),
24138
24137
  positioningAnchorEl
24139
- },
24140
- tableCellNode.getKey()
24138
+ ) : null,
24139
+ [editor, isEditable, positioningAnchorEl]
24141
24140
  );
24142
24141
  }
24143
- function TableActionMenuPlugin({
24144
- positioningAnchorEl,
24145
- menuPortalEl
24146
- }) {
24147
- const isEditable = (0, import_useLexicalEditable.useLexicalEditable)();
24148
- return isEditable ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(TableCellActionMenuContainer, { menuPortalEl, positioningAnchorEl }) : null;
24149
- }
24150
24142
 
24151
- // src/components/ParameterInputs/rich-text/TableCellResizerPlugin.tsx
24143
+ // src/components/ParameterInputs/rich-text/TableSelectionPlugin.tsx
24152
24144
  init_emotion_jsx_shim();
24153
- var import_react153 = require("@emotion/react");
24154
- var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
24155
- var import_useLexicalEditable2 = require("@lexical/react/useLexicalEditable");
24145
+ var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
24156
24146
  var import_table3 = require("@lexical/table");
24157
- var import_utils12 = require("@lexical/utils");
24158
- var import_lexical7 = require("lexical");
24147
+ var import_lexical8 = require("lexical");
24159
24148
  var import_react154 = require("react");
24160
- var import_react_dom3 = require("react-dom");
24161
- var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
24162
- var MIN_ROW_HEIGHT = 33;
24163
- var MIN_COLUMN_WIDTH = 50;
24164
- var tableResizer = import_react153.css`
24165
- position: absolute;
24166
- z-index: var(--z-10);
24167
- `;
24168
- var fixedGetDOMCellFromTarget = (node) => {
24169
- let currentNode = node;
24170
- while (currentNode != null) {
24171
- const nodeName = currentNode.nodeName;
24172
- if (nodeName === "TD" || nodeName === "TH") {
24173
- const cell2 = currentNode._cell;
24174
- if (cell2 === void 0) {
24175
- return {
24176
- elem: currentNode
24177
- };
24178
- }
24179
- return cell2;
24180
- }
24181
- currentNode = currentNode.parentNode;
24182
- }
24183
- return null;
24184
- };
24185
- function TableCellResizer({ editor, positioningAnchorEl }) {
24186
- const targetRef = (0, import_react154.useRef)(null);
24187
- const resizerRef = (0, import_react154.useRef)(null);
24188
- const tableRectRef = (0, import_react154.useRef)(null);
24189
- const mouseStartPosRef = (0, import_react154.useRef)(null);
24190
- const [mouseCurrentPos, updateMouseCurrentPos] = (0, import_react154.useState)(null);
24191
- const [activeCell, updateActiveCell] = (0, import_react154.useState)(null);
24192
- const [isMouseDown, updateIsMouseDown] = (0, import_react154.useState)(false);
24193
- const [draggingDirection, updateDraggingDirection] = (0, import_react154.useState)(null);
24194
- const resetState = (0, import_react154.useCallback)(() => {
24195
- updateActiveCell(null);
24196
- targetRef.current = null;
24197
- updateDraggingDirection(null);
24198
- mouseStartPosRef.current = null;
24199
- tableRectRef.current = null;
24200
- }, []);
24201
- const isMouseDownOnEvent = (event) => {
24202
- return (event.buttons & 1) === 1;
24203
- };
24149
+ var TableSelectionPlugin = () => {
24150
+ const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
24151
+ const [closestTableCellNode, setClosestTableCellNode] = (0, import_react154.useState)(null);
24204
24152
  (0, import_react154.useEffect)(() => {
24205
- const onMouseMove = (event) => {
24206
- setTimeout(() => {
24207
- const target = event.target;
24208
- if (draggingDirection) {
24209
- updateMouseCurrentPos({
24210
- x: event.clientX,
24211
- y: event.clientY
24212
- });
24213
- return;
24214
- }
24215
- updateIsMouseDown(isMouseDownOnEvent(event));
24216
- if (resizerRef.current && resizerRef.current.contains(target)) {
24217
- return;
24218
- }
24219
- if (targetRef.current !== target) {
24220
- targetRef.current = target;
24221
- const cell2 = fixedGetDOMCellFromTarget(target);
24222
- if (cell2 && activeCell !== cell2) {
24223
- editor.update(() => {
24224
- const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(cell2.elem);
24225
- if (!tableCellNode) {
24226
- throw new Error("TableCellResizer: Table cell node not found.");
24227
- }
24228
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24229
- const tableElement2 = editor.getElementByKey(tableNode.getKey());
24230
- if (!tableElement2) {
24231
- throw new Error("TableCellResizer: Table element not found.");
24232
- }
24233
- targetRef.current = target;
24234
- tableRectRef.current = tableElement2.getBoundingClientRect();
24235
- updateActiveCell(cell2);
24236
- });
24237
- } else if (cell2 == null) {
24238
- resetState();
24153
+ return editor.registerCommand(
24154
+ import_lexical8.SELECTION_CHANGE_COMMAND,
24155
+ () => {
24156
+ editor.read(() => {
24157
+ const selection = (0, import_lexical8.$getSelection)();
24158
+ if (!(0, import_lexical8.$isRangeSelection)(selection) || !selection.isCollapsed()) {
24159
+ setClosestTableCellNode(null);
24160
+ return false;
24161
+ }
24162
+ const tableCellNode = (0, import_table3.$findCellNode)(selection.anchor.getNode());
24163
+ if (tableCellNode === null) {
24164
+ setClosestTableCellNode(null);
24165
+ return false;
24239
24166
  }
24167
+ setClosestTableCellNode(tableCellNode);
24168
+ });
24169
+ return false;
24170
+ },
24171
+ import_lexical8.COMMAND_PRIORITY_NORMAL
24172
+ );
24173
+ }, [editor]);
24174
+ (0, import_react154.useEffect)(() => {
24175
+ const onControlA = (event) => {
24176
+ if (event.key === "a" && (event.ctrlKey || event.metaKey)) {
24177
+ if (!closestTableCellNode) {
24178
+ return;
24240
24179
  }
24241
- }, 0);
24242
- };
24243
- const onMouseDown = () => {
24244
- setTimeout(() => {
24245
- updateIsMouseDown(true);
24246
- }, 0);
24247
- };
24248
- const onMouseUp = () => {
24249
- setTimeout(() => {
24250
- updateIsMouseDown(false);
24251
- }, 0);
24180
+ event.preventDefault();
24181
+ editor.update(() => {
24182
+ const selection = closestTableCellNode.select(0, closestTableCellNode.getChildrenSize());
24183
+ (0, import_lexical8.$setSelection)(selection);
24184
+ });
24185
+ }
24252
24186
  };
24253
- const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {
24254
- rootElement == null ? void 0 : rootElement.addEventListener("mousemove", onMouseMove);
24255
- rootElement == null ? void 0 : rootElement.addEventListener("mousedown", onMouseDown);
24256
- rootElement == null ? void 0 : rootElement.addEventListener("mouseup", onMouseUp);
24257
- prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousemove", onMouseMove);
24258
- prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousedown", onMouseDown);
24259
- prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mouseup", onMouseUp);
24187
+ return editor.registerRootListener((rootElement, prevRootElement) => {
24188
+ rootElement == null ? void 0 : rootElement.addEventListener("keydown", onControlA);
24189
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("keydown", onControlA);
24260
24190
  });
24261
- return () => {
24262
- removeRootListener();
24263
- };
24264
- }, [activeCell, draggingDirection, editor, resetState]);
24265
- const isHeightChanging = (direction) => {
24266
- if (direction === "bottom") {
24267
- return true;
24191
+ }, [editor, closestTableCellNode]);
24192
+ return null;
24193
+ };
24194
+ var TableSelectionPlugin_default = TableSelectionPlugin;
24195
+
24196
+ // src/components/ParameterInputs/rich-text/toolbar/RichTextToolbar.tsx
24197
+ init_emotion_jsx_shim();
24198
+ var import_react156 = require("@emotion/react");
24199
+ var import_code2 = require("@lexical/code");
24200
+ var import_list2 = require("@lexical/list");
24201
+ var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
24202
+ var import_rich_text = require("@lexical/rich-text");
24203
+ var import_selection2 = require("@lexical/selection");
24204
+ var import_table4 = require("@lexical/table");
24205
+ var import_utils13 = require("@lexical/utils");
24206
+ var import_lexical9 = require("lexical");
24207
+ var import_react157 = require("react");
24208
+
24209
+ // src/components/ParameterInputs/rich-text/toolbar/constants.ts
24210
+ init_emotion_jsx_shim();
24211
+ var FORMATS_WITH_ICON = /* @__PURE__ */ new Map([
24212
+ ["bold", "format-bold"],
24213
+ ["italic", "format-italic"],
24214
+ ["underline", "format-underline"],
24215
+ ["strikethrough", "format-strike"],
24216
+ ["code", "format-code"],
24217
+ ["superscript", "format-superscript"],
24218
+ ["subscript", "format-subscript"]
24219
+ ]);
24220
+ var HEADING_ELEMENTS = ["h1", "h2", "h3", "h4", "h5", "h6"];
24221
+ var TEXTUAL_ELEMENTS = HEADING_ELEMENTS;
24222
+
24223
+ // src/components/ParameterInputs/rich-text/toolbar/useRichTextToolbarState.ts
24224
+ init_emotion_jsx_shim();
24225
+ var import_react155 = require("react");
24226
+ var useRichTextToolbarState = ({ config }) => {
24227
+ var _a;
24228
+ const enabledBuiltInFormats = (0, import_react155.useMemo)(() => {
24229
+ return richTextBuiltInFormats.filter((format) => {
24230
+ var _a2, _b;
24231
+ return (_b = (_a2 = config == null ? void 0 : config.formatting) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(format.type);
24232
+ });
24233
+ }, [config]);
24234
+ const enabledBuiltInElements = (0, import_react155.useMemo)(() => {
24235
+ return richTextBuiltInElements.filter((element) => {
24236
+ var _a2, _b;
24237
+ return (_b = (_a2 = config == null ? void 0 : config.elements) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(element.type);
24238
+ });
24239
+ }, [config]);
24240
+ const enabledBuiltInFormatsWithIcon = (0, import_react155.useMemo)(() => {
24241
+ return enabledBuiltInFormats.filter((format) => FORMATS_WITH_ICON.has(format.type));
24242
+ }, [enabledBuiltInFormats]);
24243
+ const enabledBuiltInFormatsWithoutIcon = enabledBuiltInFormats.filter(
24244
+ (format) => !FORMATS_WITH_ICON.has(format.type)
24245
+ );
24246
+ const [activeFormats, setActiveFormats] = (0, import_react155.useState)([]);
24247
+ const visibleFormatsWithIcon = (0, import_react155.useMemo)(() => {
24248
+ const visibleFormats = /* @__PURE__ */ new Set();
24249
+ activeFormats.filter((type) => FORMATS_WITH_ICON.has(type)).forEach((type) => {
24250
+ visibleFormats.add(type);
24251
+ });
24252
+ enabledBuiltInFormatsWithIcon.forEach((format) => {
24253
+ visibleFormats.add(format.type);
24254
+ });
24255
+ return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
24256
+ }, [activeFormats, enabledBuiltInFormatsWithIcon]);
24257
+ const visibleFormatsWithoutIcon = (0, import_react155.useMemo)(() => {
24258
+ const visibleFormats = /* @__PURE__ */ new Set();
24259
+ activeFormats.filter((type) => !FORMATS_WITH_ICON.has(type)).forEach((type) => {
24260
+ visibleFormats.add(type);
24261
+ });
24262
+ enabledBuiltInFormatsWithoutIcon.forEach((format) => {
24263
+ visibleFormats.add(format.type);
24264
+ });
24265
+ return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
24266
+ }, [activeFormats, enabledBuiltInFormatsWithoutIcon]);
24267
+ const [activeElement, setActiveElement] = (0, import_react155.useState)("paragraph");
24268
+ const enabledTextualElements = enabledBuiltInElements.filter(
24269
+ (element) => TEXTUAL_ELEMENTS.includes(element.type)
24270
+ );
24271
+ const visibleTextualElements = (0, import_react155.useMemo)(() => {
24272
+ if (!TEXTUAL_ELEMENTS.includes(activeElement)) {
24273
+ return enabledTextualElements;
24268
24274
  }
24269
- return false;
24270
- };
24271
- const updateRowHeight = (0, import_react154.useCallback)(
24272
- (heightChange) => {
24273
- if (!activeCell) {
24274
- throw new Error("TableCellResizer: Expected active cell.");
24275
+ return richTextBuiltInElements.filter(
24276
+ (element) => {
24277
+ var _a2, _b;
24278
+ 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);
24275
24279
  }
24276
- editor.update(
24277
- () => {
24278
- const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
24279
- if (!(0, import_table3.$isTableCellNode)(tableCellNode)) {
24280
- throw new Error("TableCellResizer: Table cell node not found.");
24281
- }
24282
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24283
- const tableRowIndex = (0, import_table3.$getTableRowIndexFromTableCellNode)(tableCellNode);
24284
- const tableRows = tableNode.getChildren();
24285
- if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
24286
- throw new Error("Expected table cell to be inside of table row.");
24287
- }
24288
- const tableRow2 = tableRows[tableRowIndex];
24289
- if (!(0, import_table3.$isTableRowNode)(tableRow2)) {
24290
- throw new Error("Expected table row");
24291
- }
24292
- let height = tableRow2.getHeight();
24293
- if (height === void 0) {
24294
- const rowCells = tableRow2.getChildren();
24295
- height = Math.min(...rowCells.map((cell2) => {
24296
- var _a;
24297
- return (_a = getCellNodeHeight(cell2, editor)) != null ? _a : Infinity;
24298
- }));
24299
- }
24300
- const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);
24301
- tableRow2.setHeight(newHeight);
24302
- },
24303
- { tag: "skip-scroll-into-view" }
24304
- );
24305
- },
24306
- [activeCell, editor]
24307
- );
24308
- const getCellNodeWidth = (cell2, activeEditor) => {
24309
- const width = cell2.getWidth();
24310
- if (width !== void 0) {
24311
- return width;
24280
+ );
24281
+ }, [activeElement, (_a = config == null ? void 0 : config.elements) == null ? void 0 : _a.builtIn, enabledTextualElements]);
24282
+ const [isLink, setIsLink] = (0, import_react155.useState)(false);
24283
+ const linkElementVisible = (0, import_react155.useMemo)(() => {
24284
+ return enabledBuiltInElements.some((element) => element.type === "link") || isLink;
24285
+ }, [isLink, enabledBuiltInElements]);
24286
+ const visibleLists = (0, import_react155.useMemo)(() => {
24287
+ return new Set(
24288
+ ["orderedList", "unorderedList"].filter(
24289
+ (type) => enabledBuiltInElements.some((element) => element.type === type) || activeElement === type
24290
+ )
24291
+ );
24292
+ }, [activeElement, enabledBuiltInElements]);
24293
+ const quoteElementVisible = (0, import_react155.useMemo)(() => {
24294
+ return enabledBuiltInElements.some((element) => element.type === "quote") || activeElement === "quote";
24295
+ }, [activeElement, enabledBuiltInElements]);
24296
+ const codeElementVisible = (0, import_react155.useMemo)(() => {
24297
+ return enabledBuiltInElements.some((element) => element.type === "code") || activeElement === "code";
24298
+ }, [activeElement, enabledBuiltInElements]);
24299
+ const tableElementVisible = (0, import_react155.useMemo)(() => {
24300
+ return enabledBuiltInElements.some((element) => element.type === "table") || activeElement === "table";
24301
+ }, [activeElement, enabledBuiltInElements]);
24302
+ const assetElementVisible = (0, import_react155.useMemo)(() => {
24303
+ return enabledBuiltInElements.some((element) => element.type === "asset") || activeElement === "asset";
24304
+ }, [activeElement, enabledBuiltInElements]);
24305
+ const visibleElementsWithIcons = (0, import_react155.useMemo)(() => {
24306
+ const visibleElements = /* @__PURE__ */ new Set();
24307
+ if (linkElementVisible) {
24308
+ visibleElements.add("link");
24312
24309
  }
24313
- const domCellNode = activeEditor.getElementByKey(cell2.getKey());
24314
- if (domCellNode == null) {
24315
- return void 0;
24310
+ if (visibleLists.size > 0) {
24311
+ visibleLists.forEach((type) => {
24312
+ visibleElements.add(type);
24313
+ });
24316
24314
  }
24317
- const computedStyle = getComputedStyle(domCellNode);
24318
- return domCellNode.clientWidth - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight);
24319
- };
24320
- const getCellNodeHeight = (cell2, activeEditor) => {
24321
- const domCellNode = activeEditor.getElementByKey(cell2.getKey());
24322
- return domCellNode == null ? void 0 : domCellNode.clientHeight;
24323
- };
24324
- const getCellColumnIndex = (tableCellNode, tableMap) => {
24325
- for (let row = 0; row < tableMap.length; row++) {
24326
- for (let column = 0; column < tableMap[row].length; column++) {
24327
- if (tableMap[row][column].cell === tableCellNode) {
24328
- return column;
24329
- }
24330
- }
24315
+ return visibleElements;
24316
+ }, [linkElementVisible, visibleLists]);
24317
+ const visibleInsertElementsWithIcons = (0, import_react155.useMemo)(() => {
24318
+ const visibleElements = /* @__PURE__ */ new Set();
24319
+ if (quoteElementVisible) {
24320
+ visibleElements.add("quote");
24321
+ }
24322
+ if (codeElementVisible) {
24323
+ visibleElements.add("code");
24324
+ }
24325
+ if (tableElementVisible) {
24326
+ visibleElements.add("table");
24331
24327
  }
24328
+ if (assetElementVisible) {
24329
+ visibleElements.add("asset");
24330
+ }
24331
+ return visibleElements;
24332
+ }, [codeElementVisible, quoteElementVisible, tableElementVisible, assetElementVisible]);
24333
+ return {
24334
+ activeFormats,
24335
+ setActiveFormats,
24336
+ activeElement,
24337
+ setActiveElement,
24338
+ visibleFormatsWithIcon,
24339
+ visibleFormatsWithoutIcon,
24340
+ visibleTextualElements,
24341
+ isLink,
24342
+ setIsLink,
24343
+ linkElementVisible,
24344
+ visibleLists,
24345
+ quoteElementVisible,
24346
+ codeElementVisible,
24347
+ tableElementVisible,
24348
+ assetElementVisible,
24349
+ visibleElementsWithIcons,
24350
+ visibleInsertElementsWithIcons
24332
24351
  };
24333
- const updateColumnWidth = (0, import_react154.useCallback)(
24334
- (widthChange) => {
24335
- if (!activeCell) {
24336
- throw new Error("TableCellResizer: Expected active cell.");
24337
- }
24338
- editor.update(
24339
- () => {
24340
- const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
24341
- if (!(0, import_table3.$isTableCellNode)(tableCellNode)) {
24342
- throw new Error("TableCellResizer: Table cell node not found.");
24343
- }
24344
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24345
- const [tableMap] = (0, import_table3.$computeTableMapSkipCellCheck)(tableNode, null, null);
24346
- const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
24347
- if (columnIndex === void 0) {
24348
- throw new Error("TableCellResizer: Table column not found.");
24349
- }
24350
- for (let row = 0; row < tableMap.length; row++) {
24351
- const cell2 = tableMap[row][columnIndex];
24352
- if (cell2.startRow === row && (columnIndex === tableMap[row].length - 1 || tableMap[row][columnIndex].cell !== tableMap[row][columnIndex + 1].cell)) {
24353
- const width = getCellNodeWidth(cell2.cell, editor);
24354
- if (width === void 0) {
24355
- continue;
24356
- }
24357
- const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);
24358
- cell2.cell.setWidth(newWidth);
24359
- }
24360
- }
24361
- },
24362
- { tag: "skip-scroll-into-view" }
24363
- );
24364
- },
24365
- [activeCell, editor]
24366
- );
24367
- const mouseUpHandler = (0, import_react154.useCallback)(
24368
- (direction) => {
24369
- const handler = (event) => {
24370
- event.preventDefault();
24371
- event.stopPropagation();
24372
- if (!activeCell) {
24373
- throw new Error("TableCellResizer: Expected active cell.");
24374
- }
24375
- if (mouseStartPosRef.current) {
24376
- const { x, y } = mouseStartPosRef.current;
24377
- if (activeCell === null) {
24378
- return;
24379
- }
24380
- const zoom = (0, import_utils12.calculateZoomLevel)(event.target);
24381
- if (isHeightChanging(direction)) {
24382
- const heightChange = (event.clientY - y) / zoom;
24383
- updateRowHeight(heightChange);
24384
- } else {
24385
- const widthChange = (event.clientX - x) / zoom;
24386
- updateColumnWidth(widthChange);
24387
- }
24388
- resetState();
24389
- document.removeEventListener("mouseup", handler);
24390
- }
24391
- };
24392
- return handler;
24393
- },
24394
- [activeCell, resetState, updateColumnWidth, updateRowHeight]
24395
- );
24396
- const toggleResize = (0, import_react154.useCallback)(
24397
- (direction) => (event) => {
24398
- event.preventDefault();
24399
- event.stopPropagation();
24400
- if (!activeCell) {
24401
- throw new Error("TableCellResizer: Expected active cell.");
24402
- }
24403
- mouseStartPosRef.current = {
24404
- x: event.clientX,
24405
- y: event.clientY
24406
- };
24407
- updateMouseCurrentPos(mouseStartPosRef.current);
24408
- updateDraggingDirection(direction);
24409
- document.addEventListener("mouseup", mouseUpHandler(direction));
24410
- },
24411
- [activeCell, mouseUpHandler]
24412
- );
24413
- const getResizers = (0, import_react154.useCallback)(() => {
24414
- if (activeCell) {
24415
- const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
24416
- const parentRect = positioningAnchorEl.getBoundingClientRect();
24417
- const zoom = (0, import_utils12.calculateZoomLevel)(activeCell.elem);
24418
- const zoneWidth = 10;
24419
- const styles = {
24420
- bottom: {
24421
- backgroundColor: "none",
24422
- cursor: "row-resize",
24423
- height: `${zoneWidth}px`,
24424
- left: `${left - parentRect.left}px`,
24425
- top: `${top - parentRect.top + positioningAnchorEl.scrollTop + height - zoneWidth / 2}px`,
24426
- width: `${width}px`
24427
- },
24428
- right: {
24429
- backgroundColor: "none",
24430
- cursor: "col-resize",
24431
- height: `${height}px`,
24432
- left: `${left - parentRect.left + width - zoneWidth / 2}px`,
24433
- top: `${top - parentRect.top + positioningAnchorEl.scrollTop}px`,
24434
- width: `${zoneWidth}px`
24435
- }
24436
- };
24437
- const tableRect = tableRectRef.current;
24438
- if (draggingDirection && mouseCurrentPos && tableRect) {
24439
- if (isHeightChanging(draggingDirection)) {
24440
- styles[draggingDirection].left = `${tableRect.left - parentRect.left}px`;
24441
- styles[draggingDirection].top = `${(mouseCurrentPos.y - parentRect.top + positioningAnchorEl.scrollTop) / zoom}px`;
24442
- styles[draggingDirection].height = "3px";
24443
- styles[draggingDirection].width = `${tableRect.width}px`;
24444
- } else {
24445
- styles[draggingDirection].top = `${tableRect.top - parentRect.top + positioningAnchorEl.scrollTop}px`;
24446
- styles[draggingDirection].left = `${(mouseCurrentPos.x - parentRect.left) / zoom}px`;
24447
- styles[draggingDirection].width = "3px";
24448
- styles[draggingDirection].height = `${tableRect.height}px`;
24449
- }
24450
- styles[draggingDirection].backgroundColor = "#adf";
24451
- }
24452
- return styles;
24352
+ };
24353
+
24354
+ // src/components/ParameterInputs/rich-text/toolbar/RichTextToolbar.tsx
24355
+ var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
24356
+ var toolbar = import_react156.css`
24357
+ ${scrollbarStyles}
24358
+ background: var(--gray-50);
24359
+ border-radius: var(--rounded-base);
24360
+ display: flex;
24361
+ /* We add 1px because we use a 1px wide separator */
24362
+ gap: calc(var(--spacing-sm) + 1px);
24363
+ margin: 0 0 calc(var(--spacing-sm) + var(--spacing-xs)) 0;
24364
+ overflow: auto;
24365
+ padding: var(--spacing-sm);
24366
+ position: sticky;
24367
+ top: calc(var(--spacing-sm) * -2);
24368
+ z-index: 10;
24369
+ `;
24370
+ var toolbarGroup = import_react156.css`
24371
+ display: flex;
24372
+ flex-shrink: 0;
24373
+ gap: var(--spacing-xs);
24374
+ position: relative;
24375
+
24376
+ &:not(:first-child)::before {
24377
+ background-color: var(--gray-300);
24378
+ content: '';
24379
+ display: block;
24380
+ height: 24px;
24381
+ left: calc(var(--spacing-xs) * -1);
24382
+ position: absolute;
24383
+ top: 4px;
24384
+ width: 1px;
24385
+ }
24386
+ `;
24387
+ var richTextToolbarButton = import_react156.css`
24388
+ align-items: center;
24389
+ appearance: none;
24390
+ border: 0;
24391
+ border-radius: var(--rounded-sm);
24392
+ box-shadow: none;
24393
+ color: var(--gray-900);
24394
+ display: flex;
24395
+ flex-shrink: 0;
24396
+ height: 32px;
24397
+ justify-content: center;
24398
+ min-width: 32px;
24399
+ padding: 0 var(--spacing-sm);
24400
+ `;
24401
+ var richTextToolbarButtonActive = import_react156.css`
24402
+ background: var(--gray-200);
24403
+ `;
24404
+ var textStyleButton = import_react156.css`
24405
+ justify-content: space-between;
24406
+ min-width: 7rem;
24407
+ `;
24408
+ var toolbarIcon = import_react156.css`
24409
+ color: inherit;
24410
+ `;
24411
+ var toolbarChevron = import_react156.css`
24412
+ margin-left: var(--spacing-xs);
24413
+ `;
24414
+ var RichTextToolbarIcon = ({ icon }) => {
24415
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon, css: toolbarIcon, size: "1rem" });
24416
+ };
24417
+ var RichTextToolbar = ({ config, customControls, onInsertTable, onInsertAsset }) => {
24418
+ const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
24419
+ const {
24420
+ activeElement,
24421
+ setActiveElement,
24422
+ activeFormats,
24423
+ setActiveFormats,
24424
+ visibleFormatsWithIcon,
24425
+ visibleFormatsWithoutIcon,
24426
+ visibleTextualElements,
24427
+ isLink,
24428
+ setIsLink,
24429
+ linkElementVisible,
24430
+ visibleLists,
24431
+ codeElementVisible,
24432
+ quoteElementVisible,
24433
+ visibleElementsWithIcons,
24434
+ visibleInsertElementsWithIcons,
24435
+ tableElementVisible,
24436
+ assetElementVisible
24437
+ } = useRichTextToolbarState({ config });
24438
+ const onSelectElement = (type) => {
24439
+ if (activeElement === type) {
24440
+ return;
24453
24441
  }
24454
- return {
24455
- bottom: null,
24456
- left: null,
24457
- right: null,
24458
- top: null
24459
- };
24460
- }, [activeCell, draggingDirection, mouseCurrentPos, positioningAnchorEl]);
24461
- const resizerStyles = getResizers();
24462
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { ref: resizerRef, children: activeCell != null && !isMouseDown && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [
24463
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24464
- "div",
24465
- {
24466
- css: tableResizer,
24467
- style: resizerStyles.right || void 0,
24468
- onMouseDown: toggleResize("right")
24442
+ editor.focus(() => {
24443
+ editor.update(() => {
24444
+ const selection = (0, import_lexical9.$getSelection)();
24445
+ if (HEADING_ELEMENTS.includes(type)) {
24446
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createHeadingNode)(type));
24447
+ } else if (type === "paragraph") {
24448
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_lexical9.$createParagraphNode)());
24449
+ } else if (type === "quote") {
24450
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createQuoteNode)());
24451
+ } else if (type === "code") {
24452
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_code2.$createCodeNode)());
24453
+ } else if (type === "table" && onInsertTable) {
24454
+ onInsertTable().then((dimensions) => {
24455
+ if (!dimensions) {
24456
+ return;
24457
+ }
24458
+ const { rows, columns } = dimensions;
24459
+ editor.focus(() => {
24460
+ editor.update(() => {
24461
+ (0, import_lexical9.$insertNodes)([(0, import_table4.$createTableNodeWithDimensions)(rows, columns, false)]);
24462
+ });
24463
+ });
24464
+ });
24465
+ } else if (type === "asset" && onInsertAsset) {
24466
+ onInsertAsset();
24467
+ }
24468
+ });
24469
+ });
24470
+ };
24471
+ const updateToolbar = (0, import_react157.useCallback)(() => {
24472
+ const selection = (0, import_lexical9.$getSelection)();
24473
+ if (!(0, import_lexical9.$isRangeSelection)(selection)) {
24474
+ return;
24475
+ }
24476
+ const newActiveFormats = [];
24477
+ for (const format of richTextBuiltInFormats) {
24478
+ if (selection.hasFormat(format.type)) {
24479
+ newActiveFormats.push(format.type);
24469
24480
  }
24470
- ),
24471
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24472
- "div",
24473
- {
24474
- css: tableResizer,
24475
- style: resizerStyles.bottom || void 0,
24476
- onMouseDown: toggleResize("bottom")
24481
+ }
24482
+ setActiveFormats(newActiveFormats);
24483
+ const anchorNode = selection.anchor.getNode();
24484
+ let element = anchorNode.getKey() === "root" ? anchorNode : (0, import_utils13.$findMatchingParent)(anchorNode, (e) => {
24485
+ const parent = e.getParent();
24486
+ return parent !== null && (0, import_lexical9.$isRootOrShadowRoot)(parent);
24487
+ });
24488
+ if (element === null) {
24489
+ element = anchorNode.getTopLevelElementOrThrow();
24490
+ }
24491
+ const elementKey = element.getKey();
24492
+ const elementDOM = editor.getElementByKey(elementKey);
24493
+ if (elementDOM !== null) {
24494
+ if ((0, import_list2.$isListNode)(element)) {
24495
+ const parentList = (0, import_utils13.$getNearestNodeOfType)(anchorNode, import_list2.ListNode);
24496
+ const type = parentList ? parentList.getListType() : element.getListType();
24497
+ setActiveElement(type === "bullet" ? "unorderedList" : "orderedList");
24498
+ } else {
24499
+ const type = (0, import_rich_text.$isHeadingNode)(element) ? element.getTag() : element.getType();
24500
+ setActiveElement(type);
24477
24501
  }
24478
- )
24479
- ] }) });
24480
- }
24481
- function TableCellResizerPlugin({ positioningAnchorEl }) {
24482
- const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
24483
- const isEditable = (0, import_useLexicalEditable2.useLexicalEditable)();
24484
- return (0, import_react154.useMemo)(
24485
- () => isEditable ? (0, import_react_dom3.createPortal)(
24486
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(TableCellResizer, { editor, positioningAnchorEl }),
24487
- positioningAnchorEl
24488
- ) : null,
24489
- [editor, isEditable, positioningAnchorEl]
24490
- );
24491
- }
24492
-
24493
- // src/components/ParameterInputs/rich-text/TableSelectionPlugin.tsx
24494
- init_emotion_jsx_shim();
24495
- var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
24496
- var import_table4 = require("@lexical/table");
24497
- var import_lexical8 = require("lexical");
24498
- var import_react155 = require("react");
24499
- var TableSelectionPlugin = () => {
24500
- const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
24501
- const [closestTableCellNode, setClosestTableCellNode] = (0, import_react155.useState)(null);
24502
- (0, import_react155.useEffect)(() => {
24502
+ }
24503
+ const node = getSelectedNode(selection);
24504
+ if (getLinkAncestor(node) !== null) {
24505
+ setIsLink(true);
24506
+ } else {
24507
+ setIsLink(false);
24508
+ }
24509
+ }, [editor, setActiveElement, setActiveFormats, setIsLink]);
24510
+ (0, import_react157.useEffect)(() => {
24503
24511
  return editor.registerCommand(
24504
- import_lexical8.SELECTION_CHANGE_COMMAND,
24505
- () => {
24506
- editor.read(() => {
24507
- const selection = (0, import_lexical8.$getSelection)();
24508
- if (!(0, import_lexical8.$isRangeSelection)(selection) || !selection.isCollapsed()) {
24509
- setClosestTableCellNode(null);
24510
- return false;
24511
- }
24512
- const tableCellNode = (0, import_table4.$findCellNode)(selection.anchor.getNode());
24513
- if (tableCellNode === null) {
24514
- setClosestTableCellNode(null);
24515
- return false;
24516
- }
24517
- setClosestTableCellNode(tableCellNode);
24518
- });
24512
+ import_lexical9.SELECTION_CHANGE_COMMAND,
24513
+ (_payload) => {
24514
+ updateToolbar();
24519
24515
  return false;
24520
24516
  },
24521
- import_lexical8.COMMAND_PRIORITY_NORMAL
24517
+ import_lexical9.COMMAND_PRIORITY_CRITICAL
24522
24518
  );
24523
- }, [editor]);
24524
- (0, import_react155.useEffect)(() => {
24525
- const onControlA = (event) => {
24526
- if (event.key === "a" && (event.ctrlKey || event.metaKey)) {
24527
- if (!closestTableCellNode) {
24528
- return;
24529
- }
24530
- event.preventDefault();
24531
- editor.update(() => {
24532
- const selection = closestTableCellNode.select(0, closestTableCellNode.getChildrenSize());
24533
- (0, import_lexical8.$setSelection)(selection);
24519
+ }, [editor, updateToolbar]);
24520
+ (0, import_react157.useEffect)(() => {
24521
+ return editor.registerUpdateListener(({ editorState }) => {
24522
+ requestAnimationFrame(() => {
24523
+ editorState.read(() => {
24524
+ updateToolbar();
24534
24525
  });
24535
- }
24536
- };
24537
- return editor.registerRootListener((rootElement, prevRootElement) => {
24538
- rootElement == null ? void 0 : rootElement.addEventListener("keydown", onControlA);
24539
- prevRootElement == null ? void 0 : prevRootElement.removeEventListener("keydown", onControlA);
24526
+ });
24540
24527
  });
24541
- }, [editor, closestTableCellNode]);
24542
- return null;
24528
+ }, [editor, updateToolbar]);
24529
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbar, children: [
24530
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
24531
+ Menu,
24532
+ {
24533
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("button", { css: [richTextToolbarButton, textStyleButton], title: "Text styles", children: [
24534
+ visibleTextualElements.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
24535
+ " ",
24536
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
24537
+ ] }),
24538
+ placement: "bottom-start",
24539
+ children: [
24540
+ [
24541
+ {
24542
+ label: "Normal",
24543
+ type: "paragraph"
24544
+ },
24545
+ ...visibleTextualElements
24546
+ ].map((element) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24547
+ MenuItem,
24548
+ {
24549
+ onClick: () => {
24550
+ onSelectElement(element.type);
24551
+ },
24552
+ children: element.label
24553
+ },
24554
+ element.type
24555
+ )),
24556
+ visibleTextualElements.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItem, { disabled: true, children: "Alternative text styles are not available" }) : null
24557
+ ]
24558
+ }
24559
+ ),
24560
+ visibleFormatsWithIcon.length > 0 || visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbarGroup, children: [
24561
+ visibleFormatsWithIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: format.label, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24562
+ "button",
24563
+ {
24564
+ onClick: () => {
24565
+ editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, format.type);
24566
+ },
24567
+ css: [
24568
+ richTextToolbarButton,
24569
+ activeFormats.includes(format.type) ? richTextToolbarButtonActive : null
24570
+ ],
24571
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: FORMATS_WITH_ICON.get(format.type) })
24572
+ }
24573
+ ) }, format.type)),
24574
+ visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24575
+ Menu,
24576
+ {
24577
+ menuLabel: "Alternative text styles",
24578
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("button", { css: richTextToolbarButton, title: "Alternative text styles", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "more-alt", css: toolbarIcon }) }),
24579
+ placement: "bottom-start",
24580
+ children: visibleFormatsWithoutIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24581
+ MenuItem,
24582
+ {
24583
+ onClick: () => {
24584
+ editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, format.type);
24585
+ },
24586
+ children: format.label
24587
+ },
24588
+ format.type
24589
+ ))
24590
+ }
24591
+ ) : null
24592
+ ] }) : null,
24593
+ visibleElementsWithIcons.size > 0 || customControls ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbarGroup, children: [
24594
+ linkElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24595
+ "button",
24596
+ {
24597
+ onClick: () => {
24598
+ isLink ? editor.dispatchCommand(REMOVE_LINK_NODE_COMMAND, {}) : editor.dispatchCommand(OPEN_LINK_NODE_MODAL_COMMAND, {});
24599
+ },
24600
+ css: [richTextToolbarButton, isLink ? richTextToolbarButtonActive : null],
24601
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "link" })
24602
+ }
24603
+ ) }) : null,
24604
+ visibleLists.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [
24605
+ visibleLists.has("unorderedList") ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Bullet List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24606
+ "button",
24607
+ {
24608
+ onClick: () => {
24609
+ activeElement === "unorderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_UNORDERED_LIST_COMMAND, void 0);
24610
+ },
24611
+ css: [
24612
+ richTextToolbarButton,
24613
+ activeElement === "unorderedList" ? richTextToolbarButtonActive : null
24614
+ ],
24615
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "layout-list" })
24616
+ }
24617
+ ) }) : null,
24618
+ visibleLists.has("orderedList") ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Ordered List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24619
+ "button",
24620
+ {
24621
+ onClick: () => {
24622
+ activeElement === "orderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_ORDERED_LIST_COMMAND, void 0);
24623
+ },
24624
+ css: [
24625
+ richTextToolbarButton,
24626
+ activeElement === "orderedList" ? richTextToolbarButtonActive : null
24627
+ ],
24628
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "layout-list-numbered" })
24629
+ }
24630
+ ) }) : null
24631
+ ] }) : null,
24632
+ customControls ? customControls : null
24633
+ ] }) : null,
24634
+ visibleInsertElementsWithIcons.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { css: toolbarGroup, children: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
24635
+ Menu,
24636
+ {
24637
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("button", { css: richTextToolbarButton, title: "Insert block element", children: [
24638
+ "Insert",
24639
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
24640
+ ] }),
24641
+ placement: "bottom-start",
24642
+ children: [
24643
+ quoteElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24644
+ MenuItem,
24645
+ {
24646
+ onClick: () => {
24647
+ onSelectElement("quote");
24648
+ },
24649
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "quote", iconColor: "currentColor" }),
24650
+ children: "Quote"
24651
+ }
24652
+ ) : null,
24653
+ codeElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24654
+ MenuItem,
24655
+ {
24656
+ onClick: () => {
24657
+ onSelectElement("code");
24658
+ },
24659
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "code-slash", iconColor: "currentColor" }),
24660
+ children: "Code"
24661
+ }
24662
+ ) : null,
24663
+ tableElementVisible && onInsertTable !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24664
+ MenuItem,
24665
+ {
24666
+ onClick: () => {
24667
+ onSelectElement("table");
24668
+ },
24669
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "view-grid", iconColor: "currentColor" }),
24670
+ children: "Table"
24671
+ }
24672
+ ) : null,
24673
+ assetElementVisible && onInsertAsset !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24674
+ MenuItem,
24675
+ {
24676
+ onClick: () => {
24677
+ onSelectElement("asset");
24678
+ },
24679
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "image", iconColor: "currentColor" }),
24680
+ children: "Asset"
24681
+ }
24682
+ ) : null
24683
+ ]
24684
+ }
24685
+ ) }) : null
24686
+ ] });
24543
24687
  };
24544
- var TableSelectionPlugin_default = TableSelectionPlugin;
24688
+ var RichTextToolbar_default = RichTextToolbar;
24545
24689
 
24546
24690
  // src/components/ParameterInputs/ParameterRichText.tsx
24547
24691
  var import_jsx_runtime133 = require("@emotion/react/jsx-runtime");
@@ -24570,6 +24714,7 @@ var ParameterRichText = ({
24570
24714
  variables,
24571
24715
  customControls,
24572
24716
  onInsertTable,
24717
+ onInsertAsset,
24573
24718
  minimalInteractivity
24574
24719
  }) => {
24575
24720
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
@@ -24603,6 +24748,7 @@ var ParameterRichText = ({
24603
24748
  variables,
24604
24749
  customControls,
24605
24750
  onInsertTable,
24751
+ onInsertAsset,
24606
24752
  minimalInteractivity,
24607
24753
  children
24608
24754
  }
@@ -24612,7 +24758,7 @@ var ParameterRichText = ({
24612
24758
  }
24613
24759
  );
24614
24760
  };
24615
- var editorContainerWrapper = import_react156.css`
24761
+ var editorContainerWrapper = import_react158.css`
24616
24762
  position: relative;
24617
24763
 
24618
24764
  &::before {
@@ -24628,12 +24774,12 @@ var editorContainerWrapper = import_react156.css`
24628
24774
  z-index: 2;
24629
24775
  }
24630
24776
  `;
24631
- var editorWrapper = import_react156.css`
24777
+ var editorWrapper = import_react158.css`
24632
24778
  display: flex;
24633
24779
  flex-flow: column;
24634
24780
  flex-grow: 1;
24635
24781
  `;
24636
- var editorContainer = import_react156.css`
24782
+ var editorContainer = import_react158.css`
24637
24783
  ${scrollbarStyles}
24638
24784
  background: var(--white);
24639
24785
  border-radius: var(--rounded-sm);
@@ -24645,7 +24791,7 @@ var editorContainer = import_react156.css`
24645
24791
  font-size: var(--fs-base);
24646
24792
  height: max-content;
24647
24793
  line-height: 1.2;
24648
- max-height: 300px;
24794
+ max-height: 320px;
24649
24795
  min-height: 50px;
24650
24796
  overflow-y: auto;
24651
24797
  padding: var(--spacing-sm);
@@ -24661,11 +24807,11 @@ var editorContainer = import_react156.css`
24661
24807
  }
24662
24808
 
24663
24809
  &[style*='height:'] {
24664
- min-height: 50px;
24810
+ min-height: calc(3rem + (2 * var(--spacing-sm)));
24665
24811
  max-height: unset;
24666
24812
  }
24667
24813
  `;
24668
- var editorContainerOverflowWrapper = import_react156.css`
24814
+ var editorContainerOverflowWrapper = import_react158.css`
24669
24815
  overflow: hidden;
24670
24816
  pointer-events: none;
24671
24817
 
@@ -24673,7 +24819,7 @@ var editorContainerOverflowWrapper = import_react156.css`
24673
24819
  pointer-events: auto;
24674
24820
  }
24675
24821
  `;
24676
- var editorPlaceholder = import_react156.css`
24822
+ var editorPlaceholder = import_react158.css`
24677
24823
  color: var(--gray-500);
24678
24824
  font-style: italic;
24679
24825
  /* 1px is added to make sure caret is clearly visible when field is focused
@@ -24681,11 +24827,12 @@ var editorPlaceholder = import_react156.css`
24681
24827
  left: calc(var(--spacing-sm) + 1px);
24682
24828
  pointer-events: none;
24683
24829
  position: absolute;
24684
- top: var(--spacing-sm);
24830
+ top: calc(1rem + var(--spacing-sm));
24685
24831
  user-select: none;
24686
24832
  `;
24687
- var editorInput = import_react156.css`
24833
+ var editorInput = import_react158.css`
24688
24834
  min-height: 100%;
24835
+ flex-grow: 1;
24689
24836
 
24690
24837
  &:focus,
24691
24838
  &:focus-within {
@@ -24708,6 +24855,7 @@ var ParameterRichTextInner = ({
24708
24855
  variables,
24709
24856
  customControls,
24710
24857
  onInsertTable,
24858
+ onInsertAsset,
24711
24859
  minimalInteractivity
24712
24860
  }) => {
24713
24861
  const lexicalConfig = {
@@ -24722,7 +24870,7 @@ var ParameterRichTextInner = ({
24722
24870
  LinkNode,
24723
24871
  import_rich_text2.HeadingNode,
24724
24872
  import_rich_text2.QuoteNode,
24725
- import_lexical9.ParagraphNode,
24873
+ import_lexical10.ParagraphNode,
24726
24874
  CustomCodeNode,
24727
24875
  import_table5.TableNode,
24728
24876
  import_table5.TableCellNode,
@@ -24780,6 +24928,7 @@ var ParameterRichTextInner = ({
24780
24928
  variables,
24781
24929
  customControls,
24782
24930
  onInsertTable,
24931
+ onInsertAsset,
24783
24932
  minimalInteractivity,
24784
24933
  children
24785
24934
  }
@@ -24808,15 +24957,16 @@ var RichText = ({
24808
24957
  variables,
24809
24958
  customControls,
24810
24959
  onInsertTable,
24960
+ onInsertAsset,
24811
24961
  minimalInteractivity
24812
24962
  }) => {
24813
- const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
24814
- (0, import_react157.useEffect)(() => {
24963
+ const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
24964
+ (0, import_react159.useEffect)(() => {
24815
24965
  if (onRichTextInit) {
24816
24966
  onRichTextInit(editor);
24817
24967
  }
24818
24968
  }, [editor, onRichTextInit]);
24819
- (0, import_react157.useEffect)(() => {
24969
+ (0, import_react159.useEffect)(() => {
24820
24970
  const removeUpdateListener = editor.registerUpdateListener(({ editorState, prevEditorState, tags }) => {
24821
24971
  requestAnimationFrame(() => {
24822
24972
  if (!(0, import_fast_equals2.deepEqual)(editorState.toJSON(), prevEditorState.toJSON())) {
@@ -24828,23 +24978,31 @@ var RichText = ({
24828
24978
  removeUpdateListener();
24829
24979
  };
24830
24980
  }, [editor, onChange]);
24831
- (0, import_react157.useEffect)(() => {
24981
+ (0, import_react159.useEffect)(() => {
24832
24982
  editor.setEditable(!readOnly);
24833
24983
  }, [editor, readOnly]);
24834
- const [editorContainerRef, setEditorContainerRef] = (0, import_react157.useState)(null);
24984
+ const [editorContainerRef, setEditorContainerRef] = (0, import_react159.useState)(null);
24835
24985
  const onEditorContainerRef = (_editorContainerRef) => {
24836
24986
  if (_editorContainerRef !== null) {
24837
24987
  setEditorContainerRef(_editorContainerRef);
24838
24988
  }
24839
24989
  };
24840
- const [portalContainerRef, setPortalContainerRef] = (0, import_react157.useState)(null);
24990
+ const [portalContainerRef, setPortalContainerRef] = (0, import_react159.useState)(null);
24841
24991
  const onPortalContainerRef = (_portalContainerRef) => {
24842
24992
  if (_portalContainerRef !== null) {
24843
24993
  setPortalContainerRef(_portalContainerRef);
24844
24994
  }
24845
24995
  };
24846
24996
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
24847
- readOnly || minimalInteractivity ? null : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(RichTextToolbar_default, { config, customControls, onInsertTable }),
24997
+ readOnly || minimalInteractivity ? null : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24998
+ RichTextToolbar_default,
24999
+ {
25000
+ config,
25001
+ customControls,
25002
+ onInsertTable,
25003
+ onInsertAsset
25004
+ }
25005
+ ),
24848
25006
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { css: editorContainerWrapper, ref: onPortalContainerRef, children: [
24849
25007
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
24850
25008
  "div",
@@ -24891,22 +25049,23 @@ var RichText = ({
24891
25049
  positioningAnchorEl: editorContainerRef
24892
25050
  }
24893
25051
  ) : null,
24894
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableSelectionPlugin_default, {})
25052
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableSelectionPlugin_default, {}),
25053
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ImprovedAssetSelectionPlugin_default, {})
24895
25054
  ] })
24896
25055
  ] });
24897
25056
  };
24898
25057
 
24899
25058
  // src/components/ParameterInputs/ParameterSelect.tsx
24900
25059
  init_emotion_jsx_shim();
24901
- var import_react158 = require("react");
25060
+ var import_react160 = require("react");
24902
25061
  var import_jsx_runtime134 = require("@emotion/react/jsx-runtime");
24903
- var ParameterSelect = (0, import_react158.forwardRef)(
25062
+ var ParameterSelect = (0, import_react160.forwardRef)(
24904
25063
  ({ defaultOption, options, ...props }, ref) => {
24905
25064
  const { shellProps, innerProps } = extractParameterProps(props);
24906
25065
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterSelectInner, { options, defaultOption, ...innerProps, ref }) });
24907
25066
  }
24908
25067
  );
24909
- var ParameterSelectInner = (0, import_react158.forwardRef)(
25068
+ var ParameterSelectInner = (0, import_react160.forwardRef)(
24910
25069
  ({ defaultOption, options, ...props }, ref) => {
24911
25070
  const { id, label, hiddenLabel } = useParameterShell();
24912
25071
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
@@ -24931,13 +25090,13 @@ var ParameterSelectInner = (0, import_react158.forwardRef)(
24931
25090
 
24932
25091
  // src/components/ParameterInputs/ParameterTextarea.tsx
24933
25092
  init_emotion_jsx_shim();
24934
- var import_react159 = require("react");
25093
+ var import_react161 = require("react");
24935
25094
  var import_jsx_runtime135 = require("@emotion/react/jsx-runtime");
24936
- var ParameterTextarea = (0, import_react159.forwardRef)((props, ref) => {
25095
+ var ParameterTextarea = (0, import_react161.forwardRef)((props, ref) => {
24937
25096
  const { shellProps, innerProps } = extractParameterProps(props);
24938
25097
  return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterShell, { "data-testid": "parameter-textarea", ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterTextareaInner, { ref, ...innerProps }) });
24939
25098
  });
24940
- var ParameterTextareaInner = (0, import_react159.forwardRef)(({ ...props }, ref) => {
25099
+ var ParameterTextareaInner = (0, import_react161.forwardRef)(({ ...props }, ref) => {
24941
25100
  const { id, label, hiddenLabel } = useParameterShell();
24942
25101
  return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
24943
25102
  "textarea",
@@ -24953,13 +25112,13 @@ var ParameterTextareaInner = (0, import_react159.forwardRef)(({ ...props }, ref)
24953
25112
 
24954
25113
  // src/components/ParameterInputs/ParameterToggle.tsx
24955
25114
  init_emotion_jsx_shim();
24956
- var import_react160 = require("react");
25115
+ var import_react162 = require("react");
24957
25116
  var import_jsx_runtime136 = require("@emotion/react/jsx-runtime");
24958
- var ParameterToggle = (0, import_react160.forwardRef)((props, ref) => {
25117
+ var ParameterToggle = (0, import_react162.forwardRef)((props, ref) => {
24959
25118
  const { shellProps, innerProps } = extractParameterProps(props);
24960
25119
  return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterToggleInner, { ref, ...innerProps }) });
24961
25120
  });
24962
- var ParameterToggleInner = (0, import_react160.forwardRef)(
25121
+ var ParameterToggleInner = (0, import_react162.forwardRef)(
24963
25122
  ({ children, ...props }, ref) => {
24964
25123
  const { id, label } = useParameterShell();
24965
25124
  return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("label", { css: inputToggleLabel2, children: [
@@ -24975,8 +25134,8 @@ init_emotion_jsx_shim();
24975
25134
 
24976
25135
  // src/components/ProgressBar/ProgressBar.styles.ts
24977
25136
  init_emotion_jsx_shim();
24978
- var import_react161 = require("@emotion/react");
24979
- var container3 = import_react161.css`
25137
+ var import_react163 = require("@emotion/react");
25138
+ var container3 = import_react163.css`
24980
25139
  background: var(--gray-50);
24981
25140
  margin-block: var(--spacing-sm);
24982
25141
  position: relative;
@@ -24986,17 +25145,17 @@ var container3 = import_react161.css`
24986
25145
  border: solid 1px var(--gray-300);
24987
25146
  `;
24988
25147
  var themeMap = {
24989
- primary: import_react161.css`
25148
+ primary: import_react163.css`
24990
25149
  --progress-color: var(--accent-light);
24991
25150
  `,
24992
- secondary: import_react161.css`
25151
+ secondary: import_react163.css`
24993
25152
  --progress-color: var(--accent-alt-light);
24994
25153
  `,
24995
- destructive: import_react161.css`
25154
+ destructive: import_react163.css`
24996
25155
  --progress-color: var(--brand-secondary-5);
24997
25156
  `
24998
25157
  };
24999
- var slidingBackgroundPosition = import_react161.keyframes`
25158
+ var slidingBackgroundPosition = import_react163.keyframes`
25000
25159
  from {
25001
25160
  background-position: 0 0;
25002
25161
  }
@@ -25004,10 +25163,10 @@ var slidingBackgroundPosition = import_react161.keyframes`
25004
25163
  background-position: 64px 0;
25005
25164
  }
25006
25165
  `;
25007
- var determinate = import_react161.css`
25166
+ var determinate = import_react163.css`
25008
25167
  background-color: var(--progress-color);
25009
25168
  `;
25010
- var indeterminate = import_react161.css`
25169
+ var indeterminate = import_react163.css`
25011
25170
  background-image: linear-gradient(
25012
25171
  45deg,
25013
25172
  var(--progress-color) 25%,
@@ -25021,7 +25180,7 @@ var indeterminate = import_react161.css`
25021
25180
  background-size: 64px 64px;
25022
25181
  animation: ${slidingBackgroundPosition} 1s linear infinite;
25023
25182
  `;
25024
- var bar = import_react161.css`
25183
+ var bar = import_react163.css`
25025
25184
  position: absolute;
25026
25185
  inset: 0;
25027
25186
  transition: transform var(--duration-fast) var(--timing-ease-out);
@@ -25070,22 +25229,22 @@ function ProgressBar({
25070
25229
 
25071
25230
  // src/components/ProgressList/ProgressList.tsx
25072
25231
  init_emotion_jsx_shim();
25073
- var import_react163 = require("@emotion/react");
25232
+ var import_react165 = require("@emotion/react");
25074
25233
  var import_CgCheckO3 = require("@react-icons/all-files/cg/CgCheckO");
25075
25234
  var import_CgRadioCheck2 = require("@react-icons/all-files/cg/CgRadioCheck");
25076
25235
  var import_CgRecord2 = require("@react-icons/all-files/cg/CgRecord");
25077
- var import_react164 = require("react");
25236
+ var import_react166 = require("react");
25078
25237
 
25079
25238
  // src/components/ProgressList/styles/ProgressList.styles.ts
25080
25239
  init_emotion_jsx_shim();
25081
- var import_react162 = require("@emotion/react");
25082
- var progressListStyles = import_react162.css`
25240
+ var import_react164 = require("@emotion/react");
25241
+ var progressListStyles = import_react164.css`
25083
25242
  display: flex;
25084
25243
  flex-direction: column;
25085
25244
  gap: var(--spacing-sm);
25086
25245
  list-style-type: none;
25087
25246
  `;
25088
- var progressListItemStyles = import_react162.css`
25247
+ var progressListItemStyles = import_react164.css`
25089
25248
  display: flex;
25090
25249
  gap: var(--spacing-base);
25091
25250
  align-items: center;
@@ -25094,7 +25253,7 @@ var progressListItemStyles = import_react162.css`
25094
25253
  // src/components/ProgressList/ProgressList.tsx
25095
25254
  var import_jsx_runtime138 = require("@emotion/react/jsx-runtime");
25096
25255
  var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
25097
- const itemsWithStatus = (0, import_react164.useMemo)(() => {
25256
+ const itemsWithStatus = (0, import_react166.useMemo)(() => {
25098
25257
  const indexOfInProgressItem = items.findIndex(({ id }) => id === inProgressId);
25099
25258
  return items.map((item, index) => {
25100
25259
  let status = "queued";
@@ -25127,7 +25286,7 @@ var ProgressListItem = ({
25127
25286
  errorLevel = "danger",
25128
25287
  autoEllipsis = false
25129
25288
  }) => {
25130
- const icon = (0, import_react164.useMemo)(() => {
25289
+ const icon = (0, import_react166.useMemo)(() => {
25131
25290
  if (error) {
25132
25291
  return warningIcon;
25133
25292
  }
@@ -25138,14 +25297,14 @@ var ProgressListItem = ({
25138
25297
  };
25139
25298
  return iconPerStatus[status];
25140
25299
  }, [status, error]);
25141
- const statusStyles = (0, import_react164.useMemo)(() => {
25300
+ const statusStyles = (0, import_react166.useMemo)(() => {
25142
25301
  if (error) {
25143
- return errorLevel === "caution" ? import_react163.css`
25302
+ return errorLevel === "caution" ? import_react165.css`
25144
25303
  color: rgb(161, 98, 7);
25145
25304
  & svg {
25146
25305
  color: rgb(250, 204, 21);
25147
25306
  }
25148
- ` : import_react163.css`
25307
+ ` : import_react165.css`
25149
25308
  color: rgb(185, 28, 28);
25150
25309
  & svg {
25151
25310
  color: var(--brand-primary-2);
@@ -25153,13 +25312,13 @@ var ProgressListItem = ({
25153
25312
  `;
25154
25313
  }
25155
25314
  const colorPerStatus = {
25156
- completed: import_react163.css`
25315
+ completed: import_react165.css`
25157
25316
  opacity: 0.75;
25158
25317
  `,
25159
- inProgress: import_react163.css`
25318
+ inProgress: import_react165.css`
25160
25319
  -webkit-text-stroke-width: thin;
25161
25320
  `,
25162
- queued: import_react163.css`
25321
+ queued: import_react165.css`
25163
25322
  opacity: 0.5;
25164
25323
  `
25165
25324
  };
@@ -25176,17 +25335,17 @@ var ProgressListItem = ({
25176
25335
 
25177
25336
  // src/components/SegmentedControl/SegmentedControl.tsx
25178
25337
  init_emotion_jsx_shim();
25179
- var import_react166 = require("@emotion/react");
25338
+ var import_react168 = require("@emotion/react");
25180
25339
  var import_CgCheck6 = require("@react-icons/all-files/cg/CgCheck");
25181
- var import_react167 = require("react");
25340
+ var import_react169 = require("react");
25182
25341
 
25183
25342
  // src/components/SegmentedControl/SegmentedControl.styles.ts
25184
25343
  init_emotion_jsx_shim();
25185
- var import_react165 = require("@emotion/react");
25186
- var segmentedControlRootStyles = import_react165.css`
25344
+ var import_react167 = require("@emotion/react");
25345
+ var segmentedControlRootStyles = import_react167.css`
25187
25346
  position: relative;
25188
25347
  `;
25189
- var segmentedControlScrollIndicatorsStyles = import_react165.css`
25348
+ var segmentedControlScrollIndicatorsStyles = import_react167.css`
25190
25349
  position: absolute;
25191
25350
  inset: 0;
25192
25351
  z-index: 1;
@@ -25214,17 +25373,17 @@ var segmentedControlScrollIndicatorsStyles = import_react165.css`
25214
25373
  background: linear-gradient(to left, var(--background-color) 10%, transparent);
25215
25374
  }
25216
25375
  `;
25217
- var segmentedControlScrollIndicatorStartVisibleStyles = import_react165.css`
25376
+ var segmentedControlScrollIndicatorStartVisibleStyles = import_react167.css`
25218
25377
  &::before {
25219
25378
  opacity: 1;
25220
25379
  }
25221
25380
  `;
25222
- var segmentedControlScrollIndicatorEndVisibleStyles = import_react165.css`
25381
+ var segmentedControlScrollIndicatorEndVisibleStyles = import_react167.css`
25223
25382
  &::after {
25224
25383
  opacity: 1;
25225
25384
  }
25226
25385
  `;
25227
- var segmentedControlWrapperStyles = import_react165.css`
25386
+ var segmentedControlWrapperStyles = import_react167.css`
25228
25387
  overflow-y: auto;
25229
25388
  scroll-behavior: smooth;
25230
25389
  scrollbar-width: none;
@@ -25233,7 +25392,7 @@ var segmentedControlWrapperStyles = import_react165.css`
25233
25392
  height: 0px;
25234
25393
  }
25235
25394
  `;
25236
- var segmentedControlStyles = import_react165.css`
25395
+ var segmentedControlStyles = import_react167.css`
25237
25396
  --segmented-control-rounded-value: var(--rounded-base);
25238
25397
  --segmented-control-border-width: 1px;
25239
25398
  --segmented-control-selected-color: var(--brand-secondary-3);
@@ -25252,14 +25411,14 @@ var segmentedControlStyles = import_react165.css`
25252
25411
  border-radius: calc(var(--segmented-control-rounded-value) + var(--segmented-control-border-width));
25253
25412
  font-size: var(--fs-xs);
25254
25413
  `;
25255
- var segmentedControlVerticalStyles = import_react165.css`
25414
+ var segmentedControlVerticalStyles = import_react167.css`
25256
25415
  flex-direction: column;
25257
25416
  --segmented-control-first-border-radius: var(--segmented-control-rounded-value)
25258
25417
  var(--segmented-control-rounded-value) 0 0;
25259
25418
  --segmented-control-last-border-radius: 0 0 var(--segmented-control-rounded-value)
25260
25419
  var(--segmented-control-rounded-value);
25261
25420
  `;
25262
- var segmentedControlItemStyles = import_react165.css`
25421
+ var segmentedControlItemStyles = import_react167.css`
25263
25422
  &:first-of-type label {
25264
25423
  border-radius: var(--segmented-control-first-border-radius);
25265
25424
  }
@@ -25267,10 +25426,10 @@ var segmentedControlItemStyles = import_react165.css`
25267
25426
  border-radius: var(--segmented-control-last-border-radius);
25268
25427
  }
25269
25428
  `;
25270
- var segmentedControlInputStyles = import_react165.css`
25429
+ var segmentedControlInputStyles = import_react167.css`
25271
25430
  ${accessibleHidden}
25272
25431
  `;
25273
- var segmentedControlLabelStyles = (checked, disabled2) => import_react165.css`
25432
+ var segmentedControlLabelStyles = (checked, disabled2) => import_react167.css`
25274
25433
  position: relative;
25275
25434
  display: flex;
25276
25435
  align-items: center;
@@ -25337,20 +25496,20 @@ var segmentedControlLabelStyles = (checked, disabled2) => import_react165.css`
25337
25496
  `}
25338
25497
  }
25339
25498
  `;
25340
- var segmentedControlLabelIconOnlyStyles = import_react165.css`
25499
+ var segmentedControlLabelIconOnlyStyles = import_react167.css`
25341
25500
  padding-inline: 0.5em;
25342
25501
  `;
25343
- var segmentedControlLabelCheckStyles = import_react165.css`
25502
+ var segmentedControlLabelCheckStyles = import_react167.css`
25344
25503
  opacity: 0.5;
25345
25504
  `;
25346
- var segmentedControlLabelContentStyles = import_react165.css`
25505
+ var segmentedControlLabelContentStyles = import_react167.css`
25347
25506
  display: flex;
25348
25507
  align-items: center;
25349
25508
  justify-content: center;
25350
25509
  gap: var(--spacing-sm);
25351
25510
  height: 100%;
25352
25511
  `;
25353
- var segmentedControlLabelTextStyles = import_react165.css`
25512
+ var segmentedControlLabelTextStyles = import_react167.css`
25354
25513
  white-space: nowrap;
25355
25514
  `;
25356
25515
 
@@ -25370,10 +25529,10 @@ var SegmentedControl = ({
25370
25529
  currentBackgroundColor = "white",
25371
25530
  ...props
25372
25531
  }) => {
25373
- const wrapperRef = (0, import_react167.useRef)(null);
25374
- const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = (0, import_react167.useState)(false);
25375
- const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = (0, import_react167.useState)(false);
25376
- const onOptionChange = (0, import_react167.useCallback)(
25532
+ const wrapperRef = (0, import_react169.useRef)(null);
25533
+ const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = (0, import_react169.useState)(false);
25534
+ const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = (0, import_react169.useState)(false);
25535
+ const onOptionChange = (0, import_react169.useCallback)(
25377
25536
  (event) => {
25378
25537
  if (event.target.checked) {
25379
25538
  onChange == null ? void 0 : onChange(options[parseInt(event.target.value)].value);
@@ -25381,19 +25540,19 @@ var SegmentedControl = ({
25381
25540
  },
25382
25541
  [options, onChange]
25383
25542
  );
25384
- const sizeStyles = (0, import_react167.useMemo)(() => {
25543
+ const sizeStyles = (0, import_react169.useMemo)(() => {
25385
25544
  const map = {
25386
- sm: (0, import_react166.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
25387
- md: (0, import_react166.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
25388
- lg: (0, import_react166.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
25389
- xl: (0, import_react166.css)({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
25545
+ sm: (0, import_react168.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
25546
+ md: (0, import_react168.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
25547
+ lg: (0, import_react168.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
25548
+ xl: (0, import_react168.css)({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
25390
25549
  };
25391
25550
  return map[size];
25392
25551
  }, [size]);
25393
- const isIconOnly = (0, import_react167.useMemo)(() => {
25552
+ const isIconOnly = (0, import_react169.useMemo)(() => {
25394
25553
  return options.every((option) => option && option.icon && !option.label);
25395
25554
  }, [options]);
25396
- (0, import_react167.useEffect)(() => {
25555
+ (0, import_react169.useEffect)(() => {
25397
25556
  const wrapperElement = wrapperRef.current;
25398
25557
  const onScroll = () => {
25399
25558
  if (!wrapperElement) {
@@ -25488,12 +25647,12 @@ init_emotion_jsx_shim();
25488
25647
 
25489
25648
  // src/components/Skeleton/Skeleton.styles.ts
25490
25649
  init_emotion_jsx_shim();
25491
- var import_react168 = require("@emotion/react");
25492
- var lightFadingOut = import_react168.keyframes`
25650
+ var import_react170 = require("@emotion/react");
25651
+ var lightFadingOut = import_react170.keyframes`
25493
25652
  from { opacity: 0.1; }
25494
25653
  to { opacity: 0.025; }
25495
25654
  `;
25496
- var skeletonStyles = import_react168.css`
25655
+ var skeletonStyles = import_react170.css`
25497
25656
  animation: ${lightFadingOut} 1s ease-out infinite alternate;
25498
25657
  background-color: var(--gray-900);
25499
25658
  `;
@@ -25528,12 +25687,12 @@ var Skeleton = ({
25528
25687
 
25529
25688
  // src/components/Switch/Switch.tsx
25530
25689
  init_emotion_jsx_shim();
25531
- var import_react170 = require("react");
25690
+ var import_react172 = require("react");
25532
25691
 
25533
25692
  // src/components/Switch/Switch.styles.ts
25534
25693
  init_emotion_jsx_shim();
25535
- var import_react169 = require("@emotion/react");
25536
- var SwitchInputContainer = import_react169.css`
25694
+ var import_react171 = require("@emotion/react");
25695
+ var SwitchInputContainer = import_react171.css`
25537
25696
  cursor: pointer;
25538
25697
  display: inline-block;
25539
25698
  position: relative;
@@ -25542,7 +25701,7 @@ var SwitchInputContainer = import_react169.css`
25542
25701
  vertical-align: middle;
25543
25702
  user-select: none;
25544
25703
  `;
25545
- var SwitchInput = (size) => import_react169.css`
25704
+ var SwitchInput = (size) => import_react171.css`
25546
25705
  appearance: none;
25547
25706
  border-radius: var(--rounded-full);
25548
25707
  background-color: var(--white);
@@ -25582,7 +25741,7 @@ var SwitchInput = (size) => import_react169.css`
25582
25741
  cursor: not-allowed;
25583
25742
  }
25584
25743
  `;
25585
- var SwitchInputDisabled = import_react169.css`
25744
+ var SwitchInputDisabled = import_react171.css`
25586
25745
  opacity: var(--opacity-50);
25587
25746
  cursor: not-allowed;
25588
25747
 
@@ -25590,7 +25749,7 @@ var SwitchInputDisabled = import_react169.css`
25590
25749
  cursor: not-allowed;
25591
25750
  }
25592
25751
  `;
25593
- var SwitchInputLabel = (size) => import_react169.css`
25752
+ var SwitchInputLabel = (size) => import_react171.css`
25594
25753
  align-items: center;
25595
25754
  color: var(--typography-base);
25596
25755
  display: inline-flex;
@@ -25612,7 +25771,7 @@ var SwitchInputLabel = (size) => import_react169.css`
25612
25771
  top: 0;
25613
25772
  }
25614
25773
  `;
25615
- var SwitchText = (size) => import_react169.css`
25774
+ var SwitchText = (size) => import_react171.css`
25616
25775
  color: var(--gray-500);
25617
25776
  font-size: var(--fs-sm);
25618
25777
  padding-inline: ${size === "sm" ? "var(--spacing-xl)" : "var(--spacing-2xl)"} 0;
@@ -25620,7 +25779,7 @@ var SwitchText = (size) => import_react169.css`
25620
25779
 
25621
25780
  // src/components/Switch/Switch.tsx
25622
25781
  var import_jsx_runtime141 = require("@emotion/react/jsx-runtime");
25623
- var Switch = (0, import_react170.forwardRef)(
25782
+ var Switch = (0, import_react172.forwardRef)(
25624
25783
  ({ label, infoText, toggleText, children, switchSize = "base", ...inputProps }, ref) => {
25625
25784
  let additionalText = infoText;
25626
25785
  if (infoText && toggleText) {
@@ -25649,8 +25808,8 @@ var React24 = __toESM(require("react"));
25649
25808
 
25650
25809
  // src/components/Table/Table.styles.ts
25651
25810
  init_emotion_jsx_shim();
25652
- var import_react171 = require("@emotion/react");
25653
- var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_react171.css`
25811
+ var import_react173 = require("@emotion/react");
25812
+ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_react173.css`
25654
25813
  border-bottom: 1px solid var(--gray-400);
25655
25814
  border-collapse: collapse;
25656
25815
  min-width: 100%;
@@ -25670,14 +25829,14 @@ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_
25670
25829
  background-color: var(--gray-50);
25671
25830
  }
25672
25831
  `;
25673
- var tableHead = import_react171.css`
25832
+ var tableHead = import_react173.css`
25674
25833
  color: var(--typography-base);
25675
25834
  text-align: left;
25676
25835
  `;
25677
- var tableRow = import_react171.css`
25836
+ var tableRow = import_react173.css`
25678
25837
  border-bottom: 1px solid var(--gray-100);
25679
25838
  `;
25680
- var tableCellHead = import_react171.css`
25839
+ var tableCellHead = import_react173.css`
25681
25840
  font-size: var(--fs-sm);
25682
25841
  text-transform: uppercase;
25683
25842
  font-weight: var(--fw-bold);
@@ -25723,13 +25882,13 @@ var TableCellData = React24.forwardRef(
25723
25882
 
25724
25883
  // src/components/Tabs/Tabs.tsx
25725
25884
  init_emotion_jsx_shim();
25726
- var import_react173 = require("@ariakit/react");
25727
- var import_react174 = require("react");
25885
+ var import_react175 = require("@ariakit/react");
25886
+ var import_react176 = require("react");
25728
25887
 
25729
25888
  // src/components/Tabs/Tabs.styles.ts
25730
25889
  init_emotion_jsx_shim();
25731
- var import_react172 = require("@emotion/react");
25732
- var tabButtonStyles = import_react172.css`
25890
+ var import_react174 = require("@emotion/react");
25891
+ var tabButtonStyles = import_react174.css`
25733
25892
  align-items: center;
25734
25893
  border: 0;
25735
25894
  height: 2.5rem;
@@ -25746,7 +25905,7 @@ var tabButtonStyles = import_react172.css`
25746
25905
  box-shadow: inset 0 -2px 0 var(--brand-secondary-3);
25747
25906
  }
25748
25907
  `;
25749
- var tabButtonGroupStyles = import_react172.css`
25908
+ var tabButtonGroupStyles = import_react174.css`
25750
25909
  display: flex;
25751
25910
  gap: var(--spacing-base);
25752
25911
  border-bottom: 1px solid var(--gray-300);
@@ -25755,7 +25914,7 @@ var tabButtonGroupStyles = import_react172.css`
25755
25914
  // src/components/Tabs/Tabs.tsx
25756
25915
  var import_jsx_runtime143 = require("@emotion/react/jsx-runtime");
25757
25916
  var useCurrentTab = () => {
25758
- const context = (0, import_react173.useTabStore)();
25917
+ const context = (0, import_react175.useTabStore)();
25759
25918
  if (!context) {
25760
25919
  throw new Error("This component can only be used inside <Tabs>");
25761
25920
  }
@@ -25769,12 +25928,12 @@ var Tabs = ({
25769
25928
  manual,
25770
25929
  ...props
25771
25930
  }) => {
25772
- const selected = (0, import_react174.useMemo)(() => {
25931
+ const selected = (0, import_react176.useMemo)(() => {
25773
25932
  if (selectedId) return selectedId;
25774
25933
  return useHashForState && typeof window !== "undefined" && window.location.hash ? window.location.hash.substring(1) : void 0;
25775
25934
  }, [selectedId, useHashForState]);
25776
- const tab = (0, import_react173.useTabStore)({ ...props, selectOnMove: !manual, selectedId: selected });
25777
- const onTabSelect = (0, import_react174.useCallback)(
25935
+ const tab = (0, import_react175.useTabStore)({ ...props, selectOnMove: !manual, selectedId: selected });
25936
+ const onTabSelect = (0, import_react176.useCallback)(
25778
25937
  (value) => {
25779
25938
  const selectedValueWithoutNull = value != null ? value : void 0;
25780
25939
  onSelectedIdChange == null ? void 0 : onSelectedIdChange(selectedValueWithoutNull);
@@ -25785,28 +25944,28 @@ var Tabs = ({
25785
25944
  },
25786
25945
  [onSelectedIdChange, useHashForState]
25787
25946
  );
25788
- (0, import_react174.useEffect)(() => {
25947
+ (0, import_react176.useEffect)(() => {
25789
25948
  if (selected && selected !== tab.getState().activeId) {
25790
25949
  tab.setSelectedId(selected);
25791
25950
  }
25792
25951
  }, [selected, tab]);
25793
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react173.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
25952
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react175.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
25794
25953
  };
25795
25954
  var TabButtonGroup = ({ children, ...props }) => {
25796
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react173.TabList, { ...props, css: tabButtonGroupStyles, children });
25955
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react175.TabList, { ...props, css: tabButtonGroupStyles, children });
25797
25956
  };
25798
25957
  var TabButton = ({
25799
25958
  children,
25800
25959
  id,
25801
25960
  ...props
25802
25961
  }) => {
25803
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react173.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
25962
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react175.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
25804
25963
  };
25805
25964
  var TabContent = ({
25806
25965
  children,
25807
25966
  ...props
25808
25967
  }) => {
25809
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react173.TabPanel, { ...props, children });
25968
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react175.TabPanel, { ...props, children });
25810
25969
  };
25811
25970
 
25812
25971
  // src/components/Validation/StatusBullet.tsx
@@ -25814,8 +25973,8 @@ init_emotion_jsx_shim();
25814
25973
 
25815
25974
  // src/components/Validation/StatusBullet.styles.ts
25816
25975
  init_emotion_jsx_shim();
25817
- var import_react175 = require("@emotion/react");
25818
- var StatusBulletContainer = import_react175.css`
25976
+ var import_react177 = require("@emotion/react");
25977
+ var StatusBulletContainer = import_react177.css`
25819
25978
  align-items: center;
25820
25979
  align-self: center;
25821
25980
  color: var(--gray-500);
@@ -25832,33 +25991,33 @@ var StatusBulletContainer = import_react175.css`
25832
25991
  display: block;
25833
25992
  }
25834
25993
  `;
25835
- var StatusBulletBase = import_react175.css`
25994
+ var StatusBulletBase = import_react177.css`
25836
25995
  font-size: var(--fs-sm);
25837
25996
  &:before {
25838
25997
  width: var(--fs-xs);
25839
25998
  height: var(--fs-xs);
25840
25999
  }
25841
26000
  `;
25842
- var StatusBulletSmall = import_react175.css`
26001
+ var StatusBulletSmall = import_react177.css`
25843
26002
  font-size: var(--fs-xs);
25844
26003
  &:before {
25845
26004
  width: var(--fs-xxs);
25846
26005
  height: var(--fs-xxs);
25847
26006
  }
25848
26007
  `;
25849
- var StatusDraft = import_react175.css`
26008
+ var StatusDraft = import_react177.css`
25850
26009
  &:before {
25851
26010
  background: var(--white);
25852
26011
  box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
25853
26012
  }
25854
26013
  `;
25855
- var StatusModified = import_react175.css`
26014
+ var StatusModified = import_react177.css`
25856
26015
  &:before {
25857
26016
  background: linear-gradient(to right, var(--white) 50%, var(--accent-dark) 50% 100%);
25858
26017
  box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
25859
26018
  }
25860
26019
  `;
25861
- var StatusError = import_react175.css`
26020
+ var StatusError = import_react177.css`
25862
26021
  color: var(--error);
25863
26022
  &:before {
25864
26023
  /* TODO: replace this with an svg icon */
@@ -25871,22 +26030,22 @@ var StatusError = import_react175.css`
25871
26030
  );
25872
26031
  }
25873
26032
  `;
25874
- var StatusPublished = import_react175.css`
26033
+ var StatusPublished = import_react177.css`
25875
26034
  &:before {
25876
26035
  background: var(--accent-dark);
25877
26036
  }
25878
26037
  `;
25879
- var StatusOrphan = import_react175.css`
26038
+ var StatusOrphan = import_react177.css`
25880
26039
  &:before {
25881
26040
  background: var(--brand-secondary-5);
25882
26041
  }
25883
26042
  `;
25884
- var StatusUnknown = import_react175.css`
26043
+ var StatusUnknown = import_react177.css`
25885
26044
  &:before {
25886
26045
  background: var(--gray-800);
25887
26046
  }
25888
26047
  `;
25889
- var StatusDeleted = import_react175.css`
26048
+ var StatusDeleted = import_react177.css`
25890
26049
  &:before {
25891
26050
  background: var(--error);
25892
26051
  }