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