@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.js
CHANGED
|
@@ -166,9 +166,9 @@ var require_p_limit = __commonJS({
|
|
|
166
166
|
// src/index.ts
|
|
167
167
|
var src_exports = {};
|
|
168
168
|
__export(src_exports, {
|
|
169
|
-
AddListButton: () =>
|
|
170
|
-
Button: () =>
|
|
171
|
-
Callout: () =>
|
|
169
|
+
AddListButton: () => import_design_system34.AddListButton,
|
|
170
|
+
Button: () => import_design_system34.Button,
|
|
171
|
+
Callout: () => import_design_system34.Callout,
|
|
172
172
|
DamSelectedItem: () => DamSelectedItem,
|
|
173
173
|
DataRefreshButton: () => DataRefreshButton,
|
|
174
174
|
DataResourceDynamicInputProvider: () => DataResourceDynamicInputProvider,
|
|
@@ -179,20 +179,20 @@ __export(src_exports, {
|
|
|
179
179
|
DefaultSearchRow: () => DefaultSearchRow,
|
|
180
180
|
DefaultSelectedItem: () => DefaultSelectedItem,
|
|
181
181
|
EntrySearch: () => EntrySearch,
|
|
182
|
-
Heading: () =>
|
|
182
|
+
Heading: () => import_design_system34.Heading,
|
|
183
183
|
Icons: () => icons_exports,
|
|
184
|
-
Input: () =>
|
|
185
|
-
InputComboBox: () =>
|
|
186
|
-
InputKeywordSearch: () =>
|
|
187
|
-
InputSelect: () =>
|
|
188
|
-
InputToggle: () =>
|
|
184
|
+
Input: () => import_design_system34.Input,
|
|
185
|
+
InputComboBox: () => import_design_system34.InputComboBox,
|
|
186
|
+
InputKeywordSearch: () => import_design_system34.InputKeywordSearch,
|
|
187
|
+
InputSelect: () => import_design_system34.InputSelect,
|
|
188
|
+
InputToggle: () => import_design_system34.InputToggle,
|
|
189
189
|
InputVariables: () => InputVariables,
|
|
190
|
-
Label: () =>
|
|
190
|
+
Label: () => import_design_system34.Label,
|
|
191
191
|
LinkButton: () => LinkButton,
|
|
192
|
-
LoadingIndicator: () =>
|
|
193
|
-
LoadingOverlay: () =>
|
|
194
|
-
Menu: () =>
|
|
195
|
-
MenuItem: () =>
|
|
192
|
+
LoadingIndicator: () => import_design_system34.LoadingIndicator,
|
|
193
|
+
LoadingOverlay: () => import_design_system34.LoadingOverlay,
|
|
194
|
+
Menu: () => import_design_system34.Menu,
|
|
195
|
+
MenuItem: () => import_design_system34.MenuItem,
|
|
196
196
|
MeshApp: () => MeshApp,
|
|
197
197
|
ObjectSearchContainer: () => ObjectSearchContainer,
|
|
198
198
|
ObjectSearchFilter: () => ObjectSearchFilter,
|
|
@@ -203,21 +203,21 @@ __export(src_exports, {
|
|
|
203
203
|
ObjectSearchResultItem: () => ObjectSearchResultItem,
|
|
204
204
|
ObjectSearchResultItemButton: () => ObjectSearchResultItemButton,
|
|
205
205
|
ObjectSearchResultList: () => ObjectSearchResultList,
|
|
206
|
-
ParameterGroup: () =>
|
|
207
|
-
ParameterImage: () =>
|
|
208
|
-
ParameterImageInner: () =>
|
|
209
|
-
ParameterInput: () =>
|
|
210
|
-
ParameterInputInner: () =>
|
|
211
|
-
ParameterLabel: () =>
|
|
212
|
-
ParameterMenuButton: () =>
|
|
213
|
-
ParameterSelect: () =>
|
|
214
|
-
ParameterSelectInner: () =>
|
|
215
|
-
ParameterShell: () =>
|
|
216
|
-
ParameterShellContext: () =>
|
|
217
|
-
ParameterTextarea: () =>
|
|
218
|
-
ParameterTextareaInner: () =>
|
|
219
|
-
ParameterToggle: () =>
|
|
220
|
-
ParameterToggleInner: () =>
|
|
206
|
+
ParameterGroup: () => import_design_system34.ParameterGroup,
|
|
207
|
+
ParameterImage: () => import_design_system34.ParameterImage,
|
|
208
|
+
ParameterImageInner: () => import_design_system34.ParameterImageInner,
|
|
209
|
+
ParameterInput: () => import_design_system34.ParameterInput,
|
|
210
|
+
ParameterInputInner: () => import_design_system34.ParameterInputInner,
|
|
211
|
+
ParameterLabel: () => import_design_system34.ParameterLabel,
|
|
212
|
+
ParameterMenuButton: () => import_design_system34.ParameterMenuButton,
|
|
213
|
+
ParameterSelect: () => import_design_system34.ParameterSelect,
|
|
214
|
+
ParameterSelectInner: () => import_design_system34.ParameterSelectInner,
|
|
215
|
+
ParameterShell: () => import_design_system34.ParameterShell,
|
|
216
|
+
ParameterShellContext: () => import_design_system33.ParameterShellContext,
|
|
217
|
+
ParameterTextarea: () => import_design_system34.ParameterTextarea,
|
|
218
|
+
ParameterTextareaInner: () => import_design_system34.ParameterTextareaInner,
|
|
219
|
+
ParameterToggle: () => import_design_system34.ParameterToggle,
|
|
220
|
+
ParameterToggleInner: () => import_design_system34.ParameterToggleInner,
|
|
221
221
|
ProductPreviewList: () => ProductPreviewList,
|
|
222
222
|
ProductQuery: () => ProductQuery,
|
|
223
223
|
ProductQueryContext: () => ProductQueryContext,
|
|
@@ -235,13 +235,13 @@ __export(src_exports, {
|
|
|
235
235
|
RequestUrl: () => RequestUrl,
|
|
236
236
|
RequestUrlInput: () => RequestUrlInput,
|
|
237
237
|
ResolvableLoadingValue: () => ResolvableLoadingValue,
|
|
238
|
-
ScrollableList: () =>
|
|
239
|
-
ScrollableListItem: () =>
|
|
238
|
+
ScrollableList: () => import_design_system34.ScrollableList,
|
|
239
|
+
ScrollableListItem: () => import_design_system34.ScrollableListItem,
|
|
240
240
|
SelectionField: () => SelectionField,
|
|
241
|
-
Switch: () =>
|
|
241
|
+
Switch: () => import_design_system34.Switch,
|
|
242
242
|
TextVariableRenderer: () => TextVariableRenderer,
|
|
243
|
-
Textarea: () =>
|
|
244
|
-
Theme: () =>
|
|
243
|
+
Textarea: () => import_design_system34.Textarea,
|
|
244
|
+
Theme: () => import_design_system34.Theme,
|
|
245
245
|
VariableEditor: () => VariableEditor,
|
|
246
246
|
VariablesList: () => VariablesList,
|
|
247
247
|
VariablesProvider: () => VariablesProvider,
|
|
@@ -312,7 +312,7 @@ __export(src_exports, {
|
|
|
312
312
|
urlEncodeRequestUrl: () => urlEncodeRequestUrl,
|
|
313
313
|
useMeshLocation: () => useMeshLocation,
|
|
314
314
|
useObjectSearchContext: () => useObjectSearchContext,
|
|
315
|
-
useParameterShell: () =>
|
|
315
|
+
useParameterShell: () => import_design_system33.useParameterShell,
|
|
316
316
|
useProductQueryContext: () => useProductQueryContext,
|
|
317
317
|
useProductSearchContext: () => useProductSearchContext,
|
|
318
318
|
useRequest: () => useRequest,
|
|
@@ -320,6 +320,7 @@ __export(src_exports, {
|
|
|
320
320
|
useRequestParameter: () => useRequestParameter,
|
|
321
321
|
useUniformMeshSdk: () => useUniformMeshSdk,
|
|
322
322
|
useVariables: () => useVariables,
|
|
323
|
+
variableExpression: () => variableExpression,
|
|
323
324
|
variablePrefix: () => variablePrefix,
|
|
324
325
|
variableSuffix: () => variableSuffix,
|
|
325
326
|
variablesToList: () => variablesToList
|
|
@@ -3076,221 +3077,34 @@ function useMeshLocation(expectedLocation) {
|
|
|
3076
3077
|
|
|
3077
3078
|
// src/components/Variables/InputVariables.tsx
|
|
3078
3079
|
init_emotion_jsx_shim();
|
|
3079
|
-
var
|
|
3080
|
+
var import_design_system16 = require("@uniformdev/design-system");
|
|
3080
3081
|
var React11 = __toESM(require("react"));
|
|
3081
|
-
var
|
|
3082
|
-
var import_uuid3 = require("uuid");
|
|
3083
|
-
|
|
3084
|
-
// src/components/Variables/composer/PasteTransformerPlugin.tsx
|
|
3085
|
-
init_emotion_jsx_shim();
|
|
3086
|
-
var import_LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
3087
|
-
var import_lexical = require("lexical");
|
|
3088
|
-
var import_react28 = require("react");
|
|
3089
|
-
function PasteTransformerPlugin({ transformPaste }) {
|
|
3090
|
-
const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
|
|
3091
|
-
(0, import_react28.useEffect)(() => {
|
|
3092
|
-
editor.registerCommand(
|
|
3093
|
-
import_lexical.PASTE_COMMAND,
|
|
3094
|
-
(event) => {
|
|
3095
|
-
var _a;
|
|
3096
|
-
const selection = (0, import_lexical.$getSelection)();
|
|
3097
|
-
const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
|
|
3098
|
-
if (pastedText && transformPaste && (0, import_lexical.$isRangeSelection)(selection)) {
|
|
3099
|
-
const result = transformPaste(pastedText);
|
|
3100
|
-
if (result !== void 0) {
|
|
3101
|
-
selection.insertText(result);
|
|
3102
|
-
return true;
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3105
|
-
return false;
|
|
3106
|
-
},
|
|
3107
|
-
import_lexical.COMMAND_PRIORITY_HIGH
|
|
3108
|
-
);
|
|
3109
|
-
}, [editor, transformPaste]);
|
|
3110
|
-
return null;
|
|
3111
|
-
}
|
|
3112
|
-
|
|
3113
|
-
// src/components/Variables/styles/InputVariables.styles.ts
|
|
3114
|
-
init_emotion_jsx_shim();
|
|
3115
|
-
var import_react29 = require("@emotion/react");
|
|
3116
|
-
var menuContainer = import_react29.css`
|
|
3117
|
-
position: relative;
|
|
3118
|
-
`;
|
|
3119
|
-
var menuBtn = import_react29.css`
|
|
3120
|
-
position: absolute;
|
|
3121
|
-
top: 50%;
|
|
3122
|
-
right: var(--spacing-sm);
|
|
3123
|
-
transform: translateY(-50%);
|
|
3124
|
-
`;
|
|
3125
|
-
var input = import_react29.css`
|
|
3126
|
-
appearance: none;
|
|
3127
|
-
background-color: var(--white);
|
|
3128
|
-
border: 1px solid var(--gray-400);
|
|
3129
|
-
border-radius: var(--rounded-md);
|
|
3130
|
-
color: var(--gray-700);
|
|
3131
|
-
padding-block: var(--spacing-sm);
|
|
3132
|
-
padding-left: var(--spacing-base);
|
|
3133
|
-
padding-right: var(--spacing-lg);
|
|
3134
|
-
line-height: 2.5;
|
|
3135
|
-
width: 100%;
|
|
3136
|
-
position: relative;
|
|
3137
|
-
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3138
|
-
border-color var(--duration-fast) var(--timing-ease-out),
|
|
3139
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
3140
|
-
|
|
3141
|
-
&:focus,
|
|
3142
|
-
&:focus-within {
|
|
3143
|
-
border-color: var(--brand-secondary-1);
|
|
3144
|
-
box-shadow: none;
|
|
3145
|
-
outline: none;
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3148
|
-
&:disabled,
|
|
3149
|
-
&:disabled::placeholder {
|
|
3150
|
-
cursor: not-allowed;
|
|
3151
|
-
color: var(--gray-300);
|
|
3152
|
-
border-color: var(--gray-300);
|
|
3153
|
-
}
|
|
3154
|
-
|
|
3155
|
-
> p {
|
|
3156
|
-
margin: 0;
|
|
3157
|
-
}
|
|
3158
|
-
`;
|
|
3159
|
-
|
|
3160
|
-
// src/components/Variables/util/getReferencedVariables.ts
|
|
3161
|
-
init_emotion_jsx_shim();
|
|
3162
|
-
|
|
3163
|
-
// src/components/Variables/util/parseVariableExpression.ts
|
|
3164
|
-
init_emotion_jsx_shim();
|
|
3165
|
-
|
|
3166
|
-
// src/components/Variables/util/variableExpression.ts
|
|
3167
|
-
init_emotion_jsx_shim();
|
|
3168
|
-
var variablePrefix = "${";
|
|
3169
|
-
var variableSuffix = "}";
|
|
3170
|
-
|
|
3171
|
-
// src/components/Variables/util/parseVariableExpression.ts
|
|
3172
|
-
function parseVariableExpression(serialized, onToken) {
|
|
3173
|
-
let buf = [];
|
|
3174
|
-
let state = "text";
|
|
3175
|
-
for (let index = 0; index < serialized.length; index++) {
|
|
3176
|
-
const char = serialized[index];
|
|
3177
|
-
if (char === "$" && serialized.at(index + 1) === "{") {
|
|
3178
|
-
if (serialized.at(index - 1) === "\\") {
|
|
3179
|
-
buf.pop();
|
|
3180
|
-
buf.push(char);
|
|
3181
|
-
continue;
|
|
3182
|
-
}
|
|
3183
|
-
state = "variable";
|
|
3184
|
-
if (buf.length) {
|
|
3185
|
-
onToken(buf.join(""), "text");
|
|
3186
|
-
buf = [];
|
|
3187
|
-
}
|
|
3188
|
-
index++;
|
|
3189
|
-
continue;
|
|
3190
|
-
}
|
|
3191
|
-
if (char === "}" && state === "variable") {
|
|
3192
|
-
state = "text";
|
|
3193
|
-
if (buf.length) {
|
|
3194
|
-
onToken(buf.join(""), "variable");
|
|
3195
|
-
buf = [];
|
|
3196
|
-
}
|
|
3197
|
-
continue;
|
|
3198
|
-
}
|
|
3199
|
-
buf.push(char);
|
|
3200
|
-
}
|
|
3201
|
-
if (buf.length) {
|
|
3202
|
-
if (state === "variable") {
|
|
3203
|
-
state = "text";
|
|
3204
|
-
buf.unshift(variablePrefix);
|
|
3205
|
-
}
|
|
3206
|
-
onToken(buf.join(""), state);
|
|
3207
|
-
}
|
|
3208
|
-
}
|
|
3209
|
-
|
|
3210
|
-
// src/components/Variables/util/getReferencedVariables.ts
|
|
3211
|
-
function getReferencedVariables(value) {
|
|
3212
|
-
const result = [];
|
|
3213
|
-
parseVariableExpression(value, (token, type) => {
|
|
3214
|
-
if (type === "variable") {
|
|
3215
|
-
result.push(token);
|
|
3216
|
-
}
|
|
3217
|
-
});
|
|
3218
|
-
return result;
|
|
3219
|
-
}
|
|
3220
|
-
|
|
3221
|
-
// src/components/Variables/VariableField.tsx
|
|
3222
|
-
init_emotion_jsx_shim();
|
|
3223
|
-
|
|
3224
|
-
// src/components/Variables/styles/VariableField.styles.ts
|
|
3225
|
-
init_emotion_jsx_shim();
|
|
3226
|
-
var import_react30 = require("@emotion/react");
|
|
3227
|
-
var labelText = import_react30.css`
|
|
3228
|
-
align-items: center;
|
|
3229
|
-
display: flex;
|
|
3230
|
-
gap: var(--spacing-xs);
|
|
3231
|
-
font-weight: var(--fw-regular);
|
|
3232
|
-
margin: 0 0 var(--spacing-xs);
|
|
3233
|
-
`;
|
|
3234
|
-
var variableBindButton = import_react30.css`
|
|
3235
|
-
align-items: center;
|
|
3236
|
-
border: none;
|
|
3237
|
-
border-radius: var(--rounded-base);
|
|
3238
|
-
background: none;
|
|
3239
|
-
display: flex;
|
|
3240
|
-
height: 1.2rem;
|
|
3241
|
-
padding: var(--spacing-2xs);
|
|
3242
|
-
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3243
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
3244
|
-
width: 1.2rem;
|
|
3245
|
-
|
|
3246
|
-
&:hover,
|
|
3247
|
-
&[aria-pressed='true']:not(:disabled) {
|
|
3248
|
-
background: var(--brand-secondary-3);
|
|
3249
|
-
color: var(--white);
|
|
3250
|
-
}
|
|
3251
|
-
|
|
3252
|
-
&[aria-disabled='true'] {
|
|
3253
|
-
background: none;
|
|
3254
|
-
color: currentColor;
|
|
3255
|
-
}
|
|
3256
|
-
`;
|
|
3257
|
-
|
|
3258
|
-
// src/components/Variables/VariablesComposerVariableMenu.tsx
|
|
3259
|
-
init_emotion_jsx_shim();
|
|
3260
|
-
var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
|
|
3261
|
-
var import_lexical4 = require("lexical");
|
|
3082
|
+
var import_uuid2 = require("uuid");
|
|
3262
3083
|
|
|
3263
|
-
// src/components/Variables/
|
|
3084
|
+
// src/components/Variables/SelectVariableMenu.tsx
|
|
3264
3085
|
init_emotion_jsx_shim();
|
|
3265
|
-
var
|
|
3266
|
-
var
|
|
3267
|
-
var
|
|
3268
|
-
var import_design_system16 = require("@uniformdev/design-system");
|
|
3269
|
-
var import_lexical3 = require("lexical");
|
|
3270
|
-
var import_react36 = require("react");
|
|
3271
|
-
var import_react_dom = require("react-dom");
|
|
3086
|
+
var import_design_system15 = require("@uniformdev/design-system");
|
|
3087
|
+
var import_react31 = require("react");
|
|
3088
|
+
var import_cg5 = require("react-icons/cg");
|
|
3272
3089
|
|
|
3273
3090
|
// src/components/Variables/styles/InsertVariableMenu.styles.ts
|
|
3274
3091
|
init_emotion_jsx_shim();
|
|
3275
|
-
var
|
|
3276
|
-
var
|
|
3092
|
+
var import_react28 = require("@emotion/react");
|
|
3093
|
+
var menuBtn = import_react28.css`
|
|
3277
3094
|
background: none;
|
|
3278
3095
|
border: none;
|
|
3279
3096
|
color: var(--gray-500);
|
|
3280
3097
|
padding: 0;
|
|
3281
3098
|
`;
|
|
3282
|
-
var menuItemTextGroup =
|
|
3099
|
+
var menuItemTextGroup = import_react28.css`
|
|
3283
3100
|
align-items: flex-start;
|
|
3284
3101
|
display: flex;
|
|
3285
3102
|
flex-direction: column;
|
|
3286
|
-
gap: 0;
|
|
3287
|
-
line-height: 1em;
|
|
3288
3103
|
`;
|
|
3289
|
-
var smallText =
|
|
3104
|
+
var smallText = import_react28.css`
|
|
3290
3105
|
font-size: var(--fs-xs);
|
|
3291
|
-
color: var(--gray-500);
|
|
3292
3106
|
`;
|
|
3293
|
-
var variablesTipText =
|
|
3107
|
+
var variablesTipText = import_react28.css`
|
|
3294
3108
|
${smallText}
|
|
3295
3109
|
color: var(--gray-500);
|
|
3296
3110
|
padding: 0 var(--spacing-sm);
|
|
@@ -3298,7 +3112,7 @@ var variablesTipText = import_react31.css`
|
|
|
3298
3112
|
|
|
3299
3113
|
// src/components/Variables/useOnVariableUpdated.ts
|
|
3300
3114
|
init_emotion_jsx_shim();
|
|
3301
|
-
var
|
|
3115
|
+
var import_react30 = require("react");
|
|
3302
3116
|
|
|
3303
3117
|
// src/components/Variables/VariablesProvider.tsx
|
|
3304
3118
|
init_emotion_jsx_shim();
|
|
@@ -3314,13 +3128,13 @@ var import_zod2 = require("zod");
|
|
|
3314
3128
|
|
|
3315
3129
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
3316
3130
|
init_emotion_jsx_shim();
|
|
3317
|
-
var
|
|
3318
|
-
var variablesFormContainer =
|
|
3131
|
+
var import_react29 = require("@emotion/react");
|
|
3132
|
+
var variablesFormContainer = import_react29.css`
|
|
3319
3133
|
> * {
|
|
3320
3134
|
margin: var(--spacing-base) 0 0;
|
|
3321
3135
|
}
|
|
3322
3136
|
`;
|
|
3323
|
-
var variablesFormBtnGroup =
|
|
3137
|
+
var variablesFormBtnGroup = import_react29.css`
|
|
3324
3138
|
display: flex;
|
|
3325
3139
|
gap: var(--spacing-sm);
|
|
3326
3140
|
`;
|
|
@@ -3421,27 +3235,17 @@ function VariablesProvider({
|
|
|
3421
3235
|
value,
|
|
3422
3236
|
onChange,
|
|
3423
3237
|
editVariableComponent,
|
|
3424
|
-
readOnly,
|
|
3425
3238
|
children
|
|
3426
3239
|
}) {
|
|
3427
3240
|
const [editing, setEditing] = React10.useState();
|
|
3428
3241
|
const events = React10.useMemo(() => (0, import_mitt.default)(), []);
|
|
3429
|
-
if (!readOnly && !onChange) {
|
|
3430
|
-
throw new Error("onChange must be provided when readOnly is false");
|
|
3431
|
-
}
|
|
3432
3242
|
const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
3433
3243
|
const contextValue = {
|
|
3434
3244
|
flatVariables: flattenVariables(value),
|
|
3435
3245
|
dispatch: (event) => {
|
|
3436
|
-
if (readOnly) {
|
|
3437
|
-
console.warn(
|
|
3438
|
-
`Received ignored mutation event in read-only variables context: ${JSON.stringify(event)}`
|
|
3439
|
-
);
|
|
3440
|
-
return;
|
|
3441
|
-
}
|
|
3442
3246
|
if (event.type === "set") {
|
|
3443
3247
|
const { name, ...varValue } = event.variable;
|
|
3444
|
-
onChange
|
|
3248
|
+
onChange({ ...contextValue.variables, [event.variable.name]: varValue });
|
|
3445
3249
|
if (event.openEditor) {
|
|
3446
3250
|
setEditing(event.variable.name);
|
|
3447
3251
|
}
|
|
@@ -3450,9 +3254,9 @@ function VariablesProvider({
|
|
|
3450
3254
|
} else if (event.type === "remove") {
|
|
3451
3255
|
const newValue = { ...value };
|
|
3452
3256
|
delete newValue[event.variable];
|
|
3453
|
-
onChange
|
|
3257
|
+
onChange(newValue);
|
|
3454
3258
|
} else if (event.type === "reorder") {
|
|
3455
|
-
onChange
|
|
3259
|
+
onChange(event.result);
|
|
3456
3260
|
} else {
|
|
3457
3261
|
throw new Error(`Unknown event ${JSON.stringify(event)}`);
|
|
3458
3262
|
}
|
|
@@ -3460,8 +3264,7 @@ function VariablesProvider({
|
|
|
3460
3264
|
variables: value,
|
|
3461
3265
|
isEditing: typeof editing !== "undefined",
|
|
3462
3266
|
events,
|
|
3463
|
-
canDispatch: true
|
|
3464
|
-
readOnly
|
|
3267
|
+
canDispatch: true
|
|
3465
3268
|
};
|
|
3466
3269
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
|
|
3467
3270
|
children,
|
|
@@ -3471,7 +3274,7 @@ function VariablesProvider({
|
|
|
3471
3274
|
onSubmit: (val) => {
|
|
3472
3275
|
setEditing(void 0);
|
|
3473
3276
|
const { name, ...varValue } = val;
|
|
3474
|
-
onChange
|
|
3277
|
+
onChange({ ...value, [name]: varValue });
|
|
3475
3278
|
events.emit("update", name);
|
|
3476
3279
|
},
|
|
3477
3280
|
onCancel: () => setEditing(void 0),
|
|
@@ -3510,7 +3313,7 @@ function flattenVariables(variables) {
|
|
|
3510
3313
|
// src/components/Variables/useOnVariableUpdated.ts
|
|
3511
3314
|
function useOnVariableUpdated(fn2, disabled) {
|
|
3512
3315
|
const { variables, events } = useVariables();
|
|
3513
|
-
(0,
|
|
3316
|
+
(0, import_react30.useEffect)(() => {
|
|
3514
3317
|
if (disabled) {
|
|
3515
3318
|
return;
|
|
3516
3319
|
}
|
|
@@ -3519,9 +3322,6 @@ function useOnVariableUpdated(fn2, disabled) {
|
|
|
3519
3322
|
}, [disabled, events, fn2, variables]);
|
|
3520
3323
|
}
|
|
3521
3324
|
|
|
3522
|
-
// src/components/Variables/variablesToGroupedList.ts
|
|
3523
|
-
init_emotion_jsx_shim();
|
|
3524
|
-
|
|
3525
3325
|
// src/components/Variables/variablesToList.ts
|
|
3526
3326
|
init_emotion_jsx_shim();
|
|
3527
3327
|
function variablesToList(variables) {
|
|
@@ -3541,474 +3341,180 @@ function variablesToList(variables) {
|
|
|
3541
3341
|
}));
|
|
3542
3342
|
}
|
|
3543
3343
|
|
|
3544
|
-
// src/components/Variables/variablesToGroupedList.ts
|
|
3545
|
-
function variablesToGroupedList(variables) {
|
|
3546
|
-
const groups = {};
|
|
3547
|
-
Object.entries(variables || {}).forEach(([name, definition]) => {
|
|
3548
|
-
var _a;
|
|
3549
|
-
const group = (_a = definition.source) != null ? _a : "";
|
|
3550
|
-
if (!groups[group]) {
|
|
3551
|
-
groups[group] = {};
|
|
3552
|
-
}
|
|
3553
|
-
groups[group][name] = definition;
|
|
3554
|
-
});
|
|
3555
|
-
return Object.entries(groups).map(([group, variables2]) => ({
|
|
3556
|
-
name: group,
|
|
3557
|
-
variables: variablesToList(variables2)
|
|
3558
|
-
})).sort((a2, b2) => {
|
|
3559
|
-
var _a, _b;
|
|
3560
|
-
return ((_a = a2.name) != null ? _a : "").localeCompare((_b = b2.name) != null ? _b : "");
|
|
3561
|
-
});
|
|
3562
|
-
}
|
|
3563
|
-
|
|
3564
|
-
// src/components/Variables/composer/VariableNode.tsx
|
|
3565
|
-
init_emotion_jsx_shim();
|
|
3566
|
-
var import_design_system15 = require("@uniformdev/design-system");
|
|
3567
|
-
var import_lexical2 = require("lexical");
|
|
3568
|
-
var import_react34 = require("react");
|
|
3569
|
-
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
3570
|
-
var VariableNode = class extends import_lexical2.DecoratorNode {
|
|
3571
|
-
constructor(reference, state, key) {
|
|
3572
|
-
super(key);
|
|
3573
|
-
this.reference = reference;
|
|
3574
|
-
this.__state = state;
|
|
3575
|
-
}
|
|
3576
|
-
static getType() {
|
|
3577
|
-
return "variable";
|
|
3578
|
-
}
|
|
3579
|
-
static clone(node) {
|
|
3580
|
-
return new VariableNode(node.reference, { ...node.__state }, node.__key);
|
|
3581
|
-
}
|
|
3582
|
-
/** Imports the node from serialized JSON (i.e. the data provided to the editor's initial state) */
|
|
3583
|
-
static importJSON(serializedNode) {
|
|
3584
|
-
return $createVariableNode(serializedNode.reference, {
|
|
3585
|
-
displayName: serializedNode.reference,
|
|
3586
|
-
referenceIsValid: true,
|
|
3587
|
-
hasClickEvent: void 0
|
|
3588
|
-
});
|
|
3589
|
-
}
|
|
3590
|
-
/**
|
|
3591
|
-
* Updates the node's variables state so it knows its current validity, display name, etc
|
|
3592
|
-
* The plugin updates this whenever the variables prop changes.
|
|
3593
|
-
*/
|
|
3594
|
-
setState(state) {
|
|
3595
|
-
this.getWritable().__state = state;
|
|
3596
|
-
}
|
|
3597
|
-
/**
|
|
3598
|
-
* Serializes the node to JSON for editor initial state
|
|
3599
|
-
*/
|
|
3600
|
-
exportJSON() {
|
|
3601
|
-
return {
|
|
3602
|
-
reference: this.reference,
|
|
3603
|
-
type: VariableNode.getType(),
|
|
3604
|
-
version: 1
|
|
3605
|
-
};
|
|
3606
|
-
}
|
|
3607
|
-
/**
|
|
3608
|
-
* Copy variable to clipboard in a format we will read back if pasted
|
|
3609
|
-
* (albeit it won't get the fancy chip-node)
|
|
3610
|
-
*/
|
|
3611
|
-
getTextContent() {
|
|
3612
|
-
return `\${${this.reference}}`;
|
|
3613
|
-
}
|
|
3614
|
-
/** Creates the DOM wrapper that hosts the node */
|
|
3615
|
-
createDOM() {
|
|
3616
|
-
return document.createElement("span");
|
|
3617
|
-
}
|
|
3618
|
-
updateDOM() {
|
|
3619
|
-
return false;
|
|
3620
|
-
}
|
|
3621
|
-
/**
|
|
3622
|
-
* Render the variable node using React.
|
|
3623
|
-
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
3624
|
-
* rely on Context, etc in this renderer.
|
|
3625
|
-
*/
|
|
3626
|
-
decorate(editor) {
|
|
3627
|
-
const { displayName, hasClickEvent, referenceIsValid } = this.__state;
|
|
3628
|
-
const Wrapper = referenceIsValid ? import_react34.Fragment : UndefinedVariableReference;
|
|
3629
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3630
|
-
import_design_system15.Chip,
|
|
3631
|
-
{
|
|
3632
|
-
text: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || this.reference }),
|
|
3633
|
-
title: !referenceIsValid ? `${this.reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0,
|
|
3634
|
-
onClick: () => {
|
|
3635
|
-
editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
|
|
3636
|
-
reference: this.reference
|
|
3637
|
-
});
|
|
3638
|
-
}
|
|
3639
|
-
}
|
|
3640
|
-
);
|
|
3641
|
-
}
|
|
3642
|
-
/** Enables keyboard navigation to hop over the node to previous text */
|
|
3643
|
-
isIsolated() {
|
|
3644
|
-
return true;
|
|
3645
|
-
}
|
|
3646
|
-
};
|
|
3647
|
-
function $createVariableNode(variableReference, state) {
|
|
3648
|
-
return new VariableNode(variableReference, state);
|
|
3649
|
-
}
|
|
3650
|
-
function UndefinedVariableReference({ children }) {
|
|
3651
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3652
|
-
"span",
|
|
3653
|
-
{
|
|
3654
|
-
style: {
|
|
3655
|
-
textDecoration: "underline",
|
|
3656
|
-
textDecorationStyle: "wavy",
|
|
3657
|
-
textDecorationColor: "red"
|
|
3658
|
-
},
|
|
3659
|
-
children
|
|
3660
|
-
}
|
|
3661
|
-
);
|
|
3662
|
-
}
|
|
3663
|
-
|
|
3664
|
-
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3665
|
-
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
3666
|
-
var EDIT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:edit-variable");
|
|
3667
|
-
var INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:insert-variable");
|
|
3668
|
-
var PUNCTUATION = `\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;
|
|
3669
|
-
var NAME = "\\b[A-Z][^\\s" + PUNCTUATION + "]";
|
|
3670
|
-
var DocumentVariablesRegex = {
|
|
3671
|
-
NAME,
|
|
3672
|
-
PUNCTUATION
|
|
3673
|
-
};
|
|
3674
|
-
var PUNC = DocumentVariablesRegex.PUNCTUATION;
|
|
3675
|
-
var TRIGGERS = ["$"].join("");
|
|
3676
|
-
var VALID_CHARS = "[^" + TRIGGERS + PUNC + "\\s]";
|
|
3677
|
-
var VALID_JOINS = "(?:\\.[ |$]| |[" + PUNC + "]|)";
|
|
3678
|
-
var LENGTH_LIMIT = 75;
|
|
3679
|
-
var DollarSignVariablesRegex = new RegExp(
|
|
3680
|
-
"(^.*)([" + TRIGGERS + "]((?:" + VALID_CHARS + VALID_JOINS + "){0," + LENGTH_LIMIT + "}))$"
|
|
3681
|
-
);
|
|
3682
|
-
function getPossibleQueryMatch(text) {
|
|
3683
|
-
const match = DollarSignVariablesRegex.exec(text);
|
|
3684
|
-
if (match !== null) {
|
|
3685
|
-
const maybeLeadingWhitespace = match[1];
|
|
3686
|
-
const matchingString = match[3];
|
|
3687
|
-
return {
|
|
3688
|
-
leadOffset: match.index + maybeLeadingWhitespace.length,
|
|
3689
|
-
matchingString,
|
|
3690
|
-
replaceableString: match[2]
|
|
3691
|
-
};
|
|
3692
|
-
}
|
|
3693
|
-
return null;
|
|
3694
|
-
}
|
|
3695
|
-
var ADD_VARIABLE_OPTION = "$$add-variable$$";
|
|
3696
|
-
var SOURCE_SEPARATOR = "--";
|
|
3697
|
-
function VariablesPlugin({
|
|
3698
|
-
disableVariables,
|
|
3699
|
-
showAddVariableMenuOption,
|
|
3700
|
-
enableEditingVariables
|
|
3701
|
-
}) {
|
|
3702
|
-
const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
|
|
3703
|
-
const { variables, dispatch, isEditing, canDispatch, readOnly } = useVariables();
|
|
3704
|
-
const canEditVariable = canDispatch && enableEditingVariables && !readOnly;
|
|
3705
|
-
const canAddVariable = canDispatch && showAddVariableMenuOption && !readOnly;
|
|
3706
|
-
const [openedAdd, setOpenedAdd] = (0, import_react36.useState)(false);
|
|
3707
|
-
useOnVariableUpdated((varName) => {
|
|
3708
|
-
editor.update(() => {
|
|
3709
|
-
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, { reference: varName });
|
|
3710
|
-
});
|
|
3711
|
-
}, !openedAdd);
|
|
3712
|
-
(0, import_react36.useEffect)(() => {
|
|
3713
|
-
if (openedAdd && !isEditing) {
|
|
3714
|
-
setOpenedAdd(false);
|
|
3715
|
-
}
|
|
3716
|
-
}, [isEditing, openedAdd]);
|
|
3717
|
-
const [queryString, setQueryString] = (0, import_react36.useState)(null);
|
|
3718
|
-
const { groupedVariables, menuOptions } = (0, import_react36.useMemo)(() => {
|
|
3719
|
-
const groupedVariables2 = variablesToGroupedList(variables);
|
|
3720
|
-
if (canAddVariable) {
|
|
3721
|
-
groupedVariables2.push({
|
|
3722
|
-
name: SOURCE_SEPARATOR,
|
|
3723
|
-
variables: [{ name: ADD_VARIABLE_OPTION, displayName: "Add\u2026", default: "" }]
|
|
3724
|
-
});
|
|
3725
|
-
}
|
|
3726
|
-
const menuOptions2 = [];
|
|
3727
|
-
groupedVariables2.forEach(
|
|
3728
|
-
(group) => group.variables.forEach((variable) => {
|
|
3729
|
-
menuOptions2.push(new import_LexicalTypeaheadMenuPlugin.MenuOption(variable.name));
|
|
3730
|
-
})
|
|
3731
|
-
);
|
|
3732
|
-
return { menuOptions: menuOptions2, groupedVariables: groupedVariables2 };
|
|
3733
|
-
}, [variables, canAddVariable]);
|
|
3734
|
-
const { filteredGroupedVariables, filteredMenuOptions } = (0, import_react36.useMemo)(() => {
|
|
3735
|
-
if (!queryString) {
|
|
3736
|
-
return {
|
|
3737
|
-
filteredGroupedVariables: groupedVariables,
|
|
3738
|
-
filteredMenuOptions: menuOptions
|
|
3739
|
-
};
|
|
3740
|
-
}
|
|
3741
|
-
const query = queryString.toLowerCase();
|
|
3742
|
-
return {
|
|
3743
|
-
filteredGroupedVariables: groupedVariables.map((group) => ({
|
|
3744
|
-
name: group.name,
|
|
3745
|
-
variables: group.variables.filter(
|
|
3746
|
-
(option) => option.name.toLowerCase().includes(query) || option.name === ADD_VARIABLE_OPTION
|
|
3747
|
-
)
|
|
3748
|
-
})).filter((group) => group.variables.length > 0),
|
|
3749
|
-
filteredMenuOptions: menuOptions.filter(
|
|
3750
|
-
(option) => option.key.includes(query) || option.key === ADD_VARIABLE_OPTION
|
|
3751
|
-
)
|
|
3752
|
-
};
|
|
3753
|
-
}, [queryString, groupedVariables, menuOptions]);
|
|
3754
|
-
const onSelectOption = (0, import_react36.useCallback)(
|
|
3755
|
-
(selectedOption, nodeToReplace, closeMenu) => {
|
|
3756
|
-
if (selectedOption.key === ADD_VARIABLE_OPTION) {
|
|
3757
|
-
setOpenedAdd(true);
|
|
3758
|
-
editor.update(() => {
|
|
3759
|
-
nodeToReplace == null ? void 0 : nodeToReplace.remove();
|
|
3760
|
-
});
|
|
3761
|
-
editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
|
|
3762
|
-
reference: queryString != null ? queryString : ""
|
|
3763
|
-
});
|
|
3764
|
-
} else {
|
|
3765
|
-
editor.update(() => {
|
|
3766
|
-
var _a;
|
|
3767
|
-
const variableNode = $createVariableNode(selectedOption.key, {
|
|
3768
|
-
displayName: ((_a = variables[selectedOption.key]) == null ? void 0 : _a.displayName) || selectedOption.key,
|
|
3769
|
-
hasClickEvent: canEditVariable,
|
|
3770
|
-
referenceIsValid: Boolean(variables[selectedOption.key])
|
|
3771
|
-
});
|
|
3772
|
-
if (nodeToReplace) {
|
|
3773
|
-
nodeToReplace.replace(variableNode);
|
|
3774
|
-
}
|
|
3775
|
-
});
|
|
3776
|
-
}
|
|
3777
|
-
closeMenu();
|
|
3778
|
-
},
|
|
3779
|
-
[editor, queryString, variables, canEditVariable]
|
|
3780
|
-
);
|
|
3781
|
-
(0, import_react36.useEffect)(() => {
|
|
3782
|
-
editor.registerCommand(
|
|
3783
|
-
EDIT_VARIABLE_COMMAND,
|
|
3784
|
-
({ reference }) => {
|
|
3785
|
-
if (!disableVariables && canEditVariable) {
|
|
3786
|
-
dispatch({ type: "edit", variable: reference });
|
|
3787
|
-
}
|
|
3788
|
-
return true;
|
|
3789
|
-
},
|
|
3790
|
-
import_lexical3.COMMAND_PRIORITY_NORMAL
|
|
3791
|
-
);
|
|
3792
|
-
editor.registerCommand(
|
|
3793
|
-
INSERT_VARIABLE_COMMAND,
|
|
3794
|
-
({ reference }) => {
|
|
3795
|
-
var _a;
|
|
3796
|
-
if (!disableVariables) {
|
|
3797
|
-
const variableNode = $createVariableNode(reference, {
|
|
3798
|
-
displayName: ((_a = variables[reference]) == null ? void 0 : _a.displayName) || reference,
|
|
3799
|
-
hasClickEvent: canEditVariable,
|
|
3800
|
-
referenceIsValid: Boolean(variables[reference])
|
|
3801
|
-
});
|
|
3802
|
-
(0, import_lexical3.$insertNodes)([variableNode]);
|
|
3803
|
-
}
|
|
3804
|
-
return true;
|
|
3805
|
-
},
|
|
3806
|
-
import_lexical3.COMMAND_PRIORITY_NORMAL
|
|
3807
|
-
);
|
|
3808
|
-
}, [editor, disableVariables, variables, canDispatch, dispatch, canEditVariable, readOnly]);
|
|
3809
|
-
(0, import_react36.useEffect)(() => {
|
|
3810
|
-
editor.update(() => {
|
|
3811
|
-
(0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
|
|
3812
|
-
const targetVar = variables[variableNode.reference];
|
|
3813
|
-
variableNode.setState({
|
|
3814
|
-
displayName: (targetVar == null ? void 0 : targetVar.displayName) || variableNode.reference,
|
|
3815
|
-
hasClickEvent: canEditVariable,
|
|
3816
|
-
referenceIsValid: Boolean(targetVar)
|
|
3817
|
-
});
|
|
3818
|
-
});
|
|
3819
|
-
});
|
|
3820
|
-
}, [editor, variables, canEditVariable]);
|
|
3821
|
-
if (disableVariables) {
|
|
3822
|
-
return null;
|
|
3823
|
-
}
|
|
3824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3825
|
-
import_LexicalTypeaheadMenuPlugin.LexicalTypeaheadMenuPlugin,
|
|
3826
|
-
{
|
|
3827
|
-
onQueryChange: setQueryString,
|
|
3828
|
-
onSelectOption,
|
|
3829
|
-
triggerFn: getPossibleQueryMatch,
|
|
3830
|
-
options: filteredMenuOptions,
|
|
3831
|
-
menuRenderFn: (anchorElementRef, { selectOptionAndCleanUp, setHighlightedIndex, selectedIndex }) => {
|
|
3832
|
-
if (!anchorElementRef.current || groupedVariables.length === 0 || openedAdd) {
|
|
3833
|
-
return null;
|
|
3834
|
-
}
|
|
3835
|
-
let currentCumulativeMenuIndex = -1;
|
|
3836
|
-
return (0, import_react_dom.createPortal)(
|
|
3837
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3838
|
-
"div",
|
|
3839
|
-
{
|
|
3840
|
-
css: import_react35.css`
|
|
3841
|
-
box-shadow: var(--shadow-base);
|
|
3842
|
-
border-radius: var(--rounded-base);
|
|
3843
|
-
background: var(--gray-50);
|
|
3844
|
-
display: flex;
|
|
3845
|
-
flex-direction: column;
|
|
3846
|
-
// 1em = text height, spacing-sm for padding, to prevent menu overlapping text entry
|
|
3847
|
-
margin-top: calc(1em + var(--spacing-sm));
|
|
3848
|
-
min-width: 250px;
|
|
3849
|
-
padding: var(--spacing-sm);
|
|
3850
|
-
outline: none;
|
|
3851
|
-
overflow: hidden;
|
|
3852
|
-
position: relative;
|
|
3853
|
-
z-index: var(--z-50);
|
|
3854
|
-
`,
|
|
3855
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: filteredGroupedVariables.map((group, index) => {
|
|
3856
|
-
var _a, _b;
|
|
3857
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3858
|
-
import_design_system16.MenuGroup,
|
|
3859
|
-
{
|
|
3860
|
-
title: group.name === SOURCE_SEPARATOR ? "" : (_a = group.name) != null ? _a : "",
|
|
3861
|
-
children: [
|
|
3862
|
-
group.name === SOURCE_SEPARATOR && currentCumulativeMenuIndex > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system16.MenuItemSeparator, {}) : null,
|
|
3863
|
-
group.variables.map((variable) => {
|
|
3864
|
-
var _a2;
|
|
3865
|
-
currentCumulativeMenuIndex++;
|
|
3866
|
-
const myCumulativeIndex = currentCumulativeMenuIndex;
|
|
3867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3868
|
-
import_design_system16.MenuItem,
|
|
3869
|
-
{
|
|
3870
|
-
active: selectedIndex === myCumulativeIndex,
|
|
3871
|
-
onClick: () => {
|
|
3872
|
-
setHighlightedIndex(myCumulativeIndex);
|
|
3873
|
-
selectOptionAndCleanUp(new import_LexicalTypeaheadMenuPlugin.MenuOption(variable.name));
|
|
3874
|
-
},
|
|
3875
|
-
onMouseEnter: () => {
|
|
3876
|
-
setHighlightedIndex(myCumulativeIndex);
|
|
3877
|
-
},
|
|
3878
|
-
css: menuItemTextGroup,
|
|
3879
|
-
children: [
|
|
3880
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: (_a2 = variable.displayName) != null ? _a2 : variable.name }),
|
|
3881
|
-
variable.helpText ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("small", { css: smallText, children: variable.helpText }) : null
|
|
3882
|
-
]
|
|
3883
|
-
},
|
|
3884
|
-
variable.name
|
|
3885
|
-
);
|
|
3886
|
-
})
|
|
3887
|
-
]
|
|
3888
|
-
},
|
|
3889
|
-
(_b = group.name) != null ? _b : `none${index}`
|
|
3890
|
-
);
|
|
3891
|
-
}) })
|
|
3892
|
-
}
|
|
3893
|
-
),
|
|
3894
|
-
anchorElementRef.current
|
|
3895
|
-
);
|
|
3896
|
-
}
|
|
3897
|
-
}
|
|
3898
|
-
);
|
|
3899
|
-
}
|
|
3900
|
-
|
|
3901
3344
|
// src/components/Variables/SelectVariableMenu.tsx
|
|
3902
|
-
|
|
3903
|
-
var import_design_system17 = require("@uniformdev/design-system");
|
|
3904
|
-
var import_react37 = require("react");
|
|
3905
|
-
var import_cg5 = require("react-icons/cg");
|
|
3906
|
-
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
3345
|
+
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
3907
3346
|
var SelectVariableMenu = ({
|
|
3908
3347
|
onSelectVariable,
|
|
3909
3348
|
onResetVariables,
|
|
3910
3349
|
showAddVariableMenuOption = false,
|
|
3350
|
+
forceVisible,
|
|
3911
3351
|
buttonCss,
|
|
3912
3352
|
buttonProps,
|
|
3913
3353
|
tip
|
|
3914
3354
|
}) => {
|
|
3915
3355
|
const { variables, dispatch, isEditing, canDispatch } = useVariables();
|
|
3916
|
-
const btnRef = (0,
|
|
3917
|
-
const [openedAdd, setOpenedAdd] = (0,
|
|
3356
|
+
const btnRef = (0, import_react31.useRef)(null);
|
|
3357
|
+
const [openedAdd, setOpenedAdd] = (0, import_react31.useState)(false);
|
|
3918
3358
|
useOnVariableUpdated((varName) => {
|
|
3919
3359
|
onSelectVariable == null ? void 0 : onSelectVariable({ name: varName, default: "" });
|
|
3920
3360
|
}, !openedAdd);
|
|
3921
|
-
(0,
|
|
3361
|
+
(0, import_react31.useEffect)(() => {
|
|
3922
3362
|
if (openedAdd && !isEditing) {
|
|
3923
3363
|
setOpenedAdd(false);
|
|
3924
3364
|
}
|
|
3925
3365
|
}, [isEditing, openedAdd]);
|
|
3926
|
-
const
|
|
3366
|
+
const variablesList = variablesToList(variables);
|
|
3927
3367
|
const menuHasVariableOptions = Object.entries(variables).length || showAddVariableMenuOption;
|
|
3928
|
-
return /* @__PURE__ */ (0,
|
|
3929
|
-
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3369
|
+
import_design_system15.Menu,
|
|
3930
3370
|
{
|
|
3931
3371
|
placement: "bottom-start",
|
|
3932
|
-
|
|
3372
|
+
forceVisible,
|
|
3373
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3933
3374
|
"button",
|
|
3934
3375
|
{
|
|
3935
3376
|
title: "Insert variable",
|
|
3936
3377
|
...buttonProps,
|
|
3937
3378
|
ref: btnRef,
|
|
3938
|
-
css: [
|
|
3379
|
+
css: [menuBtn, buttonCss],
|
|
3939
3380
|
type: "button",
|
|
3940
|
-
children: /* @__PURE__ */ (0,
|
|
3381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_cg5.CgUsbC, { size: "1.4rem" })
|
|
3941
3382
|
}
|
|
3942
3383
|
),
|
|
3943
3384
|
menuLabel: "Insert variable",
|
|
3944
3385
|
children: [
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
return /* @__PURE__ */ (0,
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
children:
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
name
|
|
3961
|
-
);
|
|
3962
|
-
}) }, group.name);
|
|
3386
|
+
variablesList.map((variable) => {
|
|
3387
|
+
const { name, helpText } = variable;
|
|
3388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3389
|
+
import_design_system15.MenuItem,
|
|
3390
|
+
{
|
|
3391
|
+
id: name,
|
|
3392
|
+
css: menuItemTextGroup,
|
|
3393
|
+
onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
|
|
3394
|
+
children: [
|
|
3395
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: name }),
|
|
3396
|
+
helpText ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("small", { css: smallText, children: helpText }) : null
|
|
3397
|
+
]
|
|
3398
|
+
},
|
|
3399
|
+
name
|
|
3400
|
+
);
|
|
3963
3401
|
}),
|
|
3964
|
-
showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ (0,
|
|
3965
|
-
|
|
3966
|
-
/* @__PURE__ */ (0,
|
|
3967
|
-
|
|
3402
|
+
showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3403
|
+
variablesList.length ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.MenuItemSeparator, {}) : null,
|
|
3404
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3405
|
+
import_design_system15.MenuItem,
|
|
3968
3406
|
{
|
|
3969
3407
|
onClick: () => {
|
|
3970
3408
|
setOpenedAdd(true);
|
|
3971
3409
|
dispatch({ type: "edit", variable: "" });
|
|
3972
3410
|
},
|
|
3973
|
-
children: "Add
|
|
3411
|
+
children: "Add Variable"
|
|
3974
3412
|
}
|
|
3975
3413
|
)
|
|
3976
3414
|
] }) : null,
|
|
3977
|
-
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0,
|
|
3978
|
-
onResetVariables ? /* @__PURE__ */ (0,
|
|
3979
|
-
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0,
|
|
3980
|
-
tip ? /* @__PURE__ */ (0,
|
|
3415
|
+
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.MenuItemSeparator, {}) : null,
|
|
3416
|
+
onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.MenuItem, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
|
|
3417
|
+
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.MenuItemSeparator, {}) : null,
|
|
3418
|
+
tip ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("i", { css: variablesTipText, children: tip }) : null
|
|
3981
3419
|
]
|
|
3982
3420
|
}
|
|
3983
3421
|
);
|
|
3984
3422
|
};
|
|
3985
3423
|
|
|
3986
|
-
// src/components/Variables/
|
|
3987
|
-
|
|
3988
|
-
var
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
3424
|
+
// src/components/Variables/styles/InputVariables.styles.ts
|
|
3425
|
+
init_emotion_jsx_shim();
|
|
3426
|
+
var import_react32 = require("@emotion/react");
|
|
3427
|
+
var menuContainer = import_react32.css`
|
|
3428
|
+
position: relative;
|
|
3429
|
+
`;
|
|
3430
|
+
var menuBtn2 = import_react32.css`
|
|
3431
|
+
position: absolute;
|
|
3432
|
+
bottom: 25%;
|
|
3433
|
+
right: var(--spacing-sm);
|
|
3434
|
+
`;
|
|
3435
|
+
|
|
3436
|
+
// src/components/Variables/util/getReferencedVariables.ts
|
|
3437
|
+
init_emotion_jsx_shim();
|
|
3438
|
+
|
|
3439
|
+
// src/components/Variables/util/variableExpression.ts
|
|
3440
|
+
init_emotion_jsx_shim();
|
|
3441
|
+
var variableExpression = /(?<!\\)\${([^}]+)}/g;
|
|
3442
|
+
var variablePrefix = "${";
|
|
3443
|
+
var variableSuffix = "}";
|
|
3444
|
+
|
|
3445
|
+
// src/components/Variables/util/getReferencedVariables.ts
|
|
3446
|
+
function getReferencedVariables(value) {
|
|
3447
|
+
const result = [];
|
|
3448
|
+
for (const match of value.matchAll(variableExpression)) {
|
|
3449
|
+
result.push(match[1]);
|
|
3450
|
+
}
|
|
3451
|
+
return result;
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
// src/components/Variables/util/insertVariableIntoText.ts
|
|
3455
|
+
init_emotion_jsx_shim();
|
|
3456
|
+
function insertVariableIntoText({
|
|
3457
|
+
variableName: variableName2,
|
|
3458
|
+
value,
|
|
3459
|
+
selectionStart = null,
|
|
3460
|
+
selectionEnd = null
|
|
3461
|
+
}) {
|
|
3462
|
+
const variableExpression2 = `${variablePrefix}${variableName2}${variableSuffix}`;
|
|
3463
|
+
if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
|
|
3464
|
+
return `${value.substring(0, selectionStart)}${variableExpression2}${value.substring(selectionEnd)}`;
|
|
3465
|
+
}
|
|
3466
|
+
const hasCursorPosition = selectionStart !== null;
|
|
3467
|
+
let startOffset = 0;
|
|
3468
|
+
if (hasCursorPosition && value.substring(selectionStart - variablePrefix.length, selectionStart) === variablePrefix) {
|
|
3469
|
+
startOffset = variablePrefix.length;
|
|
3470
|
+
}
|
|
3471
|
+
if (hasCursorPosition) {
|
|
3472
|
+
return `${value.substring(0, selectionStart - startOffset)}${variableExpression2}${value.substring(
|
|
3473
|
+
selectionStart
|
|
3474
|
+
)}`;
|
|
3475
|
+
}
|
|
3476
|
+
return `${value}${variableExpression2}`;
|
|
3477
|
+
}
|
|
4009
3478
|
|
|
4010
3479
|
// src/components/Variables/VariableField.tsx
|
|
4011
|
-
|
|
3480
|
+
init_emotion_jsx_shim();
|
|
3481
|
+
|
|
3482
|
+
// src/components/Variables/styles/VariableField.styles.ts
|
|
3483
|
+
init_emotion_jsx_shim();
|
|
3484
|
+
var import_react33 = require("@emotion/react");
|
|
3485
|
+
var labelText = import_react33.css`
|
|
3486
|
+
align-items: center;
|
|
3487
|
+
display: flex;
|
|
3488
|
+
gap: var(--spacing-xs);
|
|
3489
|
+
font-weight: var(--fw-regular);
|
|
3490
|
+
margin: 0 0 var(--spacing-xs);
|
|
3491
|
+
`;
|
|
3492
|
+
var variableBindButton = import_react33.css`
|
|
3493
|
+
align-items: center;
|
|
3494
|
+
border: none;
|
|
3495
|
+
border-radius: var(--rounded-base);
|
|
3496
|
+
background: none;
|
|
3497
|
+
display: flex;
|
|
3498
|
+
height: 1.2rem;
|
|
3499
|
+
padding: var(--spacing-2xs);
|
|
3500
|
+
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3501
|
+
color var(--duration-fast) var(--timing-ease-out);
|
|
3502
|
+
width: 1.2rem;
|
|
3503
|
+
|
|
3504
|
+
&:hover,
|
|
3505
|
+
&[aria-pressed='true']:not(:disabled) {
|
|
3506
|
+
background: var(--brand-secondary-3);
|
|
3507
|
+
color: var(--white);
|
|
3508
|
+
}
|
|
3509
|
+
|
|
3510
|
+
&[aria-disabled='true'] {
|
|
3511
|
+
background: none;
|
|
3512
|
+
color: currentColor;
|
|
3513
|
+
}
|
|
3514
|
+
`;
|
|
3515
|
+
|
|
3516
|
+
// src/components/Variables/VariableField.tsx
|
|
3517
|
+
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
4012
3518
|
function VariableField({
|
|
4013
3519
|
label,
|
|
4014
3520
|
selectVariableMenuOptions,
|
|
@@ -4019,191 +3525,25 @@ function VariableField({
|
|
|
4019
3525
|
}) {
|
|
4020
3526
|
const { variables } = useVariables(true);
|
|
4021
3527
|
const varCount = Object.keys(variables).length;
|
|
4022
|
-
const variableSelector = varCount > 0 && !disableVariables ? /* @__PURE__ */ (0,
|
|
4023
|
-
|
|
3528
|
+
const variableSelector = varCount > 0 && (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.onSelectVariable) && !disableVariables ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3529
|
+
SelectVariableMenu,
|
|
4024
3530
|
{
|
|
4025
3531
|
...selectVariableMenuOptions,
|
|
4026
3532
|
buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
|
|
4027
3533
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
4028
3534
|
}
|
|
4029
3535
|
) : null;
|
|
4030
|
-
return /* @__PURE__ */ (0,
|
|
4031
|
-
/* @__PURE__ */ (0,
|
|
3536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
3537
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { htmlFor: id, css: labelText, children: [
|
|
4032
3538
|
variableSelector,
|
|
4033
|
-
/* @__PURE__ */ (0,
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: label })
|
|
4034
3540
|
] }),
|
|
4035
3541
|
children
|
|
4036
3542
|
] });
|
|
4037
3543
|
}
|
|
4038
3544
|
|
|
4039
|
-
// src/components/Variables/VariablesComposer.tsx
|
|
4040
|
-
init_emotion_jsx_shim();
|
|
4041
|
-
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
4042
|
-
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
4043
|
-
var import_LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
|
|
4044
|
-
var import_LexicalErrorBoundary = __toESM(require("@lexical/react/LexicalErrorBoundary"));
|
|
4045
|
-
var import_LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
|
|
4046
|
-
var import_LexicalPlainTextPlugin = require("@lexical/react/LexicalPlainTextPlugin");
|
|
4047
|
-
var import_lexical6 = require("lexical");
|
|
4048
|
-
var import_react40 = require("react");
|
|
4049
|
-
var import_uuid2 = require("uuid");
|
|
4050
|
-
|
|
4051
|
-
// src/components/Variables/composer/DisablePlugin.tsx
|
|
4052
|
-
init_emotion_jsx_shim();
|
|
4053
|
-
var import_LexicalComposerContext4 = require("@lexical/react/LexicalComposerContext");
|
|
4054
|
-
var import_react38 = require("react");
|
|
4055
|
-
function DisablePlugin({ disabled }) {
|
|
4056
|
-
const [editor] = (0, import_LexicalComposerContext4.useLexicalComposerContext)();
|
|
4057
|
-
(0, import_react38.useEffect)(() => {
|
|
4058
|
-
editor.setEditable(!disabled);
|
|
4059
|
-
}, [editor, disabled]);
|
|
4060
|
-
return null;
|
|
4061
|
-
}
|
|
4062
|
-
|
|
4063
|
-
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4064
|
-
init_emotion_jsx_shim();
|
|
4065
|
-
var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
|
|
4066
|
-
var import_lexical5 = require("lexical");
|
|
4067
|
-
var import_react39 = require("react");
|
|
4068
|
-
function SingleLineTextPlugin() {
|
|
4069
|
-
const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
|
|
4070
|
-
(0, import_react39.useEffect)(() => {
|
|
4071
|
-
editor.registerNodeTransform(import_lexical5.LineBreakNode, (node) => {
|
|
4072
|
-
node.remove();
|
|
4073
|
-
});
|
|
4074
|
-
}, [editor]);
|
|
4075
|
-
return null;
|
|
4076
|
-
}
|
|
4077
|
-
|
|
4078
|
-
// src/components/Variables/VariablesComposer.tsx
|
|
4079
|
-
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4080
|
-
function VariablesComposer(props) {
|
|
4081
|
-
const { value, children, onChange, disabled, disableVariables, ...variablesPluginProps } = props;
|
|
4082
|
-
const [namespace] = (0, import_react40.useState)((0, import_uuid2.v4)());
|
|
4083
|
-
const [lastEmittedValue, setLastEmittedValue] = (0, import_react40.useState)(value);
|
|
4084
|
-
const editorConfig = (0, import_react40.useMemo)(
|
|
4085
|
-
() => ({
|
|
4086
|
-
namespace,
|
|
4087
|
-
onError(error) {
|
|
4088
|
-
throw error;
|
|
4089
|
-
},
|
|
4090
|
-
nodes: [VariableNode],
|
|
4091
|
-
editorState: deserializeEditorState(props.value)
|
|
4092
|
-
}),
|
|
4093
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4094
|
-
[namespace]
|
|
4095
|
-
);
|
|
4096
|
-
const editorState = (0, import_react40.useRef)();
|
|
4097
|
-
const updateTimeout = (0, import_react40.useRef)();
|
|
4098
|
-
if (typeof document === "undefined")
|
|
4099
|
-
return null;
|
|
4100
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
|
|
4101
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4102
|
-
import_LexicalOnChangePlugin.OnChangePlugin,
|
|
4103
|
-
{
|
|
4104
|
-
onChange: (state) => {
|
|
4105
|
-
editorState.current = state;
|
|
4106
|
-
if (updateTimeout.current) {
|
|
4107
|
-
clearTimeout(updateTimeout.current);
|
|
4108
|
-
}
|
|
4109
|
-
setTimeout(() => {
|
|
4110
|
-
if (editorState.current) {
|
|
4111
|
-
const valueToEmit = serializeEditorState(editorState.current);
|
|
4112
|
-
if (valueToEmit !== lastEmittedValue) {
|
|
4113
|
-
setLastEmittedValue(valueToEmit);
|
|
4114
|
-
onChange(valueToEmit);
|
|
4115
|
-
}
|
|
4116
|
-
}
|
|
4117
|
-
}, 400);
|
|
4118
|
-
}
|
|
4119
|
-
}
|
|
4120
|
-
),
|
|
4121
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SingleLineTextPlugin, {}),
|
|
4122
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_LexicalClearEditorPlugin.ClearEditorPlugin, {}),
|
|
4123
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(VariablesPlugin, { ...variablesPluginProps }),
|
|
4124
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DisablePlugin, { disabled }),
|
|
4125
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children })
|
|
4126
|
-
] });
|
|
4127
|
-
}
|
|
4128
|
-
function VariablesComposerInput(props) {
|
|
4129
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4130
|
-
import_LexicalPlainTextPlugin.PlainTextPlugin,
|
|
4131
|
-
{
|
|
4132
|
-
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_LexicalContentEditable.ContentEditable, { css: input, ...props }),
|
|
4133
|
-
placeholder: null,
|
|
4134
|
-
ErrorBoundary: import_LexicalErrorBoundary.default
|
|
4135
|
-
}
|
|
4136
|
-
) });
|
|
4137
|
-
}
|
|
4138
|
-
function deserializeEditorState(serialized) {
|
|
4139
|
-
const result = [];
|
|
4140
|
-
parseVariableExpression(serialized, (token, type) => {
|
|
4141
|
-
if (type === "text") {
|
|
4142
|
-
const node = {
|
|
4143
|
-
type: import_lexical6.TextNode.getType(),
|
|
4144
|
-
text: token,
|
|
4145
|
-
mode: "normal",
|
|
4146
|
-
version: 1,
|
|
4147
|
-
detail: 0,
|
|
4148
|
-
format: 0,
|
|
4149
|
-
style: ""
|
|
4150
|
-
};
|
|
4151
|
-
result.push(node);
|
|
4152
|
-
}
|
|
4153
|
-
if (type === "variable") {
|
|
4154
|
-
const node = {
|
|
4155
|
-
type: "variable",
|
|
4156
|
-
reference: token,
|
|
4157
|
-
version: 1
|
|
4158
|
-
};
|
|
4159
|
-
result.push(node);
|
|
4160
|
-
}
|
|
4161
|
-
});
|
|
4162
|
-
const rez = JSON.stringify({
|
|
4163
|
-
root: {
|
|
4164
|
-
children: [
|
|
4165
|
-
{
|
|
4166
|
-
children: result,
|
|
4167
|
-
direction: "ltr",
|
|
4168
|
-
format: "",
|
|
4169
|
-
indent: 0,
|
|
4170
|
-
type: "paragraph",
|
|
4171
|
-
version: 1
|
|
4172
|
-
}
|
|
4173
|
-
],
|
|
4174
|
-
direction: "ltr",
|
|
4175
|
-
format: "",
|
|
4176
|
-
indent: 0,
|
|
4177
|
-
type: "root",
|
|
4178
|
-
version: 1
|
|
4179
|
-
}
|
|
4180
|
-
});
|
|
4181
|
-
return rez;
|
|
4182
|
-
}
|
|
4183
|
-
function serializeEditorState(editorState) {
|
|
4184
|
-
const buf = [];
|
|
4185
|
-
serializeRecursive(editorState.toJSON().root, buf);
|
|
4186
|
-
return buf.join("");
|
|
4187
|
-
}
|
|
4188
|
-
function serializeRecursive(node, buffer) {
|
|
4189
|
-
if (node.type === import_lexical6.TextNode.getType()) {
|
|
4190
|
-
buffer.push(node.text);
|
|
4191
|
-
}
|
|
4192
|
-
if (node.type === VariableNode.getType()) {
|
|
4193
|
-
buffer.push(`\${${node.reference}}`);
|
|
4194
|
-
}
|
|
4195
|
-
if (node.type === import_lexical6.LineBreakNode.getType()) {
|
|
4196
|
-
buffer.push("\n");
|
|
4197
|
-
}
|
|
4198
|
-
if ("children" in node && node.children) {
|
|
4199
|
-
for (const child of node.children) {
|
|
4200
|
-
serializeRecursive(child, buffer);
|
|
4201
|
-
}
|
|
4202
|
-
}
|
|
4203
|
-
}
|
|
4204
|
-
|
|
4205
3545
|
// src/components/Variables/InputVariables.tsx
|
|
4206
|
-
var
|
|
3546
|
+
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
4207
3547
|
function InputVariables({
|
|
4208
3548
|
id,
|
|
4209
3549
|
"aria-label": ariaLabel,
|
|
@@ -4211,20 +3551,38 @@ function InputVariables({
|
|
|
4211
3551
|
value,
|
|
4212
3552
|
disableVariables,
|
|
4213
3553
|
disableReset,
|
|
4214
|
-
enableEditingVariables,
|
|
4215
3554
|
disableInlineMenu,
|
|
4216
3555
|
onChange,
|
|
4217
|
-
|
|
3556
|
+
onPaste,
|
|
4218
3557
|
showAddVariableMenuOption,
|
|
4219
3558
|
inputWhenNoVariables,
|
|
4220
3559
|
caption,
|
|
4221
3560
|
errorMessage,
|
|
4222
3561
|
warningMessage,
|
|
4223
3562
|
infoMessage,
|
|
4224
|
-
|
|
3563
|
+
...inputProps
|
|
4225
3564
|
}) {
|
|
3565
|
+
var _a, _b;
|
|
4226
3566
|
const { variables } = useVariables(true);
|
|
4227
|
-
const
|
|
3567
|
+
const inputRef = React11.useRef(null);
|
|
3568
|
+
const [finalId] = React11.useState(id != null ? id : () => (0, import_uuid2.v4)());
|
|
3569
|
+
const onPasteHandler = (e) => {
|
|
3570
|
+
var _a2, _b2, _c;
|
|
3571
|
+
if (!onPaste) {
|
|
3572
|
+
return;
|
|
3573
|
+
}
|
|
3574
|
+
const pastedValue = (_a2 = e.clipboardData) == null ? void 0 : _a2.getData("text/plain");
|
|
3575
|
+
if (!pastedValue || !e.currentTarget) {
|
|
3576
|
+
return;
|
|
3577
|
+
}
|
|
3578
|
+
const selectionStart = (_b2 = e.currentTarget.selectionStart) != null ? _b2 : 0;
|
|
3579
|
+
const selectionEnd = (_c = e.currentTarget.selectionEnd) != null ? _c : 0;
|
|
3580
|
+
const newValue = e.currentTarget.value.substring(0, selectionStart) + pastedValue + e.currentTarget.value.substring(selectionEnd);
|
|
3581
|
+
onPaste(newValue);
|
|
3582
|
+
e.preventDefault();
|
|
3583
|
+
};
|
|
3584
|
+
const currentCursor = (_b = (_a = inputRef.current) == null ? void 0 : _a.selectionStart) != null ? _b : value.length;
|
|
3585
|
+
const forceMenu = value.substring(currentCursor - 2, currentCursor) === variablePrefix;
|
|
4228
3586
|
const hasVariablesInValue = getReferencedVariables(value).length > 0;
|
|
4229
3587
|
const [hadVariablesInValue, setHadVariablesInValue] = React11.useState(hasVariablesInValue);
|
|
4230
3588
|
React11.useEffect(() => {
|
|
@@ -4234,33 +3592,58 @@ function InputVariables({
|
|
|
4234
3592
|
}, [hasVariablesInValue]);
|
|
4235
3593
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4236
3594
|
const disableInlineVariablesForReals = disableVariablesForReals || disableInlineMenu;
|
|
4237
|
-
const
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
3595
|
+
const handleInsertVariable = (variable) => {
|
|
3596
|
+
var _a2, _b2;
|
|
3597
|
+
const baseValue = inputWhenNoVariables && !hasVariablesInValue ? "" : value;
|
|
3598
|
+
handleSetValue(
|
|
3599
|
+
insertVariableIntoText({
|
|
3600
|
+
variableName: variable.name,
|
|
3601
|
+
value: baseValue,
|
|
3602
|
+
selectionEnd: (_a2 = inputRef.current) == null ? void 0 : _a2.selectionEnd,
|
|
3603
|
+
selectionStart: (_b2 = inputRef.current) == null ? void 0 : _b2.selectionStart
|
|
3604
|
+
})
|
|
3605
|
+
);
|
|
3606
|
+
};
|
|
3607
|
+
const handleSetValue = (rawValue) => {
|
|
3608
|
+
onChange(rawValue);
|
|
3609
|
+
};
|
|
3610
|
+
const sharedMenuProps = {
|
|
3611
|
+
onSelectVariable: handleInsertVariable,
|
|
3612
|
+
showAddVariableMenuOption,
|
|
3613
|
+
onResetVariables: hadVariablesInValue && !disableReset ? () => {
|
|
3614
|
+
handleSetValue("");
|
|
3615
|
+
setHadVariablesInValue(false);
|
|
3616
|
+
} : void 0
|
|
3617
|
+
};
|
|
3618
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
3619
|
+
inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3620
|
+
InputVariablesShell,
|
|
4249
3621
|
{
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
3622
|
+
...sharedMenuProps,
|
|
3623
|
+
disabled: disableInlineVariablesForReals,
|
|
3624
|
+
forceVisible: forceMenu || void 0,
|
|
3625
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3626
|
+
import_design_system16.Input,
|
|
3627
|
+
{
|
|
3628
|
+
id: finalId,
|
|
3629
|
+
ref: inputRef,
|
|
3630
|
+
label: ariaLabel,
|
|
3631
|
+
showLabel: false,
|
|
3632
|
+
value,
|
|
3633
|
+
onChange: (e) => handleSetValue(e.currentTarget.value),
|
|
3634
|
+
onPaste: onPasteHandler,
|
|
3635
|
+
...inputProps
|
|
3636
|
+
}
|
|
3637
|
+
)
|
|
4254
3638
|
}
|
|
4255
|
-
)
|
|
4256
|
-
caption ? /* @__PURE__ */ (0,
|
|
4257
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
4258
|
-
warningMessage ? /* @__PURE__ */ (0,
|
|
4259
|
-
infoMessage ? /* @__PURE__ */ (0,
|
|
3639
|
+
),
|
|
3640
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system16.Caption, { children: caption }) : null,
|
|
3641
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system16.ErrorMessage, { message: errorMessage }) : null,
|
|
3642
|
+
warningMessage ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system16.WarningMessage, { message: warningMessage }) : null,
|
|
3643
|
+
infoMessage ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system16.InfoMessage, { message: infoMessage }) : null
|
|
4260
3644
|
] });
|
|
4261
|
-
let body = input2;
|
|
4262
3645
|
if (label) {
|
|
4263
|
-
|
|
3646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4264
3647
|
VariableField,
|
|
4265
3648
|
{
|
|
4266
3649
|
label,
|
|
@@ -4268,56 +3651,36 @@ function InputVariables({
|
|
|
4268
3651
|
id: finalId,
|
|
4269
3652
|
isActive: hadVariablesInValue,
|
|
4270
3653
|
disableVariables: disableVariablesForReals,
|
|
4271
|
-
children:
|
|
3654
|
+
children: input
|
|
4272
3655
|
}
|
|
4273
3656
|
);
|
|
4274
3657
|
}
|
|
4275
|
-
return
|
|
4276
|
-
VariablesComposer,
|
|
4277
|
-
{
|
|
4278
|
-
onChange,
|
|
4279
|
-
value,
|
|
4280
|
-
disableVariables: disableVariablesForReals,
|
|
4281
|
-
showAddVariableMenuOption,
|
|
4282
|
-
enableEditingVariables,
|
|
4283
|
-
children: [
|
|
4284
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PasteTransformerPlugin, { transformPaste }),
|
|
4285
|
-
body
|
|
4286
|
-
]
|
|
4287
|
-
}
|
|
4288
|
-
);
|
|
3658
|
+
return input;
|
|
4289
3659
|
}
|
|
4290
|
-
function
|
|
3660
|
+
function InputVariablesShell({
|
|
4291
3661
|
children,
|
|
4292
3662
|
disabled,
|
|
4293
3663
|
...props
|
|
4294
3664
|
}) {
|
|
4295
3665
|
if (disabled) {
|
|
4296
|
-
return /* @__PURE__ */ (0,
|
|
3666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
|
|
4297
3667
|
}
|
|
4298
|
-
return /* @__PURE__ */ (0,
|
|
3668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { css: menuContainer, children: [
|
|
4299
3669
|
children,
|
|
4300
|
-
/* @__PURE__ */ (0,
|
|
4301
|
-
VariablesComposerVariableMenu,
|
|
4302
|
-
{
|
|
4303
|
-
...props,
|
|
4304
|
-
tip: "Tip: access this list by typing $",
|
|
4305
|
-
buttonCss: menuBtn
|
|
4306
|
-
}
|
|
4307
|
-
)
|
|
3670
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectVariableMenu, { ...props, tip: "Tip: access this list by typing ${", buttonCss: menuBtn2 })
|
|
4308
3671
|
] });
|
|
4309
3672
|
}
|
|
4310
3673
|
|
|
4311
3674
|
// src/components/Variables/VariablesList.tsx
|
|
4312
3675
|
init_emotion_jsx_shim();
|
|
4313
|
-
var
|
|
4314
|
-
var
|
|
3676
|
+
var import_react35 = require("@emotion/react");
|
|
3677
|
+
var import_design_system17 = require("@uniformdev/design-system");
|
|
4315
3678
|
var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
|
|
4316
3679
|
|
|
4317
3680
|
// src/components/Variables/styles/VariablesList.styles.ts
|
|
4318
3681
|
init_emotion_jsx_shim();
|
|
4319
|
-
var
|
|
4320
|
-
var tableRow = (isDragging) =>
|
|
3682
|
+
var import_react34 = require("@emotion/react");
|
|
3683
|
+
var tableRow = (isDragging) => import_react34.css`
|
|
4321
3684
|
position: relative;
|
|
4322
3685
|
${isDragging ? `
|
|
4323
3686
|
display: table;
|
|
@@ -4325,7 +3688,7 @@ var tableRow = (isDragging) => import_react42.css`
|
|
|
4325
3688
|
top: auto !important;
|
|
4326
3689
|
` : void 0}
|
|
4327
3690
|
`;
|
|
4328
|
-
var tableCellDragIcon =
|
|
3691
|
+
var tableCellDragIcon = import_react34.css`
|
|
4329
3692
|
&::after {
|
|
4330
3693
|
content: '';
|
|
4331
3694
|
display: block;
|
|
@@ -4343,7 +3706,7 @@ var tableCellDragIcon = import_react42.css`
|
|
|
4343
3706
|
opacity: 1;
|
|
4344
3707
|
}
|
|
4345
3708
|
`;
|
|
4346
|
-
var variableName =
|
|
3709
|
+
var variableName = import_react34.css`
|
|
4347
3710
|
border: none;
|
|
4348
3711
|
color: var(--brand-secondary-5);
|
|
4349
3712
|
font-weight: var(--fw-medium);
|
|
@@ -4354,7 +3717,7 @@ var variableName = import_react42.css`
|
|
|
4354
3717
|
white-space: nowrap;
|
|
4355
3718
|
max-width: 20ch;
|
|
4356
3719
|
`;
|
|
4357
|
-
var variableValue =
|
|
3720
|
+
var variableValue = import_react34.css`
|
|
4358
3721
|
overflow: hidden;
|
|
4359
3722
|
text-overflow: ellipsis;
|
|
4360
3723
|
white-space: nowrap;
|
|
@@ -4362,7 +3725,7 @@ var variableValue = import_react42.css`
|
|
|
4362
3725
|
`;
|
|
4363
3726
|
|
|
4364
3727
|
// src/components/Variables/VariablesList.tsx
|
|
4365
|
-
var
|
|
3728
|
+
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
4366
3729
|
function VariablesList() {
|
|
4367
3730
|
const { variables, dispatch } = useVariables();
|
|
4368
3731
|
const sorted = variablesToList(variables);
|
|
@@ -4383,24 +3746,24 @@ function VariablesList() {
|
|
|
4383
3746
|
return result;
|
|
4384
3747
|
}
|
|
4385
3748
|
};
|
|
4386
|
-
return /* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4388
|
-
/* @__PURE__ */ (0,
|
|
4389
|
-
/* @__PURE__ */ (0,
|
|
4390
|
-
/* @__PURE__ */ (0,
|
|
4391
|
-
/* @__PURE__ */ (0,
|
|
3749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
3750
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_beautiful_dnd2.DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_beautiful_dnd2.Droppable, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_design_system17.Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
3751
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_design_system17.TableRow, { children: [
|
|
3752
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.TableCellHead, { children: "Name" }),
|
|
3753
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.TableCellHead, { children: "Default Value" }),
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.TableCellHead, {})
|
|
4392
3755
|
] }) }),
|
|
4393
|
-
/* @__PURE__ */ (0,
|
|
3756
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_design_system17.TableBody, { children: [
|
|
4394
3757
|
sorted.map(({ name, displayName, default: defaultValue }, index) => {
|
|
4395
3758
|
const text = displayName != null ? displayName : name;
|
|
4396
|
-
return /* @__PURE__ */ (0,
|
|
3759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4397
3760
|
import_react_beautiful_dnd2.Draggable,
|
|
4398
3761
|
{
|
|
4399
3762
|
draggableId: name,
|
|
4400
3763
|
index,
|
|
4401
3764
|
isDragDisabled: sorted.length === 1,
|
|
4402
|
-
children: (provided2, snapshot) => /* @__PURE__ */ (0,
|
|
4403
|
-
|
|
3765
|
+
children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3766
|
+
import_design_system17.TableRow,
|
|
4404
3767
|
{
|
|
4405
3768
|
ref: provided2.innerRef,
|
|
4406
3769
|
...provided2.dragHandleProps,
|
|
@@ -4409,7 +3772,7 @@ function VariablesList() {
|
|
|
4409
3772
|
css: tableRow(snapshot.isDragging),
|
|
4410
3773
|
"data-dragging": snapshot.isDragging,
|
|
4411
3774
|
children: [
|
|
4412
|
-
/* @__PURE__ */ (0,
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4413
3776
|
"button",
|
|
4414
3777
|
{
|
|
4415
3778
|
css: variableName,
|
|
@@ -4422,21 +3785,21 @@ function VariablesList() {
|
|
|
4422
3785
|
children: text
|
|
4423
3786
|
}
|
|
4424
3787
|
) }),
|
|
4425
|
-
/* @__PURE__ */ (0,
|
|
4426
|
-
/* @__PURE__ */ (0,
|
|
3788
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.TableCellData, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
|
|
3789
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.TableCellData, { align: "right", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4427
3790
|
"button",
|
|
4428
3791
|
{
|
|
4429
3792
|
type: "button",
|
|
4430
3793
|
title: `delete ${text}`,
|
|
4431
3794
|
css: [
|
|
4432
|
-
|
|
4433
|
-
|
|
3795
|
+
import_design_system17.button,
|
|
3796
|
+
import_react35.css`
|
|
4434
3797
|
background: transparent;
|
|
4435
3798
|
`
|
|
4436
3799
|
],
|
|
4437
3800
|
"aria-controls": text,
|
|
4438
3801
|
onClick: () => dispatch({ type: "remove", variable: name }),
|
|
4439
|
-
children: /* @__PURE__ */ (0,
|
|
3802
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.Icon, { icon: "trash", iconColor: "red" })
|
|
4440
3803
|
}
|
|
4441
3804
|
) })
|
|
4442
3805
|
]
|
|
@@ -4449,8 +3812,8 @@ function VariablesList() {
|
|
|
4449
3812
|
provided.placeholder
|
|
4450
3813
|
] })
|
|
4451
3814
|
] }) }) }),
|
|
4452
|
-
/* @__PURE__ */ (0,
|
|
4453
|
-
|
|
3815
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3816
|
+
import_design_system17.AddListButton,
|
|
4454
3817
|
{
|
|
4455
3818
|
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
4456
3819
|
"aria-label": "Add variable",
|
|
@@ -4463,36 +3826,49 @@ function VariablesList() {
|
|
|
4463
3826
|
}
|
|
4464
3827
|
|
|
4465
3828
|
// src/components/DataResourceDynamicInputProvider.tsx
|
|
4466
|
-
var
|
|
3829
|
+
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
4467
3830
|
function DataResourceDynamicInputProvider({
|
|
4468
3831
|
children,
|
|
4469
3832
|
dynamicInputs
|
|
4470
3833
|
}) {
|
|
4471
3834
|
if (dynamicInputs) {
|
|
4472
|
-
return /* @__PURE__ */ (0,
|
|
3835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DataResourceDynamicInputProviderRenderer, { dynamicInputs, children });
|
|
4473
3836
|
}
|
|
4474
|
-
return /* @__PURE__ */ (0,
|
|
3837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DataResourceDynamicInputProviderContextShim, { children });
|
|
4475
3838
|
}
|
|
4476
3839
|
function DataResourceDynamicInputProviderContextShim(props) {
|
|
4477
3840
|
const {
|
|
4478
3841
|
metadata: { dynamicInputs }
|
|
4479
3842
|
} = useMeshLocation("dataResource");
|
|
4480
|
-
return /* @__PURE__ */ (0,
|
|
3843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
|
|
4481
3844
|
}
|
|
4482
3845
|
function DataResourceDynamicInputProviderRenderer({
|
|
4483
3846
|
children,
|
|
4484
3847
|
dynamicInputs
|
|
4485
3848
|
}) {
|
|
4486
|
-
return /* @__PURE__ */ (0,
|
|
3849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3850
|
+
VariablesProvider,
|
|
3851
|
+
{
|
|
3852
|
+
value: convertDynamicInputsToVariables(dynamicInputs),
|
|
3853
|
+
onChange: () => {
|
|
3854
|
+
throw new Error("Cannot change dynamic inputs. Make sure that add variable is disabled.");
|
|
3855
|
+
},
|
|
3856
|
+
editVariableComponent: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: "Cannot edit dynamic inputs." }),
|
|
3857
|
+
children
|
|
3858
|
+
}
|
|
3859
|
+
);
|
|
4487
3860
|
}
|
|
4488
3861
|
function convertDynamicInputsToVariables(dynamicInputs) {
|
|
4489
3862
|
return Object.entries(dynamicInputs).reduce(
|
|
4490
|
-
(acc, [name,
|
|
3863
|
+
(acc, [name, input]) => {
|
|
4491
3864
|
acc[name] = {
|
|
4492
|
-
type:
|
|
4493
|
-
default:
|
|
4494
|
-
|
|
4495
|
-
|
|
3865
|
+
type: input.type,
|
|
3866
|
+
default: input.value,
|
|
3867
|
+
helpText: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
3868
|
+
input.value || /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("em", { children: "not provided" }),
|
|
3869
|
+
", from ",
|
|
3870
|
+
input.type === "path" ? "URL path" : "query string"
|
|
3871
|
+
] })
|
|
4496
3872
|
// type abuse! 💚
|
|
4497
3873
|
};
|
|
4498
3874
|
return acc;
|
|
@@ -4503,14 +3879,14 @@ function convertDynamicInputsToVariables(dynamicInputs) {
|
|
|
4503
3879
|
|
|
4504
3880
|
// src/components/DataResourceVariablesList.tsx
|
|
4505
3881
|
init_emotion_jsx_shim();
|
|
4506
|
-
var
|
|
4507
|
-
var
|
|
3882
|
+
var import_design_system18 = require("@uniformdev/design-system");
|
|
3883
|
+
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4508
3884
|
function DataResourceVariablesList(props) {
|
|
4509
3885
|
const {
|
|
4510
3886
|
value,
|
|
4511
3887
|
metadata: { dataType, dynamicInputs }
|
|
4512
3888
|
} = useMeshLocation("dataResource");
|
|
4513
|
-
return /* @__PURE__ */ (0,
|
|
3889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4514
3890
|
DataResourceVariablesListExplicit,
|
|
4515
3891
|
{
|
|
4516
3892
|
...props,
|
|
@@ -4531,14 +3907,14 @@ function DataResourceVariablesListExplicit({
|
|
|
4531
3907
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
4532
3908
|
if (variableDefinitions.length === 0) {
|
|
4533
3909
|
if (NoVariablesComponent) {
|
|
4534
|
-
return /* @__PURE__ */ (0,
|
|
3910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(NoVariablesComponent, {});
|
|
4535
3911
|
}
|
|
4536
|
-
return /* @__PURE__ */ (0,
|
|
3912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system18.Callout, { type: "note", children: "No settings are required." });
|
|
4537
3913
|
}
|
|
4538
|
-
return /* @__PURE__ */ (0,
|
|
3914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: variableDefinitions.map((variableDefinition) => {
|
|
4539
3915
|
var _a, _b, _c;
|
|
4540
3916
|
const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
|
|
4541
|
-
return /* @__PURE__ */ (0,
|
|
3917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4542
3918
|
VariableRenderer,
|
|
4543
3919
|
{
|
|
4544
3920
|
definition: variableDefinition,
|
|
@@ -4561,7 +3937,7 @@ function DataResourceVariablesListExplicit({
|
|
|
4561
3937
|
}
|
|
4562
3938
|
function TextVariableRenderer({ definition, value, setValue }) {
|
|
4563
3939
|
var _a;
|
|
4564
|
-
return /* @__PURE__ */ (0,
|
|
3940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4565
3941
|
InputVariables,
|
|
4566
3942
|
{
|
|
4567
3943
|
label: definition.displayName || definition.name,
|
|
@@ -4577,14 +3953,14 @@ init_emotion_jsx_shim();
|
|
|
4577
3953
|
|
|
4578
3954
|
// src/components/Request/RequestBody.tsx
|
|
4579
3955
|
init_emotion_jsx_shim();
|
|
4580
|
-
var
|
|
4581
|
-
var
|
|
4582
|
-
var
|
|
3956
|
+
var import_react37 = require("@emotion/react");
|
|
3957
|
+
var import_design_system19 = require("@uniformdev/design-system");
|
|
3958
|
+
var import_react38 = require("react");
|
|
4583
3959
|
|
|
4584
3960
|
// src/components/Request/RequestProvider.tsx
|
|
4585
3961
|
init_emotion_jsx_shim();
|
|
4586
3962
|
var React12 = __toESM(require("react"));
|
|
4587
|
-
var
|
|
3963
|
+
var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
|
|
4588
3964
|
var RequestContext = React12.createContext(null);
|
|
4589
3965
|
function RequestProvider({ value, onChange, children }) {
|
|
4590
3966
|
const contextValue = React12.useMemo(() => {
|
|
@@ -4653,7 +4029,7 @@ function RequestProvider({ value, onChange, children }) {
|
|
|
4653
4029
|
request: value
|
|
4654
4030
|
};
|
|
4655
4031
|
}, [onChange, value]);
|
|
4656
|
-
return /* @__PURE__ */ (0,
|
|
4032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RequestContext.Provider, { value: contextValue, children });
|
|
4657
4033
|
}
|
|
4658
4034
|
function useRequest() {
|
|
4659
4035
|
const context = React12.useContext(RequestContext);
|
|
@@ -4668,11 +4044,11 @@ init_emotion_jsx_shim();
|
|
|
4668
4044
|
|
|
4669
4045
|
// src/components/Request/styles/Request.styles.ts
|
|
4670
4046
|
init_emotion_jsx_shim();
|
|
4671
|
-
var
|
|
4672
|
-
var innerContentStyles =
|
|
4047
|
+
var import_react36 = require("@emotion/react");
|
|
4048
|
+
var innerContentStyles = import_react36.css`
|
|
4673
4049
|
background: var(--white);
|
|
4674
4050
|
`;
|
|
4675
|
-
var requestTypeContainer = (bgColor) =>
|
|
4051
|
+
var requestTypeContainer = (bgColor) => import_react36.css`
|
|
4676
4052
|
align-items: start;
|
|
4677
4053
|
background: ${bgColor};
|
|
4678
4054
|
display: grid;
|
|
@@ -4681,17 +4057,17 @@ var requestTypeContainer = (bgColor) => import_react44.css`
|
|
|
4681
4057
|
`;
|
|
4682
4058
|
|
|
4683
4059
|
// src/components/Request/RequestTypeContainer.tsx
|
|
4684
|
-
var
|
|
4060
|
+
var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
|
|
4685
4061
|
var RequestTypeContainer = ({
|
|
4686
4062
|
bgColor = "transparent",
|
|
4687
4063
|
children,
|
|
4688
4064
|
...props
|
|
4689
4065
|
}) => {
|
|
4690
|
-
return /* @__PURE__ */ (0,
|
|
4066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { css: requestTypeContainer(bgColor), ...props, children });
|
|
4691
4067
|
};
|
|
4692
4068
|
|
|
4693
4069
|
// src/components/Request/RequestBody.tsx
|
|
4694
|
-
var
|
|
4070
|
+
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
4695
4071
|
var LANGUAGE_OPTIONS = [
|
|
4696
4072
|
{ label: "Text", value: "plaintext" },
|
|
4697
4073
|
{ label: "JSON", value: "json" },
|
|
@@ -4710,23 +4086,23 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
4710
4086
|
};
|
|
4711
4087
|
function RequestBody() {
|
|
4712
4088
|
const { request, dispatch } = useRequest();
|
|
4713
|
-
const [language, setLanguage] = (0,
|
|
4714
|
-
return /* @__PURE__ */ (0,
|
|
4089
|
+
const [language, setLanguage] = (0, import_react38.useState)("json");
|
|
4090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
4715
4091
|
"div",
|
|
4716
4092
|
{
|
|
4717
|
-
css:
|
|
4093
|
+
css: import_react37.css`
|
|
4718
4094
|
background: var(--white);
|
|
4719
4095
|
`,
|
|
4720
4096
|
children: [
|
|
4721
|
-
/* @__PURE__ */ (0,
|
|
4097
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4722
4098
|
RequestTypeContainer,
|
|
4723
4099
|
{
|
|
4724
4100
|
bgColor: "var(--gray-100)",
|
|
4725
|
-
css:
|
|
4101
|
+
css: import_react37.css`
|
|
4726
4102
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
4727
4103
|
`,
|
|
4728
|
-
children: /* @__PURE__ */ (0,
|
|
4729
|
-
|
|
4104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4105
|
+
import_design_system19.InputSelect,
|
|
4730
4106
|
{
|
|
4731
4107
|
label: "Language",
|
|
4732
4108
|
showLabel: false,
|
|
@@ -4748,8 +4124,8 @@ function RequestBody() {
|
|
|
4748
4124
|
)
|
|
4749
4125
|
}
|
|
4750
4126
|
),
|
|
4751
|
-
/* @__PURE__ */ (0,
|
|
4752
|
-
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4128
|
+
import_design_system19.JsonEditor,
|
|
4753
4129
|
{
|
|
4754
4130
|
height: 200,
|
|
4755
4131
|
defaultValue: request.body,
|
|
@@ -4767,8 +4143,8 @@ function RequestBody() {
|
|
|
4767
4143
|
|
|
4768
4144
|
// src/components/Request/RequestHeaders.tsx
|
|
4769
4145
|
init_emotion_jsx_shim();
|
|
4770
|
-
var
|
|
4771
|
-
var
|
|
4146
|
+
var import_design_system20 = require("@uniformdev/design-system");
|
|
4147
|
+
var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
|
|
4772
4148
|
function RequestHeaders({ disableVariables }) {
|
|
4773
4149
|
var _a, _b;
|
|
4774
4150
|
const { dispatch, request } = useRequest();
|
|
@@ -4784,29 +4160,29 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4784
4160
|
index
|
|
4785
4161
|
});
|
|
4786
4162
|
};
|
|
4787
|
-
return /* @__PURE__ */ (0,
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4789
|
-
/* @__PURE__ */ (0,
|
|
4790
|
-
/* @__PURE__ */ (0,
|
|
4163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { css: innerContentStyles, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_design_system20.Table, { children: [
|
|
4164
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system20.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_design_system20.TableRow, { children: [
|
|
4165
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system20.TableCellHead, { children: "Name" }),
|
|
4166
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system20.TableCellHead, { children: "Value" })
|
|
4791
4167
|
] }) }),
|
|
4792
|
-
/* @__PURE__ */ (0,
|
|
4168
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_design_system20.TableBody, { children: [
|
|
4793
4169
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
|
|
4794
|
-
return /* @__PURE__ */ (0,
|
|
4795
|
-
/* @__PURE__ */ (0,
|
|
4170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_design_system20.TableRow, { children: [
|
|
4171
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_design_system20.TableCellData, { width: "50%", children: [
|
|
4796
4172
|
baseHeader.key,
|
|
4797
|
-
/* @__PURE__ */ (0,
|
|
4798
|
-
/* @__PURE__ */ (0,
|
|
4173
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("br", {}),
|
|
4174
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("small", { children: "from data source" }) })
|
|
4799
4175
|
] }),
|
|
4800
|
-
/* @__PURE__ */ (0,
|
|
4801
|
-
/* @__PURE__ */ (0,
|
|
4802
|
-
request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ (0,
|
|
4176
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_design_system20.TableCellData, { width: "50%", children: [
|
|
4177
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
|
|
4178
|
+
request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system20.WarningMessage, { message: "overridden below" }) : null
|
|
4803
4179
|
] })
|
|
4804
4180
|
] }, baseHeader.key);
|
|
4805
4181
|
}),
|
|
4806
4182
|
deezHeaders.map((header, index) => {
|
|
4807
|
-
return /* @__PURE__ */ (0,
|
|
4808
|
-
/* @__PURE__ */ (0,
|
|
4809
|
-
|
|
4183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_design_system20.TableRow, { children: [
|
|
4184
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system20.TableCellData, { width: "50%", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4185
|
+
import_design_system20.Input,
|
|
4810
4186
|
{
|
|
4811
4187
|
label: header.key,
|
|
4812
4188
|
value: header.key,
|
|
@@ -4825,15 +4201,13 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4825
4201
|
"data-test-id": "header-key"
|
|
4826
4202
|
}
|
|
4827
4203
|
) }),
|
|
4828
|
-
/* @__PURE__ */ (0,
|
|
4204
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system20.TableCellData, { width: "50%", children: header.key ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4829
4205
|
InputVariables,
|
|
4830
4206
|
{
|
|
4831
4207
|
value: header.value,
|
|
4832
4208
|
onChange: (value) => handleUpdateParamFromMenu({ key: header.key, value, index }),
|
|
4833
4209
|
disableVariables,
|
|
4834
4210
|
showAddVariableMenuOption: true,
|
|
4835
|
-
enableEditingVariables: true,
|
|
4836
|
-
disableReset: true,
|
|
4837
4211
|
"data-test-id": "header-value"
|
|
4838
4212
|
}
|
|
4839
4213
|
) : null })
|
|
@@ -4845,13 +4219,13 @@ function RequestHeaders({ disableVariables }) {
|
|
|
4845
4219
|
|
|
4846
4220
|
// src/components/Request/RequestMethodSelect.tsx
|
|
4847
4221
|
init_emotion_jsx_shim();
|
|
4848
|
-
var
|
|
4849
|
-
var
|
|
4222
|
+
var import_design_system21 = require("@uniformdev/design-system");
|
|
4223
|
+
var import_jsx_runtime40 = require("@emotion/react/jsx-runtime");
|
|
4850
4224
|
function RequestMethodSelect(props) {
|
|
4851
4225
|
var _a;
|
|
4852
4226
|
const { request, dispatch } = useRequest();
|
|
4853
|
-
return /* @__PURE__ */ (0,
|
|
4854
|
-
|
|
4227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4228
|
+
import_design_system21.InputSelect,
|
|
4855
4229
|
{
|
|
4856
4230
|
...props,
|
|
4857
4231
|
options: [
|
|
@@ -4867,8 +4241,8 @@ function RequestMethodSelect(props) {
|
|
|
4867
4241
|
|
|
4868
4242
|
// src/components/Request/RequestParameters.tsx
|
|
4869
4243
|
init_emotion_jsx_shim();
|
|
4870
|
-
var
|
|
4871
|
-
var
|
|
4244
|
+
var import_design_system22 = require("@uniformdev/design-system");
|
|
4245
|
+
var import_jsx_runtime41 = require("@emotion/react/jsx-runtime");
|
|
4872
4246
|
function RequestParameters({ disableVariables }) {
|
|
4873
4247
|
var _a, _b;
|
|
4874
4248
|
const { dispatch, request } = useRequest();
|
|
@@ -4884,29 +4258,29 @@ function RequestParameters({ disableVariables }) {
|
|
|
4884
4258
|
index
|
|
4885
4259
|
});
|
|
4886
4260
|
};
|
|
4887
|
-
return /* @__PURE__ */ (0,
|
|
4888
|
-
/* @__PURE__ */ (0,
|
|
4889
|
-
/* @__PURE__ */ (0,
|
|
4890
|
-
/* @__PURE__ */ (0,
|
|
4261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: innerContentStyles, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.Table, { children: [
|
|
4262
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system22.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.TableRow, { children: [
|
|
4263
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system22.TableCellHead, { children: "Name" }),
|
|
4264
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system22.TableCellHead, { children: "Value" })
|
|
4891
4265
|
] }) }),
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
4266
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.TableBody, { children: [
|
|
4893
4267
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
|
|
4894
|
-
return /* @__PURE__ */ (0,
|
|
4895
|
-
/* @__PURE__ */ (0,
|
|
4268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.TableRow, { children: [
|
|
4269
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.TableCellData, { width: "50%", children: [
|
|
4896
4270
|
baseParameter.key,
|
|
4897
|
-
/* @__PURE__ */ (0,
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
4271
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("br", {}),
|
|
4272
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("small", { children: "from data source" }) })
|
|
4899
4273
|
] }),
|
|
4900
|
-
/* @__PURE__ */ (0,
|
|
4901
|
-
/* @__PURE__ */ (0,
|
|
4902
|
-
request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ (0,
|
|
4274
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.TableCellData, { width: "50%", children: [
|
|
4275
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
|
|
4276
|
+
request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system22.WarningMessage, { message: "overridden below" }) : null
|
|
4903
4277
|
] })
|
|
4904
4278
|
] }, baseParameter.key);
|
|
4905
4279
|
}),
|
|
4906
4280
|
deezParameters.map((parameter, index) => {
|
|
4907
|
-
return /* @__PURE__ */ (0,
|
|
4908
|
-
/* @__PURE__ */ (0,
|
|
4909
|
-
|
|
4281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.TableRow, { children: [
|
|
4282
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system22.TableCellData, { width: "50%", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4283
|
+
import_design_system22.Input,
|
|
4910
4284
|
{
|
|
4911
4285
|
label: parameter.key,
|
|
4912
4286
|
value: parameter.key,
|
|
@@ -4925,7 +4299,7 @@ function RequestParameters({ disableVariables }) {
|
|
|
4925
4299
|
"data-test-id": "parameter-key"
|
|
4926
4300
|
}
|
|
4927
4301
|
) }),
|
|
4928
|
-
/* @__PURE__ */ (0,
|
|
4302
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system22.TableCellData, { width: "50%", children: parameter.key ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4929
4303
|
InputVariables,
|
|
4930
4304
|
{
|
|
4931
4305
|
value: parameter.value,
|
|
@@ -4936,9 +4310,7 @@ function RequestParameters({ disableVariables }) {
|
|
|
4936
4310
|
}),
|
|
4937
4311
|
disableVariables,
|
|
4938
4312
|
"data-test-id": "parameter-value",
|
|
4939
|
-
showAddVariableMenuOption: true
|
|
4940
|
-
enableEditingVariables: true,
|
|
4941
|
-
disableReset: true
|
|
4313
|
+
showAddVariableMenuOption: true
|
|
4942
4314
|
}
|
|
4943
4315
|
) : null })
|
|
4944
4316
|
] }, index);
|
|
@@ -4949,8 +4321,8 @@ function RequestParameters({ disableVariables }) {
|
|
|
4949
4321
|
|
|
4950
4322
|
// src/components/Request/RequestUrl.tsx
|
|
4951
4323
|
init_emotion_jsx_shim();
|
|
4952
|
-
var
|
|
4953
|
-
var
|
|
4324
|
+
var import_react39 = require("@emotion/react");
|
|
4325
|
+
var import_react40 = require("react");
|
|
4954
4326
|
|
|
4955
4327
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
4956
4328
|
init_emotion_jsx_shim();
|
|
@@ -4972,35 +4344,35 @@ function decodeVariablesInUrlEncodedString(string, varValues) {
|
|
|
4972
4344
|
}
|
|
4973
4345
|
|
|
4974
4346
|
// src/components/Request/RequestUrl.tsx
|
|
4975
|
-
var
|
|
4347
|
+
var import_jsx_runtime42 = require("@emotion/react/jsx-runtime");
|
|
4976
4348
|
function RequestUrl() {
|
|
4977
4349
|
var _a, _b;
|
|
4978
4350
|
const { variables } = useVariables();
|
|
4979
4351
|
const { request } = useRequest();
|
|
4980
|
-
const mergedParameters = (0,
|
|
4352
|
+
const mergedParameters = (0, import_react40.useMemo)(() => {
|
|
4981
4353
|
var _a2;
|
|
4982
4354
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
4983
4355
|
return request.parameters;
|
|
4984
4356
|
}
|
|
4985
4357
|
return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p2) => p2.key === baseParam.key)).concat(request.parameters);
|
|
4986
4358
|
}, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
|
|
4987
|
-
return /* @__PURE__ */ (0,
|
|
4359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4988
4360
|
"small",
|
|
4989
4361
|
{
|
|
4990
|
-
css:
|
|
4362
|
+
css: import_react39.css`
|
|
4991
4363
|
display: inline-block;
|
|
4992
4364
|
margin-bottom: var(--spacing-xs);
|
|
4993
4365
|
word-break: break-word;
|
|
4994
4366
|
`,
|
|
4995
4367
|
children: [
|
|
4996
|
-
request.baseRequest ? /* @__PURE__ */ (0,
|
|
4997
|
-
/* @__PURE__ */ (0,
|
|
4368
|
+
request.baseRequest ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
|
|
4369
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
|
|
4998
4370
|
urlEncodeRequestUrl(request.relativeUrl, variables),
|
|
4999
|
-
mergedParameters.length > 0 ? /* @__PURE__ */ (0,
|
|
4371
|
+
mergedParameters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
5000
4372
|
"?",
|
|
5001
4373
|
mergedParameters.map((param, index) => {
|
|
5002
4374
|
const encoded = urlEncodeRequestParameter(param, variables);
|
|
5003
|
-
return /* @__PURE__ */ (0,
|
|
4375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { children: [
|
|
5004
4376
|
index > 0 ? "&" : null,
|
|
5005
4377
|
encoded.key,
|
|
5006
4378
|
"=",
|
|
@@ -5017,9 +4389,9 @@ function RequestUrl() {
|
|
|
5017
4389
|
// src/components/Request/RequestUrlInput.tsx
|
|
5018
4390
|
init_emotion_jsx_shim();
|
|
5019
4391
|
|
|
5020
|
-
// src/components/Request/util/
|
|
4392
|
+
// src/components/Request/util/handlePastedUrl.ts
|
|
5021
4393
|
init_emotion_jsx_shim();
|
|
5022
|
-
function
|
|
4394
|
+
function handlePastedUrl(value, currentRequest, dispatch) {
|
|
5023
4395
|
var _a, _b, _c;
|
|
5024
4396
|
const indexOfQueryString = value.indexOf("?");
|
|
5025
4397
|
const hasQueryString = indexOfQueryString >= 0;
|
|
@@ -5027,6 +4399,7 @@ function transformPastedUrl(value, currentRequest, dispatch) {
|
|
|
5027
4399
|
if (((_a = currentRequest.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = currentRequest.baseRequest) == null ? void 0 : _b.baseUrl)) {
|
|
5028
4400
|
relativeUrl = relativeUrl.substring((_c = currentRequest.baseRequest) == null ? void 0 : _c.baseUrl.length);
|
|
5029
4401
|
}
|
|
4402
|
+
dispatch({ type: "setRelativeUrl", relativeUrl });
|
|
5030
4403
|
if (hasQueryString) {
|
|
5031
4404
|
for (let index = currentRequest.parameters.length - 1; index >= 0; index--) {
|
|
5032
4405
|
dispatch({ type: "removeParameter", index });
|
|
@@ -5039,25 +4412,25 @@ function transformPastedUrl(value, currentRequest, dispatch) {
|
|
|
5039
4412
|
} catch (e) {
|
|
5040
4413
|
}
|
|
5041
4414
|
}
|
|
5042
|
-
return relativeUrl;
|
|
5043
4415
|
}
|
|
5044
4416
|
|
|
5045
4417
|
// src/components/Request/RequestUrlInput.tsx
|
|
5046
|
-
var
|
|
4418
|
+
var import_jsx_runtime43 = require("@emotion/react/jsx-runtime");
|
|
5047
4419
|
function RequestUrlInput(props) {
|
|
5048
4420
|
const { request, dispatch } = useRequest();
|
|
5049
|
-
return /* @__PURE__ */ (0,
|
|
4421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5050
4422
|
InputVariables,
|
|
5051
4423
|
{
|
|
5052
4424
|
disableReset: true,
|
|
5053
4425
|
...props,
|
|
5054
4426
|
value: request.relativeUrl,
|
|
5055
|
-
|
|
4427
|
+
onPaste: (value) => {
|
|
4428
|
+
handlePastedUrl(value, request, dispatch);
|
|
4429
|
+
},
|
|
5056
4430
|
onChange: (value) => {
|
|
5057
4431
|
dispatch({ type: "setRelativeUrl", relativeUrl: value });
|
|
5058
4432
|
},
|
|
5059
4433
|
showAddVariableMenuOption: true,
|
|
5060
|
-
enableEditingVariables: true,
|
|
5061
4434
|
"data-test-id": "field-url"
|
|
5062
4435
|
}
|
|
5063
4436
|
);
|
|
@@ -5100,19 +4473,18 @@ function useRequestParameter(paramName) {
|
|
|
5100
4473
|
}
|
|
5101
4474
|
|
|
5102
4475
|
// src/components/DataSourceEditor.tsx
|
|
5103
|
-
var
|
|
4476
|
+
var import_jsx_runtime44 = require("@emotion/react/jsx-runtime");
|
|
5104
4477
|
function DataSourceEditor({ onChange, children, editVariableComponent }) {
|
|
5105
4478
|
var _a;
|
|
5106
4479
|
const { value } = useMeshLocation("dataSource");
|
|
5107
4480
|
const currentRequestValue = convertDataSourceToRequestData(value);
|
|
5108
|
-
return /* @__PURE__ */ (0,
|
|
4481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5109
4482
|
VariablesProvider,
|
|
5110
4483
|
{
|
|
5111
4484
|
value: (_a = value.variables) != null ? _a : {},
|
|
5112
4485
|
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
5113
4486
|
editVariableComponent,
|
|
5114
|
-
|
|
5115
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4487
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5116
4488
|
RequestProvider,
|
|
5117
4489
|
{
|
|
5118
4490
|
value: currentRequestValue,
|
|
@@ -5150,23 +4522,21 @@ function convertRequestDataToDataSource(dataSource, requestData) {
|
|
|
5150
4522
|
|
|
5151
4523
|
// src/components/DataTypeEditor.tsx
|
|
5152
4524
|
init_emotion_jsx_shim();
|
|
5153
|
-
var
|
|
4525
|
+
var import_jsx_runtime45 = require("@emotion/react/jsx-runtime");
|
|
5154
4526
|
function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
5155
4527
|
var _a;
|
|
5156
4528
|
const {
|
|
5157
4529
|
value,
|
|
5158
|
-
metadata: { dataSource }
|
|
5159
|
-
isReadOnly
|
|
4530
|
+
metadata: { dataSource }
|
|
5160
4531
|
} = useMeshLocation("dataType");
|
|
5161
4532
|
const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
|
|
5162
|
-
return /* @__PURE__ */ (0,
|
|
4533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5163
4534
|
VariablesProvider,
|
|
5164
4535
|
{
|
|
5165
4536
|
value: (_a = value.variables) != null ? _a : {},
|
|
5166
4537
|
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
5167
4538
|
editVariableComponent,
|
|
5168
|
-
|
|
5169
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
4539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5170
4540
|
RequestProvider,
|
|
5171
4541
|
{
|
|
5172
4542
|
value: currentRequestValue,
|
|
@@ -5213,17 +4583,17 @@ function convertRequestDataToDataType(dataType, requestData) {
|
|
|
5213
4583
|
|
|
5214
4584
|
// src/components/MeshApp.tsx
|
|
5215
4585
|
init_emotion_jsx_shim();
|
|
5216
|
-
var
|
|
4586
|
+
var import_design_system23 = require("@uniformdev/design-system");
|
|
5217
4587
|
|
|
5218
4588
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
5219
4589
|
init_emotion_jsx_shim();
|
|
5220
4590
|
var import_mesh_sdk = require("@uniformdev/mesh-sdk");
|
|
5221
|
-
var
|
|
4591
|
+
var import_react41 = require("react");
|
|
5222
4592
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
5223
|
-
const [error, setError] = (0,
|
|
5224
|
-
const [sdk, setSdk] = (0,
|
|
5225
|
-
const initializationInProgress = (0,
|
|
5226
|
-
(0,
|
|
4593
|
+
const [error, setError] = (0, import_react41.useState)();
|
|
4594
|
+
const [sdk, setSdk] = (0, import_react41.useState)();
|
|
4595
|
+
const initializationInProgress = (0, import_react41.useRef)(false);
|
|
4596
|
+
(0, import_react41.useEffect)(
|
|
5227
4597
|
() => {
|
|
5228
4598
|
if (typeof window === "undefined" || sdk) {
|
|
5229
4599
|
return;
|
|
@@ -5256,7 +4626,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
5256
4626
|
};
|
|
5257
4627
|
|
|
5258
4628
|
// src/components/MeshApp.tsx
|
|
5259
|
-
var
|
|
4629
|
+
var import_jsx_runtime46 = require("@emotion/react/jsx-runtime");
|
|
5260
4630
|
var MeshApp = ({
|
|
5261
4631
|
children,
|
|
5262
4632
|
loadingComponent,
|
|
@@ -5265,37 +4635,37 @@ var MeshApp = ({
|
|
|
5265
4635
|
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
5266
4636
|
if (initializing || !sdk) {
|
|
5267
4637
|
const LoadingComponent = loadingComponent;
|
|
5268
|
-
return LoadingComponent ? /* @__PURE__ */ (0,
|
|
4638
|
+
return LoadingComponent ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LoadingComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system23.LoadingIndicator, {});
|
|
5269
4639
|
}
|
|
5270
4640
|
if (error) {
|
|
5271
4641
|
const ErrorComponent = errorComponent;
|
|
5272
4642
|
if (ErrorComponent) {
|
|
5273
|
-
return /* @__PURE__ */ (0,
|
|
4643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ErrorComponent, { error });
|
|
5274
4644
|
}
|
|
5275
4645
|
throw error;
|
|
5276
4646
|
}
|
|
5277
|
-
return /* @__PURE__ */ (0,
|
|
5278
|
-
/* @__PURE__ */ (0,
|
|
5279
|
-
/* @__PURE__ */ (0,
|
|
4647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
|
|
4648
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system23.Theme, {}),
|
|
4649
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(UniformMeshLocationContextProvider, { children })
|
|
5280
4650
|
] });
|
|
5281
4651
|
};
|
|
5282
4652
|
|
|
5283
4653
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
5284
4654
|
init_emotion_jsx_shim();
|
|
5285
|
-
var
|
|
5286
|
-
var
|
|
5287
|
-
var
|
|
4655
|
+
var import_react42 = require("@emotion/react");
|
|
4656
|
+
var import_design_system24 = require("@uniformdev/design-system");
|
|
4657
|
+
var import_jsx_runtime47 = require("@emotion/react/jsx-runtime");
|
|
5288
4658
|
var DataRefreshButton = ({
|
|
5289
4659
|
buttonText,
|
|
5290
4660
|
isLoading,
|
|
5291
4661
|
onRefreshData,
|
|
5292
4662
|
...props
|
|
5293
4663
|
}) => {
|
|
5294
|
-
return /* @__PURE__ */ (0,
|
|
5295
|
-
!isLoading ? null : /* @__PURE__ */ (0,
|
|
5296
|
-
|
|
4664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_design_system24.Button, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
4665
|
+
!isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4666
|
+
import_design_system24.LoadingIndicator,
|
|
5297
4667
|
{
|
|
5298
|
-
css:
|
|
4668
|
+
css: import_react42.css`
|
|
5299
4669
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
5300
4670
|
`
|
|
5301
4671
|
}
|
|
@@ -6467,13 +5837,13 @@ function bindVariablesToObjectRecursive({
|
|
|
6467
5837
|
}
|
|
6468
5838
|
|
|
6469
5839
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6470
|
-
var
|
|
5840
|
+
var import_design_system25 = require("@uniformdev/design-system");
|
|
6471
5841
|
|
|
6472
5842
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6473
5843
|
init_emotion_jsx_shim();
|
|
6474
|
-
var
|
|
6475
|
-
var
|
|
6476
|
-
var ObjectSearchContext = (0,
|
|
5844
|
+
var import_react43 = require("react");
|
|
5845
|
+
var import_jsx_runtime48 = require("@emotion/react/jsx-runtime");
|
|
5846
|
+
var ObjectSearchContext = (0, import_react43.createContext)({
|
|
6477
5847
|
onSetQuery: () => {
|
|
6478
5848
|
},
|
|
6479
5849
|
onSelectItem: () => {
|
|
@@ -6488,15 +5858,15 @@ var ObjectSearchContext = (0, import_react51.createContext)({
|
|
|
6488
5858
|
}
|
|
6489
5859
|
});
|
|
6490
5860
|
var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
6491
|
-
const [query, setQuery] = (0,
|
|
5861
|
+
const [query, setQuery] = (0, import_react43.useState)({
|
|
6492
5862
|
contentType: "",
|
|
6493
5863
|
keyword: ""
|
|
6494
5864
|
});
|
|
6495
5865
|
const { flatVariables } = useVariables(true);
|
|
6496
|
-
const querySearchDeferred = (0,
|
|
6497
|
-
const [selectedItems, setSelectedItems] = (0,
|
|
6498
|
-
const [list, setList] = (0,
|
|
6499
|
-
const onSetQuery = (0,
|
|
5866
|
+
const querySearchDeferred = (0, import_react43.useDeferredValue)(query);
|
|
5867
|
+
const [selectedItems, setSelectedItems] = (0, import_react43.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
5868
|
+
const [list, setList] = (0, import_react43.useState)({});
|
|
5869
|
+
const onSetQuery = (0, import_react43.useCallback)(
|
|
6500
5870
|
(value2) => {
|
|
6501
5871
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
6502
5872
|
return setQuery({
|
|
@@ -6508,7 +5878,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6508
5878
|
},
|
|
6509
5879
|
[setQuery]
|
|
6510
5880
|
);
|
|
6511
|
-
const onSelectItem = (0,
|
|
5881
|
+
const onSelectItem = (0, import_react43.useCallback)(
|
|
6512
5882
|
(selectedResult) => {
|
|
6513
5883
|
if (Array.isArray(selectedResult)) {
|
|
6514
5884
|
setSelectedItems(selectedResult);
|
|
@@ -6522,17 +5892,17 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6522
5892
|
},
|
|
6523
5893
|
[setSelectedItems, selectedItems]
|
|
6524
5894
|
);
|
|
6525
|
-
const onRemoveAllSelectedItems = (0,
|
|
5895
|
+
const onRemoveAllSelectedItems = (0, import_react43.useCallback)(() => {
|
|
6526
5896
|
setSelectedItems([]);
|
|
6527
5897
|
}, [setSelectedItems]);
|
|
6528
|
-
const onSetList = (0,
|
|
5898
|
+
const onSetList = (0, import_react43.useCallback)(
|
|
6529
5899
|
(value2) => {
|
|
6530
5900
|
setList(value2);
|
|
6531
5901
|
},
|
|
6532
5902
|
[setList]
|
|
6533
5903
|
);
|
|
6534
|
-
const boundQuery = (0,
|
|
6535
|
-
const value = (0,
|
|
5904
|
+
const boundQuery = (0, import_react43.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
5905
|
+
const value = (0, import_react43.useMemo)(
|
|
6536
5906
|
() => ({
|
|
6537
5907
|
boundQuery,
|
|
6538
5908
|
onSetQuery,
|
|
@@ -6554,10 +5924,10 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6554
5924
|
onSetList
|
|
6555
5925
|
]
|
|
6556
5926
|
);
|
|
6557
|
-
return /* @__PURE__ */ (0,
|
|
5927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ObjectSearchContext.Provider, { value, children });
|
|
6558
5928
|
};
|
|
6559
5929
|
function useObjectSearchContext() {
|
|
6560
|
-
return (0,
|
|
5930
|
+
return (0, import_react43.useContext)(ObjectSearchContext);
|
|
6561
5931
|
}
|
|
6562
5932
|
function bindQuery(query, inputs) {
|
|
6563
5933
|
const { result, errors } = bindVariablesToObject({
|
|
@@ -6572,7 +5942,7 @@ function bindQuery(query, inputs) {
|
|
|
6572
5942
|
}
|
|
6573
5943
|
|
|
6574
5944
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6575
|
-
var
|
|
5945
|
+
var import_jsx_runtime49 = require("@emotion/react/jsx-runtime");
|
|
6576
5946
|
var ObjectSearchContainer = ({
|
|
6577
5947
|
label,
|
|
6578
5948
|
enableDynamicInputToResultId,
|
|
@@ -6583,9 +5953,9 @@ var ObjectSearchContainer = ({
|
|
|
6583
5953
|
var _a, _b;
|
|
6584
5954
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6585
5955
|
const { flatVariables } = useVariables(true);
|
|
6586
|
-
const body = /* @__PURE__ */ (0,
|
|
5956
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system25.VerticalRhythm, { children: [
|
|
6587
5957
|
searchFilters,
|
|
6588
|
-
!resultList ? null : /* @__PURE__ */ (0,
|
|
5958
|
+
!resultList ? null : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system25.ScrollableList, { role: "list", children: resultList })
|
|
6589
5959
|
] });
|
|
6590
5960
|
const handleSelectedVariableChange = (selectedValue) => {
|
|
6591
5961
|
var _a2;
|
|
@@ -6614,8 +5984,8 @@ var ObjectSearchContainer = ({
|
|
|
6614
5984
|
}
|
|
6615
5985
|
]);
|
|
6616
5986
|
};
|
|
6617
|
-
return /* @__PURE__ */ (0,
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
5987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system25.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system25.VerticalRhythm, { children: [
|
|
5988
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system25.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
6619
5989
|
InputVariables,
|
|
6620
5990
|
{
|
|
6621
5991
|
label,
|
|
@@ -6631,13 +6001,13 @@ var ObjectSearchContainer = ({
|
|
|
6631
6001
|
|
|
6632
6002
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6633
6003
|
init_emotion_jsx_shim();
|
|
6634
|
-
var
|
|
6635
|
-
var
|
|
6004
|
+
var import_design_system26 = require("@uniformdev/design-system");
|
|
6005
|
+
var import_react45 = require("react");
|
|
6636
6006
|
|
|
6637
6007
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6638
6008
|
init_emotion_jsx_shim();
|
|
6639
|
-
var
|
|
6640
|
-
var ObjectSearchFilterContainerLabel =
|
|
6009
|
+
var import_react44 = require("@emotion/react");
|
|
6010
|
+
var ObjectSearchFilterContainerLabel = import_react44.css`
|
|
6641
6011
|
align-items: center;
|
|
6642
6012
|
display: flex;
|
|
6643
6013
|
font-size: var(--fs-sm);
|
|
@@ -6645,21 +6015,21 @@ var ObjectSearchFilterContainerLabel = import_react52.css`
|
|
|
6645
6015
|
line-height: 1rem;
|
|
6646
6016
|
margin-bottom: var(--spacing-sm);
|
|
6647
6017
|
`;
|
|
6648
|
-
var ObjectSearchFilterContainer =
|
|
6018
|
+
var ObjectSearchFilterContainer = import_react44.css`
|
|
6649
6019
|
display: grid;
|
|
6650
6020
|
gap: var(--spacing-base);
|
|
6651
6021
|
`;
|
|
6652
|
-
var ObjectSearchFilterDropdownAndTextSearch =
|
|
6022
|
+
var ObjectSearchFilterDropdownAndTextSearch = import_react44.css`
|
|
6653
6023
|
grid-template-columns: 0.5fr 1fr;
|
|
6654
6024
|
`;
|
|
6655
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6025
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react44.css`
|
|
6656
6026
|
display: grid;
|
|
6657
6027
|
grid-template-columns: ${gridColumns};
|
|
6658
6028
|
gap: var(--spacing-base);
|
|
6659
6029
|
`;
|
|
6660
6030
|
|
|
6661
6031
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6662
|
-
var
|
|
6032
|
+
var import_jsx_runtime50 = require("@emotion/react/jsx-runtime");
|
|
6663
6033
|
var ObjectSearchFilter = ({
|
|
6664
6034
|
requireContentType,
|
|
6665
6035
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6669,7 +6039,7 @@ var ObjectSearchFilter = ({
|
|
|
6669
6039
|
selectOptions
|
|
6670
6040
|
}) => {
|
|
6671
6041
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6672
|
-
const [searchState, setSearchState] = (0,
|
|
6042
|
+
const [searchState, setSearchState] = (0, import_react45.useState)({
|
|
6673
6043
|
contentType: "",
|
|
6674
6044
|
keyword: ""
|
|
6675
6045
|
});
|
|
@@ -6679,9 +6049,9 @@ var ObjectSearchFilter = ({
|
|
|
6679
6049
|
});
|
|
6680
6050
|
onSetQuery({ ...query, ...value });
|
|
6681
6051
|
};
|
|
6682
|
-
return /* @__PURE__ */ (0,
|
|
6683
|
-
/* @__PURE__ */ (0,
|
|
6684
|
-
|
|
6052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
|
|
6053
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6054
|
+
import_design_system26.InputSelect,
|
|
6685
6055
|
{
|
|
6686
6056
|
label: selectLabel,
|
|
6687
6057
|
showLabel: false,
|
|
@@ -6696,8 +6066,8 @@ var ObjectSearchFilter = ({
|
|
|
6696
6066
|
value: query.contentType
|
|
6697
6067
|
}
|
|
6698
6068
|
),
|
|
6699
|
-
/* @__PURE__ */ (0,
|
|
6700
|
-
|
|
6069
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
6070
|
+
import_design_system26.InputKeywordSearch,
|
|
6701
6071
|
{
|
|
6702
6072
|
inputFieldName: searchInputName,
|
|
6703
6073
|
placeholder: searchInputPlaceholderText,
|
|
@@ -6712,23 +6082,23 @@ var ObjectSearchFilter = ({
|
|
|
6712
6082
|
|
|
6713
6083
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6714
6084
|
init_emotion_jsx_shim();
|
|
6715
|
-
var
|
|
6085
|
+
var import_jsx_runtime51 = require("@emotion/react/jsx-runtime");
|
|
6716
6086
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6717
|
-
return /* @__PURE__ */ (0,
|
|
6718
|
-
label ? /* @__PURE__ */ (0,
|
|
6719
|
-
/* @__PURE__ */ (0,
|
|
6087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
|
|
6088
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6089
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
6720
6090
|
] });
|
|
6721
6091
|
};
|
|
6722
6092
|
|
|
6723
6093
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6724
6094
|
init_emotion_jsx_shim();
|
|
6725
|
-
var
|
|
6095
|
+
var import_design_system28 = require("@uniformdev/design-system");
|
|
6726
6096
|
|
|
6727
6097
|
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6728
6098
|
init_emotion_jsx_shim();
|
|
6729
|
-
var
|
|
6730
|
-
var
|
|
6731
|
-
var ObjectListItemContainer =
|
|
6099
|
+
var import_react46 = require("@emotion/react");
|
|
6100
|
+
var import_design_system27 = require("@uniformdev/design-system");
|
|
6101
|
+
var ObjectListItemContainer = import_react46.css`
|
|
6732
6102
|
align-items: center;
|
|
6733
6103
|
border: 1px solid var(--gray-300);
|
|
6734
6104
|
border-radius: var(--rounded-base);
|
|
@@ -6741,8 +6111,8 @@ var ObjectListItemContainer = import_react54.css`
|
|
|
6741
6111
|
display: none;
|
|
6742
6112
|
}
|
|
6743
6113
|
`;
|
|
6744
|
-
var ObjectListItemLoading =
|
|
6745
|
-
animation: ${
|
|
6114
|
+
var ObjectListItemLoading = import_react46.css`
|
|
6115
|
+
animation: ${import_design_system27.skeletonLoading} 1s linear infinite alternate;
|
|
6746
6116
|
border-color: transparent;
|
|
6747
6117
|
min-height: 42px;
|
|
6748
6118
|
position: relative;
|
|
@@ -6765,37 +6135,37 @@ var ObjectListItemLoading = import_react54.css`
|
|
|
6765
6135
|
width: 1rem;
|
|
6766
6136
|
}
|
|
6767
6137
|
`;
|
|
6768
|
-
var ObjectListItemHeadingGroup =
|
|
6138
|
+
var ObjectListItemHeadingGroup = import_react46.css`
|
|
6769
6139
|
align-items: center;
|
|
6770
6140
|
display: grid;
|
|
6771
6141
|
`;
|
|
6772
|
-
var ObjectListItemTitle =
|
|
6142
|
+
var ObjectListItemTitle = import_react46.css`
|
|
6773
6143
|
color: var(--brand-secondary-1);
|
|
6774
6144
|
display: block;
|
|
6775
6145
|
font-size: var(--fs-sm);
|
|
6776
6146
|
`;
|
|
6777
|
-
var ObjectListItemSubtitle =
|
|
6147
|
+
var ObjectListItemSubtitle = import_react46.css`
|
|
6778
6148
|
color: var(--gray-500);
|
|
6779
6149
|
display: block;
|
|
6780
6150
|
font-size: var(--fs-xs);
|
|
6781
6151
|
line-height: 1;
|
|
6782
6152
|
`;
|
|
6783
|
-
var ObjectListItemInfoContainer =
|
|
6153
|
+
var ObjectListItemInfoContainer = import_react46.css`
|
|
6784
6154
|
align-items: center;
|
|
6785
6155
|
display: flex;
|
|
6786
6156
|
justify-content: center;
|
|
6787
6157
|
`;
|
|
6788
|
-
var ObjectListItemControlledContent =
|
|
6158
|
+
var ObjectListItemControlledContent = import_react46.css`
|
|
6789
6159
|
display: flex;
|
|
6790
6160
|
gap: var(--spacing-sm);
|
|
6791
6161
|
`;
|
|
6792
|
-
var ObjectListItemUnControlledContent =
|
|
6162
|
+
var ObjectListItemUnControlledContent = import_react46.css`
|
|
6793
6163
|
margin-top: var(--spacing-sm);
|
|
6794
6164
|
grid-column: 1 / -1;
|
|
6795
6165
|
`;
|
|
6796
6166
|
|
|
6797
6167
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6798
|
-
var
|
|
6168
|
+
var import_jsx_runtime52 = require("@emotion/react/jsx-runtime");
|
|
6799
6169
|
var ObjectSearchListItem = ({
|
|
6800
6170
|
id,
|
|
6801
6171
|
title,
|
|
@@ -6818,25 +6188,25 @@ var ObjectSearchListItem = ({
|
|
|
6818
6188
|
return onSelectItem([selectedItem]);
|
|
6819
6189
|
};
|
|
6820
6190
|
const hideWhenInSelectedList = selectedListItems.some((item) => item.id === id);
|
|
6821
|
-
return /* @__PURE__ */ (0,
|
|
6822
|
-
/* @__PURE__ */ (0,
|
|
6823
|
-
!image ? null : /* @__PURE__ */ (0,
|
|
6824
|
-
/* @__PURE__ */ (0,
|
|
6825
|
-
!contentType ? null : /* @__PURE__ */ (0,
|
|
6826
|
-
/* @__PURE__ */ (0,
|
|
6191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, children: [
|
|
6192
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
|
|
6193
|
+
!image ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6194
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6195
|
+
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6196
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { css: ObjectListItemTitle, children: title })
|
|
6827
6197
|
] })
|
|
6828
6198
|
] }),
|
|
6829
|
-
!popoverData ? null : /* @__PURE__ */ (0,
|
|
6830
|
-
!children ? null : /* @__PURE__ */ (0,
|
|
6199
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system28.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
|
|
6200
|
+
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6831
6201
|
] });
|
|
6832
6202
|
};
|
|
6833
6203
|
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6834
|
-
return /* @__PURE__ */ (0,
|
|
6204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6835
6205
|
};
|
|
6836
6206
|
|
|
6837
6207
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6838
6208
|
init_emotion_jsx_shim();
|
|
6839
|
-
var
|
|
6209
|
+
var import_design_system30 = require("@uniformdev/design-system");
|
|
6840
6210
|
var import_timeago3 = require("timeago.js");
|
|
6841
6211
|
|
|
6842
6212
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
@@ -6844,10 +6214,10 @@ init_emotion_jsx_shim();
|
|
|
6844
6214
|
|
|
6845
6215
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6846
6216
|
init_emotion_jsx_shim();
|
|
6847
|
-
var
|
|
6848
|
-
var
|
|
6849
|
-
var ButtonStyles =
|
|
6850
|
-
${
|
|
6217
|
+
var import_react47 = require("@emotion/react");
|
|
6218
|
+
var import_design_system29 = require("@uniformdev/design-system");
|
|
6219
|
+
var ButtonStyles = import_react47.css`
|
|
6220
|
+
${import_design_system29.button}
|
|
6851
6221
|
background: transparent;
|
|
6852
6222
|
border: 1px solid var(--brand-secondary-1);
|
|
6853
6223
|
color: var(--brand-secondary-1);
|
|
@@ -6873,20 +6243,20 @@ var ButtonStyles = import_react55.css`
|
|
|
6873
6243
|
text-decoration: none;
|
|
6874
6244
|
}
|
|
6875
6245
|
`;
|
|
6876
|
-
var ButtonIcon =
|
|
6246
|
+
var ButtonIcon = import_react47.css`
|
|
6877
6247
|
width: 1rem;
|
|
6878
6248
|
height: 1rem;
|
|
6879
6249
|
`;
|
|
6880
6250
|
|
|
6881
6251
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
6882
|
-
var
|
|
6252
|
+
var import_jsx_runtime53 = require("@emotion/react/jsx-runtime");
|
|
6883
6253
|
var ObjectSearchResultItemButton = ({
|
|
6884
6254
|
text,
|
|
6885
6255
|
icon,
|
|
6886
6256
|
...props
|
|
6887
6257
|
}) => {
|
|
6888
|
-
return /* @__PURE__ */ (0,
|
|
6889
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
6259
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6890
6260
|
text
|
|
6891
6261
|
] });
|
|
6892
6262
|
};
|
|
@@ -6895,16 +6265,16 @@ var LinkButton = ({
|
|
|
6895
6265
|
icon,
|
|
6896
6266
|
...props
|
|
6897
6267
|
}) => {
|
|
6898
|
-
return /* @__PURE__ */ (0,
|
|
6899
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
6269
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6900
6270
|
text
|
|
6901
6271
|
] });
|
|
6902
6272
|
};
|
|
6903
6273
|
|
|
6904
6274
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6905
6275
|
init_emotion_jsx_shim();
|
|
6906
|
-
var
|
|
6907
|
-
var ObjectSearchResultItemContainer =
|
|
6276
|
+
var import_react48 = require("@emotion/react");
|
|
6277
|
+
var ObjectSearchResultItemContainer = import_react48.css`
|
|
6908
6278
|
align-items: center;
|
|
6909
6279
|
border: 1px solid var(--gray-300);
|
|
6910
6280
|
border-radius: var(--rounded-base);
|
|
@@ -6920,7 +6290,7 @@ var ObjectSearchResultItemContainer = import_react56.css`
|
|
|
6920
6290
|
}
|
|
6921
6291
|
}
|
|
6922
6292
|
`;
|
|
6923
|
-
var ObjectSearchDragHandle =
|
|
6293
|
+
var ObjectSearchDragHandle = import_react48.css`
|
|
6924
6294
|
border-left: 2px dotted var(--gray-300);
|
|
6925
6295
|
border-right: 2px dotted var(--gray-300);
|
|
6926
6296
|
position: absolute;
|
|
@@ -6929,41 +6299,41 @@ var ObjectSearchDragHandle = import_react56.css`
|
|
|
6929
6299
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6930
6300
|
opacity: 0;
|
|
6931
6301
|
`;
|
|
6932
|
-
var ObjectSearchResultItemSubtitle =
|
|
6302
|
+
var ObjectSearchResultItemSubtitle = import_react48.css`
|
|
6933
6303
|
color: var(--gray-500);
|
|
6934
6304
|
display: block;
|
|
6935
6305
|
font-size: var(--fs-xs);
|
|
6936
6306
|
line-height: 1;
|
|
6937
6307
|
`;
|
|
6938
|
-
var ObjectSearchResultItemTitle =
|
|
6308
|
+
var ObjectSearchResultItemTitle = import_react48.css`
|
|
6939
6309
|
align-items: center;
|
|
6940
6310
|
color: var(--brand-secondary-1);
|
|
6941
6311
|
display: flex;
|
|
6942
6312
|
gap: var(--spacing-xs);
|
|
6943
6313
|
`;
|
|
6944
|
-
var ObjectSearchResultItemTimeStamp =
|
|
6314
|
+
var ObjectSearchResultItemTimeStamp = import_react48.css`
|
|
6945
6315
|
color: var(--gray-500);
|
|
6946
6316
|
font-size: var(--fs-xs);
|
|
6947
6317
|
`;
|
|
6948
|
-
var ObjectSearchAuthorStateGroup =
|
|
6318
|
+
var ObjectSearchAuthorStateGroup = import_react48.css`
|
|
6949
6319
|
align-items: center;
|
|
6950
6320
|
display: flex;
|
|
6951
6321
|
gap: var(--spacing-sm);
|
|
6952
6322
|
`;
|
|
6953
|
-
var ObjectSearchUpdateGroup =
|
|
6323
|
+
var ObjectSearchUpdateGroup = import_react48.css`
|
|
6954
6324
|
display: grid;
|
|
6955
6325
|
`;
|
|
6956
|
-
var ObjectSearchContentContainer =
|
|
6326
|
+
var ObjectSearchContentContainer = import_react48.css`
|
|
6957
6327
|
display: flex;
|
|
6958
6328
|
gap: var(--spacing-base);
|
|
6959
6329
|
`;
|
|
6960
|
-
var ObjectSearchImage =
|
|
6330
|
+
var ObjectSearchImage = import_react48.css`
|
|
6961
6331
|
width: 56px;
|
|
6962
6332
|
object-fit: contain;
|
|
6963
6333
|
`;
|
|
6964
6334
|
|
|
6965
6335
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6966
|
-
var
|
|
6336
|
+
var import_jsx_runtime54 = require("@emotion/react/jsx-runtime");
|
|
6967
6337
|
var ObjectSearchResultItem = ({
|
|
6968
6338
|
id,
|
|
6969
6339
|
title,
|
|
@@ -6987,75 +6357,75 @@ var ObjectSearchResultItem = ({
|
|
|
6987
6357
|
onSelectItem({ id, title: id });
|
|
6988
6358
|
onRemove == null ? void 0 : onRemove();
|
|
6989
6359
|
};
|
|
6990
|
-
return /* @__PURE__ */ (0,
|
|
6991
|
-
disableDnD ? null : /* @__PURE__ */ (0,
|
|
6992
|
-
/* @__PURE__ */ (0,
|
|
6993
|
-
!imageUrl ? null : /* @__PURE__ */ (0,
|
|
6994
|
-
/* @__PURE__ */ (0,
|
|
6995
|
-
/* @__PURE__ */ (0,
|
|
6996
|
-
/* @__PURE__ */ (0,
|
|
6360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchResultItemContainer, children: [
|
|
6361
|
+
disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
6362
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchContentContainer, children: [
|
|
6363
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
6364
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
6365
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
|
|
6366
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
|
|
6997
6367
|
title != null ? title : name,
|
|
6998
|
-
!popoverData ? null : /* @__PURE__ */ (0,
|
|
6368
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system30.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
6999
6369
|
] }),
|
|
7000
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0,
|
|
7001
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0,
|
|
7002
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0,
|
|
7003
|
-
!createdAt ? null : /* @__PURE__ */ (0,
|
|
7004
|
-
/* @__PURE__ */ (0,
|
|
6370
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6371
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system30.Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
|
|
6372
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchUpdateGroup, children: [
|
|
6373
|
+
!createdAt ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6374
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("strong", { children: "Last updated: " }),
|
|
7005
6375
|
(0, import_timeago3.format)(createdAt)
|
|
7006
6376
|
] }),
|
|
7007
|
-
!publishedAt ? null : /* @__PURE__ */ (0,
|
|
7008
|
-
/* @__PURE__ */ (0,
|
|
6377
|
+
!publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6378
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("strong", { children: "Last published: " }),
|
|
7009
6379
|
(0, import_timeago3.format)(publishedAt)
|
|
7010
6380
|
] })
|
|
7011
6381
|
] })
|
|
7012
6382
|
] }),
|
|
7013
|
-
/* @__PURE__ */ (0,
|
|
6383
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { children })
|
|
7014
6384
|
] })
|
|
7015
6385
|
] }) }),
|
|
7016
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
7017
|
-
!editLink ? null : /* @__PURE__ */ (0,
|
|
7018
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6386
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6387
|
+
!editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
6388
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system30.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
7019
6389
|
] })
|
|
7020
6390
|
] });
|
|
7021
6391
|
};
|
|
7022
6392
|
|
|
7023
6393
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
7024
6394
|
init_emotion_jsx_shim();
|
|
7025
|
-
var
|
|
6395
|
+
var import_design_system31 = require("@uniformdev/design-system");
|
|
7026
6396
|
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
|
7027
6397
|
|
|
7028
6398
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
7029
6399
|
init_emotion_jsx_shim();
|
|
7030
|
-
var
|
|
7031
|
-
var ObjectSearchResultListContainer =
|
|
6400
|
+
var import_react49 = require("@emotion/react");
|
|
6401
|
+
var ObjectSearchResultListContainer = import_react49.css`
|
|
7032
6402
|
align-items: center;
|
|
7033
6403
|
display: flex;
|
|
7034
6404
|
gap: var(--spacing-sm);
|
|
7035
6405
|
justify-content: space-between;
|
|
7036
6406
|
`;
|
|
7037
|
-
var ObjectSearchDragContainer =
|
|
6407
|
+
var ObjectSearchDragContainer = import_react49.css`
|
|
7038
6408
|
margin: 0 0 var(--spacing-sm);
|
|
7039
6409
|
`;
|
|
7040
|
-
var ObjectSearchResultListCounterContainer =
|
|
6410
|
+
var ObjectSearchResultListCounterContainer = import_react49.css`
|
|
7041
6411
|
align-items: center;
|
|
7042
6412
|
display: flex;
|
|
7043
6413
|
gap: var(--spacing-sm);
|
|
7044
6414
|
`;
|
|
7045
|
-
var ObjectSearchResultListTitle =
|
|
6415
|
+
var ObjectSearchResultListTitle = import_react49.css`
|
|
7046
6416
|
font-weight: var(--fw-bold);
|
|
7047
6417
|
line-height: 1;
|
|
7048
6418
|
`;
|
|
7049
6419
|
|
|
7050
6420
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
7051
|
-
var
|
|
6421
|
+
var import_jsx_runtime55 = require("@emotion/react/jsx-runtime");
|
|
7052
6422
|
function ObjectSearchResultList({
|
|
7053
6423
|
resultLabelText = "Selected",
|
|
7054
6424
|
removeButtonText = "Remove all",
|
|
7055
6425
|
onRemoveAllSelected,
|
|
7056
6426
|
hideRemoveButton = false,
|
|
7057
6427
|
additionalButtons,
|
|
7058
|
-
renderResultComponent = (value) => /* @__PURE__ */ (0,
|
|
6428
|
+
renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ObjectSearchResultItem, { ...value, disableDnD }),
|
|
7059
6429
|
multiSelectId,
|
|
7060
6430
|
disableDnD = false,
|
|
7061
6431
|
whenNothingSelected = null
|
|
@@ -7075,17 +6445,17 @@ function ObjectSearchResultList({
|
|
|
7075
6445
|
return result;
|
|
7076
6446
|
}
|
|
7077
6447
|
};
|
|
7078
|
-
return /* @__PURE__ */ (0,
|
|
7079
|
-
/* @__PURE__ */ (0,
|
|
7080
|
-
/* @__PURE__ */ (0,
|
|
7081
|
-
/* @__PURE__ */ (0,
|
|
6448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
6449
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
6450
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
6451
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
7082
6452
|
" ",
|
|
7083
|
-
!selectedListItems.length ? null : /* @__PURE__ */ (0,
|
|
6453
|
+
!selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_design_system31.Counter, { count: selectedListItems.length })
|
|
7084
6454
|
] }),
|
|
7085
|
-
/* @__PURE__ */ (0,
|
|
6455
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
7086
6456
|
additionalButtons,
|
|
7087
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
7088
|
-
|
|
6457
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6458
|
+
import_design_system31.Button,
|
|
7089
6459
|
{
|
|
7090
6460
|
buttonType: "ghostDestructive",
|
|
7091
6461
|
size: "xs",
|
|
@@ -7096,10 +6466,10 @@ function ObjectSearchResultList({
|
|
|
7096
6466
|
)
|
|
7097
6467
|
] })
|
|
7098
6468
|
] }),
|
|
7099
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0,
|
|
6469
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_beautiful_dnd3.DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_beautiful_dnd3.Droppable, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
7100
6470
|
selectedListItems.map((item, i2) => {
|
|
7101
6471
|
const renderListItem = renderResultComponent(item);
|
|
7102
|
-
return /* @__PURE__ */ (0,
|
|
6472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_beautiful_dnd3.Draggable, { draggableId: item.id, index: i2, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7103
6473
|
"div",
|
|
7104
6474
|
{
|
|
7105
6475
|
css: ObjectSearchDragContainer,
|
|
@@ -7118,9 +6488,9 @@ function ObjectSearchResultList({
|
|
|
7118
6488
|
|
|
7119
6489
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
7120
6490
|
init_emotion_jsx_shim();
|
|
7121
|
-
var
|
|
7122
|
-
var
|
|
7123
|
-
var
|
|
6491
|
+
var import_design_system32 = require("@uniformdev/design-system");
|
|
6492
|
+
var import_react50 = require("react");
|
|
6493
|
+
var import_jsx_runtime56 = require("@emotion/react/jsx-runtime");
|
|
7124
6494
|
var QueryFilter = ({
|
|
7125
6495
|
requireContentType,
|
|
7126
6496
|
queryFilterTitle = "Configure Query",
|
|
@@ -7151,7 +6521,7 @@ var QueryFilter = ({
|
|
|
7151
6521
|
}) => {
|
|
7152
6522
|
var _a, _b, _c, _d;
|
|
7153
6523
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
7154
|
-
const [queryState, setQueryState] = (0,
|
|
6524
|
+
const [queryState, setQueryState] = (0, import_react50.useState)({
|
|
7155
6525
|
contentType: "",
|
|
7156
6526
|
keyword: "",
|
|
7157
6527
|
count: countValue != null ? countValue : 5,
|
|
@@ -7162,13 +6532,13 @@ var QueryFilter = ({
|
|
|
7162
6532
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
7163
6533
|
onSetQuery({ ...query, ...value });
|
|
7164
6534
|
};
|
|
7165
|
-
(0,
|
|
6535
|
+
(0, import_react50.useEffect)(() => {
|
|
7166
6536
|
onSetQuery(queryState);
|
|
7167
6537
|
}, [onSetQuery, queryState]);
|
|
7168
|
-
return /* @__PURE__ */ (0,
|
|
7169
|
-
/* @__PURE__ */ (0,
|
|
7170
|
-
/* @__PURE__ */ (0,
|
|
7171
|
-
/* @__PURE__ */ (0,
|
|
6538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("fieldset", { children: [
|
|
6539
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_design_system32.VerticalRhythm, { children: [
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7172
6542
|
InputVariables,
|
|
7173
6543
|
{
|
|
7174
6544
|
label: searchInputLabel,
|
|
@@ -7176,8 +6546,8 @@ var QueryFilter = ({
|
|
|
7176
6546
|
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
7177
6547
|
disableInlineMenu: true,
|
|
7178
6548
|
id: "qf_searchText",
|
|
7179
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7180
|
-
|
|
6549
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6550
|
+
import_design_system32.InputKeywordSearch,
|
|
7181
6551
|
{
|
|
7182
6552
|
id: "qf_searchText",
|
|
7183
6553
|
inputFieldName: searchInputName,
|
|
@@ -7190,8 +6560,8 @@ var QueryFilter = ({
|
|
|
7190
6560
|
)
|
|
7191
6561
|
}
|
|
7192
6562
|
),
|
|
7193
|
-
/* @__PURE__ */ (0,
|
|
7194
|
-
/* @__PURE__ */ (0,
|
|
6563
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
|
|
6564
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7195
6565
|
InputVariables,
|
|
7196
6566
|
{
|
|
7197
6567
|
label: contentTypeLabel,
|
|
@@ -7199,8 +6569,8 @@ var QueryFilter = ({
|
|
|
7199
6569
|
value: (_d = queryState.contentType) != null ? _d : "",
|
|
7200
6570
|
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
7201
6571
|
disableInlineMenu: true,
|
|
7202
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7203
|
-
|
|
6572
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6573
|
+
import_design_system32.InputSelect,
|
|
7204
6574
|
{
|
|
7205
6575
|
id: "qf_contentType",
|
|
7206
6576
|
label: contentTypeLabel,
|
|
@@ -7218,7 +6588,7 @@ var QueryFilter = ({
|
|
|
7218
6588
|
)
|
|
7219
6589
|
}
|
|
7220
6590
|
),
|
|
7221
|
-
/* @__PURE__ */ (0,
|
|
6591
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7222
6592
|
InputVariables,
|
|
7223
6593
|
{
|
|
7224
6594
|
label: countLabel,
|
|
@@ -7226,8 +6596,8 @@ var QueryFilter = ({
|
|
|
7226
6596
|
value: queryState.count.toString(10),
|
|
7227
6597
|
onChange: (newCount) => handleFilterChange({ count: newCount }),
|
|
7228
6598
|
disableInlineMenu: true,
|
|
7229
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7230
|
-
|
|
6599
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6600
|
+
import_design_system32.Input,
|
|
7231
6601
|
{
|
|
7232
6602
|
id: "qf_count",
|
|
7233
6603
|
label: countLabel,
|
|
@@ -7241,8 +6611,8 @@ var QueryFilter = ({
|
|
|
7241
6611
|
}
|
|
7242
6612
|
)
|
|
7243
6613
|
] }),
|
|
7244
|
-
/* @__PURE__ */ (0,
|
|
7245
|
-
/* @__PURE__ */ (0,
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
|
|
6615
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7246
6616
|
InputVariables,
|
|
7247
6617
|
{
|
|
7248
6618
|
id: "qf_sortBy",
|
|
@@ -7250,8 +6620,8 @@ var QueryFilter = ({
|
|
|
7250
6620
|
value: queryState.sortBy,
|
|
7251
6621
|
onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
|
|
7252
6622
|
disableInlineMenu: true,
|
|
7253
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7254
|
-
|
|
6623
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6624
|
+
import_design_system32.InputSelect,
|
|
7255
6625
|
{
|
|
7256
6626
|
label: sortLabel,
|
|
7257
6627
|
id: "qf_sortBy",
|
|
@@ -7272,7 +6642,7 @@ var QueryFilter = ({
|
|
|
7272
6642
|
)
|
|
7273
6643
|
}
|
|
7274
6644
|
),
|
|
7275
|
-
/* @__PURE__ */ (0,
|
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
7276
6646
|
InputVariables,
|
|
7277
6647
|
{
|
|
7278
6648
|
label: sortOrderLabel,
|
|
@@ -7280,8 +6650,8 @@ var QueryFilter = ({
|
|
|
7280
6650
|
value: queryState.sortOrder,
|
|
7281
6651
|
onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
|
|
7282
6652
|
disableInlineMenu: true,
|
|
7283
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7284
|
-
|
|
6653
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6654
|
+
import_design_system32.InputSelect,
|
|
7285
6655
|
{
|
|
7286
6656
|
label: sortOrderLabel,
|
|
7287
6657
|
id: "qf_sortOrder",
|
|
@@ -7306,7 +6676,7 @@ var QueryFilter = ({
|
|
|
7306
6676
|
|
|
7307
6677
|
// src/hooks/index.ts
|
|
7308
6678
|
init_emotion_jsx_shim();
|
|
7309
|
-
var
|
|
6679
|
+
var import_design_system33 = require("@uniformdev/design-system");
|
|
7310
6680
|
|
|
7311
6681
|
// src/utils/createLocationValidator.ts
|
|
7312
6682
|
init_emotion_jsx_shim();
|
|
@@ -7318,7 +6688,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
7318
6688
|
}
|
|
7319
6689
|
|
|
7320
6690
|
// src/index.ts
|
|
7321
|
-
var
|
|
6691
|
+
var import_design_system34 = require("@uniformdev/design-system");
|
|
7322
6692
|
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
7323
6693
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7324
6694
|
0 && (module.exports = {
|
|
@@ -7476,6 +6846,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7476
6846
|
useRequestParameter,
|
|
7477
6847
|
useUniformMeshSdk,
|
|
7478
6848
|
useVariables,
|
|
6849
|
+
variableExpression,
|
|
7479
6850
|
variablePrefix,
|
|
7480
6851
|
variableSuffix,
|
|
7481
6852
|
variablesToList,
|