@uniformdev/design-system 19.184.3-alpha.32 → 19.185.1-alpha.8

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
@@ -22281,11 +22281,11 @@ var ParameterNameAndPublicIdInput = ({
22281
22281
 
22282
22282
  // src/components/ParameterInputs/ParameterRichText.tsx
22283
22283
  init_emotion_jsx_shim();
22284
- var import_react155 = require("@emotion/react");
22284
+ var import_react157 = require("@emotion/react");
22285
22285
  var import_list3 = require("@lexical/list");
22286
22286
  var import_markdown = require("@lexical/markdown");
22287
22287
  var import_LexicalComposer = require("@lexical/react/LexicalComposer");
22288
- var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
22288
+ var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
22289
22289
  var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
22290
22290
  var import_LexicalErrorBoundary = __toESM(require("@lexical/react/LexicalErrorBoundary"));
22291
22291
  var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
@@ -22294,7 +22294,7 @@ var import_LexicalMarkdownShortcutPlugin = require("@lexical/react/LexicalMarkdo
22294
22294
  var import_LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
22295
22295
  var import_LexicalTablePlugin = require("@lexical/react/LexicalTablePlugin");
22296
22296
  var import_rich_text2 = require("@lexical/rich-text");
22297
- var import_table4 = require("@lexical/table");
22297
+ var import_table5 = require("@lexical/table");
22298
22298
 
22299
22299
  // ../richtext/dist/index.mjs
22300
22300
  init_emotion_jsx_shim();
@@ -22347,6 +22347,10 @@ var richTextBuiltInElements = [
22347
22347
  label: "Table",
22348
22348
  type: "table"
22349
22349
  },
22350
+ {
22351
+ label: "Asset",
22352
+ type: "asset"
22353
+ },
22350
22354
  {
22351
22355
  label: "Dynamic Token",
22352
22356
  type: "variable"
@@ -22393,8 +22397,8 @@ var getLabelForElement = (type) => {
22393
22397
 
22394
22398
  // src/components/ParameterInputs/ParameterRichText.tsx
22395
22399
  var import_fast_equals2 = require("fast-equals");
22396
- var import_lexical8 = require("lexical");
22397
- var import_react156 = require("react");
22400
+ var import_lexical9 = require("lexical");
22401
+ var import_react158 = require("react");
22398
22402
 
22399
22403
  // src/components/ParameterInputs/rich-text/CustomCodeNode.ts
22400
22404
  init_emotion_jsx_shim();
@@ -22634,9 +22638,32 @@ var tableCellElement = import_css2.css`
22634
22638
  min-width: 2rem;
22635
22639
  outline: none;
22636
22640
  padding: var(--spacing-sm);
22641
+ position: relative;
22637
22642
  text-align: start;
22638
22643
  vertical-align: top;
22639
22644
  width: 7rem;
22645
+
22646
+ /* Used by the table resizer plugin to not change the hovered cell immediately
22647
+ upon going with the mouse over the neighboring cell */
22648
+ &::after {
22649
+ content: '';
22650
+ height: 5px;
22651
+ left: 0;
22652
+ position: absolute;
22653
+ top: 100%;
22654
+ width: 100%;
22655
+ z-index: 1;
22656
+ }
22657
+
22658
+ &::before {
22659
+ content: '';
22660
+ width: 5px;
22661
+ height: 100%;
22662
+ position: absolute;
22663
+ top: 0;
22664
+ left: 100%;
22665
+ z-index: 1;
22666
+ }
22640
22667
  `;
22641
22668
  var tableHeaderElement = import_css2.css`
22642
22669
  background-color: var(--gray-100);
@@ -22988,7 +23015,7 @@ var LINK_POPOVER_OFFSET_X = 0;
22988
23015
  var LINK_POPOVER_OFFSET_Y = 8;
22989
23016
  var linkPopover = import_react146.css`
22990
23017
  position: absolute;
22991
- z-index: 5;
23018
+ z-index: 11;
22992
23019
  `;
22993
23020
  var linkPopoverContainer = import_react146.css`
22994
23021
  ${Popover()};
@@ -23207,10 +23234,9 @@ function getLinkAncestor(node) {
23207
23234
  init_emotion_jsx_shim();
23208
23235
  var import_list = require("@lexical/list");
23209
23236
  var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
23210
- var import_LexicalTabIndentationPlugin = require("@lexical/react/LexicalTabIndentationPlugin");
23237
+ var import_utils8 = require("@lexical/utils");
23211
23238
  var import_lexical4 = require("lexical");
23212
23239
  var import_react148 = require("react");
23213
- var import_jsx_runtime130 = require("@emotion/react/jsx-runtime");
23214
23240
  function isIndentPermitted(maxDepth) {
23215
23241
  const selection = (0, import_lexical4.$getSelection)();
23216
23242
  if (!(0, import_lexical4.$isRangeSelection)(selection)) {
@@ -23231,904 +23257,503 @@ function isIndentPermitted(maxDepth) {
23231
23257
  }
23232
23258
  return totalDepth <= maxDepth;
23233
23259
  }
23260
+ function $isAnyOfSelectedNodesAListItemNode(selection) {
23261
+ const nodes = selection.getNodes();
23262
+ return (0, import_utils8.$filter)(nodes, (node) => (0, import_list.$isListItemNode)(node) ? node : null).length > 0;
23263
+ }
23264
+ function $indentOverTab(selection) {
23265
+ const nodes = selection.getNodes();
23266
+ const canIndentBlockNodes = (0, import_utils8.$filter)(nodes, (node) => {
23267
+ if ((0, import_lexical4.$isBlockElementNode)(node) && node.canIndent()) {
23268
+ return node;
23269
+ }
23270
+ return null;
23271
+ });
23272
+ if (canIndentBlockNodes.length > 0) {
23273
+ return true;
23274
+ }
23275
+ const anchor = selection.anchor;
23276
+ const focus = selection.focus;
23277
+ const first = focus.isBefore(anchor) ? focus : anchor;
23278
+ const firstNode = first.getNode();
23279
+ const firstBlock = (0, import_utils8.$getNearestBlockElementAncestorOrThrow)(firstNode);
23280
+ if (firstBlock.canIndent()) {
23281
+ const firstBlockKey = firstBlock.getKey();
23282
+ let selectionAtStart = (0, import_lexical4.$createRangeSelection)();
23283
+ selectionAtStart.anchor.set(firstBlockKey, 0, "element");
23284
+ selectionAtStart.focus.set(firstBlockKey, 0, "element");
23285
+ selectionAtStart = (0, import_lexical4.$normalizeSelection__EXPERIMENTAL)(selectionAtStart);
23286
+ if (selectionAtStart.anchor.is(first)) {
23287
+ return true;
23288
+ }
23289
+ }
23290
+ return false;
23291
+ }
23234
23292
  function ListIndentPlugin({ maxDepth }) {
23235
23293
  const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
23294
+ const isInListItemNode = (0, import_react148.useRef)(false);
23236
23295
  (0, import_react148.useEffect)(() => {
23237
23296
  return editor.registerCommand(
23238
- import_lexical4.INDENT_CONTENT_COMMAND,
23239
- () => !isIndentPermitted(maxDepth),
23240
- import_lexical4.COMMAND_PRIORITY_CRITICAL
23297
+ import_lexical4.SELECTION_CHANGE_COMMAND,
23298
+ () => {
23299
+ editor.read(() => {
23300
+ const selection = (0, import_lexical4.$getSelection)();
23301
+ if (!(0, import_lexical4.$isRangeSelection)(selection) || !selection.isCollapsed()) {
23302
+ isInListItemNode.current = false;
23303
+ return false;
23304
+ }
23305
+ isInListItemNode.current = (0, import_utils8.$getNearestNodeOfType)(selection.anchor.getNode(), import_list.ListNode) !== null;
23306
+ });
23307
+ return false;
23308
+ },
23309
+ import_lexical4.COMMAND_PRIORITY_NORMAL
23310
+ );
23311
+ }, [editor]);
23312
+ (0, import_react148.useEffect)(() => {
23313
+ return (0, import_utils8.mergeRegister)(
23314
+ editor.registerCommand(
23315
+ import_lexical4.INDENT_CONTENT_COMMAND,
23316
+ () => !isIndentPermitted(maxDepth),
23317
+ import_lexical4.COMMAND_PRIORITY_CRITICAL
23318
+ ),
23319
+ editor.registerCommand(
23320
+ import_lexical4.KEY_TAB_COMMAND,
23321
+ (event) => {
23322
+ const selection = (0, import_lexical4.$getSelection)();
23323
+ if (!(0, import_lexical4.$isRangeSelection)(selection) || !isInListItemNode.current && !$isAnyOfSelectedNodesAListItemNode(selection)) {
23324
+ return false;
23325
+ }
23326
+ event.preventDefault();
23327
+ if ($indentOverTab(selection)) {
23328
+ const command = event.shiftKey ? import_lexical4.OUTDENT_CONTENT_COMMAND : import_lexical4.INDENT_CONTENT_COMMAND;
23329
+ return editor.dispatchCommand(command, void 0);
23330
+ }
23331
+ return false;
23332
+ },
23333
+ import_lexical4.COMMAND_PRIORITY_CRITICAL
23334
+ )
23241
23335
  );
23242
23336
  }, [editor, maxDepth]);
23243
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_LexicalTabIndentationPlugin.TabIndentationPlugin, {});
23337
+ return null;
23244
23338
  }
23245
23339
 
23246
- // src/components/ParameterInputs/rich-text/RichTextToolbar.tsx
23340
+ // src/components/ParameterInputs/rich-text/TableActionMenuPlugin.tsx
23247
23341
  init_emotion_jsx_shim();
23248
23342
  var import_react149 = require("@emotion/react");
23249
- var import_code2 = require("@lexical/code");
23250
- var import_list2 = require("@lexical/list");
23251
23343
  var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerContext");
23252
- var import_rich_text = require("@lexical/rich-text");
23253
- var import_selection2 = require("@lexical/selection");
23344
+ var import_useLexicalEditable = require("@lexical/react/useLexicalEditable");
23254
23345
  var import_table = require("@lexical/table");
23255
- var import_utils9 = require("@lexical/utils");
23256
23346
  var import_lexical5 = require("lexical");
23257
23347
  var import_react150 = require("react");
23258
- var import_jsx_runtime131 = require("@emotion/react/jsx-runtime");
23259
- var toolbar = import_react149.css`
23260
- ${scrollbarStyles}
23261
- background: var(--gray-50);
23262
- border-radius: var(--rounded-base);
23263
- display: flex;
23264
- /* We add 1px because we use a 1px wide separator */
23265
- gap: calc(var(--spacing-sm) + 1px);
23266
- margin: calc(var(--spacing-sm) + var(--spacing-xs)) 0;
23267
- overflow: auto;
23268
- padding: var(--spacing-sm);
23269
- position: sticky;
23270
- top: calc(var(--spacing-sm) * -2);
23271
- z-index: 10;
23272
- `;
23273
- var toolbarGroup = import_react149.css`
23274
- display: flex;
23275
- flex-shrink: 0;
23276
- gap: var(--spacing-xs);
23277
- position: relative;
23278
-
23279
- &:not(:first-child)::before {
23280
- background-color: var(--gray-300);
23281
- content: '';
23282
- display: block;
23283
- height: 24px;
23284
- left: calc(var(--spacing-xs) * -1);
23285
- position: absolute;
23286
- top: 4px;
23287
- width: 1px;
23288
- }
23289
- `;
23290
- var richTextToolbarButton = import_react149.css`
23291
- align-items: center;
23292
- appearance: none;
23293
- border: 0;
23294
- border-radius: var(--rounded-sm);
23295
- box-shadow: none;
23296
- color: var(--gray-900);
23297
- display: flex;
23298
- flex-shrink: 0;
23299
- height: 32px;
23300
- justify-content: center;
23301
- min-width: 32px;
23302
- padding: 0 var(--spacing-sm);
23303
- `;
23304
- var richTextToolbarButtonActive = import_react149.css`
23305
- background: var(--gray-200);
23306
- `;
23307
- var textStyleButton = import_react149.css`
23308
- justify-content: space-between;
23309
- min-width: 7rem;
23310
- `;
23311
- var toolbarIcon = import_react149.css`
23312
- color: inherit;
23313
- `;
23314
- var toolbarChevron = import_react149.css`
23315
- margin-left: var(--spacing-xs);
23348
+ var import_jsx_runtime130 = require("@emotion/react/jsx-runtime");
23349
+ function computeSelectionCount(selection) {
23350
+ const selectionShape = selection.getShape();
23351
+ return {
23352
+ columns: selectionShape.toX - selectionShape.fromX + 1,
23353
+ rows: selectionShape.toY - selectionShape.fromY + 1
23354
+ };
23355
+ }
23356
+ var tableActionMenuTrigger = import_react149.css`
23357
+ position: absolute;
23358
+ transform: translate(calc(-100% - 1px), 1px);
23316
23359
  `;
23317
- var RichTextToolbarIcon = ({ icon }) => {
23318
- return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon, css: toolbarIcon, size: "1rem" });
23319
- };
23320
- var FORMATS_WITH_ICON = /* @__PURE__ */ new Map([
23321
- ["bold", "format-bold"],
23322
- ["italic", "format-italic"],
23323
- ["underline", "format-underline"],
23324
- ["strikethrough", "format-strike"],
23325
- ["code", "format-code"],
23326
- ["superscript", "format-superscript"],
23327
- ["subscript", "format-subscript"]
23328
- ]);
23329
- var HEADING_ELEMENTS = ["h1", "h2", "h3", "h4", "h5", "h6"];
23330
- var TEXTUAL_ELEMENTS = HEADING_ELEMENTS;
23331
- var RichTextToolbar = ({ config, customControls, onInsertTable }) => {
23332
- const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
23333
- const {
23334
- activeElement,
23335
- setActiveElement,
23336
- activeFormats,
23337
- setActiveFormats,
23338
- visibleFormatsWithIcon,
23339
- visibleFormatsWithoutIcon,
23340
- visibleTextualElements,
23341
- isLink,
23342
- setIsLink,
23343
- linkElementVisible,
23344
- visibleLists,
23345
- codeElementVisible,
23346
- quoteElementVisible,
23347
- visibleElementsWithIcons,
23348
- visibleInsertElementsWithIcons,
23349
- tableElementVisible
23350
- } = useRichTextToolbarState({ config });
23351
- const onSelectElement = (type) => {
23352
- if (activeElement === type) {
23353
- return;
23360
+ var TableActionMenuTrigger = (0, import_react150.forwardRef)((props, ref) => {
23361
+ const { tableCellEl, positioningAnchorEl, ...rest } = props;
23362
+ const [coordinates, setCoordinates] = (0, import_react150.useState)({ x: 0, y: 0 });
23363
+ (0, import_react150.useLayoutEffect)(() => {
23364
+ const rect = tableCellEl.getBoundingClientRect();
23365
+ const parentRect = positioningAnchorEl.getBoundingClientRect();
23366
+ const relativeX = rect.right - parentRect.left + positioningAnchorEl.scrollLeft;
23367
+ const relativeY = rect.top - parentRect.top + positioningAnchorEl.scrollTop;
23368
+ setCoordinates({ x: relativeX, y: relativeY });
23369
+ }, [tableCellEl, positioningAnchorEl]);
23370
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23371
+ IconButton,
23372
+ {
23373
+ ref,
23374
+ css: [
23375
+ tableActionMenuTrigger,
23376
+ {
23377
+ top: coordinates.y,
23378
+ left: coordinates.x
23379
+ }
23380
+ ],
23381
+ size: "xs",
23382
+ buttonType: "unimportant",
23383
+ ...rest,
23384
+ children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "chevron-down", size: "1rem", iconColor: "currentColor" })
23354
23385
  }
23355
- editor.focus(() => {
23356
- editor.update(() => {
23357
- const selection = (0, import_lexical5.$getSelection)();
23358
- if (HEADING_ELEMENTS.includes(type)) {
23359
- (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createHeadingNode)(type));
23360
- } else if (type === "paragraph") {
23361
- (0, import_selection2.$setBlocksType)(selection, () => (0, import_lexical5.$createParagraphNode)());
23362
- } else if (type === "quote") {
23363
- (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createQuoteNode)());
23364
- } else if (type === "code") {
23365
- (0, import_selection2.$setBlocksType)(selection, () => (0, import_code2.$createCodeNode)());
23366
- } else if (type === "table" && onInsertTable) {
23367
- onInsertTable().then((dimensions) => {
23368
- if (!dimensions) {
23369
- return;
23370
- }
23371
- const { rows, columns } = dimensions;
23372
- editor.focus(() => {
23373
- editor.update(() => {
23374
- (0, import_lexical5.$insertNodes)([(0, import_table.$createTableNodeWithDimensions)(rows, columns, false)]);
23375
- });
23376
- });
23386
+ );
23387
+ });
23388
+ TableActionMenuTrigger.displayName = "TableActionMenuTrigger";
23389
+ function TableActionMenu({
23390
+ tableCellNode: _tableCellNode,
23391
+ menuPortalEl,
23392
+ tableCellEl,
23393
+ positioningAnchorEl
23394
+ }) {
23395
+ const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
23396
+ const [tableCellNode, updateTableCellNode] = (0, import_react150.useState)(_tableCellNode);
23397
+ const [selectionCounts, updateSelectionCounts] = (0, import_react150.useState)({
23398
+ columns: 1,
23399
+ rows: 1
23400
+ });
23401
+ const [menuTriggerKey, setMenuTriggerKey] = (0, import_react150.useState)(0);
23402
+ const incrementMenuTriggerKey = () => {
23403
+ setMenuTriggerKey((key) => key += 1);
23404
+ };
23405
+ (0, import_react150.useEffect)(() => {
23406
+ return editor.registerMutationListener(
23407
+ import_table.TableCellNode,
23408
+ (nodeMutations) => {
23409
+ const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
23410
+ if (nodeUpdated) {
23411
+ editor.getEditorState().read(() => {
23412
+ updateTableCellNode(tableCellNode.getLatest());
23377
23413
  });
23378
23414
  }
23379
- });
23415
+ },
23416
+ { skipInitialization: true }
23417
+ );
23418
+ }, [editor, tableCellNode]);
23419
+ (0, import_react150.useEffect)(() => {
23420
+ editor.getEditorState().read(() => {
23421
+ const selection = (0, import_lexical5.$getSelection)();
23422
+ if ((0, import_table.$isTableSelection)(selection)) {
23423
+ updateSelectionCounts(computeSelectionCount(selection));
23424
+ }
23380
23425
  });
23381
- };
23382
- const updateToolbar = (0, import_react150.useCallback)(() => {
23383
- const selection = (0, import_lexical5.$getSelection)();
23384
- if (!(0, import_lexical5.$isRangeSelection)(selection)) {
23385
- return;
23386
- }
23387
- const newActiveFormats = [];
23388
- for (const format of richTextBuiltInFormats) {
23389
- if (selection.hasFormat(format.type)) {
23390
- newActiveFormats.push(format.type);
23426
+ }, [editor]);
23427
+ const clearTableSelection = (0, import_react150.useCallback)(() => {
23428
+ editor.update(() => {
23429
+ if (tableCellNode.isAttached()) {
23430
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23431
+ const tableElement2 = editor.getElementByKey(
23432
+ tableNode.getKey()
23433
+ );
23434
+ if (!tableElement2) {
23435
+ throw new Error("Expected to find tableElement in DOM");
23436
+ }
23437
+ const tableSelection = (0, import_table.getTableObserverFromTableElement)(tableElement2);
23438
+ if (tableSelection !== null) {
23439
+ tableSelection.clearHighlight();
23440
+ }
23441
+ tableNode.markDirty();
23442
+ updateTableCellNode(tableCellNode.getLatest());
23391
23443
  }
23392
- }
23393
- setActiveFormats(newActiveFormats);
23394
- const anchorNode = selection.anchor.getNode();
23395
- let element = anchorNode.getKey() === "root" ? anchorNode : (0, import_utils9.$findMatchingParent)(anchorNode, (e) => {
23396
- const parent = e.getParent();
23397
- return parent !== null && (0, import_lexical5.$isRootOrShadowRoot)(parent);
23444
+ const rootNode = (0, import_lexical5.$getRoot)();
23445
+ rootNode.selectStart();
23398
23446
  });
23399
- if (element === null) {
23400
- element = anchorNode.getTopLevelElementOrThrow();
23401
- }
23402
- const elementKey = element.getKey();
23403
- const elementDOM = editor.getElementByKey(elementKey);
23404
- if (elementDOM !== null) {
23405
- if ((0, import_list2.$isListNode)(element)) {
23406
- const parentList = (0, import_utils9.$getNearestNodeOfType)(anchorNode, import_list2.ListNode);
23407
- const type = parentList ? parentList.getListType() : element.getListType();
23408
- setActiveElement(type === "bullet" ? "unorderedList" : "orderedList");
23409
- } else {
23410
- const type = (0, import_rich_text.$isHeadingNode)(element) ? element.getTag() : element.getType();
23411
- setActiveElement(type);
23447
+ }, [editor, tableCellNode]);
23448
+ const insertTableRowAtSelection = (0, import_react150.useCallback)(
23449
+ (shouldInsertAfter) => {
23450
+ editor.update(() => {
23451
+ (0, import_table.$insertTableRow__EXPERIMENTAL)(shouldInsertAfter);
23452
+ });
23453
+ incrementMenuTriggerKey();
23454
+ },
23455
+ [editor]
23456
+ );
23457
+ const insertTableColumnAtSelection = (0, import_react150.useCallback)(
23458
+ (shouldInsertAfter) => {
23459
+ editor.update(() => {
23460
+ for (let i = 0; i < selectionCounts.columns; i++) {
23461
+ (0, import_table.$insertTableColumn__EXPERIMENTAL)(shouldInsertAfter);
23462
+ }
23463
+ });
23464
+ incrementMenuTriggerKey();
23465
+ },
23466
+ [editor, selectionCounts.columns]
23467
+ );
23468
+ const deleteTableRowAtSelection = (0, import_react150.useCallback)(() => {
23469
+ editor.update(() => {
23470
+ (0, import_table.$deleteTableRow__EXPERIMENTAL)();
23471
+ });
23472
+ incrementMenuTriggerKey();
23473
+ }, [editor]);
23474
+ const deleteTableAtSelection = (0, import_react150.useCallback)(() => {
23475
+ editor.update(() => {
23476
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23477
+ tableNode.remove();
23478
+ clearTableSelection();
23479
+ });
23480
+ }, [editor, tableCellNode, clearTableSelection]);
23481
+ const deleteTableColumnAtSelection = (0, import_react150.useCallback)(() => {
23482
+ editor.update(() => {
23483
+ (0, import_table.$deleteTableColumn__EXPERIMENTAL)();
23484
+ });
23485
+ incrementMenuTriggerKey();
23486
+ }, [editor]);
23487
+ const toggleTableRowIsHeader = (0, import_react150.useCallback)(() => {
23488
+ editor.update(() => {
23489
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23490
+ const tableRowIndex = (0, import_table.$getTableRowIndexFromTableCellNode)(tableCellNode);
23491
+ const tableRows = tableNode.getChildren();
23492
+ if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
23493
+ throw new Error("Expected table cell to be inside of table row.");
23412
23494
  }
23413
- }
23414
- const node = getSelectedNode(selection);
23415
- if (getLinkAncestor(node) !== null) {
23416
- setIsLink(true);
23417
- } else {
23418
- setIsLink(false);
23419
- }
23420
- }, [editor, setActiveElement, setActiveFormats, setIsLink]);
23421
- (0, import_react150.useEffect)(() => {
23422
- return editor.registerCommand(
23423
- import_lexical5.SELECTION_CHANGE_COMMAND,
23424
- (_payload) => {
23425
- updateToolbar();
23426
- return false;
23427
- },
23428
- import_lexical5.COMMAND_PRIORITY_CRITICAL
23429
- );
23430
- }, [editor, updateToolbar]);
23431
- (0, import_react150.useEffect)(() => {
23432
- return editor.registerUpdateListener(({ editorState }) => {
23433
- requestAnimationFrame(() => {
23434
- editorState.read(() => {
23435
- updateToolbar();
23436
- });
23495
+ const tableRow2 = tableRows[tableRowIndex];
23496
+ if (!(0, import_table.$isTableRowNode)(tableRow2)) {
23497
+ throw new Error("Expected table row");
23498
+ }
23499
+ tableRow2.getChildren().forEach((tableCell) => {
23500
+ if (!(0, import_table.$isTableCellNode)(tableCell)) {
23501
+ throw new Error("Expected table cell");
23502
+ }
23503
+ tableCell.toggleHeaderStyle(import_table.TableCellHeaderStates.ROW);
23437
23504
  });
23505
+ clearTableSelection();
23438
23506
  });
23439
- }, [editor, updateToolbar]);
23440
- return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { css: toolbar, children: [
23441
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
23442
- Menu,
23443
- {
23444
- menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("button", { css: [richTextToolbarButton, textStyleButton], title: "Text styles", children: [
23445
- visibleTextualElements.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
23446
- " ",
23447
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
23448
- ] }),
23449
- placement: "bottom-start",
23450
- children: [
23451
- [
23452
- {
23453
- label: "Normal",
23454
- type: "paragraph"
23455
- },
23456
- ...visibleTextualElements
23457
- ].map((element) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23458
- MenuItem,
23459
- {
23460
- onClick: () => {
23461
- onSelectElement(element.type);
23462
- },
23463
- children: element.label
23464
- },
23465
- element.type
23466
- )),
23467
- visibleTextualElements.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItem, { disabled: true, children: "Alternative text styles are not available" }) : null
23468
- ]
23507
+ }, [editor, tableCellNode, clearTableSelection]);
23508
+ const toggleTableColumnIsHeader = (0, import_react150.useCallback)(() => {
23509
+ editor.update(() => {
23510
+ const tableNode = (0, import_table.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23511
+ const tableColumnIndex = (0, import_table.$getTableColumnIndexFromTableCellNode)(tableCellNode);
23512
+ const tableRows = tableNode.getChildren();
23513
+ const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length));
23514
+ if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {
23515
+ throw new Error("Expected table cell to be inside of table row.");
23469
23516
  }
23470
- ),
23471
- visibleFormatsWithIcon.length > 0 || visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { css: toolbarGroup, children: [
23472
- visibleFormatsWithIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Tooltip, { title: format.label, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23473
- "button",
23474
- {
23475
- onClick: () => {
23476
- editor.dispatchCommand(import_lexical5.FORMAT_TEXT_COMMAND, format.type);
23477
- },
23478
- css: [
23479
- richTextToolbarButton,
23480
- activeFormats.includes(format.type) ? richTextToolbarButtonActive : null
23481
- ],
23482
- children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(RichTextToolbarIcon, { icon: FORMATS_WITH_ICON.get(format.type) })
23517
+ for (let r = 0; r < tableRows.length; r++) {
23518
+ const tableRow2 = tableRows[r];
23519
+ if (!(0, import_table.$isTableRowNode)(tableRow2)) {
23520
+ throw new Error("Expected table row");
23483
23521
  }
23484
- ) }, format.type)),
23485
- visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23486
- Menu,
23487
- {
23488
- menuLabel: "Alternative text styles",
23489
- menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("button", { css: richTextToolbarButton, title: "Alternative text styles", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon: "more-alt", css: toolbarIcon }) }),
23490
- placement: "bottom-start",
23491
- children: visibleFormatsWithoutIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23492
- MenuItem,
23493
- {
23494
- onClick: () => {
23495
- editor.dispatchCommand(import_lexical5.FORMAT_TEXT_COMMAND, format.type);
23496
- },
23497
- children: format.label
23498
- },
23499
- format.type
23500
- ))
23522
+ const tableCells = tableRow2.getChildren();
23523
+ if (tableColumnIndex >= tableCells.length) {
23524
+ continue;
23501
23525
  }
23502
- ) : null
23503
- ] }) : null,
23504
- visibleElementsWithIcons.size > 0 || customControls ? /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { css: toolbarGroup, children: [
23505
- linkElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23506
- "button",
23507
- {
23508
- onClick: () => {
23509
- isLink ? editor.dispatchCommand(REMOVE_LINK_NODE_COMMAND, {}) : editor.dispatchCommand(OPEN_LINK_NODE_MODAL_COMMAND, {});
23510
- },
23511
- css: [richTextToolbarButton, isLink ? richTextToolbarButtonActive : null],
23512
- children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(RichTextToolbarIcon, { icon: "link" })
23526
+ const tableCell = tableCells[tableColumnIndex];
23527
+ if (!(0, import_table.$isTableCellNode)(tableCell)) {
23528
+ throw new Error("Expected table cell");
23513
23529
  }
23514
- ) }) : null,
23515
- visibleLists.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
23516
- visibleLists.has("unorderedList") ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Tooltip, { title: "Bullet List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23517
- "button",
23518
- {
23519
- onClick: () => {
23520
- activeElement === "unorderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_UNORDERED_LIST_COMMAND, void 0);
23521
- },
23522
- css: [
23523
- richTextToolbarButton,
23524
- activeElement === "unorderedList" ? richTextToolbarButtonActive : null
23525
- ],
23526
- children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(RichTextToolbarIcon, { icon: "layout-list" })
23527
- }
23528
- ) }) : null,
23529
- visibleLists.has("orderedList") ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Tooltip, { title: "Ordered List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23530
- "button",
23530
+ tableCell.toggleHeaderStyle(import_table.TableCellHeaderStates.COLUMN);
23531
+ }
23532
+ clearTableSelection();
23533
+ });
23534
+ }, [editor, tableCellNode, clearTableSelection]);
23535
+ const menuItemCss = (0, import_react149.css)({
23536
+ fontSize: "var(--fs-sm)"
23537
+ });
23538
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
23539
+ Menu,
23540
+ {
23541
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23542
+ TableActionMenuTrigger,
23543
+ {
23544
+ tableCellEl,
23545
+ positioningAnchorEl
23546
+ },
23547
+ menuTriggerKey
23548
+ ),
23549
+ portalElement: menuPortalEl,
23550
+ maxMenuHeight: "300px",
23551
+ children: [
23552
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
23553
+ MenuItem,
23531
23554
  {
23532
23555
  onClick: () => {
23533
- activeElement === "orderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_ORDERED_LIST_COMMAND, void 0);
23556
+ insertTableRowAtSelection(false);
23534
23557
  },
23535
- css: [
23536
- richTextToolbarButton,
23537
- activeElement === "orderedList" ? richTextToolbarButtonActive : null
23538
- ],
23539
- children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(RichTextToolbarIcon, { icon: "layout-list-numbered" })
23558
+ css: menuItemCss,
23559
+ children: [
23560
+ "Insert ",
23561
+ selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
23562
+ " above"
23563
+ ]
23540
23564
  }
23541
- ) }) : null
23542
- ] }) : null,
23543
- customControls ? customControls : null
23544
- ] }) : null,
23545
- visibleInsertElementsWithIcons.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { css: toolbarGroup, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
23546
- Menu,
23547
- {
23548
- menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("button", { css: richTextToolbarButton, title: "Insert block element", children: [
23549
- "Insert",
23550
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
23565
+ ),
23566
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableRowAtSelection(true), css: menuItemCss, children: [
23567
+ "Insert ",
23568
+ selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
23569
+ " below"
23551
23570
  ] }),
23552
- placement: "bottom-start",
23553
- children: [
23554
- quoteElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23555
- MenuItem,
23556
- {
23557
- onClick: () => {
23558
- onSelectElement("quote");
23559
- },
23560
- icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon: "quote", iconColor: "currentColor" }),
23561
- children: "Quote"
23562
- }
23563
- ) : null,
23564
- codeElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23565
- MenuItem,
23566
- {
23567
- onClick: () => {
23568
- onSelectElement("code");
23569
- },
23570
- icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon: "code-slash", iconColor: "currentColor" }),
23571
- children: "Code"
23572
- }
23573
- ) : null,
23574
- tableElementVisible && onInsertTable !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23575
- MenuItem,
23576
- {
23577
- onClick: () => {
23578
- onSelectElement("table");
23579
- },
23580
- icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon: "view-grid", iconColor: "currentColor" }),
23581
- children: "Table"
23582
- }
23583
- ) : null
23584
- ]
23585
- }
23586
- ) }) : null
23587
- ] });
23588
- };
23589
- var RichTextToolbar_default = RichTextToolbar;
23590
- var useRichTextToolbarState = ({ config }) => {
23591
- var _a;
23592
- const enabledBuiltInFormats = (0, import_react150.useMemo)(() => {
23593
- return richTextBuiltInFormats.filter((format) => {
23594
- var _a2, _b;
23595
- return (_b = (_a2 = config == null ? void 0 : config.formatting) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(format.type);
23596
- });
23597
- }, [config]);
23598
- const enabledBuiltInElements = (0, import_react150.useMemo)(() => {
23599
- return richTextBuiltInElements.filter((element) => {
23600
- var _a2, _b;
23601
- return (_b = (_a2 = config == null ? void 0 : config.elements) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(element.type);
23602
- });
23603
- }, [config]);
23604
- const enabledBuiltInFormatsWithIcon = (0, import_react150.useMemo)(() => {
23605
- return enabledBuiltInFormats.filter((format) => FORMATS_WITH_ICON.has(format.type));
23606
- }, [enabledBuiltInFormats]);
23607
- const enabledBuiltInFormatsWithoutIcon = enabledBuiltInFormats.filter(
23608
- (format) => !FORMATS_WITH_ICON.has(format.type)
23571
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23572
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(false), css: menuItemCss, children: [
23573
+ "Insert ",
23574
+ selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
23575
+ " left"
23576
+ ] }),
23577
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(true), css: menuItemCss, children: [
23578
+ "Insert ",
23579
+ selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
23580
+ " right"
23581
+ ] }),
23582
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23583
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableColumnAtSelection(), css: menuItemCss, children: "Delete column" }),
23584
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableRowAtSelection(), css: menuItemCss, children: "Delete row" }),
23585
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItem, { onClick: () => deleteTableAtSelection(), css: menuItemCss, children: "Delete table" }),
23586
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(MenuItemSeparator, {}),
23587
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => toggleTableRowIsHeader(), css: menuItemCss, children: [
23588
+ (tableCellNode.__headerState & import_table.TableCellHeaderStates.ROW) === import_table.TableCellHeaderStates.ROW ? "Remove" : "Add",
23589
+ " ",
23590
+ "row header"
23591
+ ] }),
23592
+ /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(MenuItem, { onClick: () => toggleTableColumnIsHeader(), css: menuItemCss, children: [
23593
+ (tableCellNode.__headerState & import_table.TableCellHeaderStates.COLUMN) === import_table.TableCellHeaderStates.COLUMN ? "Remove" : "Add",
23594
+ " ",
23595
+ "column header"
23596
+ ] })
23597
+ ]
23598
+ }
23609
23599
  );
23610
- const [activeFormats, setActiveFormats] = (0, import_react150.useState)([]);
23611
- const visibleFormatsWithIcon = (0, import_react150.useMemo)(() => {
23612
- const visibleFormats = /* @__PURE__ */ new Set();
23613
- activeFormats.filter((type) => FORMATS_WITH_ICON.has(type)).forEach((type) => {
23614
- visibleFormats.add(type);
23615
- });
23616
- enabledBuiltInFormatsWithIcon.forEach((format) => {
23617
- visibleFormats.add(format.type);
23618
- });
23619
- return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
23620
- }, [activeFormats, enabledBuiltInFormatsWithIcon]);
23621
- const visibleFormatsWithoutIcon = (0, import_react150.useMemo)(() => {
23622
- const visibleFormats = /* @__PURE__ */ new Set();
23623
- activeFormats.filter((type) => !FORMATS_WITH_ICON.has(type)).forEach((type) => {
23624
- visibleFormats.add(type);
23625
- });
23626
- enabledBuiltInFormatsWithoutIcon.forEach((format) => {
23627
- visibleFormats.add(format.type);
23628
- });
23629
- return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
23630
- }, [activeFormats, enabledBuiltInFormatsWithoutIcon]);
23631
- const [activeElement, setActiveElement] = (0, import_react150.useState)("paragraph");
23632
- const enabledTextualElements = enabledBuiltInElements.filter(
23633
- (element) => TEXTUAL_ELEMENTS.includes(element.type)
23634
- );
23635
- const visibleTextualElements = (0, import_react150.useMemo)(() => {
23636
- if (!TEXTUAL_ELEMENTS.includes(activeElement)) {
23637
- return enabledTextualElements;
23600
+ }
23601
+ function TableCellActionMenuContainer({
23602
+ menuPortalEl,
23603
+ positioningAnchorEl
23604
+ }) {
23605
+ const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
23606
+ const [tableCellNode, setTableMenuCellNode] = (0, import_react150.useState)(null);
23607
+ const [tableCellNodeEl, _setTableMenuCellNodeEl] = (0, import_react150.useState)(null);
23608
+ const [tableCellMenuPortalEl, setTableMenuCellMenuPortalEl] = (0, import_react150.useState)(null);
23609
+ (0, import_react150.useEffect)(() => {
23610
+ const newPortalEl = document.createElement("div");
23611
+ setTableMenuCellMenuPortalEl(newPortalEl);
23612
+ menuPortalEl.appendChild(newPortalEl);
23613
+ return () => {
23614
+ newPortalEl.remove();
23615
+ };
23616
+ }, [menuPortalEl]);
23617
+ const setTableMenuCellNodeElem = (0, import_react150.useCallback)((elem) => {
23618
+ if (elem) {
23619
+ _setTableMenuCellNodeEl(elem);
23620
+ } else {
23621
+ _setTableMenuCellNodeEl(null);
23638
23622
  }
23639
- return richTextBuiltInElements.filter(
23640
- (element) => {
23641
- var _a2, _b;
23642
- 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);
23623
+ }, []);
23624
+ const $moveMenu = (0, import_react150.useCallback)(() => {
23625
+ const selection = (0, import_lexical5.$getSelection)();
23626
+ const nativeSelection = window.getSelection();
23627
+ const activeElement = document.activeElement;
23628
+ if (selection == null) {
23629
+ setTableMenuCellNode(null);
23630
+ return;
23631
+ }
23632
+ const rootElement = editor.getRootElement();
23633
+ if ((0, import_lexical5.$isRangeSelection)(selection) && rootElement !== null && nativeSelection !== null && rootElement.contains(nativeSelection.anchorNode)) {
23634
+ const tableCellNodeFromSelection = (0, import_table.$getTableCellNodeFromLexicalNode)(selection.anchor.getNode());
23635
+ if (tableCellNodeFromSelection == null) {
23636
+ setTableMenuCellNode(null);
23637
+ setTableMenuCellNodeElem(null);
23638
+ return;
23643
23639
  }
23644
- );
23645
- }, [activeElement, (_a = config == null ? void 0 : config.elements) == null ? void 0 : _a.builtIn, enabledTextualElements]);
23646
- const [isLink, setIsLink] = (0, import_react150.useState)(false);
23647
- const linkElementVisible = (0, import_react150.useMemo)(() => {
23648
- return enabledBuiltInElements.some((element) => element.type === "link") || isLink;
23649
- }, [isLink, enabledBuiltInElements]);
23650
- const visibleLists = (0, import_react150.useMemo)(() => {
23651
- return new Set(
23652
- ["orderedList", "unorderedList"].filter(
23653
- (type) => enabledBuiltInElements.some((element) => element.type === type) || activeElement === type
23654
- )
23655
- );
23656
- }, [activeElement, enabledBuiltInElements]);
23657
- const quoteElementVisible = (0, import_react150.useMemo)(() => {
23658
- return enabledBuiltInElements.some((element) => element.type === "quote") || activeElement === "quote";
23659
- }, [activeElement, enabledBuiltInElements]);
23660
- const codeElementVisible = (0, import_react150.useMemo)(() => {
23661
- return enabledBuiltInElements.some((element) => element.type === "code") || activeElement === "code";
23662
- }, [activeElement, enabledBuiltInElements]);
23663
- const tableElementVisible = (0, import_react150.useMemo)(() => {
23664
- return enabledBuiltInElements.some((element) => element.type === "table") || activeElement === "table";
23665
- }, [activeElement, enabledBuiltInElements]);
23666
- const visibleElementsWithIcons = (0, import_react150.useMemo)(() => {
23667
- const visibleElements = /* @__PURE__ */ new Set();
23668
- if (linkElementVisible) {
23669
- visibleElements.add("link");
23640
+ const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
23641
+ if (tableCellParentNodeDOM == null) {
23642
+ setTableMenuCellNode(null);
23643
+ setTableMenuCellNodeElem(null);
23644
+ return;
23645
+ }
23646
+ setTableMenuCellNode(tableCellNodeFromSelection);
23647
+ setTableMenuCellNodeElem(tableCellParentNodeDOM);
23648
+ } else if (!activeElement) {
23649
+ setTableMenuCellNode(null);
23650
+ setTableMenuCellNodeElem(null);
23670
23651
  }
23671
- if (visibleLists.size > 0) {
23672
- visibleLists.forEach((type) => {
23673
- visibleElements.add(type);
23652
+ }, [editor, setTableMenuCellNodeElem]);
23653
+ (0, import_react150.useEffect)(() => {
23654
+ return editor.registerUpdateListener(() => {
23655
+ editor.getEditorState().read(() => {
23656
+ $moveMenu();
23674
23657
  });
23675
- }
23676
- return visibleElements;
23677
- }, [linkElementVisible, visibleLists]);
23678
- const visibleInsertElementsWithIcons = (0, import_react150.useMemo)(() => {
23679
- const visibleElements = /* @__PURE__ */ new Set();
23680
- if (quoteElementVisible) {
23681
- visibleElements.add("quote");
23682
- }
23683
- if (codeElementVisible) {
23684
- visibleElements.add("code");
23685
- }
23686
- if (tableElementVisible) {
23687
- visibleElements.add("table");
23688
- }
23689
- return visibleElements;
23690
- }, [codeElementVisible, quoteElementVisible, tableElementVisible]);
23691
- return {
23692
- activeFormats,
23693
- setActiveFormats,
23694
- activeElement,
23695
- setActiveElement,
23696
- visibleFormatsWithIcon,
23697
- visibleFormatsWithoutIcon,
23698
- visibleTextualElements,
23699
- isLink,
23700
- setIsLink,
23701
- linkElementVisible,
23702
- visibleLists,
23703
- quoteElementVisible,
23704
- codeElementVisible,
23705
- tableElementVisible,
23706
- visibleElementsWithIcons,
23707
- visibleInsertElementsWithIcons
23708
- };
23709
- };
23658
+ });
23659
+ });
23660
+ return tableCellNode != null && tableCellNodeEl != null && tableCellMenuPortalEl != null && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
23661
+ TableActionMenu,
23662
+ {
23663
+ tableCellNode,
23664
+ menuPortalEl: tableCellMenuPortalEl,
23665
+ tableCellEl: tableCellNodeEl,
23666
+ positioningAnchorEl
23667
+ },
23668
+ tableCellNode.getKey()
23669
+ );
23670
+ }
23671
+ function TableActionMenuPlugin({
23672
+ positioningAnchorEl,
23673
+ menuPortalEl
23674
+ }) {
23675
+ const isEditable = (0, import_useLexicalEditable.useLexicalEditable)();
23676
+ return isEditable ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(TableCellActionMenuContainer, { menuPortalEl, positioningAnchorEl }) : null;
23677
+ }
23710
23678
 
23711
- // src/components/ParameterInputs/rich-text/TableActionMenuPlugin.tsx
23679
+ // src/components/ParameterInputs/rich-text/TableCellResizerPlugin.tsx
23712
23680
  init_emotion_jsx_shim();
23713
23681
  var import_react151 = require("@emotion/react");
23714
23682
  var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
23715
- var import_useLexicalEditable = require("@lexical/react/useLexicalEditable");
23683
+ var import_useLexicalEditable2 = require("@lexical/react/useLexicalEditable");
23716
23684
  var import_table2 = require("@lexical/table");
23685
+ var import_utils10 = require("@lexical/utils");
23717
23686
  var import_lexical6 = require("lexical");
23718
23687
  var import_react152 = require("react");
23719
- var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
23720
- function computeSelectionCount(selection) {
23721
- const selectionShape = selection.getShape();
23722
- return {
23723
- columns: selectionShape.toX - selectionShape.fromX + 1,
23724
- rows: selectionShape.toY - selectionShape.fromY + 1
23725
- };
23726
- }
23727
- var tableActionMenuTrigger = import_react151.css`
23688
+ var import_react_dom3 = require("react-dom");
23689
+ var import_jsx_runtime131 = require("@emotion/react/jsx-runtime");
23690
+ var MIN_ROW_HEIGHT = 33;
23691
+ var MIN_COLUMN_WIDTH = 50;
23692
+ var tableResizer = import_react151.css`
23728
23693
  position: absolute;
23729
- transform: translate(calc(-100% - 1px), 1px);
23694
+ z-index: var(--z-10);
23730
23695
  `;
23731
- var TableActionMenuTrigger = (0, import_react152.forwardRef)((props, ref) => {
23732
- const { tableCellEl, positioningAnchorEl, ...rest } = props;
23733
- const [coordinates, setCoordinates] = (0, import_react152.useState)({ x: 0, y: 0 });
23734
- (0, import_react152.useLayoutEffect)(() => {
23735
- const rect = tableCellEl.getBoundingClientRect();
23736
- const parentRect = positioningAnchorEl.getBoundingClientRect();
23737
- const relativeX = rect.right - parentRect.left;
23738
- const relativeY = rect.top - parentRect.top;
23739
- setCoordinates({ x: relativeX, y: relativeY });
23740
- }, [tableCellEl, positioningAnchorEl]);
23741
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
23742
- IconButton,
23743
- {
23744
- ref,
23745
- css: [
23746
- tableActionMenuTrigger,
23747
- {
23748
- top: coordinates.y,
23749
- left: coordinates.x
23750
- }
23751
- ],
23752
- size: "xs",
23753
- buttonType: "unimportant",
23754
- ...rest,
23755
- children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "chevron-down", size: "1rem", iconColor: "currentColor" })
23696
+ var fixedGetDOMCellFromTarget = (node) => {
23697
+ let currentNode = node;
23698
+ while (currentNode != null) {
23699
+ const nodeName = currentNode.nodeName;
23700
+ if (nodeName === "TD" || nodeName === "TH") {
23701
+ const cell2 = currentNode._cell;
23702
+ if (cell2 === void 0) {
23703
+ return {
23704
+ elem: currentNode
23705
+ };
23706
+ }
23707
+ return cell2;
23756
23708
  }
23757
- );
23758
- });
23759
- TableActionMenuTrigger.displayName = "TableActionMenuTrigger";
23760
- function TableActionMenu({
23761
- tableCellNode: _tableCellNode,
23762
- menuPortalEl,
23763
- tableCellEl,
23764
- positioningAnchorEl
23765
- }) {
23766
- const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
23767
- const [tableCellNode, updateTableCellNode] = (0, import_react152.useState)(_tableCellNode);
23768
- const [selectionCounts, updateSelectionCounts] = (0, import_react152.useState)({
23769
- columns: 1,
23770
- rows: 1
23771
- });
23772
- const [menuTriggerKey, setMenuTriggerKey] = (0, import_react152.useState)(0);
23773
- const incrementMenuTriggerKey = () => {
23774
- setMenuTriggerKey((key) => key += 1);
23709
+ currentNode = currentNode.parentNode;
23710
+ }
23711
+ return null;
23712
+ };
23713
+ function TableCellResizer({ editor, positioningAnchorEl }) {
23714
+ const targetRef = (0, import_react152.useRef)(null);
23715
+ const resizerRef = (0, import_react152.useRef)(null);
23716
+ const tableRectRef = (0, import_react152.useRef)(null);
23717
+ const mouseStartPosRef = (0, import_react152.useRef)(null);
23718
+ const [mouseCurrentPos, updateMouseCurrentPos] = (0, import_react152.useState)(null);
23719
+ const [activeCell, updateActiveCell] = (0, import_react152.useState)(null);
23720
+ const [isMouseDown, updateIsMouseDown] = (0, import_react152.useState)(false);
23721
+ const [draggingDirection, updateDraggingDirection] = (0, import_react152.useState)(null);
23722
+ const resetState = (0, import_react152.useCallback)(() => {
23723
+ updateActiveCell(null);
23724
+ targetRef.current = null;
23725
+ updateDraggingDirection(null);
23726
+ mouseStartPosRef.current = null;
23727
+ tableRectRef.current = null;
23728
+ }, []);
23729
+ const isMouseDownOnEvent = (event) => {
23730
+ return (event.buttons & 1) === 1;
23775
23731
  };
23776
23732
  (0, import_react152.useEffect)(() => {
23777
- return editor.registerMutationListener(
23778
- import_table2.TableCellNode,
23779
- (nodeMutations) => {
23780
- const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
23781
- if (nodeUpdated) {
23782
- editor.getEditorState().read(() => {
23783
- updateTableCellNode(tableCellNode.getLatest());
23733
+ const onMouseMove = (event) => {
23734
+ setTimeout(() => {
23735
+ const target = event.target;
23736
+ if (draggingDirection) {
23737
+ updateMouseCurrentPos({
23738
+ x: event.clientX,
23739
+ y: event.clientY
23784
23740
  });
23741
+ return;
23785
23742
  }
23786
- },
23787
- { skipInitialization: true }
23788
- );
23789
- }, [editor, tableCellNode]);
23790
- (0, import_react152.useEffect)(() => {
23791
- editor.getEditorState().read(() => {
23792
- const selection = (0, import_lexical6.$getSelection)();
23793
- if ((0, import_table2.$isTableSelection)(selection)) {
23794
- updateSelectionCounts(computeSelectionCount(selection));
23795
- }
23796
- });
23797
- }, [editor]);
23798
- const clearTableSelection = (0, import_react152.useCallback)(() => {
23799
- editor.update(() => {
23800
- if (tableCellNode.isAttached()) {
23801
- const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23802
- const tableElement2 = editor.getElementByKey(
23803
- tableNode.getKey()
23804
- );
23805
- if (!tableElement2) {
23806
- throw new Error("Expected to find tableElement in DOM");
23807
- }
23808
- const tableSelection = (0, import_table2.getTableObserverFromTableElement)(tableElement2);
23809
- if (tableSelection !== null) {
23810
- tableSelection.clearHighlight();
23811
- }
23812
- tableNode.markDirty();
23813
- updateTableCellNode(tableCellNode.getLatest());
23814
- }
23815
- const rootNode = (0, import_lexical6.$getRoot)();
23816
- rootNode.selectStart();
23817
- });
23818
- }, [editor, tableCellNode]);
23819
- const insertTableRowAtSelection = (0, import_react152.useCallback)(
23820
- (shouldInsertAfter) => {
23821
- editor.update(() => {
23822
- (0, import_table2.$insertTableRow__EXPERIMENTAL)(shouldInsertAfter);
23823
- });
23824
- incrementMenuTriggerKey();
23825
- },
23826
- [editor]
23827
- );
23828
- const insertTableColumnAtSelection = (0, import_react152.useCallback)(
23829
- (shouldInsertAfter) => {
23830
- editor.update(() => {
23831
- for (let i = 0; i < selectionCounts.columns; i++) {
23832
- (0, import_table2.$insertTableColumn__EXPERIMENTAL)(shouldInsertAfter);
23833
- }
23834
- });
23835
- incrementMenuTriggerKey();
23836
- },
23837
- [editor, selectionCounts.columns]
23838
- );
23839
- const deleteTableRowAtSelection = (0, import_react152.useCallback)(() => {
23840
- editor.update(() => {
23841
- (0, import_table2.$deleteTableRow__EXPERIMENTAL)();
23842
- });
23843
- incrementMenuTriggerKey();
23844
- }, [editor]);
23845
- const deleteTableAtSelection = (0, import_react152.useCallback)(() => {
23846
- editor.update(() => {
23847
- const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23848
- tableNode.remove();
23849
- clearTableSelection();
23850
- });
23851
- }, [editor, tableCellNode, clearTableSelection]);
23852
- const deleteTableColumnAtSelection = (0, import_react152.useCallback)(() => {
23853
- editor.update(() => {
23854
- (0, import_table2.$deleteTableColumn__EXPERIMENTAL)();
23855
- clearTableSelection();
23856
- });
23857
- incrementMenuTriggerKey();
23858
- }, [editor, clearTableSelection]);
23859
- const toggleTableRowIsHeader = (0, import_react152.useCallback)(() => {
23860
- editor.update(() => {
23861
- const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23862
- const tableRowIndex = (0, import_table2.$getTableRowIndexFromTableCellNode)(tableCellNode);
23863
- const tableRows = tableNode.getChildren();
23864
- if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
23865
- throw new Error("Expected table cell to be inside of table row.");
23866
- }
23867
- const tableRow2 = tableRows[tableRowIndex];
23868
- if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
23869
- throw new Error("Expected table row");
23870
- }
23871
- tableRow2.getChildren().forEach((tableCell) => {
23872
- if (!(0, import_table2.$isTableCellNode)(tableCell)) {
23873
- throw new Error("Expected table cell");
23874
- }
23875
- tableCell.toggleHeaderStyle(import_table2.TableCellHeaderStates.ROW);
23876
- });
23877
- clearTableSelection();
23878
- });
23879
- }, [editor, tableCellNode, clearTableSelection]);
23880
- const toggleTableColumnIsHeader = (0, import_react152.useCallback)(() => {
23881
- editor.update(() => {
23882
- const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23883
- const tableColumnIndex = (0, import_table2.$getTableColumnIndexFromTableCellNode)(tableCellNode);
23884
- const tableRows = tableNode.getChildren();
23885
- const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length));
23886
- if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {
23887
- throw new Error("Expected table cell to be inside of table row.");
23888
- }
23889
- for (let r = 0; r < tableRows.length; r++) {
23890
- const tableRow2 = tableRows[r];
23891
- if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
23892
- throw new Error("Expected table row");
23893
- }
23894
- const tableCells = tableRow2.getChildren();
23895
- if (tableColumnIndex >= tableCells.length) {
23896
- continue;
23897
- }
23898
- const tableCell = tableCells[tableColumnIndex];
23899
- if (!(0, import_table2.$isTableCellNode)(tableCell)) {
23900
- throw new Error("Expected table cell");
23901
- }
23902
- tableCell.toggleHeaderStyle(import_table2.TableCellHeaderStates.COLUMN);
23903
- }
23904
- clearTableSelection();
23905
- });
23906
- }, [editor, tableCellNode, clearTableSelection]);
23907
- const menuItemCss = (0, import_react151.css)({
23908
- fontSize: "var(--fs-sm)"
23909
- });
23910
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
23911
- Menu,
23912
- {
23913
- menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
23914
- TableActionMenuTrigger,
23915
- {
23916
- tableCellEl,
23917
- positioningAnchorEl
23918
- },
23919
- menuTriggerKey
23920
- ),
23921
- portalElement: menuPortalEl,
23922
- maxMenuHeight: "300px",
23923
- children: [
23924
- /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
23925
- MenuItem,
23926
- {
23927
- onClick: () => {
23928
- insertTableRowAtSelection(false);
23929
- },
23930
- css: menuItemCss,
23931
- children: [
23932
- "Insert ",
23933
- selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
23934
- " above"
23935
- ]
23936
- }
23937
- ),
23938
- /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(MenuItem, { onClick: () => insertTableRowAtSelection(true), css: menuItemCss, children: [
23939
- "Insert ",
23940
- selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
23941
- " below"
23942
- ] }),
23943
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItemSeparator, {}),
23944
- /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(false), css: menuItemCss, children: [
23945
- "Insert ",
23946
- selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
23947
- " left"
23948
- ] }),
23949
- /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(true), css: menuItemCss, children: [
23950
- "Insert ",
23951
- selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
23952
- " right"
23953
- ] }),
23954
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItemSeparator, {}),
23955
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItem, { onClick: () => deleteTableColumnAtSelection(), css: menuItemCss, children: "Delete column" }),
23956
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItem, { onClick: () => deleteTableRowAtSelection(), css: menuItemCss, children: "Delete row" }),
23957
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItem, { onClick: () => deleteTableAtSelection(), css: menuItemCss, children: "Delete table" }),
23958
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItemSeparator, {}),
23959
- /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(MenuItem, { onClick: () => toggleTableRowIsHeader(), css: menuItemCss, children: [
23960
- (tableCellNode.__headerState & import_table2.TableCellHeaderStates.ROW) === import_table2.TableCellHeaderStates.ROW ? "Remove" : "Add",
23961
- " ",
23962
- "row header"
23963
- ] }),
23964
- /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(MenuItem, { onClick: () => toggleTableColumnIsHeader(), css: menuItemCss, children: [
23965
- (tableCellNode.__headerState & import_table2.TableCellHeaderStates.COLUMN) === import_table2.TableCellHeaderStates.COLUMN ? "Remove" : "Add",
23966
- " ",
23967
- "column header"
23968
- ] })
23969
- ]
23970
- }
23971
- );
23972
- }
23973
- function TableCellActionMenuContainer({
23974
- menuPortalEl,
23975
- positioningAnchorEl
23976
- }) {
23977
- const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
23978
- const [tableCellNode, setTableMenuCellNode] = (0, import_react152.useState)(null);
23979
- const [tableCellNodeEl, _setTableMenuCellNodeEl] = (0, import_react152.useState)(null);
23980
- const [tableCellMenuPortalEl, setTableMenuCellMenuPortalEl] = (0, import_react152.useState)(null);
23981
- (0, import_react152.useEffect)(() => {
23982
- const newPortalEl = document.createElement("div");
23983
- setTableMenuCellMenuPortalEl(newPortalEl);
23984
- menuPortalEl.appendChild(newPortalEl);
23985
- return () => {
23986
- newPortalEl.remove();
23987
- };
23988
- }, [menuPortalEl]);
23989
- const setTableMenuCellNodeElem = (0, import_react152.useCallback)((elem) => {
23990
- if (elem) {
23991
- _setTableMenuCellNodeEl(elem);
23992
- } else {
23993
- _setTableMenuCellNodeEl(null);
23994
- }
23995
- }, []);
23996
- const $moveMenu = (0, import_react152.useCallback)(() => {
23997
- const selection = (0, import_lexical6.$getSelection)();
23998
- const nativeSelection = window.getSelection();
23999
- const activeElement = document.activeElement;
24000
- if (selection == null) {
24001
- setTableMenuCellNode(null);
24002
- return;
24003
- }
24004
- const rootElement = editor.getRootElement();
24005
- if ((0, import_lexical6.$isRangeSelection)(selection) && rootElement !== null && nativeSelection !== null && rootElement.contains(nativeSelection.anchorNode)) {
24006
- const tableCellNodeFromSelection = (0, import_table2.$getTableCellNodeFromLexicalNode)(selection.anchor.getNode());
24007
- if (tableCellNodeFromSelection == null) {
24008
- setTableMenuCellNode(null);
24009
- setTableMenuCellNodeElem(null);
24010
- return;
24011
- }
24012
- const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
24013
- if (tableCellParentNodeDOM == null) {
24014
- setTableMenuCellNode(null);
24015
- setTableMenuCellNodeElem(null);
24016
- return;
24017
- }
24018
- setTableMenuCellNode(tableCellNodeFromSelection);
24019
- setTableMenuCellNodeElem(tableCellParentNodeDOM);
24020
- } else if (!activeElement) {
24021
- setTableMenuCellNode(null);
24022
- setTableMenuCellNodeElem(null);
24023
- }
24024
- }, [editor, setTableMenuCellNodeElem]);
24025
- (0, import_react152.useEffect)(() => {
24026
- return editor.registerUpdateListener(() => {
24027
- editor.getEditorState().read(() => {
24028
- $moveMenu();
24029
- });
24030
- });
24031
- });
24032
- return tableCellNode != null && tableCellNodeEl != null && tableCellMenuPortalEl != null && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24033
- TableActionMenu,
24034
- {
24035
- tableCellNode,
24036
- menuPortalEl: tableCellMenuPortalEl,
24037
- tableCellEl: tableCellNodeEl,
24038
- positioningAnchorEl
24039
- },
24040
- tableCellNode.getKey()
24041
- );
24042
- }
24043
- function TableActionMenuPlugin({ positioningAnchorEl }) {
24044
- const isEditable = (0, import_useLexicalEditable.useLexicalEditable)();
24045
- return isEditable ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24046
- TableCellActionMenuContainer,
24047
- {
24048
- menuPortalEl: positioningAnchorEl,
24049
- positioningAnchorEl
24050
- }
24051
- ) : null;
24052
- }
24053
-
24054
- // src/components/ParameterInputs/rich-text/TableCellResizerPlugin.tsx
24055
- init_emotion_jsx_shim();
24056
- var import_react153 = require("@emotion/react");
24057
- var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
24058
- var import_useLexicalEditable2 = require("@lexical/react/useLexicalEditable");
24059
- var import_table3 = require("@lexical/table");
24060
- var import_utils11 = require("@lexical/utils");
24061
- var import_lexical7 = require("lexical");
24062
- var import_react154 = require("react");
24063
- var import_react_dom3 = require("react-dom");
24064
- var import_jsx_runtime133 = require("@emotion/react/jsx-runtime");
24065
- var MIN_ROW_HEIGHT = 33;
24066
- var MIN_COLUMN_WIDTH = 50;
24067
- var tableResizer = import_react153.css`
24068
- position: absolute;
24069
- z-index: var(--z-10);
24070
- `;
24071
- var fixedGetDOMCellFromTarget = (node) => {
24072
- let currentNode = node;
24073
- while (currentNode != null) {
24074
- const nodeName = currentNode.nodeName;
24075
- if (nodeName === "TD" || nodeName === "TH") {
24076
- const cell2 = currentNode._cell;
24077
- if (cell2 === void 0) {
24078
- return {
24079
- elem: currentNode
24080
- };
24081
- }
24082
- return cell2;
24083
- }
24084
- currentNode = currentNode.parentNode;
24085
- }
24086
- return null;
24087
- };
24088
- function TableCellResizer({ editor, positioningAnchorEl }) {
24089
- const targetRef = (0, import_react154.useRef)(null);
24090
- const resizerRef = (0, import_react154.useRef)(null);
24091
- const tableRectRef = (0, import_react154.useRef)(null);
24092
- const mouseStartPosRef = (0, import_react154.useRef)(null);
24093
- const [mouseCurrentPos, updateMouseCurrentPos] = (0, import_react154.useState)(null);
24094
- const [activeCell, updateActiveCell] = (0, import_react154.useState)(null);
24095
- const [isMouseDown, updateIsMouseDown] = (0, import_react154.useState)(false);
24096
- const [draggingDirection, updateDraggingDirection] = (0, import_react154.useState)(null);
24097
- const resetState = (0, import_react154.useCallback)(() => {
24098
- updateActiveCell(null);
24099
- targetRef.current = null;
24100
- updateDraggingDirection(null);
24101
- mouseStartPosRef.current = null;
24102
- tableRectRef.current = null;
24103
- }, []);
24104
- const isMouseDownOnEvent = (event) => {
24105
- return (event.buttons & 1) === 1;
24106
- };
24107
- (0, import_react154.useEffect)(() => {
24108
- const onMouseMove = (event) => {
24109
- setTimeout(() => {
24110
- const target = event.target;
24111
- if (draggingDirection) {
24112
- updateMouseCurrentPos({
24113
- x: event.clientX,
24114
- y: event.clientY
24115
- });
24116
- return;
24117
- }
24118
- updateIsMouseDown(isMouseDownOnEvent(event));
24119
- if (resizerRef.current && resizerRef.current.contains(target)) {
24120
- return;
23743
+ updateIsMouseDown(isMouseDownOnEvent(event));
23744
+ if (resizerRef.current && resizerRef.current.contains(target)) {
23745
+ return;
24121
23746
  }
24122
23747
  if (targetRef.current !== target) {
24123
23748
  targetRef.current = target;
24124
23749
  const cell2 = fixedGetDOMCellFromTarget(target);
24125
23750
  if (cell2 && activeCell !== cell2) {
24126
23751
  editor.update(() => {
24127
- const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(cell2.elem);
23752
+ const tableCellNode = (0, import_lexical6.$getNearestNodeFromDOMNode)(cell2.elem);
24128
23753
  if (!tableCellNode) {
24129
23754
  throw new Error("TableCellResizer: Table cell node not found.");
24130
23755
  }
24131
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23756
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24132
23757
  const tableElement2 = editor.getElementByKey(tableNode.getKey());
24133
23758
  if (!tableElement2) {
24134
23759
  throw new Error("TableCellResizer: Table element not found.");
@@ -24171,25 +23796,25 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24171
23796
  }
24172
23797
  return false;
24173
23798
  };
24174
- const updateRowHeight = (0, import_react154.useCallback)(
23799
+ const updateRowHeight = (0, import_react152.useCallback)(
24175
23800
  (heightChange) => {
24176
23801
  if (!activeCell) {
24177
23802
  throw new Error("TableCellResizer: Expected active cell.");
24178
23803
  }
24179
23804
  editor.update(
24180
23805
  () => {
24181
- const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
24182
- if (!(0, import_table3.$isTableCellNode)(tableCellNode)) {
23806
+ const tableCellNode = (0, import_lexical6.$getNearestNodeFromDOMNode)(activeCell.elem);
23807
+ if (!(0, import_table2.$isTableCellNode)(tableCellNode)) {
24183
23808
  throw new Error("TableCellResizer: Table cell node not found.");
24184
23809
  }
24185
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24186
- const tableRowIndex = (0, import_table3.$getTableRowIndexFromTableCellNode)(tableCellNode);
23810
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23811
+ const tableRowIndex = (0, import_table2.$getTableRowIndexFromTableCellNode)(tableCellNode);
24187
23812
  const tableRows = tableNode.getChildren();
24188
23813
  if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
24189
23814
  throw new Error("Expected table cell to be inside of table row.");
24190
23815
  }
24191
23816
  const tableRow2 = tableRows[tableRowIndex];
24192
- if (!(0, import_table3.$isTableRowNode)(tableRow2)) {
23817
+ if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
24193
23818
  throw new Error("Expected table row");
24194
23819
  }
24195
23820
  let height = tableRow2.getHeight();
@@ -24233,19 +23858,19 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24233
23858
  }
24234
23859
  }
24235
23860
  };
24236
- const updateColumnWidth = (0, import_react154.useCallback)(
23861
+ const updateColumnWidth = (0, import_react152.useCallback)(
24237
23862
  (widthChange) => {
24238
23863
  if (!activeCell) {
24239
23864
  throw new Error("TableCellResizer: Expected active cell.");
24240
23865
  }
24241
23866
  editor.update(
24242
23867
  () => {
24243
- const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
24244
- if (!(0, import_table3.$isTableCellNode)(tableCellNode)) {
23868
+ const tableCellNode = (0, import_lexical6.$getNearestNodeFromDOMNode)(activeCell.elem);
23869
+ if (!(0, import_table2.$isTableCellNode)(tableCellNode)) {
24245
23870
  throw new Error("TableCellResizer: Table cell node not found.");
24246
23871
  }
24247
- const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
24248
- const [tableMap] = (0, import_table3.$computeTableMapSkipCellCheck)(tableNode, null, null);
23872
+ const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
23873
+ const [tableMap] = (0, import_table2.$computeTableMapSkipCellCheck)(tableNode, null, null);
24249
23874
  const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
24250
23875
  if (columnIndex === void 0) {
24251
23876
  throw new Error("TableCellResizer: Table column not found.");
@@ -24267,7 +23892,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24267
23892
  },
24268
23893
  [activeCell, editor]
24269
23894
  );
24270
- const mouseUpHandler = (0, import_react154.useCallback)(
23895
+ const mouseUpHandler = (0, import_react152.useCallback)(
24271
23896
  (direction) => {
24272
23897
  const handler = (event) => {
24273
23898
  event.preventDefault();
@@ -24280,7 +23905,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24280
23905
  if (activeCell === null) {
24281
23906
  return;
24282
23907
  }
24283
- const zoom = (0, import_utils11.calculateZoomLevel)(event.target);
23908
+ const zoom = (0, import_utils10.calculateZoomLevel)(event.target);
24284
23909
  if (isHeightChanging(direction)) {
24285
23910
  const heightChange = (event.clientY - y) / zoom;
24286
23911
  updateRowHeight(heightChange);
@@ -24296,7 +23921,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24296
23921
  },
24297
23922
  [activeCell, resetState, updateColumnWidth, updateRowHeight]
24298
23923
  );
24299
- const toggleResize = (0, import_react154.useCallback)(
23924
+ const toggleResize = (0, import_react152.useCallback)(
24300
23925
  (direction) => (event) => {
24301
23926
  event.preventDefault();
24302
23927
  event.stopPropagation();
@@ -24313,11 +23938,11 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24313
23938
  },
24314
23939
  [activeCell, mouseUpHandler]
24315
23940
  );
24316
- const getResizers = (0, import_react154.useCallback)(() => {
23941
+ const getResizers = (0, import_react152.useCallback)(() => {
24317
23942
  if (activeCell) {
24318
23943
  const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
24319
23944
  const parentRect = positioningAnchorEl.getBoundingClientRect();
24320
- const zoom = (0, import_utils11.calculateZoomLevel)(activeCell.elem);
23945
+ const zoom = (0, import_utils10.calculateZoomLevel)(activeCell.elem);
24321
23946
  const zoneWidth = 10;
24322
23947
  const styles = {
24323
23948
  bottom: {
@@ -24325,7 +23950,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24325
23950
  cursor: "row-resize",
24326
23951
  height: `${zoneWidth}px`,
24327
23952
  left: `${left - parentRect.left}px`,
24328
- top: `${top - parentRect.top + height - zoneWidth / 2}px`,
23953
+ top: `${top - parentRect.top + positioningAnchorEl.scrollTop + height - zoneWidth / 2}px`,
24329
23954
  width: `${width}px`
24330
23955
  },
24331
23956
  right: {
@@ -24333,7 +23958,7 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24333
23958
  cursor: "col-resize",
24334
23959
  height: `${height}px`,
24335
23960
  left: `${left - parentRect.left + width - zoneWidth / 2}px`,
24336
- top: `${top - parentRect.top}px`,
23961
+ top: `${top - parentRect.top + positioningAnchorEl.scrollTop}px`,
24337
23962
  width: `${zoneWidth}px`
24338
23963
  }
24339
23964
  };
@@ -24341,11 +23966,11 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24341
23966
  if (draggingDirection && mouseCurrentPos && tableRect) {
24342
23967
  if (isHeightChanging(draggingDirection)) {
24343
23968
  styles[draggingDirection].left = `${tableRect.left - parentRect.left}px`;
24344
- styles[draggingDirection].top = `${(mouseCurrentPos.y - parentRect.top) / zoom}px`;
23969
+ styles[draggingDirection].top = `${(mouseCurrentPos.y - parentRect.top + positioningAnchorEl.scrollTop) / zoom}px`;
24345
23970
  styles[draggingDirection].height = "3px";
24346
23971
  styles[draggingDirection].width = `${tableRect.width}px`;
24347
23972
  } else {
24348
- styles[draggingDirection].top = `${tableRect.top - parentRect.top}px`;
23973
+ styles[draggingDirection].top = `${tableRect.top - parentRect.top + positioningAnchorEl.scrollTop}px`;
24349
23974
  styles[draggingDirection].left = `${(mouseCurrentPos.x - parentRect.left) / zoom}px`;
24350
23975
  styles[draggingDirection].width = "3px";
24351
23976
  styles[draggingDirection].height = `${tableRect.height}px`;
@@ -24362,39 +23987,586 @@ function TableCellResizer({ editor, positioningAnchorEl }) {
24362
23987
  };
24363
23988
  }, [activeCell, draggingDirection, mouseCurrentPos, positioningAnchorEl]);
24364
23989
  const resizerStyles = getResizers();
24365
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { ref: resizerRef, children: activeCell != null && !isMouseDown && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
24366
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
23990
+ 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: [
23991
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
23992
+ "div",
23993
+ {
23994
+ css: tableResizer,
23995
+ style: resizerStyles.right || void 0,
23996
+ onMouseDown: toggleResize("right")
23997
+ }
23998
+ ),
23999
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
24367
24000
  "div",
24368
24001
  {
24369
- css: tableResizer,
24370
- style: resizerStyles.right || void 0,
24371
- onMouseDown: toggleResize("right")
24002
+ css: tableResizer,
24003
+ style: resizerStyles.bottom || void 0,
24004
+ onMouseDown: toggleResize("bottom")
24005
+ }
24006
+ )
24007
+ ] }) });
24008
+ }
24009
+ function TableCellResizerPlugin({ positioningAnchorEl }) {
24010
+ const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
24011
+ const isEditable = (0, import_useLexicalEditable2.useLexicalEditable)();
24012
+ return (0, import_react152.useMemo)(
24013
+ () => isEditable ? (0, import_react_dom3.createPortal)(
24014
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(TableCellResizer, { editor, positioningAnchorEl }),
24015
+ positioningAnchorEl
24016
+ ) : null,
24017
+ [editor, isEditable, positioningAnchorEl]
24018
+ );
24019
+ }
24020
+
24021
+ // src/components/ParameterInputs/rich-text/TableSelectionPlugin.tsx
24022
+ init_emotion_jsx_shim();
24023
+ var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
24024
+ var import_table3 = require("@lexical/table");
24025
+ var import_lexical7 = require("lexical");
24026
+ var import_react153 = require("react");
24027
+ var TableSelectionPlugin = () => {
24028
+ const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
24029
+ const [closestTableCellNode, setClosestTableCellNode] = (0, import_react153.useState)(null);
24030
+ (0, import_react153.useEffect)(() => {
24031
+ return editor.registerCommand(
24032
+ import_lexical7.SELECTION_CHANGE_COMMAND,
24033
+ () => {
24034
+ editor.read(() => {
24035
+ const selection = (0, import_lexical7.$getSelection)();
24036
+ if (!(0, import_lexical7.$isRangeSelection)(selection) || !selection.isCollapsed()) {
24037
+ setClosestTableCellNode(null);
24038
+ return false;
24039
+ }
24040
+ const tableCellNode = (0, import_table3.$findCellNode)(selection.anchor.getNode());
24041
+ if (tableCellNode === null) {
24042
+ setClosestTableCellNode(null);
24043
+ return false;
24044
+ }
24045
+ setClosestTableCellNode(tableCellNode);
24046
+ });
24047
+ return false;
24048
+ },
24049
+ import_lexical7.COMMAND_PRIORITY_NORMAL
24050
+ );
24051
+ }, [editor]);
24052
+ (0, import_react153.useEffect)(() => {
24053
+ const onControlA = (event) => {
24054
+ if (event.key === "a" && (event.ctrlKey || event.metaKey)) {
24055
+ if (!closestTableCellNode) {
24056
+ return;
24057
+ }
24058
+ event.preventDefault();
24059
+ editor.update(() => {
24060
+ const selection = closestTableCellNode.select(0, closestTableCellNode.getChildrenSize());
24061
+ (0, import_lexical7.$setSelection)(selection);
24062
+ });
24063
+ }
24064
+ };
24065
+ return editor.registerRootListener((rootElement, prevRootElement) => {
24066
+ rootElement == null ? void 0 : rootElement.addEventListener("keydown", onControlA);
24067
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("keydown", onControlA);
24068
+ });
24069
+ }, [editor, closestTableCellNode]);
24070
+ return null;
24071
+ };
24072
+ var TableSelectionPlugin_default = TableSelectionPlugin;
24073
+
24074
+ // src/components/ParameterInputs/rich-text/toolbar/RichTextToolbar.tsx
24075
+ init_emotion_jsx_shim();
24076
+ var import_react155 = require("@emotion/react");
24077
+ var import_code2 = require("@lexical/code");
24078
+ var import_list2 = require("@lexical/list");
24079
+ var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
24080
+ var import_rich_text = require("@lexical/rich-text");
24081
+ var import_selection2 = require("@lexical/selection");
24082
+ var import_table4 = require("@lexical/table");
24083
+ var import_utils11 = require("@lexical/utils");
24084
+ var import_lexical8 = require("lexical");
24085
+ var import_react156 = require("react");
24086
+
24087
+ // src/components/ParameterInputs/rich-text/toolbar/constants.ts
24088
+ init_emotion_jsx_shim();
24089
+ var FORMATS_WITH_ICON = /* @__PURE__ */ new Map([
24090
+ ["bold", "format-bold"],
24091
+ ["italic", "format-italic"],
24092
+ ["underline", "format-underline"],
24093
+ ["strikethrough", "format-strike"],
24094
+ ["code", "format-code"],
24095
+ ["superscript", "format-superscript"],
24096
+ ["subscript", "format-subscript"]
24097
+ ]);
24098
+ var HEADING_ELEMENTS = ["h1", "h2", "h3", "h4", "h5", "h6"];
24099
+ var TEXTUAL_ELEMENTS = HEADING_ELEMENTS;
24100
+
24101
+ // src/components/ParameterInputs/rich-text/toolbar/useRichTextToolbarState.ts
24102
+ init_emotion_jsx_shim();
24103
+ var import_react154 = require("react");
24104
+ var useRichTextToolbarState = ({ config }) => {
24105
+ var _a;
24106
+ const enabledBuiltInFormats = (0, import_react154.useMemo)(() => {
24107
+ return richTextBuiltInFormats.filter((format) => {
24108
+ var _a2, _b;
24109
+ return (_b = (_a2 = config == null ? void 0 : config.formatting) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(format.type);
24110
+ });
24111
+ }, [config]);
24112
+ const enabledBuiltInElements = (0, import_react154.useMemo)(() => {
24113
+ return richTextBuiltInElements.filter((element) => {
24114
+ var _a2, _b;
24115
+ return (_b = (_a2 = config == null ? void 0 : config.elements) == null ? void 0 : _a2.builtIn) == null ? void 0 : _b.includes(element.type);
24116
+ });
24117
+ }, [config]);
24118
+ const enabledBuiltInFormatsWithIcon = (0, import_react154.useMemo)(() => {
24119
+ return enabledBuiltInFormats.filter((format) => FORMATS_WITH_ICON.has(format.type));
24120
+ }, [enabledBuiltInFormats]);
24121
+ const enabledBuiltInFormatsWithoutIcon = enabledBuiltInFormats.filter(
24122
+ (format) => !FORMATS_WITH_ICON.has(format.type)
24123
+ );
24124
+ const [activeFormats, setActiveFormats] = (0, import_react154.useState)([]);
24125
+ const visibleFormatsWithIcon = (0, import_react154.useMemo)(() => {
24126
+ const visibleFormats = /* @__PURE__ */ new Set();
24127
+ activeFormats.filter((type) => FORMATS_WITH_ICON.has(type)).forEach((type) => {
24128
+ visibleFormats.add(type);
24129
+ });
24130
+ enabledBuiltInFormatsWithIcon.forEach((format) => {
24131
+ visibleFormats.add(format.type);
24132
+ });
24133
+ return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
24134
+ }, [activeFormats, enabledBuiltInFormatsWithIcon]);
24135
+ const visibleFormatsWithoutIcon = (0, import_react154.useMemo)(() => {
24136
+ const visibleFormats = /* @__PURE__ */ new Set();
24137
+ activeFormats.filter((type) => !FORMATS_WITH_ICON.has(type)).forEach((type) => {
24138
+ visibleFormats.add(type);
24139
+ });
24140
+ enabledBuiltInFormatsWithoutIcon.forEach((format) => {
24141
+ visibleFormats.add(format.type);
24142
+ });
24143
+ return richTextBuiltInFormats.filter((format) => visibleFormats.has(format.type));
24144
+ }, [activeFormats, enabledBuiltInFormatsWithoutIcon]);
24145
+ const [activeElement, setActiveElement] = (0, import_react154.useState)("paragraph");
24146
+ const enabledTextualElements = enabledBuiltInElements.filter(
24147
+ (element) => TEXTUAL_ELEMENTS.includes(element.type)
24148
+ );
24149
+ const visibleTextualElements = (0, import_react154.useMemo)(() => {
24150
+ if (!TEXTUAL_ELEMENTS.includes(activeElement)) {
24151
+ return enabledTextualElements;
24152
+ }
24153
+ return richTextBuiltInElements.filter(
24154
+ (element) => {
24155
+ var _a2, _b;
24156
+ 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);
24157
+ }
24158
+ );
24159
+ }, [activeElement, (_a = config == null ? void 0 : config.elements) == null ? void 0 : _a.builtIn, enabledTextualElements]);
24160
+ const [isLink, setIsLink] = (0, import_react154.useState)(false);
24161
+ const linkElementVisible = (0, import_react154.useMemo)(() => {
24162
+ return enabledBuiltInElements.some((element) => element.type === "link") || isLink;
24163
+ }, [isLink, enabledBuiltInElements]);
24164
+ const visibleLists = (0, import_react154.useMemo)(() => {
24165
+ return new Set(
24166
+ ["orderedList", "unorderedList"].filter(
24167
+ (type) => enabledBuiltInElements.some((element) => element.type === type) || activeElement === type
24168
+ )
24169
+ );
24170
+ }, [activeElement, enabledBuiltInElements]);
24171
+ const quoteElementVisible = (0, import_react154.useMemo)(() => {
24172
+ return enabledBuiltInElements.some((element) => element.type === "quote") || activeElement === "quote";
24173
+ }, [activeElement, enabledBuiltInElements]);
24174
+ const codeElementVisible = (0, import_react154.useMemo)(() => {
24175
+ return enabledBuiltInElements.some((element) => element.type === "code") || activeElement === "code";
24176
+ }, [activeElement, enabledBuiltInElements]);
24177
+ const tableElementVisible = (0, import_react154.useMemo)(() => {
24178
+ return enabledBuiltInElements.some((element) => element.type === "table") || activeElement === "table";
24179
+ }, [activeElement, enabledBuiltInElements]);
24180
+ const assetElementVisible = (0, import_react154.useMemo)(() => {
24181
+ return enabledBuiltInElements.some((element) => element.type === "asset") || activeElement === "asset";
24182
+ }, [activeElement, enabledBuiltInElements]);
24183
+ const visibleElementsWithIcons = (0, import_react154.useMemo)(() => {
24184
+ const visibleElements = /* @__PURE__ */ new Set();
24185
+ if (linkElementVisible) {
24186
+ visibleElements.add("link");
24187
+ }
24188
+ if (visibleLists.size > 0) {
24189
+ visibleLists.forEach((type) => {
24190
+ visibleElements.add(type);
24191
+ });
24192
+ }
24193
+ return visibleElements;
24194
+ }, [linkElementVisible, visibleLists]);
24195
+ const visibleInsertElementsWithIcons = (0, import_react154.useMemo)(() => {
24196
+ const visibleElements = /* @__PURE__ */ new Set();
24197
+ if (quoteElementVisible) {
24198
+ visibleElements.add("quote");
24199
+ }
24200
+ if (codeElementVisible) {
24201
+ visibleElements.add("code");
24202
+ }
24203
+ if (tableElementVisible) {
24204
+ visibleElements.add("table");
24205
+ }
24206
+ if (assetElementVisible) {
24207
+ visibleElements.add("asset");
24208
+ }
24209
+ return visibleElements;
24210
+ }, [codeElementVisible, quoteElementVisible, tableElementVisible, assetElementVisible]);
24211
+ return {
24212
+ activeFormats,
24213
+ setActiveFormats,
24214
+ activeElement,
24215
+ setActiveElement,
24216
+ visibleFormatsWithIcon,
24217
+ visibleFormatsWithoutIcon,
24218
+ visibleTextualElements,
24219
+ isLink,
24220
+ setIsLink,
24221
+ linkElementVisible,
24222
+ visibleLists,
24223
+ quoteElementVisible,
24224
+ codeElementVisible,
24225
+ tableElementVisible,
24226
+ assetElementVisible,
24227
+ visibleElementsWithIcons,
24228
+ visibleInsertElementsWithIcons
24229
+ };
24230
+ };
24231
+
24232
+ // src/components/ParameterInputs/rich-text/toolbar/RichTextToolbar.tsx
24233
+ var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
24234
+ var toolbar = import_react155.css`
24235
+ ${scrollbarStyles}
24236
+ background: var(--gray-50);
24237
+ border-radius: var(--rounded-base);
24238
+ display: flex;
24239
+ /* We add 1px because we use a 1px wide separator */
24240
+ gap: calc(var(--spacing-sm) + 1px);
24241
+ margin: 0 0 calc(var(--spacing-sm) + var(--spacing-xs)) 0;
24242
+ overflow: auto;
24243
+ padding: var(--spacing-sm);
24244
+ position: sticky;
24245
+ top: calc(var(--spacing-sm) * -2);
24246
+ z-index: 10;
24247
+ `;
24248
+ var toolbarGroup = import_react155.css`
24249
+ display: flex;
24250
+ flex-shrink: 0;
24251
+ gap: var(--spacing-xs);
24252
+ position: relative;
24253
+
24254
+ &:not(:first-child)::before {
24255
+ background-color: var(--gray-300);
24256
+ content: '';
24257
+ display: block;
24258
+ height: 24px;
24259
+ left: calc(var(--spacing-xs) * -1);
24260
+ position: absolute;
24261
+ top: 4px;
24262
+ width: 1px;
24263
+ }
24264
+ `;
24265
+ var richTextToolbarButton = import_react155.css`
24266
+ align-items: center;
24267
+ appearance: none;
24268
+ border: 0;
24269
+ border-radius: var(--rounded-sm);
24270
+ box-shadow: none;
24271
+ color: var(--gray-900);
24272
+ display: flex;
24273
+ flex-shrink: 0;
24274
+ height: 32px;
24275
+ justify-content: center;
24276
+ min-width: 32px;
24277
+ padding: 0 var(--spacing-sm);
24278
+ `;
24279
+ var richTextToolbarButtonActive = import_react155.css`
24280
+ background: var(--gray-200);
24281
+ `;
24282
+ var textStyleButton = import_react155.css`
24283
+ justify-content: space-between;
24284
+ min-width: 7rem;
24285
+ `;
24286
+ var toolbarIcon = import_react155.css`
24287
+ color: inherit;
24288
+ `;
24289
+ var toolbarChevron = import_react155.css`
24290
+ margin-left: var(--spacing-xs);
24291
+ `;
24292
+ var RichTextToolbarIcon = ({ icon }) => {
24293
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon, css: toolbarIcon, size: "1rem" });
24294
+ };
24295
+ var RichTextToolbar = ({ config, customControls, onInsertTable, onInsertAsset }) => {
24296
+ const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
24297
+ const {
24298
+ activeElement,
24299
+ setActiveElement,
24300
+ activeFormats,
24301
+ setActiveFormats,
24302
+ visibleFormatsWithIcon,
24303
+ visibleFormatsWithoutIcon,
24304
+ visibleTextualElements,
24305
+ isLink,
24306
+ setIsLink,
24307
+ linkElementVisible,
24308
+ visibleLists,
24309
+ codeElementVisible,
24310
+ quoteElementVisible,
24311
+ visibleElementsWithIcons,
24312
+ visibleInsertElementsWithIcons,
24313
+ tableElementVisible,
24314
+ assetElementVisible
24315
+ } = useRichTextToolbarState({ config });
24316
+ const onSelectElement = (type) => {
24317
+ if (activeElement === type) {
24318
+ return;
24319
+ }
24320
+ editor.focus(() => {
24321
+ editor.update(() => {
24322
+ const selection = (0, import_lexical8.$getSelection)();
24323
+ if (HEADING_ELEMENTS.includes(type)) {
24324
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createHeadingNode)(type));
24325
+ } else if (type === "paragraph") {
24326
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_lexical8.$createParagraphNode)());
24327
+ } else if (type === "quote") {
24328
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createQuoteNode)());
24329
+ } else if (type === "code") {
24330
+ (0, import_selection2.$setBlocksType)(selection, () => (0, import_code2.$createCodeNode)());
24331
+ } else if (type === "table" && onInsertTable) {
24332
+ onInsertTable().then((dimensions) => {
24333
+ if (!dimensions) {
24334
+ return;
24335
+ }
24336
+ const { rows, columns } = dimensions;
24337
+ editor.focus(() => {
24338
+ editor.update(() => {
24339
+ (0, import_lexical8.$insertNodes)([(0, import_table4.$createTableNodeWithDimensions)(rows, columns, false)]);
24340
+ });
24341
+ });
24342
+ });
24343
+ } else if (type === "asset" && onInsertAsset) {
24344
+ onInsertAsset();
24345
+ }
24346
+ });
24347
+ });
24348
+ };
24349
+ const updateToolbar = (0, import_react156.useCallback)(() => {
24350
+ const selection = (0, import_lexical8.$getSelection)();
24351
+ if (!(0, import_lexical8.$isRangeSelection)(selection)) {
24352
+ return;
24353
+ }
24354
+ const newActiveFormats = [];
24355
+ for (const format of richTextBuiltInFormats) {
24356
+ if (selection.hasFormat(format.type)) {
24357
+ newActiveFormats.push(format.type);
24358
+ }
24359
+ }
24360
+ setActiveFormats(newActiveFormats);
24361
+ const anchorNode = selection.anchor.getNode();
24362
+ let element = anchorNode.getKey() === "root" ? anchorNode : (0, import_utils11.$findMatchingParent)(anchorNode, (e) => {
24363
+ const parent = e.getParent();
24364
+ return parent !== null && (0, import_lexical8.$isRootOrShadowRoot)(parent);
24365
+ });
24366
+ if (element === null) {
24367
+ element = anchorNode.getTopLevelElementOrThrow();
24368
+ }
24369
+ const elementKey = element.getKey();
24370
+ const elementDOM = editor.getElementByKey(elementKey);
24371
+ if (elementDOM !== null) {
24372
+ if ((0, import_list2.$isListNode)(element)) {
24373
+ const parentList = (0, import_utils11.$getNearestNodeOfType)(anchorNode, import_list2.ListNode);
24374
+ const type = parentList ? parentList.getListType() : element.getListType();
24375
+ setActiveElement(type === "bullet" ? "unorderedList" : "orderedList");
24376
+ } else {
24377
+ const type = (0, import_rich_text.$isHeadingNode)(element) ? element.getTag() : element.getType();
24378
+ setActiveElement(type);
24379
+ }
24380
+ }
24381
+ const node = getSelectedNode(selection);
24382
+ if (getLinkAncestor(node) !== null) {
24383
+ setIsLink(true);
24384
+ } else {
24385
+ setIsLink(false);
24386
+ }
24387
+ }, [editor, setActiveElement, setActiveFormats, setIsLink]);
24388
+ (0, import_react156.useEffect)(() => {
24389
+ return editor.registerCommand(
24390
+ import_lexical8.SELECTION_CHANGE_COMMAND,
24391
+ (_payload) => {
24392
+ updateToolbar();
24393
+ return false;
24394
+ },
24395
+ import_lexical8.COMMAND_PRIORITY_CRITICAL
24396
+ );
24397
+ }, [editor, updateToolbar]);
24398
+ (0, import_react156.useEffect)(() => {
24399
+ return editor.registerUpdateListener(({ editorState }) => {
24400
+ requestAnimationFrame(() => {
24401
+ editorState.read(() => {
24402
+ updateToolbar();
24403
+ });
24404
+ });
24405
+ });
24406
+ }, [editor, updateToolbar]);
24407
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbar, children: [
24408
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
24409
+ Menu,
24410
+ {
24411
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("button", { css: [richTextToolbarButton, textStyleButton], title: "Text styles", children: [
24412
+ visibleTextualElements.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
24413
+ " ",
24414
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
24415
+ ] }),
24416
+ placement: "bottom-start",
24417
+ children: [
24418
+ [
24419
+ {
24420
+ label: "Normal",
24421
+ type: "paragraph"
24422
+ },
24423
+ ...visibleTextualElements
24424
+ ].map((element) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24425
+ MenuItem,
24426
+ {
24427
+ onClick: () => {
24428
+ onSelectElement(element.type);
24429
+ },
24430
+ children: element.label
24431
+ },
24432
+ element.type
24433
+ )),
24434
+ visibleTextualElements.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MenuItem, { disabled: true, children: "Alternative text styles are not available" }) : null
24435
+ ]
24372
24436
  }
24373
24437
  ),
24374
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24375
- "div",
24438
+ visibleFormatsWithIcon.length > 0 || visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbarGroup, children: [
24439
+ visibleFormatsWithIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: format.label, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24440
+ "button",
24441
+ {
24442
+ onClick: () => {
24443
+ editor.dispatchCommand(import_lexical8.FORMAT_TEXT_COMMAND, format.type);
24444
+ },
24445
+ css: [
24446
+ richTextToolbarButton,
24447
+ activeFormats.includes(format.type) ? richTextToolbarButtonActive : null
24448
+ ],
24449
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: FORMATS_WITH_ICON.get(format.type) })
24450
+ }
24451
+ ) }, format.type)),
24452
+ visibleFormatsWithoutIcon.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24453
+ Menu,
24454
+ {
24455
+ menuLabel: "Alternative text styles",
24456
+ 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 }) }),
24457
+ placement: "bottom-start",
24458
+ children: visibleFormatsWithoutIcon.map((format) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24459
+ MenuItem,
24460
+ {
24461
+ onClick: () => {
24462
+ editor.dispatchCommand(import_lexical8.FORMAT_TEXT_COMMAND, format.type);
24463
+ },
24464
+ children: format.label
24465
+ },
24466
+ format.type
24467
+ ))
24468
+ }
24469
+ ) : null
24470
+ ] }) : null,
24471
+ visibleElementsWithIcons.size > 0 || customControls ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { css: toolbarGroup, children: [
24472
+ linkElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24473
+ "button",
24474
+ {
24475
+ onClick: () => {
24476
+ isLink ? editor.dispatchCommand(REMOVE_LINK_NODE_COMMAND, {}) : editor.dispatchCommand(OPEN_LINK_NODE_MODAL_COMMAND, {});
24477
+ },
24478
+ css: [richTextToolbarButton, isLink ? richTextToolbarButtonActive : null],
24479
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "link" })
24480
+ }
24481
+ ) }) : null,
24482
+ visibleLists.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [
24483
+ visibleLists.has("unorderedList") ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Bullet List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24484
+ "button",
24485
+ {
24486
+ onClick: () => {
24487
+ activeElement === "unorderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_UNORDERED_LIST_COMMAND, void 0);
24488
+ },
24489
+ css: [
24490
+ richTextToolbarButton,
24491
+ activeElement === "unorderedList" ? richTextToolbarButtonActive : null
24492
+ ],
24493
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "layout-list" })
24494
+ }
24495
+ ) }) : null,
24496
+ visibleLists.has("orderedList") ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Tooltip, { title: "Ordered List", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24497
+ "button",
24498
+ {
24499
+ onClick: () => {
24500
+ activeElement === "orderedList" ? editor.dispatchCommand(import_list2.REMOVE_LIST_COMMAND, void 0) : editor.dispatchCommand(import_list2.INSERT_ORDERED_LIST_COMMAND, void 0);
24501
+ },
24502
+ css: [
24503
+ richTextToolbarButton,
24504
+ activeElement === "orderedList" ? richTextToolbarButtonActive : null
24505
+ ],
24506
+ children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RichTextToolbarIcon, { icon: "layout-list-numbered" })
24507
+ }
24508
+ ) }) : null
24509
+ ] }) : null,
24510
+ customControls ? customControls : null
24511
+ ] }) : null,
24512
+ visibleInsertElementsWithIcons.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { css: toolbarGroup, children: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
24513
+ Menu,
24376
24514
  {
24377
- css: tableResizer,
24378
- style: resizerStyles.bottom || void 0,
24379
- onMouseDown: toggleResize("bottom")
24515
+ menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("button", { css: richTextToolbarButton, title: "Insert block element", children: [
24516
+ "Insert",
24517
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
24518
+ ] }),
24519
+ placement: "bottom-start",
24520
+ children: [
24521
+ quoteElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24522
+ MenuItem,
24523
+ {
24524
+ onClick: () => {
24525
+ onSelectElement("quote");
24526
+ },
24527
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "quote", iconColor: "currentColor" }),
24528
+ children: "Quote"
24529
+ }
24530
+ ) : null,
24531
+ codeElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24532
+ MenuItem,
24533
+ {
24534
+ onClick: () => {
24535
+ onSelectElement("code");
24536
+ },
24537
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "code-slash", iconColor: "currentColor" }),
24538
+ children: "Code"
24539
+ }
24540
+ ) : null,
24541
+ tableElementVisible && onInsertTable !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24542
+ MenuItem,
24543
+ {
24544
+ onClick: () => {
24545
+ onSelectElement("table");
24546
+ },
24547
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "view-grid", iconColor: "currentColor" }),
24548
+ children: "Table"
24549
+ }
24550
+ ) : null,
24551
+ assetElementVisible && onInsertAsset !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
24552
+ MenuItem,
24553
+ {
24554
+ onClick: () => {
24555
+ onSelectElement("asset");
24556
+ },
24557
+ icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { icon: "image", iconColor: "currentColor" }),
24558
+ children: "Asset"
24559
+ }
24560
+ ) : null
24561
+ ]
24380
24562
  }
24381
- )
24382
- ] }) });
24383
- }
24384
- function TableCellResizerPlugin({ positioningAnchorEl }) {
24385
- const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
24386
- const isEditable = (0, import_useLexicalEditable2.useLexicalEditable)();
24387
- return (0, import_react154.useMemo)(
24388
- () => isEditable ? (0, import_react_dom3.createPortal)(
24389
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableCellResizer, { editor, positioningAnchorEl }),
24390
- positioningAnchorEl
24391
- ) : null,
24392
- [editor, isEditable, positioningAnchorEl]
24393
- );
24394
- }
24563
+ ) }) : null
24564
+ ] });
24565
+ };
24566
+ var RichTextToolbar_default = RichTextToolbar;
24395
24567
 
24396
24568
  // src/components/ParameterInputs/ParameterRichText.tsx
24397
- var import_jsx_runtime134 = require("@emotion/react/jsx-runtime");
24569
+ var import_jsx_runtime133 = require("@emotion/react/jsx-runtime");
24398
24570
  var ParameterRichText = ({
24399
24571
  label,
24400
24572
  labelLeadingIcon,
@@ -24420,9 +24592,10 @@ var ParameterRichText = ({
24420
24592
  variables,
24421
24593
  customControls,
24422
24594
  onInsertTable,
24595
+ onInsertAsset,
24423
24596
  minimalInteractivity
24424
24597
  }) => {
24425
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
24598
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
24426
24599
  ParameterShell,
24427
24600
  {
24428
24601
  "data-testid": "parameter-richtext",
@@ -24436,7 +24609,7 @@ var ParameterRichText = ({
24436
24609
  captionTestId,
24437
24610
  menuItems,
24438
24611
  children: [
24439
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
24612
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24440
24613
  ParameterRichTextInner,
24441
24614
  {
24442
24615
  value,
@@ -24453,27 +24626,78 @@ var ParameterRichText = ({
24453
24626
  variables,
24454
24627
  customControls,
24455
24628
  onInsertTable,
24629
+ onInsertAsset,
24456
24630
  minimalInteractivity,
24457
24631
  children
24458
24632
  }
24459
24633
  ),
24460
- menuItems ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterMenuButton, { label: `${label} menu`, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_jsx_runtime134.Fragment, { children: menuItems }) }) : null
24634
+ menuItems ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ParameterMenuButton, { label: `${label} menu`, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_jsx_runtime133.Fragment, { children: menuItems }) }) : null
24461
24635
  ]
24462
24636
  }
24463
24637
  );
24464
24638
  };
24465
- var editorWrapper = import_react155.css`
24639
+ var editorContainerWrapper = import_react157.css`
24640
+ position: relative;
24641
+
24642
+ &::before {
24643
+ background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 96.12%);
24644
+ bottom: 1px;
24645
+ content: '';
24646
+ display: block;
24647
+ height: 30px;
24648
+ left: var(--spacing-sm);
24649
+ pointer-events: none;
24650
+ position: absolute;
24651
+ right: var(--spacing-sm);
24652
+ z-index: 2;
24653
+ }
24654
+ `;
24655
+ var editorWrapper = import_react157.css`
24466
24656
  display: flex;
24467
24657
  flex-flow: column;
24468
24658
  flex-grow: 1;
24469
24659
  `;
24470
- var editorContainer = import_react155.css`
24660
+ var editorContainer = import_react157.css`
24661
+ ${scrollbarStyles}
24662
+ background: var(--white);
24663
+ border-radius: var(--rounded-sm);
24664
+ border: 1px solid var(--gray-200);
24665
+ color: var(--gray-900);
24471
24666
  display: flex;
24472
24667
  flex-flow: column;
24473
24668
  flex-grow: 1;
24669
+ font-size: var(--fs-base);
24670
+ height: max-content;
24671
+ line-height: 1.2;
24672
+ max-height: 300px;
24673
+ min-height: 50px;
24674
+ overflow-y: auto;
24675
+ padding: var(--spacing-sm);
24474
24676
  position: relative;
24677
+ resize: vertical;
24678
+
24679
+ &:focus,
24680
+ &:focus-within {
24681
+ border-radius: var(--rounded-sm);
24682
+ box-shadow: var(--elevation-100);
24683
+ border: 1px solid var(--accent-dark-hover);
24684
+ outline: none;
24685
+ }
24686
+
24687
+ &[style*='height:'] {
24688
+ min-height: 50px;
24689
+ max-height: unset;
24690
+ }
24691
+ `;
24692
+ var editorContainerOverflowWrapper = import_react157.css`
24693
+ overflow: hidden;
24694
+ pointer-events: none;
24695
+
24696
+ & > * {
24697
+ pointer-events: auto;
24698
+ }
24475
24699
  `;
24476
- var editorPlaceholder = import_react155.css`
24700
+ var editorPlaceholder = import_react157.css`
24477
24701
  color: var(--gray-500);
24478
24702
  font-style: italic;
24479
24703
  /* 1px is added to make sure caret is clearly visible when field is focused
@@ -24484,22 +24708,12 @@ var editorPlaceholder = import_react155.css`
24484
24708
  top: var(--spacing-sm);
24485
24709
  user-select: none;
24486
24710
  `;
24487
- var editorInput = import_react155.css`
24488
- background: var(--white);
24489
- border: 1px solid var(--gray-200);
24490
- border-radius: var(--rounded-sm);
24491
- color: var(--gray-900);
24711
+ var editorInput = import_react157.css`
24712
+ min-height: 100%;
24492
24713
  flex-grow: 1;
24493
- font-size: var(--fs-base);
24494
- line-height: 1.2;
24495
- min-height: 2rem;
24496
- padding: var(--spacing-sm);
24497
24714
 
24498
24715
  &:focus,
24499
24716
  &:focus-within {
24500
- border-radius: var(--rounded-sm);
24501
- box-shadow: var(--elevation-100);
24502
- border: 1px solid var(--accent-dark-hover);
24503
24717
  outline: none;
24504
24718
  }
24505
24719
  `;
@@ -24519,6 +24733,7 @@ var ParameterRichTextInner = ({
24519
24733
  variables,
24520
24734
  customControls,
24521
24735
  onInsertTable,
24736
+ onInsertAsset,
24522
24737
  minimalInteractivity
24523
24738
  }) => {
24524
24739
  const lexicalConfig = {
@@ -24533,11 +24748,11 @@ var ParameterRichTextInner = ({
24533
24748
  LinkNode,
24534
24749
  import_rich_text2.HeadingNode,
24535
24750
  import_rich_text2.QuoteNode,
24536
- import_lexical8.ParagraphNode,
24751
+ import_lexical9.ParagraphNode,
24537
24752
  CustomCodeNode,
24538
- import_table4.TableNode,
24539
- import_table4.TableCellNode,
24540
- import_table4.TableRowNode,
24753
+ import_table5.TableNode,
24754
+ import_table5.TableCellNode,
24755
+ import_table5.TableRowNode,
24541
24756
  ...customNodes != null ? customNodes : []
24542
24757
  ],
24543
24758
  theme: {
@@ -24577,8 +24792,8 @@ var ParameterRichTextInner = ({
24577
24792
  },
24578
24793
  editable: !readOnly
24579
24794
  };
24580
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, { children: [
24581
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { css: [editorWrapper], className: editorWrapperClassName, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalComposer.LexicalComposer, { initialConfig: lexicalConfig, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
24795
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
24796
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { css: [editorWrapper], className: editorWrapperClassName, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalComposer.LexicalComposer, { initialConfig: lexicalConfig, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24582
24797
  RichText,
24583
24798
  {
24584
24799
  onChange,
@@ -24591,6 +24806,7 @@ var ParameterRichTextInner = ({
24591
24806
  variables,
24592
24807
  customControls,
24593
24808
  onInsertTable,
24809
+ onInsertAsset,
24594
24810
  minimalInteractivity,
24595
24811
  children
24596
24812
  }
@@ -24619,15 +24835,16 @@ var RichText = ({
24619
24835
  variables,
24620
24836
  customControls,
24621
24837
  onInsertTable,
24838
+ onInsertAsset,
24622
24839
  minimalInteractivity
24623
24840
  }) => {
24624
- const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
24625
- (0, import_react156.useEffect)(() => {
24841
+ const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
24842
+ (0, import_react158.useEffect)(() => {
24626
24843
  if (onRichTextInit) {
24627
24844
  onRichTextInit(editor);
24628
24845
  }
24629
24846
  }, [editor, onRichTextInit]);
24630
- (0, import_react156.useEffect)(() => {
24847
+ (0, import_react158.useEffect)(() => {
24631
24848
  const removeUpdateListener = editor.registerUpdateListener(({ editorState, prevEditorState, tags }) => {
24632
24849
  requestAnimationFrame(() => {
24633
24850
  if (!(0, import_fast_equals2.deepEqual)(editorState.toJSON(), prevEditorState.toJSON())) {
@@ -24639,73 +24856,96 @@ var RichText = ({
24639
24856
  removeUpdateListener();
24640
24857
  };
24641
24858
  }, [editor, onChange]);
24642
- (0, import_react156.useEffect)(() => {
24859
+ (0, import_react158.useEffect)(() => {
24643
24860
  editor.setEditable(!readOnly);
24644
24861
  }, [editor, readOnly]);
24645
- const [editorContainerRef, setEditorContainerRef] = (0, import_react156.useState)(null);
24646
- const onRef = (_editorContainerRef) => {
24862
+ const [editorContainerRef, setEditorContainerRef] = (0, import_react158.useState)(null);
24863
+ const onEditorContainerRef = (_editorContainerRef) => {
24647
24864
  if (_editorContainerRef !== null) {
24648
24865
  setEditorContainerRef(_editorContainerRef);
24649
24866
  }
24650
24867
  };
24651
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, { children: [
24652
- readOnly || minimalInteractivity ? null : /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RichTextToolbar_default, { config, customControls, onInsertTable }),
24653
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
24654
- "div",
24868
+ const [portalContainerRef, setPortalContainerRef] = (0, import_react158.useState)(null);
24869
+ const onPortalContainerRef = (_portalContainerRef) => {
24870
+ if (_portalContainerRef !== null) {
24871
+ setPortalContainerRef(_portalContainerRef);
24872
+ }
24873
+ };
24874
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
24875
+ readOnly || minimalInteractivity ? null : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24876
+ RichTextToolbar_default,
24655
24877
  {
24656
- css: editorContainer,
24657
- className: editorInputWrapperClassName,
24658
- ref: onRef,
24659
- "data-testid": "value-container",
24660
- children: [
24661
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
24662
- import_LexicalRichTextPlugin.RichTextPlugin,
24663
- {
24664
- contentEditable: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalContentEditable.ContentEditable, { css: editorInput, className: editorInputClassName }),
24665
- placeholder: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { css: editorPlaceholder, children: readOnly ? "empty" : "start editing..." }),
24666
- ErrorBoundary: import_LexicalErrorBoundary.default
24667
- }
24668
- ),
24669
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalListPlugin.ListPlugin, {}),
24670
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalTablePlugin.TablePlugin, {}),
24671
- editorContainerRef && !minimalInteractivity ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(TableActionMenuPlugin, { positioningAnchorEl: editorContainerRef }) : null,
24672
- editorContainerRef && !minimalInteractivity ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(TableCellResizerPlugin, { positioningAnchorEl: editorContainerRef }) : null,
24673
- readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalHistoryPlugin.HistoryPlugin, {}),
24674
- editorContainerRef ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
24675
- LinkNodePlugin,
24676
- {
24677
- onConnectLink: onConnectLink ? onConnectLink : () => Promise.resolve(),
24678
- getBoundPath: (variables == null ? void 0 : variables.bindVariables) ? (path) => {
24679
- var _a, _b;
24680
- return (_b = (_a = variables.bindVariables) == null ? void 0 : _a.call(variables, path)) != null ? _b : path;
24681
- } : void 0,
24682
- positioningAnchorEl: editorContainerRef
24683
- }
24684
- ) : null,
24685
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ListIndentPlugin, { maxDepth: 4 }),
24686
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(DisableStylesPlugin, {}),
24687
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_LexicalMarkdownShortcutPlugin.MarkdownShortcutPlugin, { transformers: MARKDOWN_TRANSFORMERS }),
24688
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_jsx_runtime134.Fragment, { children })
24689
- ]
24878
+ config,
24879
+ customControls,
24880
+ onInsertTable,
24881
+ onInsertAsset
24690
24882
  }
24691
- )
24883
+ ),
24884
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { css: editorContainerWrapper, ref: onPortalContainerRef, children: [
24885
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
24886
+ "div",
24887
+ {
24888
+ css: editorContainer,
24889
+ className: editorInputWrapperClassName,
24890
+ ref: onEditorContainerRef,
24891
+ "data-testid": "value-container",
24892
+ children: [
24893
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24894
+ import_LexicalRichTextPlugin.RichTextPlugin,
24895
+ {
24896
+ contentEditable: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalContentEditable.ContentEditable, { css: editorInput, className: editorInputClassName }),
24897
+ placeholder: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { css: editorPlaceholder, children: readOnly ? "empty" : "start editing..." }),
24898
+ ErrorBoundary: import_LexicalErrorBoundary.default
24899
+ }
24900
+ ),
24901
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalListPlugin.ListPlugin, {}),
24902
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ListIndentPlugin, { maxDepth: 4 }),
24903
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalTablePlugin.TablePlugin, { hasCellMerge: false, hasCellBackgroundColor: false }),
24904
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { css: editorContainerOverflowWrapper, children: editorContainerRef && portalContainerRef && !minimalInteractivity ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24905
+ TableActionMenuPlugin,
24906
+ {
24907
+ positioningAnchorEl: editorContainerRef,
24908
+ menuPortalEl: portalContainerRef
24909
+ }
24910
+ ) : null }),
24911
+ editorContainerRef && !minimalInteractivity ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableCellResizerPlugin, { positioningAnchorEl: editorContainerRef }) : null,
24912
+ readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalHistoryPlugin.HistoryPlugin, {}),
24913
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DisableStylesPlugin, {}),
24914
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalMarkdownShortcutPlugin.MarkdownShortcutPlugin, { transformers: MARKDOWN_TRANSFORMERS })
24915
+ ]
24916
+ }
24917
+ ),
24918
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_jsx_runtime133.Fragment, { children }),
24919
+ editorContainerRef ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
24920
+ LinkNodePlugin,
24921
+ {
24922
+ onConnectLink: onConnectLink ? onConnectLink : () => Promise.resolve(),
24923
+ getBoundPath: (variables == null ? void 0 : variables.bindVariables) ? (path) => {
24924
+ var _a, _b;
24925
+ return (_b = (_a = variables.bindVariables) == null ? void 0 : _a.call(variables, path)) != null ? _b : path;
24926
+ } : void 0,
24927
+ positioningAnchorEl: editorContainerRef
24928
+ }
24929
+ ) : null,
24930
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableSelectionPlugin_default, {})
24931
+ ] })
24692
24932
  ] });
24693
24933
  };
24694
24934
 
24695
24935
  // src/components/ParameterInputs/ParameterSelect.tsx
24696
24936
  init_emotion_jsx_shim();
24697
- var import_react157 = require("react");
24698
- var import_jsx_runtime135 = require("@emotion/react/jsx-runtime");
24699
- var ParameterSelect = (0, import_react157.forwardRef)(
24937
+ var import_react159 = require("react");
24938
+ var import_jsx_runtime134 = require("@emotion/react/jsx-runtime");
24939
+ var ParameterSelect = (0, import_react159.forwardRef)(
24700
24940
  ({ defaultOption, options, ...props }, ref) => {
24701
24941
  const { shellProps, innerProps } = extractParameterProps(props);
24702
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterSelectInner, { options, defaultOption, ...innerProps, ref }) });
24942
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterSelectInner, { options, defaultOption, ...innerProps, ref }) });
24703
24943
  }
24704
24944
  );
24705
- var ParameterSelectInner = (0, import_react157.forwardRef)(
24945
+ var ParameterSelectInner = (0, import_react159.forwardRef)(
24706
24946
  ({ defaultOption, options, ...props }, ref) => {
24707
24947
  const { id, label, hiddenLabel } = useParameterShell();
24708
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
24948
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
24709
24949
  "select",
24710
24950
  {
24711
24951
  css: [input3, selectInput],
@@ -24714,10 +24954,10 @@ var ParameterSelectInner = (0, import_react157.forwardRef)(
24714
24954
  ref,
24715
24955
  ...props,
24716
24956
  children: [
24717
- defaultOption ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("option", { value: "", children: defaultOption }) : null,
24957
+ defaultOption ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("option", { value: "", children: defaultOption }) : null,
24718
24958
  options.map((option) => {
24719
24959
  var _a;
24720
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("option", { value: (_a = option.value) != null ? _a : option.label, children: option.label }, option.label);
24960
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("option", { value: (_a = option.value) != null ? _a : option.label, children: option.label }, option.label);
24721
24961
  })
24722
24962
  ]
24723
24963
  }
@@ -24727,15 +24967,15 @@ var ParameterSelectInner = (0, import_react157.forwardRef)(
24727
24967
 
24728
24968
  // src/components/ParameterInputs/ParameterTextarea.tsx
24729
24969
  init_emotion_jsx_shim();
24730
- var import_react158 = require("react");
24731
- var import_jsx_runtime136 = require("@emotion/react/jsx-runtime");
24732
- var ParameterTextarea = (0, import_react158.forwardRef)((props, ref) => {
24970
+ var import_react160 = require("react");
24971
+ var import_jsx_runtime135 = require("@emotion/react/jsx-runtime");
24972
+ var ParameterTextarea = (0, import_react160.forwardRef)((props, ref) => {
24733
24973
  const { shellProps, innerProps } = extractParameterProps(props);
24734
- return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterShell, { "data-testid": "parameter-textarea", ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterTextareaInner, { ref, ...innerProps }) });
24974
+ return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterShell, { "data-testid": "parameter-textarea", ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterTextareaInner, { ref, ...innerProps }) });
24735
24975
  });
24736
- var ParameterTextareaInner = (0, import_react158.forwardRef)(({ ...props }, ref) => {
24976
+ var ParameterTextareaInner = (0, import_react160.forwardRef)(({ ...props }, ref) => {
24737
24977
  const { id, label, hiddenLabel } = useParameterShell();
24738
- return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
24978
+ return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
24739
24979
  "textarea",
24740
24980
  {
24741
24981
  css: [input3, textarea2],
@@ -24749,18 +24989,18 @@ var ParameterTextareaInner = (0, import_react158.forwardRef)(({ ...props }, ref)
24749
24989
 
24750
24990
  // src/components/ParameterInputs/ParameterToggle.tsx
24751
24991
  init_emotion_jsx_shim();
24752
- var import_react159 = require("react");
24753
- var import_jsx_runtime137 = require("@emotion/react/jsx-runtime");
24754
- var ParameterToggle = (0, import_react159.forwardRef)((props, ref) => {
24992
+ var import_react161 = require("react");
24993
+ var import_jsx_runtime136 = require("@emotion/react/jsx-runtime");
24994
+ var ParameterToggle = (0, import_react161.forwardRef)((props, ref) => {
24755
24995
  const { shellProps, innerProps } = extractParameterProps(props);
24756
- return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(ParameterToggleInner, { ref, ...innerProps }) });
24996
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterToggleInner, { ref, ...innerProps }) });
24757
24997
  });
24758
- var ParameterToggleInner = (0, import_react159.forwardRef)(
24998
+ var ParameterToggleInner = (0, import_react161.forwardRef)(
24759
24999
  ({ children, ...props }, ref) => {
24760
25000
  const { id, label } = useParameterShell();
24761
- return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("label", { css: inputToggleLabel2, children: [
24762
- /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("input", { css: toggleInput2, type: props.type, id, ref, ...props }),
24763
- /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { css: inlineLabel2, children: label }),
25001
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("label", { css: inputToggleLabel2, children: [
25002
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("input", { css: toggleInput2, type: props.type, id, ref, ...props }),
25003
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { css: inlineLabel2, children: label }),
24764
25004
  children
24765
25005
  ] });
24766
25006
  }
@@ -24771,8 +25011,8 @@ init_emotion_jsx_shim();
24771
25011
 
24772
25012
  // src/components/ProgressBar/ProgressBar.styles.ts
24773
25013
  init_emotion_jsx_shim();
24774
- var import_react160 = require("@emotion/react");
24775
- var container3 = import_react160.css`
25014
+ var import_react162 = require("@emotion/react");
25015
+ var container3 = import_react162.css`
24776
25016
  background: var(--gray-50);
24777
25017
  margin-block: var(--spacing-sm);
24778
25018
  position: relative;
@@ -24782,17 +25022,17 @@ var container3 = import_react160.css`
24782
25022
  border: solid 1px var(--gray-300);
24783
25023
  `;
24784
25024
  var themeMap = {
24785
- primary: import_react160.css`
25025
+ primary: import_react162.css`
24786
25026
  --progress-color: var(--accent-light);
24787
25027
  `,
24788
- secondary: import_react160.css`
25028
+ secondary: import_react162.css`
24789
25029
  --progress-color: var(--accent-alt-light);
24790
25030
  `,
24791
- destructive: import_react160.css`
25031
+ destructive: import_react162.css`
24792
25032
  --progress-color: var(--brand-secondary-5);
24793
25033
  `
24794
25034
  };
24795
- var slidingBackgroundPosition = import_react160.keyframes`
25035
+ var slidingBackgroundPosition = import_react162.keyframes`
24796
25036
  from {
24797
25037
  background-position: 0 0;
24798
25038
  }
@@ -24800,10 +25040,10 @@ var slidingBackgroundPosition = import_react160.keyframes`
24800
25040
  background-position: 64px 0;
24801
25041
  }
24802
25042
  `;
24803
- var determinate = import_react160.css`
25043
+ var determinate = import_react162.css`
24804
25044
  background-color: var(--progress-color);
24805
25045
  `;
24806
- var indeterminate = import_react160.css`
25046
+ var indeterminate = import_react162.css`
24807
25047
  background-image: linear-gradient(
24808
25048
  45deg,
24809
25049
  var(--progress-color) 25%,
@@ -24817,7 +25057,7 @@ var indeterminate = import_react160.css`
24817
25057
  background-size: 64px 64px;
24818
25058
  animation: ${slidingBackgroundPosition} 1s linear infinite;
24819
25059
  `;
24820
- var bar = import_react160.css`
25060
+ var bar = import_react162.css`
24821
25061
  position: absolute;
24822
25062
  inset: 0;
24823
25063
  transition: transform var(--duration-fast) var(--timing-ease-out);
@@ -24825,7 +25065,7 @@ var bar = import_react160.css`
24825
25065
  `;
24826
25066
 
24827
25067
  // src/components/ProgressBar/ProgressBar.tsx
24828
- var import_jsx_runtime138 = require("@emotion/react/jsx-runtime");
25068
+ var import_jsx_runtime137 = require("@emotion/react/jsx-runtime");
24829
25069
  function ProgressBar({
24830
25070
  current,
24831
25071
  max,
@@ -24835,7 +25075,7 @@ function ProgressBar({
24835
25075
  }) {
24836
25076
  const valueNow = Math.min(current, max);
24837
25077
  const valuePercentage = max > 0 ? Math.ceil(100 / max * valueNow) : 0;
24838
- return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
25078
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
24839
25079
  "div",
24840
25080
  {
24841
25081
  css: container3,
@@ -24846,7 +25086,7 @@ function ProgressBar({
24846
25086
  "aria-valuemax": max,
24847
25087
  "aria-valuenow": valueNow,
24848
25088
  ...props,
24849
- children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
25089
+ children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
24850
25090
  "div",
24851
25091
  {
24852
25092
  css: [
@@ -24866,31 +25106,31 @@ function ProgressBar({
24866
25106
 
24867
25107
  // src/components/ProgressList/ProgressList.tsx
24868
25108
  init_emotion_jsx_shim();
24869
- var import_react162 = require("@emotion/react");
25109
+ var import_react164 = require("@emotion/react");
24870
25110
  var import_CgCheckO3 = require("@react-icons/all-files/cg/CgCheckO");
24871
25111
  var import_CgRadioCheck2 = require("@react-icons/all-files/cg/CgRadioCheck");
24872
25112
  var import_CgRecord2 = require("@react-icons/all-files/cg/CgRecord");
24873
- var import_react163 = require("react");
25113
+ var import_react165 = require("react");
24874
25114
 
24875
25115
  // src/components/ProgressList/styles/ProgressList.styles.ts
24876
25116
  init_emotion_jsx_shim();
24877
- var import_react161 = require("@emotion/react");
24878
- var progressListStyles = import_react161.css`
25117
+ var import_react163 = require("@emotion/react");
25118
+ var progressListStyles = import_react163.css`
24879
25119
  display: flex;
24880
25120
  flex-direction: column;
24881
25121
  gap: var(--spacing-sm);
24882
25122
  list-style-type: none;
24883
25123
  `;
24884
- var progressListItemStyles = import_react161.css`
25124
+ var progressListItemStyles = import_react163.css`
24885
25125
  display: flex;
24886
25126
  gap: var(--spacing-base);
24887
25127
  align-items: center;
24888
25128
  `;
24889
25129
 
24890
25130
  // src/components/ProgressList/ProgressList.tsx
24891
- var import_jsx_runtime139 = require("@emotion/react/jsx-runtime");
25131
+ var import_jsx_runtime138 = require("@emotion/react/jsx-runtime");
24892
25132
  var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
24893
- const itemsWithStatus = (0, import_react163.useMemo)(() => {
25133
+ const itemsWithStatus = (0, import_react165.useMemo)(() => {
24894
25134
  const indexOfInProgressItem = items.findIndex(({ id }) => id === inProgressId);
24895
25135
  return items.map((item, index) => {
24896
25136
  let status = "queued";
@@ -24902,8 +25142,8 @@ var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
24902
25142
  return { ...item, status };
24903
25143
  });
24904
25144
  }, [items, inProgressId]);
24905
- return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("ol", { css: progressListStyles, ...htmlProps, children: itemsWithStatus.map(({ id, label, status, error, errorLevel }) => {
24906
- return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
25145
+ return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("ol", { css: progressListStyles, ...htmlProps, children: itemsWithStatus.map(({ id, label, status, error, errorLevel }) => {
25146
+ return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
24907
25147
  ProgressListItem,
24908
25148
  {
24909
25149
  status,
@@ -24923,7 +25163,7 @@ var ProgressListItem = ({
24923
25163
  errorLevel = "danger",
24924
25164
  autoEllipsis = false
24925
25165
  }) => {
24926
- const icon = (0, import_react163.useMemo)(() => {
25166
+ const icon = (0, import_react165.useMemo)(() => {
24927
25167
  if (error) {
24928
25168
  return warningIcon;
24929
25169
  }
@@ -24934,14 +25174,14 @@ var ProgressListItem = ({
24934
25174
  };
24935
25175
  return iconPerStatus[status];
24936
25176
  }, [status, error]);
24937
- const statusStyles = (0, import_react163.useMemo)(() => {
25177
+ const statusStyles = (0, import_react165.useMemo)(() => {
24938
25178
  if (error) {
24939
- return errorLevel === "caution" ? import_react162.css`
25179
+ return errorLevel === "caution" ? import_react164.css`
24940
25180
  color: rgb(161, 98, 7);
24941
25181
  & svg {
24942
25182
  color: rgb(250, 204, 21);
24943
25183
  }
24944
- ` : import_react162.css`
25184
+ ` : import_react164.css`
24945
25185
  color: rgb(185, 28, 28);
24946
25186
  & svg {
24947
25187
  color: var(--brand-primary-2);
@@ -24949,40 +25189,40 @@ var ProgressListItem = ({
24949
25189
  `;
24950
25190
  }
24951
25191
  const colorPerStatus = {
24952
- completed: import_react162.css`
25192
+ completed: import_react164.css`
24953
25193
  opacity: 0.75;
24954
25194
  `,
24955
- inProgress: import_react162.css`
25195
+ inProgress: import_react164.css`
24956
25196
  -webkit-text-stroke-width: thin;
24957
25197
  `,
24958
- queued: import_react162.css`
25198
+ queued: import_react164.css`
24959
25199
  opacity: 0.5;
24960
25200
  `
24961
25201
  };
24962
25202
  return colorPerStatus[status];
24963
25203
  }, [status, error, errorLevel]);
24964
- return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("li", { css: [progressListItemStyles, statusStyles], children: [
24965
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Tooltip, { title: error != null ? error : "", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { icon, size: 20, iconColor: "currentColor" }) }) }),
24966
- /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { children: [
25204
+ return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("li", { css: [progressListItemStyles, statusStyles], children: [
25205
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(Tooltip, { title: error != null ? error : "", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(Icon, { icon, size: 20, iconColor: "currentColor" }) }) }),
25206
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { children: [
24967
25207
  children,
24968
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { css: { visibility: autoEllipsis && status === "inProgress" && !error ? "visible" : "hidden" }, children: "..." })
25208
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { css: { visibility: autoEllipsis && status === "inProgress" && !error ? "visible" : "hidden" }, children: "..." })
24969
25209
  ] })
24970
25210
  ] });
24971
25211
  };
24972
25212
 
24973
25213
  // src/components/SegmentedControl/SegmentedControl.tsx
24974
25214
  init_emotion_jsx_shim();
24975
- var import_react165 = require("@emotion/react");
25215
+ var import_react167 = require("@emotion/react");
24976
25216
  var import_CgCheck6 = require("@react-icons/all-files/cg/CgCheck");
24977
- var import_react166 = require("react");
25217
+ var import_react168 = require("react");
24978
25218
 
24979
25219
  // src/components/SegmentedControl/SegmentedControl.styles.ts
24980
25220
  init_emotion_jsx_shim();
24981
- var import_react164 = require("@emotion/react");
24982
- var segmentedControlRootStyles = import_react164.css`
25221
+ var import_react166 = require("@emotion/react");
25222
+ var segmentedControlRootStyles = import_react166.css`
24983
25223
  position: relative;
24984
25224
  `;
24985
- var segmentedControlScrollIndicatorsStyles = import_react164.css`
25225
+ var segmentedControlScrollIndicatorsStyles = import_react166.css`
24986
25226
  position: absolute;
24987
25227
  inset: 0;
24988
25228
  z-index: 1;
@@ -25010,17 +25250,17 @@ var segmentedControlScrollIndicatorsStyles = import_react164.css`
25010
25250
  background: linear-gradient(to left, var(--background-color) 10%, transparent);
25011
25251
  }
25012
25252
  `;
25013
- var segmentedControlScrollIndicatorStartVisibleStyles = import_react164.css`
25253
+ var segmentedControlScrollIndicatorStartVisibleStyles = import_react166.css`
25014
25254
  &::before {
25015
25255
  opacity: 1;
25016
25256
  }
25017
25257
  `;
25018
- var segmentedControlScrollIndicatorEndVisibleStyles = import_react164.css`
25258
+ var segmentedControlScrollIndicatorEndVisibleStyles = import_react166.css`
25019
25259
  &::after {
25020
25260
  opacity: 1;
25021
25261
  }
25022
25262
  `;
25023
- var segmentedControlWrapperStyles = import_react164.css`
25263
+ var segmentedControlWrapperStyles = import_react166.css`
25024
25264
  overflow-y: auto;
25025
25265
  scroll-behavior: smooth;
25026
25266
  scrollbar-width: none;
@@ -25029,7 +25269,7 @@ var segmentedControlWrapperStyles = import_react164.css`
25029
25269
  height: 0px;
25030
25270
  }
25031
25271
  `;
25032
- var segmentedControlStyles = import_react164.css`
25272
+ var segmentedControlStyles = import_react166.css`
25033
25273
  --segmented-control-rounded-value: var(--rounded-base);
25034
25274
  --segmented-control-border-width: 1px;
25035
25275
  --segmented-control-selected-color: var(--brand-secondary-3);
@@ -25048,14 +25288,14 @@ var segmentedControlStyles = import_react164.css`
25048
25288
  border-radius: calc(var(--segmented-control-rounded-value) + var(--segmented-control-border-width));
25049
25289
  font-size: var(--fs-xs);
25050
25290
  `;
25051
- var segmentedControlVerticalStyles = import_react164.css`
25291
+ var segmentedControlVerticalStyles = import_react166.css`
25052
25292
  flex-direction: column;
25053
25293
  --segmented-control-first-border-radius: var(--segmented-control-rounded-value)
25054
25294
  var(--segmented-control-rounded-value) 0 0;
25055
25295
  --segmented-control-last-border-radius: 0 0 var(--segmented-control-rounded-value)
25056
25296
  var(--segmented-control-rounded-value);
25057
25297
  `;
25058
- var segmentedControlItemStyles = import_react164.css`
25298
+ var segmentedControlItemStyles = import_react166.css`
25059
25299
  &:first-of-type label {
25060
25300
  border-radius: var(--segmented-control-first-border-radius);
25061
25301
  }
@@ -25063,10 +25303,10 @@ var segmentedControlItemStyles = import_react164.css`
25063
25303
  border-radius: var(--segmented-control-last-border-radius);
25064
25304
  }
25065
25305
  `;
25066
- var segmentedControlInputStyles = import_react164.css`
25306
+ var segmentedControlInputStyles = import_react166.css`
25067
25307
  ${accessibleHidden}
25068
25308
  `;
25069
- var segmentedControlLabelStyles = (checked, disabled2) => import_react164.css`
25309
+ var segmentedControlLabelStyles = (checked, disabled2) => import_react166.css`
25070
25310
  position: relative;
25071
25311
  display: flex;
25072
25312
  align-items: center;
@@ -25133,25 +25373,25 @@ var segmentedControlLabelStyles = (checked, disabled2) => import_react164.css`
25133
25373
  `}
25134
25374
  }
25135
25375
  `;
25136
- var segmentedControlLabelIconOnlyStyles = import_react164.css`
25376
+ var segmentedControlLabelIconOnlyStyles = import_react166.css`
25137
25377
  padding-inline: 0.5em;
25138
25378
  `;
25139
- var segmentedControlLabelCheckStyles = import_react164.css`
25379
+ var segmentedControlLabelCheckStyles = import_react166.css`
25140
25380
  opacity: 0.5;
25141
25381
  `;
25142
- var segmentedControlLabelContentStyles = import_react164.css`
25382
+ var segmentedControlLabelContentStyles = import_react166.css`
25143
25383
  display: flex;
25144
25384
  align-items: center;
25145
25385
  justify-content: center;
25146
25386
  gap: var(--spacing-sm);
25147
25387
  height: 100%;
25148
25388
  `;
25149
- var segmentedControlLabelTextStyles = import_react164.css`
25389
+ var segmentedControlLabelTextStyles = import_react166.css`
25150
25390
  white-space: nowrap;
25151
25391
  `;
25152
25392
 
25153
25393
  // src/components/SegmentedControl/SegmentedControl.tsx
25154
- var import_jsx_runtime140 = require("@emotion/react/jsx-runtime");
25394
+ var import_jsx_runtime139 = require("@emotion/react/jsx-runtime");
25155
25395
  var SegmentedControl = ({
25156
25396
  name,
25157
25397
  options,
@@ -25166,10 +25406,10 @@ var SegmentedControl = ({
25166
25406
  currentBackgroundColor = "white",
25167
25407
  ...props
25168
25408
  }) => {
25169
- const wrapperRef = (0, import_react166.useRef)(null);
25170
- const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = (0, import_react166.useState)(false);
25171
- const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = (0, import_react166.useState)(false);
25172
- const onOptionChange = (0, import_react166.useCallback)(
25409
+ const wrapperRef = (0, import_react168.useRef)(null);
25410
+ const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = (0, import_react168.useState)(false);
25411
+ const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = (0, import_react168.useState)(false);
25412
+ const onOptionChange = (0, import_react168.useCallback)(
25173
25413
  (event) => {
25174
25414
  if (event.target.checked) {
25175
25415
  onChange == null ? void 0 : onChange(options[parseInt(event.target.value)].value);
@@ -25177,19 +25417,19 @@ var SegmentedControl = ({
25177
25417
  },
25178
25418
  [options, onChange]
25179
25419
  );
25180
- const sizeStyles = (0, import_react166.useMemo)(() => {
25420
+ const sizeStyles = (0, import_react168.useMemo)(() => {
25181
25421
  const map = {
25182
- sm: (0, import_react165.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
25183
- md: (0, import_react165.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
25184
- lg: (0, import_react165.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
25185
- xl: (0, import_react165.css)({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
25422
+ sm: (0, import_react167.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
25423
+ md: (0, import_react167.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
25424
+ lg: (0, import_react167.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
25425
+ xl: (0, import_react167.css)({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
25186
25426
  };
25187
25427
  return map[size];
25188
25428
  }, [size]);
25189
- const isIconOnly = (0, import_react166.useMemo)(() => {
25429
+ const isIconOnly = (0, import_react168.useMemo)(() => {
25190
25430
  return options.every((option) => option && option.icon && !option.label);
25191
25431
  }, [options]);
25192
- (0, import_react166.useEffect)(() => {
25432
+ (0, import_react168.useEffect)(() => {
25193
25433
  const wrapperElement = wrapperRef.current;
25194
25434
  const onScroll = () => {
25195
25435
  if (!wrapperElement) {
@@ -25210,8 +25450,8 @@ var SegmentedControl = ({
25210
25450
  wrapperElement == null ? void 0 : wrapperElement.removeEventListener("scroll", onScroll);
25211
25451
  };
25212
25452
  }, []);
25213
- return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { css: [segmentedControlRootStyles, { "--background-color": currentBackgroundColor }], children: [
25214
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { ref: wrapperRef, css: segmentedControlWrapperStyles, children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
25453
+ return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { css: [segmentedControlRootStyles, { "--background-color": currentBackgroundColor }], children: [
25454
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { ref: wrapperRef, css: segmentedControlWrapperStyles, children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
25215
25455
  "div",
25216
25456
  {
25217
25457
  css: [
@@ -25227,12 +25467,12 @@ var SegmentedControl = ({
25227
25467
  }
25228
25468
  const text = option.label ? option.label : option.icon ? null : String(option.value);
25229
25469
  const isDisabled = disabled2 || option.disabled;
25230
- return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
25470
+ return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
25231
25471
  "div",
25232
25472
  {
25233
25473
  css: segmentedControlItemStyles,
25234
25474
  "data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
25235
- children: /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
25475
+ children: /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
25236
25476
  "label",
25237
25477
  {
25238
25478
  css: [
@@ -25241,7 +25481,7 @@ var SegmentedControl = ({
25241
25481
  isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
25242
25482
  ],
25243
25483
  children: [
25244
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
25484
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
25245
25485
  "input",
25246
25486
  {
25247
25487
  css: segmentedControlInputStyles,
@@ -25253,10 +25493,10 @@ var SegmentedControl = ({
25253
25493
  disabled: isDisabled
25254
25494
  }
25255
25495
  ),
25256
- option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_CgCheck6.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
25257
- /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
25258
- !option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
25259
- !text || hideOptionText ? null : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
25496
+ option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_CgCheck6.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
25497
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
25498
+ !option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
25499
+ !text || hideOptionText ? null : /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
25260
25500
  ] })
25261
25501
  ]
25262
25502
  }
@@ -25266,7 +25506,7 @@ var SegmentedControl = ({
25266
25506
  })
25267
25507
  }
25268
25508
  ) }),
25269
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
25509
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
25270
25510
  "div",
25271
25511
  {
25272
25512
  css: [
@@ -25284,18 +25524,18 @@ init_emotion_jsx_shim();
25284
25524
 
25285
25525
  // src/components/Skeleton/Skeleton.styles.ts
25286
25526
  init_emotion_jsx_shim();
25287
- var import_react167 = require("@emotion/react");
25288
- var lightFadingOut = import_react167.keyframes`
25527
+ var import_react169 = require("@emotion/react");
25528
+ var lightFadingOut = import_react169.keyframes`
25289
25529
  from { opacity: 0.1; }
25290
25530
  to { opacity: 0.025; }
25291
25531
  `;
25292
- var skeletonStyles = import_react167.css`
25532
+ var skeletonStyles = import_react169.css`
25293
25533
  animation: ${lightFadingOut} 1s ease-out infinite alternate;
25294
25534
  background-color: var(--gray-900);
25295
25535
  `;
25296
25536
 
25297
25537
  // src/components/Skeleton/Skeleton.tsx
25298
- var import_jsx_runtime141 = require("@emotion/react/jsx-runtime");
25538
+ var import_jsx_runtime140 = require("@emotion/react/jsx-runtime");
25299
25539
  var Skeleton = ({
25300
25540
  width = "100%",
25301
25541
  height = "1.25rem",
@@ -25303,7 +25543,7 @@ var Skeleton = ({
25303
25543
  circle = false,
25304
25544
  children,
25305
25545
  ...otherProps
25306
- }) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
25546
+ }) => /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
25307
25547
  "div",
25308
25548
  {
25309
25549
  css: [
@@ -25324,12 +25564,12 @@ var Skeleton = ({
25324
25564
 
25325
25565
  // src/components/Switch/Switch.tsx
25326
25566
  init_emotion_jsx_shim();
25327
- var import_react169 = require("react");
25567
+ var import_react171 = require("react");
25328
25568
 
25329
25569
  // src/components/Switch/Switch.styles.ts
25330
25570
  init_emotion_jsx_shim();
25331
- var import_react168 = require("@emotion/react");
25332
- var SwitchInputContainer = import_react168.css`
25571
+ var import_react170 = require("@emotion/react");
25572
+ var SwitchInputContainer = import_react170.css`
25333
25573
  cursor: pointer;
25334
25574
  display: inline-block;
25335
25575
  position: relative;
@@ -25338,7 +25578,7 @@ var SwitchInputContainer = import_react168.css`
25338
25578
  vertical-align: middle;
25339
25579
  user-select: none;
25340
25580
  `;
25341
- var SwitchInput = (size) => import_react168.css`
25581
+ var SwitchInput = (size) => import_react170.css`
25342
25582
  appearance: none;
25343
25583
  border-radius: var(--rounded-full);
25344
25584
  background-color: var(--white);
@@ -25378,7 +25618,7 @@ var SwitchInput = (size) => import_react168.css`
25378
25618
  cursor: not-allowed;
25379
25619
  }
25380
25620
  `;
25381
- var SwitchInputDisabled = import_react168.css`
25621
+ var SwitchInputDisabled = import_react170.css`
25382
25622
  opacity: var(--opacity-50);
25383
25623
  cursor: not-allowed;
25384
25624
 
@@ -25386,7 +25626,7 @@ var SwitchInputDisabled = import_react168.css`
25386
25626
  cursor: not-allowed;
25387
25627
  }
25388
25628
  `;
25389
- var SwitchInputLabel = (size) => import_react168.css`
25629
+ var SwitchInputLabel = (size) => import_react170.css`
25390
25630
  align-items: center;
25391
25631
  color: var(--typography-base);
25392
25632
  display: inline-flex;
@@ -25408,32 +25648,32 @@ var SwitchInputLabel = (size) => import_react168.css`
25408
25648
  top: 0;
25409
25649
  }
25410
25650
  `;
25411
- var SwitchText = (size) => import_react168.css`
25651
+ var SwitchText = (size) => import_react170.css`
25412
25652
  color: var(--gray-500);
25413
25653
  font-size: var(--fs-sm);
25414
25654
  padding-inline: ${size === "sm" ? "var(--spacing-xl)" : "var(--spacing-2xl)"} 0;
25415
25655
  `;
25416
25656
 
25417
25657
  // src/components/Switch/Switch.tsx
25418
- var import_jsx_runtime142 = require("@emotion/react/jsx-runtime");
25419
- var Switch = (0, import_react169.forwardRef)(
25658
+ var import_jsx_runtime141 = require("@emotion/react/jsx-runtime");
25659
+ var Switch = (0, import_react171.forwardRef)(
25420
25660
  ({ label, infoText, toggleText, children, switchSize = "base", ...inputProps }, ref) => {
25421
25661
  let additionalText = infoText;
25422
25662
  if (infoText && toggleText) {
25423
25663
  additionalText = inputProps.checked ? toggleText : infoText;
25424
25664
  }
25425
- return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
25426
- /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
25665
+ return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_jsx_runtime141.Fragment, { children: [
25666
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
25427
25667
  "label",
25428
25668
  {
25429
25669
  css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0],
25430
25670
  children: [
25431
- /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("input", { type: "checkbox", css: SwitchInput(switchSize), ...inputProps, ref }),
25432
- /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("span", { css: SwitchInputLabel(switchSize), children: label })
25671
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("input", { type: "checkbox", css: SwitchInput(switchSize), ...inputProps, ref }),
25672
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { css: SwitchInputLabel(switchSize), children: label })
25433
25673
  ]
25434
25674
  }
25435
25675
  ),
25436
- additionalText ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("p", { css: SwitchText(switchSize), children: additionalText }) : null,
25676
+ additionalText ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { css: SwitchText(switchSize), children: additionalText }) : null,
25437
25677
  children
25438
25678
  ] });
25439
25679
  }
@@ -25445,8 +25685,8 @@ var React24 = __toESM(require("react"));
25445
25685
 
25446
25686
  // src/components/Table/Table.styles.ts
25447
25687
  init_emotion_jsx_shim();
25448
- var import_react170 = require("@emotion/react");
25449
- var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_react170.css`
25688
+ var import_react172 = require("@emotion/react");
25689
+ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_react172.css`
25450
25690
  border-bottom: 1px solid var(--gray-400);
25451
25691
  border-collapse: collapse;
25452
25692
  min-width: 100%;
@@ -25466,66 +25706,66 @@ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_
25466
25706
  background-color: var(--gray-50);
25467
25707
  }
25468
25708
  `;
25469
- var tableHead = import_react170.css`
25709
+ var tableHead = import_react172.css`
25470
25710
  color: var(--typography-base);
25471
25711
  text-align: left;
25472
25712
  `;
25473
- var tableRow = import_react170.css`
25713
+ var tableRow = import_react172.css`
25474
25714
  border-bottom: 1px solid var(--gray-100);
25475
25715
  `;
25476
- var tableCellHead = import_react170.css`
25716
+ var tableCellHead = import_react172.css`
25477
25717
  font-size: var(--fs-sm);
25478
25718
  text-transform: uppercase;
25479
25719
  font-weight: var(--fw-bold);
25480
25720
  `;
25481
25721
 
25482
25722
  // src/components/Table/Table.tsx
25483
- var import_jsx_runtime143 = require("@emotion/react/jsx-runtime");
25723
+ var import_jsx_runtime142 = require("@emotion/react/jsx-runtime");
25484
25724
  var Table = React24.forwardRef(
25485
25725
  ({ children, cellPadding, ...otherProps }, ref) => {
25486
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("table", { ref, css: table({ cellPadding }), ...otherProps, children });
25726
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("table", { ref, css: table({ cellPadding }), ...otherProps, children });
25487
25727
  }
25488
25728
  );
25489
25729
  var TableHead = React24.forwardRef(
25490
25730
  ({ children, ...otherProps }, ref) => {
25491
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("thead", { ref, css: tableHead, ...otherProps, children });
25731
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("thead", { ref, css: tableHead, ...otherProps, children });
25492
25732
  }
25493
25733
  );
25494
25734
  var TableBody = React24.forwardRef(
25495
25735
  ({ children, ...otherProps }, ref) => {
25496
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("tbody", { ref, ...otherProps, children });
25736
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("tbody", { ref, ...otherProps, children });
25497
25737
  }
25498
25738
  );
25499
25739
  var TableFoot = React24.forwardRef(
25500
25740
  ({ children, ...otherProps }, ref) => {
25501
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("tfoot", { ref, ...otherProps, children });
25741
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("tfoot", { ref, ...otherProps, children });
25502
25742
  }
25503
25743
  );
25504
25744
  var TableRow = React24.forwardRef(
25505
25745
  ({ children, ...otherProps }, ref) => {
25506
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("tr", { ref, css: tableRow, ...otherProps, children });
25746
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("tr", { ref, css: tableRow, ...otherProps, children });
25507
25747
  }
25508
25748
  );
25509
25749
  var TableCellHead = React24.forwardRef(
25510
25750
  ({ children, ...otherProps }, ref) => {
25511
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("th", { ref, css: tableCellHead, ...otherProps, children });
25751
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("th", { ref, css: tableCellHead, ...otherProps, children });
25512
25752
  }
25513
25753
  );
25514
25754
  var TableCellData = React24.forwardRef(
25515
25755
  ({ children, ...otherProps }, ref) => {
25516
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("td", { ref, ...otherProps, children });
25756
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("td", { ref, ...otherProps, children });
25517
25757
  }
25518
25758
  );
25519
25759
 
25520
25760
  // src/components/Tabs/Tabs.tsx
25521
25761
  init_emotion_jsx_shim();
25522
- var import_react172 = require("@ariakit/react");
25523
- var import_react173 = require("react");
25762
+ var import_react174 = require("@ariakit/react");
25763
+ var import_react175 = require("react");
25524
25764
 
25525
25765
  // src/components/Tabs/Tabs.styles.ts
25526
25766
  init_emotion_jsx_shim();
25527
- var import_react171 = require("@emotion/react");
25528
- var tabButtonStyles = import_react171.css`
25767
+ var import_react173 = require("@emotion/react");
25768
+ var tabButtonStyles = import_react173.css`
25529
25769
  align-items: center;
25530
25770
  border: 0;
25531
25771
  height: 2.5rem;
@@ -25542,16 +25782,16 @@ var tabButtonStyles = import_react171.css`
25542
25782
  box-shadow: inset 0 -2px 0 var(--brand-secondary-3);
25543
25783
  }
25544
25784
  `;
25545
- var tabButtonGroupStyles = import_react171.css`
25785
+ var tabButtonGroupStyles = import_react173.css`
25546
25786
  display: flex;
25547
25787
  gap: var(--spacing-base);
25548
25788
  border-bottom: 1px solid var(--gray-300);
25549
25789
  `;
25550
25790
 
25551
25791
  // src/components/Tabs/Tabs.tsx
25552
- var import_jsx_runtime144 = require("@emotion/react/jsx-runtime");
25792
+ var import_jsx_runtime143 = require("@emotion/react/jsx-runtime");
25553
25793
  var useCurrentTab = () => {
25554
- const context = (0, import_react172.useTabStore)();
25794
+ const context = (0, import_react174.useTabStore)();
25555
25795
  if (!context) {
25556
25796
  throw new Error("This component can only be used inside <Tabs>");
25557
25797
  }
@@ -25565,12 +25805,12 @@ var Tabs = ({
25565
25805
  manual,
25566
25806
  ...props
25567
25807
  }) => {
25568
- const selected = (0, import_react173.useMemo)(() => {
25808
+ const selected = (0, import_react175.useMemo)(() => {
25569
25809
  if (selectedId) return selectedId;
25570
25810
  return useHashForState && typeof window !== "undefined" && window.location.hash ? window.location.hash.substring(1) : void 0;
25571
25811
  }, [selectedId, useHashForState]);
25572
- const tab = (0, import_react172.useTabStore)({ ...props, selectOnMove: !manual, selectedId: selected });
25573
- const onTabSelect = (0, import_react173.useCallback)(
25812
+ const tab = (0, import_react174.useTabStore)({ ...props, selectOnMove: !manual, selectedId: selected });
25813
+ const onTabSelect = (0, import_react175.useCallback)(
25574
25814
  (value) => {
25575
25815
  const selectedValueWithoutNull = value != null ? value : void 0;
25576
25816
  onSelectedIdChange == null ? void 0 : onSelectedIdChange(selectedValueWithoutNull);
@@ -25581,28 +25821,28 @@ var Tabs = ({
25581
25821
  },
25582
25822
  [onSelectedIdChange, useHashForState]
25583
25823
  );
25584
- (0, import_react173.useEffect)(() => {
25824
+ (0, import_react175.useEffect)(() => {
25585
25825
  if (selected && selected !== tab.getState().activeId) {
25586
25826
  tab.setSelectedId(selected);
25587
25827
  }
25588
25828
  }, [selected, tab]);
25589
- return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_react172.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
25829
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react174.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
25590
25830
  };
25591
25831
  var TabButtonGroup = ({ children, ...props }) => {
25592
- return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_react172.TabList, { ...props, css: tabButtonGroupStyles, children });
25832
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react174.TabList, { ...props, css: tabButtonGroupStyles, children });
25593
25833
  };
25594
25834
  var TabButton = ({
25595
25835
  children,
25596
25836
  id,
25597
25837
  ...props
25598
25838
  }) => {
25599
- return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_react172.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
25839
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react174.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
25600
25840
  };
25601
25841
  var TabContent = ({
25602
25842
  children,
25603
25843
  ...props
25604
25844
  }) => {
25605
- return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_react172.TabPanel, { ...props, children });
25845
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react174.TabPanel, { ...props, children });
25606
25846
  };
25607
25847
 
25608
25848
  // src/components/Validation/StatusBullet.tsx
@@ -25610,8 +25850,8 @@ init_emotion_jsx_shim();
25610
25850
 
25611
25851
  // src/components/Validation/StatusBullet.styles.ts
25612
25852
  init_emotion_jsx_shim();
25613
- var import_react174 = require("@emotion/react");
25614
- var StatusBulletContainer = import_react174.css`
25853
+ var import_react176 = require("@emotion/react");
25854
+ var StatusBulletContainer = import_react176.css`
25615
25855
  align-items: center;
25616
25856
  align-self: center;
25617
25857
  color: var(--gray-500);
@@ -25628,33 +25868,33 @@ var StatusBulletContainer = import_react174.css`
25628
25868
  display: block;
25629
25869
  }
25630
25870
  `;
25631
- var StatusBulletBase = import_react174.css`
25871
+ var StatusBulletBase = import_react176.css`
25632
25872
  font-size: var(--fs-sm);
25633
25873
  &:before {
25634
25874
  width: var(--fs-xs);
25635
25875
  height: var(--fs-xs);
25636
25876
  }
25637
25877
  `;
25638
- var StatusBulletSmall = import_react174.css`
25878
+ var StatusBulletSmall = import_react176.css`
25639
25879
  font-size: var(--fs-xs);
25640
25880
  &:before {
25641
25881
  width: var(--fs-xxs);
25642
25882
  height: var(--fs-xxs);
25643
25883
  }
25644
25884
  `;
25645
- var StatusDraft = import_react174.css`
25885
+ var StatusDraft = import_react176.css`
25646
25886
  &:before {
25647
25887
  background: var(--white);
25648
25888
  box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
25649
25889
  }
25650
25890
  `;
25651
- var StatusModified = import_react174.css`
25891
+ var StatusModified = import_react176.css`
25652
25892
  &:before {
25653
25893
  background: linear-gradient(to right, var(--white) 50%, var(--accent-dark) 50% 100%);
25654
25894
  box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
25655
25895
  }
25656
25896
  `;
25657
- var StatusError = import_react174.css`
25897
+ var StatusError = import_react176.css`
25658
25898
  color: var(--error);
25659
25899
  &:before {
25660
25900
  /* TODO: replace this with an svg icon */
@@ -25667,29 +25907,29 @@ var StatusError = import_react174.css`
25667
25907
  );
25668
25908
  }
25669
25909
  `;
25670
- var StatusPublished = import_react174.css`
25910
+ var StatusPublished = import_react176.css`
25671
25911
  &:before {
25672
25912
  background: var(--accent-dark);
25673
25913
  }
25674
25914
  `;
25675
- var StatusOrphan = import_react174.css`
25915
+ var StatusOrphan = import_react176.css`
25676
25916
  &:before {
25677
25917
  background: var(--brand-secondary-5);
25678
25918
  }
25679
25919
  `;
25680
- var StatusUnknown = import_react174.css`
25920
+ var StatusUnknown = import_react176.css`
25681
25921
  &:before {
25682
25922
  background: var(--gray-800);
25683
25923
  }
25684
25924
  `;
25685
- var StatusDeleted = import_react174.css`
25925
+ var StatusDeleted = import_react176.css`
25686
25926
  &:before {
25687
25927
  background: var(--error);
25688
25928
  }
25689
25929
  `;
25690
25930
 
25691
25931
  // src/components/Validation/StatusBullet.tsx
25692
- var import_jsx_runtime145 = require("@emotion/react/jsx-runtime");
25932
+ var import_jsx_runtime144 = require("@emotion/react/jsx-runtime");
25693
25933
  var StatusBullet = ({
25694
25934
  status,
25695
25935
  hideText = false,
@@ -25709,7 +25949,7 @@ var StatusBullet = ({
25709
25949
  Deleted: StatusDeleted
25710
25950
  };
25711
25951
  const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
25712
- return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
25952
+ return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
25713
25953
  "span",
25714
25954
  {
25715
25955
  role: "status",