@uniformdev/design-system 19.186.1 → 19.186.2-alpha.14

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
@@ -22292,11 +22292,11 @@ var ParameterNameAndPublicIdInput = ({
22292
22292
 
22293
22293
  // src/components/ParameterInputs/ParameterRichText.tsx
22294
22294
  init_emotion_jsx_shim();
22295
- var import_react156 = require("@emotion/react");
22295
+ var import_react158 = require("@emotion/react");
22296
22296
  var import_list3 = require("@lexical/list");
22297
22297
  var import_markdown = require("@lexical/markdown");
22298
22298
  var import_LexicalComposer = require("@lexical/react/LexicalComposer");
22299
- var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
22299
+ var import_LexicalComposerContext9 = require("@lexical/react/LexicalComposerContext");
22300
22300
  var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
22301
22301
  var import_LexicalErrorBoundary = __toESM(require("@lexical/react/LexicalErrorBoundary"));
22302
22302
  var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
@@ -22309,6 +22309,12 @@ var import_table5 = require("@lexical/table");
22309
22309
 
22310
22310
  // ../richtext/dist/index.mjs
22311
22311
  init_emotion_jsx_shim();
22312
+ function isRichTextNode(node) {
22313
+ return !!node && typeof node === "object" && "type" in node;
22314
+ }
22315
+ function isRichTextNodeType(node, type) {
22316
+ return isRichTextNode(node) && node.type === type;
22317
+ }
22312
22318
  var richTextBuiltInElements = [
22313
22319
  {
22314
22320
  label: "Heading 1",
@@ -22358,6 +22364,10 @@ var richTextBuiltInElements = [
22358
22364
  label: "Table",
22359
22365
  type: "table"
22360
22366
  },
22367
+ {
22368
+ label: "Asset",
22369
+ type: "asset"
22370
+ },
22361
22371
  {
22362
22372
  label: "Dynamic Token",
22363
22373
  type: "variable"
@@ -22404,8 +22414,8 @@ var getLabelForElement = (type) => {
22404
22414
 
22405
22415
  // src/components/ParameterInputs/ParameterRichText.tsx
22406
22416
  var import_fast_equals2 = require("fast-equals");
22407
- var import_lexical9 = require("lexical");
22408
- var import_react157 = require("react");
22417
+ var import_lexical10 = require("lexical");
22418
+ var import_react159 = require("react");
22409
22419
 
22410
22420
  // src/components/ParameterInputs/rich-text/CustomCodeNode.ts
22411
22421
  init_emotion_jsx_shim();
@@ -22687,20 +22697,75 @@ var tableHeaderElement = import_css2.css`
22687
22697
  width: 7rem;
22688
22698
  `;
22689
22699
 
22690
- // src/components/ParameterInputs/rich-text/LinkNodePlugin.tsx
22700
+ // src/components/ParameterInputs/rich-text/ImprovedAssetSelectionPlugin.tsx
22691
22701
  init_emotion_jsx_shim();
22692
- var import_react146 = require("@emotion/react");
22693
22702
  var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerContext");
22694
- var import_LexicalNodeEventPlugin = require("@lexical/react/LexicalNodeEventPlugin");
22695
22703
  var import_utils6 = require("@lexical/utils");
22704
+ var import_lexical2 = require("lexical");
22705
+ var import_react146 = require("react");
22706
+ var ImprovedAssetSelectionPlugin = () => {
22707
+ const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
22708
+ (0, import_react146.useEffect)(() => {
22709
+ editor.getRootElement();
22710
+ const onRootClick = (event) => {
22711
+ if (event.target !== editor.getRootElement()) {
22712
+ return;
22713
+ }
22714
+ const clickArea = event.offsetY <= 60 ? "top" : "bottom";
22715
+ const state = editor.getEditorState().toJSON();
22716
+ const firstNode = state.root.children[0];
22717
+ const lastNode = state.root.children.at(-1);
22718
+ if (isRichTextNodeType(firstNode, "asset") && clickArea === "top") {
22719
+ editor.update(() => {
22720
+ (0, import_utils6.$insertFirst)((0, import_lexical2.$getRoot)(), (0, import_lexical2.$createParagraphNode)());
22721
+ requestAnimationFrame(() => {
22722
+ var _a, _b;
22723
+ (_b = (_a = editor.getRootElement()) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.scrollTo({
22724
+ top: 0,
22725
+ behavior: "instant"
22726
+ });
22727
+ });
22728
+ });
22729
+ } else if (isRichTextNodeType(lastNode, "asset") && clickArea === "bottom") {
22730
+ editor.update(() => {
22731
+ (0, import_lexical2.$getRoot)().selectEnd();
22732
+ (0, import_lexical2.$insertNodes)([(0, import_lexical2.$createParagraphNode)()]);
22733
+ requestAnimationFrame(() => {
22734
+ var _a, _b, _c, _d;
22735
+ (_d = (_a = editor.getRootElement()) == null ? void 0 : _a.parentElement) == null ? void 0 : _d.scrollTo({
22736
+ top: (_c = (_b = editor.getRootElement()) == null ? void 0 : _b.parentElement) == null ? void 0 : _c.scrollHeight,
22737
+ behavior: "instant"
22738
+ });
22739
+ });
22740
+ });
22741
+ }
22742
+ };
22743
+ const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {
22744
+ rootElement == null ? void 0 : rootElement.addEventListener("click", onRootClick);
22745
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("click", onRootClick);
22746
+ });
22747
+ return () => {
22748
+ removeRootListener();
22749
+ };
22750
+ }, [editor]);
22751
+ return null;
22752
+ };
22753
+ var ImprovedAssetSelectionPlugin_default = ImprovedAssetSelectionPlugin;
22754
+
22755
+ // src/components/ParameterInputs/rich-text/LinkNodePlugin.tsx
22756
+ init_emotion_jsx_shim();
22757
+ var import_react147 = require("@emotion/react");
22758
+ var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
22759
+ var import_LexicalNodeEventPlugin = require("@lexical/react/LexicalNodeEventPlugin");
22760
+ var import_utils7 = require("@lexical/utils");
22696
22761
  var import_fast_equals = require("fast-equals");
22697
- var import_lexical3 = require("lexical");
22698
- var import_react147 = require("react");
22762
+ var import_lexical4 = require("lexical");
22763
+ var import_react148 = require("react");
22699
22764
 
22700
22765
  // src/components/ParameterInputs/rich-text/utils.ts
22701
22766
  init_emotion_jsx_shim();
22702
22767
  var import_selection = require("@lexical/selection");
22703
- var import_lexical2 = require("lexical");
22768
+ var import_lexical3 = require("lexical");
22704
22769
  var getElementNodesInSelection = (selection) => {
22705
22770
  const nodesInSelection = selection.getNodes();
22706
22771
  if (nodesInSelection.length === 0) {
@@ -22709,7 +22774,7 @@ var getElementNodesInSelection = (selection) => {
22709
22774
  selection.focus.getNode().getParentOrThrow()
22710
22775
  ]);
22711
22776
  }
22712
- return new Set(nodesInSelection.map((node) => (0, import_lexical2.$isElementNode)(node) ? node : node.getParentOrThrow()));
22777
+ return new Set(nodesInSelection.map((node) => (0, import_lexical3.$isElementNode)(node) ? node : node.getParentOrThrow()));
22713
22778
  };
22714
22779
  var getAncestor = (node, predicate) => {
22715
22780
  let parent = node;
@@ -22756,7 +22821,7 @@ var guessLinkTypeFromPath = (path) => {
22756
22821
  };
22757
22822
  function convertAnchorElement(domNode) {
22758
22823
  let node = null;
22759
- if (!(0, import_utils6.isHTMLAnchorElement)(domNode)) {
22824
+ if (!(0, import_utils7.isHTMLAnchorElement)(domNode)) {
22760
22825
  return { node };
22761
22826
  }
22762
22827
  const textContent = domNode.textContent;
@@ -22813,14 +22878,12 @@ function convertAnchorElement(domNode) {
22813
22878
  nodeId,
22814
22879
  dynamicInputValues
22815
22880
  };
22816
- if (isProjectMapLinkValue(value)) {
22817
- node = $createLinkNode(value);
22818
- } else if (isNonProjectMapLinkValue(value)) {
22881
+ if (isProjectMapLinkValue(value) || isNonProjectMapLinkValue(value)) {
22819
22882
  node = $createLinkNode(value);
22820
22883
  }
22821
22884
  return { node };
22822
22885
  }
22823
- var LinkNode = class _LinkNode extends import_lexical3.ElementNode {
22886
+ var LinkNode = class _LinkNode extends import_lexical4.ElementNode {
22824
22887
  static getType() {
22825
22888
  return "link";
22826
22889
  }
@@ -22865,7 +22928,7 @@ var LinkNode = class _LinkNode extends import_lexical3.ElementNode {
22865
22928
  element.setAttribute("href", `mailto:${this.__link.path}`);
22866
22929
  }
22867
22930
  }
22868
- (0, import_utils6.addClassNamesToElement)(element, config.theme.link);
22931
+ (0, import_utils7.addClassNamesToElement)(element, config.theme.link);
22869
22932
  return element;
22870
22933
  }
22871
22934
  updateDOM(prevNode, a) {
@@ -22893,7 +22956,7 @@ var LinkNode = class _LinkNode extends import_lexical3.ElementNode {
22893
22956
  }
22894
22957
  insertNewAfter(selection, restoreSelection = true) {
22895
22958
  const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection);
22896
- if ((0, import_lexical3.$isElementNode)(element)) {
22959
+ if ((0, import_lexical4.$isElementNode)(element)) {
22897
22960
  const linkNode = $createLinkNode(
22898
22961
  "nodeId" in this.__link ? {
22899
22962
  nodeId: this.__link.nodeId,
@@ -22924,7 +22987,7 @@ var LinkNode = class _LinkNode extends import_lexical3.ElementNode {
22924
22987
  }
22925
22988
  };
22926
22989
  function $createLinkNode(props) {
22927
- return (0, import_lexical3.$applyNodeReplacement)(new LinkNode(props));
22990
+ return (0, import_lexical4.$applyNodeReplacement)(new LinkNode(props));
22928
22991
  }
22929
22992
  function $isLinkNode(node) {
22930
22993
  return node instanceof LinkNode;
@@ -22937,14 +23000,14 @@ function removeLinkNode(node) {
22937
23000
  node.remove();
22938
23001
  }
22939
23002
  function removeLinkNodeFromSelection() {
22940
- const selection = (0, import_lexical3.$getSelection)();
22941
- if (!(0, import_lexical3.$isRangeSelection)(selection)) {
23003
+ const selection = (0, import_lexical4.$getSelection)();
23004
+ if (!(0, import_lexical4.$isRangeSelection)(selection)) {
22942
23005
  return;
22943
23006
  }
22944
23007
  const nodes = selection.extract();
22945
23008
  const linkNodesFound = /* @__PURE__ */ new Set();
22946
23009
  for (const node of nodes) {
22947
- if ((0, import_lexical3.$isElementNode)(node) && !node.isInline()) {
23010
+ if ((0, import_lexical4.$isElementNode)(node) && !node.isInline()) {
22948
23011
  continue;
22949
23012
  }
22950
23013
  const linkNodeAncestor = getLinkAncestor(node);
@@ -22958,17 +23021,21 @@ function removeLinkNodeFromSelection() {
22958
23021
  }
22959
23022
  function upsertLinkNode(props) {
22960
23023
  var _a, _b, _c, _d, _e;
22961
- const selection = (0, import_lexical3.$getSelection)();
22962
- if (!(0, import_lexical3.$isRangeSelection)(selection)) {
23024
+ const selection = (0, import_lexical4.$getSelection)();
23025
+ if (!(0, import_lexical4.$isRangeSelection)(selection)) {
22963
23026
  return;
22964
23027
  }
22965
23028
  const nodes = selection.extract();
22966
23029
  const touchedNodes = [];
22967
23030
  for (const node of nodes) {
22968
- if ((0, import_lexical3.$isElementNode)(node) && !node.isInline()) {
23031
+ if ((0, import_lexical4.$isElementNode)(node) && !node.isInline()) {
22969
23032
  continue;
22970
23033
  }
22971
23034
  const linkNodeAncestor = getLinkAncestor(node);
23035
+ if ($isLinkNode(node)) {
23036
+ node.setLink(props);
23037
+ continue;
23038
+ }
22972
23039
  if (!linkNodeAncestor) {
22973
23040
  const newLinkNode = $createLinkNode(props);
22974
23041
  node.insertBefore(newLinkNode);
@@ -23013,23 +23080,23 @@ function upsertLinkNode(props) {
23013
23080
  }
23014
23081
  }
23015
23082
  }
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)(
23083
+ var REMOVE_LINK_NODE_COMMAND = (0, import_lexical4.createCommand)("REMOVE_LINK_NODE_COMMAND");
23084
+ var UPSERT_LINK_NODE_COMMAND = (0, import_lexical4.createCommand)("UPSERT_LINK_NODE_COMMAND");
23085
+ var OPEN_LINK_NODE_MODAL_COMMAND = (0, import_lexical4.createCommand)(
23019
23086
  "OPEN_LINK_NODE_MODAL_COMMAND"
23020
23087
  );
23021
23088
  var LINK_POPOVER_OFFSET_X = 0;
23022
23089
  var LINK_POPOVER_OFFSET_Y = 8;
23023
- var linkPopover = import_react146.css`
23090
+ var linkPopover = import_react147.css`
23024
23091
  position: absolute;
23025
23092
  z-index: 11;
23026
23093
  `;
23027
- var linkPopoverContainer = import_react146.css`
23094
+ var linkPopoverContainer = import_react147.css`
23028
23095
  ${Popover()};
23029
23096
  align-items: center;
23030
23097
  display: flex;
23031
23098
  `;
23032
- var linkPopoverAnchor = import_react146.css`
23099
+ var linkPopoverAnchor = import_react147.css`
23033
23100
  ${link}
23034
23101
  ${linkColorDefault}
23035
23102
  `;
@@ -23041,29 +23108,29 @@ function LinkNodePlugin({
23041
23108
  const parsePath = getBoundPath != null ? getBoundPath : function(path) {
23042
23109
  return path;
23043
23110
  };
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)(() => {
23111
+ const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
23112
+ const [linkPopoverState, setLinkPopoverState] = (0, import_react148.useState)();
23113
+ const linkPopoverElRef = (0, import_react148.useRef)(null);
23114
+ const [isEditorFocused, setIsEditorFocused] = (0, import_react148.useState)(false);
23115
+ const [isLinkPopoverFocused, setIsLinkPopoverFocused] = (0, import_react148.useState)(false);
23116
+ (0, import_react148.useEffect)(() => {
23050
23117
  if (!isEditorFocused && !isLinkPopoverFocused) {
23051
23118
  setLinkPopoverState(void 0);
23052
23119
  return;
23053
23120
  }
23054
23121
  }, [isEditorFocused, isLinkPopoverFocused]);
23055
- (0, import_react147.useEffect)(() => {
23122
+ (0, import_react148.useEffect)(() => {
23056
23123
  if (!editor.hasNodes([LinkNode])) {
23057
23124
  throw new Error("LinkNode not registered on editor");
23058
23125
  }
23059
- return (0, import_utils6.mergeRegister)(
23126
+ return (0, import_utils7.mergeRegister)(
23060
23127
  editor.registerCommand(
23061
23128
  UPSERT_LINK_NODE_COMMAND,
23062
23129
  (payload) => {
23063
23130
  upsertLinkNode(payload);
23064
23131
  return true;
23065
23132
  },
23066
- import_lexical3.COMMAND_PRIORITY_EDITOR
23133
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23067
23134
  ),
23068
23135
  editor.registerCommand(
23069
23136
  REMOVE_LINK_NODE_COMMAND,
@@ -23071,7 +23138,7 @@ function LinkNodePlugin({
23071
23138
  removeLinkNodeFromSelection();
23072
23139
  return true;
23073
23140
  },
23074
- import_lexical3.COMMAND_PRIORITY_EDITOR
23141
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23075
23142
  ),
23076
23143
  editor.registerCommand(
23077
23144
  OPEN_LINK_NODE_MODAL_COMMAND,
@@ -23090,18 +23157,18 @@ function LinkNodePlugin({
23090
23157
  });
23091
23158
  return true;
23092
23159
  },
23093
- import_lexical3.COMMAND_PRIORITY_EDITOR
23160
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23094
23161
  ),
23095
23162
  editor.registerCommand(
23096
- import_lexical3.FOCUS_COMMAND,
23163
+ import_lexical4.FOCUS_COMMAND,
23097
23164
  () => {
23098
23165
  setIsEditorFocused(true);
23099
23166
  return true;
23100
23167
  },
23101
- import_lexical3.COMMAND_PRIORITY_EDITOR
23168
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23102
23169
  ),
23103
23170
  editor.registerCommand(
23104
- import_lexical3.BLUR_COMMAND,
23171
+ import_lexical4.BLUR_COMMAND,
23105
23172
  () => {
23106
23173
  requestAnimationFrame(() => {
23107
23174
  if (linkPopoverElRef.current !== null) {
@@ -23117,16 +23184,51 @@ function LinkNodePlugin({
23117
23184
  });
23118
23185
  return true;
23119
23186
  },
23120
- import_lexical3.COMMAND_PRIORITY_EDITOR
23187
+ import_lexical4.COMMAND_PRIORITY_EDITOR
23188
+ ),
23189
+ // Support pasting of links from clipboard
23190
+ editor.registerCommand(
23191
+ import_lexical4.PASTE_COMMAND,
23192
+ (event) => {
23193
+ const selection = (0, import_lexical4.$getSelection)();
23194
+ if (!(0, import_lexical4.$isRangeSelection)(selection) || selection.isCollapsed() || !(0, import_utils7.objectKlassEquals)(event, ClipboardEvent)) {
23195
+ return false;
23196
+ }
23197
+ const clipboardEvent = event;
23198
+ if (clipboardEvent.clipboardData === null) {
23199
+ return false;
23200
+ }
23201
+ const clipboardText = clipboardEvent.clipboardData.getData("text");
23202
+ if (!isValidUrl(clipboardText)) {
23203
+ return false;
23204
+ }
23205
+ if (selection.getNodes().some((node) => (0, import_lexical4.$isElementNode)(node) && !$isLinkNode(node))) {
23206
+ return false;
23207
+ }
23208
+ let path = clipboardText;
23209
+ const type = guessLinkTypeFromPath(path);
23210
+ if (type === "email" && path.startsWith("mailto:")) {
23211
+ path = path.replace("mailto:", "");
23212
+ } else if (type === "tel" && path.startsWith("tel:")) {
23213
+ path = path.replace("tel:", "");
23214
+ }
23215
+ upsertLinkNode({
23216
+ path,
23217
+ type
23218
+ });
23219
+ event.preventDefault();
23220
+ return true;
23221
+ },
23222
+ import_lexical4.COMMAND_PRIORITY_LOW
23121
23223
  )
23122
23224
  );
23123
23225
  }, [editor, onConnectLink]);
23124
- const maybeShowLinkToolbar = (0, import_react147.useCallback)(() => {
23226
+ const maybeShowLinkToolbar = (0, import_react148.useCallback)(() => {
23125
23227
  if (!editor.isEditable()) {
23126
23228
  return;
23127
23229
  }
23128
- const selection = (0, import_lexical3.$getSelection)();
23129
- if (!(0, import_lexical3.$isRangeSelection)(selection)) {
23230
+ const selection = (0, import_lexical4.$getSelection)();
23231
+ if (!(0, import_lexical4.$isRangeSelection)(selection)) {
23130
23232
  setLinkPopoverState(void 0);
23131
23233
  return;
23132
23234
  }
@@ -23155,7 +23257,7 @@ function LinkNodePlugin({
23155
23257
  }
23156
23258
  });
23157
23259
  }, [editor, positioningAnchorEl]);
23158
- (0, import_react147.useEffect)(() => {
23260
+ (0, import_react148.useEffect)(() => {
23159
23261
  return editor.registerUpdateListener(({ editorState }) => {
23160
23262
  requestAnimationFrame(() => {
23161
23263
  editorState.read(() => {
@@ -23240,13 +23342,13 @@ function getLinkAncestor(node) {
23240
23342
  // src/components/ParameterInputs/rich-text/ListIndentPlugin.tsx
23241
23343
  init_emotion_jsx_shim();
23242
23344
  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");
23345
+ var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerContext");
23346
+ var import_utils10 = require("@lexical/utils");
23347
+ var import_lexical5 = require("lexical");
23348
+ var import_react149 = require("react");
23247
23349
  function isIndentPermitted(maxDepth) {
23248
- const selection = (0, import_lexical4.$getSelection)();
23249
- if (!(0, import_lexical4.$isRangeSelection)(selection)) {
23350
+ const selection = (0, import_lexical5.$getSelection)();
23351
+ if (!(0, import_lexical5.$isRangeSelection)(selection)) {
23250
23352
  return false;
23251
23353
  }
23252
23354
  const elementNodesInSelection = getElementNodesInSelection(selection);
@@ -23266,12 +23368,12 @@ function isIndentPermitted(maxDepth) {
23266
23368
  }
23267
23369
  function $isAnyOfSelectedNodesAListItemNode(selection) {
23268
23370
  const nodes = selection.getNodes();
23269
- return (0, import_utils8.$filter)(nodes, (node) => (0, import_list.$isListItemNode)(node) ? node : null).length > 0;
23371
+ return (0, import_utils10.$filter)(nodes, (node) => (0, import_list.$isListItemNode)(node) ? node : null).length > 0;
23270
23372
  }
23271
23373
  function $indentOverTab(selection) {
23272
23374
  const nodes = selection.getNodes();
23273
- const canIndentBlockNodes = (0, import_utils8.$filter)(nodes, (node) => {
23274
- if ((0, import_lexical4.$isBlockElementNode)(node) && node.canIndent()) {
23375
+ const canIndentBlockNodes = (0, import_utils10.$filter)(nodes, (node) => {
23376
+ if ((0, import_lexical5.$isBlockElementNode)(node) && node.canIndent()) {
23275
23377
  return node;
23276
23378
  }
23277
23379
  return null;
@@ -23283,13 +23385,13 @@ function $indentOverTab(selection) {
23283
23385
  const focus = selection.focus;
23284
23386
  const first = focus.isBefore(anchor) ? focus : anchor;
23285
23387
  const firstNode = first.getNode();
23286
- const firstBlock = (0, import_utils8.$getNearestBlockElementAncestorOrThrow)(firstNode);
23388
+ const firstBlock = (0, import_utils10.$getNearestBlockElementAncestorOrThrow)(firstNode);
23287
23389
  if (firstBlock.canIndent()) {
23288
23390
  const firstBlockKey = firstBlock.getKey();
23289
- let selectionAtStart = (0, import_lexical4.$createRangeSelection)();
23391
+ let selectionAtStart = (0, import_lexical5.$createRangeSelection)();
23290
23392
  selectionAtStart.anchor.set(firstBlockKey, 0, "element");
23291
23393
  selectionAtStart.focus.set(firstBlockKey, 0, "element");
23292
- selectionAtStart = (0, import_lexical4.$normalizeSelection__EXPERIMENTAL)(selectionAtStart);
23394
+ selectionAtStart = (0, import_lexical5.$normalizeSelection__EXPERIMENTAL)(selectionAtStart);
23293
23395
  if (selectionAtStart.anchor.is(first)) {
23294
23396
  return true;
23295
23397
  }
@@ -23297,901 +23399,436 @@ function $indentOverTab(selection) {
23297
23399
  return false;
23298
23400
  }
23299
23401
  function ListIndentPlugin({ maxDepth }) {
23300
- const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
23301
- const isInListItemNode = (0, import_react148.useRef)(false);
23302
- (0, import_react148.useEffect)(() => {
23402
+ const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
23403
+ const isInListItemNode = (0, import_react149.useRef)(false);
23404
+ (0, import_react149.useEffect)(() => {
23303
23405
  return editor.registerCommand(
23304
- import_lexical4.SELECTION_CHANGE_COMMAND,
23406
+ import_lexical5.SELECTION_CHANGE_COMMAND,
23305
23407
  () => {
23306
23408
  editor.read(() => {
23307
- const selection = (0, import_lexical4.$getSelection)();
23308
- if (!(0, import_lexical4.$isRangeSelection)(selection) || !selection.isCollapsed()) {
23409
+ const selection = (0, import_lexical5.$getSelection)();
23410
+ if (!(0, import_lexical5.$isRangeSelection)(selection) || !selection.isCollapsed()) {
23309
23411
  isInListItemNode.current = false;
23310
23412
  return false;
23311
23413
  }
23312
- isInListItemNode.current = (0, import_utils8.$getNearestNodeOfType)(selection.anchor.getNode(), import_list.ListNode) !== null;
23414
+ isInListItemNode.current = (0, import_utils10.$getNearestNodeOfType)(selection.anchor.getNode(), import_list.ListNode) !== null;
23313
23415
  });
23314
23416
  return false;
23315
23417
  },
23316
- import_lexical4.COMMAND_PRIORITY_NORMAL
23418
+ import_lexical5.COMMAND_PRIORITY_NORMAL
23317
23419
  );
23318
23420
  }, [editor]);
23319
- (0, import_react148.useEffect)(() => {
23320
- return (0, import_utils8.mergeRegister)(
23421
+ (0, import_react149.useEffect)(() => {
23422
+ return (0, import_utils10.mergeRegister)(
23321
23423
  editor.registerCommand(
23322
- import_lexical4.INDENT_CONTENT_COMMAND,
23424
+ import_lexical5.INDENT_CONTENT_COMMAND,
23323
23425
  () => !isIndentPermitted(maxDepth),
23324
- import_lexical4.COMMAND_PRIORITY_CRITICAL
23426
+ import_lexical5.COMMAND_PRIORITY_CRITICAL
23325
23427
  ),
23326
23428
  editor.registerCommand(
23327
- import_lexical4.KEY_TAB_COMMAND,
23429
+ import_lexical5.KEY_TAB_COMMAND,
23328
23430
  (event) => {
23329
- const selection = (0, import_lexical4.$getSelection)();
23330
- if (!(0, import_lexical4.$isRangeSelection)(selection) || !isInListItemNode.current && !$isAnyOfSelectedNodesAListItemNode(selection)) {
23431
+ const selection = (0, import_lexical5.$getSelection)();
23432
+ if (!(0, import_lexical5.$isRangeSelection)(selection) || !isInListItemNode.current && !$isAnyOfSelectedNodesAListItemNode(selection)) {
23331
23433
  return false;
23332
23434
  }
23333
23435
  event.preventDefault();
23334
23436
  if ($indentOverTab(selection)) {
23335
- const command = event.shiftKey ? import_lexical4.OUTDENT_CONTENT_COMMAND : import_lexical4.INDENT_CONTENT_COMMAND;
23437
+ const command = event.shiftKey ? import_lexical5.OUTDENT_CONTENT_COMMAND : import_lexical5.INDENT_CONTENT_COMMAND;
23336
23438
  return editor.dispatchCommand(command, void 0);
23337
23439
  }
23338
23440
  return false;
23339
23441
  },
23340
- import_lexical4.COMMAND_PRIORITY_CRITICAL
23442
+ import_lexical5.COMMAND_PRIORITY_CRITICAL
23341
23443
  )
23342
23444
  );
23343
23445
  }, [editor, maxDepth]);
23344
23446
  return null;
23345
23447
  }
23346
23448
 
23347
- // src/components/ParameterInputs/rich-text/RichTextToolbar.tsx
23449
+ // src/components/ParameterInputs/rich-text/TableActionMenuPlugin.tsx
23348
23450
  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");
23451
+ var import_react150 = require("@emotion/react");
23452
+ var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
23453
+ var import_useLexicalEditable = require("@lexical/react/useLexicalEditable");
23355
23454
  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");
23455
+ var import_lexical6 = require("lexical");
23456
+ var import_react151 = require("react");
23359
23457
  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);
23458
+ function computeSelectionCount(selection) {
23459
+ const selectionShape = selection.getShape();
23460
+ return {
23461
+ columns: selectionShape.toX - selectionShape.fromX + 1,
23462
+ rows: selectionShape.toY - selectionShape.fromY + 1
23463
+ };
23464
+ }
23465
+ var tableActionMenuTrigger = import_react150.css`
23466
+ position: absolute;
23467
+ transform: translate(calc(-100% - 1px), 1px);
23417
23468
  `;
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;
23469
+ var TableActionMenuTrigger = (0, import_react151.forwardRef)((props, ref) => {
23470
+ const { tableCellEl, positioningAnchorEl, ...rest } = props;
23471
+ const [coordinates, setCoordinates] = (0, import_react151.useState)({ x: 0, y: 0 });
23472
+ (0, import_react151.useLayoutEffect)(() => {
23473
+ const rect = tableCellEl.getBoundingClientRect();
23474
+ const parentRect = positioningAnchorEl.getBoundingClientRect();
23475
+ const relativeX = rect.right - parentRect.left + positioningAnchorEl.scrollLeft;
23476
+ const relativeY = rect.top - parentRect.top + positioningAnchorEl.scrollTop;
23477
+ setCoordinates({ x: relativeX, y: relativeY });
23478
+ }, [tableCellEl, positioningAnchorEl]);
23479
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23480
+ IconButton,
23481
+ {
23482
+ ref,
23483
+ css: [
23484
+ tableActionMenuTrigger,
23485
+ {
23486
+ top: coordinates.y,
23487
+ left: coordinates.x
23488
+ }
23489
+ ],
23490
+ size: "xs",
23491
+ buttonType: "unimportant",
23492
+ ...rest,
23493
+ children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "chevron-down", size: "1rem", iconColor: "currentColor" })
23455
23494
  }
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
- });
23495
+ );
23496
+ });
23497
+ TableActionMenuTrigger.displayName = "TableActionMenuTrigger";
23498
+ function TableActionMenu({
23499
+ tableCellNode: _tableCellNode,
23500
+ menuPortalEl,
23501
+ tableCellEl,
23502
+ positioningAnchorEl
23503
+ }) {
23504
+ const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
23505
+ const [tableCellNode, updateTableCellNode] = (0, import_react151.useState)(_tableCellNode);
23506
+ const [selectionCounts, updateSelectionCounts] = (0, import_react151.useState)({
23507
+ columns: 1,
23508
+ rows: 1
23509
+ });
23510
+ const [menuTriggerKey, setMenuTriggerKey] = (0, import_react151.useState)(0);
23511
+ const incrementMenuTriggerKey = () => {
23512
+ setMenuTriggerKey((key) => key += 1);
23513
+ };
23514
+ (0, import_react151.useEffect)(() => {
23515
+ return editor.registerMutationListener(
23516
+ import_table.TableCellNode,
23517
+ (nodeMutations) => {
23518
+ const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
23519
+ if (nodeUpdated) {
23520
+ editor.getEditorState().read(() => {
23521
+ updateTableCellNode(tableCellNode.getLatest());
23478
23522
  });
23479
23523
  }
23480
- });
23524
+ },
23525
+ { skipInitialization: true }
23526
+ );
23527
+ }, [editor, tableCellNode]);
23528
+ (0, import_react151.useEffect)(() => {
23529
+ editor.getEditorState().read(() => {
23530
+ const selection = (0, import_lexical6.$getSelection)();
23531
+ if ((0, import_table.$isTableSelection)(selection)) {
23532
+ updateSelectionCounts(computeSelectionCount(selection));
23533
+ }
23481
23534
  });
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);
23535
+ }, [editor]);
23536
+ const clearTableSelection = (0, import_react151.useCallback)(() => {
23537
+ editor.update(() => {
23538
+ if (tableCellNode.isAttached()) {
23539
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23540
+ const tableElement2 = editor.getElementByKey(
23541
+ tableNode.getKey()
23542
+ );
23543
+ if (!tableElement2) {
23544
+ throw new Error("Expected to find tableElement in DOM");
23545
+ }
23546
+ const tableSelection = (0, import_table.getTableObserverFromTableElement)(tableElement2);
23547
+ if (tableSelection !== null) {
23548
+ tableSelection.clearHighlight();
23549
+ }
23550
+ tableNode.markDirty();
23551
+ updateTableCellNode(tableCellNode.getLatest());
23492
23552
  }
23493
- }
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);
23553
+ const rootNode = (0, import_lexical6.$getRoot)();
23554
+ rootNode.selectStart();
23499
23555
  });
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);
23556
+ }, [editor, tableCellNode]);
23557
+ const insertTableRowAtSelection = (0, import_react151.useCallback)(
23558
+ (shouldInsertAfter) => {
23559
+ editor.update(() => {
23560
+ (0, import_table.$insertTableRow__EXPERIMENTAL)(shouldInsertAfter);
23561
+ });
23562
+ incrementMenuTriggerKey();
23563
+ },
23564
+ [editor]
23565
+ );
23566
+ const insertTableColumnAtSelection = (0, import_react151.useCallback)(
23567
+ (shouldInsertAfter) => {
23568
+ editor.update(() => {
23569
+ for (let i = 0; i < selectionCounts.columns; i++) {
23570
+ (0, import_table.$insertTableColumn__EXPERIMENTAL)(shouldInsertAfter);
23571
+ }
23572
+ });
23573
+ incrementMenuTriggerKey();
23574
+ },
23575
+ [editor, selectionCounts.columns]
23576
+ );
23577
+ const deleteTableRowAtSelection = (0, import_react151.useCallback)(() => {
23578
+ editor.update(() => {
23579
+ (0, import_table.$deleteTableRow__EXPERIMENTAL)();
23580
+ });
23581
+ incrementMenuTriggerKey();
23582
+ }, [editor]);
23583
+ const deleteTableAtSelection = (0, import_react151.useCallback)(() => {
23584
+ editor.update(() => {
23585
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23586
+ tableNode.remove();
23587
+ clearTableSelection();
23588
+ });
23589
+ }, [editor, tableCellNode, clearTableSelection]);
23590
+ const deleteTableColumnAtSelection = (0, import_react151.useCallback)(() => {
23591
+ editor.update(() => {
23592
+ (0, import_table.$deleteTableColumn__EXPERIMENTAL)();
23593
+ });
23594
+ incrementMenuTriggerKey();
23595
+ }, [editor]);
23596
+ const toggleTableRowIsHeader = (0, import_react151.useCallback)(() => {
23597
+ editor.update(() => {
23598
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23599
+ const tableRowIndex = (0, import_table.$getTableRowIndexFromTableCellNode)(tableCellNode);
23600
+ const tableRows = tableNode.getChildren();
23601
+ if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
23602
+ throw new Error("Expected table cell to be inside of table row.");
23513
23603
  }
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;
23528
- },
23529
- import_lexical5.COMMAND_PRIORITY_CRITICAL
23530
- );
23531
- }, [editor, updateToolbar]);
23532
- (0, import_react150.useEffect)(() => {
23533
- return editor.registerUpdateListener(({ editorState }) => {
23534
- requestAnimationFrame(() => {
23535
- editorState.read(() => {
23536
- updateToolbar();
23537
- });
23604
+ const tableRow2 = tableRows[tableRowIndex];
23605
+ if (!(0, import_table.$isTableRowNode)(tableRow2)) {
23606
+ throw new Error("Expected table row");
23607
+ }
23608
+ tableRow2.getChildren().forEach((tableCell) => {
23609
+ if (!(0, import_table.$isTableCellNode)(tableCell)) {
23610
+ throw new Error("Expected table cell");
23611
+ }
23612
+ tableCell.toggleHeaderStyle(import_table.TableCellHeaderStates.ROW);
23538
23613
  });
23614
+ clearTableSelection();
23539
23615
  });
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
- ]
23616
+ }, [editor, tableCellNode, clearTableSelection]);
23617
+ const toggleTableColumnIsHeader = (0, import_react151.useCallback)(() => {
23618
+ editor.update(() => {
23619
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23620
+ const tableColumnIndex = (0, import_table.$getTableColumnIndexFromTableCellNode)(tableCellNode);
23621
+ const tableRows = tableNode.getChildren();
23622
+ const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length));
23623
+ if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {
23624
+ throw new Error("Expected table cell to be inside of table row.");
23570
23625
  }
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) })
23626
+ for (let r = 0; r < tableRows.length; r++) {
23627
+ const tableRow2 = tableRows[r];
23628
+ if (!(0, import_table.$isTableRowNode)(tableRow2)) {
23629
+ throw new Error("Expected table row");
23584
23630
  }
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
- ))
23631
+ const tableCells = tableRow2.getChildren();
23632
+ if (tableColumnIndex >= tableCells.length) {
23633
+ continue;
23602
23634
  }
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" })
23635
+ const tableCell = tableCells[tableColumnIndex];
23636
+ if (!(0, import_table.$isTableCellNode)(tableCell)) {
23637
+ throw new Error("Expected table cell");
23614
23638
  }
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",
23639
+ tableCell.toggleHeaderStyle(import_table.TableCellHeaderStates.COLUMN);
23640
+ }
23641
+ clearTableSelection();
23642
+ });
23643
+ }, [editor, tableCellNode, clearTableSelection]);
23644
+ const menuItemCss = (0, import_react150.css)({
23645
+ fontSize: "var(--fs-sm)"
23646
+ });
23647
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
23648
+ Menu,
23649
+ {
23650
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23651
+ TableActionMenuTrigger,
23652
+ {
23653
+ tableCellEl,
23654
+ positioningAnchorEl
23655
+ },
23656
+ menuTriggerKey
23657
+ ),
23658
+ portalElement: menuPortalEl,
23659
+ maxMenuHeight: "300px",
23660
+ children: [
23661
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
23662
+ MenuItem,
23632
23663
  {
23633
23664
  onClick: () => {
23634
- activeElement === "orderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_ORDERED_LIST_COMMAND, void 0);
23665
+ insertTableRowAtSelection(false);
23635
23666
  },
23636
- css: [
23637
- richTextToolbarButton,
23638
- activeElement === "orderedList" ? richTextToolbarButtonActive : null
23639
- ],
23640
- children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(RichTextToolbarIcon, { icon: "layout-list-numbered" })
23667
+ css: menuItemCss,
23668
+ children: [
23669
+ "Insert ",
23670
+ selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
23671
+ " above"
23672
+ ]
23641
23673
  }
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" })
23674
+ ),
23675
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableRowAtSelection(true), css: menuItemCss, children: [
23676
+ "Insert ",
23677
+ selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
23678
+ " below"
23652
23679
  ] }),
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)
23680
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23681
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(false), css: menuItemCss, children: [
23682
+ "Insert ",
23683
+ selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
23684
+ " left"
23685
+ ] }),
23686
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(true), css: menuItemCss, children: [
23687
+ "Insert ",
23688
+ selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
23689
+ " right"
23690
+ ] }),
23691
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23692
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableColumnAtSelection(), css: menuItemCss, children: "Delete column" }),
23693
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableRowAtSelection(), css: menuItemCss, children: "Delete row" }),
23694
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableAtSelection(), css: menuItemCss, children: "Delete table" }),
23695
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23696
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => toggleTableRowIsHeader(), css: menuItemCss, children: [
23697
+ (tableCellNode.__headerState & import_table.TableCellHeaderStates.ROW) === import_table.TableCellHeaderStates.ROW ? "Remove" : "Add",
23698
+ " ",
23699
+ "row header"
23700
+ ] }),
23701
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => toggleTableColumnIsHeader(), css: menuItemCss, children: [
23702
+ (tableCellNode.__headerState & import_table.TableCellHeaderStates.COLUMN) === import_table.TableCellHeaderStates.COLUMN ? "Remove" : "Add",
23703
+ " ",
23704
+ "column header"
23705
+ ] })
23706
+ ]
23707
+ }
23735
23708
  );
23736
- const visibleTextualElements = (0, import_react150.useMemo)(() => {
23737
- if (!TEXTUAL_ELEMENTS.includes(activeElement)) {
23738
- return enabledTextualElements;
23709
+ }
23710
+ function TableCellActionMenuContainer({
23711
+ menuPortalEl,
23712
+ positioningAnchorEl
23713
+ }) {
23714
+ const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
23715
+ const [tableCellNode, setTableMenuCellNode] = (0, import_react151.useState)(null);
23716
+ const [tableCellNodeEl, _setTableMenuCellNodeEl] = (0, import_react151.useState)(null);
23717
+ const [tableCellMenuPortalEl, setTableMenuCellMenuPortalEl] = (0, import_react151.useState)(null);
23718
+ (0, import_react151.useEffect)(() => {
23719
+ const newPortalEl = document.createElement("div");
23720
+ setTableMenuCellMenuPortalEl(newPortalEl);
23721
+ menuPortalEl.appendChild(newPortalEl);
23722
+ return () => {
23723
+ newPortalEl.remove();
23724
+ };
23725
+ }, [menuPortalEl]);
23726
+ const setTableMenuCellNodeElem = (0, import_react151.useCallback)((elem) => {
23727
+ if (elem) {
23728
+ _setTableMenuCellNodeEl(elem);
23729
+ } else {
23730
+ _setTableMenuCellNodeEl(null);
23739
23731
  }
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);
23732
+ }, []);
23733
+ const $moveMenu = (0, import_react151.useCallback)(() => {
23734
+ const selection = (0, import_lexical6.$getSelection)();
23735
+ const nativeSelection = window.getSelection();
23736
+ const activeElement = document.activeElement;
23737
+ if (selection == null) {
23738
+ setTableMenuCellNode(null);
23739
+ return;
23740
+ }
23741
+ const rootElement = editor.getRootElement();
23742
+ if ((0, import_lexical6.$isRangeSelection)(selection) && rootElement !== null && nativeSelection !== null && rootElement.contains(nativeSelection.anchorNode)) {
23743
+ const tableCellNodeFromSelection = (0, import_table.$getTableCellNodeFromLexicalNode)(selection.anchor.getNode());
23744
+ if (tableCellNodeFromSelection == null) {
23745
+ setTableMenuCellNode(null);
23746
+ setTableMenuCellNodeElem(null);
23747
+ return;
23744
23748
  }
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");
23749
+ const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
23750
+ if (tableCellParentNodeDOM == null) {
23751
+ setTableMenuCellNode(null);
23752
+ setTableMenuCellNodeElem(null);
23753
+ return;
23754
+ }
23755
+ setTableMenuCellNode(tableCellNodeFromSelection);
23756
+ setTableMenuCellNodeElem(tableCellParentNodeDOM);
23757
+ } else if (!activeElement) {
23758
+ setTableMenuCellNode(null);
23759
+ setTableMenuCellNodeElem(null);
23771
23760
  }
23772
- if (visibleLists.size > 0) {
23773
- visibleLists.forEach((type) => {
23774
- visibleElements.add(type);
23761
+ }, [editor, setTableMenuCellNodeElem]);
23762
+ (0, import_react151.useEffect)(() => {
23763
+ return editor.registerUpdateListener(() => {
23764
+ editor.getEditorState().read(() => {
23765
+ $moveMenu();
23775
23766
  });
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
- };
23767
+ });
23768
+ });
23769
+ return tableCellNode != null && tableCellNodeEl != null && tableCellMenuPortalEl != null && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23770
+ TableActionMenu,
23771
+ {
23772
+ tableCellNode,
23773
+ menuPortalEl: tableCellMenuPortalEl,
23774
+ tableCellEl: tableCellNodeEl,
23775
+ positioningAnchorEl
23776
+ },
23777
+ tableCellNode.getKey()
23778
+ );
23779
+ }
23780
+ function TableActionMenuPlugin({
23781
+ positioningAnchorEl,
23782
+ menuPortalEl
23783
+ }) {
23784
+ const isEditable = (0, import_useLexicalEditable.useLexicalEditable)();
23785
+ return isEditable ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(TableCellActionMenuContainer, { menuPortalEl, positioningAnchorEl }) : null;
23786
+ }
23811
23787
 
23812
- // src/components/ParameterInputs/rich-text/TableActionMenuPlugin.tsx
23788
+ // src/components/ParameterInputs/rich-text/TableCellResizerPlugin.tsx
23813
23789
  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");
23790
+ var import_react152 = require("@emotion/react");
23791
+ var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
23792
+ var import_useLexicalEditable2 = require("@lexical/react/useLexicalEditable");
23817
23793
  var import_table2 = require("@lexical/table");
23818
- var import_lexical6 = require("lexical");
23819
- var import_react152 = require("react");
23794
+ var import_utils12 = require("@lexical/utils");
23795
+ var import_lexical7 = require("lexical");
23796
+ var import_react153 = require("react");
23797
+ var import_react_dom3 = require("react-dom");
23820
23798
  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`
23799
+ var MIN_ROW_HEIGHT = 33;
23800
+ var MIN_COLUMN_WIDTH = 50;
23801
+ var tableResizer = import_react152.css`
23829
23802
  position: absolute;
23830
- transform: translate(calc(-100% - 1px), 1px);
23803
+ z-index: var(--z-10);
23831
23804
  `;
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" })
23857
- }
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);
23876
- };
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());
23885
- });
23886
- }
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");
23908
- }
23909
- const tableSelection = (0, import_table2.getTableObserverFromTableElement)(tableElement2);
23910
- if (tableSelection !== null) {
23911
- tableSelection.clearHighlight();
23912
- }
23913
- tableNode.markDirty();
23914
- updateTableCellNode(tableCellNode.getLatest());
23915
- }
23916
- const rootNode = (0, import_lexical6.$getRoot)();
23917
- rootNode.selectStart();
23918
- });
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();
23926
- },
23927
- [editor]
23928
- );
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);
23934
- }
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
- }
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.");
23988
- }
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");
23993
- }
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");
24001
- }
24002
- tableCell.toggleHeaderStyle(import_table2.TableCellHeaderStates.COLUMN);
24003
- }
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
24018
- },
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
- ]
24070
- }
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();
24087
- };
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;
24111
- }
24112
- const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
24113
- if (tableCellParentNodeDOM == null) {
24114
- setTableMenuCellNode(null);
24115
- setTableMenuCellNodeElem(null);
24116
- return;
24117
- }
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,
24138
- positioningAnchorEl
24139
- },
24140
- tableCellNode.getKey()
24141
- );
24142
- }
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
-
24151
- // src/components/ParameterInputs/rich-text/TableCellResizerPlugin.tsx
24152
- 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");
24156
- var import_table3 = require("@lexical/table");
24157
- var import_utils12 = require("@lexical/utils");
24158
- var import_lexical7 = require("lexical");
24159
- 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;
23805
+ var fixedGetDOMCellFromTarget = (node) => {
23806
+ let currentNode = node;
23807
+ while (currentNode != null) {
23808
+ const nodeName = currentNode.nodeName;
23809
+ if (nodeName === "TD" || nodeName === "TH") {
23810
+ const cell2 = currentNode._cell;
23811
+ if (cell2 === void 0) {
23812
+ return {
23813
+ elem: currentNode
23814
+ };
23815
+ }
23816
+ return cell2;
24180
23817
  }
24181
23818
  currentNode = currentNode.parentNode;
24182
23819
  }
24183
23820
  return null;
24184
23821
  };
24185
23822
  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)(() => {
23823
+ const targetRef = (0, import_react153.useRef)(null);
23824
+ const resizerRef = (0, import_react153.useRef)(null);
23825
+ const tableRectRef = (0, import_react153.useRef)(null);
23826
+ const mouseStartPosRef = (0, import_react153.useRef)(null);
23827
+ const [mouseCurrentPos, updateMouseCurrentPos] = (0, import_react153.useState)(null);
23828
+ const [activeCell, updateActiveCell] = (0, import_react153.useState)(null);
23829
+ const [isMouseDown, updateIsMouseDown] = (0, import_react153.useState)(false);
23830
+ const [draggingDirection, updateDraggingDirection] = (0, import_react153.useState)(null);
23831
+ const resetState = (0, import_react153.useCallback)(() => {
24195
23832
  updateActiveCell(null);
24196
23833
  targetRef.current = null;
24197
23834
  updateDraggingDirection(null);
@@ -24201,7 +23838,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24201
23838
  const isMouseDownOnEvent = (event) => {
24202
23839
  return (event.buttons & 1) === 1;
24203
23840
  };
24204
- (0, import_react154.useEffect)(() => {
23841
+ (0, import_react153.useEffect)(() => {
24205
23842
  const onMouseMove = (event) => {
24206
23843
  setTimeout(() => {
24207
23844
  const target = event.target;
@@ -24225,7 +23862,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24225
23862
  if (!tableCellNode) {
24226
23863
  throw new Error("TableCellResizer: Table cell node not found.");
24227
23864
  }
24228
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23865
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24229
23866
  const tableElement2 = editor.getElementByKey(tableNode.getKey());
24230
23867
  if (!tableElement2) {
24231
23868
  throw new Error("TableCellResizer: Table element not found.");
@@ -24268,7 +23905,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24268
23905
  }
24269
23906
  return false;
24270
23907
  };
24271
- const updateRowHeight = (0, import_react154.useCallback)(
23908
+ const updateRowHeight = (0, import_react153.useCallback)(
24272
23909
  (heightChange) => {
24273
23910
  if (!activeCell) {
24274
23911
  throw new Error("TableCellResizer: Expected active cell.");
@@ -24276,17 +23913,17 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24276
23913
  editor.update(
24277
23914
  () => {
24278
23915
  const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
24279
- if (!(0, import_table3.$isTableCellNode)(tableCellNode)) {
23916
+ if (!(0, import_table2.$isTableCellNode)(tableCellNode)) {
24280
23917
  throw new Error("TableCellResizer: Table cell node not found.");
24281
23918
  }
24282
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24283
- const tableRowIndex = (0, import_table3.$getTableRowIndexFromTableCellNode)(tableCellNode);
23919
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23920
+ const tableRowIndex = (0, import_table2.$getTableRowIndexFromTableCellNode)(tableCellNode);
24284
23921
  const tableRows = tableNode.getChildren();
24285
23922
  if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
24286
23923
  throw new Error("Expected table cell to be inside of table row.");
24287
23924
  }
24288
23925
  const tableRow2 = tableRows[tableRowIndex];
24289
- if (!(0, import_table3.$isTableRowNode)(tableRow2)) {
23926
+ if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
24290
23927
  throw new Error("Expected table row");
24291
23928
  }
24292
23929
  let height = tableRow2.getHeight();
@@ -24330,7 +23967,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24330
23967
  }
24331
23968
  }
24332
23969
  };
24333
- const updateColumnWidth = (0, import_react154.useCallback)(
23970
+ const updateColumnWidth = (0, import_react153.useCallback)(
24334
23971
  (widthChange) => {
24335
23972
  if (!activeCell) {
24336
23973
  throw new Error("TableCellResizer: Expected active cell.");
@@ -24338,11 +23975,11 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24338
23975
  editor.update(
24339
23976
  () => {
24340
23977
  const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
24341
- if (!(0, import_table3.$isTableCellNode)(tableCellNode)) {
23978
+ if (!(0, import_table2.$isTableCellNode)(tableCellNode)) {
24342
23979
  throw new Error("TableCellResizer: Table cell node not found.");
24343
23980
  }
24344
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24345
- const [tableMap] = (0, import_table3.$computeTableMapSkipCellCheck)(tableNode, null, null);
23981
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23982
+ const [tableMap] = (0, import_table2.$computeTableMapSkipCellCheck)(tableNode, null, null);
24346
23983
  const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
24347
23984
  if (columnIndex === void 0) {
24348
23985
  throw new Error("TableCellResizer: Table column not found.");
@@ -24364,7 +24001,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24364
24001
  },
24365
24002
  [activeCell, editor]
24366
24003
  );
24367
- const mouseUpHandler = (0, import_react154.useCallback)(
24004
+ const mouseUpHandler = (0, import_react153.useCallback)(
24368
24005
  (direction) => {
24369
24006
  const handler = (event) => {
24370
24007
  event.preventDefault();
@@ -24393,7 +24030,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24393
24030
  },
24394
24031
  [activeCell, resetState, updateColumnWidth, updateRowHeight]
24395
24032
  );
24396
- const toggleResize = (0, import_react154.useCallback)(
24033
+ const toggleResize = (0, import_react153.useCallback)(
24397
24034
  (direction) => (event) => {
24398
24035
  event.preventDefault();
24399
24036
  event.stopPropagation();
@@ -24410,7 +24047,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24410
24047
  },
24411
24048
  [activeCell, mouseUpHandler]
24412
24049
  );
24413
- const getResizers = (0, import_react154.useCallback)(() => {
24050
+ const getResizers = (0, import_react153.useCallback)(() => {
24414
24051
  if (activeCell) {
24415
24052
  const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
24416
24053
  const parentRect = positioningAnchorEl.getBoundingClientRect();
@@ -24449,99 +24086,593 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24449
24086
  }
24450
24087
  styles[draggingDirection].backgroundColor = "#adf";
24451
24088
  }
24452
- return styles;
24089
+ return styles;
24090
+ }
24091
+ return {
24092
+ bottom: null,
24093
+ left: null,
24094
+ right: null,
24095
+ top: null
24096
+ };
24097
+ }, [activeCell, draggingDirection, mouseCurrentPos, positioningAnchorEl]);
24098
+ const resizerStyles = getResizers();
24099
+ 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: [
24100
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
24101
+ "div",
24102
+ {
24103
+ css: tableResizer,
24104
+ style: resizerStyles.right || void 0,
24105
+ onMouseDown: toggleResize("right")
24106
+ }
24107
+ ),
24108
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
24109
+ "div",
24110
+ {
24111
+ css: tableResizer,
24112
+ style: resizerStyles.bottom || void 0,
24113
+ onMouseDown: toggleResize("bottom")
24114
+ }
24115
+ )
24116
+ ] }) });
24117
+ }
24118
+ function TableCellResizerPlugin({ positioningAnchorEl }) {
24119
+ const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
24120
+ const isEditable = (0, import_useLexicalEditable2.useLexicalEditable)();
24121
+ return (0, import_react153.useMemo)(
24122
+ () => isEditable ? (0, import_react_dom3.createPortal)(
24123
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(TableCellResizer, { editor, positioningAnchorEl }),
24124
+ positioningAnchorEl
24125
+ ) : null,
24126
+ [editor, isEditable, positioningAnchorEl]
24127
+ );
24128
+ }
24129
+
24130
+ // src/components/ParameterInputs/rich-text/TableSelectionPlugin.tsx
24131
+ init_emotion_jsx_shim();
24132
+ var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
24133
+ var import_table3 = require("@lexical/table");
24134
+ var import_lexical8 = require("lexical");
24135
+ var import_react154 = require("react");
24136
+ var TableSelectionPlugin = () => {
24137
+ const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
24138
+ const [closestTableCellNode, setClosestTableCellNode] = (0, import_react154.useState)(null);
24139
+ (0, import_react154.useEffect)(() => {
24140
+ return editor.registerCommand(
24141
+ import_lexical8.SELECTION_CHANGE_COMMAND,
24142
+ () => {
24143
+ editor.read(() => {
24144
+ const selection = (0, import_lexical8.$getSelection)();
24145
+ if (!(0, import_lexical8.$isRangeSelection)(selection) || !selection.isCollapsed()) {
24146
+ setClosestTableCellNode(null);
24147
+ return false;
24148
+ }
24149
+ const tableCellNode = (0, import_table3.$findCellNode)(selection.anchor.getNode());
24150
+ if (tableCellNode === null) {
24151
+ setClosestTableCellNode(null);
24152
+ return false;
24153
+ }
24154
+ setClosestTableCellNode(tableCellNode);
24155
+ });
24156
+ return false;
24157
+ },
24158
+ import_lexical8.COMMAND_PRIORITY_NORMAL
24159
+ );
24160
+ }, [editor]);
24161
+ (0, import_react154.useEffect)(() => {
24162
+ const onControlA = (event) => {
24163
+ if (event.key === "a" && (event.ctrlKey || event.metaKey)) {
24164
+ if (!closestTableCellNode) {
24165
+ return;
24166
+ }
24167
+ event.preventDefault();
24168
+ editor.update(() => {
24169
+ const selection = closestTableCellNode.select(0, closestTableCellNode.getChildrenSize());
24170
+ (0, import_lexical8.$setSelection)(selection);
24171
+ });
24172
+ }
24173
+ };
24174
+ return editor.registerRootListener((rootElement, prevRootElement) => {
24175
+ rootElement == null ? void 0 : rootElement.addEventListener("keydown", onControlA);
24176
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("keydown", onControlA);
24177
+ });
24178
+ }, [editor, closestTableCellNode]);
24179
+ return null;
24180
+ };
24181
+ var TableSelectionPlugin_default = TableSelectionPlugin;
24182
+
24183
+ // src/components/ParameterInputs/rich-text/toolbar/RichTextToolbar.tsx
24184
+ init_emotion_jsx_shim();
24185
+ var import_react156 = require("@emotion/react");
24186
+ var import_code2 = require("@lexical/code");
24187
+ var import_list2 = require("@lexical/list");
24188
+ var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
24189
+ var import_rich_text = require("@lexical/rich-text");
24190
+ var import_selection2 = require("@lexical/selection");
24191
+ var import_table4 = require("@lexical/table");
24192
+ var import_utils13 = require("@lexical/utils");
24193
+ var import_lexical9 = require("lexical");
24194
+ var import_react157 = require("react");
24195
+
24196
+ // src/components/ParameterInputs/rich-text/toolbar/constants.ts
24197
+ init_emotion_jsx_shim();
24198
+ var FORMATS_WITH_ICON = /* @__PURE__ */ new Map([
24199
+ ["bold", "format-bold"],
24200
+ ["italic", "format-italic"],
24201
+ ["underline", "format-underline"],
24202
+ ["strikethrough", "format-strike"],
24203
+ ["code", "format-code"],
24204
+ ["superscript", "format-superscript"],
24205
+ ["subscript", "format-subscript"]
24206
+ ]);
24207
+ var HEADING_ELEMENTS = ["h1", "h2", "h3", "h4", "h5", "h6"];
24208
+ var TEXTUAL_ELEMENTS = HEADING_ELEMENTS;
24209
+
24210
+ // src/components/ParameterInputs/rich-text/toolbar/useRichTextToolbarState.ts
24211
+ init_emotion_jsx_shim();
24212
+ var import_react155 = require("react");
24213
+ var useRichTextToolbarState = ({ config }) => {
24214
+ var _a;
24215
+ const enabledBuiltInFormats = (0, import_react155.useMemo)(() => {
24216
+ return richTextBuiltInFormats.filter((format) => {
24217
+ var _a2, _b;
24218
+ return (_b = (_a2 = config == null ? void 0 : config.formatting) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(format.type);
24219
+ });
24220
+ }, [config]);
24221
+ const enabledBuiltInElements = (0, import_react155.useMemo)(() => {
24222
+ return richTextBuiltInElements.filter((element) => {
24223
+ var _a2, _b;
24224
+ return (_b = (_a2 = config == null ? void 0 : config.elements) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(element.type);
24225
+ });
24226
+ }, [config]);
24227
+ const enabledBuiltInFormatsWithIcon = (0, import_react155.useMemo)(() => {
24228
+ return enabledBuiltInFormats.filter((format) => FORMATS_WITH_ICON.has(format.type));
24229
+ }, [enabledBuiltInFormats]);
24230
+ const enabledBuiltInFormatsWithoutIcon = enabledBuiltInFormats.filter(
24231
+ (format) => !FORMATS_WITH_ICON.has(format.type)
24232
+ );
24233
+ const [activeFormats, setActiveFormats] = (0, import_react155.useState)([]);
24234
+ const visibleFormatsWithIcon = (0, import_react155.useMemo)(() => {
24235
+ const visibleFormats = /* @__PURE__ */ new Set();
24236
+ activeFormats.filter((type) => FORMATS_WITH_ICON.has(type)).forEach((type) => {
24237
+ visibleFormats.add(type);
24238
+ });
24239
+ enabledBuiltInFormatsWithIcon.forEach((format) => {
24240
+ visibleFormats.add(format.type);
24241
+ });
24242
+ return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
24243
+ }, [activeFormats, enabledBuiltInFormatsWithIcon]);
24244
+ const visibleFormatsWithoutIcon = (0, import_react155.useMemo)(() => {
24245
+ const visibleFormats = /* @__PURE__ */ new Set();
24246
+ activeFormats.filter((type) => !FORMATS_WITH_ICON.has(type)).forEach((type) => {
24247
+ visibleFormats.add(type);
24248
+ });
24249
+ enabledBuiltInFormatsWithoutIcon.forEach((format) => {
24250
+ visibleFormats.add(format.type);
24251
+ });
24252
+ return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
24253
+ }, [activeFormats, enabledBuiltInFormatsWithoutIcon]);
24254
+ const [activeElement, setActiveElement] = (0, import_react155.useState)("paragraph");
24255
+ const enabledTextualElements = enabledBuiltInElements.filter(
24256
+ (element) => TEXTUAL_ELEMENTS.includes(element.type)
24257
+ );
24258
+ const visibleTextualElements = (0, import_react155.useMemo)(() => {
24259
+ if (!TEXTUAL_ELEMENTS.includes(activeElement)) {
24260
+ return enabledTextualElements;
24261
+ }
24262
+ return richTextBuiltInElements.filter(
24263
+ (element) => {
24264
+ var _a2, _b;
24265
+ 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);
24266
+ }
24267
+ );
24268
+ }, [activeElement, (_a = config == null ? void 0 : config.elements) == null ? void 0 : _a.builtIn, enabledTextualElements]);
24269
+ const [isLink, setIsLink] = (0, import_react155.useState)(false);
24270
+ const linkElementVisible = (0, import_react155.useMemo)(() => {
24271
+ return enabledBuiltInElements.some((element) => element.type === "link") || isLink;
24272
+ }, [isLink, enabledBuiltInElements]);
24273
+ const visibleLists = (0, import_react155.useMemo)(() => {
24274
+ return new Set(
24275
+ ["orderedList", "unorderedList"].filter(
24276
+ (type) => enabledBuiltInElements.some((element) => element.type === type) || activeElement === type
24277
+ )
24278
+ );
24279
+ }, [activeElement, enabledBuiltInElements]);
24280
+ const quoteElementVisible = (0, import_react155.useMemo)(() => {
24281
+ return enabledBuiltInElements.some((element) => element.type === "quote") || activeElement === "quote";
24282
+ }, [activeElement, enabledBuiltInElements]);
24283
+ const codeElementVisible = (0, import_react155.useMemo)(() => {
24284
+ return enabledBuiltInElements.some((element) => element.type === "code") || activeElement === "code";
24285
+ }, [activeElement, enabledBuiltInElements]);
24286
+ const tableElementVisible = (0, import_react155.useMemo)(() => {
24287
+ return enabledBuiltInElements.some((element) => element.type === "table") || activeElement === "table";
24288
+ }, [activeElement, enabledBuiltInElements]);
24289
+ const assetElementVisible = (0, import_react155.useMemo)(() => {
24290
+ return enabledBuiltInElements.some((element) => element.type === "asset") || activeElement === "asset";
24291
+ }, [activeElement, enabledBuiltInElements]);
24292
+ const visibleElementsWithIcons = (0, import_react155.useMemo)(() => {
24293
+ const visibleElements = /* @__PURE__ */ new Set();
24294
+ if (linkElementVisible) {
24295
+ visibleElements.add("link");
24296
+ }
24297
+ if (visibleLists.size > 0) {
24298
+ visibleLists.forEach((type) => {
24299
+ visibleElements.add(type);
24300
+ });
24301
+ }
24302
+ return visibleElements;
24303
+ }, [linkElementVisible, visibleLists]);
24304
+ const visibleInsertElementsWithIcons = (0, import_react155.useMemo)(() => {
24305
+ const visibleElements = /* @__PURE__ */ new Set();
24306
+ if (quoteElementVisible) {
24307
+ visibleElements.add("quote");
24308
+ }
24309
+ if (codeElementVisible) {
24310
+ visibleElements.add("code");
24311
+ }
24312
+ if (tableElementVisible) {
24313
+ visibleElements.add("table");
24314
+ }
24315
+ if (assetElementVisible) {
24316
+ visibleElements.add("asset");
24317
+ }
24318
+ return visibleElements;
24319
+ }, [codeElementVisible, quoteElementVisible, tableElementVisible, assetElementVisible]);
24320
+ return {
24321
+ activeFormats,
24322
+ setActiveFormats,
24323
+ activeElement,
24324
+ setActiveElement,
24325
+ visibleFormatsWithIcon,
24326
+ visibleFormatsWithoutIcon,
24327
+ visibleTextualElements,
24328
+ isLink,
24329
+ setIsLink,
24330
+ linkElementVisible,
24331
+ visibleLists,
24332
+ quoteElementVisible,
24333
+ codeElementVisible,
24334
+ tableElementVisible,
24335
+ assetElementVisible,
24336
+ visibleElementsWithIcons,
24337
+ visibleInsertElementsWithIcons
24338
+ };
24339
+ };
24340
+
24341
+ // src/components/ParameterInputs/rich-text/toolbar/RichTextToolbar.tsx
24342
+ var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
24343
+ var toolbar = import_react156.css`
24344
+ ${scrollbarStyles}
24345
+ background: var(--gray-50);
24346
+ border-radius: var(--rounded-base);
24347
+ display: flex;
24348
+ /* We add 1px because we use a 1px wide separator */
24349
+ gap: calc(var(--spacing-sm) + 1px);
24350
+ margin: 0 0 calc(var(--spacing-sm) + var(--spacing-xs)) 0;
24351
+ overflow: auto;
24352
+ padding: var(--spacing-sm);
24353
+ position: sticky;
24354
+ top: calc(var(--spacing-sm) * -2);
24355
+ z-index: 10;
24356
+ `;
24357
+ var toolbarGroup = import_react156.css`
24358
+ display: flex;
24359
+ flex-shrink: 0;
24360
+ gap: var(--spacing-xs);
24361
+ position: relative;
24362
+
24363
+ &:not(:first-child)::before {
24364
+ background-color: var(--gray-300);
24365
+ content: '';
24366
+ display: block;
24367
+ height: 24px;
24368
+ left: calc(var(--spacing-xs) * -1);
24369
+ position: absolute;
24370
+ top: 4px;
24371
+ width: 1px;
24372
+ }
24373
+ `;
24374
+ var richTextToolbarButton = import_react156.css`
24375
+ align-items: center;
24376
+ appearance: none;
24377
+ border: 0;
24378
+ border-radius: var(--rounded-sm);
24379
+ box-shadow: none;
24380
+ color: var(--gray-900);
24381
+ display: flex;
24382
+ flex-shrink: 0;
24383
+ height: 32px;
24384
+ justify-content: center;
24385
+ min-width: 32px;
24386
+ padding: 0 var(--spacing-sm);
24387
+ `;
24388
+ var richTextToolbarButtonActive = import_react156.css`
24389
+ background: var(--gray-200);
24390
+ `;
24391
+ var textStyleButton = import_react156.css`
24392
+ justify-content: space-between;
24393
+ min-width: 7rem;
24394
+ `;
24395
+ var toolbarIcon = import_react156.css`
24396
+ color: inherit;
24397
+ `;
24398
+ var toolbarChevron = import_react156.css`
24399
+ margin-left: var(--spacing-xs);
24400
+ `;
24401
+ var RichTextToolbarIcon = ({ icon }) => {
24402
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon, css: toolbarIcon, size: "1rem" });
24403
+ };
24404
+ var RichTextToolbar = ({ config, customControls, onInsertTable, onInsertAsset }) => {
24405
+ const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
24406
+ const {
24407
+ activeElement,
24408
+ setActiveElement,
24409
+ activeFormats,
24410
+ setActiveFormats,
24411
+ visibleFormatsWithIcon,
24412
+ visibleFormatsWithoutIcon,
24413
+ visibleTextualElements,
24414
+ isLink,
24415
+ setIsLink,
24416
+ linkElementVisible,
24417
+ visibleLists,
24418
+ codeElementVisible,
24419
+ quoteElementVisible,
24420
+ visibleElementsWithIcons,
24421
+ visibleInsertElementsWithIcons,
24422
+ tableElementVisible,
24423
+ assetElementVisible
24424
+ } = useRichTextToolbarState({ config });
24425
+ const onSelectElement = (type) => {
24426
+ if (activeElement === type) {
24427
+ return;
24428
+ }
24429
+ editor.focus(() => {
24430
+ editor.update(() => {
24431
+ const selection = (0, import_lexical9.$getSelection)();
24432
+ if (HEADING_ELEMENTS.includes(type)) {
24433
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createHeadingNode)(type));
24434
+ } else if (type === "paragraph") {
24435
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_lexical9.$createParagraphNode)());
24436
+ } else if (type === "quote") {
24437
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createQuoteNode)());
24438
+ } else if (type === "code") {
24439
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_code2.$createCodeNode)());
24440
+ } else if (type === "table" && onInsertTable) {
24441
+ onInsertTable().then((dimensions) => {
24442
+ if (!dimensions) {
24443
+ return;
24444
+ }
24445
+ const { rows, columns } = dimensions;
24446
+ editor.focus(() => {
24447
+ editor.update(() => {
24448
+ (0, import_lexical9.$insertNodes)([(0, import_table4.$createTableNodeWithDimensions)(rows, columns, false)]);
24449
+ });
24450
+ });
24451
+ });
24452
+ } else if (type === "asset" && onInsertAsset) {
24453
+ onInsertAsset();
24454
+ }
24455
+ });
24456
+ });
24457
+ };
24458
+ const updateToolbar = (0, import_react157.useCallback)(() => {
24459
+ const selection = (0, import_lexical9.$getSelection)();
24460
+ if (!(0, import_lexical9.$isRangeSelection)(selection)) {
24461
+ return;
24462
+ }
24463
+ const newActiveFormats = [];
24464
+ for (const format of richTextBuiltInFormats) {
24465
+ if (selection.hasFormat(format.type)) {
24466
+ newActiveFormats.push(format.type);
24467
+ }
24453
24468
  }
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")
24469
- }
24470
- ),
24471
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24472
- "div",
24473
- {
24474
- css: tableResizer,
24475
- style: resizerStyles.bottom || void 0,
24476
- onMouseDown: toggleResize("bottom")
24469
+ setActiveFormats(newActiveFormats);
24470
+ const anchorNode = selection.anchor.getNode();
24471
+ let element = anchorNode.getKey() === "root" ? anchorNode : (0, import_utils13.$findMatchingParent)(anchorNode, (e) => {
24472
+ const parent = e.getParent();
24473
+ return parent !== null && (0, import_lexical9.$isRootOrShadowRoot)(parent);
24474
+ });
24475
+ if (element === null) {
24476
+ element = anchorNode.getTopLevelElementOrThrow();
24477
+ }
24478
+ const elementKey = element.getKey();
24479
+ const elementDOM = editor.getElementByKey(elementKey);
24480
+ if (elementDOM !== null) {
24481
+ if ((0, import_list2.$isListNode)(element)) {
24482
+ const parentList = (0, import_utils13.$getNearestNodeOfType)(anchorNode, import_list2.ListNode);
24483
+ const type = parentList ? parentList.getListType() : element.getListType();
24484
+ setActiveElement(type === "bullet" ? "unorderedList" : "orderedList");
24485
+ } else {
24486
+ const type = (0, import_rich_text.$isHeadingNode)(element) ? element.getTag() : element.getType();
24487
+ setActiveElement(type);
24477
24488
  }
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)(() => {
24489
+ }
24490
+ const node = getSelectedNode(selection);
24491
+ if (getLinkAncestor(node) !== null) {
24492
+ setIsLink(true);
24493
+ } else {
24494
+ setIsLink(false);
24495
+ }
24496
+ }, [editor, setActiveElement, setActiveFormats, setIsLink]);
24497
+ (0, import_react157.useEffect)(() => {
24503
24498
  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
- });
24499
+ import_lexical9.SELECTION_CHANGE_COMMAND,
24500
+ (_payload) => {
24501
+ updateToolbar();
24519
24502
  return false;
24520
24503
  },
24521
- import_lexical8.COMMAND_PRIORITY_NORMAL
24504
+ import_lexical9.COMMAND_PRIORITY_CRITICAL
24522
24505
  );
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);
24506
+ }, [editor, updateToolbar]);
24507
+ (0, import_react157.useEffect)(() => {
24508
+ return editor.registerUpdateListener(({ editorState }) => {
24509
+ requestAnimationFrame(() => {
24510
+ editorState.read(() => {
24511
+ updateToolbar();
24534
24512
  });
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);
24513
+ });
24540
24514
  });
24541
- }, [editor, closestTableCellNode]);
24542
- return null;
24515
+ }, [editor, updateToolbar]);
24516
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbar, children: [
24517
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
24518
+ Menu,
24519
+ {
24520
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("button", { css: [richTextToolbarButton, textStyleButton], title: "Text styles", children: [
24521
+ visibleTextualElements.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
24522
+ " ",
24523
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
24524
+ ] }),
24525
+ placement: "bottom-start",
24526
+ children: [
24527
+ [
24528
+ {
24529
+ label: "Normal",
24530
+ type: "paragraph"
24531
+ },
24532
+ ...visibleTextualElements
24533
+ ].map((element) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24534
+ MenuItem,
24535
+ {
24536
+ onClick: () => {
24537
+ onSelectElement(element.type);
24538
+ },
24539
+ children: element.label
24540
+ },
24541
+ element.type
24542
+ )),
24543
+ visibleTextualElements.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItem, { disabled: true, children: "Alternative text styles are not available" }) : null
24544
+ ]
24545
+ }
24546
+ ),
24547
+ visibleFormatsWithIcon.length > 0 || visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbarGroup, children: [
24548
+ visibleFormatsWithIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: format.label, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24549
+ "button",
24550
+ {
24551
+ onClick: () => {
24552
+ editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, format.type);
24553
+ },
24554
+ css: [
24555
+ richTextToolbarButton,
24556
+ activeFormats.includes(format.type) ? richTextToolbarButtonActive : null
24557
+ ],
24558
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: FORMATS_WITH_ICON.get(format.type) })
24559
+ }
24560
+ ) }, format.type)),
24561
+ visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24562
+ Menu,
24563
+ {
24564
+ menuLabel: "Alternative text styles",
24565
+ 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 }) }),
24566
+ placement: "bottom-start",
24567
+ children: visibleFormatsWithoutIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24568
+ MenuItem,
24569
+ {
24570
+ onClick: () => {
24571
+ editor.dispatchCommand(import_lexical9.FORMAT_TEXT_COMMAND, format.type);
24572
+ },
24573
+ children: format.label
24574
+ },
24575
+ format.type
24576
+ ))
24577
+ }
24578
+ ) : null
24579
+ ] }) : null,
24580
+ visibleElementsWithIcons.size > 0 || customControls ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbarGroup, children: [
24581
+ linkElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24582
+ "button",
24583
+ {
24584
+ onClick: () => {
24585
+ isLink ? editor.dispatchCommand(REMOVE_LINK_NODE_COMMAND, {}) : editor.dispatchCommand(OPEN_LINK_NODE_MODAL_COMMAND, {});
24586
+ },
24587
+ css: [richTextToolbarButton, isLink ? richTextToolbarButtonActive : null],
24588
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "link" })
24589
+ }
24590
+ ) }) : null,
24591
+ visibleLists.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [
24592
+ visibleLists.has("unorderedList") ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Bullet List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24593
+ "button",
24594
+ {
24595
+ onClick: () => {
24596
+ activeElement === "unorderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_UNORDERED_LIST_COMMAND, void 0);
24597
+ },
24598
+ css: [
24599
+ richTextToolbarButton,
24600
+ activeElement === "unorderedList" ? richTextToolbarButtonActive : null
24601
+ ],
24602
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "layout-list" })
24603
+ }
24604
+ ) }) : null,
24605
+ visibleLists.has("orderedList") ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Ordered List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24606
+ "button",
24607
+ {
24608
+ onClick: () => {
24609
+ activeElement === "orderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_ORDERED_LIST_COMMAND, void 0);
24610
+ },
24611
+ css: [
24612
+ richTextToolbarButton,
24613
+ activeElement === "orderedList" ? richTextToolbarButtonActive : null
24614
+ ],
24615
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "layout-list-numbered" })
24616
+ }
24617
+ ) }) : null
24618
+ ] }) : null,
24619
+ customControls ? customControls : null
24620
+ ] }) : null,
24621
+ visibleInsertElementsWithIcons.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { css: toolbarGroup, children: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
24622
+ Menu,
24623
+ {
24624
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("button", { css: richTextToolbarButton, title: "Insert block element", children: [
24625
+ "Insert",
24626
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
24627
+ ] }),
24628
+ placement: "bottom-start",
24629
+ children: [
24630
+ quoteElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24631
+ MenuItem,
24632
+ {
24633
+ onClick: () => {
24634
+ onSelectElement("quote");
24635
+ },
24636
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "quote", iconColor: "currentColor" }),
24637
+ children: "Quote"
24638
+ }
24639
+ ) : null,
24640
+ codeElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24641
+ MenuItem,
24642
+ {
24643
+ onClick: () => {
24644
+ onSelectElement("code");
24645
+ },
24646
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "code-slash", iconColor: "currentColor" }),
24647
+ children: "Code"
24648
+ }
24649
+ ) : null,
24650
+ tableElementVisible && onInsertTable !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24651
+ MenuItem,
24652
+ {
24653
+ onClick: () => {
24654
+ onSelectElement("table");
24655
+ },
24656
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "view-grid", iconColor: "currentColor" }),
24657
+ children: "Table"
24658
+ }
24659
+ ) : null,
24660
+ assetElementVisible && onInsertAsset !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24661
+ MenuItem,
24662
+ {
24663
+ onClick: () => {
24664
+ onSelectElement("asset");
24665
+ },
24666
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "image", iconColor: "currentColor" }),
24667
+ children: "Asset"
24668
+ }
24669
+ ) : null
24670
+ ]
24671
+ }
24672
+ ) }) : null
24673
+ ] });
24543
24674
  };
24544
- var TableSelectionPlugin_default = TableSelectionPlugin;
24675
+ var RichTextToolbar_default = RichTextToolbar;
24545
24676
 
24546
24677
  // src/components/ParameterInputs/ParameterRichText.tsx
24547
24678
  var import_jsx_runtime133 = require("@emotion/react/jsx-runtime");
@@ -24570,6 +24701,7 @@ var ParameterRichText = ({
24570
24701
  variables,
24571
24702
  customControls,
24572
24703
  onInsertTable,
24704
+ onInsertAsset,
24573
24705
  minimalInteractivity
24574
24706
  }) => {
24575
24707
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
@@ -24603,6 +24735,7 @@ var ParameterRichText = ({
24603
24735
  variables,
24604
24736
  customControls,
24605
24737
  onInsertTable,
24738
+ onInsertAsset,
24606
24739
  minimalInteractivity,
24607
24740
  children
24608
24741
  }
@@ -24612,7 +24745,7 @@ var ParameterRichText = ({
24612
24745
  }
24613
24746
  );
24614
24747
  };
24615
- var editorContainerWrapper = import_react156.css`
24748
+ var editorContainerWrapper = import_react158.css`
24616
24749
  position: relative;
24617
24750
 
24618
24751
  &::before {
@@ -24628,12 +24761,12 @@ var editorContainerWrapper = import_react156.css`
24628
24761
  z-index: 2;
24629
24762
  }
24630
24763
  `;
24631
- var editorWrapper = import_react156.css`
24764
+ var editorWrapper = import_react158.css`
24632
24765
  display: flex;
24633
24766
  flex-flow: column;
24634
24767
  flex-grow: 1;
24635
24768
  `;
24636
- var editorContainer = import_react156.css`
24769
+ var editorContainer = import_react158.css`
24637
24770
  ${scrollbarStyles}
24638
24771
  background: var(--white);
24639
24772
  border-radius: var(--rounded-sm);
@@ -24645,7 +24778,7 @@ var editorContainer = import_react156.css`
24645
24778
  font-size: var(--fs-base);
24646
24779
  height: max-content;
24647
24780
  line-height: 1.2;
24648
- max-height: 300px;
24781
+ max-height: 320px;
24649
24782
  min-height: 50px;
24650
24783
  overflow-y: auto;
24651
24784
  padding: var(--spacing-sm);
@@ -24665,7 +24798,7 @@ var editorContainer = import_react156.css`
24665
24798
  max-height: unset;
24666
24799
  }
24667
24800
  `;
24668
- var editorContainerOverflowWrapper = import_react156.css`
24801
+ var editorContainerOverflowWrapper = import_react158.css`
24669
24802
  overflow: hidden;
24670
24803
  pointer-events: none;
24671
24804
 
@@ -24673,7 +24806,7 @@ var editorContainerOverflowWrapper = import_react156.css`
24673
24806
  pointer-events: auto;
24674
24807
  }
24675
24808
  `;
24676
- var editorPlaceholder = import_react156.css`
24809
+ var editorPlaceholder = import_react158.css`
24677
24810
  color: var(--gray-500);
24678
24811
  font-style: italic;
24679
24812
  /* 1px is added to make sure caret is clearly visible when field is focused
@@ -24684,8 +24817,9 @@ var editorPlaceholder = import_react156.css`
24684
24817
  top: var(--spacing-sm);
24685
24818
  user-select: none;
24686
24819
  `;
24687
- var editorInput = import_react156.css`
24820
+ var editorInput = import_react158.css`
24688
24821
  min-height: 100%;
24822
+ flex-grow: 1;
24689
24823
 
24690
24824
  &:focus,
24691
24825
  &:focus-within {
@@ -24708,6 +24842,7 @@ var ParameterRichTextInner = ({
24708
24842
  variables,
24709
24843
  customControls,
24710
24844
  onInsertTable,
24845
+ onInsertAsset,
24711
24846
  minimalInteractivity
24712
24847
  }) => {
24713
24848
  const lexicalConfig = {
@@ -24722,7 +24857,7 @@ var ParameterRichTextInner = ({
24722
24857
  LinkNode,
24723
24858
  import_rich_text2.HeadingNode,
24724
24859
  import_rich_text2.QuoteNode,
24725
- import_lexical9.ParagraphNode,
24860
+ import_lexical10.ParagraphNode,
24726
24861
  CustomCodeNode,
24727
24862
  import_table5.TableNode,
24728
24863
  import_table5.TableCellNode,
@@ -24780,6 +24915,7 @@ var ParameterRichTextInner = ({
24780
24915
  variables,
24781
24916
  customControls,
24782
24917
  onInsertTable,
24918
+ onInsertAsset,
24783
24919
  minimalInteractivity,
24784
24920
  children
24785
24921
  }
@@ -24808,15 +24944,16 @@ var RichText = ({
24808
24944
  variables,
24809
24945
  customControls,
24810
24946
  onInsertTable,
24947
+ onInsertAsset,
24811
24948
  minimalInteractivity
24812
24949
  }) => {
24813
- const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
24814
- (0, import_react157.useEffect)(() => {
24950
+ const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
24951
+ (0, import_react159.useEffect)(() => {
24815
24952
  if (onRichTextInit) {
24816
24953
  onRichTextInit(editor);
24817
24954
  }
24818
24955
  }, [editor, onRichTextInit]);
24819
- (0, import_react157.useEffect)(() => {
24956
+ (0, import_react159.useEffect)(() => {
24820
24957
  const removeUpdateListener = editor.registerUpdateListener(({ editorState, prevEditorState, tags }) => {
24821
24958
  requestAnimationFrame(() => {
24822
24959
  if (!(0, import_fast_equals2.deepEqual)(editorState.toJSON(), prevEditorState.toJSON())) {
@@ -24828,23 +24965,31 @@ var RichText = ({
24828
24965
  removeUpdateListener();
24829
24966
  };
24830
24967
  }, [editor, onChange]);
24831
- (0, import_react157.useEffect)(() => {
24968
+ (0, import_react159.useEffect)(() => {
24832
24969
  editor.setEditable(!readOnly);
24833
24970
  }, [editor, readOnly]);
24834
- const [editorContainerRef, setEditorContainerRef] = (0, import_react157.useState)(null);
24971
+ const [editorContainerRef, setEditorContainerRef] = (0, import_react159.useState)(null);
24835
24972
  const onEditorContainerRef = (_editorContainerRef) => {
24836
24973
  if (_editorContainerRef !== null) {
24837
24974
  setEditorContainerRef(_editorContainerRef);
24838
24975
  }
24839
24976
  };
24840
- const [portalContainerRef, setPortalContainerRef] = (0, import_react157.useState)(null);
24977
+ const [portalContainerRef, setPortalContainerRef] = (0, import_react159.useState)(null);
24841
24978
  const onPortalContainerRef = (_portalContainerRef) => {
24842
24979
  if (_portalContainerRef !== null) {
24843
24980
  setPortalContainerRef(_portalContainerRef);
24844
24981
  }
24845
24982
  };
24846
24983
  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 }),
24984
+ readOnly || minimalInteractivity ? null : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24985
+ RichTextToolbar_default,
24986
+ {
24987
+ config,
24988
+ customControls,
24989
+ onInsertTable,
24990
+ onInsertAsset
24991
+ }
24992
+ ),
24848
24993
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { css: editorContainerWrapper, ref: onPortalContainerRef, children: [
24849
24994
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
24850
24995
  "div",
@@ -24891,22 +25036,23 @@ var RichText = ({
24891
25036
  positioningAnchorEl: editorContainerRef
24892
25037
  }
24893
25038
  ) : null,
24894
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableSelectionPlugin_default, {})
25039
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableSelectionPlugin_default, {}),
25040
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ImprovedAssetSelectionPlugin_default, {})
24895
25041
  ] })
24896
25042
  ] });
24897
25043
  };
24898
25044
 
24899
25045
  // src/components/ParameterInputs/ParameterSelect.tsx
24900
25046
  init_emotion_jsx_shim();
24901
- var import_react158 = require("react");
25047
+ var import_react160 = require("react");
24902
25048
  var import_jsx_runtime134 = require("@emotion/react/jsx-runtime");
24903
- var ParameterSelect = (0, import_react158.forwardRef)(
25049
+ var ParameterSelect = (0, import_react160.forwardRef)(
24904
25050
  ({ defaultOption, options, ...props }, ref) => {
24905
25051
  const { shellProps, innerProps } = extractParameterProps(props);
24906
25052
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterSelectInner, { options, defaultOption, ...innerProps, ref }) });
24907
25053
  }
24908
25054
  );
24909
- var ParameterSelectInner = (0, import_react158.forwardRef)(
25055
+ var ParameterSelectInner = (0, import_react160.forwardRef)(
24910
25056
  ({ defaultOption, options, ...props }, ref) => {
24911
25057
  const { id, label, hiddenLabel } = useParameterShell();
24912
25058
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
@@ -24931,13 +25077,13 @@ var ParameterSelectInner = (0, import_react158.forwardRef)(
24931
25077
 
24932
25078
  // src/components/ParameterInputs/ParameterTextarea.tsx
24933
25079
  init_emotion_jsx_shim();
24934
- var import_react159 = require("react");
25080
+ var import_react161 = require("react");
24935
25081
  var import_jsx_runtime135 = require("@emotion/react/jsx-runtime");
24936
- var ParameterTextarea = (0, import_react159.forwardRef)((props, ref) => {
25082
+ var ParameterTextarea = (0, import_react161.forwardRef)((props, ref) => {
24937
25083
  const { shellProps, innerProps } = extractParameterProps(props);
24938
25084
  return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterShell, { "data-testid": "parameter-textarea", ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterTextareaInner, { ref, ...innerProps }) });
24939
25085
  });
24940
- var ParameterTextareaInner = (0, import_react159.forwardRef)(({ ...props }, ref) => {
25086
+ var ParameterTextareaInner = (0, import_react161.forwardRef)(({ ...props }, ref) => {
24941
25087
  const { id, label, hiddenLabel } = useParameterShell();
24942
25088
  return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
24943
25089
  "textarea",
@@ -24953,13 +25099,13 @@ var ParameterTextareaInner = (0, import_react159.forwardRef)(({ ...props }, ref)
24953
25099
 
24954
25100
  // src/components/ParameterInputs/ParameterToggle.tsx
24955
25101
  init_emotion_jsx_shim();
24956
- var import_react160 = require("react");
25102
+ var import_react162 = require("react");
24957
25103
  var import_jsx_runtime136 = require("@emotion/react/jsx-runtime");
24958
- var ParameterToggle = (0, import_react160.forwardRef)((props, ref) => {
25104
+ var ParameterToggle = (0, import_react162.forwardRef)((props, ref) => {
24959
25105
  const { shellProps, innerProps } = extractParameterProps(props);
24960
25106
  return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterToggleInner, { ref, ...innerProps }) });
24961
25107
  });
24962
- var ParameterToggleInner = (0, import_react160.forwardRef)(
25108
+ var ParameterToggleInner = (0, import_react162.forwardRef)(
24963
25109
  ({ children, ...props }, ref) => {
24964
25110
  const { id, label } = useParameterShell();
24965
25111
  return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("label", { css: inputToggleLabel2, children: [
@@ -24975,8 +25121,8 @@ init_emotion_jsx_shim();
24975
25121
 
24976
25122
  // src/components/ProgressBar/ProgressBar.styles.ts
24977
25123
  init_emotion_jsx_shim();
24978
- var import_react161 = require("@emotion/react");
24979
- var container3 = import_react161.css`
25124
+ var import_react163 = require("@emotion/react");
25125
+ var container3 = import_react163.css`
24980
25126
  background: var(--gray-50);
24981
25127
  margin-block: var(--spacing-sm);
24982
25128
  position: relative;
@@ -24986,17 +25132,17 @@ var container3 = import_react161.css`
24986
25132
  border: solid 1px var(--gray-300);
24987
25133
  `;
24988
25134
  var themeMap = {
24989
- primary: import_react161.css`
25135
+ primary: import_react163.css`
24990
25136
  --progress-color: var(--accent-light);
24991
25137
  `,
24992
- secondary: import_react161.css`
25138
+ secondary: import_react163.css`
24993
25139
  --progress-color: var(--accent-alt-light);
24994
25140
  `,
24995
- destructive: import_react161.css`
25141
+ destructive: import_react163.css`
24996
25142
  --progress-color: var(--brand-secondary-5);
24997
25143
  `
24998
25144
  };
24999
- var slidingBackgroundPosition = import_react161.keyframes`
25145
+ var slidingBackgroundPosition = import_react163.keyframes`
25000
25146
  from {
25001
25147
  background-position: 0 0;
25002
25148
  }
@@ -25004,10 +25150,10 @@ var slidingBackgroundPosition = import_react161.keyframes`
25004
25150
  background-position: 64px 0;
25005
25151
  }
25006
25152
  `;
25007
- var determinate = import_react161.css`
25153
+ var determinate = import_react163.css`
25008
25154
  background-color: var(--progress-color);
25009
25155
  `;
25010
- var indeterminate = import_react161.css`
25156
+ var indeterminate = import_react163.css`
25011
25157
  background-image: linear-gradient(
25012
25158
  45deg,
25013
25159
  var(--progress-color) 25%,
@@ -25021,7 +25167,7 @@ var indeterminate = import_react161.css`
25021
25167
  background-size: 64px 64px;
25022
25168
  animation: ${slidingBackgroundPosition} 1s linear infinite;
25023
25169
  `;
25024
- var bar = import_react161.css`
25170
+ var bar = import_react163.css`
25025
25171
  position: absolute;
25026
25172
  inset: 0;
25027
25173
  transition: transform var(--duration-fast) var(--timing-ease-out);
@@ -25070,22 +25216,22 @@ function ProgressBar({
25070
25216
 
25071
25217
  // src/components/ProgressList/ProgressList.tsx
25072
25218
  init_emotion_jsx_shim();
25073
- var import_react163 = require("@emotion/react");
25219
+ var import_react165 = require("@emotion/react");
25074
25220
  var import_CgCheckO3 = require("@react-icons/all-files/cg/CgCheckO");
25075
25221
  var import_CgRadioCheck2 = require("@react-icons/all-files/cg/CgRadioCheck");
25076
25222
  var import_CgRecord2 = require("@react-icons/all-files/cg/CgRecord");
25077
- var import_react164 = require("react");
25223
+ var import_react166 = require("react");
25078
25224
 
25079
25225
  // src/components/ProgressList/styles/ProgressList.styles.ts
25080
25226
  init_emotion_jsx_shim();
25081
- var import_react162 = require("@emotion/react");
25082
- var progressListStyles = import_react162.css`
25227
+ var import_react164 = require("@emotion/react");
25228
+ var progressListStyles = import_react164.css`
25083
25229
  display: flex;
25084
25230
  flex-direction: column;
25085
25231
  gap: var(--spacing-sm);
25086
25232
  list-style-type: none;
25087
25233
  `;
25088
- var progressListItemStyles = import_react162.css`
25234
+ var progressListItemStyles = import_react164.css`
25089
25235
  display: flex;
25090
25236
  gap: var(--spacing-base);
25091
25237
  align-items: center;
@@ -25094,7 +25240,7 @@ var progressListItemStyles = import_react162.css`
25094
25240
  // src/components/ProgressList/ProgressList.tsx
25095
25241
  var import_jsx_runtime138 = require("@emotion/react/jsx-runtime");
25096
25242
  var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
25097
- const itemsWithStatus = (0, import_react164.useMemo)(() => {
25243
+ const itemsWithStatus = (0, import_react166.useMemo)(() => {
25098
25244
  const indexOfInProgressItem = items.findIndex(({ id }) => id === inProgressId);
25099
25245
  return items.map((item, index) => {
25100
25246
  let status = "queued";
@@ -25127,7 +25273,7 @@ var ProgressListItem = ({
25127
25273
  errorLevel = "danger",
25128
25274
  autoEllipsis = false
25129
25275
  }) => {
25130
- const icon = (0, import_react164.useMemo)(() => {
25276
+ const icon = (0, import_react166.useMemo)(() => {
25131
25277
  if (error) {
25132
25278
  return warningIcon;
25133
25279
  }
@@ -25138,14 +25284,14 @@ var ProgressListItem = ({
25138
25284
  };
25139
25285
  return iconPerStatus[status];
25140
25286
  }, [status, error]);
25141
- const statusStyles = (0, import_react164.useMemo)(() => {
25287
+ const statusStyles = (0, import_react166.useMemo)(() => {
25142
25288
  if (error) {
25143
- return errorLevel === "caution" ? import_react163.css`
25289
+ return errorLevel === "caution" ? import_react165.css`
25144
25290
  color: rgb(161, 98, 7);
25145
25291
  & svg {
25146
25292
  color: rgb(250, 204, 21);
25147
25293
  }
25148
- ` : import_react163.css`
25294
+ ` : import_react165.css`
25149
25295
  color: rgb(185, 28, 28);
25150
25296
  & svg {
25151
25297
  color: var(--brand-primary-2);
@@ -25153,13 +25299,13 @@ var ProgressListItem = ({
25153
25299
  `;
25154
25300
  }
25155
25301
  const colorPerStatus = {
25156
- completed: import_react163.css`
25302
+ completed: import_react165.css`
25157
25303
  opacity: 0.75;
25158
25304
  `,
25159
- inProgress: import_react163.css`
25305
+ inProgress: import_react165.css`
25160
25306
  -webkit-text-stroke-width: thin;
25161
25307
  `,
25162
- queued: import_react163.css`
25308
+ queued: import_react165.css`
25163
25309
  opacity: 0.5;
25164
25310
  `
25165
25311
  };
@@ -25176,17 +25322,17 @@ var ProgressListItem = ({
25176
25322
 
25177
25323
  // src/components/SegmentedControl/SegmentedControl.tsx
25178
25324
  init_emotion_jsx_shim();
25179
- var import_react166 = require("@emotion/react");
25325
+ var import_react168 = require("@emotion/react");
25180
25326
  var import_CgCheck6 = require("@react-icons/all-files/cg/CgCheck");
25181
- var import_react167 = require("react");
25327
+ var import_react169 = require("react");
25182
25328
 
25183
25329
  // src/components/SegmentedControl/SegmentedControl.styles.ts
25184
25330
  init_emotion_jsx_shim();
25185
- var import_react165 = require("@emotion/react");
25186
- var segmentedControlRootStyles = import_react165.css`
25331
+ var import_react167 = require("@emotion/react");
25332
+ var segmentedControlRootStyles = import_react167.css`
25187
25333
  position: relative;
25188
25334
  `;
25189
- var segmentedControlScrollIndicatorsStyles = import_react165.css`
25335
+ var segmentedControlScrollIndicatorsStyles = import_react167.css`
25190
25336
  position: absolute;
25191
25337
  inset: 0;
25192
25338
  z-index: 1;
@@ -25214,17 +25360,17 @@ var segmentedControlScrollIndicatorsStyles = import_react165.css`
25214
25360
  background: linear-gradient(to left, var(--background-color) 10%, transparent);
25215
25361
  }
25216
25362
  `;
25217
- var segmentedControlScrollIndicatorStartVisibleStyles = import_react165.css`
25363
+ var segmentedControlScrollIndicatorStartVisibleStyles = import_react167.css`
25218
25364
  &::before {
25219
25365
  opacity: 1;
25220
25366
  }
25221
25367
  `;
25222
- var segmentedControlScrollIndicatorEndVisibleStyles = import_react165.css`
25368
+ var segmentedControlScrollIndicatorEndVisibleStyles = import_react167.css`
25223
25369
  &::after {
25224
25370
  opacity: 1;
25225
25371
  }
25226
25372
  `;
25227
- var segmentedControlWrapperStyles = import_react165.css`
25373
+ var segmentedControlWrapperStyles = import_react167.css`
25228
25374
  overflow-y: auto;
25229
25375
  scroll-behavior: smooth;
25230
25376
  scrollbar-width: none;
@@ -25233,7 +25379,7 @@ var segmentedControlWrapperStyles = import_react165.css`
25233
25379
  height: 0px;
25234
25380
  }
25235
25381
  `;
25236
- var segmentedControlStyles = import_react165.css`
25382
+ var segmentedControlStyles = import_react167.css`
25237
25383
  --segmented-control-rounded-value: var(--rounded-base);
25238
25384
  --segmented-control-border-width: 1px;
25239
25385
  --segmented-control-selected-color: var(--brand-secondary-3);
@@ -25252,14 +25398,14 @@ var segmentedControlStyles = import_react165.css`
25252
25398
  border-radius: calc(var(--segmented-control-rounded-value) + var(--segmented-control-border-width));
25253
25399
  font-size: var(--fs-xs);
25254
25400
  `;
25255
- var segmentedControlVerticalStyles = import_react165.css`
25401
+ var segmentedControlVerticalStyles = import_react167.css`
25256
25402
  flex-direction: column;
25257
25403
  --segmented-control-first-border-radius: var(--segmented-control-rounded-value)
25258
25404
  var(--segmented-control-rounded-value) 0 0;
25259
25405
  --segmented-control-last-border-radius: 0 0 var(--segmented-control-rounded-value)
25260
25406
  var(--segmented-control-rounded-value);
25261
25407
  `;
25262
- var segmentedControlItemStyles = import_react165.css`
25408
+ var segmentedControlItemStyles = import_react167.css`
25263
25409
  &:first-of-type label {
25264
25410
  border-radius: var(--segmented-control-first-border-radius);
25265
25411
  }
@@ -25267,10 +25413,10 @@ var segmentedControlItemStyles = import_react165.css`
25267
25413
  border-radius: var(--segmented-control-last-border-radius);
25268
25414
  }
25269
25415
  `;
25270
- var segmentedControlInputStyles = import_react165.css`
25416
+ var segmentedControlInputStyles = import_react167.css`
25271
25417
  ${accessibleHidden}
25272
25418
  `;
25273
- var segmentedControlLabelStyles = (checked, disabled2) => import_react165.css`
25419
+ var segmentedControlLabelStyles = (checked, disabled2) => import_react167.css`
25274
25420
  position: relative;
25275
25421
  display: flex;
25276
25422
  align-items: center;
@@ -25337,20 +25483,20 @@ var segmentedControlLabelStyles = (checked, disabled2) => import_react165.css`
25337
25483
  `}
25338
25484
  }
25339
25485
  `;
25340
- var segmentedControlLabelIconOnlyStyles = import_react165.css`
25486
+ var segmentedControlLabelIconOnlyStyles = import_react167.css`
25341
25487
  padding-inline: 0.5em;
25342
25488
  `;
25343
- var segmentedControlLabelCheckStyles = import_react165.css`
25489
+ var segmentedControlLabelCheckStyles = import_react167.css`
25344
25490
  opacity: 0.5;
25345
25491
  `;
25346
- var segmentedControlLabelContentStyles = import_react165.css`
25492
+ var segmentedControlLabelContentStyles = import_react167.css`
25347
25493
  display: flex;
25348
25494
  align-items: center;
25349
25495
  justify-content: center;
25350
25496
  gap: var(--spacing-sm);
25351
25497
  height: 100%;
25352
25498
  `;
25353
- var segmentedControlLabelTextStyles = import_react165.css`
25499
+ var segmentedControlLabelTextStyles = import_react167.css`
25354
25500
  white-space: nowrap;
25355
25501
  `;
25356
25502
 
@@ -25370,10 +25516,10 @@ var SegmentedControl = ({
25370
25516
  currentBackgroundColor = "white",
25371
25517
  ...props
25372
25518
  }) => {
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)(
25519
+ const wrapperRef = (0, import_react169.useRef)(null);
25520
+ const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = (0, import_react169.useState)(false);
25521
+ const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = (0, import_react169.useState)(false);
25522
+ const onOptionChange = (0, import_react169.useCallback)(
25377
25523
  (event) => {
25378
25524
  if (event.target.checked) {
25379
25525
  onChange == null ? void 0 : onChange(options[parseInt(event.target.value)].value);
@@ -25381,19 +25527,19 @@ var SegmentedControl = ({
25381
25527
  },
25382
25528
  [options, onChange]
25383
25529
  );
25384
- const sizeStyles = (0, import_react167.useMemo)(() => {
25530
+ const sizeStyles = (0, import_react169.useMemo)(() => {
25385
25531
  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)" })
25532
+ sm: (0, import_react168.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
25533
+ md: (0, import_react168.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
25534
+ lg: (0, import_react168.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
25535
+ xl: (0, import_react168.css)({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
25390
25536
  };
25391
25537
  return map[size];
25392
25538
  }, [size]);
25393
- const isIconOnly = (0, import_react167.useMemo)(() => {
25539
+ const isIconOnly = (0, import_react169.useMemo)(() => {
25394
25540
  return options.every((option) => option && option.icon && !option.label);
25395
25541
  }, [options]);
25396
- (0, import_react167.useEffect)(() => {
25542
+ (0, import_react169.useEffect)(() => {
25397
25543
  const wrapperElement = wrapperRef.current;
25398
25544
  const onScroll = () => {
25399
25545
  if (!wrapperElement) {
@@ -25488,12 +25634,12 @@ init_emotion_jsx_shim();
25488
25634
 
25489
25635
  // src/components/Skeleton/Skeleton.styles.ts
25490
25636
  init_emotion_jsx_shim();
25491
- var import_react168 = require("@emotion/react");
25492
- var lightFadingOut = import_react168.keyframes`
25637
+ var import_react170 = require("@emotion/react");
25638
+ var lightFadingOut = import_react170.keyframes`
25493
25639
  from { opacity: 0.1; }
25494
25640
  to { opacity: 0.025; }
25495
25641
  `;
25496
- var skeletonStyles = import_react168.css`
25642
+ var skeletonStyles = import_react170.css`
25497
25643
  animation: ${lightFadingOut} 1s ease-out infinite alternate;
25498
25644
  background-color: var(--gray-900);
25499
25645
  `;
@@ -25528,12 +25674,12 @@ var Skeleton = ({
25528
25674
 
25529
25675
  // src/components/Switch/Switch.tsx
25530
25676
  init_emotion_jsx_shim();
25531
- var import_react170 = require("react");
25677
+ var import_react172 = require("react");
25532
25678
 
25533
25679
  // src/components/Switch/Switch.styles.ts
25534
25680
  init_emotion_jsx_shim();
25535
- var import_react169 = require("@emotion/react");
25536
- var SwitchInputContainer = import_react169.css`
25681
+ var import_react171 = require("@emotion/react");
25682
+ var SwitchInputContainer = import_react171.css`
25537
25683
  cursor: pointer;
25538
25684
  display: inline-block;
25539
25685
  position: relative;
@@ -25542,7 +25688,7 @@ var SwitchInputContainer = import_react169.css`
25542
25688
  vertical-align: middle;
25543
25689
  user-select: none;
25544
25690
  `;
25545
- var SwitchInput = (size) => import_react169.css`
25691
+ var SwitchInput = (size) => import_react171.css`
25546
25692
  appearance: none;
25547
25693
  border-radius: var(--rounded-full);
25548
25694
  background-color: var(--white);
@@ -25582,7 +25728,7 @@ var SwitchInput = (size) => import_react169.css`
25582
25728
  cursor: not-allowed;
25583
25729
  }
25584
25730
  `;
25585
- var SwitchInputDisabled = import_react169.css`
25731
+ var SwitchInputDisabled = import_react171.css`
25586
25732
  opacity: var(--opacity-50);
25587
25733
  cursor: not-allowed;
25588
25734
 
@@ -25590,7 +25736,7 @@ var SwitchInputDisabled = import_react169.css`
25590
25736
  cursor: not-allowed;
25591
25737
  }
25592
25738
  `;
25593
- var SwitchInputLabel = (size) => import_react169.css`
25739
+ var SwitchInputLabel = (size) => import_react171.css`
25594
25740
  align-items: center;
25595
25741
  color: var(--typography-base);
25596
25742
  display: inline-flex;
@@ -25612,7 +25758,7 @@ var SwitchInputLabel = (size) => import_react169.css`
25612
25758
  top: 0;
25613
25759
  }
25614
25760
  `;
25615
- var SwitchText = (size) => import_react169.css`
25761
+ var SwitchText = (size) => import_react171.css`
25616
25762
  color: var(--gray-500);
25617
25763
  font-size: var(--fs-sm);
25618
25764
  padding-inline: ${size === "sm" ? "var(--spacing-xl)" : "var(--spacing-2xl)"} 0;
@@ -25620,7 +25766,7 @@ var SwitchText = (size) => import_react169.css`
25620
25766
 
25621
25767
  // src/components/Switch/Switch.tsx
25622
25768
  var import_jsx_runtime141 = require("@emotion/react/jsx-runtime");
25623
- var Switch = (0, import_react170.forwardRef)(
25769
+ var Switch = (0, import_react172.forwardRef)(
25624
25770
  ({ label, infoText, toggleText, children, switchSize = "base", ...inputProps }, ref) => {
25625
25771
  let additionalText = infoText;
25626
25772
  if (infoText && toggleText) {
@@ -25649,8 +25795,8 @@ var React24 = __toESM(require("react"));
25649
25795
 
25650
25796
  // src/components/Table/Table.styles.ts
25651
25797
  init_emotion_jsx_shim();
25652
- var import_react171 = require("@emotion/react");
25653
- var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_react171.css`
25798
+ var import_react173 = require("@emotion/react");
25799
+ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_react173.css`
25654
25800
  border-bottom: 1px solid var(--gray-400);
25655
25801
  border-collapse: collapse;
25656
25802
  min-width: 100%;
@@ -25670,14 +25816,14 @@ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_
25670
25816
  background-color: var(--gray-50);
25671
25817
  }
25672
25818
  `;
25673
- var tableHead = import_react171.css`
25819
+ var tableHead = import_react173.css`
25674
25820
  color: var(--typography-base);
25675
25821
  text-align: left;
25676
25822
  `;
25677
- var tableRow = import_react171.css`
25823
+ var tableRow = import_react173.css`
25678
25824
  border-bottom: 1px solid var(--gray-100);
25679
25825
  `;
25680
- var tableCellHead = import_react171.css`
25826
+ var tableCellHead = import_react173.css`
25681
25827
  font-size: var(--fs-sm);
25682
25828
  text-transform: uppercase;
25683
25829
  font-weight: var(--fw-bold);
@@ -25723,13 +25869,13 @@ var TableCellData = React24.forwardRef(
25723
25869
 
25724
25870
  // src/components/Tabs/Tabs.tsx
25725
25871
  init_emotion_jsx_shim();
25726
- var import_react173 = require("@ariakit/react");
25727
- var import_react174 = require("react");
25872
+ var import_react175 = require("@ariakit/react");
25873
+ var import_react176 = require("react");
25728
25874
 
25729
25875
  // src/components/Tabs/Tabs.styles.ts
25730
25876
  init_emotion_jsx_shim();
25731
- var import_react172 = require("@emotion/react");
25732
- var tabButtonStyles = import_react172.css`
25877
+ var import_react174 = require("@emotion/react");
25878
+ var tabButtonStyles = import_react174.css`
25733
25879
  align-items: center;
25734
25880
  border: 0;
25735
25881
  height: 2.5rem;
@@ -25746,7 +25892,7 @@ var tabButtonStyles = import_react172.css`
25746
25892
  box-shadow: inset 0 -2px 0 var(--brand-secondary-3);
25747
25893
  }
25748
25894
  `;
25749
- var tabButtonGroupStyles = import_react172.css`
25895
+ var tabButtonGroupStyles = import_react174.css`
25750
25896
  display: flex;
25751
25897
  gap: var(--spacing-base);
25752
25898
  border-bottom: 1px solid var(--gray-300);
@@ -25755,7 +25901,7 @@ var tabButtonGroupStyles = import_react172.css`
25755
25901
  // src/components/Tabs/Tabs.tsx
25756
25902
  var import_jsx_runtime143 = require("@emotion/react/jsx-runtime");
25757
25903
  var useCurrentTab = () => {
25758
- const context = (0, import_react173.useTabStore)();
25904
+ const context = (0, import_react175.useTabStore)();
25759
25905
  if (!context) {
25760
25906
  throw new Error("This component can only be used inside <Tabs>");
25761
25907
  }
@@ -25769,12 +25915,12 @@ var Tabs = ({
25769
25915
  manual,
25770
25916
  ...props
25771
25917
  }) => {
25772
- const selected = (0, import_react174.useMemo)(() => {
25918
+ const selected = (0, import_react176.useMemo)(() => {
25773
25919
  if (selectedId) return selectedId;
25774
25920
  return useHashForState && typeof window !== "undefined" && window.location.hash ? window.location.hash.substring(1) : void 0;
25775
25921
  }, [selectedId, useHashForState]);
25776
- const tab = (0, import_react173.useTabStore)({ ...props, selectOnMove: !manual, selectedId: selected });
25777
- const onTabSelect = (0, import_react174.useCallback)(
25922
+ const tab = (0, import_react175.useTabStore)({ ...props, selectOnMove: !manual, selectedId: selected });
25923
+ const onTabSelect = (0, import_react176.useCallback)(
25778
25924
  (value) => {
25779
25925
  const selectedValueWithoutNull = value != null ? value : void 0;
25780
25926
  onSelectedIdChange == null ? void 0 : onSelectedIdChange(selectedValueWithoutNull);
@@ -25785,28 +25931,28 @@ var Tabs = ({
25785
25931
  },
25786
25932
  [onSelectedIdChange, useHashForState]
25787
25933
  );
25788
- (0, import_react174.useEffect)(() => {
25934
+ (0, import_react176.useEffect)(() => {
25789
25935
  if (selected && selected !== tab.getState().activeId) {
25790
25936
  tab.setSelectedId(selected);
25791
25937
  }
25792
25938
  }, [selected, tab]);
25793
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react173.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
25939
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react175.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
25794
25940
  };
25795
25941
  var TabButtonGroup = ({ children, ...props }) => {
25796
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react173.TabList, { ...props, css: tabButtonGroupStyles, children });
25942
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react175.TabList, { ...props, css: tabButtonGroupStyles, children });
25797
25943
  };
25798
25944
  var TabButton = ({
25799
25945
  children,
25800
25946
  id,
25801
25947
  ...props
25802
25948
  }) => {
25803
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react173.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
25949
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react175.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
25804
25950
  };
25805
25951
  var TabContent = ({
25806
25952
  children,
25807
25953
  ...props
25808
25954
  }) => {
25809
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react173.TabPanel, { ...props, children });
25955
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react175.TabPanel, { ...props, children });
25810
25956
  };
25811
25957
 
25812
25958
  // src/components/Validation/StatusBullet.tsx
@@ -25814,8 +25960,8 @@ init_emotion_jsx_shim();
25814
25960
 
25815
25961
  // src/components/Validation/StatusBullet.styles.ts
25816
25962
  init_emotion_jsx_shim();
25817
- var import_react175 = require("@emotion/react");
25818
- var StatusBulletContainer = import_react175.css`
25963
+ var import_react177 = require("@emotion/react");
25964
+ var StatusBulletContainer = import_react177.css`
25819
25965
  align-items: center;
25820
25966
  align-self: center;
25821
25967
  color: var(--gray-500);
@@ -25832,33 +25978,33 @@ var StatusBulletContainer = import_react175.css`
25832
25978
  display: block;
25833
25979
  }
25834
25980
  `;
25835
- var StatusBulletBase = import_react175.css`
25981
+ var StatusBulletBase = import_react177.css`
25836
25982
  font-size: var(--fs-sm);
25837
25983
  &:before {
25838
25984
  width: var(--fs-xs);
25839
25985
  height: var(--fs-xs);
25840
25986
  }
25841
25987
  `;
25842
- var StatusBulletSmall = import_react175.css`
25988
+ var StatusBulletSmall = import_react177.css`
25843
25989
  font-size: var(--fs-xs);
25844
25990
  &:before {
25845
25991
  width: var(--fs-xxs);
25846
25992
  height: var(--fs-xxs);
25847
25993
  }
25848
25994
  `;
25849
- var StatusDraft = import_react175.css`
25995
+ var StatusDraft = import_react177.css`
25850
25996
  &:before {
25851
25997
  background: var(--white);
25852
25998
  box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
25853
25999
  }
25854
26000
  `;
25855
- var StatusModified = import_react175.css`
26001
+ var StatusModified = import_react177.css`
25856
26002
  &:before {
25857
26003
  background: linear-gradient(to right, var(--white) 50%, var(--accent-dark) 50% 100%);
25858
26004
  box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
25859
26005
  }
25860
26006
  `;
25861
- var StatusError = import_react175.css`
26007
+ var StatusError = import_react177.css`
25862
26008
  color: var(--error);
25863
26009
  &:before {
25864
26010
  /* TODO: replace this with an svg icon */
@@ -25871,22 +26017,22 @@ var StatusError = import_react175.css`
25871
26017
  );
25872
26018
  }
25873
26019
  `;
25874
- var StatusPublished = import_react175.css`
26020
+ var StatusPublished = import_react177.css`
25875
26021
  &:before {
25876
26022
  background: var(--accent-dark);
25877
26023
  }
25878
26024
  `;
25879
- var StatusOrphan = import_react175.css`
26025
+ var StatusOrphan = import_react177.css`
25880
26026
  &:before {
25881
26027
  background: var(--brand-secondary-5);
25882
26028
  }
25883
26029
  `;
25884
- var StatusUnknown = import_react175.css`
26030
+ var StatusUnknown = import_react177.css`
25885
26031
  &:before {
25886
26032
  background: var(--gray-800);
25887
26033
  }
25888
26034
  `;
25889
- var StatusDeleted = import_react175.css`
26035
+ var StatusDeleted = import_react177.css`
25890
26036
  &:before {
25891
26037
  background: var(--error);
25892
26038
  }