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