@uniformdev/mesh-sdk-react 19.23.1-alpha.12 → 19.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -43
- package/dist/index.esm.js +519 -1153
- package/dist/index.js +588 -1215
- package/dist/index.mjs +519 -1153
- package/package.json +4 -7
package/dist/index.mjs
CHANGED
|
@@ -2921,206 +2921,42 @@ function useMeshLocation(expectedLocation) {
|
|
|
2921
2921
|
|
|
2922
2922
|
// src/components/Variables/InputVariables.tsx
|
|
2923
2923
|
init_emotion_jsx_shim();
|
|
2924
|
-
import { Caption
|
|
2924
|
+
import { Caption, ErrorMessage, InfoMessage, Input as Input3, WarningMessage } from "@uniformdev/design-system";
|
|
2925
2925
|
import * as React11 from "react";
|
|
2926
|
-
import {
|
|
2927
|
-
import { v4 as v43 } from "uuid";
|
|
2926
|
+
import { v4 as v42 } from "uuid";
|
|
2928
2927
|
|
|
2929
|
-
// src/components/Variables/
|
|
2928
|
+
// src/components/Variables/SelectVariableMenu.tsx
|
|
2930
2929
|
init_emotion_jsx_shim();
|
|
2931
|
-
import {
|
|
2932
|
-
import {
|
|
2933
|
-
import {
|
|
2934
|
-
function PasteTransformerPlugin({ transformPaste }) {
|
|
2935
|
-
const [editor] = useLexicalComposerContext();
|
|
2936
|
-
useEffect5(() => {
|
|
2937
|
-
editor.registerCommand(
|
|
2938
|
-
PASTE_COMMAND,
|
|
2939
|
-
(event) => {
|
|
2940
|
-
var _a;
|
|
2941
|
-
const selection = $getSelection();
|
|
2942
|
-
const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
|
|
2943
|
-
if (pastedText && transformPaste && $isRangeSelection(selection)) {
|
|
2944
|
-
const result = transformPaste(pastedText);
|
|
2945
|
-
if (result !== void 0) {
|
|
2946
|
-
selection.insertText(result);
|
|
2947
|
-
return true;
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2950
|
-
return false;
|
|
2951
|
-
},
|
|
2952
|
-
COMMAND_PRIORITY_HIGH
|
|
2953
|
-
);
|
|
2954
|
-
}, [editor, transformPaste]);
|
|
2955
|
-
return null;
|
|
2956
|
-
}
|
|
2930
|
+
import { Menu as Menu2, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
|
|
2931
|
+
import { useEffect as useEffect6, useRef as useRef8, useState as useState8 } from "react";
|
|
2932
|
+
import { CgUsbC } from "react-icons/cg";
|
|
2957
2933
|
|
|
2958
|
-
// src/components/Variables/styles/
|
|
2934
|
+
// src/components/Variables/styles/InsertVariableMenu.styles.ts
|
|
2959
2935
|
init_emotion_jsx_shim();
|
|
2960
2936
|
import { css as css18 } from "@emotion/react";
|
|
2961
|
-
var menuContainer = css18`
|
|
2962
|
-
position: relative;
|
|
2963
|
-
`;
|
|
2964
2937
|
var menuBtn = css18`
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
`;
|
|
2970
|
-
var input = css18`
|
|
2971
|
-
appearance: none;
|
|
2972
|
-
background-color: var(--white);
|
|
2973
|
-
border: 1px solid var(--gray-400);
|
|
2974
|
-
border-radius: var(--rounded-md);
|
|
2975
|
-
color: var(--gray-700);
|
|
2976
|
-
padding-block: var(--spacing-sm);
|
|
2977
|
-
padding-left: var(--spacing-base);
|
|
2978
|
-
padding-right: var(--spacing-lg);
|
|
2979
|
-
line-height: 2.5;
|
|
2980
|
-
width: 100%;
|
|
2981
|
-
position: relative;
|
|
2982
|
-
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
2983
|
-
border-color var(--duration-fast) var(--timing-ease-out),
|
|
2984
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
2985
|
-
|
|
2986
|
-
&:focus,
|
|
2987
|
-
&:focus-within {
|
|
2988
|
-
border-color: var(--brand-secondary-1);
|
|
2989
|
-
box-shadow: none;
|
|
2990
|
-
outline: none;
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
&:disabled,
|
|
2994
|
-
&:disabled::placeholder {
|
|
2995
|
-
cursor: not-allowed;
|
|
2996
|
-
color: var(--gray-300);
|
|
2997
|
-
border-color: var(--gray-300);
|
|
2998
|
-
}
|
|
2999
|
-
|
|
3000
|
-
> p {
|
|
3001
|
-
margin: 0;
|
|
3002
|
-
}
|
|
2938
|
+
background: none;
|
|
2939
|
+
border: none;
|
|
2940
|
+
color: var(--gray-500);
|
|
2941
|
+
padding: 0;
|
|
3003
2942
|
`;
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
init_emotion_jsx_shim();
|
|
3007
|
-
|
|
3008
|
-
// src/components/Variables/util/parseVariableExpression.ts
|
|
3009
|
-
init_emotion_jsx_shim();
|
|
3010
|
-
|
|
3011
|
-
// src/components/Variables/util/variableExpression.ts
|
|
3012
|
-
init_emotion_jsx_shim();
|
|
3013
|
-
var variablePrefix = "${";
|
|
3014
|
-
var variableSuffix = "}";
|
|
3015
|
-
|
|
3016
|
-
// src/components/Variables/util/parseVariableExpression.ts
|
|
3017
|
-
function parseVariableExpression(serialized, onToken) {
|
|
3018
|
-
let buf = [];
|
|
3019
|
-
let state = "text";
|
|
3020
|
-
for (let index = 0; index < serialized.length; index++) {
|
|
3021
|
-
const char = serialized[index];
|
|
3022
|
-
if (char === "$" && serialized.at(index + 1) === "{") {
|
|
3023
|
-
if (serialized.at(index - 1) === "\\") {
|
|
3024
|
-
buf.pop();
|
|
3025
|
-
buf.push(char);
|
|
3026
|
-
continue;
|
|
3027
|
-
}
|
|
3028
|
-
state = "variable";
|
|
3029
|
-
if (buf.length) {
|
|
3030
|
-
onToken(buf.join(""), "text");
|
|
3031
|
-
buf = [];
|
|
3032
|
-
}
|
|
3033
|
-
index++;
|
|
3034
|
-
continue;
|
|
3035
|
-
}
|
|
3036
|
-
if (char === "}" && state === "variable") {
|
|
3037
|
-
state = "text";
|
|
3038
|
-
if (buf.length) {
|
|
3039
|
-
onToken(buf.join(""), "variable");
|
|
3040
|
-
buf = [];
|
|
3041
|
-
}
|
|
3042
|
-
continue;
|
|
3043
|
-
}
|
|
3044
|
-
buf.push(char);
|
|
3045
|
-
}
|
|
3046
|
-
if (buf.length) {
|
|
3047
|
-
if (state === "variable") {
|
|
3048
|
-
state = "text";
|
|
3049
|
-
buf.unshift(variablePrefix);
|
|
3050
|
-
}
|
|
3051
|
-
onToken(buf.join(""), state);
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
|
|
3055
|
-
// src/components/Variables/util/getReferencedVariables.ts
|
|
3056
|
-
function getReferencedVariables(value) {
|
|
3057
|
-
const result = [];
|
|
3058
|
-
parseVariableExpression(value, (token, type) => {
|
|
3059
|
-
if (type === "variable") {
|
|
3060
|
-
result.push(token);
|
|
3061
|
-
}
|
|
3062
|
-
});
|
|
3063
|
-
return result;
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3066
|
-
// src/components/Variables/VariableField.tsx
|
|
3067
|
-
init_emotion_jsx_shim();
|
|
3068
|
-
|
|
3069
|
-
// src/components/Variables/styles/VariableField.styles.ts
|
|
3070
|
-
init_emotion_jsx_shim();
|
|
3071
|
-
import { css as css19 } from "@emotion/react";
|
|
3072
|
-
var labelText = css19`
|
|
3073
|
-
align-items: center;
|
|
2943
|
+
var menuItemTextGroup = css18`
|
|
2944
|
+
align-items: flex-start;
|
|
3074
2945
|
display: flex;
|
|
3075
|
-
|
|
3076
|
-
font-weight: var(--fw-regular);
|
|
3077
|
-
margin: 0 0 var(--spacing-xs);
|
|
2946
|
+
flex-direction: column;
|
|
3078
2947
|
`;
|
|
3079
|
-
var
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
padding: var(--spacing-2xs);
|
|
3087
|
-
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3088
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
3089
|
-
width: 1.2rem;
|
|
3090
|
-
|
|
3091
|
-
&:hover,
|
|
3092
|
-
&[aria-pressed='true']:not(:disabled) {
|
|
3093
|
-
background: var(--brand-secondary-3);
|
|
3094
|
-
color: var(--white);
|
|
3095
|
-
}
|
|
3096
|
-
|
|
3097
|
-
&[aria-disabled='true'] {
|
|
3098
|
-
background: none;
|
|
3099
|
-
color: currentColor;
|
|
3100
|
-
}
|
|
2948
|
+
var smallText = css18`
|
|
2949
|
+
font-size: var(--fs-xs);
|
|
2950
|
+
`;
|
|
2951
|
+
var variablesTipText = css18`
|
|
2952
|
+
${smallText}
|
|
2953
|
+
color: var(--gray-500);
|
|
2954
|
+
padding: 0 var(--spacing-sm);
|
|
3101
2955
|
`;
|
|
3102
|
-
|
|
3103
|
-
// src/components/Variables/VariablesComposerVariableMenu.tsx
|
|
3104
|
-
init_emotion_jsx_shim();
|
|
3105
|
-
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
3106
|
-
import { CLEAR_EDITOR_COMMAND } from "lexical";
|
|
3107
|
-
|
|
3108
|
-
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3109
|
-
init_emotion_jsx_shim();
|
|
3110
|
-
import { css as css21 } from "@emotion/react";
|
|
3111
|
-
import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
|
|
3112
|
-
import {
|
|
3113
|
-
LexicalTypeaheadMenuPlugin,
|
|
3114
|
-
MenuOption
|
|
3115
|
-
} from "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
3116
|
-
import { Caption, MenuGroup, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
|
|
3117
|
-
import { $insertNodes, $nodesOfType, COMMAND_PRIORITY_NORMAL, createCommand } from "lexical";
|
|
3118
|
-
import { useCallback, useEffect as useEffect7, useMemo as useMemo6, useState as useState8 } from "react";
|
|
3119
|
-
import { createPortal } from "react-dom";
|
|
3120
2956
|
|
|
3121
2957
|
// src/components/Variables/useOnVariableUpdated.ts
|
|
3122
2958
|
init_emotion_jsx_shim();
|
|
3123
|
-
import { useEffect as
|
|
2959
|
+
import { useEffect as useEffect5 } from "react";
|
|
3124
2960
|
|
|
3125
2961
|
// src/components/Variables/VariablesProvider.tsx
|
|
3126
2962
|
init_emotion_jsx_shim();
|
|
@@ -3136,13 +2972,13 @@ import { z } from "zod";
|
|
|
3136
2972
|
|
|
3137
2973
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
3138
2974
|
init_emotion_jsx_shim();
|
|
3139
|
-
import { css as
|
|
3140
|
-
var variablesFormContainer =
|
|
2975
|
+
import { css as css19 } from "@emotion/react";
|
|
2976
|
+
var variablesFormContainer = css19`
|
|
3141
2977
|
> * {
|
|
3142
2978
|
margin: var(--spacing-base) 0 0;
|
|
3143
2979
|
}
|
|
3144
2980
|
`;
|
|
3145
|
-
var variablesFormBtnGroup =
|
|
2981
|
+
var variablesFormBtnGroup = css19`
|
|
3146
2982
|
display: flex;
|
|
3147
2983
|
gap: var(--spacing-sm);
|
|
3148
2984
|
`;
|
|
@@ -3243,27 +3079,17 @@ function VariablesProvider({
|
|
|
3243
3079
|
value,
|
|
3244
3080
|
onChange,
|
|
3245
3081
|
editVariableComponent,
|
|
3246
|
-
readOnly,
|
|
3247
3082
|
children
|
|
3248
3083
|
}) {
|
|
3249
3084
|
const [editing, setEditing] = React10.useState();
|
|
3250
3085
|
const events = React10.useMemo(() => mitt(), []);
|
|
3251
|
-
if (!readOnly && !onChange) {
|
|
3252
|
-
throw new Error("onChange must be provided when readOnly is false");
|
|
3253
|
-
}
|
|
3254
3086
|
const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
3255
3087
|
const contextValue = {
|
|
3256
3088
|
flatVariables: flattenVariables(value),
|
|
3257
3089
|
dispatch: (event) => {
|
|
3258
|
-
if (readOnly) {
|
|
3259
|
-
console.warn(
|
|
3260
|
-
`Received ignored mutation event in read-only variables context: ${JSON.stringify(event)}`
|
|
3261
|
-
);
|
|
3262
|
-
return;
|
|
3263
|
-
}
|
|
3264
3090
|
if (event.type === "set") {
|
|
3265
3091
|
const { name, ...varValue } = event.variable;
|
|
3266
|
-
onChange
|
|
3092
|
+
onChange({ ...contextValue.variables, [event.variable.name]: varValue });
|
|
3267
3093
|
if (event.openEditor) {
|
|
3268
3094
|
setEditing(event.variable.name);
|
|
3269
3095
|
}
|
|
@@ -3272,9 +3098,9 @@ function VariablesProvider({
|
|
|
3272
3098
|
} else if (event.type === "remove") {
|
|
3273
3099
|
const newValue = { ...value };
|
|
3274
3100
|
delete newValue[event.variable];
|
|
3275
|
-
onChange
|
|
3101
|
+
onChange(newValue);
|
|
3276
3102
|
} else if (event.type === "reorder") {
|
|
3277
|
-
onChange
|
|
3103
|
+
onChange(event.result);
|
|
3278
3104
|
} else {
|
|
3279
3105
|
throw new Error(`Unknown event ${JSON.stringify(event)}`);
|
|
3280
3106
|
}
|
|
@@ -3292,7 +3118,7 @@ function VariablesProvider({
|
|
|
3292
3118
|
onSubmit: (val) => {
|
|
3293
3119
|
setEditing(void 0);
|
|
3294
3120
|
const { name, ...varValue } = val;
|
|
3295
|
-
onChange
|
|
3121
|
+
onChange({ ...value, [name]: varValue });
|
|
3296
3122
|
events.emit("update", name);
|
|
3297
3123
|
},
|
|
3298
3124
|
onCancel: () => setEditing(void 0),
|
|
@@ -3331,7 +3157,7 @@ function flattenVariables(variables) {
|
|
|
3331
3157
|
// src/components/Variables/useOnVariableUpdated.ts
|
|
3332
3158
|
function useOnVariableUpdated(fn2, disabled) {
|
|
3333
3159
|
const { variables, events } = useVariables();
|
|
3334
|
-
|
|
3160
|
+
useEffect5(() => {
|
|
3335
3161
|
if (disabled) {
|
|
3336
3162
|
return;
|
|
3337
3163
|
}
|
|
@@ -3340,9 +3166,6 @@ function useOnVariableUpdated(fn2, disabled) {
|
|
|
3340
3166
|
}, [disabled, events, fn2, variables]);
|
|
3341
3167
|
}
|
|
3342
3168
|
|
|
3343
|
-
// src/components/Variables/variablesToGroupedList.ts
|
|
3344
|
-
init_emotion_jsx_shim();
|
|
3345
|
-
|
|
3346
3169
|
// src/components/Variables/variablesToList.ts
|
|
3347
3170
|
init_emotion_jsx_shim();
|
|
3348
3171
|
function variablesToList(variables) {
|
|
@@ -3362,392 +3185,8 @@ function variablesToList(variables) {
|
|
|
3362
3185
|
}));
|
|
3363
3186
|
}
|
|
3364
3187
|
|
|
3365
|
-
// src/components/Variables/variablesToGroupedList.ts
|
|
3366
|
-
function variablesToGroupedList(variables) {
|
|
3367
|
-
const groups = {};
|
|
3368
|
-
Object.entries(variables || {}).forEach(([name, definition]) => {
|
|
3369
|
-
var _a;
|
|
3370
|
-
const group = (_a = definition.source) != null ? _a : "";
|
|
3371
|
-
if (!groups[group]) {
|
|
3372
|
-
groups[group] = {};
|
|
3373
|
-
}
|
|
3374
|
-
groups[group][name] = definition;
|
|
3375
|
-
});
|
|
3376
|
-
return Object.entries(groups).map(([group, variables2]) => ({
|
|
3377
|
-
name: group,
|
|
3378
|
-
variables: variablesToList(variables2)
|
|
3379
|
-
})).sort((a2, b2) => {
|
|
3380
|
-
var _a, _b;
|
|
3381
|
-
return ((_a = a2.name) != null ? _a : "").localeCompare((_b = b2.name) != null ? _b : "");
|
|
3382
|
-
});
|
|
3383
|
-
}
|
|
3384
|
-
|
|
3385
|
-
// src/components/Variables/composer/VariableNode.tsx
|
|
3386
|
-
init_emotion_jsx_shim();
|
|
3387
|
-
import { Chip } from "@uniformdev/design-system";
|
|
3388
|
-
import { DecoratorNode } from "lexical";
|
|
3389
|
-
import { Fragment as Fragment4 } from "react";
|
|
3390
|
-
import { jsx as jsx30 } from "@emotion/react/jsx-runtime";
|
|
3391
|
-
var VariableNode = class extends DecoratorNode {
|
|
3392
|
-
constructor(reference, state, key) {
|
|
3393
|
-
super(key);
|
|
3394
|
-
this.reference = reference;
|
|
3395
|
-
this.__state = state;
|
|
3396
|
-
}
|
|
3397
|
-
static getType() {
|
|
3398
|
-
return "variable";
|
|
3399
|
-
}
|
|
3400
|
-
static clone(node) {
|
|
3401
|
-
return new VariableNode(node.reference, { ...node.__state }, node.__key);
|
|
3402
|
-
}
|
|
3403
|
-
/** Imports the node from serialized JSON (i.e. the data provided to the editor's initial state) */
|
|
3404
|
-
static importJSON(serializedNode) {
|
|
3405
|
-
return $createVariableNode(serializedNode.reference, {
|
|
3406
|
-
displayName: serializedNode.reference,
|
|
3407
|
-
referenceIsValid: true,
|
|
3408
|
-
hasClickEvent: void 0
|
|
3409
|
-
});
|
|
3410
|
-
}
|
|
3411
|
-
/**
|
|
3412
|
-
* Updates the node's variables state so it knows its current validity, display name, etc
|
|
3413
|
-
* The plugin updates this whenever the variables prop changes.
|
|
3414
|
-
*/
|
|
3415
|
-
setState(state) {
|
|
3416
|
-
this.getWritable().__state = state;
|
|
3417
|
-
}
|
|
3418
|
-
/**
|
|
3419
|
-
* Serializes the node to JSON for editor initial state
|
|
3420
|
-
*/
|
|
3421
|
-
exportJSON() {
|
|
3422
|
-
return {
|
|
3423
|
-
reference: this.reference,
|
|
3424
|
-
type: VariableNode.getType(),
|
|
3425
|
-
version: 1
|
|
3426
|
-
};
|
|
3427
|
-
}
|
|
3428
|
-
/**
|
|
3429
|
-
* Copy variable to clipboard in a format we will read back if pasted
|
|
3430
|
-
* (albeit it won't get the fancy chip-node)
|
|
3431
|
-
*/
|
|
3432
|
-
getTextContent() {
|
|
3433
|
-
return `\${${this.reference}}`;
|
|
3434
|
-
}
|
|
3435
|
-
/** Creates the DOM wrapper that hosts the node */
|
|
3436
|
-
createDOM() {
|
|
3437
|
-
return document.createElement("span");
|
|
3438
|
-
}
|
|
3439
|
-
updateDOM() {
|
|
3440
|
-
return false;
|
|
3441
|
-
}
|
|
3442
|
-
/**
|
|
3443
|
-
* Render the variable node using React.
|
|
3444
|
-
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
3445
|
-
* rely on Context, etc in this renderer.
|
|
3446
|
-
*/
|
|
3447
|
-
decorate(editor) {
|
|
3448
|
-
const { displayName, hasClickEvent, referenceIsValid } = this.__state;
|
|
3449
|
-
const Wrapper = referenceIsValid ? Fragment4 : UndefinedVariableReference;
|
|
3450
|
-
return /* @__PURE__ */ jsx30(
|
|
3451
|
-
Chip,
|
|
3452
|
-
{
|
|
3453
|
-
text: /* @__PURE__ */ jsx30(Wrapper, { children: displayName || this.reference }),
|
|
3454
|
-
title: !referenceIsValid ? `${this.reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0,
|
|
3455
|
-
onClick: () => {
|
|
3456
|
-
editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
|
|
3457
|
-
reference: this.reference
|
|
3458
|
-
});
|
|
3459
|
-
}
|
|
3460
|
-
}
|
|
3461
|
-
);
|
|
3462
|
-
}
|
|
3463
|
-
/** Enables keyboard navigation to hop over the node to previous text */
|
|
3464
|
-
isIsolated() {
|
|
3465
|
-
return true;
|
|
3466
|
-
}
|
|
3467
|
-
};
|
|
3468
|
-
function $createVariableNode(variableReference, state) {
|
|
3469
|
-
return new VariableNode(variableReference, state);
|
|
3470
|
-
}
|
|
3471
|
-
function UndefinedVariableReference({ children }) {
|
|
3472
|
-
return /* @__PURE__ */ jsx30(
|
|
3473
|
-
"span",
|
|
3474
|
-
{
|
|
3475
|
-
style: {
|
|
3476
|
-
textDecoration: "underline",
|
|
3477
|
-
textDecorationStyle: "wavy",
|
|
3478
|
-
textDecorationColor: "red"
|
|
3479
|
-
},
|
|
3480
|
-
children
|
|
3481
|
-
}
|
|
3482
|
-
);
|
|
3483
|
-
}
|
|
3484
|
-
|
|
3485
|
-
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3486
|
-
import { jsx as jsx31, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
|
|
3487
|
-
var EDIT_VARIABLE_COMMAND = createCommand("uniform:edit-variable");
|
|
3488
|
-
var INSERT_VARIABLE_COMMAND = createCommand("uniform:insert-variable");
|
|
3489
|
-
var PUNCTUATION = `\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;
|
|
3490
|
-
var NAME = "\\b[A-Z][^\\s" + PUNCTUATION + "]";
|
|
3491
|
-
var DocumentVariablesRegex = {
|
|
3492
|
-
NAME,
|
|
3493
|
-
PUNCTUATION
|
|
3494
|
-
};
|
|
3495
|
-
var PUNC = DocumentVariablesRegex.PUNCTUATION;
|
|
3496
|
-
var TRIGGERS = ["$"].join("");
|
|
3497
|
-
var VALID_CHARS = "[^" + TRIGGERS + PUNC + "\\s]";
|
|
3498
|
-
var VALID_JOINS = "(?:\\.[ |$]| |[" + PUNC + "]|)";
|
|
3499
|
-
var LENGTH_LIMIT = 75;
|
|
3500
|
-
var DollarSignVariablesRegex = new RegExp(
|
|
3501
|
-
"(^.*)([" + TRIGGERS + "]((?:" + VALID_CHARS + VALID_JOINS + "){0," + LENGTH_LIMIT + "}))$"
|
|
3502
|
-
);
|
|
3503
|
-
function getPossibleQueryMatch(text) {
|
|
3504
|
-
const match = DollarSignVariablesRegex.exec(text);
|
|
3505
|
-
if (match !== null) {
|
|
3506
|
-
const maybeLeadingWhitespace = match[1];
|
|
3507
|
-
const matchingString = match[3];
|
|
3508
|
-
return {
|
|
3509
|
-
leadOffset: match.index + maybeLeadingWhitespace.length,
|
|
3510
|
-
matchingString,
|
|
3511
|
-
replaceableString: match[2]
|
|
3512
|
-
};
|
|
3513
|
-
}
|
|
3514
|
-
return null;
|
|
3515
|
-
}
|
|
3516
|
-
var ADD_VARIABLE_OPTION = "$$add-variable$$";
|
|
3517
|
-
var SOURCE_SEPARATOR = "--";
|
|
3518
|
-
function VariablesPlugin({
|
|
3519
|
-
disableVariables,
|
|
3520
|
-
showAddVariableMenuOption,
|
|
3521
|
-
enableEditingVariables
|
|
3522
|
-
}) {
|
|
3523
|
-
const [editor] = useLexicalComposerContext2();
|
|
3524
|
-
const { variables, dispatch, isEditing, canDispatch, readOnly } = useVariables();
|
|
3525
|
-
const canEditVariable = canDispatch && enableEditingVariables && !readOnly;
|
|
3526
|
-
const [openedAdd, setOpenedAdd] = useState8(false);
|
|
3527
|
-
useOnVariableUpdated((varName) => {
|
|
3528
|
-
editor.update(() => {
|
|
3529
|
-
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, { reference: varName });
|
|
3530
|
-
});
|
|
3531
|
-
}, !openedAdd);
|
|
3532
|
-
useEffect7(() => {
|
|
3533
|
-
if (openedAdd && !isEditing) {
|
|
3534
|
-
setOpenedAdd(false);
|
|
3535
|
-
}
|
|
3536
|
-
}, [isEditing, openedAdd]);
|
|
3537
|
-
const [queryString, setQueryString] = useState8(null);
|
|
3538
|
-
const { groupedVariables, menuOptions } = useMemo6(() => {
|
|
3539
|
-
const groupedVariables2 = variablesToGroupedList(variables);
|
|
3540
|
-
if (showAddVariableMenuOption) {
|
|
3541
|
-
groupedVariables2.push({
|
|
3542
|
-
name: SOURCE_SEPARATOR,
|
|
3543
|
-
variables: [{ name: ADD_VARIABLE_OPTION, displayName: "Add\u2026", default: "" }]
|
|
3544
|
-
});
|
|
3545
|
-
}
|
|
3546
|
-
const menuOptions2 = [];
|
|
3547
|
-
groupedVariables2.forEach(
|
|
3548
|
-
(group) => group.variables.forEach((variable) => {
|
|
3549
|
-
menuOptions2.push(new MenuOption(variable.name));
|
|
3550
|
-
})
|
|
3551
|
-
);
|
|
3552
|
-
return { menuOptions: menuOptions2, groupedVariables: groupedVariables2 };
|
|
3553
|
-
}, [variables, showAddVariableMenuOption]);
|
|
3554
|
-
const { filteredGroupedVariables, filteredMenuOptions } = useMemo6(() => {
|
|
3555
|
-
if (!queryString) {
|
|
3556
|
-
return {
|
|
3557
|
-
filteredGroupedVariables: groupedVariables,
|
|
3558
|
-
filteredMenuOptions: menuOptions
|
|
3559
|
-
};
|
|
3560
|
-
}
|
|
3561
|
-
const query = queryString.toLowerCase();
|
|
3562
|
-
return {
|
|
3563
|
-
filteredGroupedVariables: groupedVariables.map((group) => ({
|
|
3564
|
-
name: group.name,
|
|
3565
|
-
variables: group.variables.filter(
|
|
3566
|
-
(option) => option.name.toLowerCase().includes(query) || option.name === ADD_VARIABLE_OPTION
|
|
3567
|
-
)
|
|
3568
|
-
})).filter((group) => group.variables.length > 0),
|
|
3569
|
-
filteredMenuOptions: menuOptions.filter(
|
|
3570
|
-
(option) => option.key.includes(query) || option.key === ADD_VARIABLE_OPTION
|
|
3571
|
-
)
|
|
3572
|
-
};
|
|
3573
|
-
}, [queryString, groupedVariables, menuOptions]);
|
|
3574
|
-
const onSelectOption = useCallback(
|
|
3575
|
-
(selectedOption, nodeToReplace, closeMenu) => {
|
|
3576
|
-
if (selectedOption.key === ADD_VARIABLE_OPTION) {
|
|
3577
|
-
setOpenedAdd(true);
|
|
3578
|
-
editor.update(() => {
|
|
3579
|
-
nodeToReplace == null ? void 0 : nodeToReplace.remove();
|
|
3580
|
-
});
|
|
3581
|
-
editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
|
|
3582
|
-
reference: queryString != null ? queryString : ""
|
|
3583
|
-
});
|
|
3584
|
-
} else {
|
|
3585
|
-
editor.update(() => {
|
|
3586
|
-
var _a;
|
|
3587
|
-
const variableNode = $createVariableNode(selectedOption.key, {
|
|
3588
|
-
displayName: ((_a = variables[selectedOption.key]) == null ? void 0 : _a.displayName) || selectedOption.key,
|
|
3589
|
-
hasClickEvent: canEditVariable,
|
|
3590
|
-
referenceIsValid: Boolean(variables[selectedOption.key])
|
|
3591
|
-
});
|
|
3592
|
-
if (nodeToReplace) {
|
|
3593
|
-
nodeToReplace.replace(variableNode);
|
|
3594
|
-
}
|
|
3595
|
-
});
|
|
3596
|
-
}
|
|
3597
|
-
closeMenu();
|
|
3598
|
-
},
|
|
3599
|
-
[editor, queryString, variables, canEditVariable]
|
|
3600
|
-
);
|
|
3601
|
-
useEffect7(() => {
|
|
3602
|
-
editor.registerCommand(
|
|
3603
|
-
EDIT_VARIABLE_COMMAND,
|
|
3604
|
-
({ reference }) => {
|
|
3605
|
-
if (!disableVariables && canEditVariable) {
|
|
3606
|
-
dispatch({ type: "edit", variable: reference });
|
|
3607
|
-
}
|
|
3608
|
-
return true;
|
|
3609
|
-
},
|
|
3610
|
-
COMMAND_PRIORITY_NORMAL
|
|
3611
|
-
);
|
|
3612
|
-
editor.registerCommand(
|
|
3613
|
-
INSERT_VARIABLE_COMMAND,
|
|
3614
|
-
({ reference }) => {
|
|
3615
|
-
var _a;
|
|
3616
|
-
if (!disableVariables) {
|
|
3617
|
-
const variableNode = $createVariableNode(reference, {
|
|
3618
|
-
displayName: ((_a = variables[reference]) == null ? void 0 : _a.displayName) || reference,
|
|
3619
|
-
hasClickEvent: canEditVariable,
|
|
3620
|
-
referenceIsValid: Boolean(variables[reference])
|
|
3621
|
-
});
|
|
3622
|
-
$insertNodes([variableNode]);
|
|
3623
|
-
}
|
|
3624
|
-
return true;
|
|
3625
|
-
},
|
|
3626
|
-
COMMAND_PRIORITY_NORMAL
|
|
3627
|
-
);
|
|
3628
|
-
}, [editor, disableVariables, variables, canDispatch, dispatch, canEditVariable, readOnly]);
|
|
3629
|
-
useEffect7(() => {
|
|
3630
|
-
editor.update(() => {
|
|
3631
|
-
$nodesOfType(VariableNode).forEach((variableNode) => {
|
|
3632
|
-
const targetVar = variables[variableNode.reference];
|
|
3633
|
-
variableNode.setState({
|
|
3634
|
-
displayName: (targetVar == null ? void 0 : targetVar.displayName) || variableNode.reference,
|
|
3635
|
-
hasClickEvent: canEditVariable,
|
|
3636
|
-
referenceIsValid: Boolean(targetVar)
|
|
3637
|
-
});
|
|
3638
|
-
});
|
|
3639
|
-
});
|
|
3640
|
-
}, [editor, variables, canEditVariable]);
|
|
3641
|
-
if (disableVariables) {
|
|
3642
|
-
return null;
|
|
3643
|
-
}
|
|
3644
|
-
return /* @__PURE__ */ jsx31(
|
|
3645
|
-
LexicalTypeaheadMenuPlugin,
|
|
3646
|
-
{
|
|
3647
|
-
onQueryChange: setQueryString,
|
|
3648
|
-
onSelectOption,
|
|
3649
|
-
triggerFn: getPossibleQueryMatch,
|
|
3650
|
-
options: filteredMenuOptions,
|
|
3651
|
-
menuRenderFn: (anchorElementRef, { selectOptionAndCleanUp, setHighlightedIndex, selectedIndex }) => {
|
|
3652
|
-
if (!anchorElementRef.current || groupedVariables.length === 0 || openedAdd) {
|
|
3653
|
-
return null;
|
|
3654
|
-
}
|
|
3655
|
-
let currentCumulativeMenuIndex = -1;
|
|
3656
|
-
return createPortal(
|
|
3657
|
-
/* @__PURE__ */ jsx31(
|
|
3658
|
-
"div",
|
|
3659
|
-
{
|
|
3660
|
-
css: css21`
|
|
3661
|
-
box-shadow: var(--shadow-base);
|
|
3662
|
-
border-radius: var(--rounded-base);
|
|
3663
|
-
background: var(--gray-50);
|
|
3664
|
-
display: flex;
|
|
3665
|
-
flex-direction: column;
|
|
3666
|
-
min-width: 250px;
|
|
3667
|
-
padding: var(--spacing-sm);
|
|
3668
|
-
outline: none;
|
|
3669
|
-
overflow: hidden;
|
|
3670
|
-
position: relative;
|
|
3671
|
-
z-index: var(--z-50);
|
|
3672
|
-
`,
|
|
3673
|
-
children: /* @__PURE__ */ jsx31("div", { children: filteredGroupedVariables.map((group, index) => {
|
|
3674
|
-
var _a, _b;
|
|
3675
|
-
return /* @__PURE__ */ jsxs18(
|
|
3676
|
-
MenuGroup,
|
|
3677
|
-
{
|
|
3678
|
-
title: group.name === SOURCE_SEPARATOR ? "" : (_a = group.name) != null ? _a : "",
|
|
3679
|
-
children: [
|
|
3680
|
-
group.name === SOURCE_SEPARATOR ? /* @__PURE__ */ jsx31(MenuItemSeparator, {}) : null,
|
|
3681
|
-
group.variables.map((variable) => {
|
|
3682
|
-
var _a2;
|
|
3683
|
-
currentCumulativeMenuIndex++;
|
|
3684
|
-
return /* @__PURE__ */ jsxs18(
|
|
3685
|
-
MenuItem2,
|
|
3686
|
-
{
|
|
3687
|
-
active: selectedIndex === currentCumulativeMenuIndex,
|
|
3688
|
-
onClick: () => {
|
|
3689
|
-
setHighlightedIndex(currentCumulativeMenuIndex);
|
|
3690
|
-
selectOptionAndCleanUp(new MenuOption(variable.name));
|
|
3691
|
-
},
|
|
3692
|
-
onMouseEnter: () => {
|
|
3693
|
-
setHighlightedIndex(currentCumulativeMenuIndex);
|
|
3694
|
-
},
|
|
3695
|
-
children: [
|
|
3696
|
-
/* @__PURE__ */ jsx31("div", { children: (_a2 = variable.displayName) != null ? _a2 : variable.name }),
|
|
3697
|
-
variable.helpText ? /* @__PURE__ */ jsx31(Caption, { children: variable.helpText }) : null
|
|
3698
|
-
]
|
|
3699
|
-
},
|
|
3700
|
-
variable.name
|
|
3701
|
-
);
|
|
3702
|
-
})
|
|
3703
|
-
]
|
|
3704
|
-
},
|
|
3705
|
-
(_b = group.name) != null ? _b : `none${index}`
|
|
3706
|
-
);
|
|
3707
|
-
}) })
|
|
3708
|
-
}
|
|
3709
|
-
),
|
|
3710
|
-
anchorElementRef.current
|
|
3711
|
-
);
|
|
3712
|
-
}
|
|
3713
|
-
}
|
|
3714
|
-
);
|
|
3715
|
-
}
|
|
3716
|
-
|
|
3717
|
-
// src/components/Variables/SelectVariableMenu.tsx
|
|
3718
|
-
init_emotion_jsx_shim();
|
|
3719
|
-
import { Menu as Menu2, MenuGroup as MenuGroup2, MenuItem as MenuItem3, MenuItemSeparator as MenuItemSeparator2 } from "@uniformdev/design-system";
|
|
3720
|
-
import { useEffect as useEffect8, useRef as useRef8, useState as useState9 } from "react";
|
|
3721
|
-
import { CgUsbC } from "react-icons/cg";
|
|
3722
|
-
|
|
3723
|
-
// src/components/Variables/styles/InsertVariableMenu.styles.ts
|
|
3724
|
-
init_emotion_jsx_shim();
|
|
3725
|
-
import { css as css22 } from "@emotion/react";
|
|
3726
|
-
var menuBtn2 = css22`
|
|
3727
|
-
background: none;
|
|
3728
|
-
border: none;
|
|
3729
|
-
color: var(--gray-500);
|
|
3730
|
-
padding: 0;
|
|
3731
|
-
`;
|
|
3732
|
-
var menuItemTextGroup = css22`
|
|
3733
|
-
align-items: flex-start;
|
|
3734
|
-
display: flex;
|
|
3735
|
-
flex-direction: column;
|
|
3736
|
-
gap: 0;
|
|
3737
|
-
line-height: 1em;
|
|
3738
|
-
`;
|
|
3739
|
-
var smallText = css22`
|
|
3740
|
-
font-size: var(--fs-xs);
|
|
3741
|
-
color: var(--gray-500);
|
|
3742
|
-
`;
|
|
3743
|
-
var variablesTipText = css22`
|
|
3744
|
-
${smallText}
|
|
3745
|
-
color: var(--gray-500);
|
|
3746
|
-
padding: 0 var(--spacing-sm);
|
|
3747
|
-
`;
|
|
3748
|
-
|
|
3749
3188
|
// src/components/Variables/SelectVariableMenu.tsx
|
|
3750
|
-
import { Fragment as
|
|
3189
|
+
import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
|
|
3751
3190
|
var SelectVariableMenu = ({
|
|
3752
3191
|
onSelectVariable,
|
|
3753
3192
|
onResetVariables,
|
|
@@ -3759,102 +3198,167 @@ var SelectVariableMenu = ({
|
|
|
3759
3198
|
}) => {
|
|
3760
3199
|
const { variables, dispatch, isEditing, canDispatch } = useVariables();
|
|
3761
3200
|
const btnRef = useRef8(null);
|
|
3762
|
-
const [openedAdd, setOpenedAdd] =
|
|
3201
|
+
const [openedAdd, setOpenedAdd] = useState8(false);
|
|
3763
3202
|
useOnVariableUpdated((varName) => {
|
|
3764
3203
|
onSelectVariable == null ? void 0 : onSelectVariable({ name: varName, default: "" });
|
|
3765
3204
|
}, !openedAdd);
|
|
3766
|
-
|
|
3205
|
+
useEffect6(() => {
|
|
3767
3206
|
if (openedAdd && !isEditing) {
|
|
3768
3207
|
setOpenedAdd(false);
|
|
3769
3208
|
}
|
|
3770
3209
|
}, [isEditing, openedAdd]);
|
|
3771
|
-
const
|
|
3210
|
+
const variablesList = variablesToList(variables);
|
|
3772
3211
|
const menuHasVariableOptions = Object.entries(variables).length || showAddVariableMenuOption;
|
|
3773
|
-
return /* @__PURE__ */
|
|
3212
|
+
return /* @__PURE__ */ jsxs18(
|
|
3774
3213
|
Menu2,
|
|
3775
3214
|
{
|
|
3776
3215
|
placement: "bottom-start",
|
|
3777
3216
|
forceVisible,
|
|
3778
|
-
menuTrigger: /* @__PURE__ */
|
|
3217
|
+
menuTrigger: /* @__PURE__ */ jsx30(
|
|
3779
3218
|
"button",
|
|
3780
3219
|
{
|
|
3781
3220
|
title: "Insert variable",
|
|
3782
3221
|
...buttonProps,
|
|
3783
3222
|
ref: btnRef,
|
|
3784
|
-
css: [
|
|
3223
|
+
css: [menuBtn, buttonCss],
|
|
3785
3224
|
type: "button",
|
|
3786
|
-
children: /* @__PURE__ */
|
|
3225
|
+
children: /* @__PURE__ */ jsx30(CgUsbC, { size: "1.4rem" })
|
|
3787
3226
|
}
|
|
3788
3227
|
),
|
|
3789
3228
|
menuLabel: "Insert variable",
|
|
3790
3229
|
children: [
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
return /* @__PURE__ */
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
children:
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
name
|
|
3807
|
-
);
|
|
3808
|
-
}) }, group.name);
|
|
3230
|
+
variablesList.map((variable) => {
|
|
3231
|
+
const { name, helpText } = variable;
|
|
3232
|
+
return /* @__PURE__ */ jsxs18(
|
|
3233
|
+
MenuItem2,
|
|
3234
|
+
{
|
|
3235
|
+
id: name,
|
|
3236
|
+
css: menuItemTextGroup,
|
|
3237
|
+
onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
|
|
3238
|
+
children: [
|
|
3239
|
+
/* @__PURE__ */ jsx30("span", { children: name }),
|
|
3240
|
+
helpText ? /* @__PURE__ */ jsx30("small", { css: smallText, children: helpText }) : null
|
|
3241
|
+
]
|
|
3242
|
+
},
|
|
3243
|
+
name
|
|
3244
|
+
);
|
|
3809
3245
|
}),
|
|
3810
|
-
showAddVariableMenuOption && canDispatch ? /* @__PURE__ */
|
|
3811
|
-
|
|
3812
|
-
/* @__PURE__ */
|
|
3813
|
-
|
|
3246
|
+
showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
3247
|
+
variablesList.length ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
3248
|
+
/* @__PURE__ */ jsx30(
|
|
3249
|
+
MenuItem2,
|
|
3814
3250
|
{
|
|
3815
3251
|
onClick: () => {
|
|
3816
3252
|
setOpenedAdd(true);
|
|
3817
3253
|
dispatch({ type: "edit", variable: "" });
|
|
3818
3254
|
},
|
|
3819
|
-
children: "Add
|
|
3255
|
+
children: "Add Variable"
|
|
3820
3256
|
}
|
|
3821
3257
|
)
|
|
3822
3258
|
] }) : null,
|
|
3823
|
-
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */
|
|
3824
|
-
onResetVariables ? /* @__PURE__ */
|
|
3825
|
-
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */
|
|
3826
|
-
tip ? /* @__PURE__ */
|
|
3259
|
+
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
3260
|
+
onResetVariables ? /* @__PURE__ */ jsx30(MenuItem2, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
|
|
3261
|
+
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
3262
|
+
tip ? /* @__PURE__ */ jsx30("i", { css: variablesTipText, children: tip }) : null
|
|
3827
3263
|
]
|
|
3828
3264
|
}
|
|
3829
3265
|
);
|
|
3830
3266
|
};
|
|
3831
3267
|
|
|
3832
|
-
// src/components/Variables/
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3268
|
+
// src/components/Variables/styles/InputVariables.styles.ts
|
|
3269
|
+
init_emotion_jsx_shim();
|
|
3270
|
+
import { css as css20 } from "@emotion/react";
|
|
3271
|
+
var menuContainer = css20`
|
|
3272
|
+
position: relative;
|
|
3273
|
+
`;
|
|
3274
|
+
var menuBtn2 = css20`
|
|
3275
|
+
position: absolute;
|
|
3276
|
+
bottom: 25%;
|
|
3277
|
+
right: var(--spacing-sm);
|
|
3278
|
+
`;
|
|
3279
|
+
|
|
3280
|
+
// src/components/Variables/util/getReferencedVariables.ts
|
|
3281
|
+
init_emotion_jsx_shim();
|
|
3282
|
+
|
|
3283
|
+
// src/components/Variables/util/variableExpression.ts
|
|
3284
|
+
init_emotion_jsx_shim();
|
|
3285
|
+
var variableExpression = /(?<!\\)\${([^}]+)}/g;
|
|
3286
|
+
var variablePrefix = "${";
|
|
3287
|
+
var variableSuffix = "}";
|
|
3288
|
+
|
|
3289
|
+
// src/components/Variables/util/getReferencedVariables.ts
|
|
3290
|
+
function getReferencedVariables(value) {
|
|
3291
|
+
const result = [];
|
|
3292
|
+
for (const match of value.matchAll(variableExpression)) {
|
|
3293
|
+
result.push(match[1]);
|
|
3294
|
+
}
|
|
3295
|
+
return result;
|
|
3296
|
+
}
|
|
3297
|
+
|
|
3298
|
+
// src/components/Variables/util/insertVariableIntoText.ts
|
|
3299
|
+
init_emotion_jsx_shim();
|
|
3300
|
+
function insertVariableIntoText({
|
|
3301
|
+
variableName: variableName2,
|
|
3302
|
+
value,
|
|
3303
|
+
selectionStart = null,
|
|
3304
|
+
selectionEnd = null
|
|
3305
|
+
}) {
|
|
3306
|
+
const variableExpression2 = `${variablePrefix}${variableName2}${variableSuffix}`;
|
|
3307
|
+
if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
|
|
3308
|
+
return `${value.substring(0, selectionStart)}${variableExpression2}${value.substring(selectionEnd)}`;
|
|
3309
|
+
}
|
|
3310
|
+
const hasCursorPosition = selectionStart !== null;
|
|
3311
|
+
let startOffset = 0;
|
|
3312
|
+
if (hasCursorPosition && value.substring(selectionStart - variablePrefix.length, selectionStart) === variablePrefix) {
|
|
3313
|
+
startOffset = variablePrefix.length;
|
|
3314
|
+
}
|
|
3315
|
+
if (hasCursorPosition) {
|
|
3316
|
+
return `${value.substring(0, selectionStart - startOffset)}${variableExpression2}${value.substring(
|
|
3317
|
+
selectionStart
|
|
3318
|
+
)}`;
|
|
3319
|
+
}
|
|
3320
|
+
return `${value}${variableExpression2}`;
|
|
3321
|
+
}
|
|
3855
3322
|
|
|
3856
3323
|
// src/components/Variables/VariableField.tsx
|
|
3857
|
-
|
|
3324
|
+
init_emotion_jsx_shim();
|
|
3325
|
+
|
|
3326
|
+
// src/components/Variables/styles/VariableField.styles.ts
|
|
3327
|
+
init_emotion_jsx_shim();
|
|
3328
|
+
import { css as css21 } from "@emotion/react";
|
|
3329
|
+
var labelText = css21`
|
|
3330
|
+
align-items: center;
|
|
3331
|
+
display: flex;
|
|
3332
|
+
gap: var(--spacing-xs);
|
|
3333
|
+
font-weight: var(--fw-regular);
|
|
3334
|
+
margin: 0 0 var(--spacing-xs);
|
|
3335
|
+
`;
|
|
3336
|
+
var variableBindButton = css21`
|
|
3337
|
+
align-items: center;
|
|
3338
|
+
border: none;
|
|
3339
|
+
border-radius: var(--rounded-base);
|
|
3340
|
+
background: none;
|
|
3341
|
+
display: flex;
|
|
3342
|
+
height: 1.2rem;
|
|
3343
|
+
padding: var(--spacing-2xs);
|
|
3344
|
+
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3345
|
+
color var(--duration-fast) var(--timing-ease-out);
|
|
3346
|
+
width: 1.2rem;
|
|
3347
|
+
|
|
3348
|
+
&:hover,
|
|
3349
|
+
&[aria-pressed='true']:not(:disabled) {
|
|
3350
|
+
background: var(--brand-secondary-3);
|
|
3351
|
+
color: var(--white);
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
&[aria-disabled='true'] {
|
|
3355
|
+
background: none;
|
|
3356
|
+
color: currentColor;
|
|
3357
|
+
}
|
|
3358
|
+
`;
|
|
3359
|
+
|
|
3360
|
+
// src/components/Variables/VariableField.tsx
|
|
3361
|
+
import { jsx as jsx31, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
|
|
3858
3362
|
function VariableField({
|
|
3859
3363
|
label,
|
|
3860
3364
|
selectVariableMenuOptions,
|
|
@@ -3865,194 +3369,25 @@ function VariableField({
|
|
|
3865
3369
|
}) {
|
|
3866
3370
|
const { variables } = useVariables(true);
|
|
3867
3371
|
const varCount = Object.keys(variables).length;
|
|
3868
|
-
const variableSelector = varCount > 0 && !disableVariables ? /* @__PURE__ */
|
|
3869
|
-
|
|
3372
|
+
const variableSelector = varCount > 0 && (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.onSelectVariable) && !disableVariables ? /* @__PURE__ */ jsx31(
|
|
3373
|
+
SelectVariableMenu,
|
|
3870
3374
|
{
|
|
3871
3375
|
...selectVariableMenuOptions,
|
|
3872
3376
|
buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
|
|
3873
3377
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
3874
3378
|
}
|
|
3875
3379
|
) : null;
|
|
3876
|
-
return /* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
3380
|
+
return /* @__PURE__ */ jsxs19("div", { children: [
|
|
3381
|
+
/* @__PURE__ */ jsxs19("label", { htmlFor: id, css: labelText, children: [
|
|
3878
3382
|
variableSelector,
|
|
3879
|
-
/* @__PURE__ */
|
|
3383
|
+
/* @__PURE__ */ jsx31("span", { children: label })
|
|
3880
3384
|
] }),
|
|
3881
3385
|
children
|
|
3882
3386
|
] });
|
|
3883
3387
|
}
|
|
3884
3388
|
|
|
3885
|
-
// src/components/Variables/VariablesComposer.tsx
|
|
3886
|
-
init_emotion_jsx_shim();
|
|
3887
|
-
import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
|
|
3888
|
-
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
3889
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
3890
|
-
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
|
|
3891
|
-
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
3892
|
-
import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin";
|
|
3893
|
-
import {
|
|
3894
|
-
LineBreakNode as LineBreakNode2,
|
|
3895
|
-
TextNode as TextNode2
|
|
3896
|
-
} from "lexical";
|
|
3897
|
-
import { useMemo as useMemo7, useRef as useRef9, useState as useState10 } from "react";
|
|
3898
|
-
import { v4 as v42 } from "uuid";
|
|
3899
|
-
|
|
3900
|
-
// src/components/Variables/composer/DisablePlugin.tsx
|
|
3901
|
-
init_emotion_jsx_shim();
|
|
3902
|
-
import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
|
|
3903
|
-
import { useEffect as useEffect9 } from "react";
|
|
3904
|
-
function DisablePlugin({ disabled }) {
|
|
3905
|
-
const [editor] = useLexicalComposerContext4();
|
|
3906
|
-
useEffect9(() => {
|
|
3907
|
-
editor.setEditable(!disabled);
|
|
3908
|
-
}, [editor, disabled]);
|
|
3909
|
-
return null;
|
|
3910
|
-
}
|
|
3911
|
-
|
|
3912
|
-
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
3913
|
-
init_emotion_jsx_shim();
|
|
3914
|
-
import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
|
|
3915
|
-
import { LineBreakNode } from "lexical";
|
|
3916
|
-
import { useEffect as useEffect10 } from "react";
|
|
3917
|
-
function SingleLineTextPlugin() {
|
|
3918
|
-
const [editor] = useLexicalComposerContext5();
|
|
3919
|
-
useEffect10(() => {
|
|
3920
|
-
editor.registerNodeTransform(LineBreakNode, (node) => {
|
|
3921
|
-
node.remove();
|
|
3922
|
-
});
|
|
3923
|
-
}, [editor]);
|
|
3924
|
-
return null;
|
|
3925
|
-
}
|
|
3926
|
-
|
|
3927
|
-
// src/components/Variables/VariablesComposer.tsx
|
|
3928
|
-
import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
|
|
3929
|
-
function VariablesComposer(props) {
|
|
3930
|
-
const { value, children, onChange, disabled, disableVariables, ...variablesPluginProps } = props;
|
|
3931
|
-
const [namespace] = useState10(v42());
|
|
3932
|
-
const [lastEmittedValue, setLastEmittedValue] = useState10(value);
|
|
3933
|
-
const editorConfig = useMemo7(
|
|
3934
|
-
() => ({
|
|
3935
|
-
namespace,
|
|
3936
|
-
onError(error) {
|
|
3937
|
-
throw error;
|
|
3938
|
-
},
|
|
3939
|
-
nodes: [VariableNode],
|
|
3940
|
-
editorState: deserializeEditorState(props.value)
|
|
3941
|
-
}),
|
|
3942
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3943
|
-
[namespace]
|
|
3944
|
-
);
|
|
3945
|
-
const editorState = useRef9();
|
|
3946
|
-
const updateTimeout = useRef9();
|
|
3947
|
-
if (typeof document === "undefined")
|
|
3948
|
-
return null;
|
|
3949
|
-
return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
|
|
3950
|
-
/* @__PURE__ */ jsx35(
|
|
3951
|
-
OnChangePlugin,
|
|
3952
|
-
{
|
|
3953
|
-
onChange: (state) => {
|
|
3954
|
-
editorState.current = state;
|
|
3955
|
-
if (updateTimeout.current) {
|
|
3956
|
-
clearTimeout(updateTimeout.current);
|
|
3957
|
-
}
|
|
3958
|
-
setTimeout(() => {
|
|
3959
|
-
if (editorState.current) {
|
|
3960
|
-
const valueToEmit = serializeEditorState(editorState.current);
|
|
3961
|
-
if (valueToEmit !== lastEmittedValue) {
|
|
3962
|
-
setLastEmittedValue(valueToEmit);
|
|
3963
|
-
onChange(valueToEmit);
|
|
3964
|
-
}
|
|
3965
|
-
}
|
|
3966
|
-
}, 400);
|
|
3967
|
-
}
|
|
3968
|
-
}
|
|
3969
|
-
),
|
|
3970
|
-
/* @__PURE__ */ jsx35(SingleLineTextPlugin, {}),
|
|
3971
|
-
/* @__PURE__ */ jsx35(ClearEditorPlugin, {}),
|
|
3972
|
-
/* @__PURE__ */ jsx35(VariablesPlugin, { ...variablesPluginProps }),
|
|
3973
|
-
/* @__PURE__ */ jsx35(DisablePlugin, { disabled }),
|
|
3974
|
-
/* @__PURE__ */ jsx35(Fragment6, { children })
|
|
3975
|
-
] });
|
|
3976
|
-
}
|
|
3977
|
-
function VariablesComposerInput(props) {
|
|
3978
|
-
return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
|
|
3979
|
-
PlainTextPlugin,
|
|
3980
|
-
{
|
|
3981
|
-
contentEditable: /* @__PURE__ */ jsx35(ContentEditable, { css: input, ...props }),
|
|
3982
|
-
placeholder: null,
|
|
3983
|
-
ErrorBoundary: LexicalErrorBoundary
|
|
3984
|
-
}
|
|
3985
|
-
) });
|
|
3986
|
-
}
|
|
3987
|
-
function deserializeEditorState(serialized) {
|
|
3988
|
-
const result = [];
|
|
3989
|
-
parseVariableExpression(serialized, (token, type) => {
|
|
3990
|
-
if (type === "text") {
|
|
3991
|
-
const node = {
|
|
3992
|
-
type: TextNode2.getType(),
|
|
3993
|
-
text: token,
|
|
3994
|
-
mode: "normal",
|
|
3995
|
-
version: 1,
|
|
3996
|
-
detail: 0,
|
|
3997
|
-
format: 0,
|
|
3998
|
-
style: ""
|
|
3999
|
-
};
|
|
4000
|
-
result.push(node);
|
|
4001
|
-
}
|
|
4002
|
-
if (type === "variable") {
|
|
4003
|
-
const node = {
|
|
4004
|
-
type: "variable",
|
|
4005
|
-
reference: token,
|
|
4006
|
-
version: 1
|
|
4007
|
-
};
|
|
4008
|
-
result.push(node);
|
|
4009
|
-
}
|
|
4010
|
-
});
|
|
4011
|
-
const rez = JSON.stringify({
|
|
4012
|
-
root: {
|
|
4013
|
-
children: [
|
|
4014
|
-
{
|
|
4015
|
-
children: result,
|
|
4016
|
-
direction: "ltr",
|
|
4017
|
-
format: "",
|
|
4018
|
-
indent: 0,
|
|
4019
|
-
type: "paragraph",
|
|
4020
|
-
version: 1
|
|
4021
|
-
}
|
|
4022
|
-
],
|
|
4023
|
-
direction: "ltr",
|
|
4024
|
-
format: "",
|
|
4025
|
-
indent: 0,
|
|
4026
|
-
type: "root",
|
|
4027
|
-
version: 1
|
|
4028
|
-
}
|
|
4029
|
-
});
|
|
4030
|
-
return rez;
|
|
4031
|
-
}
|
|
4032
|
-
function serializeEditorState(editorState) {
|
|
4033
|
-
const buf = [];
|
|
4034
|
-
serializeRecursive(editorState.toJSON().root, buf);
|
|
4035
|
-
return buf.join("");
|
|
4036
|
-
}
|
|
4037
|
-
function serializeRecursive(node, buffer) {
|
|
4038
|
-
if (node.type === TextNode2.getType()) {
|
|
4039
|
-
buffer.push(node.text);
|
|
4040
|
-
}
|
|
4041
|
-
if (node.type === VariableNode.getType()) {
|
|
4042
|
-
buffer.push(`\${${node.reference}}`);
|
|
4043
|
-
}
|
|
4044
|
-
if (node.type === LineBreakNode2.getType()) {
|
|
4045
|
-
buffer.push("\n");
|
|
4046
|
-
}
|
|
4047
|
-
if ("children" in node && node.children) {
|
|
4048
|
-
for (const child of node.children) {
|
|
4049
|
-
serializeRecursive(child, buffer);
|
|
4050
|
-
}
|
|
4051
|
-
}
|
|
4052
|
-
}
|
|
4053
|
-
|
|
4054
3389
|
// src/components/Variables/InputVariables.tsx
|
|
4055
|
-
import { Fragment as
|
|
3390
|
+
import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs20 } from "@emotion/react/jsx-runtime";
|
|
4056
3391
|
function InputVariables({
|
|
4057
3392
|
id,
|
|
4058
3393
|
"aria-label": ariaLabel,
|
|
@@ -4060,20 +3395,38 @@ function InputVariables({
|
|
|
4060
3395
|
value,
|
|
4061
3396
|
disableVariables,
|
|
4062
3397
|
disableReset,
|
|
4063
|
-
enableEditingVariables,
|
|
4064
3398
|
disableInlineMenu,
|
|
4065
3399
|
onChange,
|
|
4066
|
-
|
|
3400
|
+
onPaste,
|
|
4067
3401
|
showAddVariableMenuOption,
|
|
4068
3402
|
inputWhenNoVariables,
|
|
4069
3403
|
caption,
|
|
4070
3404
|
errorMessage,
|
|
4071
3405
|
warningMessage,
|
|
4072
3406
|
infoMessage,
|
|
4073
|
-
|
|
3407
|
+
...inputProps
|
|
4074
3408
|
}) {
|
|
4075
|
-
|
|
4076
|
-
const
|
|
3409
|
+
var _a, _b;
|
|
3410
|
+
const { variables } = useVariables(true);
|
|
3411
|
+
const inputRef = React11.useRef(null);
|
|
3412
|
+
const [finalId] = React11.useState(id != null ? id : () => v42());
|
|
3413
|
+
const onPasteHandler = (e) => {
|
|
3414
|
+
var _a2, _b2, _c;
|
|
3415
|
+
if (!onPaste) {
|
|
3416
|
+
return;
|
|
3417
|
+
}
|
|
3418
|
+
const pastedValue = (_a2 = e.clipboardData) == null ? void 0 : _a2.getData("text/plain");
|
|
3419
|
+
if (!pastedValue || !e.currentTarget) {
|
|
3420
|
+
return;
|
|
3421
|
+
}
|
|
3422
|
+
const selectionStart = (_b2 = e.currentTarget.selectionStart) != null ? _b2 : 0;
|
|
3423
|
+
const selectionEnd = (_c = e.currentTarget.selectionEnd) != null ? _c : 0;
|
|
3424
|
+
const newValue = e.currentTarget.value.substring(0, selectionStart) + pastedValue + e.currentTarget.value.substring(selectionEnd);
|
|
3425
|
+
onPaste(newValue);
|
|
3426
|
+
e.preventDefault();
|
|
3427
|
+
};
|
|
3428
|
+
const currentCursor = (_b = (_a = inputRef.current) == null ? void 0 : _a.selectionStart) != null ? _b : value.length;
|
|
3429
|
+
const forceMenu = value.substring(currentCursor - 2, currentCursor) === variablePrefix;
|
|
4077
3430
|
const hasVariablesInValue = getReferencedVariables(value).length > 0;
|
|
4078
3431
|
const [hadVariablesInValue, setHadVariablesInValue] = React11.useState(hasVariablesInValue);
|
|
4079
3432
|
React11.useEffect(() => {
|
|
@@ -4081,35 +3434,60 @@ function InputVariables({
|
|
|
4081
3434
|
setHadVariablesInValue(true);
|
|
4082
3435
|
}
|
|
4083
3436
|
}, [hasVariablesInValue]);
|
|
4084
|
-
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption
|
|
3437
|
+
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4085
3438
|
const disableInlineVariablesForReals = disableVariablesForReals || disableInlineMenu;
|
|
4086
|
-
const
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
3439
|
+
const handleInsertVariable = (variable) => {
|
|
3440
|
+
var _a2, _b2;
|
|
3441
|
+
const baseValue = inputWhenNoVariables && !hasVariablesInValue ? "" : value;
|
|
3442
|
+
handleSetValue(
|
|
3443
|
+
insertVariableIntoText({
|
|
3444
|
+
variableName: variable.name,
|
|
3445
|
+
value: baseValue,
|
|
3446
|
+
selectionEnd: (_a2 = inputRef.current) == null ? void 0 : _a2.selectionEnd,
|
|
3447
|
+
selectionStart: (_b2 = inputRef.current) == null ? void 0 : _b2.selectionStart
|
|
3448
|
+
})
|
|
3449
|
+
);
|
|
3450
|
+
};
|
|
3451
|
+
const handleSetValue = (rawValue) => {
|
|
3452
|
+
onChange(rawValue);
|
|
3453
|
+
};
|
|
3454
|
+
const sharedMenuProps = {
|
|
3455
|
+
onSelectVariable: handleInsertVariable,
|
|
3456
|
+
showAddVariableMenuOption,
|
|
3457
|
+
onResetVariables: hadVariablesInValue && !disableReset ? () => {
|
|
3458
|
+
handleSetValue("");
|
|
3459
|
+
setHadVariablesInValue(false);
|
|
3460
|
+
} : void 0
|
|
3461
|
+
};
|
|
3462
|
+
const input = /* @__PURE__ */ jsxs20("div", { children: [
|
|
3463
|
+
inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx32(
|
|
3464
|
+
InputVariablesShell,
|
|
4098
3465
|
{
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
3466
|
+
...sharedMenuProps,
|
|
3467
|
+
disabled: disableInlineVariablesForReals,
|
|
3468
|
+
forceVisible: forceMenu || void 0,
|
|
3469
|
+
children: /* @__PURE__ */ jsx32(
|
|
3470
|
+
Input3,
|
|
3471
|
+
{
|
|
3472
|
+
id: finalId,
|
|
3473
|
+
ref: inputRef,
|
|
3474
|
+
label: ariaLabel,
|
|
3475
|
+
showLabel: false,
|
|
3476
|
+
value,
|
|
3477
|
+
onChange: (e) => handleSetValue(e.currentTarget.value),
|
|
3478
|
+
onPaste: onPasteHandler,
|
|
3479
|
+
...inputProps
|
|
3480
|
+
}
|
|
3481
|
+
)
|
|
4103
3482
|
}
|
|
4104
|
-
)
|
|
4105
|
-
caption ? /* @__PURE__ */
|
|
4106
|
-
errorMessage ? /* @__PURE__ */
|
|
4107
|
-
warningMessage ? /* @__PURE__ */
|
|
4108
|
-
infoMessage ? /* @__PURE__ */
|
|
3483
|
+
),
|
|
3484
|
+
caption ? /* @__PURE__ */ jsx32(Caption, { children: caption }) : null,
|
|
3485
|
+
errorMessage ? /* @__PURE__ */ jsx32(ErrorMessage, { message: errorMessage }) : null,
|
|
3486
|
+
warningMessage ? /* @__PURE__ */ jsx32(WarningMessage, { message: warningMessage }) : null,
|
|
3487
|
+
infoMessage ? /* @__PURE__ */ jsx32(InfoMessage, { message: infoMessage }) : null
|
|
4109
3488
|
] });
|
|
4110
|
-
let body = input2;
|
|
4111
3489
|
if (label) {
|
|
4112
|
-
|
|
3490
|
+
return /* @__PURE__ */ jsx32(
|
|
4113
3491
|
VariableField,
|
|
4114
3492
|
{
|
|
4115
3493
|
label,
|
|
@@ -4117,49 +3495,29 @@ function InputVariables({
|
|
|
4117
3495
|
id: finalId,
|
|
4118
3496
|
isActive: hadVariablesInValue,
|
|
4119
3497
|
disableVariables: disableVariablesForReals,
|
|
4120
|
-
children:
|
|
3498
|
+
children: input
|
|
4121
3499
|
}
|
|
4122
3500
|
);
|
|
4123
3501
|
}
|
|
4124
|
-
return
|
|
4125
|
-
VariablesComposer,
|
|
4126
|
-
{
|
|
4127
|
-
onChange,
|
|
4128
|
-
value,
|
|
4129
|
-
disableVariables: disableVariablesForReals,
|
|
4130
|
-
showAddVariableMenuOption,
|
|
4131
|
-
enableEditingVariables,
|
|
4132
|
-
children: [
|
|
4133
|
-
/* @__PURE__ */ jsx36(PasteTransformerPlugin, { transformPaste }),
|
|
4134
|
-
body
|
|
4135
|
-
]
|
|
4136
|
-
}
|
|
4137
|
-
);
|
|
3502
|
+
return input;
|
|
4138
3503
|
}
|
|
4139
|
-
function
|
|
3504
|
+
function InputVariablesShell({
|
|
4140
3505
|
children,
|
|
4141
3506
|
disabled,
|
|
4142
3507
|
...props
|
|
4143
3508
|
}) {
|
|
4144
3509
|
if (disabled) {
|
|
4145
|
-
return /* @__PURE__ */
|
|
3510
|
+
return /* @__PURE__ */ jsx32(Fragment5, { children });
|
|
4146
3511
|
}
|
|
4147
|
-
return /* @__PURE__ */
|
|
3512
|
+
return /* @__PURE__ */ jsxs20("div", { css: menuContainer, children: [
|
|
4148
3513
|
children,
|
|
4149
|
-
/* @__PURE__ */
|
|
4150
|
-
VariablesComposerVariableMenu,
|
|
4151
|
-
{
|
|
4152
|
-
...props,
|
|
4153
|
-
tip: "Tip: access this list by typing $",
|
|
4154
|
-
buttonCss: menuBtn
|
|
4155
|
-
}
|
|
4156
|
-
)
|
|
3514
|
+
/* @__PURE__ */ jsx32(SelectVariableMenu, { ...props, tip: "Tip: access this list by typing ${", buttonCss: menuBtn2 })
|
|
4157
3515
|
] });
|
|
4158
3516
|
}
|
|
4159
3517
|
|
|
4160
3518
|
// src/components/Variables/VariablesList.tsx
|
|
4161
3519
|
init_emotion_jsx_shim();
|
|
4162
|
-
import { css as
|
|
3520
|
+
import { css as css23 } from "@emotion/react";
|
|
4163
3521
|
import {
|
|
4164
3522
|
AddListButton,
|
|
4165
3523
|
button,
|
|
@@ -4175,8 +3533,8 @@ import { DragDropContext as DragDropContext2, Draggable as Draggable2, Droppable
|
|
|
4175
3533
|
|
|
4176
3534
|
// src/components/Variables/styles/VariablesList.styles.ts
|
|
4177
3535
|
init_emotion_jsx_shim();
|
|
4178
|
-
import { css as
|
|
4179
|
-
var tableRow = (isDragging) =>
|
|
3536
|
+
import { css as css22 } from "@emotion/react";
|
|
3537
|
+
var tableRow = (isDragging) => css22`
|
|
4180
3538
|
position: relative;
|
|
4181
3539
|
${isDragging ? `
|
|
4182
3540
|
display: table;
|
|
@@ -4184,7 +3542,7 @@ var tableRow = (isDragging) => css23`
|
|
|
4184
3542
|
top: auto !important;
|
|
4185
3543
|
` : void 0}
|
|
4186
3544
|
`;
|
|
4187
|
-
var tableCellDragIcon =
|
|
3545
|
+
var tableCellDragIcon = css22`
|
|
4188
3546
|
&::after {
|
|
4189
3547
|
content: '';
|
|
4190
3548
|
display: block;
|
|
@@ -4202,7 +3560,7 @@ var tableCellDragIcon = css23`
|
|
|
4202
3560
|
opacity: 1;
|
|
4203
3561
|
}
|
|
4204
3562
|
`;
|
|
4205
|
-
var variableName =
|
|
3563
|
+
var variableName = css22`
|
|
4206
3564
|
border: none;
|
|
4207
3565
|
color: var(--brand-secondary-5);
|
|
4208
3566
|
font-weight: var(--fw-medium);
|
|
@@ -4213,7 +3571,7 @@ var variableName = css23`
|
|
|
4213
3571
|
white-space: nowrap;
|
|
4214
3572
|
max-width: 20ch;
|
|
4215
3573
|
`;
|
|
4216
|
-
var variableValue =
|
|
3574
|
+
var variableValue = css22`
|
|
4217
3575
|
overflow: hidden;
|
|
4218
3576
|
text-overflow: ellipsis;
|
|
4219
3577
|
white-space: nowrap;
|
|
@@ -4221,7 +3579,7 @@ var variableValue = css23`
|
|
|
4221
3579
|
`;
|
|
4222
3580
|
|
|
4223
3581
|
// src/components/Variables/VariablesList.tsx
|
|
4224
|
-
import { Fragment as
|
|
3582
|
+
import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
|
|
4225
3583
|
function VariablesList() {
|
|
4226
3584
|
const { variables, dispatch } = useVariables();
|
|
4227
3585
|
const sorted = variablesToList(variables);
|
|
@@ -4242,23 +3600,23 @@ function VariablesList() {
|
|
|
4242
3600
|
return result;
|
|
4243
3601
|
}
|
|
4244
3602
|
};
|
|
4245
|
-
return /* @__PURE__ */
|
|
4246
|
-
/* @__PURE__ */
|
|
4247
|
-
/* @__PURE__ */
|
|
4248
|
-
/* @__PURE__ */
|
|
4249
|
-
/* @__PURE__ */
|
|
4250
|
-
/* @__PURE__ */
|
|
3603
|
+
return /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
3604
|
+
/* @__PURE__ */ jsx33(DragDropContext2, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx33(Droppable2, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ jsxs21(Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
3605
|
+
/* @__PURE__ */ jsx33(TableHead, { children: /* @__PURE__ */ jsxs21(TableRow, { children: [
|
|
3606
|
+
/* @__PURE__ */ jsx33(TableCellHead, { children: "Name" }),
|
|
3607
|
+
/* @__PURE__ */ jsx33(TableCellHead, { children: "Default Value" }),
|
|
3608
|
+
/* @__PURE__ */ jsx33(TableCellHead, {})
|
|
4251
3609
|
] }) }),
|
|
4252
|
-
/* @__PURE__ */
|
|
3610
|
+
/* @__PURE__ */ jsxs21(TableBody, { children: [
|
|
4253
3611
|
sorted.map(({ name, displayName, default: defaultValue }, index) => {
|
|
4254
3612
|
const text = displayName != null ? displayName : name;
|
|
4255
|
-
return /* @__PURE__ */
|
|
3613
|
+
return /* @__PURE__ */ jsx33(
|
|
4256
3614
|
Draggable2,
|
|
4257
3615
|
{
|
|
4258
3616
|
draggableId: name,
|
|
4259
3617
|
index,
|
|
4260
3618
|
isDragDisabled: sorted.length === 1,
|
|
4261
|
-
children: (provided2, snapshot) => /* @__PURE__ */
|
|
3619
|
+
children: (provided2, snapshot) => /* @__PURE__ */ jsxs21(
|
|
4262
3620
|
TableRow,
|
|
4263
3621
|
{
|
|
4264
3622
|
ref: provided2.innerRef,
|
|
@@ -4268,7 +3626,7 @@ function VariablesList() {
|
|
|
4268
3626
|
css: tableRow(snapshot.isDragging),
|
|
4269
3627
|
"data-dragging": snapshot.isDragging,
|
|
4270
3628
|
children: [
|
|
4271
|
-
/* @__PURE__ */
|
|
3629
|
+
/* @__PURE__ */ jsx33(TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ jsx33(
|
|
4272
3630
|
"button",
|
|
4273
3631
|
{
|
|
4274
3632
|
css: variableName,
|
|
@@ -4281,21 +3639,21 @@ function VariablesList() {
|
|
|
4281
3639
|
children: text
|
|
4282
3640
|
}
|
|
4283
3641
|
) }),
|
|
4284
|
-
/* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsx33(TableCellData, { children: /* @__PURE__ */ jsx33("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
|
|
3643
|
+
/* @__PURE__ */ jsx33(TableCellData, { align: "right", children: /* @__PURE__ */ jsx33(
|
|
4286
3644
|
"button",
|
|
4287
3645
|
{
|
|
4288
3646
|
type: "button",
|
|
4289
3647
|
title: `delete ${text}`,
|
|
4290
3648
|
css: [
|
|
4291
3649
|
button,
|
|
4292
|
-
|
|
3650
|
+
css23`
|
|
4293
3651
|
background: transparent;
|
|
4294
3652
|
`
|
|
4295
3653
|
],
|
|
4296
3654
|
"aria-controls": text,
|
|
4297
3655
|
onClick: () => dispatch({ type: "remove", variable: name }),
|
|
4298
|
-
children: /* @__PURE__ */
|
|
3656
|
+
children: /* @__PURE__ */ jsx33(Icon5, { icon: "trash", iconColor: "red" })
|
|
4299
3657
|
}
|
|
4300
3658
|
) })
|
|
4301
3659
|
]
|
|
@@ -4308,7 +3666,7 @@ function VariablesList() {
|
|
|
4308
3666
|
provided.placeholder
|
|
4309
3667
|
] })
|
|
4310
3668
|
] }) }) }),
|
|
4311
|
-
/* @__PURE__ */
|
|
3669
|
+
/* @__PURE__ */ jsx33(
|
|
4312
3670
|
AddListButton,
|
|
4313
3671
|
{
|
|
4314
3672
|
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
@@ -4322,36 +3680,49 @@ function VariablesList() {
|
|
|
4322
3680
|
}
|
|
4323
3681
|
|
|
4324
3682
|
// src/components/DataResourceDynamicInputProvider.tsx
|
|
4325
|
-
import { Fragment as
|
|
3683
|
+
import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
|
|
4326
3684
|
function DataResourceDynamicInputProvider({
|
|
4327
3685
|
children,
|
|
4328
3686
|
dynamicInputs
|
|
4329
3687
|
}) {
|
|
4330
3688
|
if (dynamicInputs) {
|
|
4331
|
-
return /* @__PURE__ */
|
|
3689
|
+
return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderRenderer, { dynamicInputs, children });
|
|
4332
3690
|
}
|
|
4333
|
-
return /* @__PURE__ */
|
|
3691
|
+
return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderContextShim, { children });
|
|
4334
3692
|
}
|
|
4335
3693
|
function DataResourceDynamicInputProviderContextShim(props) {
|
|
4336
3694
|
const {
|
|
4337
3695
|
metadata: { dynamicInputs }
|
|
4338
3696
|
} = useMeshLocation("dataResource");
|
|
4339
|
-
return /* @__PURE__ */
|
|
3697
|
+
return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
|
|
4340
3698
|
}
|
|
4341
3699
|
function DataResourceDynamicInputProviderRenderer({
|
|
4342
3700
|
children,
|
|
4343
3701
|
dynamicInputs
|
|
4344
3702
|
}) {
|
|
4345
|
-
return /* @__PURE__ */
|
|
3703
|
+
return /* @__PURE__ */ jsx34(
|
|
3704
|
+
VariablesProvider,
|
|
3705
|
+
{
|
|
3706
|
+
value: convertDynamicInputsToVariables(dynamicInputs),
|
|
3707
|
+
onChange: () => {
|
|
3708
|
+
throw new Error("Cannot change dynamic inputs. Make sure that add variable is disabled.");
|
|
3709
|
+
},
|
|
3710
|
+
editVariableComponent: () => /* @__PURE__ */ jsx34("span", { children: "Cannot edit dynamic inputs." }),
|
|
3711
|
+
children
|
|
3712
|
+
}
|
|
3713
|
+
);
|
|
4346
3714
|
}
|
|
4347
3715
|
function convertDynamicInputsToVariables(dynamicInputs) {
|
|
4348
3716
|
return Object.entries(dynamicInputs).reduce(
|
|
4349
|
-
(acc, [name,
|
|
3717
|
+
(acc, [name, input]) => {
|
|
4350
3718
|
acc[name] = {
|
|
4351
|
-
type:
|
|
4352
|
-
default:
|
|
4353
|
-
|
|
4354
|
-
|
|
3719
|
+
type: input.type,
|
|
3720
|
+
default: input.value,
|
|
3721
|
+
helpText: /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
3722
|
+
input.value || /* @__PURE__ */ jsx34("em", { children: "not provided" }),
|
|
3723
|
+
", from ",
|
|
3724
|
+
input.type === "path" ? "URL path" : "query string"
|
|
3725
|
+
] })
|
|
4355
3726
|
// type abuse! 💚
|
|
4356
3727
|
};
|
|
4357
3728
|
return acc;
|
|
@@ -4363,13 +3734,13 @@ function convertDynamicInputsToVariables(dynamicInputs) {
|
|
|
4363
3734
|
// src/components/DataResourceVariablesList.tsx
|
|
4364
3735
|
init_emotion_jsx_shim();
|
|
4365
3736
|
import { Callout as Callout4 } from "@uniformdev/design-system";
|
|
4366
|
-
import { jsx as
|
|
3737
|
+
import { jsx as jsx35 } from "@emotion/react/jsx-runtime";
|
|
4367
3738
|
function DataResourceVariablesList(props) {
|
|
4368
3739
|
const {
|
|
4369
3740
|
value,
|
|
4370
3741
|
metadata: { dataType, dynamicInputs }
|
|
4371
3742
|
} = useMeshLocation("dataResource");
|
|
4372
|
-
return /* @__PURE__ */
|
|
3743
|
+
return /* @__PURE__ */ jsx35(
|
|
4373
3744
|
DataResourceVariablesListExplicit,
|
|
4374
3745
|
{
|
|
4375
3746
|
...props,
|
|
@@ -4390,14 +3761,14 @@ function DataResourceVariablesListExplicit({
|
|
|
4390
3761
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
4391
3762
|
if (variableDefinitions.length === 0) {
|
|
4392
3763
|
if (NoVariablesComponent) {
|
|
4393
|
-
return /* @__PURE__ */
|
|
3764
|
+
return /* @__PURE__ */ jsx35(NoVariablesComponent, {});
|
|
4394
3765
|
}
|
|
4395
|
-
return /* @__PURE__ */
|
|
3766
|
+
return /* @__PURE__ */ jsx35(Callout4, { type: "note", children: "No settings are required." });
|
|
4396
3767
|
}
|
|
4397
|
-
return /* @__PURE__ */
|
|
3768
|
+
return /* @__PURE__ */ jsx35(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx35("div", { children: variableDefinitions.map((variableDefinition) => {
|
|
4398
3769
|
var _a, _b, _c;
|
|
4399
3770
|
const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
|
|
4400
|
-
return /* @__PURE__ */
|
|
3771
|
+
return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
|
|
4401
3772
|
VariableRenderer,
|
|
4402
3773
|
{
|
|
4403
3774
|
definition: variableDefinition,
|
|
@@ -4420,7 +3791,7 @@ function DataResourceVariablesListExplicit({
|
|
|
4420
3791
|
}
|
|
4421
3792
|
function TextVariableRenderer({ definition, value, setValue }) {
|
|
4422
3793
|
var _a;
|
|
4423
|
-
return /* @__PURE__ */
|
|
3794
|
+
return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
|
|
4424
3795
|
InputVariables,
|
|
4425
3796
|
{
|
|
4426
3797
|
label: definition.displayName || definition.name,
|
|
@@ -4436,14 +3807,14 @@ init_emotion_jsx_shim();
|
|
|
4436
3807
|
|
|
4437
3808
|
// src/components/Request/RequestBody.tsx
|
|
4438
3809
|
init_emotion_jsx_shim();
|
|
4439
|
-
import { css as
|
|
3810
|
+
import { css as css25 } from "@emotion/react";
|
|
4440
3811
|
import { InputSelect as InputSelect4, JsonEditor } from "@uniformdev/design-system";
|
|
4441
|
-
import { useState as
|
|
3812
|
+
import { useState as useState10 } from "react";
|
|
4442
3813
|
|
|
4443
3814
|
// src/components/Request/RequestProvider.tsx
|
|
4444
3815
|
init_emotion_jsx_shim();
|
|
4445
3816
|
import * as React12 from "react";
|
|
4446
|
-
import { jsx as
|
|
3817
|
+
import { jsx as jsx36 } from "@emotion/react/jsx-runtime";
|
|
4447
3818
|
var RequestContext = React12.createContext(null);
|
|
4448
3819
|
function RequestProvider({ value, onChange, children }) {
|
|
4449
3820
|
const contextValue = React12.useMemo(() => {
|
|
@@ -4512,7 +3883,7 @@ function RequestProvider({ value, onChange, children }) {
|
|
|
4512
3883
|
request: value
|
|
4513
3884
|
};
|
|
4514
3885
|
}, [onChange, value]);
|
|
4515
|
-
return /* @__PURE__ */
|
|
3886
|
+
return /* @__PURE__ */ jsx36(RequestContext.Provider, { value: contextValue, children });
|
|
4516
3887
|
}
|
|
4517
3888
|
function useRequest() {
|
|
4518
3889
|
const context = React12.useContext(RequestContext);
|
|
@@ -4527,11 +3898,11 @@ init_emotion_jsx_shim();
|
|
|
4527
3898
|
|
|
4528
3899
|
// src/components/Request/styles/Request.styles.ts
|
|
4529
3900
|
init_emotion_jsx_shim();
|
|
4530
|
-
import { css as
|
|
4531
|
-
var innerContentStyles =
|
|
3901
|
+
import { css as css24 } from "@emotion/react";
|
|
3902
|
+
var innerContentStyles = css24`
|
|
4532
3903
|
background: var(--white);
|
|
4533
3904
|
`;
|
|
4534
|
-
var requestTypeContainer = (bgColor) =>
|
|
3905
|
+
var requestTypeContainer = (bgColor) => css24`
|
|
4535
3906
|
align-items: start;
|
|
4536
3907
|
background: ${bgColor};
|
|
4537
3908
|
display: grid;
|
|
@@ -4540,17 +3911,17 @@ var requestTypeContainer = (bgColor) => css25`
|
|
|
4540
3911
|
`;
|
|
4541
3912
|
|
|
4542
3913
|
// src/components/Request/RequestTypeContainer.tsx
|
|
4543
|
-
import { jsx as
|
|
3914
|
+
import { jsx as jsx37 } from "@emotion/react/jsx-runtime";
|
|
4544
3915
|
var RequestTypeContainer = ({
|
|
4545
3916
|
bgColor = "transparent",
|
|
4546
3917
|
children,
|
|
4547
3918
|
...props
|
|
4548
3919
|
}) => {
|
|
4549
|
-
return /* @__PURE__ */
|
|
3920
|
+
return /* @__PURE__ */ jsx37("div", { css: requestTypeContainer(bgColor), ...props, children });
|
|
4550
3921
|
};
|
|
4551
3922
|
|
|
4552
3923
|
// src/components/Request/RequestBody.tsx
|
|
4553
|
-
import { jsx as
|
|
3924
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "@emotion/react/jsx-runtime";
|
|
4554
3925
|
var LANGUAGE_OPTIONS = [
|
|
4555
3926
|
{ label: "Text", value: "plaintext" },
|
|
4556
3927
|
{ label: "JSON", value: "json" },
|
|
@@ -4569,22 +3940,22 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
4569
3940
|
};
|
|
4570
3941
|
function RequestBody() {
|
|
4571
3942
|
const { request, dispatch } = useRequest();
|
|
4572
|
-
const [language, setLanguage] =
|
|
4573
|
-
return /* @__PURE__ */
|
|
3943
|
+
const [language, setLanguage] = useState10("json");
|
|
3944
|
+
return /* @__PURE__ */ jsxs23(
|
|
4574
3945
|
"div",
|
|
4575
3946
|
{
|
|
4576
|
-
css:
|
|
3947
|
+
css: css25`
|
|
4577
3948
|
background: var(--white);
|
|
4578
3949
|
`,
|
|
4579
3950
|
children: [
|
|
4580
|
-
/* @__PURE__ */
|
|
3951
|
+
/* @__PURE__ */ jsx38(
|
|
4581
3952
|
RequestTypeContainer,
|
|
4582
3953
|
{
|
|
4583
3954
|
bgColor: "var(--gray-100)",
|
|
4584
|
-
css:
|
|
3955
|
+
css: css25`
|
|
4585
3956
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
4586
3957
|
`,
|
|
4587
|
-
children: /* @__PURE__ */
|
|
3958
|
+
children: /* @__PURE__ */ jsx38(
|
|
4588
3959
|
InputSelect4,
|
|
4589
3960
|
{
|
|
4590
3961
|
label: "Language",
|
|
@@ -4607,7 +3978,7 @@ function RequestBody() {
|
|
|
4607
3978
|
)
|
|
4608
3979
|
}
|
|
4609
3980
|
),
|
|
4610
|
-
/* @__PURE__ */
|
|
3981
|
+
/* @__PURE__ */ jsx38(
|
|
4611
3982
|
JsonEditor,
|
|
4612
3983
|
{
|
|
4613
3984
|
height: 200,
|
|
@@ -4627,7 +3998,7 @@ function RequestBody() {
|
|
|
4627
3998
|
// src/components/Request/RequestHeaders.tsx
|
|
4628
3999
|
init_emotion_jsx_shim();
|
|
4629
4000
|
import {
|
|
4630
|
-
Input as
|
|
4001
|
+
Input as Input4,
|
|
4631
4002
|
Table as Table2,
|
|
4632
4003
|
TableBody as TableBody2,
|
|
4633
4004
|
TableCellData as TableCellData2,
|
|
@@ -4636,7 +4007,7 @@ import {
|
|
|
4636
4007
|
TableRow as TableRow2,
|
|
4637
4008
|
WarningMessage as WarningMessage2
|
|
4638
4009
|
} from "@uniformdev/design-system";
|
|
4639
|
-
import { jsx as
|
|
4010
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
|
|
4640
4011
|
function RequestHeaders({ disableVariables }) {
|
|
4641
4012
|
var _a, _b;
|
|
4642
4013
|
const { dispatch, request } = useRequest();
|
|
@@ -4652,29 +4023,29 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4652
4023
|
index
|
|
4653
4024
|
});
|
|
4654
4025
|
};
|
|
4655
|
-
return /* @__PURE__ */
|
|
4656
|
-
/* @__PURE__ */
|
|
4657
|
-
/* @__PURE__ */
|
|
4658
|
-
/* @__PURE__ */
|
|
4026
|
+
return /* @__PURE__ */ jsx39("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs24(Table2, { children: [
|
|
4027
|
+
/* @__PURE__ */ jsx39(TableHead2, { children: /* @__PURE__ */ jsxs24(TableRow2, { children: [
|
|
4028
|
+
/* @__PURE__ */ jsx39(TableCellHead2, { children: "Name" }),
|
|
4029
|
+
/* @__PURE__ */ jsx39(TableCellHead2, { children: "Value" })
|
|
4659
4030
|
] }) }),
|
|
4660
|
-
/* @__PURE__ */
|
|
4031
|
+
/* @__PURE__ */ jsxs24(TableBody2, { children: [
|
|
4661
4032
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
|
|
4662
|
-
return /* @__PURE__ */
|
|
4663
|
-
/* @__PURE__ */
|
|
4033
|
+
return /* @__PURE__ */ jsxs24(TableRow2, { children: [
|
|
4034
|
+
/* @__PURE__ */ jsxs24(TableCellData2, { width: "50%", children: [
|
|
4664
4035
|
baseHeader.key,
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4036
|
+
/* @__PURE__ */ jsx39("br", {}),
|
|
4037
|
+
/* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx39("small", { children: "from data source" }) })
|
|
4667
4038
|
] }),
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
/* @__PURE__ */
|
|
4670
|
-
request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */
|
|
4039
|
+
/* @__PURE__ */ jsxs24(TableCellData2, { width: "50%", children: [
|
|
4040
|
+
/* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
|
|
4041
|
+
request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ jsx39(WarningMessage2, { message: "overridden below" }) : null
|
|
4671
4042
|
] })
|
|
4672
4043
|
] }, baseHeader.key);
|
|
4673
4044
|
}),
|
|
4674
4045
|
deezHeaders.map((header, index) => {
|
|
4675
|
-
return /* @__PURE__ */
|
|
4676
|
-
/* @__PURE__ */
|
|
4677
|
-
|
|
4046
|
+
return /* @__PURE__ */ jsxs24(TableRow2, { children: [
|
|
4047
|
+
/* @__PURE__ */ jsx39(TableCellData2, { width: "50%", children: /* @__PURE__ */ jsx39(
|
|
4048
|
+
Input4,
|
|
4678
4049
|
{
|
|
4679
4050
|
label: header.key,
|
|
4680
4051
|
value: header.key,
|
|
@@ -4693,15 +4064,13 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4693
4064
|
"data-test-id": "header-key"
|
|
4694
4065
|
}
|
|
4695
4066
|
) }),
|
|
4696
|
-
/* @__PURE__ */
|
|
4067
|
+
/* @__PURE__ */ jsx39(TableCellData2, { width: "50%", children: header.key ? /* @__PURE__ */ jsx39(
|
|
4697
4068
|
InputVariables,
|
|
4698
4069
|
{
|
|
4699
4070
|
value: header.value,
|
|
4700
4071
|
onChange: (value) => handleUpdateParamFromMenu({ key: header.key, value, index }),
|
|
4701
4072
|
disableVariables,
|
|
4702
4073
|
showAddVariableMenuOption: true,
|
|
4703
|
-
enableEditingVariables: true,
|
|
4704
|
-
disableReset: true,
|
|
4705
4074
|
"data-test-id": "header-value"
|
|
4706
4075
|
}
|
|
4707
4076
|
) : null })
|
|
@@ -4714,11 +4083,11 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4714
4083
|
// src/components/Request/RequestMethodSelect.tsx
|
|
4715
4084
|
init_emotion_jsx_shim();
|
|
4716
4085
|
import { InputSelect as InputSelect5 } from "@uniformdev/design-system";
|
|
4717
|
-
import { jsx as
|
|
4086
|
+
import { jsx as jsx40 } from "@emotion/react/jsx-runtime";
|
|
4718
4087
|
function RequestMethodSelect(props) {
|
|
4719
4088
|
var _a;
|
|
4720
4089
|
const { request, dispatch } = useRequest();
|
|
4721
|
-
return /* @__PURE__ */
|
|
4090
|
+
return /* @__PURE__ */ jsx40(
|
|
4722
4091
|
InputSelect5,
|
|
4723
4092
|
{
|
|
4724
4093
|
...props,
|
|
@@ -4736,7 +4105,7 @@ function RequestMethodSelect(props) {
|
|
|
4736
4105
|
// src/components/Request/RequestParameters.tsx
|
|
4737
4106
|
init_emotion_jsx_shim();
|
|
4738
4107
|
import {
|
|
4739
|
-
Input as
|
|
4108
|
+
Input as Input5,
|
|
4740
4109
|
Table as Table3,
|
|
4741
4110
|
TableBody as TableBody3,
|
|
4742
4111
|
TableCellData as TableCellData3,
|
|
@@ -4745,7 +4114,7 @@ import {
|
|
|
4745
4114
|
TableRow as TableRow3,
|
|
4746
4115
|
WarningMessage as WarningMessage3
|
|
4747
4116
|
} from "@uniformdev/design-system";
|
|
4748
|
-
import { jsx as
|
|
4117
|
+
import { jsx as jsx41, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
|
|
4749
4118
|
function RequestParameters({ disableVariables }) {
|
|
4750
4119
|
var _a, _b;
|
|
4751
4120
|
const { dispatch, request } = useRequest();
|
|
@@ -4761,29 +4130,29 @@ function RequestParameters({ disableVariables }) {
|
|
|
4761
4130
|
index
|
|
4762
4131
|
});
|
|
4763
4132
|
};
|
|
4764
|
-
return /* @__PURE__ */
|
|
4765
|
-
/* @__PURE__ */
|
|
4766
|
-
/* @__PURE__ */
|
|
4767
|
-
/* @__PURE__ */
|
|
4133
|
+
return /* @__PURE__ */ jsx41("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs25(Table3, { children: [
|
|
4134
|
+
/* @__PURE__ */ jsx41(TableHead3, { children: /* @__PURE__ */ jsxs25(TableRow3, { children: [
|
|
4135
|
+
/* @__PURE__ */ jsx41(TableCellHead3, { children: "Name" }),
|
|
4136
|
+
/* @__PURE__ */ jsx41(TableCellHead3, { children: "Value" })
|
|
4768
4137
|
] }) }),
|
|
4769
|
-
/* @__PURE__ */
|
|
4138
|
+
/* @__PURE__ */ jsxs25(TableBody3, { children: [
|
|
4770
4139
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
|
|
4771
|
-
return /* @__PURE__ */
|
|
4772
|
-
/* @__PURE__ */
|
|
4140
|
+
return /* @__PURE__ */ jsxs25(TableRow3, { children: [
|
|
4141
|
+
/* @__PURE__ */ jsxs25(TableCellData3, { width: "50%", children: [
|
|
4773
4142
|
baseParameter.key,
|
|
4774
|
-
/* @__PURE__ */
|
|
4775
|
-
/* @__PURE__ */
|
|
4143
|
+
/* @__PURE__ */ jsx41("br", {}),
|
|
4144
|
+
/* @__PURE__ */ jsx41("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx41("small", { children: "from data source" }) })
|
|
4776
4145
|
] }),
|
|
4777
|
-
/* @__PURE__ */
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */
|
|
4146
|
+
/* @__PURE__ */ jsxs25(TableCellData3, { width: "50%", children: [
|
|
4147
|
+
/* @__PURE__ */ jsx41("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
|
|
4148
|
+
request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ jsx41(WarningMessage3, { message: "overridden below" }) : null
|
|
4780
4149
|
] })
|
|
4781
4150
|
] }, baseParameter.key);
|
|
4782
4151
|
}),
|
|
4783
4152
|
deezParameters.map((parameter, index) => {
|
|
4784
|
-
return /* @__PURE__ */
|
|
4785
|
-
/* @__PURE__ */
|
|
4786
|
-
|
|
4153
|
+
return /* @__PURE__ */ jsxs25(TableRow3, { children: [
|
|
4154
|
+
/* @__PURE__ */ jsx41(TableCellData3, { width: "50%", children: /* @__PURE__ */ jsx41(
|
|
4155
|
+
Input5,
|
|
4787
4156
|
{
|
|
4788
4157
|
label: parameter.key,
|
|
4789
4158
|
value: parameter.key,
|
|
@@ -4802,7 +4171,7 @@ function RequestParameters({ disableVariables }) {
|
|
|
4802
4171
|
"data-test-id": "parameter-key"
|
|
4803
4172
|
}
|
|
4804
4173
|
) }),
|
|
4805
|
-
/* @__PURE__ */
|
|
4174
|
+
/* @__PURE__ */ jsx41(TableCellData3, { width: "50%", children: parameter.key ? /* @__PURE__ */ jsx41(
|
|
4806
4175
|
InputVariables,
|
|
4807
4176
|
{
|
|
4808
4177
|
value: parameter.value,
|
|
@@ -4813,9 +4182,7 @@ function RequestParameters({ disableVariables }) {
|
|
|
4813
4182
|
}),
|
|
4814
4183
|
disableVariables,
|
|
4815
4184
|
"data-test-id": "parameter-value",
|
|
4816
|
-
showAddVariableMenuOption: true
|
|
4817
|
-
enableEditingVariables: true,
|
|
4818
|
-
disableReset: true
|
|
4185
|
+
showAddVariableMenuOption: true
|
|
4819
4186
|
}
|
|
4820
4187
|
) : null })
|
|
4821
4188
|
] }, index);
|
|
@@ -4826,8 +4193,8 @@ function RequestParameters({ disableVariables }) {
|
|
|
4826
4193
|
|
|
4827
4194
|
// src/components/Request/RequestUrl.tsx
|
|
4828
4195
|
init_emotion_jsx_shim();
|
|
4829
|
-
import { css as
|
|
4830
|
-
import { useMemo as
|
|
4196
|
+
import { css as css26 } from "@emotion/react";
|
|
4197
|
+
import { useMemo as useMemo7 } from "react";
|
|
4831
4198
|
|
|
4832
4199
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
4833
4200
|
init_emotion_jsx_shim();
|
|
@@ -4849,35 +4216,35 @@ function decodeVariablesInUrlEncodedString(string, varValues) {
|
|
|
4849
4216
|
}
|
|
4850
4217
|
|
|
4851
4218
|
// src/components/Request/RequestUrl.tsx
|
|
4852
|
-
import { Fragment as
|
|
4219
|
+
import { Fragment as Fragment8, jsx as jsx42, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
|
|
4853
4220
|
function RequestUrl() {
|
|
4854
4221
|
var _a, _b;
|
|
4855
4222
|
const { variables } = useVariables();
|
|
4856
4223
|
const { request } = useRequest();
|
|
4857
|
-
const mergedParameters =
|
|
4224
|
+
const mergedParameters = useMemo7(() => {
|
|
4858
4225
|
var _a2;
|
|
4859
4226
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
4860
4227
|
return request.parameters;
|
|
4861
4228
|
}
|
|
4862
4229
|
return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p2) => p2.key === baseParam.key)).concat(request.parameters);
|
|
4863
4230
|
}, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
|
|
4864
|
-
return /* @__PURE__ */
|
|
4231
|
+
return /* @__PURE__ */ jsxs26(
|
|
4865
4232
|
"small",
|
|
4866
4233
|
{
|
|
4867
|
-
css:
|
|
4234
|
+
css: css26`
|
|
4868
4235
|
display: inline-block;
|
|
4869
4236
|
margin-bottom: var(--spacing-xs);
|
|
4870
4237
|
word-break: break-word;
|
|
4871
4238
|
`,
|
|
4872
4239
|
children: [
|
|
4873
|
-
request.baseRequest ? /* @__PURE__ */
|
|
4874
|
-
/* @__PURE__ */
|
|
4240
|
+
request.baseRequest ? /* @__PURE__ */ jsx42("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
|
|
4241
|
+
/* @__PURE__ */ jsxs26("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
|
|
4875
4242
|
urlEncodeRequestUrl(request.relativeUrl, variables),
|
|
4876
|
-
mergedParameters.length > 0 ? /* @__PURE__ */
|
|
4243
|
+
mergedParameters.length > 0 ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
4877
4244
|
"?",
|
|
4878
4245
|
mergedParameters.map((param, index) => {
|
|
4879
4246
|
const encoded = urlEncodeRequestParameter(param, variables);
|
|
4880
|
-
return /* @__PURE__ */
|
|
4247
|
+
return /* @__PURE__ */ jsxs26("span", { children: [
|
|
4881
4248
|
index > 0 ? "&" : null,
|
|
4882
4249
|
encoded.key,
|
|
4883
4250
|
"=",
|
|
@@ -4894,9 +4261,9 @@ function RequestUrl() {
|
|
|
4894
4261
|
// src/components/Request/RequestUrlInput.tsx
|
|
4895
4262
|
init_emotion_jsx_shim();
|
|
4896
4263
|
|
|
4897
|
-
// src/components/Request/util/
|
|
4264
|
+
// src/components/Request/util/handlePastedUrl.ts
|
|
4898
4265
|
init_emotion_jsx_shim();
|
|
4899
|
-
function
|
|
4266
|
+
function handlePastedUrl(value, currentRequest, dispatch) {
|
|
4900
4267
|
var _a, _b, _c;
|
|
4901
4268
|
const indexOfQueryString = value.indexOf("?");
|
|
4902
4269
|
const hasQueryString = indexOfQueryString >= 0;
|
|
@@ -4904,6 +4271,7 @@ function transformPastedUrl(value, currentRequest, dispatch) {
|
|
|
4904
4271
|
if (((_a = currentRequest.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = currentRequest.baseRequest) == null ? void 0 : _b.baseUrl)) {
|
|
4905
4272
|
relativeUrl = relativeUrl.substring((_c = currentRequest.baseRequest) == null ? void 0 : _c.baseUrl.length);
|
|
4906
4273
|
}
|
|
4274
|
+
dispatch({ type: "setRelativeUrl", relativeUrl });
|
|
4907
4275
|
if (hasQueryString) {
|
|
4908
4276
|
for (let index = currentRequest.parameters.length - 1; index >= 0; index--) {
|
|
4909
4277
|
dispatch({ type: "removeParameter", index });
|
|
@@ -4916,25 +4284,25 @@ function transformPastedUrl(value, currentRequest, dispatch) {
|
|
|
4916
4284
|
} catch (e) {
|
|
4917
4285
|
}
|
|
4918
4286
|
}
|
|
4919
|
-
return relativeUrl;
|
|
4920
4287
|
}
|
|
4921
4288
|
|
|
4922
4289
|
// src/components/Request/RequestUrlInput.tsx
|
|
4923
|
-
import { jsx as
|
|
4290
|
+
import { jsx as jsx43 } from "@emotion/react/jsx-runtime";
|
|
4924
4291
|
function RequestUrlInput(props) {
|
|
4925
4292
|
const { request, dispatch } = useRequest();
|
|
4926
|
-
return /* @__PURE__ */
|
|
4293
|
+
return /* @__PURE__ */ jsx43(
|
|
4927
4294
|
InputVariables,
|
|
4928
4295
|
{
|
|
4929
4296
|
disableReset: true,
|
|
4930
4297
|
...props,
|
|
4931
4298
|
value: request.relativeUrl,
|
|
4932
|
-
|
|
4299
|
+
onPaste: (value) => {
|
|
4300
|
+
handlePastedUrl(value, request, dispatch);
|
|
4301
|
+
},
|
|
4933
4302
|
onChange: (value) => {
|
|
4934
4303
|
dispatch({ type: "setRelativeUrl", relativeUrl: value });
|
|
4935
4304
|
},
|
|
4936
4305
|
showAddVariableMenuOption: true,
|
|
4937
|
-
enableEditingVariables: true,
|
|
4938
4306
|
"data-test-id": "field-url"
|
|
4939
4307
|
}
|
|
4940
4308
|
);
|
|
@@ -4977,19 +4345,18 @@ function useRequestParameter(paramName) {
|
|
|
4977
4345
|
}
|
|
4978
4346
|
|
|
4979
4347
|
// src/components/DataSourceEditor.tsx
|
|
4980
|
-
import { jsx as
|
|
4348
|
+
import { jsx as jsx44 } from "@emotion/react/jsx-runtime";
|
|
4981
4349
|
function DataSourceEditor({ onChange, children, editVariableComponent }) {
|
|
4982
4350
|
var _a;
|
|
4983
4351
|
const { value } = useMeshLocation("dataSource");
|
|
4984
4352
|
const currentRequestValue = convertDataSourceToRequestData(value);
|
|
4985
|
-
return /* @__PURE__ */
|
|
4353
|
+
return /* @__PURE__ */ jsx44(
|
|
4986
4354
|
VariablesProvider,
|
|
4987
4355
|
{
|
|
4988
4356
|
value: (_a = value.variables) != null ? _a : {},
|
|
4989
4357
|
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
4990
4358
|
editVariableComponent,
|
|
4991
|
-
|
|
4992
|
-
children: /* @__PURE__ */ jsx48(
|
|
4359
|
+
children: /* @__PURE__ */ jsx44(
|
|
4993
4360
|
RequestProvider,
|
|
4994
4361
|
{
|
|
4995
4362
|
value: currentRequestValue,
|
|
@@ -5027,23 +4394,21 @@ function convertRequestDataToDataSource(dataSource, requestData) {
|
|
|
5027
4394
|
|
|
5028
4395
|
// src/components/DataTypeEditor.tsx
|
|
5029
4396
|
init_emotion_jsx_shim();
|
|
5030
|
-
import { jsx as
|
|
4397
|
+
import { jsx as jsx45 } from "@emotion/react/jsx-runtime";
|
|
5031
4398
|
function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
5032
4399
|
var _a;
|
|
5033
4400
|
const {
|
|
5034
4401
|
value,
|
|
5035
|
-
metadata: { dataSource }
|
|
5036
|
-
isReadOnly
|
|
4402
|
+
metadata: { dataSource }
|
|
5037
4403
|
} = useMeshLocation("dataType");
|
|
5038
4404
|
const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
|
|
5039
|
-
return /* @__PURE__ */
|
|
4405
|
+
return /* @__PURE__ */ jsx45(
|
|
5040
4406
|
VariablesProvider,
|
|
5041
4407
|
{
|
|
5042
4408
|
value: (_a = value.variables) != null ? _a : {},
|
|
5043
4409
|
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
5044
4410
|
editVariableComponent,
|
|
5045
|
-
|
|
5046
|
-
children: /* @__PURE__ */ jsx49(
|
|
4411
|
+
children: /* @__PURE__ */ jsx45(
|
|
5047
4412
|
RequestProvider,
|
|
5048
4413
|
{
|
|
5049
4414
|
value: currentRequestValue,
|
|
@@ -5095,12 +4460,12 @@ import { LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniform
|
|
|
5095
4460
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
5096
4461
|
init_emotion_jsx_shim();
|
|
5097
4462
|
import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
|
|
5098
|
-
import { useEffect as
|
|
4463
|
+
import { useEffect as useEffect8, useRef as useRef10, useState as useState11 } from "react";
|
|
5099
4464
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
5100
|
-
const [error, setError] =
|
|
5101
|
-
const [sdk, setSdk] =
|
|
4465
|
+
const [error, setError] = useState11();
|
|
4466
|
+
const [sdk, setSdk] = useState11();
|
|
5102
4467
|
const initializationInProgress = useRef10(false);
|
|
5103
|
-
|
|
4468
|
+
useEffect8(
|
|
5104
4469
|
() => {
|
|
5105
4470
|
if (typeof window === "undefined" || sdk) {
|
|
5106
4471
|
return;
|
|
@@ -5133,7 +4498,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
5133
4498
|
};
|
|
5134
4499
|
|
|
5135
4500
|
// src/components/MeshApp.tsx
|
|
5136
|
-
import { jsx as
|
|
4501
|
+
import { jsx as jsx46, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
|
|
5137
4502
|
var MeshApp = ({
|
|
5138
4503
|
children,
|
|
5139
4504
|
loadingComponent,
|
|
@@ -5142,37 +4507,37 @@ var MeshApp = ({
|
|
|
5142
4507
|
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
5143
4508
|
if (initializing || !sdk) {
|
|
5144
4509
|
const LoadingComponent = loadingComponent;
|
|
5145
|
-
return LoadingComponent ? /* @__PURE__ */
|
|
4510
|
+
return LoadingComponent ? /* @__PURE__ */ jsx46(LoadingComponent, {}) : /* @__PURE__ */ jsx46(LoadingIndicator2, {});
|
|
5146
4511
|
}
|
|
5147
4512
|
if (error) {
|
|
5148
4513
|
const ErrorComponent = errorComponent;
|
|
5149
4514
|
if (ErrorComponent) {
|
|
5150
|
-
return /* @__PURE__ */
|
|
4515
|
+
return /* @__PURE__ */ jsx46(ErrorComponent, { error });
|
|
5151
4516
|
}
|
|
5152
4517
|
throw error;
|
|
5153
4518
|
}
|
|
5154
|
-
return /* @__PURE__ */
|
|
5155
|
-
/* @__PURE__ */
|
|
5156
|
-
/* @__PURE__ */
|
|
4519
|
+
return /* @__PURE__ */ jsxs27(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
|
|
4520
|
+
/* @__PURE__ */ jsx46(Theme2, {}),
|
|
4521
|
+
/* @__PURE__ */ jsx46(UniformMeshLocationContextProvider, { children })
|
|
5157
4522
|
] });
|
|
5158
4523
|
};
|
|
5159
4524
|
|
|
5160
4525
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
5161
4526
|
init_emotion_jsx_shim();
|
|
5162
|
-
import { css as
|
|
4527
|
+
import { css as css27 } from "@emotion/react";
|
|
5163
4528
|
import { Button as Button3, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
|
|
5164
|
-
import { jsx as
|
|
4529
|
+
import { jsx as jsx47, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
|
|
5165
4530
|
var DataRefreshButton = ({
|
|
5166
4531
|
buttonText,
|
|
5167
4532
|
isLoading,
|
|
5168
4533
|
onRefreshData,
|
|
5169
4534
|
...props
|
|
5170
4535
|
}) => {
|
|
5171
|
-
return /* @__PURE__ */
|
|
5172
|
-
!isLoading ? null : /* @__PURE__ */
|
|
4536
|
+
return /* @__PURE__ */ jsxs28(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
4537
|
+
!isLoading ? null : /* @__PURE__ */ jsx47(
|
|
5173
4538
|
LoadingIndicator3,
|
|
5174
4539
|
{
|
|
5175
|
-
css:
|
|
4540
|
+
css: css27`
|
|
5176
4541
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
5177
4542
|
`
|
|
5178
4543
|
}
|
|
@@ -6350,13 +5715,13 @@ import { Container, IconsProvider, ScrollableList, VerticalRhythm } from "@unifo
|
|
|
6350
5715
|
init_emotion_jsx_shim();
|
|
6351
5716
|
import {
|
|
6352
5717
|
createContext as createContext5,
|
|
6353
|
-
useCallback
|
|
5718
|
+
useCallback,
|
|
6354
5719
|
useContext as useContext7,
|
|
6355
5720
|
useDeferredValue,
|
|
6356
|
-
useMemo as
|
|
6357
|
-
useState as
|
|
5721
|
+
useMemo as useMemo8,
|
|
5722
|
+
useState as useState12
|
|
6358
5723
|
} from "react";
|
|
6359
|
-
import { jsx as
|
|
5724
|
+
import { jsx as jsx48 } from "@emotion/react/jsx-runtime";
|
|
6360
5725
|
var ObjectSearchContext = createContext5({
|
|
6361
5726
|
onSetQuery: () => {
|
|
6362
5727
|
},
|
|
@@ -6372,15 +5737,15 @@ var ObjectSearchContext = createContext5({
|
|
|
6372
5737
|
}
|
|
6373
5738
|
});
|
|
6374
5739
|
var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
6375
|
-
const [query, setQuery] =
|
|
5740
|
+
const [query, setQuery] = useState12({
|
|
6376
5741
|
contentType: "",
|
|
6377
5742
|
keyword: ""
|
|
6378
5743
|
});
|
|
6379
5744
|
const { flatVariables } = useVariables(true);
|
|
6380
5745
|
const querySearchDeferred = useDeferredValue(query);
|
|
6381
|
-
const [selectedItems, setSelectedItems] =
|
|
6382
|
-
const [list, setList] =
|
|
6383
|
-
const onSetQuery =
|
|
5746
|
+
const [selectedItems, setSelectedItems] = useState12(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
5747
|
+
const [list, setList] = useState12({});
|
|
5748
|
+
const onSetQuery = useCallback(
|
|
6384
5749
|
(value2) => {
|
|
6385
5750
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
6386
5751
|
return setQuery({
|
|
@@ -6392,7 +5757,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6392
5757
|
},
|
|
6393
5758
|
[setQuery]
|
|
6394
5759
|
);
|
|
6395
|
-
const onSelectItem =
|
|
5760
|
+
const onSelectItem = useCallback(
|
|
6396
5761
|
(selectedResult) => {
|
|
6397
5762
|
if (Array.isArray(selectedResult)) {
|
|
6398
5763
|
setSelectedItems(selectedResult);
|
|
@@ -6406,17 +5771,17 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6406
5771
|
},
|
|
6407
5772
|
[setSelectedItems, selectedItems]
|
|
6408
5773
|
);
|
|
6409
|
-
const onRemoveAllSelectedItems =
|
|
5774
|
+
const onRemoveAllSelectedItems = useCallback(() => {
|
|
6410
5775
|
setSelectedItems([]);
|
|
6411
5776
|
}, [setSelectedItems]);
|
|
6412
|
-
const onSetList =
|
|
5777
|
+
const onSetList = useCallback(
|
|
6413
5778
|
(value2) => {
|
|
6414
5779
|
setList(value2);
|
|
6415
5780
|
},
|
|
6416
5781
|
[setList]
|
|
6417
5782
|
);
|
|
6418
|
-
const boundQuery =
|
|
6419
|
-
const value =
|
|
5783
|
+
const boundQuery = useMemo8(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
5784
|
+
const value = useMemo8(
|
|
6420
5785
|
() => ({
|
|
6421
5786
|
boundQuery,
|
|
6422
5787
|
onSetQuery,
|
|
@@ -6438,7 +5803,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6438
5803
|
onSetList
|
|
6439
5804
|
]
|
|
6440
5805
|
);
|
|
6441
|
-
return /* @__PURE__ */
|
|
5806
|
+
return /* @__PURE__ */ jsx48(ObjectSearchContext.Provider, { value, children });
|
|
6442
5807
|
};
|
|
6443
5808
|
function useObjectSearchContext() {
|
|
6444
5809
|
return useContext7(ObjectSearchContext);
|
|
@@ -6456,7 +5821,7 @@ function bindQuery(query, inputs) {
|
|
|
6456
5821
|
}
|
|
6457
5822
|
|
|
6458
5823
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6459
|
-
import { jsx as
|
|
5824
|
+
import { jsx as jsx49, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
|
|
6460
5825
|
var ObjectSearchContainer = ({
|
|
6461
5826
|
label,
|
|
6462
5827
|
enableDynamicInputToResultId,
|
|
@@ -6467,9 +5832,9 @@ var ObjectSearchContainer = ({
|
|
|
6467
5832
|
var _a, _b;
|
|
6468
5833
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6469
5834
|
const { flatVariables } = useVariables(true);
|
|
6470
|
-
const body = /* @__PURE__ */
|
|
5835
|
+
const body = /* @__PURE__ */ jsxs29(VerticalRhythm, { children: [
|
|
6471
5836
|
searchFilters,
|
|
6472
|
-
!resultList ? null : /* @__PURE__ */
|
|
5837
|
+
!resultList ? null : /* @__PURE__ */ jsx49(ScrollableList, { role: "list", children: resultList })
|
|
6473
5838
|
] });
|
|
6474
5839
|
const handleSelectedVariableChange = (selectedValue) => {
|
|
6475
5840
|
var _a2;
|
|
@@ -6498,8 +5863,8 @@ var ObjectSearchContainer = ({
|
|
|
6498
5863
|
}
|
|
6499
5864
|
]);
|
|
6500
5865
|
};
|
|
6501
|
-
return /* @__PURE__ */
|
|
6502
|
-
/* @__PURE__ */
|
|
5866
|
+
return /* @__PURE__ */ jsx49(IconsProvider, { children: /* @__PURE__ */ jsxs29(VerticalRhythm, { children: [
|
|
5867
|
+
/* @__PURE__ */ jsx49(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx49(
|
|
6503
5868
|
InputVariables,
|
|
6504
5869
|
{
|
|
6505
5870
|
label,
|
|
@@ -6516,12 +5881,12 @@ var ObjectSearchContainer = ({
|
|
|
6516
5881
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6517
5882
|
init_emotion_jsx_shim();
|
|
6518
5883
|
import { InputKeywordSearch as InputKeywordSearch2, InputSelect as InputSelect6 } from "@uniformdev/design-system";
|
|
6519
|
-
import { useState as
|
|
5884
|
+
import { useState as useState13 } from "react";
|
|
6520
5885
|
|
|
6521
5886
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6522
5887
|
init_emotion_jsx_shim();
|
|
6523
|
-
import { css as
|
|
6524
|
-
var ObjectSearchFilterContainerLabel =
|
|
5888
|
+
import { css as css28 } from "@emotion/react";
|
|
5889
|
+
var ObjectSearchFilterContainerLabel = css28`
|
|
6525
5890
|
align-items: center;
|
|
6526
5891
|
display: flex;
|
|
6527
5892
|
font-size: var(--fs-sm);
|
|
@@ -6529,21 +5894,21 @@ var ObjectSearchFilterContainerLabel = css29`
|
|
|
6529
5894
|
line-height: 1rem;
|
|
6530
5895
|
margin-bottom: var(--spacing-sm);
|
|
6531
5896
|
`;
|
|
6532
|
-
var ObjectSearchFilterContainer =
|
|
5897
|
+
var ObjectSearchFilterContainer = css28`
|
|
6533
5898
|
display: grid;
|
|
6534
5899
|
gap: var(--spacing-base);
|
|
6535
5900
|
`;
|
|
6536
|
-
var ObjectSearchFilterDropdownAndTextSearch =
|
|
5901
|
+
var ObjectSearchFilterDropdownAndTextSearch = css28`
|
|
6537
5902
|
grid-template-columns: 0.5fr 1fr;
|
|
6538
5903
|
`;
|
|
6539
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
5904
|
+
var ObjectSearchFilterGrid = (gridColumns) => css28`
|
|
6540
5905
|
display: grid;
|
|
6541
5906
|
grid-template-columns: ${gridColumns};
|
|
6542
5907
|
gap: var(--spacing-base);
|
|
6543
5908
|
`;
|
|
6544
5909
|
|
|
6545
5910
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6546
|
-
import { jsx as
|
|
5911
|
+
import { jsx as jsx50, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
|
|
6547
5912
|
var ObjectSearchFilter = ({
|
|
6548
5913
|
requireContentType,
|
|
6549
5914
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6553,7 +5918,7 @@ var ObjectSearchFilter = ({
|
|
|
6553
5918
|
selectOptions
|
|
6554
5919
|
}) => {
|
|
6555
5920
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6556
|
-
const [searchState, setSearchState] =
|
|
5921
|
+
const [searchState, setSearchState] = useState13({
|
|
6557
5922
|
contentType: "",
|
|
6558
5923
|
keyword: ""
|
|
6559
5924
|
});
|
|
@@ -6563,8 +5928,8 @@ var ObjectSearchFilter = ({
|
|
|
6563
5928
|
});
|
|
6564
5929
|
onSetQuery({ ...query, ...value });
|
|
6565
5930
|
};
|
|
6566
|
-
return /* @__PURE__ */
|
|
6567
|
-
/* @__PURE__ */
|
|
5931
|
+
return /* @__PURE__ */ jsxs30("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
|
|
5932
|
+
/* @__PURE__ */ jsx50(
|
|
6568
5933
|
InputSelect6,
|
|
6569
5934
|
{
|
|
6570
5935
|
label: selectLabel,
|
|
@@ -6580,7 +5945,7 @@ var ObjectSearchFilter = ({
|
|
|
6580
5945
|
value: query.contentType
|
|
6581
5946
|
}
|
|
6582
5947
|
),
|
|
6583
|
-
/* @__PURE__ */
|
|
5948
|
+
/* @__PURE__ */ jsx50(
|
|
6584
5949
|
InputKeywordSearch2,
|
|
6585
5950
|
{
|
|
6586
5951
|
inputFieldName: searchInputName,
|
|
@@ -6596,11 +5961,11 @@ var ObjectSearchFilter = ({
|
|
|
6596
5961
|
|
|
6597
5962
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6598
5963
|
init_emotion_jsx_shim();
|
|
6599
|
-
import { jsx as
|
|
5964
|
+
import { jsx as jsx51, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
|
|
6600
5965
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6601
|
-
return /* @__PURE__ */
|
|
6602
|
-
label ? /* @__PURE__ */
|
|
6603
|
-
/* @__PURE__ */
|
|
5966
|
+
return /* @__PURE__ */ jsxs31("div", { children: [
|
|
5967
|
+
label ? /* @__PURE__ */ jsx51("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
5968
|
+
/* @__PURE__ */ jsx51("div", { css: ObjectSearchFilterContainer, children })
|
|
6604
5969
|
] });
|
|
6605
5970
|
};
|
|
6606
5971
|
|
|
@@ -6610,9 +5975,9 @@ import { Popover } from "@uniformdev/design-system";
|
|
|
6610
5975
|
|
|
6611
5976
|
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6612
5977
|
init_emotion_jsx_shim();
|
|
6613
|
-
import { css as
|
|
5978
|
+
import { css as css29 } from "@emotion/react";
|
|
6614
5979
|
import { skeletonLoading } from "@uniformdev/design-system";
|
|
6615
|
-
var ObjectListItemContainer =
|
|
5980
|
+
var ObjectListItemContainer = css29`
|
|
6616
5981
|
align-items: center;
|
|
6617
5982
|
border: 1px solid var(--gray-300);
|
|
6618
5983
|
border-radius: var(--rounded-base);
|
|
@@ -6625,7 +5990,7 @@ var ObjectListItemContainer = css30`
|
|
|
6625
5990
|
display: none;
|
|
6626
5991
|
}
|
|
6627
5992
|
`;
|
|
6628
|
-
var ObjectListItemLoading =
|
|
5993
|
+
var ObjectListItemLoading = css29`
|
|
6629
5994
|
animation: ${skeletonLoading} 1s linear infinite alternate;
|
|
6630
5995
|
border-color: transparent;
|
|
6631
5996
|
min-height: 42px;
|
|
@@ -6649,37 +6014,37 @@ var ObjectListItemLoading = css30`
|
|
|
6649
6014
|
width: 1rem;
|
|
6650
6015
|
}
|
|
6651
6016
|
`;
|
|
6652
|
-
var ObjectListItemHeadingGroup =
|
|
6017
|
+
var ObjectListItemHeadingGroup = css29`
|
|
6653
6018
|
align-items: center;
|
|
6654
6019
|
display: grid;
|
|
6655
6020
|
`;
|
|
6656
|
-
var ObjectListItemTitle =
|
|
6021
|
+
var ObjectListItemTitle = css29`
|
|
6657
6022
|
color: var(--brand-secondary-1);
|
|
6658
6023
|
display: block;
|
|
6659
6024
|
font-size: var(--fs-sm);
|
|
6660
6025
|
`;
|
|
6661
|
-
var ObjectListItemSubtitle =
|
|
6026
|
+
var ObjectListItemSubtitle = css29`
|
|
6662
6027
|
color: var(--gray-500);
|
|
6663
6028
|
display: block;
|
|
6664
6029
|
font-size: var(--fs-xs);
|
|
6665
6030
|
line-height: 1;
|
|
6666
6031
|
`;
|
|
6667
|
-
var ObjectListItemInfoContainer =
|
|
6032
|
+
var ObjectListItemInfoContainer = css29`
|
|
6668
6033
|
align-items: center;
|
|
6669
6034
|
display: flex;
|
|
6670
6035
|
justify-content: center;
|
|
6671
6036
|
`;
|
|
6672
|
-
var ObjectListItemControlledContent =
|
|
6037
|
+
var ObjectListItemControlledContent = css29`
|
|
6673
6038
|
display: flex;
|
|
6674
6039
|
gap: var(--spacing-sm);
|
|
6675
6040
|
`;
|
|
6676
|
-
var ObjectListItemUnControlledContent =
|
|
6041
|
+
var ObjectListItemUnControlledContent = css29`
|
|
6677
6042
|
margin-top: var(--spacing-sm);
|
|
6678
6043
|
grid-column: 1 / -1;
|
|
6679
6044
|
`;
|
|
6680
6045
|
|
|
6681
6046
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6682
|
-
import { jsx as
|
|
6047
|
+
import { jsx as jsx52, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
|
|
6683
6048
|
var ObjectSearchListItem = ({
|
|
6684
6049
|
id,
|
|
6685
6050
|
title,
|
|
@@ -6702,20 +6067,20 @@ var ObjectSearchListItem = ({
|
|
|
6702
6067
|
return onSelectItem([selectedItem]);
|
|
6703
6068
|
};
|
|
6704
6069
|
const hideWhenInSelectedList = selectedListItems.some((item) => item.id === id);
|
|
6705
|
-
return /* @__PURE__ */
|
|
6706
|
-
/* @__PURE__ */
|
|
6707
|
-
!image ? null : /* @__PURE__ */
|
|
6708
|
-
/* @__PURE__ */
|
|
6709
|
-
!contentType ? null : /* @__PURE__ */
|
|
6710
|
-
/* @__PURE__ */
|
|
6070
|
+
return /* @__PURE__ */ jsxs32("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, children: [
|
|
6071
|
+
/* @__PURE__ */ jsxs32("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
|
|
6072
|
+
!image ? null : /* @__PURE__ */ jsx52("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6073
|
+
/* @__PURE__ */ jsxs32("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6074
|
+
!contentType ? null : /* @__PURE__ */ jsx52("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6075
|
+
/* @__PURE__ */ jsx52("span", { css: ObjectListItemTitle, children: title })
|
|
6711
6076
|
] })
|
|
6712
6077
|
] }),
|
|
6713
|
-
!popoverData ? null : /* @__PURE__ */
|
|
6714
|
-
!children ? null : /* @__PURE__ */
|
|
6078
|
+
!popoverData ? null : /* @__PURE__ */ jsx52("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ jsx52(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
|
|
6079
|
+
!children ? null : /* @__PURE__ */ jsx52("div", { css: ObjectListItemUnControlledContent, children })
|
|
6715
6080
|
] });
|
|
6716
6081
|
};
|
|
6717
6082
|
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6718
|
-
return /* @__PURE__ */
|
|
6083
|
+
return /* @__PURE__ */ jsx52("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6719
6084
|
};
|
|
6720
6085
|
|
|
6721
6086
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
@@ -6728,9 +6093,9 @@ init_emotion_jsx_shim();
|
|
|
6728
6093
|
|
|
6729
6094
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6730
6095
|
init_emotion_jsx_shim();
|
|
6731
|
-
import { css as
|
|
6096
|
+
import { css as css30 } from "@emotion/react";
|
|
6732
6097
|
import { button as button2 } from "@uniformdev/design-system";
|
|
6733
|
-
var ButtonStyles =
|
|
6098
|
+
var ButtonStyles = css30`
|
|
6734
6099
|
${button2}
|
|
6735
6100
|
background: transparent;
|
|
6736
6101
|
border: 1px solid var(--brand-secondary-1);
|
|
@@ -6757,20 +6122,20 @@ var ButtonStyles = css31`
|
|
|
6757
6122
|
text-decoration: none;
|
|
6758
6123
|
}
|
|
6759
6124
|
`;
|
|
6760
|
-
var ButtonIcon =
|
|
6125
|
+
var ButtonIcon = css30`
|
|
6761
6126
|
width: 1rem;
|
|
6762
6127
|
height: 1rem;
|
|
6763
6128
|
`;
|
|
6764
6129
|
|
|
6765
6130
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
6766
|
-
import { jsx as
|
|
6131
|
+
import { jsx as jsx53, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
|
|
6767
6132
|
var ObjectSearchResultItemButton = ({
|
|
6768
6133
|
text,
|
|
6769
6134
|
icon,
|
|
6770
6135
|
...props
|
|
6771
6136
|
}) => {
|
|
6772
|
-
return /* @__PURE__ */
|
|
6773
|
-
!icon ? null : /* @__PURE__ */
|
|
6137
|
+
return /* @__PURE__ */ jsxs33("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
6138
|
+
!icon ? null : /* @__PURE__ */ jsx53(Image, { src: icon, css: ButtonIcon }),
|
|
6774
6139
|
text
|
|
6775
6140
|
] });
|
|
6776
6141
|
};
|
|
@@ -6779,16 +6144,16 @@ var LinkButton = ({
|
|
|
6779
6144
|
icon,
|
|
6780
6145
|
...props
|
|
6781
6146
|
}) => {
|
|
6782
|
-
return /* @__PURE__ */
|
|
6783
|
-
!icon ? null : /* @__PURE__ */
|
|
6147
|
+
return /* @__PURE__ */ jsxs33("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
6148
|
+
!icon ? null : /* @__PURE__ */ jsx53(Image, { src: icon, css: ButtonIcon }),
|
|
6784
6149
|
text
|
|
6785
6150
|
] });
|
|
6786
6151
|
};
|
|
6787
6152
|
|
|
6788
6153
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6789
6154
|
init_emotion_jsx_shim();
|
|
6790
|
-
import { css as
|
|
6791
|
-
var ObjectSearchResultItemContainer =
|
|
6155
|
+
import { css as css31 } from "@emotion/react";
|
|
6156
|
+
var ObjectSearchResultItemContainer = css31`
|
|
6792
6157
|
align-items: center;
|
|
6793
6158
|
border: 1px solid var(--gray-300);
|
|
6794
6159
|
border-radius: var(--rounded-base);
|
|
@@ -6804,7 +6169,7 @@ var ObjectSearchResultItemContainer = css32`
|
|
|
6804
6169
|
}
|
|
6805
6170
|
}
|
|
6806
6171
|
`;
|
|
6807
|
-
var ObjectSearchDragHandle =
|
|
6172
|
+
var ObjectSearchDragHandle = css31`
|
|
6808
6173
|
border-left: 2px dotted var(--gray-300);
|
|
6809
6174
|
border-right: 2px dotted var(--gray-300);
|
|
6810
6175
|
position: absolute;
|
|
@@ -6813,41 +6178,41 @@ var ObjectSearchDragHandle = css32`
|
|
|
6813
6178
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6814
6179
|
opacity: 0;
|
|
6815
6180
|
`;
|
|
6816
|
-
var ObjectSearchResultItemSubtitle =
|
|
6181
|
+
var ObjectSearchResultItemSubtitle = css31`
|
|
6817
6182
|
color: var(--gray-500);
|
|
6818
6183
|
display: block;
|
|
6819
6184
|
font-size: var(--fs-xs);
|
|
6820
6185
|
line-height: 1;
|
|
6821
6186
|
`;
|
|
6822
|
-
var ObjectSearchResultItemTitle =
|
|
6187
|
+
var ObjectSearchResultItemTitle = css31`
|
|
6823
6188
|
align-items: center;
|
|
6824
6189
|
color: var(--brand-secondary-1);
|
|
6825
6190
|
display: flex;
|
|
6826
6191
|
gap: var(--spacing-xs);
|
|
6827
6192
|
`;
|
|
6828
|
-
var ObjectSearchResultItemTimeStamp =
|
|
6193
|
+
var ObjectSearchResultItemTimeStamp = css31`
|
|
6829
6194
|
color: var(--gray-500);
|
|
6830
6195
|
font-size: var(--fs-xs);
|
|
6831
6196
|
`;
|
|
6832
|
-
var ObjectSearchAuthorStateGroup =
|
|
6197
|
+
var ObjectSearchAuthorStateGroup = css31`
|
|
6833
6198
|
align-items: center;
|
|
6834
6199
|
display: flex;
|
|
6835
6200
|
gap: var(--spacing-sm);
|
|
6836
6201
|
`;
|
|
6837
|
-
var ObjectSearchUpdateGroup =
|
|
6202
|
+
var ObjectSearchUpdateGroup = css31`
|
|
6838
6203
|
display: grid;
|
|
6839
6204
|
`;
|
|
6840
|
-
var ObjectSearchContentContainer =
|
|
6205
|
+
var ObjectSearchContentContainer = css31`
|
|
6841
6206
|
display: flex;
|
|
6842
6207
|
gap: var(--spacing-base);
|
|
6843
6208
|
`;
|
|
6844
|
-
var ObjectSearchImage =
|
|
6209
|
+
var ObjectSearchImage = css31`
|
|
6845
6210
|
width: 56px;
|
|
6846
6211
|
object-fit: contain;
|
|
6847
6212
|
`;
|
|
6848
6213
|
|
|
6849
6214
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6850
|
-
import { jsx as
|
|
6215
|
+
import { jsx as jsx54, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
|
|
6851
6216
|
var ObjectSearchResultItem = ({
|
|
6852
6217
|
id,
|
|
6853
6218
|
title,
|
|
@@ -6871,35 +6236,35 @@ var ObjectSearchResultItem = ({
|
|
|
6871
6236
|
onSelectItem({ id, title: id });
|
|
6872
6237
|
onRemove == null ? void 0 : onRemove();
|
|
6873
6238
|
};
|
|
6874
|
-
return /* @__PURE__ */
|
|
6875
|
-
disableDnD ? null : /* @__PURE__ */
|
|
6876
|
-
/* @__PURE__ */
|
|
6877
|
-
!imageUrl ? null : /* @__PURE__ */
|
|
6878
|
-
/* @__PURE__ */
|
|
6879
|
-
/* @__PURE__ */
|
|
6880
|
-
/* @__PURE__ */
|
|
6239
|
+
return /* @__PURE__ */ jsxs34("div", { css: ObjectSearchResultItemContainer, children: [
|
|
6240
|
+
disableDnD ? null : /* @__PURE__ */ jsx54("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
6241
|
+
/* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsxs34("div", { css: ObjectSearchContentContainer, children: [
|
|
6242
|
+
!imageUrl ? null : /* @__PURE__ */ jsx54("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
6243
|
+
/* @__PURE__ */ jsxs34("div", { children: [
|
|
6244
|
+
/* @__PURE__ */ jsx54("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
|
|
6245
|
+
/* @__PURE__ */ jsxs34("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
|
|
6881
6246
|
title != null ? title : name,
|
|
6882
|
-
!popoverData ? null : /* @__PURE__ */
|
|
6247
|
+
!popoverData ? null : /* @__PURE__ */ jsx54(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
6883
6248
|
] }),
|
|
6884
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */
|
|
6885
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */
|
|
6886
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */
|
|
6887
|
-
!createdAt ? null : /* @__PURE__ */
|
|
6888
|
-
/* @__PURE__ */
|
|
6249
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs34("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6250
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx54(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
|
|
6251
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs34("div", { css: ObjectSearchUpdateGroup, children: [
|
|
6252
|
+
!createdAt ? null : /* @__PURE__ */ jsxs34("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6253
|
+
/* @__PURE__ */ jsx54("strong", { children: "Last updated: " }),
|
|
6889
6254
|
timeagoFormat(createdAt)
|
|
6890
6255
|
] }),
|
|
6891
|
-
!publishedAt ? null : /* @__PURE__ */
|
|
6892
|
-
/* @__PURE__ */
|
|
6256
|
+
!publishedAt ? null : /* @__PURE__ */ jsxs34("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6257
|
+
/* @__PURE__ */ jsx54("strong", { children: "Last published: " }),
|
|
6893
6258
|
timeagoFormat(publishedAt)
|
|
6894
6259
|
] })
|
|
6895
6260
|
] })
|
|
6896
6261
|
] }),
|
|
6897
|
-
/* @__PURE__ */
|
|
6262
|
+
/* @__PURE__ */ jsx54("div", { children })
|
|
6898
6263
|
] })
|
|
6899
6264
|
] }) }),
|
|
6900
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */
|
|
6901
|
-
!editLink ? null : /* @__PURE__ */
|
|
6902
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
6265
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs34("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6266
|
+
!editLink ? null : /* @__PURE__ */ jsx54(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
6267
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx54(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
6903
6268
|
] })
|
|
6904
6269
|
] });
|
|
6905
6270
|
};
|
|
@@ -6911,35 +6276,35 @@ import { DragDropContext as DragDropContext3, Draggable as Draggable3, Droppable
|
|
|
6911
6276
|
|
|
6912
6277
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
6913
6278
|
init_emotion_jsx_shim();
|
|
6914
|
-
import { css as
|
|
6915
|
-
var ObjectSearchResultListContainer =
|
|
6279
|
+
import { css as css32 } from "@emotion/react";
|
|
6280
|
+
var ObjectSearchResultListContainer = css32`
|
|
6916
6281
|
align-items: center;
|
|
6917
6282
|
display: flex;
|
|
6918
6283
|
gap: var(--spacing-sm);
|
|
6919
6284
|
justify-content: space-between;
|
|
6920
6285
|
`;
|
|
6921
|
-
var ObjectSearchDragContainer =
|
|
6286
|
+
var ObjectSearchDragContainer = css32`
|
|
6922
6287
|
margin: 0 0 var(--spacing-sm);
|
|
6923
6288
|
`;
|
|
6924
|
-
var ObjectSearchResultListCounterContainer =
|
|
6289
|
+
var ObjectSearchResultListCounterContainer = css32`
|
|
6925
6290
|
align-items: center;
|
|
6926
6291
|
display: flex;
|
|
6927
6292
|
gap: var(--spacing-sm);
|
|
6928
6293
|
`;
|
|
6929
|
-
var ObjectSearchResultListTitle =
|
|
6294
|
+
var ObjectSearchResultListTitle = css32`
|
|
6930
6295
|
font-weight: var(--fw-bold);
|
|
6931
6296
|
line-height: 1;
|
|
6932
6297
|
`;
|
|
6933
6298
|
|
|
6934
6299
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6935
|
-
import { Fragment as
|
|
6300
|
+
import { Fragment as Fragment9, jsx as jsx55, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
|
|
6936
6301
|
function ObjectSearchResultList({
|
|
6937
6302
|
resultLabelText = "Selected",
|
|
6938
6303
|
removeButtonText = "Remove all",
|
|
6939
6304
|
onRemoveAllSelected,
|
|
6940
6305
|
hideRemoveButton = false,
|
|
6941
6306
|
additionalButtons,
|
|
6942
|
-
renderResultComponent = (value) => /* @__PURE__ */
|
|
6307
|
+
renderResultComponent = (value) => /* @__PURE__ */ jsx55(ObjectSearchResultItem, { ...value, disableDnD }),
|
|
6943
6308
|
multiSelectId,
|
|
6944
6309
|
disableDnD = false,
|
|
6945
6310
|
whenNothingSelected = null
|
|
@@ -6959,16 +6324,16 @@ function ObjectSearchResultList({
|
|
|
6959
6324
|
return result;
|
|
6960
6325
|
}
|
|
6961
6326
|
};
|
|
6962
|
-
return /* @__PURE__ */
|
|
6963
|
-
/* @__PURE__ */
|
|
6964
|
-
/* @__PURE__ */
|
|
6965
|
-
/* @__PURE__ */
|
|
6327
|
+
return /* @__PURE__ */ jsxs35(Fragment9, { children: [
|
|
6328
|
+
/* @__PURE__ */ jsxs35("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
6329
|
+
/* @__PURE__ */ jsxs35("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
6330
|
+
/* @__PURE__ */ jsx55("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
6966
6331
|
" ",
|
|
6967
|
-
!selectedListItems.length ? null : /* @__PURE__ */
|
|
6332
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx55(Counter, { count: selectedListItems.length })
|
|
6968
6333
|
] }),
|
|
6969
|
-
/* @__PURE__ */
|
|
6334
|
+
/* @__PURE__ */ jsxs35("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
6970
6335
|
additionalButtons,
|
|
6971
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
6336
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx55(
|
|
6972
6337
|
Button5,
|
|
6973
6338
|
{
|
|
6974
6339
|
buttonType: "ghostDestructive",
|
|
@@ -6980,10 +6345,10 @@ function ObjectSearchResultList({
|
|
|
6980
6345
|
)
|
|
6981
6346
|
] })
|
|
6982
6347
|
] }),
|
|
6983
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */
|
|
6348
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx55(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx55(Droppable3, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs35("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
6984
6349
|
selectedListItems.map((item, i2) => {
|
|
6985
6350
|
const renderListItem = renderResultComponent(item);
|
|
6986
|
-
return /* @__PURE__ */
|
|
6351
|
+
return /* @__PURE__ */ jsx55(Draggable3, { draggableId: item.id, index: i2, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ jsx55(
|
|
6987
6352
|
"div",
|
|
6988
6353
|
{
|
|
6989
6354
|
css: ObjectSearchDragContainer,
|
|
@@ -7002,9 +6367,9 @@ function ObjectSearchResultList({
|
|
|
7002
6367
|
|
|
7003
6368
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
7004
6369
|
init_emotion_jsx_shim();
|
|
7005
|
-
import { Input as
|
|
7006
|
-
import { useEffect as
|
|
7007
|
-
import { jsx as
|
|
6370
|
+
import { Input as Input6, InputKeywordSearch as InputKeywordSearch3, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
|
|
6371
|
+
import { useEffect as useEffect9, useState as useState14 } from "react";
|
|
6372
|
+
import { jsx as jsx56, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
|
|
7008
6373
|
var QueryFilter = ({
|
|
7009
6374
|
requireContentType,
|
|
7010
6375
|
queryFilterTitle = "Configure Query",
|
|
@@ -7035,7 +6400,7 @@ var QueryFilter = ({
|
|
|
7035
6400
|
}) => {
|
|
7036
6401
|
var _a, _b, _c, _d;
|
|
7037
6402
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
7038
|
-
const [queryState, setQueryState] =
|
|
6403
|
+
const [queryState, setQueryState] = useState14({
|
|
7039
6404
|
contentType: "",
|
|
7040
6405
|
keyword: "",
|
|
7041
6406
|
count: countValue != null ? countValue : 5,
|
|
@@ -7046,13 +6411,13 @@ var QueryFilter = ({
|
|
|
7046
6411
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
7047
6412
|
onSetQuery({ ...query, ...value });
|
|
7048
6413
|
};
|
|
7049
|
-
|
|
6414
|
+
useEffect9(() => {
|
|
7050
6415
|
onSetQuery(queryState);
|
|
7051
6416
|
}, [onSetQuery, queryState]);
|
|
7052
|
-
return /* @__PURE__ */
|
|
7053
|
-
/* @__PURE__ */
|
|
7054
|
-
/* @__PURE__ */
|
|
7055
|
-
/* @__PURE__ */
|
|
6417
|
+
return /* @__PURE__ */ jsxs36("fieldset", { children: [
|
|
6418
|
+
/* @__PURE__ */ jsx56("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
6419
|
+
/* @__PURE__ */ jsx56("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs36(VerticalRhythm2, { children: [
|
|
6420
|
+
/* @__PURE__ */ jsx56(
|
|
7056
6421
|
InputVariables,
|
|
7057
6422
|
{
|
|
7058
6423
|
label: searchInputLabel,
|
|
@@ -7060,7 +6425,7 @@ var QueryFilter = ({
|
|
|
7060
6425
|
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
7061
6426
|
disableInlineMenu: true,
|
|
7062
6427
|
id: "qf_searchText",
|
|
7063
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
6428
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
7064
6429
|
InputKeywordSearch3,
|
|
7065
6430
|
{
|
|
7066
6431
|
id: "qf_searchText",
|
|
@@ -7074,8 +6439,8 @@ var QueryFilter = ({
|
|
|
7074
6439
|
)
|
|
7075
6440
|
}
|
|
7076
6441
|
),
|
|
7077
|
-
/* @__PURE__ */
|
|
7078
|
-
/* @__PURE__ */
|
|
6442
|
+
/* @__PURE__ */ jsxs36("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
|
|
6443
|
+
/* @__PURE__ */ jsx56(
|
|
7079
6444
|
InputVariables,
|
|
7080
6445
|
{
|
|
7081
6446
|
label: contentTypeLabel,
|
|
@@ -7083,7 +6448,7 @@ var QueryFilter = ({
|
|
|
7083
6448
|
value: (_d = queryState.contentType) != null ? _d : "",
|
|
7084
6449
|
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
7085
6450
|
disableInlineMenu: true,
|
|
7086
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
6451
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
7087
6452
|
InputSelect7,
|
|
7088
6453
|
{
|
|
7089
6454
|
id: "qf_contentType",
|
|
@@ -7102,7 +6467,7 @@ var QueryFilter = ({
|
|
|
7102
6467
|
)
|
|
7103
6468
|
}
|
|
7104
6469
|
),
|
|
7105
|
-
/* @__PURE__ */
|
|
6470
|
+
/* @__PURE__ */ jsx56(
|
|
7106
6471
|
InputVariables,
|
|
7107
6472
|
{
|
|
7108
6473
|
label: countLabel,
|
|
@@ -7110,8 +6475,8 @@ var QueryFilter = ({
|
|
|
7110
6475
|
value: queryState.count.toString(10),
|
|
7111
6476
|
onChange: (newCount) => handleFilterChange({ count: newCount }),
|
|
7112
6477
|
disableInlineMenu: true,
|
|
7113
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7114
|
-
|
|
6478
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
6479
|
+
Input6,
|
|
7115
6480
|
{
|
|
7116
6481
|
id: "qf_count",
|
|
7117
6482
|
label: countLabel,
|
|
@@ -7125,8 +6490,8 @@ var QueryFilter = ({
|
|
|
7125
6490
|
}
|
|
7126
6491
|
)
|
|
7127
6492
|
] }),
|
|
7128
|
-
/* @__PURE__ */
|
|
7129
|
-
/* @__PURE__ */
|
|
6493
|
+
/* @__PURE__ */ jsxs36("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
|
|
6494
|
+
/* @__PURE__ */ jsx56(
|
|
7130
6495
|
InputVariables,
|
|
7131
6496
|
{
|
|
7132
6497
|
id: "qf_sortBy",
|
|
@@ -7134,7 +6499,7 @@ var QueryFilter = ({
|
|
|
7134
6499
|
value: queryState.sortBy,
|
|
7135
6500
|
onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
|
|
7136
6501
|
disableInlineMenu: true,
|
|
7137
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
6502
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
7138
6503
|
InputSelect7,
|
|
7139
6504
|
{
|
|
7140
6505
|
label: sortLabel,
|
|
@@ -7156,7 +6521,7 @@ var QueryFilter = ({
|
|
|
7156
6521
|
)
|
|
7157
6522
|
}
|
|
7158
6523
|
),
|
|
7159
|
-
/* @__PURE__ */
|
|
6524
|
+
/* @__PURE__ */ jsx56(
|
|
7160
6525
|
InputVariables,
|
|
7161
6526
|
{
|
|
7162
6527
|
label: sortOrderLabel,
|
|
@@ -7164,7 +6529,7 @@ var QueryFilter = ({
|
|
|
7164
6529
|
value: queryState.sortOrder,
|
|
7165
6530
|
onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
|
|
7166
6531
|
disableInlineMenu: true,
|
|
7167
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
6532
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
7168
6533
|
InputSelect7,
|
|
7169
6534
|
{
|
|
7170
6535
|
label: sortOrderLabel,
|
|
@@ -7207,7 +6572,7 @@ import {
|
|
|
7207
6572
|
Button as Button6,
|
|
7208
6573
|
Callout as Callout5,
|
|
7209
6574
|
Heading,
|
|
7210
|
-
Input as
|
|
6575
|
+
Input as Input7,
|
|
7211
6576
|
InputComboBox,
|
|
7212
6577
|
InputKeywordSearch as InputKeywordSearch4,
|
|
7213
6578
|
InputSelect as InputSelect8,
|
|
@@ -7216,7 +6581,7 @@ import {
|
|
|
7216
6581
|
LoadingIndicator as LoadingIndicator4,
|
|
7217
6582
|
LoadingOverlay as LoadingOverlay2,
|
|
7218
6583
|
Menu as Menu3,
|
|
7219
|
-
MenuItem as
|
|
6584
|
+
MenuItem as MenuItem3,
|
|
7220
6585
|
ParameterGroup,
|
|
7221
6586
|
ParameterImage,
|
|
7222
6587
|
ParameterImageInner,
|
|
@@ -7254,7 +6619,7 @@ export {
|
|
|
7254
6619
|
EntrySearch,
|
|
7255
6620
|
Heading,
|
|
7256
6621
|
icons_exports as Icons,
|
|
7257
|
-
|
|
6622
|
+
Input7 as Input,
|
|
7258
6623
|
InputComboBox,
|
|
7259
6624
|
InputKeywordSearch4 as InputKeywordSearch,
|
|
7260
6625
|
InputSelect8 as InputSelect,
|
|
@@ -7265,7 +6630,7 @@ export {
|
|
|
7265
6630
|
LoadingIndicator4 as LoadingIndicator,
|
|
7266
6631
|
LoadingOverlay2 as LoadingOverlay,
|
|
7267
6632
|
Menu3 as Menu,
|
|
7268
|
-
|
|
6633
|
+
MenuItem3 as MenuItem,
|
|
7269
6634
|
MeshApp,
|
|
7270
6635
|
ObjectSearchContainer,
|
|
7271
6636
|
ObjectSearchFilter,
|
|
@@ -7393,6 +6758,7 @@ export {
|
|
|
7393
6758
|
useRequestParameter,
|
|
7394
6759
|
useUniformMeshSdk,
|
|
7395
6760
|
useVariables,
|
|
6761
|
+
variableExpression,
|
|
7396
6762
|
variablePrefix,
|
|
7397
6763
|
variableSuffix,
|
|
7398
6764
|
variablesToList
|