@uniformdev/design-system 19.177.2-alpha.18 → 19.178.2-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +1097 -243
- package/dist/index.d.mts +48 -4
- package/dist/index.d.ts +48 -4
- package/dist/index.js +1086 -251
- package/package.json +14 -13
package/dist/index.js
CHANGED
|
@@ -1609,6 +1609,7 @@ __export(src_exports, {
|
|
|
1609
1609
|
useOutsideClick: () => useOutsideClick,
|
|
1610
1610
|
useParameterShell: () => useParameterShell,
|
|
1611
1611
|
usePopoverComponentContext: () => usePopoverComponentContext,
|
|
1612
|
+
useRichTextToolbarState: () => useRichTextToolbarState,
|
|
1612
1613
|
useShortcut: () => useShortcut,
|
|
1613
1614
|
utilityColors: () => functionalColors,
|
|
1614
1615
|
warningIcon: () => warningIcon,
|
|
@@ -14150,6 +14151,7 @@ var Menu = React7.forwardRef(function Menu2({
|
|
|
14150
14151
|
menuItemsContainerCssClasses,
|
|
14151
14152
|
testId,
|
|
14152
14153
|
maxMenuHeight,
|
|
14154
|
+
portalElement,
|
|
14153
14155
|
...props
|
|
14154
14156
|
}, ref) {
|
|
14155
14157
|
const placementOverride = legacyPlacements.includes(placement) ? void 0 : placement;
|
|
@@ -14160,6 +14162,7 @@ var Menu = React7.forwardRef(function Menu2({
|
|
|
14160
14162
|
import_react37.Menu,
|
|
14161
14163
|
{
|
|
14162
14164
|
portal: !withoutPortal,
|
|
14165
|
+
portalElement,
|
|
14163
14166
|
unmountOnHide: true,
|
|
14164
14167
|
gutter: 0,
|
|
14165
14168
|
shift: menu.parent ? -4 : 0,
|
|
@@ -22145,18 +22148,20 @@ var ParameterNameAndPublicIdInput = ({
|
|
|
22145
22148
|
|
|
22146
22149
|
// src/components/ParameterInputs/ParameterRichText.tsx
|
|
22147
22150
|
init_emotion_jsx_shim();
|
|
22148
|
-
var
|
|
22151
|
+
var import_react154 = require("@emotion/react");
|
|
22149
22152
|
var import_list3 = require("@lexical/list");
|
|
22150
22153
|
var import_markdown = require("@lexical/markdown");
|
|
22151
22154
|
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
22152
|
-
var
|
|
22155
|
+
var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
|
|
22153
22156
|
var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
|
|
22154
22157
|
var import_LexicalErrorBoundary = __toESM(require("@lexical/react/LexicalErrorBoundary"));
|
|
22155
22158
|
var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin");
|
|
22156
22159
|
var import_LexicalListPlugin = require("@lexical/react/LexicalListPlugin");
|
|
22157
22160
|
var import_LexicalMarkdownShortcutPlugin = require("@lexical/react/LexicalMarkdownShortcutPlugin");
|
|
22158
22161
|
var import_LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
|
|
22162
|
+
var import_LexicalTablePlugin = require("@lexical/react/LexicalTablePlugin");
|
|
22159
22163
|
var import_rich_text2 = require("@lexical/rich-text");
|
|
22164
|
+
var import_table4 = require("@lexical/table");
|
|
22160
22165
|
|
|
22161
22166
|
// ../richtext/dist/index.mjs
|
|
22162
22167
|
init_emotion_jsx_shim();
|
|
@@ -22205,6 +22210,10 @@ var richTextBuiltInElements = [
|
|
|
22205
22210
|
label: "Code Block",
|
|
22206
22211
|
type: "code"
|
|
22207
22212
|
},
|
|
22213
|
+
{
|
|
22214
|
+
label: "Table",
|
|
22215
|
+
type: "table"
|
|
22216
|
+
},
|
|
22208
22217
|
{
|
|
22209
22218
|
label: "Dynamic Token",
|
|
22210
22219
|
type: "variable"
|
|
@@ -22251,8 +22260,8 @@ var getLabelForElement = (type) => {
|
|
|
22251
22260
|
|
|
22252
22261
|
// src/components/ParameterInputs/ParameterRichText.tsx
|
|
22253
22262
|
var import_fast_equals2 = require("fast-equals");
|
|
22254
|
-
var
|
|
22255
|
-
var
|
|
22263
|
+
var import_lexical8 = require("lexical");
|
|
22264
|
+
var import_react155 = require("react");
|
|
22256
22265
|
|
|
22257
22266
|
// src/components/ParameterInputs/rich-text/CustomCodeNode.ts
|
|
22258
22267
|
init_emotion_jsx_shim();
|
|
@@ -22470,6 +22479,46 @@ var codeElement = import_css2.css`
|
|
|
22470
22479
|
margin-bottom: 0;
|
|
22471
22480
|
}
|
|
22472
22481
|
`;
|
|
22482
|
+
var tableElement = import_css2.css`
|
|
22483
|
+
border-collapse: collapse;
|
|
22484
|
+
border-spacing: 0;
|
|
22485
|
+
border-color: var(--gray-300);
|
|
22486
|
+
border-width: 1px;
|
|
22487
|
+
border-style: solid;
|
|
22488
|
+
margin-bottom: var(--spacing-base);
|
|
22489
|
+
margin-top: 0;
|
|
22490
|
+
|
|
22491
|
+
&:last-child {
|
|
22492
|
+
margin-bottom: 0;
|
|
22493
|
+
}
|
|
22494
|
+
`;
|
|
22495
|
+
var tableCellElement = import_css2.css`
|
|
22496
|
+
background-color: var(--white);
|
|
22497
|
+
border-color: var(--gray-300);
|
|
22498
|
+
border-style: solid;
|
|
22499
|
+
border-width: 1px;
|
|
22500
|
+
box-sizing: unset;
|
|
22501
|
+
min-width: 2rem;
|
|
22502
|
+
outline: none;
|
|
22503
|
+
padding: var(--spacing-sm);
|
|
22504
|
+
text-align: start;
|
|
22505
|
+
vertical-align: top;
|
|
22506
|
+
width: 7rem;
|
|
22507
|
+
`;
|
|
22508
|
+
var tableHeaderElement = import_css2.css`
|
|
22509
|
+
background-color: var(--gray-100);
|
|
22510
|
+
border-color: var(--gray-300);
|
|
22511
|
+
border-style: solid;
|
|
22512
|
+
border-width: 1px;
|
|
22513
|
+
box-sizing: unset;
|
|
22514
|
+
font-weight: normal;
|
|
22515
|
+
min-width: 2rem;
|
|
22516
|
+
outline: none;
|
|
22517
|
+
padding: var(--spacing-sm);
|
|
22518
|
+
text-align: start;
|
|
22519
|
+
vertical-align: top;
|
|
22520
|
+
width: 7rem;
|
|
22521
|
+
`;
|
|
22473
22522
|
|
|
22474
22523
|
// src/components/ParameterInputs/rich-text/LinkNodePlugin.tsx
|
|
22475
22524
|
init_emotion_jsx_shim();
|
|
@@ -22817,7 +22866,11 @@ var linkPopoverAnchor = import_react145.css`
|
|
|
22817
22866
|
${link}
|
|
22818
22867
|
${linkColorDefault}
|
|
22819
22868
|
`;
|
|
22820
|
-
function LinkNodePlugin({
|
|
22869
|
+
function LinkNodePlugin({
|
|
22870
|
+
onConnectLink,
|
|
22871
|
+
getBoundPath,
|
|
22872
|
+
positioningAnchorEl
|
|
22873
|
+
}) {
|
|
22821
22874
|
const parsePath = getBoundPath != null ? getBoundPath : function(path) {
|
|
22822
22875
|
return path;
|
|
22823
22876
|
};
|
|
@@ -22921,9 +22974,11 @@ function LinkNodePlugin({ onConnectLink, getBoundPath }) {
|
|
|
22921
22974
|
setLinkPopoverState(void 0);
|
|
22922
22975
|
return;
|
|
22923
22976
|
}
|
|
22977
|
+
const elementRect = element.getBoundingClientRect();
|
|
22978
|
+
const positioningAnchorRect = positioningAnchorEl.getBoundingClientRect();
|
|
22924
22979
|
const { x, y } = {
|
|
22925
|
-
x:
|
|
22926
|
-
y:
|
|
22980
|
+
x: elementRect.left - positioningAnchorRect.left + LINK_POPOVER_OFFSET_X,
|
|
22981
|
+
y: elementRect.top + elementRect.height - positioningAnchorRect.top + LINK_POPOVER_OFFSET_Y
|
|
22927
22982
|
};
|
|
22928
22983
|
setLinkPopoverState({
|
|
22929
22984
|
node: linkNode,
|
|
@@ -22932,7 +22987,7 @@ function LinkNodePlugin({ onConnectLink, getBoundPath }) {
|
|
|
22932
22987
|
y
|
|
22933
22988
|
}
|
|
22934
22989
|
});
|
|
22935
|
-
}, [editor]);
|
|
22990
|
+
}, [editor, positioningAnchorEl]);
|
|
22936
22991
|
(0, import_react146.useEffect)(() => {
|
|
22937
22992
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
22938
22993
|
requestAnimationFrame(() => {
|
|
@@ -23063,17 +23118,20 @@ var import_list2 = require("@lexical/list");
|
|
|
23063
23118
|
var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerContext");
|
|
23064
23119
|
var import_rich_text = require("@lexical/rich-text");
|
|
23065
23120
|
var import_selection2 = require("@lexical/selection");
|
|
23121
|
+
var import_table = require("@lexical/table");
|
|
23066
23122
|
var import_utils9 = require("@lexical/utils");
|
|
23067
23123
|
var import_lexical5 = require("lexical");
|
|
23068
23124
|
var import_react149 = require("react");
|
|
23069
23125
|
var import_jsx_runtime130 = require("@emotion/react/jsx-runtime");
|
|
23070
23126
|
var toolbar = import_react148.css`
|
|
23127
|
+
${scrollbarStyles}
|
|
23071
23128
|
background: var(--gray-50);
|
|
23072
23129
|
border-radius: var(--rounded-base);
|
|
23073
23130
|
display: flex;
|
|
23074
23131
|
/* We add 1px because we use a 1px wide separator */
|
|
23075
23132
|
gap: calc(var(--spacing-sm) + 1px);
|
|
23076
23133
|
margin: calc(var(--spacing-sm) + var(--spacing-xs)) 0;
|
|
23134
|
+
overflow: auto;
|
|
23077
23135
|
padding: var(--spacing-sm);
|
|
23078
23136
|
position: sticky;
|
|
23079
23137
|
top: calc(var(--spacing-sm) * -2);
|
|
@@ -23081,6 +23139,7 @@ var toolbar = import_react148.css`
|
|
|
23081
23139
|
`;
|
|
23082
23140
|
var toolbarGroup = import_react148.css`
|
|
23083
23141
|
display: flex;
|
|
23142
|
+
flex-shrink: 0;
|
|
23084
23143
|
gap: var(--spacing-xs);
|
|
23085
23144
|
position: relative;
|
|
23086
23145
|
|
|
@@ -23103,6 +23162,7 @@ var richTextToolbarButton = import_react148.css`
|
|
|
23103
23162
|
box-shadow: none;
|
|
23104
23163
|
color: var(--gray-900);
|
|
23105
23164
|
display: flex;
|
|
23165
|
+
flex-shrink: 0;
|
|
23106
23166
|
height: 32px;
|
|
23107
23167
|
justify-content: center;
|
|
23108
23168
|
min-width: 32px;
|
|
@@ -23111,6 +23171,10 @@ var richTextToolbarButton = import_react148.css`
|
|
|
23111
23171
|
var richTextToolbarButtonActive = import_react148.css`
|
|
23112
23172
|
background: var(--gray-200);
|
|
23113
23173
|
`;
|
|
23174
|
+
var textStyleButton = import_react148.css`
|
|
23175
|
+
justify-content: space-between;
|
|
23176
|
+
min-width: 7rem;
|
|
23177
|
+
`;
|
|
23114
23178
|
var toolbarIcon = import_react148.css`
|
|
23115
23179
|
color: inherit;
|
|
23116
23180
|
`;
|
|
@@ -23131,7 +23195,7 @@ var FORMATS_WITH_ICON = /* @__PURE__ */ new Map([
|
|
|
23131
23195
|
]);
|
|
23132
23196
|
var HEADING_ELEMENTS = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
23133
23197
|
var TEXTUAL_ELEMENTS = HEADING_ELEMENTS;
|
|
23134
|
-
var RichTextToolbar = ({ config, customControls }) => {
|
|
23198
|
+
var RichTextToolbar = ({ config, customControls, onInsertTable }) => {
|
|
23135
23199
|
const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
|
|
23136
23200
|
const {
|
|
23137
23201
|
activeElement,
|
|
@@ -23147,26 +23211,39 @@ var RichTextToolbar = ({ config, customControls }) => {
|
|
|
23147
23211
|
visibleLists,
|
|
23148
23212
|
codeElementVisible,
|
|
23149
23213
|
quoteElementVisible,
|
|
23150
|
-
visibleElementsWithIcons
|
|
23214
|
+
visibleElementsWithIcons,
|
|
23215
|
+
visibleInsertElementsWithIcons,
|
|
23216
|
+
tableElementVisible
|
|
23151
23217
|
} = useRichTextToolbarState({ config });
|
|
23152
23218
|
const onSelectElement = (type) => {
|
|
23153
23219
|
if (activeElement === type) {
|
|
23154
23220
|
return;
|
|
23155
23221
|
}
|
|
23156
|
-
editor.
|
|
23157
|
-
|
|
23158
|
-
|
|
23159
|
-
|
|
23160
|
-
|
|
23161
|
-
|
|
23162
|
-
|
|
23163
|
-
|
|
23164
|
-
|
|
23165
|
-
|
|
23166
|
-
|
|
23167
|
-
|
|
23168
|
-
|
|
23169
|
-
|
|
23222
|
+
editor.focus(() => {
|
|
23223
|
+
editor.update(() => {
|
|
23224
|
+
const selection = (0, import_lexical5.$getSelection)();
|
|
23225
|
+
if (HEADING_ELEMENTS.includes(type)) {
|
|
23226
|
+
(0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createHeadingNode)(type));
|
|
23227
|
+
} else if (type === "paragraph") {
|
|
23228
|
+
(0, import_selection2.$setBlocksType)(selection, () => (0, import_lexical5.$createParagraphNode)());
|
|
23229
|
+
} else if (type === "quote") {
|
|
23230
|
+
(0, import_selection2.$setBlocksType)(selection, () => (0, import_rich_text.$createQuoteNode)());
|
|
23231
|
+
} else if (type === "code") {
|
|
23232
|
+
(0, import_selection2.$setBlocksType)(selection, () => (0, import_code2.$createCodeNode)());
|
|
23233
|
+
} else if (type === "table" && onInsertTable) {
|
|
23234
|
+
onInsertTable().then((dimensions) => {
|
|
23235
|
+
if (!dimensions) {
|
|
23236
|
+
return;
|
|
23237
|
+
}
|
|
23238
|
+
const { rows, columns } = dimensions;
|
|
23239
|
+
editor.focus(() => {
|
|
23240
|
+
editor.update(() => {
|
|
23241
|
+
(0, import_lexical5.$insertNodes)([(0, import_table.$createTableNodeWithDimensions)(rows, columns, false)]);
|
|
23242
|
+
});
|
|
23243
|
+
});
|
|
23244
|
+
});
|
|
23245
|
+
}
|
|
23246
|
+
});
|
|
23170
23247
|
});
|
|
23171
23248
|
};
|
|
23172
23249
|
const updateToolbar = (0, import_react149.useCallback)(() => {
|
|
@@ -23231,8 +23308,7 @@ var RichTextToolbar = ({ config, customControls }) => {
|
|
|
23231
23308
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
|
|
23232
23309
|
Menu,
|
|
23233
23310
|
{
|
|
23234
|
-
|
|
23235
|
-
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("button", { css: richTextToolbarButton, title: "Text styles", children: [
|
|
23311
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("button", { css: [richTextToolbarButton, textStyleButton], title: "Text styles", children: [
|
|
23236
23312
|
visibleTextualElements.some((element) => element.type === activeElement) ? getLabelForElement(activeElement) : getLabelForElement("paragraph"),
|
|
23237
23313
|
" ",
|
|
23238
23314
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
|
|
@@ -23292,7 +23368,7 @@ var RichTextToolbar = ({ config, customControls }) => {
|
|
|
23292
23368
|
}
|
|
23293
23369
|
) : null
|
|
23294
23370
|
] }) : null,
|
|
23295
|
-
visibleElementsWithIcons.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { css: toolbarGroup, children: [
|
|
23371
|
+
visibleElementsWithIcons.size > 0 || customControls ? /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { css: toolbarGroup, children: [
|
|
23296
23372
|
linkElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Tooltip, { title: "Link", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
23297
23373
|
"button",
|
|
23298
23374
|
{
|
|
@@ -23331,28 +23407,50 @@ var RichTextToolbar = ({ config, customControls }) => {
|
|
|
23331
23407
|
}
|
|
23332
23408
|
) }) : null
|
|
23333
23409
|
] }) : null,
|
|
23334
|
-
|
|
23335
|
-
"button",
|
|
23336
|
-
{
|
|
23337
|
-
onClick: () => {
|
|
23338
|
-
activeElement === "quote" ? onSelectElement("paragraph") : onSelectElement("quote");
|
|
23339
|
-
},
|
|
23340
|
-
css: [richTextToolbarButton, activeElement === "quote" ? richTextToolbarButtonActive : null],
|
|
23341
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(RichTextToolbarIcon, { icon: "quote" })
|
|
23342
|
-
}
|
|
23343
|
-
) }) : null,
|
|
23344
|
-
codeElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Tooltip, { title: "Code Block", placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
23345
|
-
"button",
|
|
23346
|
-
{
|
|
23347
|
-
onClick: () => {
|
|
23348
|
-
activeElement === "code" ? onSelectElement("paragraph") : onSelectElement("code");
|
|
23349
|
-
},
|
|
23350
|
-
css: [richTextToolbarButton, activeElement === "code" ? richTextToolbarButtonActive : null],
|
|
23351
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(RichTextToolbarIcon, { icon: "code-slash" })
|
|
23352
|
-
}
|
|
23353
|
-
) }) : null
|
|
23410
|
+
customControls ? customControls : null
|
|
23354
23411
|
] }) : null,
|
|
23355
|
-
|
|
23412
|
+
visibleInsertElementsWithIcons.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { css: toolbarGroup, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
|
|
23413
|
+
Menu,
|
|
23414
|
+
{
|
|
23415
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("button", { css: richTextToolbarButton, title: "Insert block element", children: [
|
|
23416
|
+
"Insert",
|
|
23417
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "chevron-down", css: [toolbarIcon, toolbarChevron], size: "1rem" })
|
|
23418
|
+
] }),
|
|
23419
|
+
placement: "bottom-start",
|
|
23420
|
+
children: [
|
|
23421
|
+
quoteElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
23422
|
+
MenuItem,
|
|
23423
|
+
{
|
|
23424
|
+
onClick: () => {
|
|
23425
|
+
onSelectElement("quote");
|
|
23426
|
+
},
|
|
23427
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "quote", iconColor: "currentColor" }),
|
|
23428
|
+
children: "Quote"
|
|
23429
|
+
}
|
|
23430
|
+
) : null,
|
|
23431
|
+
codeElementVisible ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
23432
|
+
MenuItem,
|
|
23433
|
+
{
|
|
23434
|
+
onClick: () => {
|
|
23435
|
+
onSelectElement("code");
|
|
23436
|
+
},
|
|
23437
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "code-slash", iconColor: "currentColor" }),
|
|
23438
|
+
children: "Code"
|
|
23439
|
+
}
|
|
23440
|
+
) : null,
|
|
23441
|
+
tableElementVisible && onInsertTable !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
23442
|
+
MenuItem,
|
|
23443
|
+
{
|
|
23444
|
+
onClick: () => {
|
|
23445
|
+
onSelectElement("table");
|
|
23446
|
+
},
|
|
23447
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Icon, { icon: "view-grid", iconColor: "currentColor" }),
|
|
23448
|
+
children: "Table"
|
|
23449
|
+
}
|
|
23450
|
+
) : null
|
|
23451
|
+
]
|
|
23452
|
+
}
|
|
23453
|
+
) }) : null
|
|
23356
23454
|
] });
|
|
23357
23455
|
};
|
|
23358
23456
|
var RichTextToolbar_default = RichTextToolbar;
|
|
@@ -23429,6 +23527,9 @@ var useRichTextToolbarState = ({ config }) => {
|
|
|
23429
23527
|
const codeElementVisible = (0, import_react149.useMemo)(() => {
|
|
23430
23528
|
return enabledBuiltInElements.some((element) => element.type === "code") || activeElement === "code";
|
|
23431
23529
|
}, [activeElement, enabledBuiltInElements]);
|
|
23530
|
+
const tableElementVisible = (0, import_react149.useMemo)(() => {
|
|
23531
|
+
return enabledBuiltInElements.some((element) => element.type === "table") || activeElement === "table";
|
|
23532
|
+
}, [activeElement, enabledBuiltInElements]);
|
|
23432
23533
|
const visibleElementsWithIcons = (0, import_react149.useMemo)(() => {
|
|
23433
23534
|
const visibleElements = /* @__PURE__ */ new Set();
|
|
23434
23535
|
if (linkElementVisible) {
|
|
@@ -23439,14 +23540,21 @@ var useRichTextToolbarState = ({ config }) => {
|
|
|
23439
23540
|
visibleElements.add(type);
|
|
23440
23541
|
});
|
|
23441
23542
|
}
|
|
23543
|
+
return visibleElements;
|
|
23544
|
+
}, [linkElementVisible, visibleLists]);
|
|
23545
|
+
const visibleInsertElementsWithIcons = (0, import_react149.useMemo)(() => {
|
|
23546
|
+
const visibleElements = /* @__PURE__ */ new Set();
|
|
23442
23547
|
if (quoteElementVisible) {
|
|
23443
23548
|
visibleElements.add("quote");
|
|
23444
23549
|
}
|
|
23445
23550
|
if (codeElementVisible) {
|
|
23446
23551
|
visibleElements.add("code");
|
|
23447
23552
|
}
|
|
23553
|
+
if (tableElementVisible) {
|
|
23554
|
+
visibleElements.add("table");
|
|
23555
|
+
}
|
|
23448
23556
|
return visibleElements;
|
|
23449
|
-
}, [codeElementVisible,
|
|
23557
|
+
}, [codeElementVisible, quoteElementVisible, tableElementVisible]);
|
|
23450
23558
|
return {
|
|
23451
23559
|
activeFormats,
|
|
23452
23560
|
setActiveFormats,
|
|
@@ -23461,12 +23569,699 @@ var useRichTextToolbarState = ({ config }) => {
|
|
|
23461
23569
|
visibleLists,
|
|
23462
23570
|
quoteElementVisible,
|
|
23463
23571
|
codeElementVisible,
|
|
23464
|
-
|
|
23572
|
+
tableElementVisible,
|
|
23573
|
+
visibleElementsWithIcons,
|
|
23574
|
+
visibleInsertElementsWithIcons
|
|
23465
23575
|
};
|
|
23466
23576
|
};
|
|
23467
23577
|
|
|
23468
|
-
// src/components/ParameterInputs/
|
|
23578
|
+
// src/components/ParameterInputs/rich-text/TableActionMenuPlugin.tsx
|
|
23579
|
+
init_emotion_jsx_shim();
|
|
23580
|
+
var import_react150 = require("@emotion/react");
|
|
23581
|
+
var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
|
|
23582
|
+
var import_useLexicalEditable = require("@lexical/react/useLexicalEditable");
|
|
23583
|
+
var import_table2 = require("@lexical/table");
|
|
23584
|
+
var import_lexical6 = require("lexical");
|
|
23585
|
+
var import_react151 = require("react");
|
|
23469
23586
|
var import_jsx_runtime131 = require("@emotion/react/jsx-runtime");
|
|
23587
|
+
function computeSelectionCount(selection) {
|
|
23588
|
+
const selectionShape = selection.getShape();
|
|
23589
|
+
return {
|
|
23590
|
+
columns: selectionShape.toX - selectionShape.fromX + 1,
|
|
23591
|
+
rows: selectionShape.toY - selectionShape.fromY + 1
|
|
23592
|
+
};
|
|
23593
|
+
}
|
|
23594
|
+
var tableActionMenuTrigger = import_react150.css`
|
|
23595
|
+
position: absolute;
|
|
23596
|
+
transform: translate(calc(-100% - 1px), 1px);
|
|
23597
|
+
`;
|
|
23598
|
+
var TableActionMenuTrigger = (0, import_react151.forwardRef)((props, ref) => {
|
|
23599
|
+
const { tableCellEl, positioningAnchorEl, ...rest } = props;
|
|
23600
|
+
const [coordinates, setCoordinates] = (0, import_react151.useState)({ x: 0, y: 0 });
|
|
23601
|
+
(0, import_react151.useLayoutEffect)(() => {
|
|
23602
|
+
const rect = tableCellEl.getBoundingClientRect();
|
|
23603
|
+
const parentRect = positioningAnchorEl.getBoundingClientRect();
|
|
23604
|
+
const relativeX = rect.right - parentRect.left;
|
|
23605
|
+
const relativeY = rect.top - parentRect.top;
|
|
23606
|
+
setCoordinates({ x: relativeX, y: relativeY });
|
|
23607
|
+
}, [tableCellEl, positioningAnchorEl]);
|
|
23608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
23609
|
+
IconButton,
|
|
23610
|
+
{
|
|
23611
|
+
ref,
|
|
23612
|
+
css: [
|
|
23613
|
+
tableActionMenuTrigger,
|
|
23614
|
+
{
|
|
23615
|
+
top: coordinates.y,
|
|
23616
|
+
left: coordinates.x
|
|
23617
|
+
}
|
|
23618
|
+
],
|
|
23619
|
+
size: "xs",
|
|
23620
|
+
buttonType: "unimportant",
|
|
23621
|
+
...rest,
|
|
23622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { icon: "chevron-down", size: "1rem", iconColor: "currentColor" })
|
|
23623
|
+
}
|
|
23624
|
+
);
|
|
23625
|
+
});
|
|
23626
|
+
TableActionMenuTrigger.displayName = "TableActionMenuTrigger";
|
|
23627
|
+
function TableActionMenu({
|
|
23628
|
+
tableCellNode: _tableCellNode,
|
|
23629
|
+
menuPortalEl,
|
|
23630
|
+
tableCellEl,
|
|
23631
|
+
positioningAnchorEl
|
|
23632
|
+
}) {
|
|
23633
|
+
const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
|
|
23634
|
+
const [tableCellNode, updateTableCellNode] = (0, import_react151.useState)(_tableCellNode);
|
|
23635
|
+
const [selectionCounts, updateSelectionCounts] = (0, import_react151.useState)({
|
|
23636
|
+
columns: 1,
|
|
23637
|
+
rows: 1
|
|
23638
|
+
});
|
|
23639
|
+
const [menuTriggerKey, setMenuTriggerKey] = (0, import_react151.useState)(0);
|
|
23640
|
+
const incrementMenuTriggerKey = () => {
|
|
23641
|
+
setMenuTriggerKey((key) => key += 1);
|
|
23642
|
+
};
|
|
23643
|
+
(0, import_react151.useEffect)(() => {
|
|
23644
|
+
return editor.registerMutationListener(
|
|
23645
|
+
import_table2.TableCellNode,
|
|
23646
|
+
(nodeMutations) => {
|
|
23647
|
+
const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
|
|
23648
|
+
if (nodeUpdated) {
|
|
23649
|
+
editor.getEditorState().read(() => {
|
|
23650
|
+
updateTableCellNode(tableCellNode.getLatest());
|
|
23651
|
+
});
|
|
23652
|
+
}
|
|
23653
|
+
},
|
|
23654
|
+
{ skipInitialization: true }
|
|
23655
|
+
);
|
|
23656
|
+
}, [editor, tableCellNode]);
|
|
23657
|
+
(0, import_react151.useEffect)(() => {
|
|
23658
|
+
editor.getEditorState().read(() => {
|
|
23659
|
+
const selection = (0, import_lexical6.$getSelection)();
|
|
23660
|
+
if ((0, import_table2.$isTableSelection)(selection)) {
|
|
23661
|
+
updateSelectionCounts(computeSelectionCount(selection));
|
|
23662
|
+
}
|
|
23663
|
+
});
|
|
23664
|
+
}, [editor]);
|
|
23665
|
+
const clearTableSelection = (0, import_react151.useCallback)(() => {
|
|
23666
|
+
editor.update(() => {
|
|
23667
|
+
if (tableCellNode.isAttached()) {
|
|
23668
|
+
const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
23669
|
+
const tableElement2 = editor.getElementByKey(
|
|
23670
|
+
tableNode.getKey()
|
|
23671
|
+
);
|
|
23672
|
+
if (!tableElement2) {
|
|
23673
|
+
throw new Error("Expected to find tableElement in DOM");
|
|
23674
|
+
}
|
|
23675
|
+
const tableSelection = (0, import_table2.getTableObserverFromTableElement)(tableElement2);
|
|
23676
|
+
if (tableSelection !== null) {
|
|
23677
|
+
tableSelection.clearHighlight();
|
|
23678
|
+
}
|
|
23679
|
+
tableNode.markDirty();
|
|
23680
|
+
updateTableCellNode(tableCellNode.getLatest());
|
|
23681
|
+
}
|
|
23682
|
+
const rootNode = (0, import_lexical6.$getRoot)();
|
|
23683
|
+
rootNode.selectStart();
|
|
23684
|
+
});
|
|
23685
|
+
}, [editor, tableCellNode]);
|
|
23686
|
+
const insertTableRowAtSelection = (0, import_react151.useCallback)(
|
|
23687
|
+
(shouldInsertAfter) => {
|
|
23688
|
+
editor.update(() => {
|
|
23689
|
+
(0, import_table2.$insertTableRow__EXPERIMENTAL)(shouldInsertAfter);
|
|
23690
|
+
});
|
|
23691
|
+
incrementMenuTriggerKey();
|
|
23692
|
+
},
|
|
23693
|
+
[editor]
|
|
23694
|
+
);
|
|
23695
|
+
const insertTableColumnAtSelection = (0, import_react151.useCallback)(
|
|
23696
|
+
(shouldInsertAfter) => {
|
|
23697
|
+
editor.update(() => {
|
|
23698
|
+
for (let i = 0; i < selectionCounts.columns; i++) {
|
|
23699
|
+
(0, import_table2.$insertTableColumn__EXPERIMENTAL)(shouldInsertAfter);
|
|
23700
|
+
}
|
|
23701
|
+
});
|
|
23702
|
+
incrementMenuTriggerKey();
|
|
23703
|
+
},
|
|
23704
|
+
[editor, selectionCounts.columns]
|
|
23705
|
+
);
|
|
23706
|
+
const deleteTableRowAtSelection = (0, import_react151.useCallback)(() => {
|
|
23707
|
+
editor.update(() => {
|
|
23708
|
+
(0, import_table2.$deleteTableRow__EXPERIMENTAL)();
|
|
23709
|
+
});
|
|
23710
|
+
incrementMenuTriggerKey();
|
|
23711
|
+
}, [editor]);
|
|
23712
|
+
const deleteTableAtSelection = (0, import_react151.useCallback)(() => {
|
|
23713
|
+
editor.update(() => {
|
|
23714
|
+
const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
23715
|
+
tableNode.remove();
|
|
23716
|
+
clearTableSelection();
|
|
23717
|
+
});
|
|
23718
|
+
}, [editor, tableCellNode, clearTableSelection]);
|
|
23719
|
+
const deleteTableColumnAtSelection = (0, import_react151.useCallback)(() => {
|
|
23720
|
+
editor.update(() => {
|
|
23721
|
+
(0, import_table2.$deleteTableColumn__EXPERIMENTAL)();
|
|
23722
|
+
clearTableSelection();
|
|
23723
|
+
});
|
|
23724
|
+
incrementMenuTriggerKey();
|
|
23725
|
+
}, [editor, clearTableSelection]);
|
|
23726
|
+
const toggleTableRowIsHeader = (0, import_react151.useCallback)(() => {
|
|
23727
|
+
editor.update(() => {
|
|
23728
|
+
const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
23729
|
+
const tableRowIndex = (0, import_table2.$getTableRowIndexFromTableCellNode)(tableCellNode);
|
|
23730
|
+
const tableRows = tableNode.getChildren();
|
|
23731
|
+
if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
|
|
23732
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
23733
|
+
}
|
|
23734
|
+
const tableRow2 = tableRows[tableRowIndex];
|
|
23735
|
+
if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
|
|
23736
|
+
throw new Error("Expected table row");
|
|
23737
|
+
}
|
|
23738
|
+
tableRow2.getChildren().forEach((tableCell) => {
|
|
23739
|
+
if (!(0, import_table2.$isTableCellNode)(tableCell)) {
|
|
23740
|
+
throw new Error("Expected table cell");
|
|
23741
|
+
}
|
|
23742
|
+
tableCell.toggleHeaderStyle(import_table2.TableCellHeaderStates.ROW);
|
|
23743
|
+
});
|
|
23744
|
+
clearTableSelection();
|
|
23745
|
+
});
|
|
23746
|
+
}, [editor, tableCellNode, clearTableSelection]);
|
|
23747
|
+
const toggleTableColumnIsHeader = (0, import_react151.useCallback)(() => {
|
|
23748
|
+
editor.update(() => {
|
|
23749
|
+
const tableNode = (0, import_table2.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
23750
|
+
const tableColumnIndex = (0, import_table2.$getTableColumnIndexFromTableCellNode)(tableCellNode);
|
|
23751
|
+
const tableRows = tableNode.getChildren();
|
|
23752
|
+
const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length));
|
|
23753
|
+
if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {
|
|
23754
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
23755
|
+
}
|
|
23756
|
+
for (let r = 0; r < tableRows.length; r++) {
|
|
23757
|
+
const tableRow2 = tableRows[r];
|
|
23758
|
+
if (!(0, import_table2.$isTableRowNode)(tableRow2)) {
|
|
23759
|
+
throw new Error("Expected table row");
|
|
23760
|
+
}
|
|
23761
|
+
const tableCells = tableRow2.getChildren();
|
|
23762
|
+
if (tableColumnIndex >= tableCells.length) {
|
|
23763
|
+
continue;
|
|
23764
|
+
}
|
|
23765
|
+
const tableCell = tableCells[tableColumnIndex];
|
|
23766
|
+
if (!(0, import_table2.$isTableCellNode)(tableCell)) {
|
|
23767
|
+
throw new Error("Expected table cell");
|
|
23768
|
+
}
|
|
23769
|
+
tableCell.toggleHeaderStyle(import_table2.TableCellHeaderStates.COLUMN);
|
|
23770
|
+
}
|
|
23771
|
+
clearTableSelection();
|
|
23772
|
+
});
|
|
23773
|
+
}, [editor, tableCellNode, clearTableSelection]);
|
|
23774
|
+
const menuItemCss = (0, import_react150.css)({
|
|
23775
|
+
fontSize: "var(--fs-sm)"
|
|
23776
|
+
});
|
|
23777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
|
|
23778
|
+
Menu,
|
|
23779
|
+
{
|
|
23780
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
23781
|
+
TableActionMenuTrigger,
|
|
23782
|
+
{
|
|
23783
|
+
tableCellEl,
|
|
23784
|
+
positioningAnchorEl
|
|
23785
|
+
},
|
|
23786
|
+
menuTriggerKey
|
|
23787
|
+
),
|
|
23788
|
+
portalElement: menuPortalEl,
|
|
23789
|
+
maxMenuHeight: "300px",
|
|
23790
|
+
children: [
|
|
23791
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
|
|
23792
|
+
MenuItem,
|
|
23793
|
+
{
|
|
23794
|
+
onClick: () => {
|
|
23795
|
+
insertTableRowAtSelection(false);
|
|
23796
|
+
},
|
|
23797
|
+
css: menuItemCss,
|
|
23798
|
+
children: [
|
|
23799
|
+
"Insert ",
|
|
23800
|
+
selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
|
|
23801
|
+
" above"
|
|
23802
|
+
]
|
|
23803
|
+
}
|
|
23804
|
+
),
|
|
23805
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => insertTableRowAtSelection(true), css: menuItemCss, children: [
|
|
23806
|
+
"Insert ",
|
|
23807
|
+
selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`,
|
|
23808
|
+
" below"
|
|
23809
|
+
] }),
|
|
23810
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItemSeparator, {}),
|
|
23811
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(false), css: menuItemCss, children: [
|
|
23812
|
+
"Insert ",
|
|
23813
|
+
selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
|
|
23814
|
+
" left"
|
|
23815
|
+
] }),
|
|
23816
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => insertTableColumnAtSelection(true), css: menuItemCss, children: [
|
|
23817
|
+
"Insert ",
|
|
23818
|
+
selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`,
|
|
23819
|
+
" right"
|
|
23820
|
+
] }),
|
|
23821
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItemSeparator, {}),
|
|
23822
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItem, { onClick: () => deleteTableColumnAtSelection(), css: menuItemCss, children: "Delete column" }),
|
|
23823
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItem, { onClick: () => deleteTableRowAtSelection(), css: menuItemCss, children: "Delete row" }),
|
|
23824
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItem, { onClick: () => deleteTableAtSelection(), css: menuItemCss, children: "Delete table" }),
|
|
23825
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MenuItemSeparator, {}),
|
|
23826
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => toggleTableRowIsHeader(), css: menuItemCss, children: [
|
|
23827
|
+
(tableCellNode.__headerState & import_table2.TableCellHeaderStates.ROW) === import_table2.TableCellHeaderStates.ROW ? "Remove" : "Add",
|
|
23828
|
+
" ",
|
|
23829
|
+
"row header"
|
|
23830
|
+
] }),
|
|
23831
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(MenuItem, { onClick: () => toggleTableColumnIsHeader(), css: menuItemCss, children: [
|
|
23832
|
+
(tableCellNode.__headerState & import_table2.TableCellHeaderStates.COLUMN) === import_table2.TableCellHeaderStates.COLUMN ? "Remove" : "Add",
|
|
23833
|
+
" ",
|
|
23834
|
+
"column header"
|
|
23835
|
+
] })
|
|
23836
|
+
]
|
|
23837
|
+
}
|
|
23838
|
+
);
|
|
23839
|
+
}
|
|
23840
|
+
function TableCellActionMenuContainer({
|
|
23841
|
+
menuPortalEl,
|
|
23842
|
+
positioningAnchorEl
|
|
23843
|
+
}) {
|
|
23844
|
+
const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
|
|
23845
|
+
const [tableCellNode, setTableMenuCellNode] = (0, import_react151.useState)(null);
|
|
23846
|
+
const [tableCellNodeEl, _setTableMenuCellNodeEl] = (0, import_react151.useState)(null);
|
|
23847
|
+
const [tableCellMenuPortalEl, setTableMenuCellMenuPortalEl] = (0, import_react151.useState)(null);
|
|
23848
|
+
(0, import_react151.useEffect)(() => {
|
|
23849
|
+
const newPortalEl = document.createElement("div");
|
|
23850
|
+
setTableMenuCellMenuPortalEl(newPortalEl);
|
|
23851
|
+
menuPortalEl.appendChild(newPortalEl);
|
|
23852
|
+
return () => {
|
|
23853
|
+
newPortalEl.remove();
|
|
23854
|
+
};
|
|
23855
|
+
}, [menuPortalEl]);
|
|
23856
|
+
const setTableMenuCellNodeElem = (0, import_react151.useCallback)((elem) => {
|
|
23857
|
+
if (elem) {
|
|
23858
|
+
_setTableMenuCellNodeEl(elem);
|
|
23859
|
+
} else {
|
|
23860
|
+
_setTableMenuCellNodeEl(null);
|
|
23861
|
+
}
|
|
23862
|
+
}, []);
|
|
23863
|
+
const $moveMenu = (0, import_react151.useCallback)(() => {
|
|
23864
|
+
const selection = (0, import_lexical6.$getSelection)();
|
|
23865
|
+
const nativeSelection = window.getSelection();
|
|
23866
|
+
const activeElement = document.activeElement;
|
|
23867
|
+
if (selection == null) {
|
|
23868
|
+
setTableMenuCellNode(null);
|
|
23869
|
+
return;
|
|
23870
|
+
}
|
|
23871
|
+
const rootElement = editor.getRootElement();
|
|
23872
|
+
if ((0, import_lexical6.$isRangeSelection)(selection) && rootElement !== null && nativeSelection !== null && rootElement.contains(nativeSelection.anchorNode)) {
|
|
23873
|
+
const tableCellNodeFromSelection = (0, import_table2.$getTableCellNodeFromLexicalNode)(selection.anchor.getNode());
|
|
23874
|
+
if (tableCellNodeFromSelection == null) {
|
|
23875
|
+
setTableMenuCellNode(null);
|
|
23876
|
+
setTableMenuCellNodeElem(null);
|
|
23877
|
+
return;
|
|
23878
|
+
}
|
|
23879
|
+
const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
|
|
23880
|
+
if (tableCellParentNodeDOM == null) {
|
|
23881
|
+
setTableMenuCellNode(null);
|
|
23882
|
+
setTableMenuCellNodeElem(null);
|
|
23883
|
+
return;
|
|
23884
|
+
}
|
|
23885
|
+
setTableMenuCellNode(tableCellNodeFromSelection);
|
|
23886
|
+
setTableMenuCellNodeElem(tableCellParentNodeDOM);
|
|
23887
|
+
} else if (!activeElement) {
|
|
23888
|
+
setTableMenuCellNode(null);
|
|
23889
|
+
setTableMenuCellNodeElem(null);
|
|
23890
|
+
}
|
|
23891
|
+
}, [editor, setTableMenuCellNodeElem]);
|
|
23892
|
+
(0, import_react151.useEffect)(() => {
|
|
23893
|
+
return editor.registerUpdateListener(() => {
|
|
23894
|
+
editor.getEditorState().read(() => {
|
|
23895
|
+
$moveMenu();
|
|
23896
|
+
});
|
|
23897
|
+
});
|
|
23898
|
+
});
|
|
23899
|
+
return tableCellNode != null && tableCellNodeEl != null && tableCellMenuPortalEl != null && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
23900
|
+
TableActionMenu,
|
|
23901
|
+
{
|
|
23902
|
+
tableCellNode,
|
|
23903
|
+
menuPortalEl: tableCellMenuPortalEl,
|
|
23904
|
+
tableCellEl: tableCellNodeEl,
|
|
23905
|
+
positioningAnchorEl
|
|
23906
|
+
},
|
|
23907
|
+
tableCellNode.getKey()
|
|
23908
|
+
);
|
|
23909
|
+
}
|
|
23910
|
+
function TableActionMenuPlugin({ positioningAnchorEl }) {
|
|
23911
|
+
const isEditable = (0, import_useLexicalEditable.useLexicalEditable)();
|
|
23912
|
+
return isEditable ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
23913
|
+
TableCellActionMenuContainer,
|
|
23914
|
+
{
|
|
23915
|
+
menuPortalEl: positioningAnchorEl,
|
|
23916
|
+
positioningAnchorEl
|
|
23917
|
+
}
|
|
23918
|
+
) : null;
|
|
23919
|
+
}
|
|
23920
|
+
|
|
23921
|
+
// src/components/ParameterInputs/rich-text/TableCellResizerPlugin.tsx
|
|
23922
|
+
init_emotion_jsx_shim();
|
|
23923
|
+
var import_react152 = require("@emotion/react");
|
|
23924
|
+
var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
|
|
23925
|
+
var import_useLexicalEditable2 = require("@lexical/react/useLexicalEditable");
|
|
23926
|
+
var import_table3 = require("@lexical/table");
|
|
23927
|
+
var import_utils11 = require("@lexical/utils");
|
|
23928
|
+
var import_lexical7 = require("lexical");
|
|
23929
|
+
var import_react153 = require("react");
|
|
23930
|
+
var import_react_dom3 = require("react-dom");
|
|
23931
|
+
var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
|
|
23932
|
+
var MIN_ROW_HEIGHT = 33;
|
|
23933
|
+
var MIN_COLUMN_WIDTH = 50;
|
|
23934
|
+
var tableResizer = import_react152.css`
|
|
23935
|
+
position: absolute;
|
|
23936
|
+
z-index: var(--z-10);
|
|
23937
|
+
`;
|
|
23938
|
+
var fixedGetDOMCellFromTarget = (node) => {
|
|
23939
|
+
let currentNode = node;
|
|
23940
|
+
while (currentNode != null) {
|
|
23941
|
+
const nodeName = currentNode.nodeName;
|
|
23942
|
+
if (nodeName === "TD" || nodeName === "TH") {
|
|
23943
|
+
const cell2 = currentNode._cell;
|
|
23944
|
+
if (cell2 === void 0) {
|
|
23945
|
+
return {
|
|
23946
|
+
elem: currentNode
|
|
23947
|
+
};
|
|
23948
|
+
}
|
|
23949
|
+
return cell2;
|
|
23950
|
+
}
|
|
23951
|
+
currentNode = currentNode.parentNode;
|
|
23952
|
+
}
|
|
23953
|
+
return null;
|
|
23954
|
+
};
|
|
23955
|
+
function TableCellResizer({ editor, positioningAnchorEl }) {
|
|
23956
|
+
const targetRef = (0, import_react153.useRef)(null);
|
|
23957
|
+
const resizerRef = (0, import_react153.useRef)(null);
|
|
23958
|
+
const tableRectRef = (0, import_react153.useRef)(null);
|
|
23959
|
+
const mouseStartPosRef = (0, import_react153.useRef)(null);
|
|
23960
|
+
const [mouseCurrentPos, updateMouseCurrentPos] = (0, import_react153.useState)(null);
|
|
23961
|
+
const [activeCell, updateActiveCell] = (0, import_react153.useState)(null);
|
|
23962
|
+
const [isMouseDown, updateIsMouseDown] = (0, import_react153.useState)(false);
|
|
23963
|
+
const [draggingDirection, updateDraggingDirection] = (0, import_react153.useState)(null);
|
|
23964
|
+
const resetState = (0, import_react153.useCallback)(() => {
|
|
23965
|
+
updateActiveCell(null);
|
|
23966
|
+
targetRef.current = null;
|
|
23967
|
+
updateDraggingDirection(null);
|
|
23968
|
+
mouseStartPosRef.current = null;
|
|
23969
|
+
tableRectRef.current = null;
|
|
23970
|
+
}, []);
|
|
23971
|
+
const isMouseDownOnEvent = (event) => {
|
|
23972
|
+
return (event.buttons & 1) === 1;
|
|
23973
|
+
};
|
|
23974
|
+
(0, import_react153.useEffect)(() => {
|
|
23975
|
+
const onMouseMove = (event) => {
|
|
23976
|
+
setTimeout(() => {
|
|
23977
|
+
const target = event.target;
|
|
23978
|
+
if (draggingDirection) {
|
|
23979
|
+
updateMouseCurrentPos({
|
|
23980
|
+
x: event.clientX,
|
|
23981
|
+
y: event.clientY
|
|
23982
|
+
});
|
|
23983
|
+
return;
|
|
23984
|
+
}
|
|
23985
|
+
updateIsMouseDown(isMouseDownOnEvent(event));
|
|
23986
|
+
if (resizerRef.current && resizerRef.current.contains(target)) {
|
|
23987
|
+
return;
|
|
23988
|
+
}
|
|
23989
|
+
if (targetRef.current !== target) {
|
|
23990
|
+
targetRef.current = target;
|
|
23991
|
+
const cell2 = fixedGetDOMCellFromTarget(target);
|
|
23992
|
+
if (cell2 && activeCell !== cell2) {
|
|
23993
|
+
editor.update(() => {
|
|
23994
|
+
const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(cell2.elem);
|
|
23995
|
+
if (!tableCellNode) {
|
|
23996
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
23997
|
+
}
|
|
23998
|
+
const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
23999
|
+
const tableElement2 = editor.getElementByKey(tableNode.getKey());
|
|
24000
|
+
if (!tableElement2) {
|
|
24001
|
+
throw new Error("TableCellResizer: Table element not found.");
|
|
24002
|
+
}
|
|
24003
|
+
targetRef.current = target;
|
|
24004
|
+
tableRectRef.current = tableElement2.getBoundingClientRect();
|
|
24005
|
+
updateActiveCell(cell2);
|
|
24006
|
+
});
|
|
24007
|
+
} else if (cell2 == null) {
|
|
24008
|
+
resetState();
|
|
24009
|
+
}
|
|
24010
|
+
}
|
|
24011
|
+
}, 0);
|
|
24012
|
+
};
|
|
24013
|
+
const onMouseDown = () => {
|
|
24014
|
+
setTimeout(() => {
|
|
24015
|
+
updateIsMouseDown(true);
|
|
24016
|
+
}, 0);
|
|
24017
|
+
};
|
|
24018
|
+
const onMouseUp = () => {
|
|
24019
|
+
setTimeout(() => {
|
|
24020
|
+
updateIsMouseDown(false);
|
|
24021
|
+
}, 0);
|
|
24022
|
+
};
|
|
24023
|
+
const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {
|
|
24024
|
+
rootElement == null ? void 0 : rootElement.addEventListener("mousemove", onMouseMove);
|
|
24025
|
+
rootElement == null ? void 0 : rootElement.addEventListener("mousedown", onMouseDown);
|
|
24026
|
+
rootElement == null ? void 0 : rootElement.addEventListener("mouseup", onMouseUp);
|
|
24027
|
+
prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousemove", onMouseMove);
|
|
24028
|
+
prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousedown", onMouseDown);
|
|
24029
|
+
prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mouseup", onMouseUp);
|
|
24030
|
+
});
|
|
24031
|
+
return () => {
|
|
24032
|
+
removeRootListener();
|
|
24033
|
+
};
|
|
24034
|
+
}, [activeCell, draggingDirection, editor, resetState]);
|
|
24035
|
+
const isHeightChanging = (direction) => {
|
|
24036
|
+
if (direction === "bottom") {
|
|
24037
|
+
return true;
|
|
24038
|
+
}
|
|
24039
|
+
return false;
|
|
24040
|
+
};
|
|
24041
|
+
const updateRowHeight = (0, import_react153.useCallback)(
|
|
24042
|
+
(heightChange) => {
|
|
24043
|
+
if (!activeCell) {
|
|
24044
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
24045
|
+
}
|
|
24046
|
+
editor.update(
|
|
24047
|
+
() => {
|
|
24048
|
+
const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
|
|
24049
|
+
if (!(0, import_table3.$isTableCellNode)(tableCellNode)) {
|
|
24050
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
24051
|
+
}
|
|
24052
|
+
const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
24053
|
+
const tableRowIndex = (0, import_table3.$getTableRowIndexFromTableCellNode)(tableCellNode);
|
|
24054
|
+
const tableRows = tableNode.getChildren();
|
|
24055
|
+
if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
|
|
24056
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
24057
|
+
}
|
|
24058
|
+
const tableRow2 = tableRows[tableRowIndex];
|
|
24059
|
+
if (!(0, import_table3.$isTableRowNode)(tableRow2)) {
|
|
24060
|
+
throw new Error("Expected table row");
|
|
24061
|
+
}
|
|
24062
|
+
let height = tableRow2.getHeight();
|
|
24063
|
+
if (height === void 0) {
|
|
24064
|
+
const rowCells = tableRow2.getChildren();
|
|
24065
|
+
height = Math.min(...rowCells.map((cell2) => {
|
|
24066
|
+
var _a;
|
|
24067
|
+
return (_a = getCellNodeHeight(cell2, editor)) != null ? _a : Infinity;
|
|
24068
|
+
}));
|
|
24069
|
+
}
|
|
24070
|
+
const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);
|
|
24071
|
+
tableRow2.setHeight(newHeight);
|
|
24072
|
+
},
|
|
24073
|
+
{ tag: "skip-scroll-into-view" }
|
|
24074
|
+
);
|
|
24075
|
+
},
|
|
24076
|
+
[activeCell, editor]
|
|
24077
|
+
);
|
|
24078
|
+
const getCellNodeWidth = (cell2, activeEditor) => {
|
|
24079
|
+
const width = cell2.getWidth();
|
|
24080
|
+
if (width !== void 0) {
|
|
24081
|
+
return width;
|
|
24082
|
+
}
|
|
24083
|
+
const domCellNode = activeEditor.getElementByKey(cell2.getKey());
|
|
24084
|
+
if (domCellNode == null) {
|
|
24085
|
+
return void 0;
|
|
24086
|
+
}
|
|
24087
|
+
const computedStyle = getComputedStyle(domCellNode);
|
|
24088
|
+
return domCellNode.clientWidth - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight);
|
|
24089
|
+
};
|
|
24090
|
+
const getCellNodeHeight = (cell2, activeEditor) => {
|
|
24091
|
+
const domCellNode = activeEditor.getElementByKey(cell2.getKey());
|
|
24092
|
+
return domCellNode == null ? void 0 : domCellNode.clientHeight;
|
|
24093
|
+
};
|
|
24094
|
+
const getCellColumnIndex = (tableCellNode, tableMap) => {
|
|
24095
|
+
for (let row = 0; row < tableMap.length; row++) {
|
|
24096
|
+
for (let column = 0; column < tableMap[row].length; column++) {
|
|
24097
|
+
if (tableMap[row][column].cell === tableCellNode) {
|
|
24098
|
+
return column;
|
|
24099
|
+
}
|
|
24100
|
+
}
|
|
24101
|
+
}
|
|
24102
|
+
};
|
|
24103
|
+
const updateColumnWidth = (0, import_react153.useCallback)(
|
|
24104
|
+
(widthChange) => {
|
|
24105
|
+
if (!activeCell) {
|
|
24106
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
24107
|
+
}
|
|
24108
|
+
editor.update(
|
|
24109
|
+
() => {
|
|
24110
|
+
const tableCellNode = (0, import_lexical7.$getNearestNodeFromDOMNode)(activeCell.elem);
|
|
24111
|
+
if (!(0, import_table3.$isTableCellNode)(tableCellNode)) {
|
|
24112
|
+
throw new Error("TableCellResizer: Table cell node not found.");
|
|
24113
|
+
}
|
|
24114
|
+
const tableNode = (0, import_table3.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
|
|
24115
|
+
const [tableMap] = (0, import_table3.$computeTableMapSkipCellCheck)(tableNode, null, null);
|
|
24116
|
+
const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
|
|
24117
|
+
if (columnIndex === void 0) {
|
|
24118
|
+
throw new Error("TableCellResizer: Table column not found.");
|
|
24119
|
+
}
|
|
24120
|
+
for (let row = 0; row < tableMap.length; row++) {
|
|
24121
|
+
const cell2 = tableMap[row][columnIndex];
|
|
24122
|
+
if (cell2.startRow === row && (columnIndex === tableMap[row].length - 1 || tableMap[row][columnIndex].cell !== tableMap[row][columnIndex + 1].cell)) {
|
|
24123
|
+
const width = getCellNodeWidth(cell2.cell, editor);
|
|
24124
|
+
if (width === void 0) {
|
|
24125
|
+
continue;
|
|
24126
|
+
}
|
|
24127
|
+
const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);
|
|
24128
|
+
cell2.cell.setWidth(newWidth);
|
|
24129
|
+
}
|
|
24130
|
+
}
|
|
24131
|
+
},
|
|
24132
|
+
{ tag: "skip-scroll-into-view" }
|
|
24133
|
+
);
|
|
24134
|
+
},
|
|
24135
|
+
[activeCell, editor]
|
|
24136
|
+
);
|
|
24137
|
+
const mouseUpHandler = (0, import_react153.useCallback)(
|
|
24138
|
+
(direction) => {
|
|
24139
|
+
const handler = (event) => {
|
|
24140
|
+
event.preventDefault();
|
|
24141
|
+
event.stopPropagation();
|
|
24142
|
+
if (!activeCell) {
|
|
24143
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
24144
|
+
}
|
|
24145
|
+
if (mouseStartPosRef.current) {
|
|
24146
|
+
const { x, y } = mouseStartPosRef.current;
|
|
24147
|
+
if (activeCell === null) {
|
|
24148
|
+
return;
|
|
24149
|
+
}
|
|
24150
|
+
const zoom = (0, import_utils11.calculateZoomLevel)(event.target);
|
|
24151
|
+
if (isHeightChanging(direction)) {
|
|
24152
|
+
const heightChange = (event.clientY - y) / zoom;
|
|
24153
|
+
updateRowHeight(heightChange);
|
|
24154
|
+
} else {
|
|
24155
|
+
const widthChange = (event.clientX - x) / zoom;
|
|
24156
|
+
updateColumnWidth(widthChange);
|
|
24157
|
+
}
|
|
24158
|
+
resetState();
|
|
24159
|
+
document.removeEventListener("mouseup", handler);
|
|
24160
|
+
}
|
|
24161
|
+
};
|
|
24162
|
+
return handler;
|
|
24163
|
+
},
|
|
24164
|
+
[activeCell, resetState, updateColumnWidth, updateRowHeight]
|
|
24165
|
+
);
|
|
24166
|
+
const toggleResize = (0, import_react153.useCallback)(
|
|
24167
|
+
(direction) => (event) => {
|
|
24168
|
+
event.preventDefault();
|
|
24169
|
+
event.stopPropagation();
|
|
24170
|
+
if (!activeCell) {
|
|
24171
|
+
throw new Error("TableCellResizer: Expected active cell.");
|
|
24172
|
+
}
|
|
24173
|
+
mouseStartPosRef.current = {
|
|
24174
|
+
x: event.clientX,
|
|
24175
|
+
y: event.clientY
|
|
24176
|
+
};
|
|
24177
|
+
updateMouseCurrentPos(mouseStartPosRef.current);
|
|
24178
|
+
updateDraggingDirection(direction);
|
|
24179
|
+
document.addEventListener("mouseup", mouseUpHandler(direction));
|
|
24180
|
+
},
|
|
24181
|
+
[activeCell, mouseUpHandler]
|
|
24182
|
+
);
|
|
24183
|
+
const getResizers = (0, import_react153.useCallback)(() => {
|
|
24184
|
+
if (activeCell) {
|
|
24185
|
+
const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
|
|
24186
|
+
const parentRect = positioningAnchorEl.getBoundingClientRect();
|
|
24187
|
+
const zoom = (0, import_utils11.calculateZoomLevel)(activeCell.elem);
|
|
24188
|
+
const zoneWidth = 10;
|
|
24189
|
+
const styles = {
|
|
24190
|
+
bottom: {
|
|
24191
|
+
backgroundColor: "none",
|
|
24192
|
+
cursor: "row-resize",
|
|
24193
|
+
height: `${zoneWidth}px`,
|
|
24194
|
+
left: `${left - parentRect.left}px`,
|
|
24195
|
+
top: `${top - parentRect.top + height - zoneWidth / 2}px`,
|
|
24196
|
+
width: `${width}px`
|
|
24197
|
+
},
|
|
24198
|
+
right: {
|
|
24199
|
+
backgroundColor: "none",
|
|
24200
|
+
cursor: "col-resize",
|
|
24201
|
+
height: `${height}px`,
|
|
24202
|
+
left: `${left - parentRect.left + width - zoneWidth / 2}px`,
|
|
24203
|
+
top: `${top - parentRect.top}px`,
|
|
24204
|
+
width: `${zoneWidth}px`
|
|
24205
|
+
}
|
|
24206
|
+
};
|
|
24207
|
+
const tableRect = tableRectRef.current;
|
|
24208
|
+
if (draggingDirection && mouseCurrentPos && tableRect) {
|
|
24209
|
+
if (isHeightChanging(draggingDirection)) {
|
|
24210
|
+
styles[draggingDirection].left = `${tableRect.left - parentRect.left}px`;
|
|
24211
|
+
styles[draggingDirection].top = `${(mouseCurrentPos.y - parentRect.top) / zoom}px`;
|
|
24212
|
+
styles[draggingDirection].height = "3px";
|
|
24213
|
+
styles[draggingDirection].width = `${tableRect.width}px`;
|
|
24214
|
+
} else {
|
|
24215
|
+
styles[draggingDirection].top = `${tableRect.top - parentRect.top}px`;
|
|
24216
|
+
styles[draggingDirection].left = `${(mouseCurrentPos.x - parentRect.left) / zoom}px`;
|
|
24217
|
+
styles[draggingDirection].width = "3px";
|
|
24218
|
+
styles[draggingDirection].height = `${tableRect.height}px`;
|
|
24219
|
+
}
|
|
24220
|
+
styles[draggingDirection].backgroundColor = "#adf";
|
|
24221
|
+
}
|
|
24222
|
+
return styles;
|
|
24223
|
+
}
|
|
24224
|
+
return {
|
|
24225
|
+
bottom: null,
|
|
24226
|
+
left: null,
|
|
24227
|
+
right: null,
|
|
24228
|
+
top: null
|
|
24229
|
+
};
|
|
24230
|
+
}, [activeCell, draggingDirection, mouseCurrentPos, positioningAnchorEl]);
|
|
24231
|
+
const resizerStyles = getResizers();
|
|
24232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { ref: resizerRef, children: activeCell != null && !isMouseDown && /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [
|
|
24233
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
24234
|
+
"div",
|
|
24235
|
+
{
|
|
24236
|
+
css: tableResizer,
|
|
24237
|
+
style: resizerStyles.right || void 0,
|
|
24238
|
+
onMouseDown: toggleResize("right")
|
|
24239
|
+
}
|
|
24240
|
+
),
|
|
24241
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
24242
|
+
"div",
|
|
24243
|
+
{
|
|
24244
|
+
css: tableResizer,
|
|
24245
|
+
style: resizerStyles.bottom || void 0,
|
|
24246
|
+
onMouseDown: toggleResize("bottom")
|
|
24247
|
+
}
|
|
24248
|
+
)
|
|
24249
|
+
] }) });
|
|
24250
|
+
}
|
|
24251
|
+
function TableCellResizerPlugin({ positioningAnchorEl }) {
|
|
24252
|
+
const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
|
|
24253
|
+
const isEditable = (0, import_useLexicalEditable2.useLexicalEditable)();
|
|
24254
|
+
return (0, import_react153.useMemo)(
|
|
24255
|
+
() => isEditable ? (0, import_react_dom3.createPortal)(
|
|
24256
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(TableCellResizer, { editor, positioningAnchorEl }),
|
|
24257
|
+
positioningAnchorEl
|
|
24258
|
+
) : null,
|
|
24259
|
+
[editor, isEditable, positioningAnchorEl]
|
|
24260
|
+
);
|
|
24261
|
+
}
|
|
24262
|
+
|
|
24263
|
+
// src/components/ParameterInputs/ParameterRichText.tsx
|
|
24264
|
+
var import_jsx_runtime133 = require("@emotion/react/jsx-runtime");
|
|
23470
24265
|
var ParameterRichText = ({
|
|
23471
24266
|
label,
|
|
23472
24267
|
labelLeadingIcon,
|
|
@@ -23485,13 +24280,16 @@ var ParameterRichText = ({
|
|
|
23485
24280
|
readOnly,
|
|
23486
24281
|
editorWrapperClassName,
|
|
23487
24282
|
editorInputClassName,
|
|
24283
|
+
editorInputWrapperClassName,
|
|
23488
24284
|
editorFooter,
|
|
23489
24285
|
customNodes,
|
|
23490
24286
|
children,
|
|
23491
24287
|
variables,
|
|
23492
|
-
customControls
|
|
24288
|
+
customControls,
|
|
24289
|
+
onInsertTable,
|
|
24290
|
+
minimalInteractivity
|
|
23493
24291
|
}) => {
|
|
23494
|
-
return /* @__PURE__ */ (0,
|
|
24292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
23495
24293
|
ParameterShell,
|
|
23496
24294
|
{
|
|
23497
24295
|
"data-testid": "parameter-richtext",
|
|
@@ -23505,7 +24303,7 @@ var ParameterRichText = ({
|
|
|
23505
24303
|
captionTestId,
|
|
23506
24304
|
menuItems,
|
|
23507
24305
|
children: [
|
|
23508
|
-
/* @__PURE__ */ (0,
|
|
24306
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
23509
24307
|
ParameterRichTextInner,
|
|
23510
24308
|
{
|
|
23511
24309
|
value,
|
|
@@ -23516,30 +24314,33 @@ var ParameterRichText = ({
|
|
|
23516
24314
|
readOnly,
|
|
23517
24315
|
editorWrapperClassName,
|
|
23518
24316
|
editorInputClassName,
|
|
24317
|
+
editorInputWrapperClassName,
|
|
23519
24318
|
editorFooter,
|
|
23520
24319
|
customNodes,
|
|
23521
24320
|
variables,
|
|
23522
24321
|
customControls,
|
|
24322
|
+
onInsertTable,
|
|
24323
|
+
minimalInteractivity,
|
|
23523
24324
|
children
|
|
23524
24325
|
}
|
|
23525
24326
|
),
|
|
23526
|
-
menuItems ? /* @__PURE__ */ (0,
|
|
24327
|
+
menuItems ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ParameterMenuButton, { label: `${label} menu`, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_jsx_runtime133.Fragment, { children: menuItems }) }) : null
|
|
23527
24328
|
]
|
|
23528
24329
|
}
|
|
23529
24330
|
);
|
|
23530
24331
|
};
|
|
23531
|
-
var editorWrapper =
|
|
24332
|
+
var editorWrapper = import_react154.css`
|
|
23532
24333
|
display: flex;
|
|
23533
24334
|
flex-flow: column;
|
|
23534
24335
|
flex-grow: 1;
|
|
23535
24336
|
`;
|
|
23536
|
-
var editorContainer =
|
|
24337
|
+
var editorContainer = import_react154.css`
|
|
23537
24338
|
display: flex;
|
|
23538
24339
|
flex-flow: column;
|
|
23539
24340
|
flex-grow: 1;
|
|
23540
24341
|
position: relative;
|
|
23541
24342
|
`;
|
|
23542
|
-
var editorPlaceholder =
|
|
24343
|
+
var editorPlaceholder = import_react154.css`
|
|
23543
24344
|
color: var(--gray-500);
|
|
23544
24345
|
font-style: italic;
|
|
23545
24346
|
/* 1px is added to make sure caret is clearly visible when field is focused
|
|
@@ -23550,7 +24351,7 @@ var editorPlaceholder = import_react150.css`
|
|
|
23550
24351
|
top: var(--spacing-sm);
|
|
23551
24352
|
user-select: none;
|
|
23552
24353
|
`;
|
|
23553
|
-
var editorInput =
|
|
24354
|
+
var editorInput = import_react154.css`
|
|
23554
24355
|
background: var(--white);
|
|
23555
24356
|
border: 1px solid var(--gray-200);
|
|
23556
24357
|
border-radius: var(--rounded-sm);
|
|
@@ -23578,11 +24379,14 @@ var ParameterRichTextInner = ({
|
|
|
23578
24379
|
readOnly,
|
|
23579
24380
|
editorWrapperClassName,
|
|
23580
24381
|
editorInputClassName,
|
|
24382
|
+
editorInputWrapperClassName,
|
|
23581
24383
|
editorFooter,
|
|
23582
24384
|
children,
|
|
23583
24385
|
customNodes,
|
|
23584
24386
|
variables,
|
|
23585
|
-
customControls
|
|
24387
|
+
customControls,
|
|
24388
|
+
onInsertTable,
|
|
24389
|
+
minimalInteractivity
|
|
23586
24390
|
}) => {
|
|
23587
24391
|
const lexicalConfig = {
|
|
23588
24392
|
namespace: "uniform",
|
|
@@ -23596,8 +24400,11 @@ var ParameterRichTextInner = ({
|
|
|
23596
24400
|
LinkNode,
|
|
23597
24401
|
import_rich_text2.HeadingNode,
|
|
23598
24402
|
import_rich_text2.QuoteNode,
|
|
23599
|
-
|
|
24403
|
+
import_lexical8.ParagraphNode,
|
|
23600
24404
|
CustomCodeNode,
|
|
24405
|
+
import_table4.TableNode,
|
|
24406
|
+
import_table4.TableCellNode,
|
|
24407
|
+
import_table4.TableRowNode,
|
|
23601
24408
|
...customNodes != null ? customNodes : []
|
|
23602
24409
|
],
|
|
23603
24410
|
theme: {
|
|
@@ -23630,12 +24437,15 @@ var ParameterRichTextInner = ({
|
|
|
23630
24437
|
}
|
|
23631
24438
|
},
|
|
23632
24439
|
quote: blockquoteElement,
|
|
23633
|
-
code: codeElement
|
|
24440
|
+
code: codeElement,
|
|
24441
|
+
table: tableElement,
|
|
24442
|
+
tableCell: tableCellElement,
|
|
24443
|
+
tableCellHeader: tableHeaderElement
|
|
23634
24444
|
},
|
|
23635
24445
|
editable: !readOnly
|
|
23636
24446
|
};
|
|
23637
|
-
return /* @__PURE__ */ (0,
|
|
23638
|
-
/* @__PURE__ */ (0,
|
|
24447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
|
|
24448
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { css: [editorWrapper], className: editorWrapperClassName, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalComposer.LexicalComposer, { initialConfig: lexicalConfig, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
23639
24449
|
RichText,
|
|
23640
24450
|
{
|
|
23641
24451
|
onChange,
|
|
@@ -23644,8 +24454,11 @@ var ParameterRichTextInner = ({
|
|
|
23644
24454
|
onRichTextInit,
|
|
23645
24455
|
readOnly,
|
|
23646
24456
|
editorInputClassName,
|
|
24457
|
+
editorInputWrapperClassName,
|
|
23647
24458
|
variables,
|
|
23648
24459
|
customControls,
|
|
24460
|
+
onInsertTable,
|
|
24461
|
+
minimalInteractivity,
|
|
23649
24462
|
children
|
|
23650
24463
|
}
|
|
23651
24464
|
) }) }),
|
|
@@ -23668,18 +24481,20 @@ var RichText = ({
|
|
|
23668
24481
|
onRichTextInit,
|
|
23669
24482
|
readOnly,
|
|
23670
24483
|
editorInputClassName,
|
|
24484
|
+
editorInputWrapperClassName,
|
|
23671
24485
|
children,
|
|
23672
24486
|
variables,
|
|
23673
|
-
customControls
|
|
24487
|
+
customControls,
|
|
24488
|
+
onInsertTable,
|
|
24489
|
+
minimalInteractivity
|
|
23674
24490
|
}) => {
|
|
23675
|
-
const
|
|
23676
|
-
|
|
23677
|
-
(0, import_react151.useEffect)(() => {
|
|
24491
|
+
const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
|
|
24492
|
+
(0, import_react155.useEffect)(() => {
|
|
23678
24493
|
if (onRichTextInit) {
|
|
23679
24494
|
onRichTextInit(editor);
|
|
23680
24495
|
}
|
|
23681
24496
|
}, [editor, onRichTextInit]);
|
|
23682
|
-
(0,
|
|
24497
|
+
(0, import_react155.useEffect)(() => {
|
|
23683
24498
|
const removeUpdateListener = editor.registerUpdateListener(({ editorState, prevEditorState }) => {
|
|
23684
24499
|
requestAnimationFrame(() => {
|
|
23685
24500
|
if (!(0, import_fast_equals2.deepEqual)(editorState.toJSON(), prevEditorState.toJSON())) {
|
|
@@ -23691,54 +24506,73 @@ var RichText = ({
|
|
|
23691
24506
|
removeUpdateListener();
|
|
23692
24507
|
};
|
|
23693
24508
|
}, [editor, onChange]);
|
|
23694
|
-
(0,
|
|
24509
|
+
(0, import_react155.useEffect)(() => {
|
|
23695
24510
|
editor.setEditable(!readOnly);
|
|
23696
24511
|
}, [editor, readOnly]);
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
|
|
23708
|
-
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
23712
|
-
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
23723
|
-
|
|
23724
|
-
|
|
24512
|
+
const [editorContainerRef, setEditorContainerRef] = (0, import_react155.useState)(null);
|
|
24513
|
+
const onRef = (_editorContainerRef) => {
|
|
24514
|
+
if (_editorContainerRef !== null) {
|
|
24515
|
+
setEditorContainerRef(_editorContainerRef);
|
|
24516
|
+
}
|
|
24517
|
+
};
|
|
24518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
|
|
24519
|
+
readOnly || minimalInteractivity ? null : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(RichTextToolbar_default, { config, customControls, onInsertTable }),
|
|
24520
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
24521
|
+
"div",
|
|
24522
|
+
{
|
|
24523
|
+
css: editorContainer,
|
|
24524
|
+
className: editorInputWrapperClassName,
|
|
24525
|
+
ref: onRef,
|
|
24526
|
+
"data-testid": "value-container",
|
|
24527
|
+
children: [
|
|
24528
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
24529
|
+
import_LexicalRichTextPlugin.RichTextPlugin,
|
|
24530
|
+
{
|
|
24531
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalContentEditable.ContentEditable, { css: editorInput, className: editorInputClassName }),
|
|
24532
|
+
placeholder: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { css: editorPlaceholder, children: readOnly ? "empty" : "start editing..." }),
|
|
24533
|
+
ErrorBoundary: import_LexicalErrorBoundary.default
|
|
24534
|
+
}
|
|
24535
|
+
),
|
|
24536
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalListPlugin.ListPlugin, {}),
|
|
24537
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalTablePlugin.TablePlugin, {}),
|
|
24538
|
+
editorContainerRef && !minimalInteractivity ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableActionMenuPlugin, { positioningAnchorEl: editorContainerRef }) : null,
|
|
24539
|
+
editorContainerRef && !minimalInteractivity ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(TableCellResizerPlugin, { positioningAnchorEl: editorContainerRef }) : null,
|
|
24540
|
+
readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalHistoryPlugin.HistoryPlugin, {}),
|
|
24541
|
+
editorContainerRef ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
24542
|
+
LinkNodePlugin,
|
|
24543
|
+
{
|
|
24544
|
+
onConnectLink: onConnectLink ? onConnectLink : () => Promise.resolve(),
|
|
24545
|
+
getBoundPath: (variables == null ? void 0 : variables.bindVariables) ? (path) => {
|
|
24546
|
+
var _a, _b;
|
|
24547
|
+
return (_b = (_a = variables.bindVariables) == null ? void 0 : _a.call(variables, path)) != null ? _b : path;
|
|
24548
|
+
} : void 0,
|
|
24549
|
+
positioningAnchorEl: editorContainerRef
|
|
24550
|
+
}
|
|
24551
|
+
) : null,
|
|
24552
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ListIndentPlugin, { maxDepth: 4 }),
|
|
24553
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DisableStylesPlugin, {}),
|
|
24554
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_LexicalMarkdownShortcutPlugin.MarkdownShortcutPlugin, { transformers: MARKDOWN_TRANSFORMERS }),
|
|
24555
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_jsx_runtime133.Fragment, { children })
|
|
24556
|
+
]
|
|
24557
|
+
}
|
|
24558
|
+
)
|
|
23725
24559
|
] });
|
|
23726
24560
|
};
|
|
23727
24561
|
|
|
23728
24562
|
// src/components/ParameterInputs/ParameterSelect.tsx
|
|
23729
24563
|
init_emotion_jsx_shim();
|
|
23730
|
-
var
|
|
23731
|
-
var
|
|
23732
|
-
var ParameterSelect = (0,
|
|
24564
|
+
var import_react156 = require("react");
|
|
24565
|
+
var import_jsx_runtime134 = require("@emotion/react/jsx-runtime");
|
|
24566
|
+
var ParameterSelect = (0, import_react156.forwardRef)(
|
|
23733
24567
|
({ defaultOption, options, ...props }, ref) => {
|
|
23734
24568
|
const { shellProps, innerProps } = extractParameterProps(props);
|
|
23735
|
-
return /* @__PURE__ */ (0,
|
|
24569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ParameterSelectInner, { options, defaultOption, ...innerProps, ref }) });
|
|
23736
24570
|
}
|
|
23737
24571
|
);
|
|
23738
|
-
var ParameterSelectInner = (0,
|
|
24572
|
+
var ParameterSelectInner = (0, import_react156.forwardRef)(
|
|
23739
24573
|
({ defaultOption, options, ...props }, ref) => {
|
|
23740
24574
|
const { id, label, hiddenLabel } = useParameterShell();
|
|
23741
|
-
return /* @__PURE__ */ (0,
|
|
24575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
23742
24576
|
"select",
|
|
23743
24577
|
{
|
|
23744
24578
|
css: [input3, selectInput],
|
|
@@ -23747,10 +24581,10 @@ var ParameterSelectInner = (0, import_react152.forwardRef)(
|
|
|
23747
24581
|
ref,
|
|
23748
24582
|
...props,
|
|
23749
24583
|
children: [
|
|
23750
|
-
defaultOption ? /* @__PURE__ */ (0,
|
|
24584
|
+
defaultOption ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("option", { value: "", children: defaultOption }) : null,
|
|
23751
24585
|
options.map((option) => {
|
|
23752
24586
|
var _a;
|
|
23753
|
-
return /* @__PURE__ */ (0,
|
|
24587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("option", { value: (_a = option.value) != null ? _a : option.label, children: option.label }, option.label);
|
|
23754
24588
|
})
|
|
23755
24589
|
]
|
|
23756
24590
|
}
|
|
@@ -23760,15 +24594,15 @@ var ParameterSelectInner = (0, import_react152.forwardRef)(
|
|
|
23760
24594
|
|
|
23761
24595
|
// src/components/ParameterInputs/ParameterTextarea.tsx
|
|
23762
24596
|
init_emotion_jsx_shim();
|
|
23763
|
-
var
|
|
23764
|
-
var
|
|
23765
|
-
var ParameterTextarea = (0,
|
|
24597
|
+
var import_react157 = require("react");
|
|
24598
|
+
var import_jsx_runtime135 = require("@emotion/react/jsx-runtime");
|
|
24599
|
+
var ParameterTextarea = (0, import_react157.forwardRef)((props, ref) => {
|
|
23766
24600
|
const { shellProps, innerProps } = extractParameterProps(props);
|
|
23767
|
-
return /* @__PURE__ */ (0,
|
|
24601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterShell, { "data-testid": "parameter-textarea", ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ParameterTextareaInner, { ref, ...innerProps }) });
|
|
23768
24602
|
});
|
|
23769
|
-
var ParameterTextareaInner = (0,
|
|
24603
|
+
var ParameterTextareaInner = (0, import_react157.forwardRef)(({ ...props }, ref) => {
|
|
23770
24604
|
const { id, label, hiddenLabel } = useParameterShell();
|
|
23771
|
-
return /* @__PURE__ */ (0,
|
|
24605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
23772
24606
|
"textarea",
|
|
23773
24607
|
{
|
|
23774
24608
|
css: [input3, textarea2],
|
|
@@ -23782,18 +24616,18 @@ var ParameterTextareaInner = (0, import_react153.forwardRef)(({ ...props }, ref)
|
|
|
23782
24616
|
|
|
23783
24617
|
// src/components/ParameterInputs/ParameterToggle.tsx
|
|
23784
24618
|
init_emotion_jsx_shim();
|
|
23785
|
-
var
|
|
23786
|
-
var
|
|
23787
|
-
var ParameterToggle = (0,
|
|
24619
|
+
var import_react158 = require("react");
|
|
24620
|
+
var import_jsx_runtime136 = require("@emotion/react/jsx-runtime");
|
|
24621
|
+
var ParameterToggle = (0, import_react158.forwardRef)((props, ref) => {
|
|
23788
24622
|
const { shellProps, innerProps } = extractParameterProps(props);
|
|
23789
|
-
return /* @__PURE__ */ (0,
|
|
24623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterShell, { ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ParameterToggleInner, { ref, ...innerProps }) });
|
|
23790
24624
|
});
|
|
23791
|
-
var ParameterToggleInner = (0,
|
|
24625
|
+
var ParameterToggleInner = (0, import_react158.forwardRef)(
|
|
23792
24626
|
({ children, ...props }, ref) => {
|
|
23793
24627
|
const { id, label } = useParameterShell();
|
|
23794
|
-
return /* @__PURE__ */ (0,
|
|
23795
|
-
/* @__PURE__ */ (0,
|
|
23796
|
-
/* @__PURE__ */ (0,
|
|
24628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("label", { css: inputToggleLabel2, children: [
|
|
24629
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("input", { css: toggleInput2, type: props.type, id, ref, ...props }),
|
|
24630
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { css: inlineLabel2, children: label }),
|
|
23797
24631
|
children
|
|
23798
24632
|
] });
|
|
23799
24633
|
}
|
|
@@ -23804,8 +24638,8 @@ init_emotion_jsx_shim();
|
|
|
23804
24638
|
|
|
23805
24639
|
// src/components/ProgressBar/ProgressBar.styles.ts
|
|
23806
24640
|
init_emotion_jsx_shim();
|
|
23807
|
-
var
|
|
23808
|
-
var container3 =
|
|
24641
|
+
var import_react159 = require("@emotion/react");
|
|
24642
|
+
var container3 = import_react159.css`
|
|
23809
24643
|
background: var(--gray-50);
|
|
23810
24644
|
margin-block: var(--spacing-sm);
|
|
23811
24645
|
position: relative;
|
|
@@ -23815,17 +24649,17 @@ var container3 = import_react155.css`
|
|
|
23815
24649
|
border: solid 1px var(--gray-300);
|
|
23816
24650
|
`;
|
|
23817
24651
|
var themeMap = {
|
|
23818
|
-
primary:
|
|
24652
|
+
primary: import_react159.css`
|
|
23819
24653
|
--progress-color: var(--accent-light);
|
|
23820
24654
|
`,
|
|
23821
|
-
secondary:
|
|
24655
|
+
secondary: import_react159.css`
|
|
23822
24656
|
--progress-color: var(--accent-alt-light);
|
|
23823
24657
|
`,
|
|
23824
|
-
destructive:
|
|
24658
|
+
destructive: import_react159.css`
|
|
23825
24659
|
--progress-color: var(--brand-secondary-5);
|
|
23826
24660
|
`
|
|
23827
24661
|
};
|
|
23828
|
-
var slidingBackgroundPosition =
|
|
24662
|
+
var slidingBackgroundPosition = import_react159.keyframes`
|
|
23829
24663
|
from {
|
|
23830
24664
|
background-position: 0 0;
|
|
23831
24665
|
}
|
|
@@ -23833,10 +24667,10 @@ var slidingBackgroundPosition = import_react155.keyframes`
|
|
|
23833
24667
|
background-position: 64px 0;
|
|
23834
24668
|
}
|
|
23835
24669
|
`;
|
|
23836
|
-
var determinate =
|
|
24670
|
+
var determinate = import_react159.css`
|
|
23837
24671
|
background-color: var(--progress-color);
|
|
23838
24672
|
`;
|
|
23839
|
-
var indeterminate =
|
|
24673
|
+
var indeterminate = import_react159.css`
|
|
23840
24674
|
background-image: linear-gradient(
|
|
23841
24675
|
45deg,
|
|
23842
24676
|
var(--progress-color) 25%,
|
|
@@ -23850,7 +24684,7 @@ var indeterminate = import_react155.css`
|
|
|
23850
24684
|
background-size: 64px 64px;
|
|
23851
24685
|
animation: ${slidingBackgroundPosition} 1s linear infinite;
|
|
23852
24686
|
`;
|
|
23853
|
-
var bar =
|
|
24687
|
+
var bar = import_react159.css`
|
|
23854
24688
|
position: absolute;
|
|
23855
24689
|
inset: 0;
|
|
23856
24690
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
@@ -23858,7 +24692,7 @@ var bar = import_react155.css`
|
|
|
23858
24692
|
`;
|
|
23859
24693
|
|
|
23860
24694
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
23861
|
-
var
|
|
24695
|
+
var import_jsx_runtime137 = require("@emotion/react/jsx-runtime");
|
|
23862
24696
|
function ProgressBar({
|
|
23863
24697
|
current,
|
|
23864
24698
|
max,
|
|
@@ -23868,7 +24702,7 @@ function ProgressBar({
|
|
|
23868
24702
|
}) {
|
|
23869
24703
|
const valueNow = Math.min(current, max);
|
|
23870
24704
|
const valuePercentage = max > 0 ? Math.ceil(100 / max * valueNow) : 0;
|
|
23871
|
-
return /* @__PURE__ */ (0,
|
|
24705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
23872
24706
|
"div",
|
|
23873
24707
|
{
|
|
23874
24708
|
css: container3,
|
|
@@ -23879,7 +24713,7 @@ function ProgressBar({
|
|
|
23879
24713
|
"aria-valuemax": max,
|
|
23880
24714
|
"aria-valuenow": valueNow,
|
|
23881
24715
|
...props,
|
|
23882
|
-
children: /* @__PURE__ */ (0,
|
|
24716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
23883
24717
|
"div",
|
|
23884
24718
|
{
|
|
23885
24719
|
css: [
|
|
@@ -23899,31 +24733,31 @@ function ProgressBar({
|
|
|
23899
24733
|
|
|
23900
24734
|
// src/components/ProgressList/ProgressList.tsx
|
|
23901
24735
|
init_emotion_jsx_shim();
|
|
23902
|
-
var
|
|
24736
|
+
var import_react161 = require("@emotion/react");
|
|
23903
24737
|
var import_CgCheckO3 = require("@react-icons/all-files/cg/CgCheckO");
|
|
23904
24738
|
var import_CgRadioCheck2 = require("@react-icons/all-files/cg/CgRadioCheck");
|
|
23905
24739
|
var import_CgRecord2 = require("@react-icons/all-files/cg/CgRecord");
|
|
23906
|
-
var
|
|
24740
|
+
var import_react162 = require("react");
|
|
23907
24741
|
|
|
23908
24742
|
// src/components/ProgressList/styles/ProgressList.styles.ts
|
|
23909
24743
|
init_emotion_jsx_shim();
|
|
23910
|
-
var
|
|
23911
|
-
var progressListStyles =
|
|
24744
|
+
var import_react160 = require("@emotion/react");
|
|
24745
|
+
var progressListStyles = import_react160.css`
|
|
23912
24746
|
display: flex;
|
|
23913
24747
|
flex-direction: column;
|
|
23914
24748
|
gap: var(--spacing-sm);
|
|
23915
24749
|
list-style-type: none;
|
|
23916
24750
|
`;
|
|
23917
|
-
var progressListItemStyles =
|
|
24751
|
+
var progressListItemStyles = import_react160.css`
|
|
23918
24752
|
display: flex;
|
|
23919
24753
|
gap: var(--spacing-base);
|
|
23920
24754
|
align-items: center;
|
|
23921
24755
|
`;
|
|
23922
24756
|
|
|
23923
24757
|
// src/components/ProgressList/ProgressList.tsx
|
|
23924
|
-
var
|
|
24758
|
+
var import_jsx_runtime138 = require("@emotion/react/jsx-runtime");
|
|
23925
24759
|
var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
|
|
23926
|
-
const itemsWithStatus = (0,
|
|
24760
|
+
const itemsWithStatus = (0, import_react162.useMemo)(() => {
|
|
23927
24761
|
const indexOfInProgressItem = items.findIndex(({ id }) => id === inProgressId);
|
|
23928
24762
|
return items.map((item, index) => {
|
|
23929
24763
|
let status = "queued";
|
|
@@ -23935,8 +24769,8 @@ var ProgressList = ({ inProgressId, items, autoEllipsis, ...htmlProps }) => {
|
|
|
23935
24769
|
return { ...item, status };
|
|
23936
24770
|
});
|
|
23937
24771
|
}, [items, inProgressId]);
|
|
23938
|
-
return /* @__PURE__ */ (0,
|
|
23939
|
-
return /* @__PURE__ */ (0,
|
|
24772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("ol", { css: progressListStyles, ...htmlProps, children: itemsWithStatus.map(({ id, label, status, error, errorLevel }) => {
|
|
24773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
23940
24774
|
ProgressListItem,
|
|
23941
24775
|
{
|
|
23942
24776
|
status,
|
|
@@ -23956,7 +24790,7 @@ var ProgressListItem = ({
|
|
|
23956
24790
|
errorLevel = "danger",
|
|
23957
24791
|
autoEllipsis = false
|
|
23958
24792
|
}) => {
|
|
23959
|
-
const icon = (0,
|
|
24793
|
+
const icon = (0, import_react162.useMemo)(() => {
|
|
23960
24794
|
if (error) {
|
|
23961
24795
|
return warningIcon;
|
|
23962
24796
|
}
|
|
@@ -23967,14 +24801,14 @@ var ProgressListItem = ({
|
|
|
23967
24801
|
};
|
|
23968
24802
|
return iconPerStatus[status];
|
|
23969
24803
|
}, [status, error]);
|
|
23970
|
-
const statusStyles = (0,
|
|
24804
|
+
const statusStyles = (0, import_react162.useMemo)(() => {
|
|
23971
24805
|
if (error) {
|
|
23972
|
-
return errorLevel === "caution" ?
|
|
24806
|
+
return errorLevel === "caution" ? import_react161.css`
|
|
23973
24807
|
color: rgb(161, 98, 7);
|
|
23974
24808
|
& svg {
|
|
23975
24809
|
color: rgb(250, 204, 21);
|
|
23976
24810
|
}
|
|
23977
|
-
` :
|
|
24811
|
+
` : import_react161.css`
|
|
23978
24812
|
color: rgb(185, 28, 28);
|
|
23979
24813
|
& svg {
|
|
23980
24814
|
color: var(--brand-primary-2);
|
|
@@ -23982,40 +24816,40 @@ var ProgressListItem = ({
|
|
|
23982
24816
|
`;
|
|
23983
24817
|
}
|
|
23984
24818
|
const colorPerStatus = {
|
|
23985
|
-
completed:
|
|
24819
|
+
completed: import_react161.css`
|
|
23986
24820
|
opacity: 0.75;
|
|
23987
24821
|
`,
|
|
23988
|
-
inProgress:
|
|
24822
|
+
inProgress: import_react161.css`
|
|
23989
24823
|
-webkit-text-stroke-width: thin;
|
|
23990
24824
|
`,
|
|
23991
|
-
queued:
|
|
24825
|
+
queued: import_react161.css`
|
|
23992
24826
|
opacity: 0.5;
|
|
23993
24827
|
`
|
|
23994
24828
|
};
|
|
23995
24829
|
return colorPerStatus[status];
|
|
23996
24830
|
}, [status, error, errorLevel]);
|
|
23997
|
-
return /* @__PURE__ */ (0,
|
|
23998
|
-
/* @__PURE__ */ (0,
|
|
23999
|
-
/* @__PURE__ */ (0,
|
|
24831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("li", { css: [progressListItemStyles, statusStyles], children: [
|
|
24832
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(Tooltip, { title: error != null ? error : "", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(Icon, { icon, size: 20, iconColor: "currentColor" }) }) }),
|
|
24833
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { children: [
|
|
24000
24834
|
children,
|
|
24001
|
-
/* @__PURE__ */ (0,
|
|
24835
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { css: { visibility: autoEllipsis && status === "inProgress" && !error ? "visible" : "hidden" }, children: "..." })
|
|
24002
24836
|
] })
|
|
24003
24837
|
] });
|
|
24004
24838
|
};
|
|
24005
24839
|
|
|
24006
24840
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
24007
24841
|
init_emotion_jsx_shim();
|
|
24008
|
-
var
|
|
24842
|
+
var import_react164 = require("@emotion/react");
|
|
24009
24843
|
var import_CgCheck6 = require("@react-icons/all-files/cg/CgCheck");
|
|
24010
|
-
var
|
|
24844
|
+
var import_react165 = require("react");
|
|
24011
24845
|
|
|
24012
24846
|
// src/components/SegmentedControl/SegmentedControl.styles.ts
|
|
24013
24847
|
init_emotion_jsx_shim();
|
|
24014
|
-
var
|
|
24015
|
-
var segmentedControlRootStyles =
|
|
24848
|
+
var import_react163 = require("@emotion/react");
|
|
24849
|
+
var segmentedControlRootStyles = import_react163.css`
|
|
24016
24850
|
position: relative;
|
|
24017
24851
|
`;
|
|
24018
|
-
var segmentedControlScrollIndicatorsStyles =
|
|
24852
|
+
var segmentedControlScrollIndicatorsStyles = import_react163.css`
|
|
24019
24853
|
position: absolute;
|
|
24020
24854
|
inset: 0;
|
|
24021
24855
|
z-index: 1;
|
|
@@ -24043,17 +24877,17 @@ var segmentedControlScrollIndicatorsStyles = import_react159.css`
|
|
|
24043
24877
|
background: linear-gradient(to left, var(--background-color) 10%, transparent);
|
|
24044
24878
|
}
|
|
24045
24879
|
`;
|
|
24046
|
-
var segmentedControlScrollIndicatorStartVisibleStyles =
|
|
24880
|
+
var segmentedControlScrollIndicatorStartVisibleStyles = import_react163.css`
|
|
24047
24881
|
&::before {
|
|
24048
24882
|
opacity: 1;
|
|
24049
24883
|
}
|
|
24050
24884
|
`;
|
|
24051
|
-
var segmentedControlScrollIndicatorEndVisibleStyles =
|
|
24885
|
+
var segmentedControlScrollIndicatorEndVisibleStyles = import_react163.css`
|
|
24052
24886
|
&::after {
|
|
24053
24887
|
opacity: 1;
|
|
24054
24888
|
}
|
|
24055
24889
|
`;
|
|
24056
|
-
var segmentedControlWrapperStyles =
|
|
24890
|
+
var segmentedControlWrapperStyles = import_react163.css`
|
|
24057
24891
|
overflow-y: auto;
|
|
24058
24892
|
scroll-behavior: smooth;
|
|
24059
24893
|
scrollbar-width: none;
|
|
@@ -24062,7 +24896,7 @@ var segmentedControlWrapperStyles = import_react159.css`
|
|
|
24062
24896
|
height: 0px;
|
|
24063
24897
|
}
|
|
24064
24898
|
`;
|
|
24065
|
-
var segmentedControlStyles =
|
|
24899
|
+
var segmentedControlStyles = import_react163.css`
|
|
24066
24900
|
--segmented-control-rounded-value: var(--rounded-base);
|
|
24067
24901
|
--segmented-control-border-width: 1px;
|
|
24068
24902
|
--segmented-control-selected-color: var(--brand-secondary-3);
|
|
@@ -24081,14 +24915,14 @@ var segmentedControlStyles = import_react159.css`
|
|
|
24081
24915
|
border-radius: calc(var(--segmented-control-rounded-value) + var(--segmented-control-border-width));
|
|
24082
24916
|
font-size: var(--fs-xs);
|
|
24083
24917
|
`;
|
|
24084
|
-
var segmentedControlVerticalStyles =
|
|
24918
|
+
var segmentedControlVerticalStyles = import_react163.css`
|
|
24085
24919
|
flex-direction: column;
|
|
24086
24920
|
--segmented-control-first-border-radius: var(--segmented-control-rounded-value)
|
|
24087
24921
|
var(--segmented-control-rounded-value) 0 0;
|
|
24088
24922
|
--segmented-control-last-border-radius: 0 0 var(--segmented-control-rounded-value)
|
|
24089
24923
|
var(--segmented-control-rounded-value);
|
|
24090
24924
|
`;
|
|
24091
|
-
var segmentedControlItemStyles =
|
|
24925
|
+
var segmentedControlItemStyles = import_react163.css`
|
|
24092
24926
|
&:first-of-type label {
|
|
24093
24927
|
border-radius: var(--segmented-control-first-border-radius);
|
|
24094
24928
|
}
|
|
@@ -24096,10 +24930,10 @@ var segmentedControlItemStyles = import_react159.css`
|
|
|
24096
24930
|
border-radius: var(--segmented-control-last-border-radius);
|
|
24097
24931
|
}
|
|
24098
24932
|
`;
|
|
24099
|
-
var segmentedControlInputStyles =
|
|
24933
|
+
var segmentedControlInputStyles = import_react163.css`
|
|
24100
24934
|
${accessibleHidden}
|
|
24101
24935
|
`;
|
|
24102
|
-
var segmentedControlLabelStyles = (checked, disabled2) =>
|
|
24936
|
+
var segmentedControlLabelStyles = (checked, disabled2) => import_react163.css`
|
|
24103
24937
|
position: relative;
|
|
24104
24938
|
display: flex;
|
|
24105
24939
|
align-items: center;
|
|
@@ -24166,25 +25000,25 @@ var segmentedControlLabelStyles = (checked, disabled2) => import_react159.css`
|
|
|
24166
25000
|
`}
|
|
24167
25001
|
}
|
|
24168
25002
|
`;
|
|
24169
|
-
var segmentedControlLabelIconOnlyStyles =
|
|
25003
|
+
var segmentedControlLabelIconOnlyStyles = import_react163.css`
|
|
24170
25004
|
padding-inline: 0.5em;
|
|
24171
25005
|
`;
|
|
24172
|
-
var segmentedControlLabelCheckStyles =
|
|
25006
|
+
var segmentedControlLabelCheckStyles = import_react163.css`
|
|
24173
25007
|
opacity: 0.5;
|
|
24174
25008
|
`;
|
|
24175
|
-
var segmentedControlLabelContentStyles =
|
|
25009
|
+
var segmentedControlLabelContentStyles = import_react163.css`
|
|
24176
25010
|
display: flex;
|
|
24177
25011
|
align-items: center;
|
|
24178
25012
|
justify-content: center;
|
|
24179
25013
|
gap: var(--spacing-sm);
|
|
24180
25014
|
height: 100%;
|
|
24181
25015
|
`;
|
|
24182
|
-
var segmentedControlLabelTextStyles =
|
|
25016
|
+
var segmentedControlLabelTextStyles = import_react163.css`
|
|
24183
25017
|
white-space: nowrap;
|
|
24184
25018
|
`;
|
|
24185
25019
|
|
|
24186
25020
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
24187
|
-
var
|
|
25021
|
+
var import_jsx_runtime139 = require("@emotion/react/jsx-runtime");
|
|
24188
25022
|
var SegmentedControl = ({
|
|
24189
25023
|
name,
|
|
24190
25024
|
options,
|
|
@@ -24199,10 +25033,10 @@ var SegmentedControl = ({
|
|
|
24199
25033
|
currentBackgroundColor = "white",
|
|
24200
25034
|
...props
|
|
24201
25035
|
}) => {
|
|
24202
|
-
const wrapperRef = (0,
|
|
24203
|
-
const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = (0,
|
|
24204
|
-
const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = (0,
|
|
24205
|
-
const onOptionChange = (0,
|
|
25036
|
+
const wrapperRef = (0, import_react165.useRef)(null);
|
|
25037
|
+
const [isOverflowStartShadowVisible, setIsOverflowStartShadowVisible] = (0, import_react165.useState)(false);
|
|
25038
|
+
const [isOverflowEndShadowVisible, setIsOverflowEndShadowVisible] = (0, import_react165.useState)(false);
|
|
25039
|
+
const onOptionChange = (0, import_react165.useCallback)(
|
|
24206
25040
|
(event) => {
|
|
24207
25041
|
if (event.target.checked) {
|
|
24208
25042
|
onChange == null ? void 0 : onChange(options[parseInt(event.target.value)].value);
|
|
@@ -24210,19 +25044,19 @@ var SegmentedControl = ({
|
|
|
24210
25044
|
},
|
|
24211
25045
|
[options, onChange]
|
|
24212
25046
|
);
|
|
24213
|
-
const sizeStyles = (0,
|
|
25047
|
+
const sizeStyles = (0, import_react165.useMemo)(() => {
|
|
24214
25048
|
const map = {
|
|
24215
|
-
sm: (0,
|
|
24216
|
-
md: (0,
|
|
24217
|
-
lg: (0,
|
|
24218
|
-
xl: (0,
|
|
25049
|
+
sm: (0, import_react164.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
|
|
25050
|
+
md: (0, import_react164.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
|
|
25051
|
+
lg: (0, import_react164.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
|
|
25052
|
+
xl: (0, import_react164.css)({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
|
|
24219
25053
|
};
|
|
24220
25054
|
return map[size];
|
|
24221
25055
|
}, [size]);
|
|
24222
|
-
const isIconOnly = (0,
|
|
25056
|
+
const isIconOnly = (0, import_react165.useMemo)(() => {
|
|
24223
25057
|
return options.every((option) => option && option.icon && !option.label);
|
|
24224
25058
|
}, [options]);
|
|
24225
|
-
(0,
|
|
25059
|
+
(0, import_react165.useEffect)(() => {
|
|
24226
25060
|
const wrapperElement = wrapperRef.current;
|
|
24227
25061
|
const onScroll = () => {
|
|
24228
25062
|
if (!wrapperElement) {
|
|
@@ -24243,8 +25077,8 @@ var SegmentedControl = ({
|
|
|
24243
25077
|
wrapperElement == null ? void 0 : wrapperElement.removeEventListener("scroll", onScroll);
|
|
24244
25078
|
};
|
|
24245
25079
|
}, []);
|
|
24246
|
-
return /* @__PURE__ */ (0,
|
|
24247
|
-
/* @__PURE__ */ (0,
|
|
25080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { css: [segmentedControlRootStyles, { "--background-color": currentBackgroundColor }], children: [
|
|
25081
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { ref: wrapperRef, css: segmentedControlWrapperStyles, children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
24248
25082
|
"div",
|
|
24249
25083
|
{
|
|
24250
25084
|
css: [
|
|
@@ -24260,12 +25094,12 @@ var SegmentedControl = ({
|
|
|
24260
25094
|
}
|
|
24261
25095
|
const text = option.label ? option.label : option.icon ? null : String(option.value);
|
|
24262
25096
|
const isDisabled = disabled2 || option.disabled;
|
|
24263
|
-
return /* @__PURE__ */ (0,
|
|
25097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
24264
25098
|
"div",
|
|
24265
25099
|
{
|
|
24266
25100
|
css: segmentedControlItemStyles,
|
|
24267
25101
|
"data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
|
|
24268
|
-
children: /* @__PURE__ */ (0,
|
|
25102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
24269
25103
|
"label",
|
|
24270
25104
|
{
|
|
24271
25105
|
css: [
|
|
@@ -24274,7 +25108,7 @@ var SegmentedControl = ({
|
|
|
24274
25108
|
isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
|
|
24275
25109
|
],
|
|
24276
25110
|
children: [
|
|
24277
|
-
/* @__PURE__ */ (0,
|
|
25111
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
24278
25112
|
"input",
|
|
24279
25113
|
{
|
|
24280
25114
|
css: segmentedControlInputStyles,
|
|
@@ -24286,10 +25120,10 @@ var SegmentedControl = ({
|
|
|
24286
25120
|
disabled: isDisabled
|
|
24287
25121
|
}
|
|
24288
25122
|
),
|
|
24289
|
-
option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0,
|
|
24290
|
-
/* @__PURE__ */ (0,
|
|
24291
|
-
!option.icon ? null : /* @__PURE__ */ (0,
|
|
24292
|
-
!text || hideOptionText ? null : /* @__PURE__ */ (0,
|
|
25123
|
+
option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_CgCheck6.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
|
|
25124
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
|
|
25125
|
+
!option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
|
|
25126
|
+
!text || hideOptionText ? null : /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
|
|
24293
25127
|
] })
|
|
24294
25128
|
]
|
|
24295
25129
|
}
|
|
@@ -24299,7 +25133,7 @@ var SegmentedControl = ({
|
|
|
24299
25133
|
})
|
|
24300
25134
|
}
|
|
24301
25135
|
) }),
|
|
24302
|
-
/* @__PURE__ */ (0,
|
|
25136
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
24303
25137
|
"div",
|
|
24304
25138
|
{
|
|
24305
25139
|
css: [
|
|
@@ -24317,18 +25151,18 @@ init_emotion_jsx_shim();
|
|
|
24317
25151
|
|
|
24318
25152
|
// src/components/Skeleton/Skeleton.styles.ts
|
|
24319
25153
|
init_emotion_jsx_shim();
|
|
24320
|
-
var
|
|
24321
|
-
var lightFadingOut =
|
|
25154
|
+
var import_react166 = require("@emotion/react");
|
|
25155
|
+
var lightFadingOut = import_react166.keyframes`
|
|
24322
25156
|
from { opacity: 0.1; }
|
|
24323
25157
|
to { opacity: 0.025; }
|
|
24324
25158
|
`;
|
|
24325
|
-
var skeletonStyles =
|
|
25159
|
+
var skeletonStyles = import_react166.css`
|
|
24326
25160
|
animation: ${lightFadingOut} 1s ease-out infinite alternate;
|
|
24327
25161
|
background-color: var(--gray-900);
|
|
24328
25162
|
`;
|
|
24329
25163
|
|
|
24330
25164
|
// src/components/Skeleton/Skeleton.tsx
|
|
24331
|
-
var
|
|
25165
|
+
var import_jsx_runtime140 = require("@emotion/react/jsx-runtime");
|
|
24332
25166
|
var Skeleton = ({
|
|
24333
25167
|
width = "100%",
|
|
24334
25168
|
height = "1.25rem",
|
|
@@ -24336,7 +25170,7 @@ var Skeleton = ({
|
|
|
24336
25170
|
circle = false,
|
|
24337
25171
|
children,
|
|
24338
25172
|
...otherProps
|
|
24339
|
-
}) => /* @__PURE__ */ (0,
|
|
25173
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
24340
25174
|
"div",
|
|
24341
25175
|
{
|
|
24342
25176
|
css: [
|
|
@@ -24357,12 +25191,12 @@ var Skeleton = ({
|
|
|
24357
25191
|
|
|
24358
25192
|
// src/components/Switch/Switch.tsx
|
|
24359
25193
|
init_emotion_jsx_shim();
|
|
24360
|
-
var
|
|
25194
|
+
var import_react168 = require("react");
|
|
24361
25195
|
|
|
24362
25196
|
// src/components/Switch/Switch.styles.ts
|
|
24363
25197
|
init_emotion_jsx_shim();
|
|
24364
|
-
var
|
|
24365
|
-
var SwitchInputContainer =
|
|
25198
|
+
var import_react167 = require("@emotion/react");
|
|
25199
|
+
var SwitchInputContainer = import_react167.css`
|
|
24366
25200
|
cursor: pointer;
|
|
24367
25201
|
display: inline-block;
|
|
24368
25202
|
position: relative;
|
|
@@ -24371,7 +25205,7 @@ var SwitchInputContainer = import_react163.css`
|
|
|
24371
25205
|
vertical-align: middle;
|
|
24372
25206
|
user-select: none;
|
|
24373
25207
|
`;
|
|
24374
|
-
var SwitchInput = (size) =>
|
|
25208
|
+
var SwitchInput = (size) => import_react167.css`
|
|
24375
25209
|
appearance: none;
|
|
24376
25210
|
border-radius: var(--rounded-full);
|
|
24377
25211
|
background-color: var(--white);
|
|
@@ -24410,7 +25244,7 @@ var SwitchInput = (size) => import_react163.css`
|
|
|
24410
25244
|
cursor: not-allowed;
|
|
24411
25245
|
}
|
|
24412
25246
|
`;
|
|
24413
|
-
var SwitchInputDisabled =
|
|
25247
|
+
var SwitchInputDisabled = import_react167.css`
|
|
24414
25248
|
opacity: var(--opacity-50);
|
|
24415
25249
|
cursor: not-allowed;
|
|
24416
25250
|
|
|
@@ -24418,7 +25252,7 @@ var SwitchInputDisabled = import_react163.css`
|
|
|
24418
25252
|
cursor: not-allowed;
|
|
24419
25253
|
}
|
|
24420
25254
|
`;
|
|
24421
|
-
var SwitchInputLabel = (size) =>
|
|
25255
|
+
var SwitchInputLabel = (size) => import_react167.css`
|
|
24422
25256
|
align-items: center;
|
|
24423
25257
|
color: var(--typography-base);
|
|
24424
25258
|
display: inline-flex;
|
|
@@ -24440,32 +25274,32 @@ var SwitchInputLabel = (size) => import_react163.css`
|
|
|
24440
25274
|
top: 0;
|
|
24441
25275
|
}
|
|
24442
25276
|
`;
|
|
24443
|
-
var SwitchText = (size) =>
|
|
25277
|
+
var SwitchText = (size) => import_react167.css`
|
|
24444
25278
|
color: var(--gray-500);
|
|
24445
25279
|
font-size: var(--fs-sm);
|
|
24446
25280
|
padding-inline: ${size === "sm" ? "var(--spacing-xl)" : "var(--spacing-2xl)"} 0;
|
|
24447
25281
|
`;
|
|
24448
25282
|
|
|
24449
25283
|
// src/components/Switch/Switch.tsx
|
|
24450
|
-
var
|
|
24451
|
-
var Switch = (0,
|
|
25284
|
+
var import_jsx_runtime141 = require("@emotion/react/jsx-runtime");
|
|
25285
|
+
var Switch = (0, import_react168.forwardRef)(
|
|
24452
25286
|
({ label, infoText, toggleText, children, switchSize = "base", ...inputProps }, ref) => {
|
|
24453
25287
|
let additionalText = infoText;
|
|
24454
25288
|
if (infoText && toggleText) {
|
|
24455
25289
|
additionalText = inputProps.checked ? toggleText : infoText;
|
|
24456
25290
|
}
|
|
24457
|
-
return /* @__PURE__ */ (0,
|
|
24458
|
-
/* @__PURE__ */ (0,
|
|
25291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_jsx_runtime141.Fragment, { children: [
|
|
25292
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
|
|
24459
25293
|
"label",
|
|
24460
25294
|
{
|
|
24461
25295
|
css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0],
|
|
24462
25296
|
children: [
|
|
24463
|
-
/* @__PURE__ */ (0,
|
|
24464
|
-
/* @__PURE__ */ (0,
|
|
25297
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("input", { type: "checkbox", css: SwitchInput(switchSize), ...inputProps, ref }),
|
|
25298
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { css: SwitchInputLabel(switchSize), children: label })
|
|
24465
25299
|
]
|
|
24466
25300
|
}
|
|
24467
25301
|
),
|
|
24468
|
-
additionalText ? /* @__PURE__ */ (0,
|
|
25302
|
+
additionalText ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { css: SwitchText(switchSize), children: additionalText }) : null,
|
|
24469
25303
|
children
|
|
24470
25304
|
] });
|
|
24471
25305
|
}
|
|
@@ -24477,8 +25311,8 @@ var React24 = __toESM(require("react"));
|
|
|
24477
25311
|
|
|
24478
25312
|
// src/components/Table/Table.styles.ts
|
|
24479
25313
|
init_emotion_jsx_shim();
|
|
24480
|
-
var
|
|
24481
|
-
var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) =>
|
|
25314
|
+
var import_react169 = require("@emotion/react");
|
|
25315
|
+
var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_react169.css`
|
|
24482
25316
|
border-bottom: 1px solid var(--gray-400);
|
|
24483
25317
|
border-collapse: collapse;
|
|
24484
25318
|
min-width: 100%;
|
|
@@ -24498,66 +25332,66 @@ var table = ({ cellPadding = "var(--spacing-sm) var(--spacing-md)" }) => import_
|
|
|
24498
25332
|
background-color: var(--gray-50);
|
|
24499
25333
|
}
|
|
24500
25334
|
`;
|
|
24501
|
-
var tableHead =
|
|
25335
|
+
var tableHead = import_react169.css`
|
|
24502
25336
|
color: var(--typography-base);
|
|
24503
25337
|
text-align: left;
|
|
24504
25338
|
`;
|
|
24505
|
-
var tableRow =
|
|
25339
|
+
var tableRow = import_react169.css`
|
|
24506
25340
|
border-bottom: 1px solid var(--gray-100);
|
|
24507
25341
|
`;
|
|
24508
|
-
var tableCellHead =
|
|
25342
|
+
var tableCellHead = import_react169.css`
|
|
24509
25343
|
font-size: var(--fs-sm);
|
|
24510
25344
|
text-transform: uppercase;
|
|
24511
25345
|
font-weight: var(--fw-bold);
|
|
24512
25346
|
`;
|
|
24513
25347
|
|
|
24514
25348
|
// src/components/Table/Table.tsx
|
|
24515
|
-
var
|
|
25349
|
+
var import_jsx_runtime142 = require("@emotion/react/jsx-runtime");
|
|
24516
25350
|
var Table = React24.forwardRef(
|
|
24517
25351
|
({ children, cellPadding, ...otherProps }, ref) => {
|
|
24518
|
-
return /* @__PURE__ */ (0,
|
|
25352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("table", { ref, css: table({ cellPadding }), ...otherProps, children });
|
|
24519
25353
|
}
|
|
24520
25354
|
);
|
|
24521
25355
|
var TableHead = React24.forwardRef(
|
|
24522
25356
|
({ children, ...otherProps }, ref) => {
|
|
24523
|
-
return /* @__PURE__ */ (0,
|
|
25357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("thead", { ref, css: tableHead, ...otherProps, children });
|
|
24524
25358
|
}
|
|
24525
25359
|
);
|
|
24526
25360
|
var TableBody = React24.forwardRef(
|
|
24527
25361
|
({ children, ...otherProps }, ref) => {
|
|
24528
|
-
return /* @__PURE__ */ (0,
|
|
25362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("tbody", { ref, ...otherProps, children });
|
|
24529
25363
|
}
|
|
24530
25364
|
);
|
|
24531
25365
|
var TableFoot = React24.forwardRef(
|
|
24532
25366
|
({ children, ...otherProps }, ref) => {
|
|
24533
|
-
return /* @__PURE__ */ (0,
|
|
25367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("tfoot", { ref, ...otherProps, children });
|
|
24534
25368
|
}
|
|
24535
25369
|
);
|
|
24536
25370
|
var TableRow = React24.forwardRef(
|
|
24537
25371
|
({ children, ...otherProps }, ref) => {
|
|
24538
|
-
return /* @__PURE__ */ (0,
|
|
25372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("tr", { ref, css: tableRow, ...otherProps, children });
|
|
24539
25373
|
}
|
|
24540
25374
|
);
|
|
24541
25375
|
var TableCellHead = React24.forwardRef(
|
|
24542
25376
|
({ children, ...otherProps }, ref) => {
|
|
24543
|
-
return /* @__PURE__ */ (0,
|
|
25377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("th", { ref, css: tableCellHead, ...otherProps, children });
|
|
24544
25378
|
}
|
|
24545
25379
|
);
|
|
24546
25380
|
var TableCellData = React24.forwardRef(
|
|
24547
25381
|
({ children, ...otherProps }, ref) => {
|
|
24548
|
-
return /* @__PURE__ */ (0,
|
|
25382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("td", { ref, ...otherProps, children });
|
|
24549
25383
|
}
|
|
24550
25384
|
);
|
|
24551
25385
|
|
|
24552
25386
|
// src/components/Tabs/Tabs.tsx
|
|
24553
25387
|
init_emotion_jsx_shim();
|
|
24554
|
-
var
|
|
24555
|
-
var
|
|
25388
|
+
var import_react171 = require("@ariakit/react");
|
|
25389
|
+
var import_react172 = require("react");
|
|
24556
25390
|
|
|
24557
25391
|
// src/components/Tabs/Tabs.styles.ts
|
|
24558
25392
|
init_emotion_jsx_shim();
|
|
24559
|
-
var
|
|
24560
|
-
var tabButtonStyles =
|
|
25393
|
+
var import_react170 = require("@emotion/react");
|
|
25394
|
+
var tabButtonStyles = import_react170.css`
|
|
24561
25395
|
align-items: center;
|
|
24562
25396
|
border: 0;
|
|
24563
25397
|
height: 2.5rem;
|
|
@@ -24574,16 +25408,16 @@ var tabButtonStyles = import_react166.css`
|
|
|
24574
25408
|
box-shadow: inset 0 -2px 0 var(--brand-secondary-3);
|
|
24575
25409
|
}
|
|
24576
25410
|
`;
|
|
24577
|
-
var tabButtonGroupStyles =
|
|
25411
|
+
var tabButtonGroupStyles = import_react170.css`
|
|
24578
25412
|
display: flex;
|
|
24579
25413
|
gap: var(--spacing-base);
|
|
24580
25414
|
border-bottom: 1px solid var(--gray-300);
|
|
24581
25415
|
`;
|
|
24582
25416
|
|
|
24583
25417
|
// src/components/Tabs/Tabs.tsx
|
|
24584
|
-
var
|
|
25418
|
+
var import_jsx_runtime143 = require("@emotion/react/jsx-runtime");
|
|
24585
25419
|
var useCurrentTab = () => {
|
|
24586
|
-
const context = (0,
|
|
25420
|
+
const context = (0, import_react171.useTabStore)();
|
|
24587
25421
|
if (!context) {
|
|
24588
25422
|
throw new Error("This component can only be used inside <Tabs>");
|
|
24589
25423
|
}
|
|
@@ -24597,12 +25431,12 @@ var Tabs = ({
|
|
|
24597
25431
|
manual,
|
|
24598
25432
|
...props
|
|
24599
25433
|
}) => {
|
|
24600
|
-
const selected = (0,
|
|
25434
|
+
const selected = (0, import_react172.useMemo)(() => {
|
|
24601
25435
|
if (selectedId) return selectedId;
|
|
24602
25436
|
return useHashForState && typeof window !== "undefined" && window.location.hash ? window.location.hash.substring(1) : void 0;
|
|
24603
25437
|
}, [selectedId, useHashForState]);
|
|
24604
|
-
const tab = (0,
|
|
24605
|
-
const onTabSelect = (0,
|
|
25438
|
+
const tab = (0, import_react171.useTabStore)({ ...props, selectOnMove: !manual, selectedId: selected });
|
|
25439
|
+
const onTabSelect = (0, import_react172.useCallback)(
|
|
24606
25440
|
(value) => {
|
|
24607
25441
|
const selectedValueWithoutNull = value != null ? value : void 0;
|
|
24608
25442
|
onSelectedIdChange == null ? void 0 : onSelectedIdChange(selectedValueWithoutNull);
|
|
@@ -24613,28 +25447,28 @@ var Tabs = ({
|
|
|
24613
25447
|
},
|
|
24614
25448
|
[onSelectedIdChange, useHashForState]
|
|
24615
25449
|
);
|
|
24616
|
-
(0,
|
|
25450
|
+
(0, import_react172.useEffect)(() => {
|
|
24617
25451
|
if (selected && selected !== tab.getState().activeId) {
|
|
24618
25452
|
tab.setSelectedId(selected);
|
|
24619
25453
|
}
|
|
24620
25454
|
}, [selected, tab]);
|
|
24621
|
-
return /* @__PURE__ */ (0,
|
|
25455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react171.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
|
|
24622
25456
|
};
|
|
24623
25457
|
var TabButtonGroup = ({ children, ...props }) => {
|
|
24624
|
-
return /* @__PURE__ */ (0,
|
|
25458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react171.TabList, { ...props, css: tabButtonGroupStyles, children });
|
|
24625
25459
|
};
|
|
24626
25460
|
var TabButton = ({
|
|
24627
25461
|
children,
|
|
24628
25462
|
id,
|
|
24629
25463
|
...props
|
|
24630
25464
|
}) => {
|
|
24631
|
-
return /* @__PURE__ */ (0,
|
|
25465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react171.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
|
|
24632
25466
|
};
|
|
24633
25467
|
var TabContent = ({
|
|
24634
25468
|
children,
|
|
24635
25469
|
...props
|
|
24636
25470
|
}) => {
|
|
24637
|
-
return /* @__PURE__ */ (0,
|
|
25471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react171.TabPanel, { ...props, children });
|
|
24638
25472
|
};
|
|
24639
25473
|
|
|
24640
25474
|
// src/components/Validation/StatusBullet.tsx
|
|
@@ -24642,8 +25476,8 @@ init_emotion_jsx_shim();
|
|
|
24642
25476
|
|
|
24643
25477
|
// src/components/Validation/StatusBullet.styles.ts
|
|
24644
25478
|
init_emotion_jsx_shim();
|
|
24645
|
-
var
|
|
24646
|
-
var StatusBulletContainer =
|
|
25479
|
+
var import_react173 = require("@emotion/react");
|
|
25480
|
+
var StatusBulletContainer = import_react173.css`
|
|
24647
25481
|
align-items: center;
|
|
24648
25482
|
align-self: center;
|
|
24649
25483
|
color: var(--gray-500);
|
|
@@ -24660,33 +25494,33 @@ var StatusBulletContainer = import_react169.css`
|
|
|
24660
25494
|
display: block;
|
|
24661
25495
|
}
|
|
24662
25496
|
`;
|
|
24663
|
-
var StatusBulletBase =
|
|
25497
|
+
var StatusBulletBase = import_react173.css`
|
|
24664
25498
|
font-size: var(--fs-sm);
|
|
24665
25499
|
&:before {
|
|
24666
25500
|
width: var(--fs-xs);
|
|
24667
25501
|
height: var(--fs-xs);
|
|
24668
25502
|
}
|
|
24669
25503
|
`;
|
|
24670
|
-
var StatusBulletSmall =
|
|
25504
|
+
var StatusBulletSmall = import_react173.css`
|
|
24671
25505
|
font-size: var(--fs-xs);
|
|
24672
25506
|
&:before {
|
|
24673
25507
|
width: var(--fs-xxs);
|
|
24674
25508
|
height: var(--fs-xxs);
|
|
24675
25509
|
}
|
|
24676
25510
|
`;
|
|
24677
|
-
var StatusDraft =
|
|
25511
|
+
var StatusDraft = import_react173.css`
|
|
24678
25512
|
&:before {
|
|
24679
25513
|
background: var(--white);
|
|
24680
25514
|
box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
|
|
24681
25515
|
}
|
|
24682
25516
|
`;
|
|
24683
|
-
var StatusModified =
|
|
25517
|
+
var StatusModified = import_react173.css`
|
|
24684
25518
|
&:before {
|
|
24685
25519
|
background: linear-gradient(to right, var(--white) 50%, var(--accent-dark) 50% 100%);
|
|
24686
25520
|
box-shadow: inset 0 0 0 0.125rem var(--accent-dark);
|
|
24687
25521
|
}
|
|
24688
25522
|
`;
|
|
24689
|
-
var StatusError =
|
|
25523
|
+
var StatusError = import_react173.css`
|
|
24690
25524
|
color: var(--error);
|
|
24691
25525
|
&:before {
|
|
24692
25526
|
/* TODO: replace this with an svg icon */
|
|
@@ -24699,29 +25533,29 @@ var StatusError = import_react169.css`
|
|
|
24699
25533
|
);
|
|
24700
25534
|
}
|
|
24701
25535
|
`;
|
|
24702
|
-
var StatusPublished =
|
|
25536
|
+
var StatusPublished = import_react173.css`
|
|
24703
25537
|
&:before {
|
|
24704
25538
|
background: var(--accent-dark);
|
|
24705
25539
|
}
|
|
24706
25540
|
`;
|
|
24707
|
-
var StatusOrphan =
|
|
25541
|
+
var StatusOrphan = import_react173.css`
|
|
24708
25542
|
&:before {
|
|
24709
25543
|
background: var(--brand-secondary-5);
|
|
24710
25544
|
}
|
|
24711
25545
|
`;
|
|
24712
|
-
var StatusUnknown =
|
|
25546
|
+
var StatusUnknown = import_react173.css`
|
|
24713
25547
|
&:before {
|
|
24714
25548
|
background: var(--gray-800);
|
|
24715
25549
|
}
|
|
24716
25550
|
`;
|
|
24717
|
-
var StatusDeleted =
|
|
25551
|
+
var StatusDeleted = import_react173.css`
|
|
24718
25552
|
&:before {
|
|
24719
25553
|
background: var(--error);
|
|
24720
25554
|
}
|
|
24721
25555
|
`;
|
|
24722
25556
|
|
|
24723
25557
|
// src/components/Validation/StatusBullet.tsx
|
|
24724
|
-
var
|
|
25558
|
+
var import_jsx_runtime144 = require("@emotion/react/jsx-runtime");
|
|
24725
25559
|
var StatusBullet = ({
|
|
24726
25560
|
status,
|
|
24727
25561
|
hideText = false,
|
|
@@ -24741,7 +25575,7 @@ var StatusBullet = ({
|
|
|
24741
25575
|
Deleted: StatusDeleted
|
|
24742
25576
|
};
|
|
24743
25577
|
const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
|
|
24744
|
-
return /* @__PURE__ */ (0,
|
|
25578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
24745
25579
|
"span",
|
|
24746
25580
|
{
|
|
24747
25581
|
role: "status",
|
|
@@ -25017,6 +25851,7 @@ var StatusBullet = ({
|
|
|
25017
25851
|
useOutsideClick,
|
|
25018
25852
|
useParameterShell,
|
|
25019
25853
|
usePopoverComponentContext,
|
|
25854
|
+
useRichTextToolbarState,
|
|
25020
25855
|
useShortcut,
|
|
25021
25856
|
utilityColors,
|
|
25022
25857
|
warningIcon,
|