@uniformdev/design-system 19.178.0 → 19.178.2-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -12449,6 +12449,7 @@ var Menu = React7.forwardRef(function Menu2({
12449
12449
  menuItemsContainerCssClasses,
12450
12450
  testId,
12451
12451
  maxMenuHeight,
12452
+ portalElement,
12452
12453
  ...props
12453
12454
  }, ref) {
12454
12455
  const placementOverride = legacyPlacements.includes(placement) ? void 0 : placement;
@@ -12459,6 +12460,7 @@ var Menu = React7.forwardRef(function Menu2({
12459
12460
  BaseMenu,
12460
12461
  {
12461
12462
  portal: !withoutPortal,
12463
+ portalElement,
12462
12464
  unmountOnHide: true,
12463
12465
  gutter: 0,
12464
12466
  shift: menu.parent ? -4 : 0,
@@ -20245,7 +20247,7 @@ var ParameterNameAndPublicIdInput = ({
20245
20247
  };
20246
20248
 
20247
20249
  // src/components/ParameterInputs/ParameterRichText.tsx
20248
- import { css as css98 } from "@emotion/react";
20250
+ import { css as css100 } from "@emotion/react";
20249
20251
  import { ListItemNode, ListNode as ListNode2 } from "@lexical/list";
20250
20252
  import {
20251
20253
  CODE,
@@ -20257,14 +20259,16 @@ import {
20257
20259
  UNORDERED_LIST
20258
20260
  } from "@lexical/markdown";
20259
20261
  import { LexicalComposer } from "@lexical/react/LexicalComposer";
20260
- import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
20262
+ import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
20261
20263
  import { ContentEditable } from "@lexical/react/LexicalContentEditable";
20262
20264
  import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
20263
20265
  import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
20264
20266
  import { ListPlugin } from "@lexical/react/LexicalListPlugin";
20265
20267
  import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
20266
20268
  import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
20269
+ import { TablePlugin } from "@lexical/react/LexicalTablePlugin";
20267
20270
  import { HeadingNode, QuoteNode } from "@lexical/rich-text";
20271
+ import { TableCellNode as TableCellNode2, TableNode, TableRowNode as TableRowNode2 } from "@lexical/table";
20268
20272
 
20269
20273
  // ../richtext/dist/index.mjs
20270
20274
  var richTextBuiltInElements = [
@@ -20312,6 +20316,10 @@ var richTextBuiltInElements = [
20312
20316
  label: "Code Block",
20313
20317
  type: "code"
20314
20318
  },
20319
+ {
20320
+ label: "Table",
20321
+ type: "table"
20322
+ },
20315
20323
  {
20316
20324
  label: "Dynamic Token",
20317
20325
  type: "variable"
@@ -20359,7 +20367,7 @@ var getLabelForElement = (type) => {
20359
20367
  // src/components/ParameterInputs/ParameterRichText.tsx
20360
20368
  import { deepEqual as deepEqual2 } from "fast-equals";
20361
20369
  import { ParagraphNode as ParagraphNode2 } from "lexical";
20362
- import { useEffect as useEffect21, useRef as useRef12 } from "react";
20370
+ import { useEffect as useEffect23, useState as useState20 } from "react";
20363
20371
 
20364
20372
  // src/components/ParameterInputs/rich-text/CustomCodeNode.ts
20365
20373
  import { CodeNode } from "@lexical/code";
@@ -20574,6 +20582,46 @@ var codeElement = css95`
20574
20582
  margin-bottom: 0;
20575
20583
  }
20576
20584
  `;
20585
+ var tableElement = css95`
20586
+ border-collapse: collapse;
20587
+ border-spacing: 0;
20588
+ border-color: var(--gray-300);
20589
+ border-width: 1px;
20590
+ border-style: solid;
20591
+ margin-bottom: var(--spacing-base);
20592
+ margin-top: 0;
20593
+
20594
+ &:last-child {
20595
+ margin-bottom: 0;
20596
+ }
20597
+ `;
20598
+ var tableCellElement = css95`
20599
+ background-color: var(--white);
20600
+ border-color: var(--gray-300);
20601
+ border-style: solid;
20602
+ border-width: 1px;
20603
+ box-sizing: unset;
20604
+ min-width: 2rem;
20605
+ outline: none;
20606
+ padding: var(--spacing-sm);
20607
+ text-align: start;
20608
+ vertical-align: top;
20609
+ width: 7rem;
20610
+ `;
20611
+ var tableHeaderElement = css95`
20612
+ background-color: var(--gray-100);
20613
+ border-color: var(--gray-300);
20614
+ border-style: solid;
20615
+ border-width: 1px;
20616
+ box-sizing: unset;
20617
+ font-weight: normal;
20618
+ min-width: 2rem;
20619
+ outline: none;
20620
+ padding: var(--spacing-sm);
20621
+ text-align: start;
20622
+ vertical-align: top;
20623
+ width: 7rem;
20624
+ `;
20577
20625
 
20578
20626
  // src/components/ParameterInputs/rich-text/LinkNodePlugin.tsx
20579
20627
  import { css as css96 } from "@emotion/react";
@@ -20929,7 +20977,11 @@ var linkPopoverAnchor = css96`
20929
20977
  ${link}
20930
20978
  ${linkColorDefault}
20931
20979
  `;
20932
- function LinkNodePlugin({ onConnectLink, getBoundPath }) {
20980
+ function LinkNodePlugin({
20981
+ onConnectLink,
20982
+ getBoundPath,
20983
+ positioningAnchorEl
20984
+ }) {
20933
20985
  const parsePath = getBoundPath != null ? getBoundPath : function(path) {
20934
20986
  return path;
20935
20987
  };
@@ -21033,9 +21085,11 @@ function LinkNodePlugin({ onConnectLink, getBoundPath }) {
21033
21085
  setLinkPopoverState(void 0);
21034
21086
  return;
21035
21087
  }
21088
+ const elementRect = element.getBoundingClientRect();
21089
+ const positioningAnchorRect = positioningAnchorEl.getBoundingClientRect();
21036
21090
  const { x, y } = {
21037
- x: element.offsetLeft + LINK_POPOVER_OFFSET_X,
21038
- y: element.offsetTop + element.clientHeight + LINK_POPOVER_OFFSET_Y
21091
+ x: elementRect.left - positioningAnchorRect.left + LINK_POPOVER_OFFSET_X,
21092
+ y: elementRect.top + elementRect.height - positioningAnchorRect.top + LINK_POPOVER_OFFSET_Y
21039
21093
  };
21040
21094
  setLinkPopoverState({
21041
21095
  node: linkNode,
@@ -21044,7 +21098,7 @@ function LinkNodePlugin({ onConnectLink, getBoundPath }) {
21044
21098
  y
21045
21099
  }
21046
21100
  });
21047
- }, [editor]);
21101
+ }, [editor, positioningAnchorEl]);
21048
21102
  useEffect18(() => {
21049
21103
  return editor.registerUpdateListener(({ editorState }) => {
21050
21104
  requestAnimationFrame(() => {
@@ -21184,10 +21238,12 @@ import {
21184
21238
  import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
21185
21239
  import { $createHeadingNode, $createQuoteNode, $isHeadingNode } from "@lexical/rich-text";
21186
21240
  import { $setBlocksType } from "@lexical/selection";
21241
+ import { $createTableNodeWithDimensions } from "@lexical/table";
21187
21242
  import { $findMatchingParent, $getNearestNodeOfType } from "@lexical/utils";
21188
21243
  import {
21189
21244
  $createParagraphNode,
21190
21245
  $getSelection as $getSelection3,
21246
+ $insertNodes,
21191
21247
  $isRangeSelection as $isRangeSelection3,
21192
21248
  $isRootOrShadowRoot,
21193
21249
  COMMAND_PRIORITY_CRITICAL as COMMAND_PRIORITY_CRITICAL2,
@@ -21197,12 +21253,14 @@ import {
21197
21253
  import { useCallback as useCallback11, useEffect as useEffect20, useMemo as useMemo6, useState as useState17 } from "react";
21198
21254
  import { Fragment as Fragment19, jsx as jsx130, jsxs as jsxs86 } from "@emotion/react/jsx-runtime";
21199
21255
  var toolbar = css97`
21256
+ ${scrollbarStyles}
21200
21257
  background: var(--gray-50);
21201
21258
  border-radius: var(--rounded-base);
21202
21259
  display: flex;
21203
21260
  /* We add 1px because we use a 1px wide separator */
21204
21261
  gap: calc(var(--spacing-sm) + 1px);
21205
21262
  margin: calc(var(--spacing-sm) + var(--spacing-xs)) 0;
21263
+ overflow: auto;
21206
21264
  padding: var(--spacing-sm);
21207
21265
  position: sticky;
21208
21266
  top: calc(var(--spacing-sm) * -2);
@@ -21210,6 +21268,7 @@ var toolbar = css97`
21210
21268
  `;
21211
21269
  var toolbarGroup = css97`
21212
21270
  display: flex;
21271
+ flex-shrink: 0;
21213
21272
  gap: var(--spacing-xs);
21214
21273
  position: relative;
21215
21274
 
@@ -21232,6 +21291,7 @@ var richTextToolbarButton = css97`
21232
21291
  box-shadow: none;
21233
21292
  color: var(--gray-900);
21234
21293
  display: flex;
21294
+ flex-shrink: 0;
21235
21295
  height: 32px;
21236
21296
  justify-content: center;
21237
21297
  min-width: 32px;
@@ -21240,6 +21300,10 @@ var richTextToolbarButton = css97`
21240
21300
  var richTextToolbarButtonActive = css97`
21241
21301
  background: var(--gray-200);
21242
21302
  `;
21303
+ var textStyleButton = css97`
21304
+ justify-content: space-between;
21305
+ min-width: 7rem;
21306
+ `;
21243
21307
  var toolbarIcon = css97`
21244
21308
  color: inherit;
21245
21309
  `;
@@ -21260,7 +21324,7 @@ var FORMATS_WITH_ICON = /* @__PURE__ */ new Map([
21260
21324
  ]);
21261
21325
  var HEADING_ELEMENTS = ["h1", "h2", "h3", "h4", "h5", "h6"];
21262
21326
  var TEXTUAL_ELEMENTS = HEADING_ELEMENTS;
21263
- var RichTextToolbar = ({ config, customControls }) => {
21327
+ var RichTextToolbar = ({ config, customControls, onInsertTable }) => {
21264
21328
  const [editor] = useLexicalComposerContext4();
21265
21329
  const {
21266
21330
  activeElement,
@@ -21276,26 +21340,39 @@ var RichTextToolbar = ({ config, customControls }) => {
21276
21340
  visibleLists,
21277
21341
  codeElementVisible,
21278
21342
  quoteElementVisible,
21279
- visibleElementsWithIcons
21343
+ visibleElementsWithIcons,
21344
+ visibleInsertElementsWithIcons,
21345
+ tableElementVisible
21280
21346
  } = useRichTextToolbarState({ config });
21281
21347
  const onSelectElement = (type) => {
21282
21348
  if (activeElement === type) {
21283
21349
  return;
21284
21350
  }
21285
- editor.update(() => {
21286
- const selection = $getSelection3();
21287
- if (!$isRangeSelection3(selection)) {
21288
- return;
21289
- }
21290
- if (HEADING_ELEMENTS.includes(type)) {
21291
- $setBlocksType(selection, () => $createHeadingNode(type));
21292
- } else if (type === "paragraph") {
21293
- $setBlocksType(selection, () => $createParagraphNode());
21294
- } else if (type === "quote") {
21295
- $setBlocksType(selection, () => $createQuoteNode());
21296
- } else if (type === "code") {
21297
- $setBlocksType(selection, () => $createCodeNode());
21298
- }
21351
+ editor.focus(() => {
21352
+ editor.update(() => {
21353
+ const selection = $getSelection3();
21354
+ if (HEADING_ELEMENTS.includes(type)) {
21355
+ $setBlocksType(selection, () => $createHeadingNode(type));
21356
+ } else if (type === "paragraph") {
21357
+ $setBlocksType(selection, () => $createParagraphNode());
21358
+ } else if (type === "quote") {
21359
+ $setBlocksType(selection, () => $createQuoteNode());
21360
+ } else if (type === "code") {
21361
+ $setBlocksType(selection, () => $createCodeNode());
21362
+ } else if (type === "table" && onInsertTable) {
21363
+ onInsertTable().then((dimensions) => {
21364
+ if (!dimensions) {
21365
+ return;
21366
+ }
21367
+ const { rows, columns } = dimensions;
21368
+ editor.focus(() => {
21369
+ editor.update(() => {
21370
+ $insertNodes([$createTableNodeWithDimensions(rows, columns, false)]);
21371
+ });
21372
+ });
21373
+ });
21374
+ }
21375
+ });
21299
21376
  });
21300
21377
  };
21301
21378
  const updateToolbar = useCallback11(() => {
@@ -21360,8 +21437,7 @@ var RichTextToolbar = ({ config, customControls }) => {
21360
21437
  /* @__PURE__ */ jsxs86(
21361
21438
  Menu,
21362
21439
  {
21363
- menuLabel: "Elements",
21364
- menuTrigger: /* @__PURE__ */ jsxs86("button", { css: richTextToolbarButton, title: "Text styles", children: [
21440
+ menuTrigger: /* @__PURE__ */ jsxs86("button", { css: [richTextToolbarButton, textStyleButton], title: "Text styles", children: [
21365
21441
  visibleTextualElements.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
21366
21442
  " ",
21367
21443
  /* @__PURE__ */ jsx130(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
@@ -21421,7 +21497,7 @@ var RichTextToolbar = ({ config, customControls }) => {
21421
21497
  }
21422
21498
  ) : null
21423
21499
  ] }) : null,
21424
- visibleElementsWithIcons.size > 0 ? /* @__PURE__ */ jsxs86("div", { css: toolbarGroup, children: [
21500
+ visibleElementsWithIcons.size > 0 || customControls ? /* @__PURE__ */ jsxs86("div", { css: toolbarGroup, children: [
21425
21501
  linkElementVisible ? /* @__PURE__ */ jsx130(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ jsx130(
21426
21502
  "button",
21427
21503
  {
@@ -21460,28 +21536,50 @@ var RichTextToolbar = ({ config, customControls }) => {
21460
21536
  }
21461
21537
  ) }) : null
21462
21538
  ] }) : null,
21463
- quoteElementVisible ? /* @__PURE__ */ jsx130(Tooltip, { title: "Blockquote", placement: "top", children: /* @__PURE__ */ jsx130(
21464
- "button",
21465
- {
21466
- onClick: () => {
21467
- activeElement === "quote" ? onSelectElement("paragraph") : onSelectElement("quote");
21468
- },
21469
- css: [richTextToolbarButton, activeElement === "quote" ? richTextToolbarButtonActive : null],
21470
- children: /* @__PURE__ */ jsx130(RichTextToolbarIcon, { icon: "quote" })
21471
- }
21472
- ) }) : null,
21473
- codeElementVisible ? /* @__PURE__ */ jsx130(Tooltip, { title: "Code Block", placement: "top", children: /* @__PURE__ */ jsx130(
21474
- "button",
21475
- {
21476
- onClick: () => {
21477
- activeElement === "code" ? onSelectElement("paragraph") : onSelectElement("code");
21478
- },
21479
- css: [richTextToolbarButton, activeElement === "code" ? richTextToolbarButtonActive : null],
21480
- children: /* @__PURE__ */ jsx130(RichTextToolbarIcon, { icon: "code-slash" })
21481
- }
21482
- ) }) : null
21539
+ customControls ? customControls : null
21483
21540
  ] }) : null,
21484
- customControls ? /* @__PURE__ */ jsx130("div", { css: toolbarGroup, children: customControls }) : null
21541
+ visibleInsertElementsWithIcons.size > 0 ? /* @__PURE__ */ jsx130("div", { css: toolbarGroup, children: /* @__PURE__ */ jsxs86(
21542
+ Menu,
21543
+ {
21544
+ menuTrigger: /* @__PURE__ */ jsxs86("button", { css: richTextToolbarButton, title: "Insert block element", children: [
21545
+ "Insert",
21546
+ /* @__PURE__ */ jsx130(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
21547
+ ] }),
21548
+ placement: "bottom-start",
21549
+ children: [
21550
+ quoteElementVisible ? /* @__PURE__ */ jsx130(
21551
+ MenuItem,
21552
+ {
21553
+ onClick: () => {
21554
+ onSelectElement("quote");
21555
+ },
21556
+ icon: /* @__PURE__ */ jsx130(Icon, { icon: "quote", iconColor: "currentColor" }),
21557
+ children: "Quote"
21558
+ }
21559
+ ) : null,
21560
+ codeElementVisible ? /* @__PURE__ */ jsx130(
21561
+ MenuItem,
21562
+ {
21563
+ onClick: () => {
21564
+ onSelectElement("code");
21565
+ },
21566
+ icon: /* @__PURE__ */ jsx130(Icon, { icon: "code-slash", iconColor: "currentColor" }),
21567
+ children: "Code"
21568
+ }
21569
+ ) : null,
21570
+ tableElementVisible && onInsertTable !== void 0 ? /* @__PURE__ */ jsx130(
21571
+ MenuItem,
21572
+ {
21573
+ onClick: () => {
21574
+ onSelectElement("table");
21575
+ },
21576
+ icon: /* @__PURE__ */ jsx130(Icon, { icon: "view-grid", iconColor: "currentColor" }),
21577
+ children: "Table"
21578
+ }
21579
+ ) : null
21580
+ ]
21581
+ }
21582
+ ) }) : null
21485
21583
  ] });
21486
21584
  };
21487
21585
  var RichTextToolbar_default = RichTextToolbar;
@@ -21558,6 +21656,9 @@ var useRichTextToolbarState = ({ config }) => {
21558
21656
  const codeElementVisible = useMemo6(() => {
21559
21657
  return enabledBuiltInElements.some((element) => element.type === "code") || activeElement === "code";
21560
21658
  }, [activeElement, enabledBuiltInElements]);
21659
+ const tableElementVisible = useMemo6(() => {
21660
+ return enabledBuiltInElements.some((element) => element.type === "table") || activeElement === "table";
21661
+ }, [activeElement, enabledBuiltInElements]);
21561
21662
  const visibleElementsWithIcons = useMemo6(() => {
21562
21663
  const visibleElements = /* @__PURE__ */ new Set();
21563
21664
  if (linkElementVisible) {
@@ -21568,14 +21669,21 @@ var useRichTextToolbarState = ({ config }) => {
21568
21669
  visibleElements.add(type);
21569
21670
  });
21570
21671
  }
21672
+ return visibleElements;
21673
+ }, [linkElementVisible, visibleLists]);
21674
+ const visibleInsertElementsWithIcons = useMemo6(() => {
21675
+ const visibleElements = /* @__PURE__ */ new Set();
21571
21676
  if (quoteElementVisible) {
21572
21677
  visibleElements.add("quote");
21573
21678
  }
21574
21679
  if (codeElementVisible) {
21575
21680
  visibleElements.add("code");
21576
21681
  }
21682
+ if (tableElementVisible) {
21683
+ visibleElements.add("table");
21684
+ }
21577
21685
  return visibleElements;
21578
- }, [codeElementVisible, linkElementVisible, quoteElementVisible, visibleLists]);
21686
+ }, [codeElementVisible, quoteElementVisible, tableElementVisible]);
21579
21687
  return {
21580
21688
  activeFormats,
21581
21689
  setActiveFormats,
@@ -21590,12 +21698,718 @@ var useRichTextToolbarState = ({ config }) => {
21590
21698
  visibleLists,
21591
21699
  quoteElementVisible,
21592
21700
  codeElementVisible,
21593
- visibleElementsWithIcons
21701
+ tableElementVisible,
21702
+ visibleElementsWithIcons,
21703
+ visibleInsertElementsWithIcons
21594
21704
  };
21595
21705
  };
21596
21706
 
21707
+ // src/components/ParameterInputs/rich-text/TableActionMenuPlugin.tsx
21708
+ import { css as css98 } from "@emotion/react";
21709
+ import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
21710
+ import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
21711
+ import {
21712
+ $deleteTableColumn__EXPERIMENTAL,
21713
+ $deleteTableRow__EXPERIMENTAL,
21714
+ $getTableCellNodeFromLexicalNode,
21715
+ $getTableColumnIndexFromTableCellNode,
21716
+ $getTableNodeFromLexicalNodeOrThrow,
21717
+ $getTableRowIndexFromTableCellNode,
21718
+ $insertTableColumn__EXPERIMENTAL,
21719
+ $insertTableRow__EXPERIMENTAL,
21720
+ $isTableCellNode,
21721
+ $isTableRowNode,
21722
+ $isTableSelection,
21723
+ getTableObserverFromTableElement,
21724
+ TableCellHeaderStates,
21725
+ TableCellNode
21726
+ } from "@lexical/table";
21727
+ import { $getRoot, $getSelection as $getSelection4, $isRangeSelection as $isRangeSelection4 } from "lexical";
21728
+ import { forwardRef as forwardRef22, useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect, useState as useState18 } from "react";
21729
+ import { jsx as jsx131, jsxs as jsxs87 } from "@emotion/react/jsx-runtime";
21730
+ function computeSelectionCount(selection) {
21731
+ const selectionShape = selection.getShape();
21732
+ return {
21733
+ columns: selectionShape.toX - selectionShape.fromX + 1,
21734
+ rows: selectionShape.toY - selectionShape.fromY + 1
21735
+ };
21736
+ }
21737
+ var tableActionMenuTrigger = css98`
21738
+ position: absolute;
21739
+ transform: translate(calc(-100% - 1px), 1px);
21740
+ `;
21741
+ var TableActionMenuTrigger = forwardRef22((props, ref) => {
21742
+ const { tableCellEl, positioningAnchorEl, ...rest } = props;
21743
+ const [coordinates, setCoordinates] = useState18({ x: 0, y: 0 });
21744
+ useLayoutEffect(() => {
21745
+ const rect = tableCellEl.getBoundingClientRect();
21746
+ const parentRect = positioningAnchorEl.getBoundingClientRect();
21747
+ const relativeX = rect.right - parentRect.left;
21748
+ const relativeY = rect.top - parentRect.top;
21749
+ setCoordinates({ x: relativeX, y: relativeY });
21750
+ }, [tableCellEl, positioningAnchorEl]);
21751
+ return /* @__PURE__ */ jsx131(
21752
+ IconButton,
21753
+ {
21754
+ ref,
21755
+ css: [
21756
+ tableActionMenuTrigger,
21757
+ {
21758
+ top: coordinates.y,
21759
+ left: coordinates.x
21760
+ }
21761
+ ],
21762
+ size: "xs",
21763
+ buttonType: "unimportant",
21764
+ ...rest,
21765
+ children: /* @__PURE__ */ jsx131(Icon, { icon: "chevron-down", size: "1rem", iconColor: "currentColor" })
21766
+ }
21767
+ );
21768
+ });
21769
+ TableActionMenuTrigger.displayName = "TableActionMenuTrigger";
21770
+ function TableActionMenu({
21771
+ tableCellNode: _tableCellNode,
21772
+ menuPortalEl,
21773
+ tableCellEl,
21774
+ positioningAnchorEl
21775
+ }) {
21776
+ const [editor] = useLexicalComposerContext5();
21777
+ const [tableCellNode, updateTableCellNode] = useState18(_tableCellNode);
21778
+ const [selectionCounts, updateSelectionCounts] = useState18({
21779
+ columns: 1,
21780
+ rows: 1
21781
+ });
21782
+ const [menuTriggerKey, setMenuTriggerKey] = useState18(0);
21783
+ const incrementMenuTriggerKey = () => {
21784
+ setMenuTriggerKey((key) => key += 1);
21785
+ };
21786
+ useEffect21(() => {
21787
+ return editor.registerMutationListener(
21788
+ TableCellNode,
21789
+ (nodeMutations) => {
21790
+ const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
21791
+ if (nodeUpdated) {
21792
+ editor.getEditorState().read(() => {
21793
+ updateTableCellNode(tableCellNode.getLatest());
21794
+ });
21795
+ }
21796
+ },
21797
+ { skipInitialization: true }
21798
+ );
21799
+ }, [editor, tableCellNode]);
21800
+ useEffect21(() => {
21801
+ editor.getEditorState().read(() => {
21802
+ const selection = $getSelection4();
21803
+ if ($isTableSelection(selection)) {
21804
+ updateSelectionCounts(computeSelectionCount(selection));
21805
+ }
21806
+ });
21807
+ }, [editor]);
21808
+ const clearTableSelection = useCallback12(() => {
21809
+ editor.update(() => {
21810
+ if (tableCellNode.isAttached()) {
21811
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
21812
+ const tableElement2 = editor.getElementByKey(
21813
+ tableNode.getKey()
21814
+ );
21815
+ if (!tableElement2) {
21816
+ throw new Error("Expected to find tableElement in DOM");
21817
+ }
21818
+ const tableSelection = getTableObserverFromTableElement(tableElement2);
21819
+ if (tableSelection !== null) {
21820
+ tableSelection.clearHighlight();
21821
+ }
21822
+ tableNode.markDirty();
21823
+ updateTableCellNode(tableCellNode.getLatest());
21824
+ }
21825
+ const rootNode = $getRoot();
21826
+ rootNode.selectStart();
21827
+ });
21828
+ }, [editor, tableCellNode]);
21829
+ const insertTableRowAtSelection = useCallback12(
21830
+ (shouldInsertAfter) => {
21831
+ editor.update(() => {
21832
+ $insertTableRow__EXPERIMENTAL(shouldInsertAfter);
21833
+ });
21834
+ incrementMenuTriggerKey();
21835
+ },
21836
+ [editor]
21837
+ );
21838
+ const insertTableColumnAtSelection = useCallback12(
21839
+ (shouldInsertAfter) => {
21840
+ editor.update(() => {
21841
+ for (let i = 0; i < selectionCounts.columns; i++) {
21842
+ $insertTableColumn__EXPERIMENTAL(shouldInsertAfter);
21843
+ }
21844
+ });
21845
+ incrementMenuTriggerKey();
21846
+ },
21847
+ [editor, selectionCounts.columns]
21848
+ );
21849
+ const deleteTableRowAtSelection = useCallback12(() => {
21850
+ editor.update(() => {
21851
+ $deleteTableRow__EXPERIMENTAL();
21852
+ });
21853
+ incrementMenuTriggerKey();
21854
+ }, [editor]);
21855
+ const deleteTableAtSelection = useCallback12(() => {
21856
+ editor.update(() => {
21857
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
21858
+ tableNode.remove();
21859
+ clearTableSelection();
21860
+ });
21861
+ }, [editor, tableCellNode, clearTableSelection]);
21862
+ const deleteTableColumnAtSelection = useCallback12(() => {
21863
+ editor.update(() => {
21864
+ $deleteTableColumn__EXPERIMENTAL();
21865
+ clearTableSelection();
21866
+ });
21867
+ incrementMenuTriggerKey();
21868
+ }, [editor, clearTableSelection]);
21869
+ const toggleTableRowIsHeader = useCallback12(() => {
21870
+ editor.update(() => {
21871
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
21872
+ const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode);
21873
+ const tableRows = tableNode.getChildren();
21874
+ if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
21875
+ throw new Error("Expected table cell to be inside of table row.");
21876
+ }
21877
+ const tableRow2 = tableRows[tableRowIndex];
21878
+ if (!$isTableRowNode(tableRow2)) {
21879
+ throw new Error("Expected table row");
21880
+ }
21881
+ tableRow2.getChildren().forEach((tableCell) => {
21882
+ if (!$isTableCellNode(tableCell)) {
21883
+ throw new Error("Expected table cell");
21884
+ }
21885
+ tableCell.toggleHeaderStyle(TableCellHeaderStates.ROW);
21886
+ });
21887
+ clearTableSelection();
21888
+ });
21889
+ }, [editor, tableCellNode, clearTableSelection]);
21890
+ const toggleTableColumnIsHeader = useCallback12(() => {
21891
+ editor.update(() => {
21892
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
21893
+ const tableColumnIndex = $getTableColumnIndexFromTableCellNode(tableCellNode);
21894
+ const tableRows = tableNode.getChildren();
21895
+ const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length));
21896
+ if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {
21897
+ throw new Error("Expected table cell to be inside of table row.");
21898
+ }
21899
+ for (let r = 0; r < tableRows.length; r++) {
21900
+ const tableRow2 = tableRows[r];
21901
+ if (!$isTableRowNode(tableRow2)) {
21902
+ throw new Error("Expected table row");
21903
+ }
21904
+ const tableCells = tableRow2.getChildren();
21905
+ if (tableColumnIndex >= tableCells.length) {
21906
+ continue;
21907
+ }
21908
+ const tableCell = tableCells[tableColumnIndex];
21909
+ if (!$isTableCellNode(tableCell)) {
21910
+ throw new Error("Expected table cell");
21911
+ }
21912
+ tableCell.toggleHeaderStyle(TableCellHeaderStates.COLUMN);
21913
+ }
21914
+ clearTableSelection();
21915
+ });
21916
+ }, [editor, tableCellNode, clearTableSelection]);
21917
+ const menuItemCss = css98({
21918
+ fontSize: "var(--fs-sm)"
21919
+ });
21920
+ return /* @__PURE__ */ jsxs87(
21921
+ Menu,
21922
+ {
21923
+ menuTrigger: /* @__PURE__ */ jsx131(
21924
+ TableActionMenuTrigger,
21925
+ {
21926
+ tableCellEl,
21927
+ positioningAnchorEl
21928
+ },
21929
+ menuTriggerKey
21930
+ ),
21931
+ portalElement: menuPortalEl,
21932
+ maxMenuHeight: "300px",
21933
+ children: [
21934
+ /* @__PURE__ */ jsxs87(
21935
+ MenuItem,
21936
+ {
21937
+ onClick: () => {
21938
+ insertTableRowAtSelection(false);
21939
+ },
21940
+ css: menuItemCss,
21941
+ children: [
21942
+ "Insert ",
21943
+ selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
21944
+ " above"
21945
+ ]
21946
+ }
21947
+ ),
21948
+ /* @__PURE__ */ jsxs87(MenuItem, { onClick: () => insertTableRowAtSelection(true), css: menuItemCss, children: [
21949
+ "Insert ",
21950
+ selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
21951
+ " below"
21952
+ ] }),
21953
+ /* @__PURE__ */ jsx131(MenuItemSeparator, {}),
21954
+ /* @__PURE__ */ jsxs87(MenuItem, { onClick: () => insertTableColumnAtSelection(false), css: menuItemCss, children: [
21955
+ "Insert ",
21956
+ selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
21957
+ " left"
21958
+ ] }),
21959
+ /* @__PURE__ */ jsxs87(MenuItem, { onClick: () => insertTableColumnAtSelection(true), css: menuItemCss, children: [
21960
+ "Insert ",
21961
+ selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
21962
+ " right"
21963
+ ] }),
21964
+ /* @__PURE__ */ jsx131(MenuItemSeparator, {}),
21965
+ /* @__PURE__ */ jsx131(MenuItem, { onClick: () => deleteTableColumnAtSelection(), css: menuItemCss, children: "Delete column" }),
21966
+ /* @__PURE__ */ jsx131(MenuItem, { onClick: () => deleteTableRowAtSelection(), css: menuItemCss, children: "Delete row" }),
21967
+ /* @__PURE__ */ jsx131(MenuItem, { onClick: () => deleteTableAtSelection(), css: menuItemCss, children: "Delete table" }),
21968
+ /* @__PURE__ */ jsx131(MenuItemSeparator, {}),
21969
+ /* @__PURE__ */ jsxs87(MenuItem, { onClick: () => toggleTableRowIsHeader(), css: menuItemCss, children: [
21970
+ (tableCellNode.__headerState & TableCellHeaderStates.ROW) === TableCellHeaderStates.ROW ? "Remove" : "Add",
21971
+ " ",
21972
+ "row header"
21973
+ ] }),
21974
+ /* @__PURE__ */ jsxs87(MenuItem, { onClick: () => toggleTableColumnIsHeader(), css: menuItemCss, children: [
21975
+ (tableCellNode.__headerState & TableCellHeaderStates.COLUMN) === TableCellHeaderStates.COLUMN ? "Remove" : "Add",
21976
+ " ",
21977
+ "column header"
21978
+ ] })
21979
+ ]
21980
+ }
21981
+ );
21982
+ }
21983
+ function TableCellActionMenuContainer({
21984
+ menuPortalEl,
21985
+ positioningAnchorEl
21986
+ }) {
21987
+ const [editor] = useLexicalComposerContext5();
21988
+ const [tableCellNode, setTableMenuCellNode] = useState18(null);
21989
+ const [tableCellNodeEl, _setTableMenuCellNodeEl] = useState18(null);
21990
+ const [tableCellMenuPortalEl, setTableMenuCellMenuPortalEl] = useState18(null);
21991
+ useEffect21(() => {
21992
+ const newPortalEl = document.createElement("div");
21993
+ setTableMenuCellMenuPortalEl(newPortalEl);
21994
+ menuPortalEl.appendChild(newPortalEl);
21995
+ return () => {
21996
+ newPortalEl.remove();
21997
+ };
21998
+ }, [menuPortalEl]);
21999
+ const setTableMenuCellNodeElem = useCallback12((elem) => {
22000
+ if (elem) {
22001
+ _setTableMenuCellNodeEl(elem);
22002
+ } else {
22003
+ _setTableMenuCellNodeEl(null);
22004
+ }
22005
+ }, []);
22006
+ const $moveMenu = useCallback12(() => {
22007
+ const selection = $getSelection4();
22008
+ const nativeSelection = window.getSelection();
22009
+ const activeElement = document.activeElement;
22010
+ if (selection == null) {
22011
+ setTableMenuCellNode(null);
22012
+ return;
22013
+ }
22014
+ const rootElement = editor.getRootElement();
22015
+ if ($isRangeSelection4(selection) && rootElement !== null && nativeSelection !== null && rootElement.contains(nativeSelection.anchorNode)) {
22016
+ const tableCellNodeFromSelection = $getTableCellNodeFromLexicalNode(selection.anchor.getNode());
22017
+ if (tableCellNodeFromSelection == null) {
22018
+ setTableMenuCellNode(null);
22019
+ setTableMenuCellNodeElem(null);
22020
+ return;
22021
+ }
22022
+ const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
22023
+ if (tableCellParentNodeDOM == null) {
22024
+ setTableMenuCellNode(null);
22025
+ setTableMenuCellNodeElem(null);
22026
+ return;
22027
+ }
22028
+ setTableMenuCellNode(tableCellNodeFromSelection);
22029
+ setTableMenuCellNodeElem(tableCellParentNodeDOM);
22030
+ } else if (!activeElement) {
22031
+ setTableMenuCellNode(null);
22032
+ setTableMenuCellNodeElem(null);
22033
+ }
22034
+ }, [editor, setTableMenuCellNodeElem]);
22035
+ useEffect21(() => {
22036
+ return editor.registerUpdateListener(() => {
22037
+ editor.getEditorState().read(() => {
22038
+ $moveMenu();
22039
+ });
22040
+ });
22041
+ });
22042
+ return tableCellNode != null && tableCellNodeEl != null && tableCellMenuPortalEl != null && /* @__PURE__ */ jsx131(
22043
+ TableActionMenu,
22044
+ {
22045
+ tableCellNode,
22046
+ menuPortalEl: tableCellMenuPortalEl,
22047
+ tableCellEl: tableCellNodeEl,
22048
+ positioningAnchorEl
22049
+ },
22050
+ tableCellNode.getKey()
22051
+ );
22052
+ }
22053
+ function TableActionMenuPlugin({ positioningAnchorEl }) {
22054
+ const isEditable = useLexicalEditable();
22055
+ return isEditable ? /* @__PURE__ */ jsx131(
22056
+ TableCellActionMenuContainer,
22057
+ {
22058
+ menuPortalEl: positioningAnchorEl,
22059
+ positioningAnchorEl
22060
+ }
22061
+ ) : null;
22062
+ }
22063
+
22064
+ // src/components/ParameterInputs/rich-text/TableCellResizerPlugin.tsx
22065
+ import { css as css99 } from "@emotion/react";
22066
+ import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexical/react/LexicalComposerContext";
22067
+ import { useLexicalEditable as useLexicalEditable2 } from "@lexical/react/useLexicalEditable";
22068
+ import {
22069
+ $computeTableMapSkipCellCheck,
22070
+ $getTableNodeFromLexicalNodeOrThrow as $getTableNodeFromLexicalNodeOrThrow2,
22071
+ $getTableRowIndexFromTableCellNode as $getTableRowIndexFromTableCellNode2,
22072
+ $isTableCellNode as $isTableCellNode2,
22073
+ $isTableRowNode as $isTableRowNode2
22074
+ } from "@lexical/table";
22075
+ import { calculateZoomLevel } from "@lexical/utils";
22076
+ import { $getNearestNodeFromDOMNode } from "lexical";
22077
+ import { useCallback as useCallback13, useEffect as useEffect22, useMemo as useMemo7, useRef as useRef12, useState as useState19 } from "react";
22078
+ import { createPortal as createPortal3 } from "react-dom";
22079
+ import { Fragment as Fragment20, jsx as jsx132, jsxs as jsxs88 } from "@emotion/react/jsx-runtime";
22080
+ var MIN_ROW_HEIGHT = 33;
22081
+ var MIN_COLUMN_WIDTH = 50;
22082
+ var tableResizer = css99`
22083
+ position: absolute;
22084
+ z-index: var(--z-10);
22085
+ `;
22086
+ var fixedGetDOMCellFromTarget = (node) => {
22087
+ let currentNode = node;
22088
+ while (currentNode != null) {
22089
+ const nodeName = currentNode.nodeName;
22090
+ if (nodeName === "TD" || nodeName === "TH") {
22091
+ const cell2 = currentNode._cell;
22092
+ if (cell2 === void 0) {
22093
+ return {
22094
+ elem: currentNode
22095
+ };
22096
+ }
22097
+ return cell2;
22098
+ }
22099
+ currentNode = currentNode.parentNode;
22100
+ }
22101
+ return null;
22102
+ };
22103
+ function TableCellResizer({ editor, positioningAnchorEl }) {
22104
+ const targetRef = useRef12(null);
22105
+ const resizerRef = useRef12(null);
22106
+ const tableRectRef = useRef12(null);
22107
+ const mouseStartPosRef = useRef12(null);
22108
+ const [mouseCurrentPos, updateMouseCurrentPos] = useState19(null);
22109
+ const [activeCell, updateActiveCell] = useState19(null);
22110
+ const [isMouseDown, updateIsMouseDown] = useState19(false);
22111
+ const [draggingDirection, updateDraggingDirection] = useState19(null);
22112
+ const resetState = useCallback13(() => {
22113
+ updateActiveCell(null);
22114
+ targetRef.current = null;
22115
+ updateDraggingDirection(null);
22116
+ mouseStartPosRef.current = null;
22117
+ tableRectRef.current = null;
22118
+ }, []);
22119
+ const isMouseDownOnEvent = (event) => {
22120
+ return (event.buttons & 1) === 1;
22121
+ };
22122
+ useEffect22(() => {
22123
+ const onMouseMove = (event) => {
22124
+ setTimeout(() => {
22125
+ const target = event.target;
22126
+ if (draggingDirection) {
22127
+ updateMouseCurrentPos({
22128
+ x: event.clientX,
22129
+ y: event.clientY
22130
+ });
22131
+ return;
22132
+ }
22133
+ updateIsMouseDown(isMouseDownOnEvent(event));
22134
+ if (resizerRef.current && resizerRef.current.contains(target)) {
22135
+ return;
22136
+ }
22137
+ if (targetRef.current !== target) {
22138
+ targetRef.current = target;
22139
+ const cell2 = fixedGetDOMCellFromTarget(target);
22140
+ if (cell2 && activeCell !== cell2) {
22141
+ editor.update(() => {
22142
+ const tableCellNode = $getNearestNodeFromDOMNode(cell2.elem);
22143
+ if (!tableCellNode) {
22144
+ throw new Error("TableCellResizer: Table cell node not found.");
22145
+ }
22146
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow2(tableCellNode);
22147
+ const tableElement2 = editor.getElementByKey(tableNode.getKey());
22148
+ if (!tableElement2) {
22149
+ throw new Error("TableCellResizer: Table element not found.");
22150
+ }
22151
+ targetRef.current = target;
22152
+ tableRectRef.current = tableElement2.getBoundingClientRect();
22153
+ updateActiveCell(cell2);
22154
+ });
22155
+ } else if (cell2 == null) {
22156
+ resetState();
22157
+ }
22158
+ }
22159
+ }, 0);
22160
+ };
22161
+ const onMouseDown = () => {
22162
+ setTimeout(() => {
22163
+ updateIsMouseDown(true);
22164
+ }, 0);
22165
+ };
22166
+ const onMouseUp = () => {
22167
+ setTimeout(() => {
22168
+ updateIsMouseDown(false);
22169
+ }, 0);
22170
+ };
22171
+ const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {
22172
+ rootElement == null ? void 0 : rootElement.addEventListener("mousemove", onMouseMove);
22173
+ rootElement == null ? void 0 : rootElement.addEventListener("mousedown", onMouseDown);
22174
+ rootElement == null ? void 0 : rootElement.addEventListener("mouseup", onMouseUp);
22175
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousemove", onMouseMove);
22176
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousedown", onMouseDown);
22177
+ prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mouseup", onMouseUp);
22178
+ });
22179
+ return () => {
22180
+ removeRootListener();
22181
+ };
22182
+ }, [activeCell, draggingDirection, editor, resetState]);
22183
+ const isHeightChanging = (direction) => {
22184
+ if (direction === "bottom") {
22185
+ return true;
22186
+ }
22187
+ return false;
22188
+ };
22189
+ const updateRowHeight = useCallback13(
22190
+ (heightChange) => {
22191
+ if (!activeCell) {
22192
+ throw new Error("TableCellResizer: Expected active cell.");
22193
+ }
22194
+ editor.update(
22195
+ () => {
22196
+ const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);
22197
+ if (!$isTableCellNode2(tableCellNode)) {
22198
+ throw new Error("TableCellResizer: Table cell node not found.");
22199
+ }
22200
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow2(tableCellNode);
22201
+ const tableRowIndex = $getTableRowIndexFromTableCellNode2(tableCellNode);
22202
+ const tableRows = tableNode.getChildren();
22203
+ if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
22204
+ throw new Error("Expected table cell to be inside of table row.");
22205
+ }
22206
+ const tableRow2 = tableRows[tableRowIndex];
22207
+ if (!$isTableRowNode2(tableRow2)) {
22208
+ throw new Error("Expected table row");
22209
+ }
22210
+ let height = tableRow2.getHeight();
22211
+ if (height === void 0) {
22212
+ const rowCells = tableRow2.getChildren();
22213
+ height = Math.min(...rowCells.map((cell2) => {
22214
+ var _a;
22215
+ return (_a = getCellNodeHeight(cell2, editor)) != null ? _a : Infinity;
22216
+ }));
22217
+ }
22218
+ const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);
22219
+ tableRow2.setHeight(newHeight);
22220
+ },
22221
+ { tag: "skip-scroll-into-view" }
22222
+ );
22223
+ },
22224
+ [activeCell, editor]
22225
+ );
22226
+ const getCellNodeWidth = (cell2, activeEditor) => {
22227
+ const width = cell2.getWidth();
22228
+ if (width !== void 0) {
22229
+ return width;
22230
+ }
22231
+ const domCellNode = activeEditor.getElementByKey(cell2.getKey());
22232
+ if (domCellNode == null) {
22233
+ return void 0;
22234
+ }
22235
+ const computedStyle = getComputedStyle(domCellNode);
22236
+ return domCellNode.clientWidth - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight);
22237
+ };
22238
+ const getCellNodeHeight = (cell2, activeEditor) => {
22239
+ const domCellNode = activeEditor.getElementByKey(cell2.getKey());
22240
+ return domCellNode == null ? void 0 : domCellNode.clientHeight;
22241
+ };
22242
+ const getCellColumnIndex = (tableCellNode, tableMap) => {
22243
+ for (let row = 0; row < tableMap.length; row++) {
22244
+ for (let column = 0; column < tableMap[row].length; column++) {
22245
+ if (tableMap[row][column].cell === tableCellNode) {
22246
+ return column;
22247
+ }
22248
+ }
22249
+ }
22250
+ };
22251
+ const updateColumnWidth = useCallback13(
22252
+ (widthChange) => {
22253
+ if (!activeCell) {
22254
+ throw new Error("TableCellResizer: Expected active cell.");
22255
+ }
22256
+ editor.update(
22257
+ () => {
22258
+ const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);
22259
+ if (!$isTableCellNode2(tableCellNode)) {
22260
+ throw new Error("TableCellResizer: Table cell node not found.");
22261
+ }
22262
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow2(tableCellNode);
22263
+ const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);
22264
+ const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
22265
+ if (columnIndex === void 0) {
22266
+ throw new Error("TableCellResizer: Table column not found.");
22267
+ }
22268
+ for (let row = 0; row < tableMap.length; row++) {
22269
+ const cell2 = tableMap[row][columnIndex];
22270
+ if (cell2.startRow === row && (columnIndex === tableMap[row].length - 1 || tableMap[row][columnIndex].cell !== tableMap[row][columnIndex + 1].cell)) {
22271
+ const width = getCellNodeWidth(cell2.cell, editor);
22272
+ if (width === void 0) {
22273
+ continue;
22274
+ }
22275
+ const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);
22276
+ cell2.cell.setWidth(newWidth);
22277
+ }
22278
+ }
22279
+ },
22280
+ { tag: "skip-scroll-into-view" }
22281
+ );
22282
+ },
22283
+ [activeCell, editor]
22284
+ );
22285
+ const mouseUpHandler = useCallback13(
22286
+ (direction) => {
22287
+ const handler = (event) => {
22288
+ event.preventDefault();
22289
+ event.stopPropagation();
22290
+ if (!activeCell) {
22291
+ throw new Error("TableCellResizer: Expected active cell.");
22292
+ }
22293
+ if (mouseStartPosRef.current) {
22294
+ const { x, y } = mouseStartPosRef.current;
22295
+ if (activeCell === null) {
22296
+ return;
22297
+ }
22298
+ const zoom = calculateZoomLevel(event.target);
22299
+ if (isHeightChanging(direction)) {
22300
+ const heightChange = (event.clientY - y) / zoom;
22301
+ updateRowHeight(heightChange);
22302
+ } else {
22303
+ const widthChange = (event.clientX - x) / zoom;
22304
+ updateColumnWidth(widthChange);
22305
+ }
22306
+ resetState();
22307
+ document.removeEventListener("mouseup", handler);
22308
+ }
22309
+ };
22310
+ return handler;
22311
+ },
22312
+ [activeCell, resetState, updateColumnWidth, updateRowHeight]
22313
+ );
22314
+ const toggleResize = useCallback13(
22315
+ (direction) => (event) => {
22316
+ event.preventDefault();
22317
+ event.stopPropagation();
22318
+ if (!activeCell) {
22319
+ throw new Error("TableCellResizer: Expected active cell.");
22320
+ }
22321
+ mouseStartPosRef.current = {
22322
+ x: event.clientX,
22323
+ y: event.clientY
22324
+ };
22325
+ updateMouseCurrentPos(mouseStartPosRef.current);
22326
+ updateDraggingDirection(direction);
22327
+ document.addEventListener("mouseup", mouseUpHandler(direction));
22328
+ },
22329
+ [activeCell, mouseUpHandler]
22330
+ );
22331
+ const getResizers = useCallback13(() => {
22332
+ if (activeCell) {
22333
+ const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
22334
+ const parentRect = positioningAnchorEl.getBoundingClientRect();
22335
+ const zoom = calculateZoomLevel(activeCell.elem);
22336
+ const zoneWidth = 10;
22337
+ const styles = {
22338
+ bottom: {
22339
+ backgroundColor: "none",
22340
+ cursor: "row-resize",
22341
+ height: `${zoneWidth}px`,
22342
+ left: `${left - parentRect.left}px`,
22343
+ top: `${top - parentRect.top + height - zoneWidth / 2}px`,
22344
+ width: `${width}px`
22345
+ },
22346
+ right: {
22347
+ backgroundColor: "none",
22348
+ cursor: "col-resize",
22349
+ height: `${height}px`,
22350
+ left: `${left - parentRect.left + width - zoneWidth / 2}px`,
22351
+ top: `${top - parentRect.top}px`,
22352
+ width: `${zoneWidth}px`
22353
+ }
22354
+ };
22355
+ const tableRect = tableRectRef.current;
22356
+ if (draggingDirection && mouseCurrentPos && tableRect) {
22357
+ if (isHeightChanging(draggingDirection)) {
22358
+ styles[draggingDirection].left = `${tableRect.left - parentRect.left}px`;
22359
+ styles[draggingDirection].top = `${(mouseCurrentPos.y - parentRect.top) / zoom}px`;
22360
+ styles[draggingDirection].height = "3px";
22361
+ styles[draggingDirection].width = `${tableRect.width}px`;
22362
+ } else {
22363
+ styles[draggingDirection].top = `${tableRect.top - parentRect.top}px`;
22364
+ styles[draggingDirection].left = `${(mouseCurrentPos.x - parentRect.left) / zoom}px`;
22365
+ styles[draggingDirection].width = "3px";
22366
+ styles[draggingDirection].height = `${tableRect.height}px`;
22367
+ }
22368
+ styles[draggingDirection].backgroundColor = "#adf";
22369
+ }
22370
+ return styles;
22371
+ }
22372
+ return {
22373
+ bottom: null,
22374
+ left: null,
22375
+ right: null,
22376
+ top: null
22377
+ };
22378
+ }, [activeCell, draggingDirection, mouseCurrentPos, positioningAnchorEl]);
22379
+ const resizerStyles = getResizers();
22380
+ return /* @__PURE__ */ jsx132("div", { ref: resizerRef, children: activeCell != null && !isMouseDown && /* @__PURE__ */ jsxs88(Fragment20, { children: [
22381
+ /* @__PURE__ */ jsx132(
22382
+ "div",
22383
+ {
22384
+ css: tableResizer,
22385
+ style: resizerStyles.right || void 0,
22386
+ onMouseDown: toggleResize("right")
22387
+ }
22388
+ ),
22389
+ /* @__PURE__ */ jsx132(
22390
+ "div",
22391
+ {
22392
+ css: tableResizer,
22393
+ style: resizerStyles.bottom || void 0,
22394
+ onMouseDown: toggleResize("bottom")
22395
+ }
22396
+ )
22397
+ ] }) });
22398
+ }
22399
+ function TableCellResizerPlugin({ positioningAnchorEl }) {
22400
+ const [editor] = useLexicalComposerContext6();
22401
+ const isEditable = useLexicalEditable2();
22402
+ return useMemo7(
22403
+ () => isEditable ? createPortal3(
22404
+ /* @__PURE__ */ jsx132(TableCellResizer, { editor, positioningAnchorEl }),
22405
+ positioningAnchorEl
22406
+ ) : null,
22407
+ [editor, isEditable, positioningAnchorEl]
22408
+ );
22409
+ }
22410
+
21597
22411
  // src/components/ParameterInputs/ParameterRichText.tsx
21598
- import { Fragment as Fragment20, jsx as jsx131, jsxs as jsxs87 } from "@emotion/react/jsx-runtime";
22412
+ import { Fragment as Fragment21, jsx as jsx133, jsxs as jsxs89 } from "@emotion/react/jsx-runtime";
21599
22413
  var ParameterRichText = ({
21600
22414
  label,
21601
22415
  labelLeadingIcon,
@@ -21614,13 +22428,16 @@ var ParameterRichText = ({
21614
22428
  readOnly,
21615
22429
  editorWrapperClassName,
21616
22430
  editorInputClassName,
22431
+ editorInputWrapperClassName,
21617
22432
  editorFooter,
21618
22433
  customNodes,
21619
22434
  children,
21620
22435
  variables,
21621
- customControls
22436
+ customControls,
22437
+ onInsertTable,
22438
+ minimalInteractivity
21622
22439
  }) => {
21623
- return /* @__PURE__ */ jsxs87(
22440
+ return /* @__PURE__ */ jsxs89(
21624
22441
  ParameterShell,
21625
22442
  {
21626
22443
  "data-testid": "parameter-richtext",
@@ -21634,7 +22451,7 @@ var ParameterRichText = ({
21634
22451
  captionTestId,
21635
22452
  menuItems,
21636
22453
  children: [
21637
- /* @__PURE__ */ jsx131(
22454
+ /* @__PURE__ */ jsx133(
21638
22455
  ParameterRichTextInner,
21639
22456
  {
21640
22457
  value,
@@ -21645,30 +22462,33 @@ var ParameterRichText = ({
21645
22462
  readOnly,
21646
22463
  editorWrapperClassName,
21647
22464
  editorInputClassName,
22465
+ editorInputWrapperClassName,
21648
22466
  editorFooter,
21649
22467
  customNodes,
21650
22468
  variables,
21651
22469
  customControls,
22470
+ onInsertTable,
22471
+ minimalInteractivity,
21652
22472
  children
21653
22473
  }
21654
22474
  ),
21655
- menuItems ? /* @__PURE__ */ jsx131(ParameterMenuButton, { label: `${label} menu`, children: /* @__PURE__ */ jsx131(Fragment20, { children: menuItems }) }) : null
22475
+ menuItems ? /* @__PURE__ */ jsx133(ParameterMenuButton, { label: `${label} menu`, children: /* @__PURE__ */ jsx133(Fragment21, { children: menuItems }) }) : null
21656
22476
  ]
21657
22477
  }
21658
22478
  );
21659
22479
  };
21660
- var editorWrapper = css98`
22480
+ var editorWrapper = css100`
21661
22481
  display: flex;
21662
22482
  flex-flow: column;
21663
22483
  flex-grow: 1;
21664
22484
  `;
21665
- var editorContainer = css98`
22485
+ var editorContainer = css100`
21666
22486
  display: flex;
21667
22487
  flex-flow: column;
21668
22488
  flex-grow: 1;
21669
22489
  position: relative;
21670
22490
  `;
21671
- var editorPlaceholder = css98`
22491
+ var editorPlaceholder = css100`
21672
22492
  color: var(--gray-500);
21673
22493
  font-style: italic;
21674
22494
  /* 1px is added to make sure caret is clearly visible when field is focused
@@ -21679,7 +22499,7 @@ var editorPlaceholder = css98`
21679
22499
  top: var(--spacing-sm);
21680
22500
  user-select: none;
21681
22501
  `;
21682
- var editorInput = css98`
22502
+ var editorInput = css100`
21683
22503
  background: var(--white);
21684
22504
  border: 1px solid var(--gray-200);
21685
22505
  border-radius: var(--rounded-sm);
@@ -21707,11 +22527,14 @@ var ParameterRichTextInner = ({
21707
22527
  readOnly,
21708
22528
  editorWrapperClassName,
21709
22529
  editorInputClassName,
22530
+ editorInputWrapperClassName,
21710
22531
  editorFooter,
21711
22532
  children,
21712
22533
  customNodes,
21713
22534
  variables,
21714
- customControls
22535
+ customControls,
22536
+ onInsertTable,
22537
+ minimalInteractivity
21715
22538
  }) => {
21716
22539
  const lexicalConfig = {
21717
22540
  namespace: "uniform",
@@ -21727,6 +22550,9 @@ var ParameterRichTextInner = ({
21727
22550
  QuoteNode,
21728
22551
  ParagraphNode2,
21729
22552
  CustomCodeNode,
22553
+ TableNode,
22554
+ TableCellNode2,
22555
+ TableRowNode2,
21730
22556
  ...customNodes != null ? customNodes : []
21731
22557
  ],
21732
22558
  theme: {
@@ -21759,12 +22585,15 @@ var ParameterRichTextInner = ({
21759
22585
  }
21760
22586
  },
21761
22587
  quote: blockquoteElement,
21762
- code: codeElement
22588
+ code: codeElement,
22589
+ table: tableElement,
22590
+ tableCell: tableCellElement,
22591
+ tableCellHeader: tableHeaderElement
21763
22592
  },
21764
22593
  editable: !readOnly
21765
22594
  };
21766
- return /* @__PURE__ */ jsxs87(Fragment20, { children: [
21767
- /* @__PURE__ */ jsx131("div", { css: [editorWrapper], className: editorWrapperClassName, children: /* @__PURE__ */ jsx131(LexicalComposer, { initialConfig: lexicalConfig, children: /* @__PURE__ */ jsx131(
22595
+ return /* @__PURE__ */ jsxs89(Fragment21, { children: [
22596
+ /* @__PURE__ */ jsx133("div", { css: [editorWrapper], className: editorWrapperClassName, children: /* @__PURE__ */ jsx133(LexicalComposer, { initialConfig: lexicalConfig, children: /* @__PURE__ */ jsx133(
21768
22597
  RichText,
21769
22598
  {
21770
22599
  onChange,
@@ -21773,8 +22602,11 @@ var ParameterRichTextInner = ({
21773
22602
  onRichTextInit,
21774
22603
  readOnly,
21775
22604
  editorInputClassName,
22605
+ editorInputWrapperClassName,
21776
22606
  variables,
21777
22607
  customControls,
22608
+ onInsertTable,
22609
+ minimalInteractivity,
21778
22610
  children
21779
22611
  }
21780
22612
  ) }) }),
@@ -21797,18 +22629,20 @@ var RichText = ({
21797
22629
  onRichTextInit,
21798
22630
  readOnly,
21799
22631
  editorInputClassName,
22632
+ editorInputWrapperClassName,
21800
22633
  children,
21801
22634
  variables,
21802
- customControls
22635
+ customControls,
22636
+ onInsertTable,
22637
+ minimalInteractivity
21803
22638
  }) => {
21804
- const editorContainerRef = useRef12(null);
21805
- const [editor] = useLexicalComposerContext5();
21806
- useEffect21(() => {
22639
+ const [editor] = useLexicalComposerContext7();
22640
+ useEffect23(() => {
21807
22641
  if (onRichTextInit) {
21808
22642
  onRichTextInit(editor);
21809
22643
  }
21810
22644
  }, [editor, onRichTextInit]);
21811
- useEffect21(() => {
22645
+ useEffect23(() => {
21812
22646
  const removeUpdateListener = editor.registerUpdateListener(({ editorState, prevEditorState }) => {
21813
22647
  requestAnimationFrame(() => {
21814
22648
  if (!deepEqual2(editorState.toJSON(), prevEditorState.toJSON())) {
@@ -21820,53 +22654,72 @@ var RichText = ({
21820
22654
  removeUpdateListener();
21821
22655
  };
21822
22656
  }, [editor, onChange]);
21823
- useEffect21(() => {
22657
+ useEffect23(() => {
21824
22658
  editor.setEditable(!readOnly);
21825
22659
  }, [editor, readOnly]);
21826
- return /* @__PURE__ */ jsxs87(Fragment20, { children: [
21827
- readOnly ? null : /* @__PURE__ */ jsx131(RichTextToolbar_default, { config, customControls }),
21828
- /* @__PURE__ */ jsxs87("div", { css: editorContainer, ref: editorContainerRef, "data-testid": "value-container", children: [
21829
- /* @__PURE__ */ jsx131(
21830
- RichTextPlugin,
21831
- {
21832
- contentEditable: /* @__PURE__ */ jsx131(ContentEditable, { css: editorInput, className: editorInputClassName }),
21833
- placeholder: /* @__PURE__ */ jsx131("div", { css: editorPlaceholder, children: readOnly ? "empty" : "start editing..." }),
21834
- ErrorBoundary: LexicalErrorBoundary
21835
- }
21836
- ),
21837
- /* @__PURE__ */ jsx131(ListPlugin, {}),
21838
- readOnly ? null : /* @__PURE__ */ jsx131(HistoryPlugin, {}),
21839
- /* @__PURE__ */ jsx131(
21840
- LinkNodePlugin,
21841
- {
21842
- onConnectLink: onConnectLink ? onConnectLink : () => Promise.resolve(),
21843
- getBoundPath: (variables == null ? void 0 : variables.bindVariables) ? (path) => {
21844
- var _a, _b;
21845
- return (_b = (_a = variables.bindVariables) == null ? void 0 : _a.call(variables, path)) != null ? _b : path;
21846
- } : void 0
21847
- }
21848
- ),
21849
- /* @__PURE__ */ jsx131(ListIndentPlugin, { maxDepth: 4 }),
21850
- /* @__PURE__ */ jsx131(DisableStylesPlugin, {}),
21851
- /* @__PURE__ */ jsx131(MarkdownShortcutPlugin, { transformers: MARKDOWN_TRANSFORMERS }),
21852
- /* @__PURE__ */ jsx131(Fragment20, { children })
21853
- ] })
22660
+ const [editorContainerRef, setEditorContainerRef] = useState20(null);
22661
+ const onRef = (_editorContainerRef) => {
22662
+ if (_editorContainerRef !== null) {
22663
+ setEditorContainerRef(_editorContainerRef);
22664
+ }
22665
+ };
22666
+ return /* @__PURE__ */ jsxs89(Fragment21, { children: [
22667
+ readOnly || minimalInteractivity ? null : /* @__PURE__ */ jsx133(RichTextToolbar_default, { config, customControls, onInsertTable }),
22668
+ /* @__PURE__ */ jsxs89(
22669
+ "div",
22670
+ {
22671
+ css: editorContainer,
22672
+ className: editorInputWrapperClassName,
22673
+ ref: onRef,
22674
+ "data-testid": "value-container",
22675
+ children: [
22676
+ /* @__PURE__ */ jsx133(
22677
+ RichTextPlugin,
22678
+ {
22679
+ contentEditable: /* @__PURE__ */ jsx133(ContentEditable, { css: editorInput, className: editorInputClassName }),
22680
+ placeholder: /* @__PURE__ */ jsx133("div", { css: editorPlaceholder, children: readOnly ? "empty" : "start editing..." }),
22681
+ ErrorBoundary: LexicalErrorBoundary
22682
+ }
22683
+ ),
22684
+ /* @__PURE__ */ jsx133(ListPlugin, {}),
22685
+ /* @__PURE__ */ jsx133(TablePlugin, {}),
22686
+ editorContainerRef && !minimalInteractivity ? /* @__PURE__ */ jsx133(TableActionMenuPlugin, { positioningAnchorEl: editorContainerRef }) : null,
22687
+ editorContainerRef && !minimalInteractivity ? /* @__PURE__ */ jsx133(TableCellResizerPlugin, { positioningAnchorEl: editorContainerRef }) : null,
22688
+ readOnly ? null : /* @__PURE__ */ jsx133(HistoryPlugin, {}),
22689
+ editorContainerRef ? /* @__PURE__ */ jsx133(
22690
+ LinkNodePlugin,
22691
+ {
22692
+ onConnectLink: onConnectLink ? onConnectLink : () => Promise.resolve(),
22693
+ getBoundPath: (variables == null ? void 0 : variables.bindVariables) ? (path) => {
22694
+ var _a, _b;
22695
+ return (_b = (_a = variables.bindVariables) == null ? void 0 : _a.call(variables, path)) != null ? _b : path;
22696
+ } : void 0,
22697
+ positioningAnchorEl: editorContainerRef
22698
+ }
22699
+ ) : null,
22700
+ /* @__PURE__ */ jsx133(ListIndentPlugin, { maxDepth: 4 }),
22701
+ /* @__PURE__ */ jsx133(DisableStylesPlugin, {}),
22702
+ /* @__PURE__ */ jsx133(MarkdownShortcutPlugin, { transformers: MARKDOWN_TRANSFORMERS }),
22703
+ /* @__PURE__ */ jsx133(Fragment21, { children })
22704
+ ]
22705
+ }
22706
+ )
21854
22707
  ] });
21855
22708
  };
21856
22709
 
21857
22710
  // src/components/ParameterInputs/ParameterSelect.tsx
21858
- import { forwardRef as forwardRef22 } from "react";
21859
- import { jsx as jsx132, jsxs as jsxs88 } from "@emotion/react/jsx-runtime";
21860
- var ParameterSelect = forwardRef22(
22711
+ import { forwardRef as forwardRef23 } from "react";
22712
+ import { jsx as jsx134, jsxs as jsxs90 } from "@emotion/react/jsx-runtime";
22713
+ var ParameterSelect = forwardRef23(
21861
22714
  ({ defaultOption, options, ...props }, ref) => {
21862
22715
  const { shellProps, innerProps } = extractParameterProps(props);
21863
- return /* @__PURE__ */ jsx132(ParameterShell, { ...shellProps, children: /* @__PURE__ */ jsx132(ParameterSelectInner, { options, defaultOption, ...innerProps, ref }) });
22716
+ return /* @__PURE__ */ jsx134(ParameterShell, { ...shellProps, children: /* @__PURE__ */ jsx134(ParameterSelectInner, { options, defaultOption, ...innerProps, ref }) });
21864
22717
  }
21865
22718
  );
21866
- var ParameterSelectInner = forwardRef22(
22719
+ var ParameterSelectInner = forwardRef23(
21867
22720
  ({ defaultOption, options, ...props }, ref) => {
21868
22721
  const { id, label, hiddenLabel } = useParameterShell();
21869
- return /* @__PURE__ */ jsxs88(
22722
+ return /* @__PURE__ */ jsxs90(
21870
22723
  "select",
21871
22724
  {
21872
22725
  css: [input3, selectInput],
@@ -21875,10 +22728,10 @@ var ParameterSelectInner = forwardRef22(
21875
22728
  ref,
21876
22729
  ...props,
21877
22730
  children: [
21878
- defaultOption ? /* @__PURE__ */ jsx132("option", { value: "", children: defaultOption }) : null,
22731
+ defaultOption ? /* @__PURE__ */ jsx134("option", { value: "", children: defaultOption }) : null,
21879
22732
  options.map((option) => {
21880
22733
  var _a;
21881
- return /* @__PURE__ */ jsx132("option", { value: (_a = option.value) != null ? _a : option.label, children: option.label }, option.label);
22734
+ return /* @__PURE__ */ jsx134("option", { value: (_a = option.value) != null ? _a : option.label, children: option.label }, option.label);
21882
22735
  })
21883
22736
  ]
21884
22737
  }
@@ -21887,15 +22740,15 @@ var ParameterSelectInner = forwardRef22(
21887
22740
  );
21888
22741
 
21889
22742
  // src/components/ParameterInputs/ParameterTextarea.tsx
21890
- import { forwardRef as forwardRef23 } from "react";
21891
- import { jsx as jsx133 } from "@emotion/react/jsx-runtime";
21892
- var ParameterTextarea = forwardRef23((props, ref) => {
22743
+ import { forwardRef as forwardRef24 } from "react";
22744
+ import { jsx as jsx135 } from "@emotion/react/jsx-runtime";
22745
+ var ParameterTextarea = forwardRef24((props, ref) => {
21893
22746
  const { shellProps, innerProps } = extractParameterProps(props);
21894
- return /* @__PURE__ */ jsx133(ParameterShell, { "data-testid": "parameter-textarea", ...shellProps, children: /* @__PURE__ */ jsx133(ParameterTextareaInner, { ref, ...innerProps }) });
22747
+ return /* @__PURE__ */ jsx135(ParameterShell, { "data-testid": "parameter-textarea", ...shellProps, children: /* @__PURE__ */ jsx135(ParameterTextareaInner, { ref, ...innerProps }) });
21895
22748
  });
21896
- var ParameterTextareaInner = forwardRef23(({ ...props }, ref) => {
22749
+ var ParameterTextareaInner = forwardRef24(({ ...props }, ref) => {
21897
22750
  const { id, label, hiddenLabel } = useParameterShell();
21898
- return /* @__PURE__ */ jsx133(
22751
+ return /* @__PURE__ */ jsx135(
21899
22752
  "textarea",
21900
22753
  {
21901
22754
  css: [input3, textarea2],
@@ -21908,26 +22761,26 @@ var ParameterTextareaInner = forwardRef23(({ ...props }, ref) => {
21908
22761
  });
21909
22762
 
21910
22763
  // src/components/ParameterInputs/ParameterToggle.tsx
21911
- import { forwardRef as forwardRef24 } from "react";
21912
- import { jsx as jsx134, jsxs as jsxs89 } from "@emotion/react/jsx-runtime";
21913
- var ParameterToggle = forwardRef24((props, ref) => {
22764
+ import { forwardRef as forwardRef25 } from "react";
22765
+ import { jsx as jsx136, jsxs as jsxs91 } from "@emotion/react/jsx-runtime";
22766
+ var ParameterToggle = forwardRef25((props, ref) => {
21914
22767
  const { shellProps, innerProps } = extractParameterProps(props);
21915
- return /* @__PURE__ */ jsx134(ParameterShell, { ...shellProps, children: /* @__PURE__ */ jsx134(ParameterToggleInner, { ref, ...innerProps }) });
22768
+ return /* @__PURE__ */ jsx136(ParameterShell, { ...shellProps, children: /* @__PURE__ */ jsx136(ParameterToggleInner, { ref, ...innerProps }) });
21916
22769
  });
21917
- var ParameterToggleInner = forwardRef24(
22770
+ var ParameterToggleInner = forwardRef25(
21918
22771
  ({ children, ...props }, ref) => {
21919
22772
  const { id, label } = useParameterShell();
21920
- return /* @__PURE__ */ jsxs89("label", { css: inputToggleLabel2, children: [
21921
- /* @__PURE__ */ jsx134("input", { css: toggleInput2, type: props.type, id, ref, ...props }),
21922
- /* @__PURE__ */ jsx134("span", { css: inlineLabel2, children: label }),
22773
+ return /* @__PURE__ */ jsxs91("label", { css: inputToggleLabel2, children: [
22774
+ /* @__PURE__ */ jsx136("input", { css: toggleInput2, type: props.type, id, ref, ...props }),
22775
+ /* @__PURE__ */ jsx136("span", { css: inlineLabel2, children: label }),
21923
22776
  children
21924
22777
  ] });
21925
22778
  }
21926
22779
  );
21927
22780
 
21928
22781
  // src/components/ProgressBar/ProgressBar.styles.ts
21929
- import { css as css99, keyframes as keyframes4 } from "@emotion/react";
21930
- var container3 = css99`
22782
+ import { css as css101, keyframes as keyframes4 } from "@emotion/react";
22783
+ var container3 = css101`
21931
22784
  background: var(--gray-50);
21932
22785
  margin-block: var(--spacing-sm);
21933
22786
  position: relative;
@@ -21937,13 +22790,13 @@ var container3 = css99`
21937
22790
  border: solid 1px var(--gray-300);
21938
22791
  `;
21939
22792
  var themeMap = {
21940
- primary: css99`
22793
+ primary: css101`
21941
22794
  --progress-color: var(--accent-light);
21942
22795
  `,
21943
- secondary: css99`
22796
+ secondary: css101`
21944
22797
  --progress-color: var(--accent-alt-light);
21945
22798
  `,
21946
- destructive: css99`
22799
+ destructive: css101`
21947
22800
  --progress-color: var(--brand-secondary-5);
21948
22801
  `
21949
22802
  };
@@ -21955,10 +22808,10 @@ var slidingBackgroundPosition = keyframes4`
21955
22808
  background-position: 64px 0;
21956
22809
  }
21957
22810
  `;
21958
- var determinate = css99`
22811
+ var determinate = css101`
21959
22812
  background-color: var(--progress-color);
21960
22813
  `;
21961
- var indeterminate = css99`
22814
+ var indeterminate = css101`
21962
22815
  background-image: linear-gradient(
21963
22816
  45deg,
21964
22817
  var(--progress-color) 25%,
@@ -21972,7 +22825,7 @@ var indeterminate = css99`
21972
22825
  background-size: 64px 64px;
21973
22826
  animation: ${slidingBackgroundPosition} 1s linear infinite;
21974
22827
  `;
21975
- var bar = css99`
22828
+ var bar = css101`
21976
22829
  position: absolute;
21977
22830
  inset: 0;
21978
22831
  transition: transform var(--duration-fast) var(--timing-ease-out);
@@ -21980,7 +22833,7 @@ var bar = css99`
21980
22833
  `;
21981
22834
 
21982
22835
  // src/components/ProgressBar/ProgressBar.tsx
21983
- import { jsx as jsx135 } from "@emotion/react/jsx-runtime";
22836
+ import { jsx as jsx137 } from "@emotion/react/jsx-runtime";
21984
22837
  function ProgressBar({
21985
22838
  current,
21986
22839
  max,
@@ -21990,7 +22843,7 @@ function ProgressBar({
21990
22843
  }) {
21991
22844
  const valueNow = Math.min(current, max);
21992
22845
  const valuePercentage = max > 0 ? Math.ceil(100 / max * valueNow) : 0;
21993
- return /* @__PURE__ */ jsx135(
22846
+ return /* @__PURE__ */ jsx137(
21994
22847
  "div",
21995
22848
  {
21996
22849
  css: container3,
@@ -22001,7 +22854,7 @@ function ProgressBar({
22001
22854
  "aria-valuemax": max,
22002
22855
  "aria-valuenow": valueNow,
22003
22856
  ...props,
22004
- children: /* @__PURE__ */ jsx135(
22857
+ children: /* @__PURE__ */ jsx137(
22005
22858
  "div",
22006
22859
  {
22007
22860
  css: [
@@ -22020,30 +22873,30 @@ function ProgressBar({
22020
22873
  }
22021
22874
 
22022
22875
  // src/components/ProgressList/ProgressList.tsx
22023
- import { css as css101 } from "@emotion/react";
22876
+ import { css as css103 } from "@emotion/react";
22024
22877
  import { CgCheckO as CgCheckO2 } from "@react-icons/all-files/cg/CgCheckO";
22025
22878
  import { CgRadioCheck } from "@react-icons/all-files/cg/CgRadioCheck";
22026
22879
  import { CgRecord } from "@react-icons/all-files/cg/CgRecord";
22027
- import { useMemo as useMemo7 } from "react";
22880
+ import { useMemo as useMemo8 } from "react";
22028
22881
 
22029
22882
  // src/components/ProgressList/styles/ProgressList.styles.ts
22030
- import { css as css100 } from "@emotion/react";
22031
- var progressListStyles = css100`
22883
+ import { css as css102 } from "@emotion/react";
22884
+ var progressListStyles = css102`
22032
22885
  display: flex;
22033
22886
  flex-direction: column;
22034
22887
  gap: var(--spacing-sm);
22035
22888
  list-style-type: none;
22036
22889
  `;
22037
- var progressListItemStyles = css100`
22890
+ var progressListItemStyles = css102`
22038
22891
  display: flex;
22039
22892
  gap: var(--spacing-base);
22040
22893
  align-items: center;
22041
22894
  `;
22042
22895
 
22043
22896
  // src/components/ProgressList/ProgressList.tsx
22044
- import { jsx as jsx136, jsxs as jsxs90 } from "@emotion/react/jsx-runtime";
22897
+ import { jsx as jsx138, jsxs as jsxs92 } from "@emotion/react/jsx-runtime";
22045
22898
  var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
22046
- const itemsWithStatus = useMemo7(() => {
22899
+ const itemsWithStatus = useMemo8(() => {
22047
22900
  const indexOfInProgressItem = items.findIndex(({ id }) => id === inProgressId);
22048
22901
  return items.map((item, index) => {
22049
22902
  let status = "queued";
@@ -22055,8 +22908,8 @@ var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
22055
22908
  return { ...item, status };
22056
22909
  });
22057
22910
  }, [items, inProgressId]);
22058
- return /* @__PURE__ */ jsx136("ol", { css: progressListStyles, ...htmlProps, children: itemsWithStatus.map(({ id, label, status, error, errorLevel }) => {
22059
- return /* @__PURE__ */ jsx136(
22911
+ return /* @__PURE__ */ jsx138("ol", { css: progressListStyles, ...htmlProps, children: itemsWithStatus.map(({ id, label, status, error, errorLevel }) => {
22912
+ return /* @__PURE__ */ jsx138(
22060
22913
  ProgressListItem,
22061
22914
  {
22062
22915
  status,
@@ -22076,7 +22929,7 @@ var ProgressListItem = ({
22076
22929
  errorLevel = "danger",
22077
22930
  autoEllipsis = false
22078
22931
  }) => {
22079
- const icon = useMemo7(() => {
22932
+ const icon = useMemo8(() => {
22080
22933
  if (error) {
22081
22934
  return warningIcon;
22082
22935
  }
@@ -22087,14 +22940,14 @@ var ProgressListItem = ({
22087
22940
  };
22088
22941
  return iconPerStatus[status];
22089
22942
  }, [status, error]);
22090
- const statusStyles = useMemo7(() => {
22943
+ const statusStyles = useMemo8(() => {
22091
22944
  if (error) {
22092
- return errorLevel === "caution" ? css101`
22945
+ return errorLevel === "caution" ? css103`
22093
22946
  color: rgb(161, 98, 7);
22094
22947
  & svg {
22095
22948
  color: rgb(250, 204, 21);
22096
22949
  }
22097
- ` : css101`
22950
+ ` : css103`
22098
22951
  color: rgb(185, 28, 28);
22099
22952
  & svg {
22100
22953
  color: var(--brand-primary-2);
@@ -22102,38 +22955,38 @@ var ProgressListItem = ({
22102
22955
  `;
22103
22956
  }
22104
22957
  const colorPerStatus = {
22105
- completed: css101`
22958
+ completed: css103`
22106
22959
  opacity: 0.75;
22107
22960
  `,
22108
- inProgress: css101`
22961
+ inProgress: css103`
22109
22962
  -webkit-text-stroke-width: thin;
22110
22963
  `,
22111
- queued: css101`
22964
+ queued: css103`
22112
22965
  opacity: 0.5;
22113
22966
  `
22114
22967
  };
22115
22968
  return colorPerStatus[status];
22116
22969
  }, [status, error, errorLevel]);
22117
- return /* @__PURE__ */ jsxs90("li", { css: [progressListItemStyles, statusStyles], children: [
22118
- /* @__PURE__ */ jsx136(Tooltip, { title: error != null ? error : "", children: /* @__PURE__ */ jsx136("div", { children: /* @__PURE__ */ jsx136(Icon, { icon, size: 20, iconColor: "currentColor" }) }) }),
22119
- /* @__PURE__ */ jsxs90("div", { children: [
22970
+ return /* @__PURE__ */ jsxs92("li", { css: [progressListItemStyles, statusStyles], children: [
22971
+ /* @__PURE__ */ jsx138(Tooltip, { title: error != null ? error : "", children: /* @__PURE__ */ jsx138("div", { children: /* @__PURE__ */ jsx138(Icon, { icon, size: 20, iconColor: "currentColor" }) }) }),
22972
+ /* @__PURE__ */ jsxs92("div", { children: [
22120
22973
  children,
22121
- /* @__PURE__ */ jsx136("span", { css: { visibility: autoEllipsis && status === "inProgress" && !error ? "visible" : "hidden" }, children: "..." })
22974
+ /* @__PURE__ */ jsx138("span", { css: { visibility: autoEllipsis && status === "inProgress" && !error ? "visible" : "hidden" }, children: "..." })
22122
22975
  ] })
22123
22976
  ] });
22124
22977
  };
22125
22978
 
22126
22979
  // src/components/SegmentedControl/SegmentedControl.tsx
22127
- import { css as css103 } from "@emotion/react";
22980
+ import { css as css105 } from "@emotion/react";
22128
22981
  import { CgCheck as CgCheck5 } from "@react-icons/all-files/cg/CgCheck";
22129
- import { useCallback as useCallback12, useEffect as useEffect22, useMemo as useMemo8, useRef as useRef13, useState as useState18 } from "react";
22982
+ import { useCallback as useCallback14, useEffect as useEffect24, useMemo as useMemo9, useRef as useRef13, useState as useState21 } from "react";
22130
22983
 
22131
22984
  // src/components/SegmentedControl/SegmentedControl.styles.ts
22132
- import { css as css102 } from "@emotion/react";
22133
- var segmentedControlRootStyles = css102`
22985
+ import { css as css104 } from "@emotion/react";
22986
+ var segmentedControlRootStyles = css104`
22134
22987
  position: relative;
22135
22988
  `;
22136
- var segmentedControlScrollIndicatorsStyles = css102`
22989
+ var segmentedControlScrollIndicatorsStyles = css104`
22137
22990
  position: absolute;
22138
22991
  inset: 0;
22139
22992
  z-index: 1;
@@ -22161,17 +23014,17 @@ var segmentedControlScrollIndicatorsStyles = css102`
22161
23014
  background: linear-gradient(to left, var(--background-color) 10%, transparent);
22162
23015
  }
22163
23016
  `;
22164
- var segmentedControlScrollIndicatorStartVisibleStyles = css102`
23017
+ var segmentedControlScrollIndicatorStartVisibleStyles = css104`
22165
23018
  &::before {
22166
23019
  opacity: 1;
22167
23020
  }
22168
23021
  `;
22169
- var segmentedControlScrollIndicatorEndVisibleStyles = css102`
23022
+ var segmentedControlScrollIndicatorEndVisibleStyles = css104`
22170
23023
  &::after {
22171
23024
  opacity: 1;
22172
23025
  }
22173
23026
  `;
22174
- var segmentedControlWrapperStyles = css102`
23027
+ var segmentedControlWrapperStyles = css104`
22175
23028
  overflow-y: auto;
22176
23029
  scroll-behavior: smooth;
22177
23030
  scrollbar-width: none;
@@ -22180,7 +23033,7 @@ var segmentedControlWrapperStyles = css102`
22180
23033
  height: 0px;
22181
23034
  }
22182
23035
  `;
22183
- var segmentedControlStyles = css102`
23036
+ var segmentedControlStyles = css104`
22184
23037
  --segmented-control-rounded-value: var(--rounded-base);
22185
23038
  --segmented-control-border-width: 1px;
22186
23039
  --segmented-control-selected-color: var(--brand-secondary-3);
@@ -22199,14 +23052,14 @@ var segmentedControlStyles = css102`
22199
23052
  border-radius: calc(var(--segmented-control-rounded-value) + var(--segmented-control-border-width));
22200
23053
  font-size: var(--fs-xs);
22201
23054
  `;
22202
- var segmentedControlVerticalStyles = css102`
23055
+ var segmentedControlVerticalStyles = css104`
22203
23056
  flex-direction: column;
22204
23057
  --segmented-control-first-border-radius: var(--segmented-control-rounded-value)
22205
23058
  var(--segmented-control-rounded-value) 0 0;
22206
23059
  --segmented-control-last-border-radius: 0 0 var(--segmented-control-rounded-value)
22207
23060
  var(--segmented-control-rounded-value);
22208
23061
  `;
22209
- var segmentedControlItemStyles = css102`
23062
+ var segmentedControlItemStyles = css104`
22210
23063
  &:first-of-type label {
22211
23064
  border-radius: var(--segmented-control-first-border-radius);
22212
23065
  }
@@ -22214,10 +23067,10 @@ var segmentedControlItemStyles = css102`
22214
23067
  border-radius: var(--segmented-control-last-border-radius);
22215
23068
  }
22216
23069
  `;
22217
- var segmentedControlInputStyles = css102`
23070
+ var segmentedControlInputStyles = css104`
22218
23071
  ${accessibleHidden}
22219
23072
  `;
22220
- var segmentedControlLabelStyles = (checked, disabled2) => css102`
23073
+ var segmentedControlLabelStyles = (checked, disabled2) => css104`
22221
23074
  position: relative;
22222
23075
  display: flex;
22223
23076
  align-items: center;
@@ -22284,25 +23137,25 @@ var segmentedControlLabelStyles = (checked, disabled2) => css102`
22284
23137
  `}
22285
23138
  }
22286
23139
  `;
22287
- var segmentedControlLabelIconOnlyStyles = css102`
23140
+ var segmentedControlLabelIconOnlyStyles = css104`
22288
23141
  padding-inline: 0.5em;
22289
23142
  `;
22290
- var segmentedControlLabelCheckStyles = css102`
23143
+ var segmentedControlLabelCheckStyles = css104`
22291
23144
  opacity: 0.5;
22292
23145
  `;
22293
- var segmentedControlLabelContentStyles = css102`
23146
+ var segmentedControlLabelContentStyles = css104`
22294
23147
  display: flex;
22295
23148
  align-items: center;
22296
23149
  justify-content: center;
22297
23150
  gap: var(--spacing-sm);
22298
23151
  height: 100%;
22299
23152
  `;
22300
- var segmentedControlLabelTextStyles = css102`
23153
+ var segmentedControlLabelTextStyles = css104`
22301
23154
  white-space: nowrap;
22302
23155
  `;
22303
23156
 
22304
23157
  // src/components/SegmentedControl/SegmentedControl.tsx
22305
- import { jsx as jsx137, jsxs as jsxs91 } from "@emotion/react/jsx-runtime";
23158
+ import { jsx as jsx139, jsxs as jsxs93 } from "@emotion/react/jsx-runtime";
22306
23159
  var SegmentedControl = ({
22307
23160
  name,
22308
23161
  options,
@@ -22318,9 +23171,9 @@ var SegmentedControl = ({
22318
23171
  ...props
22319
23172
  }) => {
22320
23173
  const wrapperRef = useRef13(null);
22321
- const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = useState18(false);
22322
- const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = useState18(false);
22323
- const onOptionChange = useCallback12(
23174
+ const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = useState21(false);
23175
+ const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = useState21(false);
23176
+ const onOptionChange = useCallback14(
22324
23177
  (event) => {
22325
23178
  if (event.target.checked) {
22326
23179
  onChange == null ? void 0 : onChange(options[parseInt(event.target.value)].value);
@@ -22328,19 +23181,19 @@ var SegmentedControl = ({
22328
23181
  },
22329
23182
  [options, onChange]
22330
23183
  );
22331
- const sizeStyles = useMemo8(() => {
23184
+ const sizeStyles = useMemo9(() => {
22332
23185
  const map = {
22333
- sm: css103({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
22334
- md: css103({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
22335
- lg: css103({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
22336
- xl: css103({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
23186
+ sm: css105({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
23187
+ md: css105({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
23188
+ lg: css105({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
23189
+ xl: css105({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
22337
23190
  };
22338
23191
  return map[size];
22339
23192
  }, [size]);
22340
- const isIconOnly = useMemo8(() => {
23193
+ const isIconOnly = useMemo9(() => {
22341
23194
  return options.every((option) => option && option.icon && !option.label);
22342
23195
  }, [options]);
22343
- useEffect22(() => {
23196
+ useEffect24(() => {
22344
23197
  const wrapperElement = wrapperRef.current;
22345
23198
  const onScroll = () => {
22346
23199
  if (!wrapperElement) {
@@ -22361,8 +23214,8 @@ var SegmentedControl = ({
22361
23214
  wrapperElement == null ? void 0 : wrapperElement.removeEventListener("scroll", onScroll);
22362
23215
  };
22363
23216
  }, []);
22364
- return /* @__PURE__ */ jsxs91("div", { css: [segmentedControlRootStyles, { "--background-color": currentBackgroundColor }], children: [
22365
- /* @__PURE__ */ jsx137("div", { ref: wrapperRef, css: segmentedControlWrapperStyles, children: /* @__PURE__ */ jsx137(
23217
+ return /* @__PURE__ */ jsxs93("div", { css: [segmentedControlRootStyles, { "--background-color": currentBackgroundColor }], children: [
23218
+ /* @__PURE__ */ jsx139("div", { ref: wrapperRef, css: segmentedControlWrapperStyles, children: /* @__PURE__ */ jsx139(
22366
23219
  "div",
22367
23220
  {
22368
23221
  css: [
@@ -22378,12 +23231,12 @@ var SegmentedControl = ({
22378
23231
  }
22379
23232
  const text = option.label ? option.label : option.icon ? null : String(option.value);
22380
23233
  const isDisabled = disabled2 || option.disabled;
22381
- return /* @__PURE__ */ jsx137(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx137(
23234
+ return /* @__PURE__ */ jsx139(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx139(
22382
23235
  "div",
22383
23236
  {
22384
23237
  css: segmentedControlItemStyles,
22385
23238
  "data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
22386
- children: /* @__PURE__ */ jsxs91(
23239
+ children: /* @__PURE__ */ jsxs93(
22387
23240
  "label",
22388
23241
  {
22389
23242
  css: [
@@ -22392,7 +23245,7 @@ var SegmentedControl = ({
22392
23245
  isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
22393
23246
  ],
22394
23247
  children: [
22395
- /* @__PURE__ */ jsx137(
23248
+ /* @__PURE__ */ jsx139(
22396
23249
  "input",
22397
23250
  {
22398
23251
  css: segmentedControlInputStyles,
@@ -22404,10 +23257,10 @@ var SegmentedControl = ({
22404
23257
  disabled: isDisabled
22405
23258
  }
22406
23259
  ),
22407
- option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx137(CgCheck5, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
22408
- /* @__PURE__ */ jsxs91("span", { css: segmentedControlLabelContentStyles, children: [
22409
- !option.icon ? null : /* @__PURE__ */ jsx137(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
22410
- !text || hideOptionText ? null : /* @__PURE__ */ jsx137("span", { css: segmentedControlLabelTextStyles, children: text })
23260
+ option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx139(CgCheck5, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
23261
+ /* @__PURE__ */ jsxs93("span", { css: segmentedControlLabelContentStyles, children: [
23262
+ !option.icon ? null : /* @__PURE__ */ jsx139(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
23263
+ !text || hideOptionText ? null : /* @__PURE__ */ jsx139("span", { css: segmentedControlLabelTextStyles, children: text })
22411
23264
  ] })
22412
23265
  ]
22413
23266
  }
@@ -22417,7 +23270,7 @@ var SegmentedControl = ({
22417
23270
  })
22418
23271
  }
22419
23272
  ) }),
22420
- /* @__PURE__ */ jsx137(
23273
+ /* @__PURE__ */ jsx139(
22421
23274
  "div",
22422
23275
  {
22423
23276
  css: [
@@ -22431,18 +23284,18 @@ var SegmentedControl = ({
22431
23284
  };
22432
23285
 
22433
23286
  // src/components/Skeleton/Skeleton.styles.ts
22434
- import { css as css104, keyframes as keyframes5 } from "@emotion/react";
23287
+ import { css as css106, keyframes as keyframes5 } from "@emotion/react";
22435
23288
  var lightFadingOut = keyframes5`
22436
23289
  from { opacity: 0.1; }
22437
23290
  to { opacity: 0.025; }
22438
23291
  `;
22439
- var skeletonStyles = css104`
23292
+ var skeletonStyles = css106`
22440
23293
  animation: ${lightFadingOut} 1s ease-out infinite alternate;
22441
23294
  background-color: var(--gray-900);
22442
23295
  `;
22443
23296
 
22444
23297
  // src/components/Skeleton/Skeleton.tsx
22445
- import { jsx as jsx138 } from "@emotion/react/jsx-runtime";
23298
+ import { jsx as jsx140 } from "@emotion/react/jsx-runtime";
22446
23299
  var Skeleton = ({
22447
23300
  width = "100%",
22448
23301
  height = "1.25rem",
@@ -22450,7 +23303,7 @@ var Skeleton = ({
22450
23303
  circle = false,
22451
23304
  children,
22452
23305
  ...otherProps
22453
- }) => /* @__PURE__ */ jsx138(
23306
+ }) => /* @__PURE__ */ jsx140(
22454
23307
  "div",
22455
23308
  {
22456
23309
  css: [
@@ -22470,11 +23323,11 @@ var Skeleton = ({
22470
23323
  );
22471
23324
 
22472
23325
  // src/components/Switch/Switch.tsx
22473
- import { forwardRef as forwardRef25 } from "react";
23326
+ import { forwardRef as forwardRef26 } from "react";
22474
23327
 
22475
23328
  // src/components/Switch/Switch.styles.ts
22476
- import { css as css105 } from "@emotion/react";
22477
- var SwitchInputContainer = css105`
23329
+ import { css as css107 } from "@emotion/react";
23330
+ var SwitchInputContainer = css107`
22478
23331
  cursor: pointer;
22479
23332
  display: inline-block;
22480
23333
  position: relative;
@@ -22483,7 +23336,7 @@ var SwitchInputContainer = css105`
22483
23336
  vertical-align: middle;
22484
23337
  user-select: none;
22485
23338
  `;
22486
- var SwitchInput = (size) => css105`
23339
+ var SwitchInput = (size) => css107`
22487
23340
  appearance: none;
22488
23341
  border-radius: var(--rounded-full);
22489
23342
  background-color: var(--white);
@@ -22522,7 +23375,7 @@ var SwitchInput = (size) => css105`
22522
23375
  cursor: not-allowed;
22523
23376
  }
22524
23377
  `;
22525
- var SwitchInputDisabled = css105`
23378
+ var SwitchInputDisabled = css107`
22526
23379
  opacity: var(--opacity-50);
22527
23380
  cursor: not-allowed;
22528
23381
 
@@ -22530,7 +23383,7 @@ var SwitchInputDisabled = css105`
22530
23383
  cursor: not-allowed;
22531
23384
  }
22532
23385
  `;
22533
- var SwitchInputLabel = (size) => css105`
23386
+ var SwitchInputLabel = (size) => css107`
22534
23387
  align-items: center;
22535
23388
  color: var(--typography-base);
22536
23389
  display: inline-flex;
@@ -22552,32 +23405,32 @@ var SwitchInputLabel = (size) => css105`
22552
23405
  top: 0;
22553
23406
  }
22554
23407
  `;
22555
- var SwitchText = (size) => css105`
23408
+ var SwitchText = (size) => css107`
22556
23409
  color: var(--gray-500);
22557
23410
  font-size: var(--fs-sm);
22558
23411
  padding-inline: ${size === "sm" ? "var(--spacing-xl)" : "var(--spacing-2xl)"} 0;
22559
23412
  `;
22560
23413
 
22561
23414
  // src/components/Switch/Switch.tsx
22562
- import { Fragment as Fragment21, jsx as jsx139, jsxs as jsxs92 } from "@emotion/react/jsx-runtime";
22563
- var Switch = forwardRef25(
23415
+ import { Fragment as Fragment22, jsx as jsx141, jsxs as jsxs94 } from "@emotion/react/jsx-runtime";
23416
+ var Switch = forwardRef26(
22564
23417
  ({ label, infoText, toggleText, children, switchSize = "base", ...inputProps }, ref) => {
22565
23418
  let additionalText = infoText;
22566
23419
  if (infoText && toggleText) {
22567
23420
  additionalText = inputProps.checked ? toggleText : infoText;
22568
23421
  }
22569
- return /* @__PURE__ */ jsxs92(Fragment21, { children: [
22570
- /* @__PURE__ */ jsxs92(
23422
+ return /* @__PURE__ */ jsxs94(Fragment22, { children: [
23423
+ /* @__PURE__ */ jsxs94(
22571
23424
  "label",
22572
23425
  {
22573
23426
  css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0],
22574
23427
  children: [
22575
- /* @__PURE__ */ jsx139("input", { type: "checkbox", css: SwitchInput(switchSize), ...inputProps, ref }),
22576
- /* @__PURE__ */ jsx139("span", { css: SwitchInputLabel(switchSize), children: label })
23428
+ /* @__PURE__ */ jsx141("input", { type: "checkbox", css: SwitchInput(switchSize), ...inputProps, ref }),
23429
+ /* @__PURE__ */ jsx141("span", { css: SwitchInputLabel(switchSize), children: label })
22577
23430
  ]
22578
23431
  }
22579
23432
  ),
22580
- additionalText ? /* @__PURE__ */ jsx139("p", { css: SwitchText(switchSize), children: additionalText }) : null,
23433
+ additionalText ? /* @__PURE__ */ jsx141("p", { css: SwitchText(switchSize), children: additionalText }) : null,
22581
23434
  children
22582
23435
  ] });
22583
23436
  }
@@ -22587,8 +23440,8 @@ var Switch = forwardRef25(
22587
23440
  import * as React24 from "react";
22588
23441
 
22589
23442
  // src/components/Table/Table.styles.ts
22590
- import { css as css106 } from "@emotion/react";
22591
- var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => css106`
23443
+ import { css as css108 } from "@emotion/react";
23444
+ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => css108`
22592
23445
  border-bottom: 1px solid var(--gray-400);
22593
23446
  border-collapse: collapse;
22594
23447
  min-width: 100%;
@@ -22608,54 +23461,54 @@ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => css106`
22608
23461
  background-color: var(--gray-50);
22609
23462
  }
22610
23463
  `;
22611
- var tableHead = css106`
23464
+ var tableHead = css108`
22612
23465
  color: var(--typography-base);
22613
23466
  text-align: left;
22614
23467
  `;
22615
- var tableRow = css106`
23468
+ var tableRow = css108`
22616
23469
  border-bottom: 1px solid var(--gray-100);
22617
23470
  `;
22618
- var tableCellHead = css106`
23471
+ var tableCellHead = css108`
22619
23472
  font-size: var(--fs-sm);
22620
23473
  text-transform: uppercase;
22621
23474
  font-weight: var(--fw-bold);
22622
23475
  `;
22623
23476
 
22624
23477
  // src/components/Table/Table.tsx
22625
- import { jsx as jsx140 } from "@emotion/react/jsx-runtime";
23478
+ import { jsx as jsx142 } from "@emotion/react/jsx-runtime";
22626
23479
  var Table = React24.forwardRef(
22627
23480
  ({ children, cellPadding, ...otherProps }, ref) => {
22628
- return /* @__PURE__ */ jsx140("table", { ref, css: table({ cellPadding }), ...otherProps, children });
23481
+ return /* @__PURE__ */ jsx142("table", { ref, css: table({ cellPadding }), ...otherProps, children });
22629
23482
  }
22630
23483
  );
22631
23484
  var TableHead = React24.forwardRef(
22632
23485
  ({ children, ...otherProps }, ref) => {
22633
- return /* @__PURE__ */ jsx140("thead", { ref, css: tableHead, ...otherProps, children });
23486
+ return /* @__PURE__ */ jsx142("thead", { ref, css: tableHead, ...otherProps, children });
22634
23487
  }
22635
23488
  );
22636
23489
  var TableBody = React24.forwardRef(
22637
23490
  ({ children, ...otherProps }, ref) => {
22638
- return /* @__PURE__ */ jsx140("tbody", { ref, ...otherProps, children });
23491
+ return /* @__PURE__ */ jsx142("tbody", { ref, ...otherProps, children });
22639
23492
  }
22640
23493
  );
22641
23494
  var TableFoot = React24.forwardRef(
22642
23495
  ({ children, ...otherProps }, ref) => {
22643
- return /* @__PURE__ */ jsx140("tfoot", { ref, ...otherProps, children });
23496
+ return /* @__PURE__ */ jsx142("tfoot", { ref, ...otherProps, children });
22644
23497
  }
22645
23498
  );
22646
23499
  var TableRow = React24.forwardRef(
22647
23500
  ({ children, ...otherProps }, ref) => {
22648
- return /* @__PURE__ */ jsx140("tr", { ref, css: tableRow, ...otherProps, children });
23501
+ return /* @__PURE__ */ jsx142("tr", { ref, css: tableRow, ...otherProps, children });
22649
23502
  }
22650
23503
  );
22651
23504
  var TableCellHead = React24.forwardRef(
22652
23505
  ({ children, ...otherProps }, ref) => {
22653
- return /* @__PURE__ */ jsx140("th", { ref, css: tableCellHead, ...otherProps, children });
23506
+ return /* @__PURE__ */ jsx142("th", { ref, css: tableCellHead, ...otherProps, children });
22654
23507
  }
22655
23508
  );
22656
23509
  var TableCellData = React24.forwardRef(
22657
23510
  ({ children, ...otherProps }, ref) => {
22658
- return /* @__PURE__ */ jsx140("td", { ref, ...otherProps, children });
23511
+ return /* @__PURE__ */ jsx142("td", { ref, ...otherProps, children });
22659
23512
  }
22660
23513
  );
22661
23514
 
@@ -22667,11 +23520,11 @@ import {
22667
23520
  TabProvider as AriakitTabProvider,
22668
23521
  useTabStore as useAriakitTabStore
22669
23522
  } from "@ariakit/react";
22670
- import { useCallback as useCallback13, useEffect as useEffect23, useMemo as useMemo9 } from "react";
23523
+ import { useCallback as useCallback15, useEffect as useEffect25, useMemo as useMemo10 } from "react";
22671
23524
 
22672
23525
  // src/components/Tabs/Tabs.styles.ts
22673
- import { css as css107 } from "@emotion/react";
22674
- var tabButtonStyles = css107`
23526
+ import { css as css109 } from "@emotion/react";
23527
+ var tabButtonStyles = css109`
22675
23528
  align-items: center;
22676
23529
  border: 0;
22677
23530
  height: 2.5rem;
@@ -22688,14 +23541,14 @@ var tabButtonStyles = css107`
22688
23541
  box-shadow: inset 0 -2px 0 var(--brand-secondary-3);
22689
23542
  }
22690
23543
  `;
22691
- var tabButtonGroupStyles = css107`
23544
+ var tabButtonGroupStyles = css109`
22692
23545
  display: flex;
22693
23546
  gap: var(--spacing-base);
22694
23547
  border-bottom: 1px solid var(--gray-300);
22695
23548
  `;
22696
23549
 
22697
23550
  // src/components/Tabs/Tabs.tsx
22698
- import { jsx as jsx141 } from "@emotion/react/jsx-runtime";
23551
+ import { jsx as jsx143 } from "@emotion/react/jsx-runtime";
22699
23552
  var useCurrentTab = () => {
22700
23553
  const context = useAriakitTabStore();
22701
23554
  if (!context) {
@@ -22711,12 +23564,12 @@ var Tabs = ({
22711
23564
  manual,
22712
23565
  ...props
22713
23566
  }) => {
22714
- const selected = useMemo9(() => {
23567
+ const selected = useMemo10(() => {
22715
23568
  if (selectedId) return selectedId;
22716
23569
  return useHashForState && typeof window !== "undefined" && window.location.hash ? window.location.hash.substring(1) : void 0;
22717
23570
  }, [selectedId, useHashForState]);
22718
23571
  const tab = useAriakitTabStore({ ...props, selectOnMove: !manual, selectedId: selected });
22719
- const onTabSelect = useCallback13(
23572
+ const onTabSelect = useCallback15(
22720
23573
  (value) => {
22721
23574
  const selectedValueWithoutNull = value != null ? value : void 0;
22722
23575
  onSelectedIdChange == null ? void 0 : onSelectedIdChange(selectedValueWithoutNull);
@@ -22727,33 +23580,33 @@ var Tabs = ({
22727
23580
  },
22728
23581
  [onSelectedIdChange, useHashForState]
22729
23582
  );
22730
- useEffect23(() => {
23583
+ useEffect25(() => {
22731
23584
  if (selected && selected !== tab.getState().activeId) {
22732
23585
  tab.setSelectedId(selected);
22733
23586
  }
22734
23587
  }, [selected, tab]);
22735
- return /* @__PURE__ */ jsx141(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
23588
+ return /* @__PURE__ */ jsx143(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
22736
23589
  };
22737
23590
  var TabButtonGroup = ({ children, ...props }) => {
22738
- return /* @__PURE__ */ jsx141(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
23591
+ return /* @__PURE__ */ jsx143(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
22739
23592
  };
22740
23593
  var TabButton = ({
22741
23594
  children,
22742
23595
  id,
22743
23596
  ...props
22744
23597
  }) => {
22745
- return /* @__PURE__ */ jsx141(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
23598
+ return /* @__PURE__ */ jsx143(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
22746
23599
  };
22747
23600
  var TabContent = ({
22748
23601
  children,
22749
23602
  ...props
22750
23603
  }) => {
22751
- return /* @__PURE__ */ jsx141(AriakitTabPanel, { ...props, children });
23604
+ return /* @__PURE__ */ jsx143(AriakitTabPanel, { ...props, children });
22752
23605
  };
22753
23606
 
22754
23607
  // src/components/Validation/StatusBullet.styles.ts
22755
- import { css as css108 } from "@emotion/react";
22756
- var StatusBulletContainer = css108`
23608
+ import { css as css110 } from "@emotion/react";
23609
+ var StatusBulletContainer = css110`
22757
23610
  align-items: center;
22758
23611
  align-self: center;
22759
23612
  color: var(--gray-500);
@@ -22770,33 +23623,33 @@ var StatusBulletContainer = css108`
22770
23623
  display: block;
22771
23624
  }
22772
23625
  `;
22773
- var StatusBulletBase = css108`
23626
+ var StatusBulletBase = css110`
22774
23627
  font-size: var(--fs-sm);
22775
23628
  &:before {
22776
23629
  width: var(--fs-xs);
22777
23630
  height: var(--fs-xs);
22778
23631
  }
22779
23632
  `;
22780
- var StatusBulletSmall = css108`
23633
+ var StatusBulletSmall = css110`
22781
23634
  font-size: var(--fs-xs);
22782
23635
  &:before {
22783
23636
  width: var(--fs-xxs);
22784
23637
  height: var(--fs-xxs);
22785
23638
  }
22786
23639
  `;
22787
- var StatusDraft = css108`
23640
+ var StatusDraft = css110`
22788
23641
  &:before {
22789
23642
  background: var(--white);
22790
23643
  box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
22791
23644
  }
22792
23645
  `;
22793
- var StatusModified = css108`
23646
+ var StatusModified = css110`
22794
23647
  &:before {
22795
23648
  background: linear-gradient(to right, var(--white) 50%, var(--accent-dark) 50% 100%);
22796
23649
  box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
22797
23650
  }
22798
23651
  `;
22799
- var StatusError = css108`
23652
+ var StatusError = css110`
22800
23653
  color: var(--error);
22801
23654
  &:before {
22802
23655
  /* TODO: replace this with an svg icon */
@@ -22809,29 +23662,29 @@ var StatusError = css108`
22809
23662
  );
22810
23663
  }
22811
23664
  `;
22812
- var StatusPublished = css108`
23665
+ var StatusPublished = css110`
22813
23666
  &:before {
22814
23667
  background: var(--accent-dark);
22815
23668
  }
22816
23669
  `;
22817
- var StatusOrphan = css108`
23670
+ var StatusOrphan = css110`
22818
23671
  &:before {
22819
23672
  background: var(--brand-secondary-5);
22820
23673
  }
22821
23674
  `;
22822
- var StatusUnknown = css108`
23675
+ var StatusUnknown = css110`
22823
23676
  &:before {
22824
23677
  background: var(--gray-800);
22825
23678
  }
22826
23679
  `;
22827
- var StatusDeleted = css108`
23680
+ var StatusDeleted = css110`
22828
23681
  &:before {
22829
23682
  background: var(--error);
22830
23683
  }
22831
23684
  `;
22832
23685
 
22833
23686
  // src/components/Validation/StatusBullet.tsx
22834
- import { jsx as jsx142 } from "@emotion/react/jsx-runtime";
23687
+ import { jsx as jsx144 } from "@emotion/react/jsx-runtime";
22835
23688
  var StatusBullet = ({
22836
23689
  status,
22837
23690
  hideText = false,
@@ -22851,7 +23704,7 @@ var StatusBullet = ({
22851
23704
  Deleted: StatusDeleted
22852
23705
  };
22853
23706
  const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
22854
- return /* @__PURE__ */ jsx142(
23707
+ return /* @__PURE__ */ jsx144(
22855
23708
  "span",
22856
23709
  {
22857
23710
  role: "status",
@@ -23126,6 +23979,7 @@ export {
23126
23979
  useOutsideClick,
23127
23980
  useParameterShell,
23128
23981
  usePopoverComponentContext,
23982
+ useRichTextToolbarState,
23129
23983
  useShortcut,
23130
23984
  functionalColors as utilityColors,
23131
23985
  warningIcon,