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