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