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