@uniformdev/mesh-sdk-react 19.135.0 → 19.135.1-alpha.10
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.mts +674 -70
- package/dist/index.d.ts +674 -70
- package/dist/index.esm.js +3116 -724
- package/dist/index.js +3069 -650
- package/dist/index.mjs +3116 -724
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -33,67 +33,88 @@ var src_exports = {};
|
|
|
33
33
|
__export(src_exports, {
|
|
34
34
|
$createVariableNode: () => $createVariableNode,
|
|
35
35
|
$isVariableNode: () => $isVariableNode,
|
|
36
|
-
AddListButton: () =>
|
|
37
|
-
Button: () =>
|
|
38
|
-
|
|
36
|
+
AddListButton: () => import_design_system54.AddListButton,
|
|
37
|
+
Button: () => import_design_system54.Button,
|
|
38
|
+
CHECKBOX_OPERATORS: () => CHECKBOX_OPERATORS,
|
|
39
|
+
Callout: () => import_design_system54.Callout,
|
|
40
|
+
ControlledObjectSearchProvider: () => ControlledObjectSearchProvider,
|
|
39
41
|
ControlledValuePlugin: () => ControlledValuePlugin,
|
|
42
|
+
DATE_OPERATORS: () => DATE_OPERATORS,
|
|
40
43
|
DISCONNECT_VARIABLE_COMMAND: () => DISCONNECT_VARIABLE_COMMAND,
|
|
41
44
|
DamSelectedItem: () => DamSelectedItem,
|
|
42
45
|
DataRefreshButton: () => DataRefreshButton,
|
|
43
46
|
DataResourceDynamicInputProvider: () => DataResourceDynamicInputProvider,
|
|
47
|
+
DataResourceInputContext: () => DataResourceInputContext,
|
|
44
48
|
DataResourceVariablesList: () => DataResourceVariablesList,
|
|
45
49
|
DataResourceVariablesListExplicit: () => DataResourceVariablesListExplicit,
|
|
46
50
|
DataSourceEditor: () => DataSourceEditor,
|
|
47
51
|
DataTypeEditor: () => DataTypeEditor,
|
|
52
|
+
DateEditor: () => DateEditor,
|
|
53
|
+
DateRangeEditor: () => DateRangeEditor,
|
|
48
54
|
DefaultSearchRow: () => DefaultSearchRow,
|
|
49
55
|
DefaultSelectedItem: () => DefaultSelectedItem,
|
|
50
|
-
DrawerContent: () =>
|
|
56
|
+
DrawerContent: () => import_design_system54.DrawerContent,
|
|
51
57
|
EDIT_VARIABLE_COMMAND: () => EDIT_VARIABLE_COMMAND,
|
|
52
58
|
EntrySearch: () => EntrySearch,
|
|
53
|
-
|
|
59
|
+
FilterButton: () => FilterButton2,
|
|
60
|
+
FilterControls: () => FilterControls,
|
|
61
|
+
FilterEditorRenderer: () => FilterEditorRenderer,
|
|
62
|
+
FilterItem: () => FilterItem,
|
|
63
|
+
FilterItems: () => FilterItems,
|
|
64
|
+
FilterMenu: () => FilterMenu,
|
|
65
|
+
FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
|
|
66
|
+
FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
|
|
67
|
+
Heading: () => import_design_system54.Heading,
|
|
54
68
|
INSERT_VARIABLE_COMMAND: () => INSERT_VARIABLE_COMMAND,
|
|
55
69
|
Icons: () => icons_exports,
|
|
56
|
-
Input: () =>
|
|
57
|
-
InputComboBox: () =>
|
|
58
|
-
InputKeywordSearch: () =>
|
|
59
|
-
InputSelect: () =>
|
|
60
|
-
InputToggle: () =>
|
|
70
|
+
Input: () => import_design_system54.Input,
|
|
71
|
+
InputComboBox: () => import_design_system54.InputComboBox,
|
|
72
|
+
InputKeywordSearch: () => import_design_system54.InputKeywordSearch,
|
|
73
|
+
InputSelect: () => import_design_system54.InputSelect,
|
|
74
|
+
InputToggle: () => import_design_system54.InputToggle,
|
|
61
75
|
InputVariables: () => InputVariables,
|
|
62
|
-
Label: () =>
|
|
76
|
+
Label: () => import_design_system54.Label,
|
|
63
77
|
LinkButton: () => LinkButton,
|
|
64
|
-
LoadingIndicator: () =>
|
|
65
|
-
LoadingOverlay: () =>
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
LoadingIndicator: () => import_design_system54.LoadingIndicator,
|
|
79
|
+
LoadingOverlay: () => import_design_system54.LoadingOverlay,
|
|
80
|
+
MULTI_SELECT_OPERATORS: () => MULTI_SELECT_OPERATORS,
|
|
81
|
+
Menu: () => import_design_system54.Menu,
|
|
82
|
+
MenuItem: () => import_design_system54.MenuItem,
|
|
68
83
|
MeshApp: () => MeshApp,
|
|
84
|
+
NUMBER_OPERATORS: () => NUMBER_OPERATORS,
|
|
85
|
+
NumberEditor: () => NumberEditor,
|
|
86
|
+
NumberRangeEditor: () => NumberRangeEditor,
|
|
69
87
|
OPEN_INSERT_VARIABLE_COMMAND: () => OPEN_INSERT_VARIABLE_COMMAND,
|
|
70
88
|
ObjectSearchContainer: () => ObjectSearchContainer,
|
|
89
|
+
ObjectSearchContext: () => ObjectSearchContext,
|
|
71
90
|
ObjectSearchFilter: () => ObjectSearchFilter,
|
|
72
91
|
ObjectSearchFilterContainer: () => ObjectSearchFilterContainer2,
|
|
73
92
|
ObjectSearchListItem: () => ObjectSearchListItem,
|
|
74
93
|
ObjectSearchListItemLoadingSkeleton: () => ObjectSearchListItemLoadingSkeleton,
|
|
94
|
+
ObjectSearchListOfSearchResults: () => ObjectSearchListOfSearchResults,
|
|
75
95
|
ObjectSearchProvider: () => ObjectSearchProvider,
|
|
76
96
|
ObjectSearchResultItem: () => ObjectSearchResultItem,
|
|
77
97
|
ObjectSearchResultItemButton: () => ObjectSearchResultItemButton,
|
|
78
98
|
ObjectSearchResultList: () => ObjectSearchResultList,
|
|
99
|
+
PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
|
|
79
100
|
ParamTypeDynamicDataProvider: () => ParamTypeDynamicDataProvider,
|
|
80
101
|
ParameterConnectionIndicator: () => ParameterConnectionIndicator,
|
|
81
|
-
ParameterGroup: () =>
|
|
82
|
-
ParameterImage: () =>
|
|
83
|
-
ParameterImageInner: () =>
|
|
84
|
-
ParameterInput: () =>
|
|
85
|
-
ParameterInputInner: () =>
|
|
86
|
-
ParameterLabel: () =>
|
|
87
|
-
ParameterMenuButton: () =>
|
|
102
|
+
ParameterGroup: () => import_design_system54.ParameterGroup,
|
|
103
|
+
ParameterImage: () => import_design_system54.ParameterImage,
|
|
104
|
+
ParameterImageInner: () => import_design_system54.ParameterImageInner,
|
|
105
|
+
ParameterInput: () => import_design_system54.ParameterInput,
|
|
106
|
+
ParameterInputInner: () => import_design_system54.ParameterInputInner,
|
|
107
|
+
ParameterLabel: () => import_design_system54.ParameterLabel,
|
|
108
|
+
ParameterMenuButton: () => import_design_system54.ParameterMenuButton,
|
|
88
109
|
ParameterOrSingleVariable: () => ParameterOrSingleVariable,
|
|
89
|
-
ParameterSelect: () =>
|
|
90
|
-
ParameterSelectInner: () =>
|
|
91
|
-
ParameterShell: () =>
|
|
110
|
+
ParameterSelect: () => import_design_system54.ParameterSelect,
|
|
111
|
+
ParameterSelectInner: () => import_design_system54.ParameterSelectInner,
|
|
112
|
+
ParameterShell: () => import_design_system54.ParameterShell,
|
|
92
113
|
ParameterShellContext: () => import_design_system14.ParameterShellContext,
|
|
93
|
-
ParameterTextarea: () =>
|
|
94
|
-
ParameterTextareaInner: () =>
|
|
95
|
-
ParameterToggle: () =>
|
|
96
|
-
ParameterToggleInner: () =>
|
|
114
|
+
ParameterTextarea: () => import_design_system54.ParameterTextarea,
|
|
115
|
+
ParameterTextareaInner: () => import_design_system54.ParameterTextareaInner,
|
|
116
|
+
ParameterToggle: () => import_design_system54.ParameterToggle,
|
|
117
|
+
ParameterToggleInner: () => import_design_system54.ParameterToggleInner,
|
|
97
118
|
ParameterVariables: () => ParameterVariables,
|
|
98
119
|
ProductPreviewList: () => ProductPreviewList,
|
|
99
120
|
ProductQuery: () => ProductQuery,
|
|
@@ -103,6 +124,7 @@ __export(src_exports, {
|
|
|
103
124
|
ProductSearchRow: () => ProductSearchRow,
|
|
104
125
|
ProductSelectedItem: () => ProductSelectedItem,
|
|
105
126
|
QueryFilter: () => QueryFilter,
|
|
127
|
+
RICHTEXT_OPERATORS: () => RICHTEXT_OPERATORS,
|
|
106
128
|
RequestBody: () => RequestBody,
|
|
107
129
|
RequestHeaders: () => RequestHeaders,
|
|
108
130
|
RequestMethodSelect: () => RequestMethodSelect,
|
|
@@ -112,19 +134,37 @@ __export(src_exports, {
|
|
|
112
134
|
RequestUrl: () => RequestUrl,
|
|
113
135
|
RequestUrlInput: () => RequestUrlInput,
|
|
114
136
|
ResolvableLoadingValue: () => ResolvableLoadingValue,
|
|
115
|
-
|
|
116
|
-
|
|
137
|
+
SELECT_OPERATORS: () => SELECT_OPERATORS,
|
|
138
|
+
SYSTEM_DATE_OPERATORS: () => SYSTEM_DATE_OPERATORS,
|
|
139
|
+
SYSTEM_FIELD_OPERATORS: () => SYSTEM_FIELD_OPERATORS,
|
|
140
|
+
ScrollableList: () => import_design_system54.ScrollableList,
|
|
141
|
+
ScrollableListItem: () => import_design_system54.ScrollableListItem,
|
|
142
|
+
SearchAndFilter: () => SearchAndFilter,
|
|
143
|
+
SearchAndFilterContext: () => SearchAndFilterContext,
|
|
144
|
+
SearchAndFilterOptionsContainer: () => SearchAndFilterOptionsContainer2,
|
|
145
|
+
SearchAndFilterProvider: () => SearchAndFilterProvider,
|
|
146
|
+
SearchAndFilterResultContainer: () => SearchAndFilterResultContainer,
|
|
147
|
+
SearchOnlyContext: () => SearchOnlyContext,
|
|
148
|
+
SearchOnlyFilter: () => SearchOnlyFilter,
|
|
117
149
|
SelectionField: () => SelectionField,
|
|
118
|
-
|
|
150
|
+
SortItems: () => SortItems,
|
|
151
|
+
StatusMultiEditor: () => StatusMultiEditor,
|
|
152
|
+
StatusSingleEditor: () => StatusSingleEditor,
|
|
153
|
+
Switch: () => import_design_system54.Switch,
|
|
154
|
+
TEXTBOX_OPERATORS: () => TEXTBOX_OPERATORS,
|
|
155
|
+
TextEditor: () => TextEditor,
|
|
119
156
|
TextVariableRenderer: () => TextVariableRenderer,
|
|
120
|
-
Textarea: () =>
|
|
121
|
-
Theme: () =>
|
|
157
|
+
Textarea: () => import_design_system54.Textarea,
|
|
158
|
+
Theme: () => import_design_system54.Theme,
|
|
159
|
+
USER_OPERATORS: () => USER_OPERATORS,
|
|
122
160
|
VariableEditor: () => VariableEditor,
|
|
123
161
|
VariableNode: () => VariableNode,
|
|
124
162
|
VariablesList: () => VariablesList,
|
|
125
163
|
VariablesPlugin: () => VariablesPlugin,
|
|
126
164
|
VariablesProvider: () => VariablesProvider,
|
|
127
165
|
badgeIcon: () => badgeIcon,
|
|
166
|
+
bindQuery: () => bindQuery,
|
|
167
|
+
bindableFiltersMapper: () => bindableFiltersMapper,
|
|
128
168
|
convertConnectedDataToVariable: () => convertConnectedDataToVariable,
|
|
129
169
|
createLocationValidator: () => createLocationValidator,
|
|
130
170
|
damSelectItemImage: () => damSelectItemImage,
|
|
@@ -155,6 +195,7 @@ __export(src_exports, {
|
|
|
155
195
|
entrySearchSelectInput: () => entrySearchSelectInput,
|
|
156
196
|
entrySearchSelectOption: () => entrySearchSelectOption,
|
|
157
197
|
entrySearchWrapper: () => entrySearchWrapper,
|
|
198
|
+
filterMapper: () => filterMapper,
|
|
158
199
|
hasReferencedVariables: () => hasReferencedVariables,
|
|
159
200
|
prettifyBindExpression: () => prettifyBindExpression,
|
|
160
201
|
productSearchRowActiveIcon: () => productSearchRowActiveIcon,
|
|
@@ -196,6 +237,7 @@ __export(src_exports, {
|
|
|
196
237
|
urlEncodeRequestUrl: () => urlEncodeRequestUrl,
|
|
197
238
|
useConnectedDataAsVariables: () => useConnectedDataAsVariables,
|
|
198
239
|
useContentDataResourceLocaleInfo: () => useContentDataResourceLocaleInfo,
|
|
240
|
+
useDataResourceDynamicInputs: () => useDataResourceDynamicInputs,
|
|
199
241
|
useDynamicInputsAsVariables: () => useDynamicInputsAsVariables,
|
|
200
242
|
useMeshLocation: () => useMeshLocation,
|
|
201
243
|
useObjectSearchContext: () => useObjectSearchContext,
|
|
@@ -205,10 +247,12 @@ __export(src_exports, {
|
|
|
205
247
|
useRequest: () => useRequest,
|
|
206
248
|
useRequestHeader: () => useRequestHeader,
|
|
207
249
|
useRequestParameter: () => useRequestParameter,
|
|
250
|
+
useSearchAndFilter: () => useSearchAndFilter,
|
|
208
251
|
useUniformMeshSdk: () => useUniformMeshSdk,
|
|
209
252
|
useVariableEditor: () => useVariableEditor,
|
|
210
253
|
useVariables: () => useVariables,
|
|
211
254
|
useVariablesMenu: () => useVariablesMenu,
|
|
255
|
+
utilityColors: () => import_design_system54.utilityColors,
|
|
212
256
|
variableDefaultTextValue: () => variableDefaultTextValue,
|
|
213
257
|
variablePrefix: () => variablePrefix,
|
|
214
258
|
variableSuffix: () => variableSuffix,
|
|
@@ -2855,6 +2899,9 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2855
2899
|
] }) : null;
|
|
2856
2900
|
}
|
|
2857
2901
|
|
|
2902
|
+
// src/components/DataResourceDynamicInputProvider.tsx
|
|
2903
|
+
var import_react59 = require("react");
|
|
2904
|
+
|
|
2858
2905
|
// src/hooks/useConnectedDataAsVariables.tsx
|
|
2859
2906
|
var import_react26 = require("react");
|
|
2860
2907
|
function useConnectedDataAsVariables(connectedData) {
|
|
@@ -3138,7 +3185,8 @@ var import_react40 = require("react");
|
|
|
3138
3185
|
|
|
3139
3186
|
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
3140
3187
|
function prettifyBindExpression(bindExpression) {
|
|
3141
|
-
|
|
3188
|
+
const [, expression] = bindExpression.split(":");
|
|
3189
|
+
return expression;
|
|
3142
3190
|
}
|
|
3143
3191
|
|
|
3144
3192
|
// src/components/Variables/composer/VariableChip.tsx
|
|
@@ -3158,42 +3206,58 @@ function VariableChip({
|
|
|
3158
3206
|
}) {
|
|
3159
3207
|
const hasClickEvent = !!onClick;
|
|
3160
3208
|
const referenceIsValidFr = isFresh ? true : referenceIsValid;
|
|
3161
|
-
const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
|
|
3209
|
+
const Wrapper = referenceIsValidFr === "warning" ? WarningVariableReference : referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
|
|
3162
3210
|
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
|
|
3211
|
+
const chippy = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.MultilineChip, { onClick, "aria-selected": selected ? true : void 0, "aria-disabled": disabled, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || reference }) });
|
|
3212
|
+
if (tooltip) {
|
|
3213
|
+
const tip = tooltip ? `${tooltip}${extraTitle ? `
|
|
3214
|
+
|
|
3215
|
+
${extraTitle}` : ""}` : extraTitle != null ? extraTitle : "";
|
|
3216
|
+
const tipLines = tip.split("\n");
|
|
3217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3218
|
+
import_design_system15.Tooltip,
|
|
3219
|
+
{
|
|
3220
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.VerticalRhythm, { gap: "sm", children: tipLines.map((t, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: t }, index)) }),
|
|
3221
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: chippy })
|
|
3222
|
+
}
|
|
3223
|
+
);
|
|
3224
|
+
}
|
|
3225
|
+
return chippy;
|
|
3226
|
+
}
|
|
3227
|
+
function UndefinedVariableReference({ children }) {
|
|
3163
3228
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3164
|
-
|
|
3229
|
+
"span",
|
|
3165
3230
|
{
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || reference })
|
|
3231
|
+
style: {
|
|
3232
|
+
textDecoration: "underline",
|
|
3233
|
+
textDecorationStyle: "wavy",
|
|
3234
|
+
textDecorationColor: "var(--error)"
|
|
3235
|
+
},
|
|
3236
|
+
children
|
|
3173
3237
|
}
|
|
3174
3238
|
);
|
|
3175
3239
|
}
|
|
3176
|
-
function
|
|
3240
|
+
function InfoVariableReference({ children }) {
|
|
3177
3241
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3178
3242
|
"span",
|
|
3179
3243
|
{
|
|
3180
3244
|
style: {
|
|
3181
3245
|
textDecoration: "underline",
|
|
3182
3246
|
textDecorationStyle: "wavy",
|
|
3183
|
-
textDecorationColor: "
|
|
3247
|
+
textDecorationColor: "var(--primary-action-default)"
|
|
3184
3248
|
},
|
|
3185
3249
|
children
|
|
3186
3250
|
}
|
|
3187
3251
|
);
|
|
3188
3252
|
}
|
|
3189
|
-
function
|
|
3253
|
+
function WarningVariableReference({ children }) {
|
|
3190
3254
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3191
3255
|
"span",
|
|
3192
3256
|
{
|
|
3193
3257
|
style: {
|
|
3194
3258
|
textDecoration: "underline",
|
|
3195
3259
|
textDecorationStyle: "wavy",
|
|
3196
|
-
textDecorationColor: "
|
|
3260
|
+
textDecorationColor: "var(--alert)"
|
|
3197
3261
|
},
|
|
3198
3262
|
children
|
|
3199
3263
|
}
|
|
@@ -3441,7 +3505,8 @@ function VariablesProvider({
|
|
|
3441
3505
|
readOnly,
|
|
3442
3506
|
isLoading,
|
|
3443
3507
|
children,
|
|
3444
|
-
knownUndefinedValues = {}
|
|
3508
|
+
knownUndefinedValues = {},
|
|
3509
|
+
onChangeKnownUndefinedValue
|
|
3445
3510
|
}) {
|
|
3446
3511
|
const [editing, setEditing] = (0, import_react37.useState)();
|
|
3447
3512
|
const [editingContext, setEditingContext] = (0, import_react37.useState)();
|
|
@@ -3508,6 +3573,15 @@ function VariablesProvider({
|
|
|
3508
3573
|
isLoading: !!isLoading
|
|
3509
3574
|
};
|
|
3510
3575
|
}, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
|
|
3576
|
+
(0, import_react37.useEffect)(() => {
|
|
3577
|
+
if (editing === void 0) {
|
|
3578
|
+
return;
|
|
3579
|
+
}
|
|
3580
|
+
const activeElement = document.activeElement;
|
|
3581
|
+
if (activeElement && "blur" in activeElement && typeof activeElement.blur === "function") {
|
|
3582
|
+
activeElement.blur();
|
|
3583
|
+
}
|
|
3584
|
+
}, [editing]);
|
|
3511
3585
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
|
|
3512
3586
|
children,
|
|
3513
3587
|
typeof editing !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -3516,9 +3590,19 @@ function VariablesProvider({
|
|
|
3516
3590
|
context: editingContext,
|
|
3517
3591
|
onSubmit: (val, editorCompletedContext) => {
|
|
3518
3592
|
contextValue.dispatch({ type: "cancelEdit" });
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3593
|
+
if ("resultType" in val) {
|
|
3594
|
+
if (!onChangeKnownUndefinedValue) {
|
|
3595
|
+
throw new Error(
|
|
3596
|
+
"onChangeKnownUndefinedValue must be provided to handle known-undefined-value results"
|
|
3597
|
+
);
|
|
3598
|
+
}
|
|
3599
|
+
const { name, ...kuv } = val;
|
|
3600
|
+
onChangeKnownUndefinedValue(val.name, kuv);
|
|
3601
|
+
} else {
|
|
3602
|
+
const { name, ...varValue } = val;
|
|
3603
|
+
const latestValue = { ...value, [name]: varValue };
|
|
3604
|
+
onChange == null ? void 0 : onChange(latestValue);
|
|
3605
|
+
}
|
|
3522
3606
|
events.emit("editCompleted", {
|
|
3523
3607
|
canceled: false,
|
|
3524
3608
|
selectedVariable: val,
|
|
@@ -3933,21 +4017,21 @@ function VariablesPlugin({
|
|
|
3933
4017
|
]);
|
|
3934
4018
|
const updateExistingNodeIfChanged = (0, import_react39.useCallback)(
|
|
3935
4019
|
(variableNode) => {
|
|
3936
|
-
var _a, _b, _c;
|
|
4020
|
+
var _a, _b, _c, _d;
|
|
3937
4021
|
const targetVar = variablesRef.current.variables[variableNode.reference];
|
|
3938
4022
|
const targetUndefinedVar = variablesRef.current.knownUndefinedValues[variableNode.reference];
|
|
3939
4023
|
const isLoadingVariables = variablesRef.current.isLoading;
|
|
3940
4024
|
const currentState = variableNode.getState();
|
|
3941
|
-
if (currentState.isFresh && !targetVar) {
|
|
4025
|
+
if (currentState.isFresh && !targetVar && !targetUndefinedVar) {
|
|
3942
4026
|
return;
|
|
3943
4027
|
}
|
|
3944
|
-
const tooltip = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
|
|
4028
|
+
const tooltip = (_d = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
|
|
3945
4029
|
const newState = {
|
|
3946
4030
|
...currentState,
|
|
3947
4031
|
displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
|
|
3948
4032
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
3949
4033
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
3950
|
-
referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
|
|
4034
|
+
referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
|
|
3951
4035
|
tooltip,
|
|
3952
4036
|
isFresh: false
|
|
3953
4037
|
};
|
|
@@ -3963,7 +4047,7 @@ function VariablesPlugin({
|
|
|
3963
4047
|
updateExistingNodeIfChanged(variableNode);
|
|
3964
4048
|
});
|
|
3965
4049
|
});
|
|
3966
|
-
}, [editor, variables, canEditVariable, updateExistingNodeIfChanged]);
|
|
4050
|
+
}, [editor, variables, knownUndefinedValues, canEditVariable, updateExistingNodeIfChanged]);
|
|
3967
4051
|
(0, import_react39.useEffect)(() => {
|
|
3968
4052
|
return editor.registerNodeTransform(VariableNode, (variableNode) => {
|
|
3969
4053
|
updateExistingNodeIfChanged(variableNode);
|
|
@@ -4231,8 +4315,9 @@ function $isTargetWithinDecorator(target) {
|
|
|
4231
4315
|
}
|
|
4232
4316
|
|
|
4233
4317
|
// src/components/Variables/InputVariables.tsx
|
|
4234
|
-
var
|
|
4235
|
-
var
|
|
4318
|
+
var import_react51 = require("@emotion/react");
|
|
4319
|
+
var import_design_system21 = require("@uniformdev/design-system");
|
|
4320
|
+
var import_react52 = require("react");
|
|
4236
4321
|
var import_uuid2 = require("uuid");
|
|
4237
4322
|
|
|
4238
4323
|
// src/components/Variables/composer/EditorRefPlugin.tsx
|
|
@@ -4337,6 +4422,7 @@ var input = import_react42.css`
|
|
|
4337
4422
|
var inputCompact = import_react42.css`
|
|
4338
4423
|
border: 1px solid var(--white);
|
|
4339
4424
|
padding-block: var(--spacing-sm);
|
|
4425
|
+
min-height: 39px;
|
|
4340
4426
|
font-size: var(--fs-sm);
|
|
4341
4427
|
`;
|
|
4342
4428
|
var inputDisabled = import_react42.css`
|
|
@@ -4346,19 +4432,112 @@ var inputDisabled = import_react42.css`
|
|
|
4346
4432
|
var placeholderCaption = import_react42.css`
|
|
4347
4433
|
position: absolute;
|
|
4348
4434
|
color: var(--gray-400);
|
|
4349
|
-
inset: var(--spacing-base)
|
|
4435
|
+
inset: 12px var(--spacing-base) 12px var(--spacing-sm);
|
|
4350
4436
|
overflow: hidden;
|
|
4351
4437
|
text-overflow: ellipsis;
|
|
4352
4438
|
white-space: nowrap;
|
|
4353
4439
|
pointer-events: none;
|
|
4354
4440
|
`;
|
|
4355
4441
|
var placeholderCompact = import_react42.css`
|
|
4356
|
-
inset: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-
|
|
4442
|
+
inset: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-sm);
|
|
4443
|
+
`;
|
|
4444
|
+
|
|
4445
|
+
// src/components/Variables/styles/ParameterVariables.styles.ts
|
|
4446
|
+
var import_react43 = require("@emotion/react");
|
|
4447
|
+
var import_design_system19 = require("@uniformdev/design-system");
|
|
4448
|
+
var variableBindButton = import_react43.css`
|
|
4449
|
+
align-items: center;
|
|
4450
|
+
border: none;
|
|
4451
|
+
border-radius: var(--rounded-base);
|
|
4452
|
+
background: none;
|
|
4453
|
+
display: flex;
|
|
4454
|
+
height: 1.2rem;
|
|
4455
|
+
padding: var(--spacing-2xs);
|
|
4456
|
+
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
4457
|
+
color var(--duration-fast) var(--timing-ease-out);
|
|
4458
|
+
width: 1.2rem;
|
|
4459
|
+
|
|
4460
|
+
&:hover,
|
|
4461
|
+
&[aria-pressed='true']:not(:disabled) {
|
|
4462
|
+
background: var(--brand-secondary-3);
|
|
4463
|
+
color: var(--white);
|
|
4464
|
+
}
|
|
4465
|
+
|
|
4466
|
+
&[aria-disabled='true'] {
|
|
4467
|
+
background: none;
|
|
4468
|
+
color: currentColor;
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4471
|
+
// fixes menu resizing issue within iframes
|
|
4472
|
+
// see https://linear.app/uniform/issue/UNI-3068/mesh-integration-resizing-with-menus
|
|
4473
|
+
+ [role='menu'] {
|
|
4474
|
+
max-height: unset;
|
|
4475
|
+
}
|
|
4476
|
+
`;
|
|
4477
|
+
var input2 = import_react43.css`
|
|
4478
|
+
display: block;
|
|
4479
|
+
appearance: none;
|
|
4480
|
+
box-sizing: border-box;
|
|
4481
|
+
background: var(--white);
|
|
4482
|
+
border: 1px solid var(--gray-200);
|
|
4483
|
+
border-radius: var(--rounded-sm);
|
|
4484
|
+
color: var(--gray-700);
|
|
4485
|
+
font-size: var(--fs-sm);
|
|
4486
|
+
line-height: 1.5;
|
|
4487
|
+
min-height: 2rem;
|
|
4488
|
+
padding: var(--spacing-sm);
|
|
4489
|
+
width: 100%;
|
|
4490
|
+
position: relative;
|
|
4491
|
+
white-space: normal;
|
|
4492
|
+
transition-property: background, border-color, color, box-shadow, border-radius;
|
|
4493
|
+
transition-duration: var(--duration-fast);
|
|
4494
|
+
transition-timing-function: var(--timing-ease-out);
|
|
4495
|
+
|
|
4496
|
+
&::placeholder {
|
|
4497
|
+
color: var(--gray-400);
|
|
4498
|
+
}
|
|
4499
|
+
|
|
4500
|
+
&:focus,
|
|
4501
|
+
&:focus-within {
|
|
4502
|
+
border-radius: var(--rounded-sm);
|
|
4503
|
+
box-shadow: var(--elevation-100);
|
|
4504
|
+
border: 1px solid var(--accent-dark-active);
|
|
4505
|
+
outline: none;
|
|
4506
|
+
}
|
|
4507
|
+
&:hover {
|
|
4508
|
+
border: 1px solid var(--accent-dark-hover);
|
|
4509
|
+
}
|
|
4510
|
+
|
|
4511
|
+
&:disabled,
|
|
4512
|
+
&:disabled::placeholder,
|
|
4513
|
+
&:disabled:hover {
|
|
4514
|
+
border-radius: var(--rounded-sm);
|
|
4515
|
+
cursor: not-allowed;
|
|
4516
|
+
color: var(--gray-400);
|
|
4517
|
+
}
|
|
4518
|
+
|
|
4519
|
+
&[readonly],
|
|
4520
|
+
&[contenteditable='false'] {
|
|
4521
|
+
cursor: not-allowed;
|
|
4522
|
+
color: var(--gray-400);
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4525
|
+
> p {
|
|
4526
|
+
margin: 0;
|
|
4527
|
+
}
|
|
4528
|
+
`;
|
|
4529
|
+
var inputMultiLine = (lines) => import_react43.css`
|
|
4530
|
+
${import_design_system19.scrollbarStyles}
|
|
4531
|
+
// 1.5 = line height, spacing-sm = top and bottom padding + spacing-xs to give a slight increase in height
|
|
4532
|
+
// as the text looked to close to the bottom of the input
|
|
4533
|
+
height: calc(${lines * 1.5}em + var(--spacing-sm) + var(--spacing-xs));
|
|
4534
|
+
resize: vertical;
|
|
4535
|
+
overflow: auto;
|
|
4357
4536
|
`;
|
|
4358
4537
|
|
|
4359
4538
|
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4360
4539
|
var React10 = __toESM(require("react"));
|
|
4361
|
-
var
|
|
4540
|
+
var import_react44 = require("react");
|
|
4362
4541
|
|
|
4363
4542
|
// src/components/Variables/util/hasReferencedVariables.ts
|
|
4364
4543
|
var import_canvas5 = require("@uniformdev/canvas");
|
|
@@ -4403,7 +4582,7 @@ function useInputVariablesState({
|
|
|
4403
4582
|
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
|
|
4404
4583
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4405
4584
|
const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
|
|
4406
|
-
const sharedMenuProps = (0,
|
|
4585
|
+
const sharedMenuProps = (0, import_react44.useMemo)(
|
|
4407
4586
|
() => ({
|
|
4408
4587
|
menuTooltip,
|
|
4409
4588
|
showAddVariableMenuOption,
|
|
@@ -4434,15 +4613,15 @@ function useInputVariablesState({
|
|
|
4434
4613
|
}
|
|
4435
4614
|
|
|
4436
4615
|
// src/components/Variables/toolbox/VariableField.styles.ts
|
|
4437
|
-
var
|
|
4438
|
-
var labelText =
|
|
4616
|
+
var import_react45 = require("@emotion/react");
|
|
4617
|
+
var labelText = import_react45.css`
|
|
4439
4618
|
align-items: center;
|
|
4440
4619
|
display: flex;
|
|
4441
4620
|
gap: var(--spacing-xs);
|
|
4442
4621
|
font-weight: var(--fw-regular);
|
|
4443
4622
|
margin: 0 0 var(--spacing-xs);
|
|
4444
4623
|
`;
|
|
4445
|
-
var
|
|
4624
|
+
var variableBindButton2 = import_react45.css`
|
|
4446
4625
|
align-items: center;
|
|
4447
4626
|
border: none;
|
|
4448
4627
|
border-radius: var(--rounded-base);
|
|
@@ -4473,8 +4652,8 @@ var import_lexical6 = require("lexical");
|
|
|
4473
4652
|
// src/components/Variables/toolbox/SelectVariableMenu.tsx
|
|
4474
4653
|
var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
|
|
4475
4654
|
var import_CgUsbC = require("@react-icons/all-files/cg/CgUsbC");
|
|
4476
|
-
var
|
|
4477
|
-
var
|
|
4655
|
+
var import_design_system20 = require("@uniformdev/design-system");
|
|
4656
|
+
var import_react46 = require("react");
|
|
4478
4657
|
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4479
4658
|
function SelectVariableMenu({
|
|
4480
4659
|
onSelectVariable,
|
|
@@ -4489,7 +4668,7 @@ function SelectVariableMenu({
|
|
|
4489
4668
|
filterVariable
|
|
4490
4669
|
}) {
|
|
4491
4670
|
const { variables, canDispatch, readOnly } = useVariables(true);
|
|
4492
|
-
const btnRef = (0,
|
|
4671
|
+
const btnRef = (0, import_react46.useRef)(null);
|
|
4493
4672
|
const { editVariable } = useVariableEditor();
|
|
4494
4673
|
const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
|
|
4495
4674
|
const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
|
|
@@ -4498,7 +4677,7 @@ function SelectVariableMenu({
|
|
|
4498
4677
|
return null;
|
|
4499
4678
|
}
|
|
4500
4679
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4501
|
-
|
|
4680
|
+
import_design_system20.Menu,
|
|
4502
4681
|
{
|
|
4503
4682
|
placement: portal ? "bottom-end" : "bottom-start",
|
|
4504
4683
|
portal,
|
|
@@ -4517,7 +4696,7 @@ function SelectVariableMenu({
|
|
|
4517
4696
|
menuLabel: menuTooltip,
|
|
4518
4697
|
children: [
|
|
4519
4698
|
showAddVariableMenuOptionForReals ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4520
|
-
|
|
4699
|
+
import_design_system20.MenuItem,
|
|
4521
4700
|
{
|
|
4522
4701
|
onClick: async () => {
|
|
4523
4702
|
const result = await editVariable("", getEditorContext == null ? void 0 : getEditorContext());
|
|
@@ -4527,19 +4706,19 @@ function SelectVariableMenu({
|
|
|
4527
4706
|
onSelectVariable == null ? void 0 : onSelectVariable(result.selectedVariable);
|
|
4528
4707
|
},
|
|
4529
4708
|
"data-testid": "add-variable-button",
|
|
4530
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_design_system20.HorizontalRhythm, { gap: "sm", align: "center", children: [
|
|
4531
4710
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_BsFillPlusCircleFill.BsFillPlusCircleFill, { fill: "var(--gray-500)", size: "1.25em" }),
|
|
4532
4711
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: typeof showAddVariableMenuOption === "string" ? showAddVariableMenuOption : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: "Add\u2026" }) })
|
|
4533
4712
|
] })
|
|
4534
4713
|
}
|
|
4535
4714
|
) : null,
|
|
4536
|
-
showAddVariableMenuOptionForReals && menuHasVariableOptions ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4715
|
+
showAddVariableMenuOptionForReals && menuHasVariableOptions ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuItemSeparator, {}) : null,
|
|
4537
4716
|
variablesGroups.map((group) => {
|
|
4538
4717
|
var _a;
|
|
4539
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuGroup, { title: (_a = group.name) != null ? _a : "", children: group.variables.map((variable) => {
|
|
4540
4719
|
const { name, displayName, helpText } = variable;
|
|
4541
4720
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4542
|
-
|
|
4721
|
+
import_design_system20.MenuItem,
|
|
4543
4722
|
{
|
|
4544
4723
|
id: name,
|
|
4545
4724
|
css: menuItemTextGroup,
|
|
@@ -4553,9 +4732,9 @@ function SelectVariableMenu({
|
|
|
4553
4732
|
);
|
|
4554
4733
|
}) }, group.name);
|
|
4555
4734
|
}),
|
|
4556
|
-
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4557
|
-
onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4558
|
-
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4735
|
+
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuItemSeparator, {}) : null,
|
|
4736
|
+
onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuItem, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
|
|
4737
|
+
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuItemSeparator, {}) : null,
|
|
4559
4738
|
tip ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("i", { css: variablesTipText, children: tip }) : null
|
|
4560
4739
|
]
|
|
4561
4740
|
}
|
|
@@ -4601,14 +4780,14 @@ function VariableField({
|
|
|
4601
4780
|
}) {
|
|
4602
4781
|
const { variables } = useVariables(true);
|
|
4603
4782
|
const varCount = Object.keys(variables).length;
|
|
4604
|
-
const variableSelector = (varCount > 0 || (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.showAddVariableMenuOption)) && !disableVariables ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4783
|
+
const variableSelector = (varCount > 0 || (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.showAddVariableMenuOption)) && !disableVariables ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-testid": "label-var-menu", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4605
4784
|
VariablesComposerVariableMenu,
|
|
4606
4785
|
{
|
|
4607
4786
|
...selectVariableMenuOptions,
|
|
4608
|
-
buttonCss: [
|
|
4787
|
+
buttonCss: [variableBindButton2, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
|
|
4609
4788
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
4610
4789
|
}
|
|
4611
|
-
) : null;
|
|
4790
|
+
) }) : null;
|
|
4612
4791
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { "data-testid": "variable-field", children: [
|
|
4613
4792
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { htmlFor: id, css: labelText, "data-testid": "field-name", children: [
|
|
4614
4793
|
variableSelector,
|
|
@@ -4623,14 +4802,14 @@ var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlug
|
|
|
4623
4802
|
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
4624
4803
|
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
4625
4804
|
var import_LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
|
|
4626
|
-
var
|
|
4805
|
+
var import_react49 = require("react");
|
|
4627
4806
|
|
|
4628
4807
|
// src/components/Variables/composer/DisablePlugin.tsx
|
|
4629
4808
|
var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
|
|
4630
|
-
var
|
|
4809
|
+
var import_react47 = require("react");
|
|
4631
4810
|
function DisablePlugin({ disabled }) {
|
|
4632
4811
|
const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
|
|
4633
|
-
(0,
|
|
4812
|
+
(0, import_react47.useEffect)(() => {
|
|
4634
4813
|
editor.setEditable(!disabled);
|
|
4635
4814
|
}, [editor, disabled]);
|
|
4636
4815
|
return null;
|
|
@@ -4639,10 +4818,10 @@ function DisablePlugin({ disabled }) {
|
|
|
4639
4818
|
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4640
4819
|
var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
|
|
4641
4820
|
var import_lexical7 = require("lexical");
|
|
4642
|
-
var
|
|
4821
|
+
var import_react48 = require("react");
|
|
4643
4822
|
function SingleLineTextPlugin() {
|
|
4644
4823
|
const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
|
|
4645
|
-
(0,
|
|
4824
|
+
(0, import_react48.useEffect)(() => {
|
|
4646
4825
|
editor.registerNodeTransform(import_lexical7.LineBreakNode, (node) => {
|
|
4647
4826
|
node.remove();
|
|
4648
4827
|
});
|
|
@@ -4695,8 +4874,8 @@ function VariablesComposer(props) {
|
|
|
4695
4874
|
autoFocus,
|
|
4696
4875
|
...variablesPluginProps
|
|
4697
4876
|
} = props;
|
|
4698
|
-
const [lastEmittedValue, setLastEmittedValue] = (0,
|
|
4699
|
-
const editorConfig = (0,
|
|
4877
|
+
const [lastEmittedValue, setLastEmittedValue] = (0, import_react49.useState)(value);
|
|
4878
|
+
const editorConfig = (0, import_react49.useMemo)(
|
|
4700
4879
|
() => ({
|
|
4701
4880
|
namespace: "uniform",
|
|
4702
4881
|
onError(error) {
|
|
@@ -4708,8 +4887,8 @@ function VariablesComposer(props) {
|
|
|
4708
4887
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4709
4888
|
[]
|
|
4710
4889
|
);
|
|
4711
|
-
const editorState = (0,
|
|
4712
|
-
const updateTimeout = (0,
|
|
4890
|
+
const editorState = (0, import_react49.useRef)();
|
|
4891
|
+
const updateTimeout = (0, import_react49.useRef)();
|
|
4713
4892
|
if (typeof document === "undefined")
|
|
4714
4893
|
return null;
|
|
4715
4894
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
|
|
@@ -4752,10 +4931,10 @@ var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin")
|
|
|
4752
4931
|
var import_LexicalPlainTextPlugin = require("@lexical/react/LexicalPlainTextPlugin");
|
|
4753
4932
|
var import_utils4 = require("@lexical/utils");
|
|
4754
4933
|
var import_lexical9 = require("lexical");
|
|
4755
|
-
var
|
|
4934
|
+
var import_react50 = require("react");
|
|
4756
4935
|
var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
|
|
4757
4936
|
function VariablesComposerInput({
|
|
4758
|
-
css:
|
|
4937
|
+
css: css40,
|
|
4759
4938
|
placeholder,
|
|
4760
4939
|
...contentEditableProps
|
|
4761
4940
|
}) {
|
|
@@ -4774,7 +4953,7 @@ function VariablesComposerInput({
|
|
|
4774
4953
|
}
|
|
4775
4954
|
function RichishCopyAndPastePlugin() {
|
|
4776
4955
|
const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
|
|
4777
|
-
(0,
|
|
4956
|
+
(0, import_react50.useEffect)(() => {
|
|
4778
4957
|
return (0, import_utils4.mergeRegister)(
|
|
4779
4958
|
editor.registerCommand(
|
|
4780
4959
|
import_lexical9.COPY_COMMAND,
|
|
@@ -4858,6 +5037,7 @@ function InputVariables(props) {
|
|
|
4858
5037
|
value,
|
|
4859
5038
|
enableEditingVariables,
|
|
4860
5039
|
disableInlineMenu,
|
|
5040
|
+
showMenuPosition,
|
|
4861
5041
|
onChange,
|
|
4862
5042
|
transformPaste,
|
|
4863
5043
|
showAddVariableMenuOption,
|
|
@@ -4875,9 +5055,10 @@ function InputVariables(props) {
|
|
|
4875
5055
|
editorRef,
|
|
4876
5056
|
filterVariable,
|
|
4877
5057
|
styleVariant = "default",
|
|
4878
|
-
renderMenuInPortal
|
|
5058
|
+
renderMenuInPortal,
|
|
5059
|
+
disableDismissEditorOnChange
|
|
4879
5060
|
} = props;
|
|
4880
|
-
const [finalId] = (0,
|
|
5061
|
+
const [finalId] = (0, import_react52.useState)(id != null ? id : () => (0, import_uuid2.v4)());
|
|
4881
5062
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
4882
5063
|
const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps } = useInputVariablesState(props);
|
|
4883
5064
|
const useInputWithNoVariables = Boolean(inputWhenNoVariables && !hadVariablesInValue);
|
|
@@ -4885,46 +5066,71 @@ function InputVariables(props) {
|
|
|
4885
5066
|
"div",
|
|
4886
5067
|
{
|
|
4887
5068
|
onKeyDown: () => {
|
|
4888
|
-
if (isEditing && canDispatch) {
|
|
5069
|
+
if (!disableDismissEditorOnChange && isEditing && canDispatch) {
|
|
4889
5070
|
dispatch({ type: "cancelEdit" });
|
|
4890
5071
|
}
|
|
4891
5072
|
},
|
|
4892
5073
|
css: disabled ? inputDisabled : "",
|
|
4893
5074
|
children: [
|
|
4894
|
-
|
|
4895
|
-
|
|
5075
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
5076
|
+
import_design_system21.HorizontalRhythm,
|
|
4896
5077
|
{
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
5078
|
+
align: "center",
|
|
5079
|
+
gap: "xs",
|
|
5080
|
+
css: import_react51.css`
|
|
5081
|
+
position: relative;
|
|
5082
|
+
& > div:first-child {
|
|
5083
|
+
flex-grow: 1;
|
|
5084
|
+
}
|
|
5085
|
+
`,
|
|
5086
|
+
children: [
|
|
5087
|
+
useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5088
|
+
InputVariablesOverlayMenu,
|
|
5089
|
+
{
|
|
5090
|
+
...sharedMenuProps,
|
|
5091
|
+
disabled: disableVariablesForReals || showMenuPosition && showMenuPosition !== "label" || disableInlineMenu === true || disableInlineMenu === "by-input",
|
|
5092
|
+
portal: renderMenuInPortal,
|
|
5093
|
+
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
5094
|
+
useInputWhenNoVariables: useInputWithNoVariables,
|
|
5095
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5096
|
+
VariablesComposerInput,
|
|
5097
|
+
{
|
|
5098
|
+
id: finalId,
|
|
5099
|
+
"aria-label": ariaLabel,
|
|
5100
|
+
"data-testid": dataTestId ? dataTestId : "input-container",
|
|
5101
|
+
"data-text-value": value,
|
|
5102
|
+
css: [input, styleVariant === "compact" ? inputCompact : null],
|
|
5103
|
+
placeholder: placeholder ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5104
|
+
import_design_system21.Caption,
|
|
5105
|
+
{
|
|
5106
|
+
css: [
|
|
5107
|
+
placeholderCaption,
|
|
5108
|
+
styleVariant === "compact" ? placeholderCompact : null
|
|
5109
|
+
],
|
|
5110
|
+
children: placeholder
|
|
5111
|
+
}
|
|
5112
|
+
) : void 0
|
|
5113
|
+
}
|
|
5114
|
+
)
|
|
5115
|
+
}
|
|
5116
|
+
),
|
|
5117
|
+
disableVariablesForReals || showMenuPosition !== "inline-right" ? null : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5118
|
+
VariablesComposerVariableMenu,
|
|
5119
|
+
{
|
|
5120
|
+
...sharedMenuProps,
|
|
5121
|
+
buttonCss: variableBindButton,
|
|
5122
|
+
tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5123
|
+
buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5124
|
+
replaceValueOnVariableInsert: useInputWithNoVariables
|
|
5125
|
+
}
|
|
5126
|
+
)
|
|
5127
|
+
]
|
|
4922
5128
|
}
|
|
4923
5129
|
),
|
|
4924
|
-
caption ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4925
|
-
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4926
|
-
warningMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4927
|
-
infoMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5130
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system21.Caption, { children: caption }) : null,
|
|
5131
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system21.ErrorMessage, { message: errorMessage }) : null,
|
|
5132
|
+
warningMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system21.WarningMessage, { message: warningMessage }) : null,
|
|
5133
|
+
infoMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system21.InfoMessage, { message: infoMessage }) : null
|
|
4928
5134
|
]
|
|
4929
5135
|
}
|
|
4930
5136
|
);
|
|
@@ -4940,7 +5146,7 @@ function InputVariables(props) {
|
|
|
4940
5146
|
},
|
|
4941
5147
|
id: finalId,
|
|
4942
5148
|
isActive: hadVariablesInValue,
|
|
4943
|
-
disableVariables: disableVariablesForReals || disableInlineMenu === "by-label",
|
|
5149
|
+
disableVariables: disableVariablesForReals || showMenuPosition && showMenuPosition !== "label" || disableInlineMenu === "by-label",
|
|
4944
5150
|
children: input3
|
|
4945
5151
|
}
|
|
4946
5152
|
);
|
|
@@ -4978,7 +5184,7 @@ function InputVariablesOverlayMenu({
|
|
|
4978
5184
|
if (disabled) {
|
|
4979
5185
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
|
|
4980
5186
|
}
|
|
4981
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { css: menuContainer, children: [
|
|
5187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { css: menuContainer, "data-testid": "inline-var-menu", children: [
|
|
4982
5188
|
children,
|
|
4983
5189
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4984
5190
|
VariablesComposerVariableMenu,
|
|
@@ -4996,111 +5202,17 @@ function InputVariablesOverlayMenu({
|
|
|
4996
5202
|
var import_CgUsbC2 = require("@react-icons/all-files/cg/CgUsbC");
|
|
4997
5203
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
4998
5204
|
var import_design_system22 = require("@uniformdev/design-system");
|
|
4999
|
-
var
|
|
5000
|
-
|
|
5001
|
-
// src/components/Variables/styles/ParameterVariables.styles.ts
|
|
5002
|
-
var import_react51 = require("@emotion/react");
|
|
5003
|
-
var import_design_system21 = require("@uniformdev/design-system");
|
|
5004
|
-
var variableBindButton2 = import_react51.css`
|
|
5005
|
-
align-items: center;
|
|
5006
|
-
border: none;
|
|
5007
|
-
border-radius: var(--rounded-base);
|
|
5008
|
-
background: none;
|
|
5009
|
-
display: flex;
|
|
5010
|
-
height: 1.2rem;
|
|
5011
|
-
padding: var(--spacing-2xs);
|
|
5012
|
-
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
5013
|
-
color var(--duration-fast) var(--timing-ease-out);
|
|
5014
|
-
width: 1.2rem;
|
|
5015
|
-
|
|
5016
|
-
&:hover,
|
|
5017
|
-
&[aria-pressed='true']:not(:disabled) {
|
|
5018
|
-
background: var(--brand-secondary-3);
|
|
5019
|
-
color: var(--white);
|
|
5020
|
-
}
|
|
5021
|
-
|
|
5022
|
-
&[aria-disabled='true'] {
|
|
5023
|
-
background: none;
|
|
5024
|
-
color: currentColor;
|
|
5025
|
-
}
|
|
5026
|
-
|
|
5027
|
-
// fixes menu resizing issue within iframes
|
|
5028
|
-
// see https://linear.app/uniform/issue/UNI-3068/mesh-integration-resizing-with-menus
|
|
5029
|
-
+ [role='menu'] {
|
|
5030
|
-
max-height: unset;
|
|
5031
|
-
}
|
|
5032
|
-
`;
|
|
5033
|
-
var input2 = import_react51.css`
|
|
5034
|
-
display: block;
|
|
5035
|
-
appearance: none;
|
|
5036
|
-
box-sizing: border-box;
|
|
5037
|
-
background: var(--white);
|
|
5038
|
-
border: 1px solid var(--gray-200);
|
|
5039
|
-
border-radius: var(--rounded-sm);
|
|
5040
|
-
color: var(--gray-700);
|
|
5041
|
-
font-size: var(--fs-sm);
|
|
5042
|
-
line-height: 1.5;
|
|
5043
|
-
min-height: 2rem;
|
|
5044
|
-
padding: var(--spacing-sm);
|
|
5045
|
-
width: 100%;
|
|
5046
|
-
position: relative;
|
|
5047
|
-
white-space: normal;
|
|
5048
|
-
transition-property: background, border-color, color, box-shadow, border-radius;
|
|
5049
|
-
transition-duration: var(--duration-fast);
|
|
5050
|
-
transition-timing-function: var(--timing-ease-out);
|
|
5051
|
-
|
|
5052
|
-
&::placeholder {
|
|
5053
|
-
color: var(--gray-400);
|
|
5054
|
-
}
|
|
5055
|
-
|
|
5056
|
-
&:focus,
|
|
5057
|
-
&:focus-within {
|
|
5058
|
-
border-radius: var(--rounded-sm);
|
|
5059
|
-
box-shadow: var(--elevation-100);
|
|
5060
|
-
border: 1px solid var(--accent-dark-active);
|
|
5061
|
-
outline: none;
|
|
5062
|
-
}
|
|
5063
|
-
&:hover {
|
|
5064
|
-
border: 1px solid var(--accent-dark-hover);
|
|
5065
|
-
}
|
|
5066
|
-
|
|
5067
|
-
&:disabled,
|
|
5068
|
-
&:disabled::placeholder,
|
|
5069
|
-
&:disabled:hover {
|
|
5070
|
-
border-radius: var(--rounded-sm);
|
|
5071
|
-
cursor: not-allowed;
|
|
5072
|
-
color: var(--gray-400);
|
|
5073
|
-
}
|
|
5074
|
-
|
|
5075
|
-
&[readonly],
|
|
5076
|
-
&[contenteditable='false'] {
|
|
5077
|
-
cursor: not-allowed;
|
|
5078
|
-
color: var(--gray-400);
|
|
5079
|
-
}
|
|
5080
|
-
|
|
5081
|
-
> p {
|
|
5082
|
-
margin: 0;
|
|
5083
|
-
}
|
|
5084
|
-
`;
|
|
5085
|
-
var inputMultiLine = (lines) => import_react51.css`
|
|
5086
|
-
${import_design_system21.scrollbarStyles}
|
|
5087
|
-
// 1.5 = line height, spacing-sm = top and bottom padding + spacing-xs to give a slight increase in height
|
|
5088
|
-
// as the text looked to close to the bottom of the input
|
|
5089
|
-
height: calc(${lines * 1.5}em + var(--spacing-sm) + var(--spacing-xs));
|
|
5090
|
-
resize: vertical;
|
|
5091
|
-
overflow: auto;
|
|
5092
|
-
`;
|
|
5093
|
-
|
|
5094
|
-
// src/components/Variables/ParameterConnectionIndicator.tsx
|
|
5205
|
+
var import_react53 = require("react");
|
|
5095
5206
|
var import_jsx_runtime41 = require("@emotion/react/jsx-runtime");
|
|
5096
5207
|
function ParameterConnectionIndicator({
|
|
5097
5208
|
children,
|
|
5098
5209
|
value,
|
|
5099
5210
|
menuOptions,
|
|
5100
5211
|
disabled,
|
|
5101
|
-
menuTooltip = "Insert variable"
|
|
5212
|
+
menuTooltip = "Insert variable",
|
|
5213
|
+
overrideMenuButtonParentMargin
|
|
5102
5214
|
}) {
|
|
5103
|
-
const hasVariablesInValue = (0,
|
|
5215
|
+
const hasVariablesInValue = (0, import_react53.useMemo)(() => {
|
|
5104
5216
|
let result = false;
|
|
5105
5217
|
(0, import_canvas7.bindVariablesToObject)({
|
|
5106
5218
|
value,
|
|
@@ -5119,13 +5231,21 @@ function ParameterConnectionIndicator({
|
|
|
5119
5231
|
placement: "bottom-start",
|
|
5120
5232
|
withoutPortal: true,
|
|
5121
5233
|
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5122
|
-
"
|
|
5234
|
+
"div",
|
|
5123
5235
|
{
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5236
|
+
css: overrideMenuButtonParentMargin ? {
|
|
5237
|
+
marginBottom: overrideMenuButtonParentMargin
|
|
5238
|
+
} : void 0,
|
|
5239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5240
|
+
"button",
|
|
5241
|
+
{
|
|
5242
|
+
title: menuTooltip,
|
|
5243
|
+
"aria-pressed": hasVariablesInValue,
|
|
5244
|
+
css: [menuBtn, variableBindButton],
|
|
5245
|
+
type: "button",
|
|
5246
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_CgUsbC2.CgUsbC, { size: "1.4rem" })
|
|
5247
|
+
}
|
|
5248
|
+
)
|
|
5129
5249
|
}
|
|
5130
5250
|
),
|
|
5131
5251
|
menuLabel: menuTooltip,
|
|
@@ -5137,21 +5257,21 @@ function ParameterConnectionIndicator({
|
|
|
5137
5257
|
|
|
5138
5258
|
// src/components/Variables/ParameterOrSingleVariable.tsx
|
|
5139
5259
|
var import_design_system23 = require("@uniformdev/design-system");
|
|
5140
|
-
var
|
|
5260
|
+
var import_react55 = require("react");
|
|
5141
5261
|
|
|
5142
5262
|
// src/components/Variables/composer/OnDisconnectPlugin.tsx
|
|
5143
5263
|
var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
|
|
5144
5264
|
var import_utils5 = require("@lexical/utils");
|
|
5145
5265
|
var import_lexical10 = require("lexical");
|
|
5146
|
-
var
|
|
5266
|
+
var import_react54 = require("react");
|
|
5147
5267
|
function OnDisconnectPlugin({
|
|
5148
5268
|
onDisconnect
|
|
5149
5269
|
}) {
|
|
5150
5270
|
const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
|
|
5151
5271
|
const { variables } = useVariables(true);
|
|
5152
|
-
const variablesRef = (0,
|
|
5272
|
+
const variablesRef = (0, import_react54.useRef)(variables);
|
|
5153
5273
|
variablesRef.current = variables;
|
|
5154
|
-
(0,
|
|
5274
|
+
(0, import_react54.useEffect)(() => {
|
|
5155
5275
|
return (0, import_utils5.mergeRegister)(
|
|
5156
5276
|
editor.registerCommand(
|
|
5157
5277
|
DISCONNECT_VARIABLE_COMMAND,
|
|
@@ -5196,7 +5316,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5196
5316
|
hasVariablesInValue,
|
|
5197
5317
|
setHadVariablesInValue
|
|
5198
5318
|
} = useInputVariablesState(props);
|
|
5199
|
-
const handleDisconnect = (0,
|
|
5319
|
+
const handleDisconnect = (0, import_react55.useCallback)(
|
|
5200
5320
|
(variable) => {
|
|
5201
5321
|
setHadVariablesInValue(false);
|
|
5202
5322
|
if (onDisconnect) {
|
|
@@ -5235,7 +5355,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5235
5355
|
VariablesComposerVariableMenu,
|
|
5236
5356
|
{
|
|
5237
5357
|
...sharedMenuProps,
|
|
5238
|
-
buttonCss: [
|
|
5358
|
+
buttonCss: [variableBindButton],
|
|
5239
5359
|
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5240
5360
|
replaceValueOnVariableInsert: true,
|
|
5241
5361
|
filterVariable
|
|
@@ -5249,7 +5369,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5249
5369
|
}
|
|
5250
5370
|
|
|
5251
5371
|
// src/components/Variables/ParameterVariables.tsx
|
|
5252
|
-
var
|
|
5372
|
+
var import_react56 = require("@emotion/react");
|
|
5253
5373
|
var import_design_system24 = require("@uniformdev/design-system");
|
|
5254
5374
|
var import_jsx_runtime43 = require("@emotion/react/jsx-runtime");
|
|
5255
5375
|
function ParameterVariables(props) {
|
|
@@ -5288,19 +5408,17 @@ function ParameterVariables(props) {
|
|
|
5288
5408
|
children: [
|
|
5289
5409
|
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
5290
5410
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ControlledValuePlugin, { value, enabled: useInputWhenNoVariables }),
|
|
5291
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
}
|
|
5301
|
-
|
|
5302
|
-
children: [
|
|
5303
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5411
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system24.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5412
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5413
|
+
"div",
|
|
5414
|
+
{
|
|
5415
|
+
css: { flex: 1 },
|
|
5416
|
+
onKeyDown: () => {
|
|
5417
|
+
if (isEditing && canDispatch) {
|
|
5418
|
+
dispatch({ type: "cancelEdit" });
|
|
5419
|
+
}
|
|
5420
|
+
},
|
|
5421
|
+
children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5304
5422
|
VariablesComposerInput,
|
|
5305
5423
|
{
|
|
5306
5424
|
"aria-label": ariaLabel,
|
|
@@ -5308,24 +5426,24 @@ function ParameterVariables(props) {
|
|
|
5308
5426
|
"data-text-value": value,
|
|
5309
5427
|
css: [
|
|
5310
5428
|
input2,
|
|
5311
|
-
typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) :
|
|
5312
|
-
inputCss != null ? inputCss :
|
|
5429
|
+
typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) : import_react56.css``,
|
|
5430
|
+
inputCss != null ? inputCss : import_react56.css``
|
|
5313
5431
|
]
|
|
5314
5432
|
}
|
|
5315
|
-
) }),
|
|
5316
|
-
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5317
|
-
VariablesComposerVariableMenu,
|
|
5318
|
-
{
|
|
5319
|
-
...sharedMenuProps,
|
|
5320
|
-
buttonCss: [variableBindButton2],
|
|
5321
|
-
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5322
|
-
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5323
|
-
replaceValueOnVariableInsert: useInputWhenNoVariables
|
|
5324
|
-
}
|
|
5325
5433
|
)
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5434
|
+
}
|
|
5435
|
+
),
|
|
5436
|
+
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5437
|
+
VariablesComposerVariableMenu,
|
|
5438
|
+
{
|
|
5439
|
+
...sharedMenuProps,
|
|
5440
|
+
buttonCss: [variableBindButton],
|
|
5441
|
+
tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
|
|
5442
|
+
buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
|
|
5443
|
+
replaceValueOnVariableInsert: useInputWhenNoVariables
|
|
5444
|
+
}
|
|
5445
|
+
)
|
|
5446
|
+
] })
|
|
5329
5447
|
]
|
|
5330
5448
|
}
|
|
5331
5449
|
);
|
|
@@ -5333,7 +5451,7 @@ function ParameterVariables(props) {
|
|
|
5333
5451
|
|
|
5334
5452
|
// src/components/Variables/util/convertConnectedDataToVariable.ts
|
|
5335
5453
|
function convertConnectedDataToVariable(bindExpression, value) {
|
|
5336
|
-
const isValuePrimitive = typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
5454
|
+
const isValuePrimitive = typeof value === "string" && value.length > 0 || typeof value === "number" || typeof value === "boolean";
|
|
5337
5455
|
return {
|
|
5338
5456
|
ephemeral: true,
|
|
5339
5457
|
displayName: isValuePrimitive ? value.toString() : prettifyBindExpression(bindExpression),
|
|
@@ -5345,13 +5463,13 @@ ${prettifyBindExpression(bindExpression)}`
|
|
|
5345
5463
|
}
|
|
5346
5464
|
|
|
5347
5465
|
// src/components/Variables/VariablesList.tsx
|
|
5348
|
-
var
|
|
5466
|
+
var import_react58 = require("@emotion/react");
|
|
5349
5467
|
var import_design_system25 = require("@uniformdev/design-system");
|
|
5350
5468
|
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
|
5351
5469
|
|
|
5352
5470
|
// src/components/Variables/styles/VariablesList.styles.ts
|
|
5353
|
-
var
|
|
5354
|
-
var tableRow = (isDragging) =>
|
|
5471
|
+
var import_react57 = require("@emotion/react");
|
|
5472
|
+
var tableRow = (isDragging) => import_react57.css`
|
|
5355
5473
|
position: relative;
|
|
5356
5474
|
${isDragging ? `
|
|
5357
5475
|
display: table;
|
|
@@ -5359,7 +5477,7 @@ var tableRow = (isDragging) => import_react56.css`
|
|
|
5359
5477
|
top: auto !important;
|
|
5360
5478
|
` : void 0}
|
|
5361
5479
|
`;
|
|
5362
|
-
var tableCellDragIcon =
|
|
5480
|
+
var tableCellDragIcon = import_react57.css`
|
|
5363
5481
|
&::after {
|
|
5364
5482
|
content: '';
|
|
5365
5483
|
display: block;
|
|
@@ -5377,7 +5495,7 @@ var tableCellDragIcon = import_react56.css`
|
|
|
5377
5495
|
opacity: 1;
|
|
5378
5496
|
}
|
|
5379
5497
|
`;
|
|
5380
|
-
var variableName =
|
|
5498
|
+
var variableName = import_react57.css`
|
|
5381
5499
|
border: none;
|
|
5382
5500
|
font-weight: var(--fw-medium);
|
|
5383
5501
|
padding: 0;
|
|
@@ -5387,7 +5505,7 @@ var variableName = import_react56.css`
|
|
|
5387
5505
|
white-space: nowrap;
|
|
5388
5506
|
max-width: 20ch;
|
|
5389
5507
|
`;
|
|
5390
|
-
var variableValue =
|
|
5508
|
+
var variableValue = import_react57.css`
|
|
5391
5509
|
overflow: hidden;
|
|
5392
5510
|
text-overflow: ellipsis;
|
|
5393
5511
|
white-space: nowrap;
|
|
@@ -5464,7 +5582,7 @@ function VariablesList() {
|
|
|
5464
5582
|
title: `delete ${text}`,
|
|
5465
5583
|
css: [
|
|
5466
5584
|
import_design_system25.button,
|
|
5467
|
-
|
|
5585
|
+
import_react58.css`
|
|
5468
5586
|
background: transparent;
|
|
5469
5587
|
`
|
|
5470
5588
|
],
|
|
@@ -5498,6 +5616,10 @@ function VariablesList() {
|
|
|
5498
5616
|
|
|
5499
5617
|
// src/components/DataResourceDynamicInputProvider.tsx
|
|
5500
5618
|
var import_jsx_runtime45 = require("@emotion/react/jsx-runtime");
|
|
5619
|
+
var DataResourceInputContext = (0, import_react59.createContext)(void 0);
|
|
5620
|
+
var useDataResourceDynamicInputs = () => {
|
|
5621
|
+
return (0, import_react59.useContext)(DataResourceInputContext);
|
|
5622
|
+
};
|
|
5501
5623
|
function DataResourceDynamicInputProvider(props) {
|
|
5502
5624
|
const { children, dynamicInputs } = props;
|
|
5503
5625
|
if (dynamicInputs) {
|
|
@@ -5516,7 +5638,7 @@ function DataResourceDynamicInputProviderRenderer({
|
|
|
5516
5638
|
dynamicInputs
|
|
5517
5639
|
}) {
|
|
5518
5640
|
const variables = useDynamicInputsAsVariables(dynamicInputs);
|
|
5519
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(VariablesProvider, { value: variables, readOnly: true, children });
|
|
5641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DataResourceInputContext.Provider, { value: dynamicInputs, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(VariablesProvider, { value: variables, readOnly: true, children }) });
|
|
5520
5642
|
}
|
|
5521
5643
|
|
|
5522
5644
|
// src/components/DataResourceVariablesList.tsx
|
|
@@ -5593,9 +5715,9 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
5593
5715
|
}
|
|
5594
5716
|
|
|
5595
5717
|
// src/components/Request/RequestBody.tsx
|
|
5596
|
-
var
|
|
5718
|
+
var import_react61 = require("@emotion/react");
|
|
5597
5719
|
var import_design_system27 = require("@uniformdev/design-system");
|
|
5598
|
-
var
|
|
5720
|
+
var import_react62 = require("react");
|
|
5599
5721
|
|
|
5600
5722
|
// src/components/Request/RequestProvider.tsx
|
|
5601
5723
|
var React11 = __toESM(require("react"));
|
|
@@ -5679,11 +5801,11 @@ function useRequest() {
|
|
|
5679
5801
|
}
|
|
5680
5802
|
|
|
5681
5803
|
// src/components/Request/styles/Request.styles.ts
|
|
5682
|
-
var
|
|
5683
|
-
var innerContentStyles =
|
|
5804
|
+
var import_react60 = require("@emotion/react");
|
|
5805
|
+
var innerContentStyles = import_react60.css`
|
|
5684
5806
|
background: var(--white);
|
|
5685
5807
|
`;
|
|
5686
|
-
var requestTypeContainer = (bgColor) =>
|
|
5808
|
+
var requestTypeContainer = (bgColor) => import_react60.css`
|
|
5687
5809
|
align-items: start;
|
|
5688
5810
|
background: ${bgColor};
|
|
5689
5811
|
display: grid;
|
|
@@ -5721,11 +5843,11 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
5721
5843
|
};
|
|
5722
5844
|
function RequestBody() {
|
|
5723
5845
|
const { request, dispatch } = useRequest();
|
|
5724
|
-
const [language, setLanguage] = (0,
|
|
5846
|
+
const [language, setLanguage] = (0, import_react62.useState)("json");
|
|
5725
5847
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
5726
5848
|
"div",
|
|
5727
5849
|
{
|
|
5728
|
-
css:
|
|
5850
|
+
css: import_react61.css`
|
|
5729
5851
|
background: var(--white);
|
|
5730
5852
|
`,
|
|
5731
5853
|
children: [
|
|
@@ -5733,7 +5855,7 @@ function RequestBody() {
|
|
|
5733
5855
|
RequestTypeContainer,
|
|
5734
5856
|
{
|
|
5735
5857
|
bgColor: "var(--gray-100)",
|
|
5736
|
-
css:
|
|
5858
|
+
css: import_react61.css`
|
|
5737
5859
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
5738
5860
|
`,
|
|
5739
5861
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
@@ -5851,8 +5973,11 @@ function RequestHeaders({
|
|
|
5851
5973
|
}
|
|
5852
5974
|
) : null }),
|
|
5853
5975
|
addOmitIfEmpty ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellData, { width: "50%", children: header.key ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5854
|
-
import_design_system28.
|
|
5976
|
+
import_design_system28.InputToggle,
|
|
5855
5977
|
{
|
|
5978
|
+
label: "Omit if empty",
|
|
5979
|
+
showLabel: false,
|
|
5980
|
+
name: "omitIfEmpty",
|
|
5856
5981
|
type: "checkbox",
|
|
5857
5982
|
checked: header.omitIfEmpty,
|
|
5858
5983
|
"data-testid": "header-omitifempty",
|
|
@@ -5979,8 +6104,11 @@ function RequestParameters({
|
|
|
5979
6104
|
}
|
|
5980
6105
|
) : null }),
|
|
5981
6106
|
addOmitIfEmpty ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellData, { width: "50%", children: parameter.key ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5982
|
-
import_design_system30.
|
|
6107
|
+
import_design_system30.InputToggle,
|
|
5983
6108
|
{
|
|
6109
|
+
label: "Omit if empty",
|
|
6110
|
+
showLabel: false,
|
|
6111
|
+
name: "omitIfEmpty",
|
|
5984
6112
|
type: "checkbox",
|
|
5985
6113
|
checked: parameter.omitIfEmpty,
|
|
5986
6114
|
"data-testid": "parameter-omitifempty",
|
|
@@ -6004,8 +6132,8 @@ function RequestParameters({
|
|
|
6004
6132
|
}
|
|
6005
6133
|
|
|
6006
6134
|
// src/components/Request/RequestUrl.tsx
|
|
6007
|
-
var
|
|
6008
|
-
var
|
|
6135
|
+
var import_react63 = require("@emotion/react");
|
|
6136
|
+
var import_react64 = require("react");
|
|
6009
6137
|
|
|
6010
6138
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
6011
6139
|
function urlEncodeRequestUrl(url, varValues) {
|
|
@@ -6031,7 +6159,7 @@ function RequestUrl() {
|
|
|
6031
6159
|
var _a, _b;
|
|
6032
6160
|
const { variables } = useVariables();
|
|
6033
6161
|
const { request } = useRequest();
|
|
6034
|
-
const mergedParameters = (0,
|
|
6162
|
+
const mergedParameters = (0, import_react64.useMemo)(() => {
|
|
6035
6163
|
var _a2;
|
|
6036
6164
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
6037
6165
|
return request.parameters;
|
|
@@ -6041,7 +6169,7 @@ function RequestUrl() {
|
|
|
6041
6169
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
6042
6170
|
"small",
|
|
6043
6171
|
{
|
|
6044
|
-
css:
|
|
6172
|
+
css: import_react63.css`
|
|
6045
6173
|
display: inline-block;
|
|
6046
6174
|
margin-bottom: var(--spacing-xs);
|
|
6047
6175
|
word-break: break-word;
|
|
@@ -6279,12 +6407,12 @@ var import_design_system31 = require("@uniformdev/design-system");
|
|
|
6279
6407
|
|
|
6280
6408
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
6281
6409
|
var import_mesh_sdk = require("@uniformdev/mesh-sdk");
|
|
6282
|
-
var
|
|
6410
|
+
var import_react65 = require("react");
|
|
6283
6411
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
6284
|
-
const [error, setError] = (0,
|
|
6285
|
-
const [sdk, setSdk] = (0,
|
|
6286
|
-
const initializationInProgress = (0,
|
|
6287
|
-
(0,
|
|
6412
|
+
const [error, setError] = (0, import_react65.useState)();
|
|
6413
|
+
const [sdk, setSdk] = (0, import_react65.useState)();
|
|
6414
|
+
const initializationInProgress = (0, import_react65.useRef)(false);
|
|
6415
|
+
(0, import_react65.useEffect)(
|
|
6288
6416
|
() => {
|
|
6289
6417
|
if (typeof window === "undefined" || sdk) {
|
|
6290
6418
|
return;
|
|
@@ -6342,7 +6470,7 @@ var MeshApp = ({
|
|
|
6342
6470
|
};
|
|
6343
6471
|
|
|
6344
6472
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
6345
|
-
var
|
|
6473
|
+
var import_react66 = require("@emotion/react");
|
|
6346
6474
|
var import_design_system32 = require("@uniformdev/design-system");
|
|
6347
6475
|
var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
|
|
6348
6476
|
var DataRefreshButton = ({
|
|
@@ -6355,7 +6483,7 @@ var DataRefreshButton = ({
|
|
|
6355
6483
|
!isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6356
6484
|
import_design_system32.LoadingIndicator,
|
|
6357
6485
|
{
|
|
6358
|
-
css:
|
|
6486
|
+
css: import_react66.css`
|
|
6359
6487
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
6360
6488
|
`
|
|
6361
6489
|
}
|
|
@@ -6365,15 +6493,16 @@ var DataRefreshButton = ({
|
|
|
6365
6493
|
};
|
|
6366
6494
|
|
|
6367
6495
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6368
|
-
var
|
|
6496
|
+
var import_react72 = require("@emotion/react");
|
|
6369
6497
|
var import_canvas9 = require("@uniformdev/canvas");
|
|
6370
|
-
var
|
|
6498
|
+
var import_design_system38 = require("@uniformdev/design-system");
|
|
6499
|
+
var import_react73 = __toESM(require("react"));
|
|
6371
6500
|
|
|
6372
6501
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6373
6502
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
6374
|
-
var
|
|
6503
|
+
var import_react67 = require("react");
|
|
6375
6504
|
var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
|
|
6376
|
-
var ObjectSearchContext = (0,
|
|
6505
|
+
var ObjectSearchContext = (0, import_react67.createContext)({
|
|
6377
6506
|
onSetQuery: () => {
|
|
6378
6507
|
},
|
|
6379
6508
|
onSelectItem: () => {
|
|
@@ -6381,8 +6510,6 @@ var ObjectSearchContext = (0, import_react65.createContext)({
|
|
|
6381
6510
|
query: {},
|
|
6382
6511
|
boundQuery: {},
|
|
6383
6512
|
list: {},
|
|
6384
|
-
onSetList: () => {
|
|
6385
|
-
},
|
|
6386
6513
|
selectedListItems: [],
|
|
6387
6514
|
onRemoveAllSelectedItems: () => {
|
|
6388
6515
|
},
|
|
@@ -6394,16 +6521,16 @@ var ObjectSearchProvider = ({
|
|
|
6394
6521
|
children,
|
|
6395
6522
|
defaultQuery
|
|
6396
6523
|
}) => {
|
|
6397
|
-
const [query, setQuery] = (0,
|
|
6524
|
+
const [query, setQuery] = (0, import_react67.useState)({
|
|
6398
6525
|
contentType: "",
|
|
6399
6526
|
keyword: "",
|
|
6400
6527
|
...defaultQuery
|
|
6401
6528
|
});
|
|
6402
6529
|
const { flatVariables } = useVariables(true);
|
|
6403
|
-
const querySearchDeferred = (0,
|
|
6404
|
-
const [selectedItems, setSelectedItems] = (0,
|
|
6405
|
-
const [list, setList] = (0,
|
|
6406
|
-
const onSetQuery = (0,
|
|
6530
|
+
const querySearchDeferred = (0, import_react67.useDeferredValue)(query);
|
|
6531
|
+
const [selectedItems, setSelectedItems] = (0, import_react67.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
6532
|
+
const [list, setList] = (0, import_react67.useState)({});
|
|
6533
|
+
const onSetQuery = (0, import_react67.useCallback)(
|
|
6407
6534
|
(value2) => {
|
|
6408
6535
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
6409
6536
|
return setQuery({
|
|
@@ -6415,7 +6542,7 @@ var ObjectSearchProvider = ({
|
|
|
6415
6542
|
},
|
|
6416
6543
|
[setQuery]
|
|
6417
6544
|
);
|
|
6418
|
-
const onSelectItem = (0,
|
|
6545
|
+
const onSelectItem = (0, import_react67.useCallback)(
|
|
6419
6546
|
(selectedResult) => {
|
|
6420
6547
|
if (Array.isArray(selectedResult)) {
|
|
6421
6548
|
setSelectedItems(selectedResult);
|
|
@@ -6429,17 +6556,17 @@ var ObjectSearchProvider = ({
|
|
|
6429
6556
|
},
|
|
6430
6557
|
[setSelectedItems, selectedItems]
|
|
6431
6558
|
);
|
|
6432
|
-
const onRemoveAllSelectedItems = (0,
|
|
6559
|
+
const onRemoveAllSelectedItems = (0, import_react67.useCallback)(() => {
|
|
6433
6560
|
setSelectedItems([]);
|
|
6434
6561
|
}, [setSelectedItems]);
|
|
6435
|
-
const onSetList = (0,
|
|
6562
|
+
const onSetList = (0, import_react67.useCallback)(
|
|
6436
6563
|
(value2) => {
|
|
6437
6564
|
setList(value2);
|
|
6438
6565
|
},
|
|
6439
6566
|
[setList]
|
|
6440
6567
|
);
|
|
6441
|
-
const boundQuery = (0,
|
|
6442
|
-
const value = (0,
|
|
6568
|
+
const boundQuery = (0, import_react67.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
6569
|
+
const value = (0, import_react67.useMemo)(
|
|
6443
6570
|
() => ({
|
|
6444
6571
|
boundQuery,
|
|
6445
6572
|
onSetQuery,
|
|
@@ -6466,7 +6593,7 @@ var ObjectSearchProvider = ({
|
|
|
6466
6593
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ObjectSearchContext.Provider, { value, children });
|
|
6467
6594
|
};
|
|
6468
6595
|
function useObjectSearchContext() {
|
|
6469
|
-
return (0,
|
|
6596
|
+
return (0, import_react67.useContext)(ObjectSearchContext);
|
|
6470
6597
|
}
|
|
6471
6598
|
function bindQuery(query, inputs) {
|
|
6472
6599
|
const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
|
|
@@ -6484,9 +6611,9 @@ function bindQuery(query, inputs) {
|
|
|
6484
6611
|
var import_design_system34 = require("@uniformdev/design-system");
|
|
6485
6612
|
|
|
6486
6613
|
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6487
|
-
var
|
|
6614
|
+
var import_react68 = require("@emotion/react");
|
|
6488
6615
|
var import_design_system33 = require("@uniformdev/design-system");
|
|
6489
|
-
var ObjectListItemContainer =
|
|
6616
|
+
var ObjectListItemContainer = import_react68.css`
|
|
6490
6617
|
align-items: center;
|
|
6491
6618
|
border: 1px solid var(--gray-300);
|
|
6492
6619
|
border-radius: var(--rounded-base);
|
|
@@ -6495,11 +6622,11 @@ var ObjectListItemContainer = import_react66.css`
|
|
|
6495
6622
|
grid-template-columns: 1fr auto;
|
|
6496
6623
|
padding: var(--spacing-sm);
|
|
6497
6624
|
`;
|
|
6498
|
-
var ObjectListItemContainerDisabled =
|
|
6625
|
+
var ObjectListItemContainerDisabled = import_react68.css`
|
|
6499
6626
|
opacity: var(--opacity-50);
|
|
6500
6627
|
pointer-events: none;
|
|
6501
6628
|
`;
|
|
6502
|
-
var ObjectListItemLoading =
|
|
6629
|
+
var ObjectListItemLoading = import_react68.css`
|
|
6503
6630
|
animation: ${import_design_system33.skeletonLoading} 1s linear infinite alternate;
|
|
6504
6631
|
border-color: transparent;
|
|
6505
6632
|
min-height: 42px;
|
|
@@ -6523,36 +6650,36 @@ var ObjectListItemLoading = import_react66.css`
|
|
|
6523
6650
|
width: 1rem;
|
|
6524
6651
|
}
|
|
6525
6652
|
`;
|
|
6526
|
-
var ObjectListItemHeadingGroup =
|
|
6653
|
+
var ObjectListItemHeadingGroup = import_react68.css`
|
|
6527
6654
|
align-items: center;
|
|
6528
6655
|
display: grid;
|
|
6529
6656
|
`;
|
|
6530
|
-
var ObjectListItemThumbnail =
|
|
6657
|
+
var ObjectListItemThumbnail = import_react68.css`
|
|
6531
6658
|
width: 30px;
|
|
6532
6659
|
object-fit: contain;
|
|
6533
6660
|
`;
|
|
6534
|
-
var ObjectListItemTitle =
|
|
6661
|
+
var ObjectListItemTitle = import_react68.css`
|
|
6535
6662
|
color: var(--typography-base);
|
|
6536
6663
|
display: block;
|
|
6537
6664
|
font-size: var(--fs-sm);
|
|
6538
6665
|
`;
|
|
6539
|
-
var ObjectListItemSubtitle =
|
|
6666
|
+
var ObjectListItemSubtitle = import_react68.css`
|
|
6540
6667
|
color: var(--gray-500);
|
|
6541
6668
|
display: block;
|
|
6542
6669
|
font-size: var(--fs-xs);
|
|
6543
6670
|
line-height: 1;
|
|
6544
6671
|
`;
|
|
6545
|
-
var ObjectListItemInfoContainer =
|
|
6672
|
+
var ObjectListItemInfoContainer = import_react68.css`
|
|
6546
6673
|
align-items: center;
|
|
6547
6674
|
display: flex;
|
|
6548
6675
|
gap: var(--spacing-sm);
|
|
6549
6676
|
justify-content: center;
|
|
6550
6677
|
`;
|
|
6551
|
-
var ObjectListItemControlledContent =
|
|
6678
|
+
var ObjectListItemControlledContent = import_react68.css`
|
|
6552
6679
|
display: flex;
|
|
6553
6680
|
gap: var(--spacing-sm);
|
|
6554
6681
|
`;
|
|
6555
|
-
var ObjectListItemUnControlledContent =
|
|
6682
|
+
var ObjectListItemUnControlledContent = import_react68.css`
|
|
6556
6683
|
margin-top: var(--spacing-sm);
|
|
6557
6684
|
grid-column: 1 / -1;
|
|
6558
6685
|
`;
|
|
@@ -6622,202 +6749,19 @@ var ObjectSearchListItemLoadingSkeleton = () => {
|
|
|
6622
6749
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6623
6750
|
};
|
|
6624
6751
|
|
|
6625
|
-
// src/components/ObjectSearch/
|
|
6626
|
-
var
|
|
6627
|
-
var
|
|
6628
|
-
label,
|
|
6629
|
-
enableDynamicInputToResultId,
|
|
6630
|
-
searchFilters,
|
|
6631
|
-
resultList,
|
|
6632
|
-
children
|
|
6633
|
-
}) => {
|
|
6634
|
-
var _a, _b;
|
|
6635
|
-
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6636
|
-
const { flatVariables } = useVariables(true);
|
|
6637
|
-
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6638
|
-
const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6639
|
-
import_design_system35.ScrollableList,
|
|
6640
|
-
{
|
|
6641
|
-
role: "list",
|
|
6642
|
-
css: import_react67.css`
|
|
6643
|
-
> div {
|
|
6644
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6645
|
-
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6646
|
-
}
|
|
6647
|
-
`,
|
|
6648
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DefaultResultList, {})
|
|
6649
|
-
}
|
|
6650
|
-
);
|
|
6651
|
-
const body = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6652
|
-
searchFilters,
|
|
6653
|
-
listItems
|
|
6654
|
-
] });
|
|
6655
|
-
const handleSelectedVariableChange = (selectedValue) => {
|
|
6656
|
-
var _a2;
|
|
6657
|
-
if (!selectedValue) {
|
|
6658
|
-
onSelectItem([]);
|
|
6659
|
-
return;
|
|
6660
|
-
}
|
|
6661
|
-
const { result, errors } = (0, import_canvas9.bindVariables)({
|
|
6662
|
-
value: selectedValue,
|
|
6663
|
-
variables: flatVariables,
|
|
6664
|
-
errorPrefix: "Dynamic input"
|
|
6665
|
-
});
|
|
6666
|
-
if (!result) {
|
|
6667
|
-
onSelectItem([]);
|
|
6668
|
-
return;
|
|
6669
|
-
}
|
|
6670
|
-
const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
|
|
6671
|
-
onSelectItem([
|
|
6672
|
-
{
|
|
6673
|
-
title: selectedValue,
|
|
6674
|
-
contentType: (errors == null ? void 0 : errors.length) ? errors[0] instanceof Error ? errors[0].message : errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
|
|
6675
|
-
// spread any matched list item, overriding the above default props
|
|
6676
|
-
...item,
|
|
6677
|
-
// we want to make sure the ID is our dynamic value
|
|
6678
|
-
id: selectedValue
|
|
6679
|
-
}
|
|
6680
|
-
]);
|
|
6681
|
-
};
|
|
6682
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6683
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6684
|
-
InputVariables,
|
|
6685
|
-
{
|
|
6686
|
-
label,
|
|
6687
|
-
value: inputValue,
|
|
6688
|
-
onChange: (value) => {
|
|
6689
|
-
if (value === inputValue) {
|
|
6690
|
-
return;
|
|
6691
|
-
}
|
|
6692
|
-
handleSelectedVariableChange(value);
|
|
6693
|
-
},
|
|
6694
|
-
inputWhenNoVariables: body,
|
|
6695
|
-
disableVariables: !enableDynamicInputToResultId
|
|
6696
|
-
}
|
|
6697
|
-
) : body }),
|
|
6698
|
-
children
|
|
6699
|
-
] }) });
|
|
6700
|
-
};
|
|
6701
|
-
var DefaultResultList = () => {
|
|
6702
|
-
var _a;
|
|
6703
|
-
const { list } = useObjectSearchContext();
|
|
6704
|
-
if (!list.items) {
|
|
6705
|
-
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
6706
|
-
}
|
|
6707
|
-
if (list.items.length === 0) {
|
|
6708
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Callout, { type: "info", children: "No results were found" });
|
|
6709
|
-
}
|
|
6710
|
-
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
6711
|
-
};
|
|
6712
|
-
|
|
6713
|
-
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6714
|
-
var import_design_system36 = require("@uniformdev/design-system");
|
|
6715
|
-
var import_react69 = require("react");
|
|
6716
|
-
|
|
6717
|
-
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6718
|
-
var import_react68 = require("@emotion/react");
|
|
6719
|
-
var ObjectSearchFilterContainerLabel = import_react68.css`
|
|
6720
|
-
align-items: center;
|
|
6721
|
-
display: flex;
|
|
6722
|
-
font-size: var(--fs-sm);
|
|
6723
|
-
font-weight: var(--fw-bold);
|
|
6724
|
-
line-height: 1rem;
|
|
6725
|
-
margin-bottom: var(--spacing-sm);
|
|
6726
|
-
`;
|
|
6727
|
-
var ObjectSearchFilterContainer = import_react68.css`
|
|
6728
|
-
display: grid;
|
|
6729
|
-
gap: var(--spacing-base);
|
|
6730
|
-
`;
|
|
6731
|
-
var ObjectSearchFilterGrid = (gridColumns) => import_react68.css`
|
|
6732
|
-
display: grid;
|
|
6733
|
-
grid-template-columns: ${gridColumns};
|
|
6734
|
-
gap: var(--spacing-base);
|
|
6735
|
-
`;
|
|
6736
|
-
|
|
6737
|
-
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6738
|
-
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6739
|
-
var ObjectSearchFilter = ({
|
|
6740
|
-
requireContentType,
|
|
6741
|
-
typeSelectorAllTypesOptionText = "All content types",
|
|
6742
|
-
searchInputName = "searchText",
|
|
6743
|
-
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
6744
|
-
selectLabel = "Content Type Select",
|
|
6745
|
-
selectOptions
|
|
6746
|
-
}) => {
|
|
6747
|
-
var _a, _b;
|
|
6748
|
-
const { query, onSetQuery } = useObjectSearchContext();
|
|
6749
|
-
const [searchState, setSearchState] = (0, import_react69.useState)({
|
|
6750
|
-
contentType: (_a = query.contentType) != null ? _a : "",
|
|
6751
|
-
keyword: (_b = query.keyword) != null ? _b : ""
|
|
6752
|
-
});
|
|
6753
|
-
const handleFilterChange = (value) => {
|
|
6754
|
-
setSearchState((prev) => {
|
|
6755
|
-
return { ...prev, ...value };
|
|
6756
|
-
});
|
|
6757
|
-
onSetQuery({ ...query, ...value });
|
|
6758
|
-
};
|
|
6759
|
-
const memoizedSelectOptions = (0, import_react69.useMemo)(() => {
|
|
6760
|
-
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
6761
|
-
return [];
|
|
6762
|
-
}
|
|
6763
|
-
return [
|
|
6764
|
-
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
6765
|
-
...selectOptions != null ? selectOptions : []
|
|
6766
|
-
];
|
|
6767
|
-
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6768
|
-
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6769
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6770
|
-
"fieldset",
|
|
6771
|
-
{
|
|
6772
|
-
css: [
|
|
6773
|
-
ObjectSearchFilterContainer,
|
|
6774
|
-
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6775
|
-
],
|
|
6776
|
-
children: [
|
|
6777
|
-
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6778
|
-
import_design_system36.InputSelect,
|
|
6779
|
-
{
|
|
6780
|
-
label: selectLabel,
|
|
6781
|
-
showLabel: false,
|
|
6782
|
-
onChange: (e) => handleFilterChange({ contentType: e.target.value }),
|
|
6783
|
-
options: memoizedSelectOptions,
|
|
6784
|
-
value: query.contentType
|
|
6785
|
-
}
|
|
6786
|
-
) : null,
|
|
6787
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6788
|
-
import_design_system36.DebouncedInputKeywordSearch,
|
|
6789
|
-
{
|
|
6790
|
-
inputFieldName: searchInputName,
|
|
6791
|
-
placeholder: searchInputPlaceholderText,
|
|
6792
|
-
onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
|
|
6793
|
-
disabledFieldSubmission: true,
|
|
6794
|
-
defaultValue: searchState.keyword,
|
|
6795
|
-
delay: 300
|
|
6796
|
-
}
|
|
6797
|
-
)
|
|
6798
|
-
]
|
|
6799
|
-
}
|
|
6800
|
-
);
|
|
6801
|
-
};
|
|
6802
|
-
|
|
6803
|
-
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6804
|
-
var import_jsx_runtime63 = require("@emotion/react/jsx-runtime");
|
|
6805
|
-
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6806
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { children: [
|
|
6807
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6808
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
6809
|
-
] });
|
|
6810
|
-
};
|
|
6752
|
+
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6753
|
+
var import_design_system37 = require("@uniformdev/design-system");
|
|
6754
|
+
var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
|
|
6811
6755
|
|
|
6812
6756
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6813
|
-
var
|
|
6757
|
+
var import_design_system36 = require("@uniformdev/design-system");
|
|
6814
6758
|
var import_timeago3 = require("timeago.js");
|
|
6815
6759
|
|
|
6816
6760
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6817
|
-
var
|
|
6818
|
-
var
|
|
6819
|
-
var ButtonStyles =
|
|
6820
|
-
${
|
|
6761
|
+
var import_react69 = require("@emotion/react");
|
|
6762
|
+
var import_design_system35 = require("@uniformdev/design-system");
|
|
6763
|
+
var ButtonStyles = import_react69.css`
|
|
6764
|
+
${import_design_system35.button}
|
|
6821
6765
|
background: transparent;
|
|
6822
6766
|
border: 1px solid var(--typography-base);
|
|
6823
6767
|
color: var(--typography-base);
|
|
@@ -6843,20 +6787,20 @@ var ButtonStyles = import_react70.css`
|
|
|
6843
6787
|
text-decoration: none;
|
|
6844
6788
|
}
|
|
6845
6789
|
`;
|
|
6846
|
-
var ButtonIcon =
|
|
6790
|
+
var ButtonIcon = import_react69.css`
|
|
6847
6791
|
width: 1rem;
|
|
6848
6792
|
height: 1rem;
|
|
6849
6793
|
`;
|
|
6850
6794
|
|
|
6851
6795
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
6852
|
-
var
|
|
6796
|
+
var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
|
|
6853
6797
|
var ObjectSearchResultItemButton = ({
|
|
6854
6798
|
text,
|
|
6855
6799
|
icon,
|
|
6856
6800
|
...props
|
|
6857
6801
|
}) => {
|
|
6858
|
-
return /* @__PURE__ */ (0,
|
|
6859
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
6803
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6860
6804
|
text
|
|
6861
6805
|
] });
|
|
6862
6806
|
};
|
|
@@ -6865,15 +6809,15 @@ var LinkButton = ({
|
|
|
6865
6809
|
icon,
|
|
6866
6810
|
...props
|
|
6867
6811
|
}) => {
|
|
6868
|
-
return /* @__PURE__ */ (0,
|
|
6869
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
6813
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6870
6814
|
text
|
|
6871
6815
|
] });
|
|
6872
6816
|
};
|
|
6873
6817
|
|
|
6874
6818
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6875
|
-
var
|
|
6876
|
-
var ObjectSearchResultItemContainer =
|
|
6819
|
+
var import_react70 = require("@emotion/react");
|
|
6820
|
+
var ObjectSearchResultItemContainer = import_react70.css`
|
|
6877
6821
|
align-items: center;
|
|
6878
6822
|
border: 1px solid var(--gray-300);
|
|
6879
6823
|
border-radius: var(--rounded-base);
|
|
@@ -6889,7 +6833,7 @@ var ObjectSearchResultItemContainer = import_react71.css`
|
|
|
6889
6833
|
}
|
|
6890
6834
|
}
|
|
6891
6835
|
`;
|
|
6892
|
-
var ObjectSearchDragHandle =
|
|
6836
|
+
var ObjectSearchDragHandle = import_react70.css`
|
|
6893
6837
|
border-left: 2px dotted var(--gray-300);
|
|
6894
6838
|
border-right: 2px dotted var(--gray-300);
|
|
6895
6839
|
position: absolute;
|
|
@@ -6898,41 +6842,41 @@ var ObjectSearchDragHandle = import_react71.css`
|
|
|
6898
6842
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6899
6843
|
opacity: 0;
|
|
6900
6844
|
`;
|
|
6901
|
-
var ObjectSearchResultItemSubtitle =
|
|
6845
|
+
var ObjectSearchResultItemSubtitle = import_react70.css`
|
|
6902
6846
|
color: var(--gray-500);
|
|
6903
6847
|
display: block;
|
|
6904
6848
|
font-size: var(--fs-xs);
|
|
6905
6849
|
line-height: 1;
|
|
6906
6850
|
`;
|
|
6907
|
-
var ObjectSearchResultItemTitle =
|
|
6851
|
+
var ObjectSearchResultItemTitle = import_react70.css`
|
|
6908
6852
|
align-items: center;
|
|
6909
6853
|
color: var(--typography-base);
|
|
6910
6854
|
display: flex;
|
|
6911
6855
|
gap: var(--spacing-xs);
|
|
6912
6856
|
`;
|
|
6913
|
-
var ObjectSearchResultItemTimeStamp =
|
|
6857
|
+
var ObjectSearchResultItemTimeStamp = import_react70.css`
|
|
6914
6858
|
color: var(--gray-500);
|
|
6915
6859
|
font-size: var(--fs-xs);
|
|
6916
6860
|
`;
|
|
6917
|
-
var ObjectSearchAuthorStateGroup =
|
|
6861
|
+
var ObjectSearchAuthorStateGroup = import_react70.css`
|
|
6918
6862
|
align-items: center;
|
|
6919
6863
|
display: flex;
|
|
6920
6864
|
gap: var(--spacing-sm);
|
|
6921
6865
|
`;
|
|
6922
|
-
var ObjectSearchUpdateGroup =
|
|
6866
|
+
var ObjectSearchUpdateGroup = import_react70.css`
|
|
6923
6867
|
display: grid;
|
|
6924
6868
|
`;
|
|
6925
|
-
var ObjectSearchContentContainer =
|
|
6869
|
+
var ObjectSearchContentContainer = import_react70.css`
|
|
6926
6870
|
display: flex;
|
|
6927
6871
|
gap: var(--spacing-base);
|
|
6928
6872
|
`;
|
|
6929
|
-
var ObjectSearchImage =
|
|
6873
|
+
var ObjectSearchImage = import_react70.css`
|
|
6930
6874
|
width: 56px;
|
|
6931
6875
|
object-fit: contain;
|
|
6932
6876
|
`;
|
|
6933
6877
|
|
|
6934
6878
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6935
|
-
var
|
|
6879
|
+
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6936
6880
|
var ObjectSearchResultItem = ({
|
|
6937
6881
|
id,
|
|
6938
6882
|
title,
|
|
@@ -6956,70 +6900,66 @@ var ObjectSearchResultItem = ({
|
|
|
6956
6900
|
onSelectItem({ id, title: id });
|
|
6957
6901
|
onRemove == null ? void 0 : onRemove();
|
|
6958
6902
|
};
|
|
6959
|
-
return /* @__PURE__ */ (0,
|
|
6960
|
-
disableDnD ? null : /* @__PURE__ */ (0,
|
|
6961
|
-
/* @__PURE__ */ (0,
|
|
6962
|
-
!imageUrl ? null : /* @__PURE__ */ (0,
|
|
6963
|
-
/* @__PURE__ */ (0,
|
|
6964
|
-
/* @__PURE__ */ (0,
|
|
6965
|
-
/* @__PURE__ */ (0,
|
|
6903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
|
|
6904
|
+
disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
6905
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchContentContainer, children: [
|
|
6906
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
6907
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { children: [
|
|
6908
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
|
|
6909
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
|
|
6966
6910
|
title != null ? title : name,
|
|
6967
|
-
!popoverData ? null : /* @__PURE__ */ (0,
|
|
6911
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
6968
6912
|
] }),
|
|
6969
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0,
|
|
6970
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0,
|
|
6971
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0,
|
|
6972
|
-
!createdAt ? null : /* @__PURE__ */ (0,
|
|
6973
|
-
/* @__PURE__ */ (0,
|
|
6913
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6914
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
|
|
6915
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchUpdateGroup, children: [
|
|
6916
|
+
!createdAt ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6917
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("strong", { children: "Last updated: " }),
|
|
6974
6918
|
(0, import_timeago3.format)(createdAt)
|
|
6975
6919
|
] }),
|
|
6976
|
-
!publishedAt ? null : /* @__PURE__ */ (0,
|
|
6977
|
-
/* @__PURE__ */ (0,
|
|
6920
|
+
!publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6921
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("strong", { children: "Last published: " }),
|
|
6978
6922
|
(0, import_timeago3.format)(publishedAt)
|
|
6979
6923
|
] })
|
|
6980
6924
|
] })
|
|
6981
6925
|
] }),
|
|
6982
|
-
/* @__PURE__ */ (0,
|
|
6926
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { children })
|
|
6983
6927
|
] })
|
|
6984
6928
|
] }) }),
|
|
6985
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6986
|
-
!editLink ? null : /* @__PURE__ */ (0,
|
|
6987
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6929
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6930
|
+
!editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
6931
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
6988
6932
|
] })
|
|
6989
6933
|
] });
|
|
6990
6934
|
};
|
|
6991
6935
|
|
|
6992
|
-
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6993
|
-
var import_design_system39 = require("@uniformdev/design-system");
|
|
6994
|
-
var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
|
|
6995
|
-
|
|
6996
6936
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
6997
|
-
var
|
|
6998
|
-
var ObjectSearchResultListContainer =
|
|
6937
|
+
var import_react71 = require("@emotion/react");
|
|
6938
|
+
var ObjectSearchResultListContainer = import_react71.css`
|
|
6999
6939
|
align-items: center;
|
|
7000
6940
|
display: flex;
|
|
7001
6941
|
gap: var(--spacing-sm);
|
|
7002
6942
|
justify-content: space-between;
|
|
7003
6943
|
`;
|
|
7004
|
-
var ObjectSearchDragContainer =
|
|
6944
|
+
var ObjectSearchDragContainer = import_react71.css`
|
|
7005
6945
|
margin: 0 0 var(--spacing-sm);
|
|
7006
6946
|
`;
|
|
7007
|
-
var ObjectSearchContainerDragging =
|
|
6947
|
+
var ObjectSearchContainerDragging = import_react71.css`
|
|
7008
6948
|
box-shadow: var(--shadow-base);
|
|
7009
6949
|
opacity: var(--opacity-50);
|
|
7010
6950
|
`;
|
|
7011
|
-
var ObjectSearchResultListCounterContainer =
|
|
6951
|
+
var ObjectSearchResultListCounterContainer = import_react71.css`
|
|
7012
6952
|
align-items: center;
|
|
7013
6953
|
display: flex;
|
|
7014
6954
|
gap: var(--spacing-sm);
|
|
7015
6955
|
`;
|
|
7016
|
-
var ObjectSearchResultListTitle =
|
|
6956
|
+
var ObjectSearchResultListTitle = import_react71.css`
|
|
7017
6957
|
font-weight: var(--fw-bold);
|
|
7018
6958
|
line-height: 1;
|
|
7019
6959
|
`;
|
|
7020
6960
|
|
|
7021
6961
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
7022
|
-
var
|
|
6962
|
+
var import_jsx_runtime63 = require("@emotion/react/jsx-runtime");
|
|
7023
6963
|
function ObjectSearchResultList({
|
|
7024
6964
|
resultLabelText = "Selected",
|
|
7025
6965
|
removeButtonText = "Remove all",
|
|
@@ -7027,7 +6967,7 @@ function ObjectSearchResultList({
|
|
|
7027
6967
|
hideRemoveButton = false,
|
|
7028
6968
|
resultLabelOverride,
|
|
7029
6969
|
additionalButtons,
|
|
7030
|
-
renderResultComponent = (value) => /* @__PURE__ */ (0,
|
|
6970
|
+
renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ObjectSearchResultItem, { ...value }),
|
|
7031
6971
|
multiSelectId,
|
|
7032
6972
|
disableDnD = false,
|
|
7033
6973
|
getContainerForDnDReparenting,
|
|
@@ -7052,9 +6992,10 @@ function ObjectSearchResultList({
|
|
|
7052
6992
|
const item = selectedListItems.find((i) => i.id === rubric.draggableId);
|
|
7053
6993
|
const renderListItem = renderResultComponent({
|
|
7054
6994
|
...item,
|
|
6995
|
+
hideRemoveButton,
|
|
7055
6996
|
disableDnD: selectedListItems.length === 1 || disableDnD
|
|
7056
6997
|
});
|
|
7057
|
-
return /* @__PURE__ */ (0,
|
|
6998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7058
6999
|
"div",
|
|
7059
7000
|
{
|
|
7060
7001
|
css: [
|
|
@@ -7069,17 +7010,17 @@ function ObjectSearchResultList({
|
|
|
7069
7010
|
}
|
|
7070
7011
|
);
|
|
7071
7012
|
};
|
|
7072
|
-
return /* @__PURE__ */ (0,
|
|
7073
|
-
/* @__PURE__ */ (0,
|
|
7074
|
-
!resultLabelOverride ? /* @__PURE__ */ (0,
|
|
7075
|
-
/* @__PURE__ */ (0,
|
|
7013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
7015
|
+
!resultLabelOverride ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
7016
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
7076
7017
|
" ",
|
|
7077
|
-
!selectedListItems.length ? null : /* @__PURE__ */ (0,
|
|
7018
|
+
!selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system37.Counter, { count: selectedListItems.length })
|
|
7078
7019
|
] }) : resultLabelOverride,
|
|
7079
|
-
/* @__PURE__ */ (0,
|
|
7020
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
7080
7021
|
additionalButtons,
|
|
7081
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
7082
|
-
|
|
7022
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7023
|
+
import_design_system37.Button,
|
|
7083
7024
|
{
|
|
7084
7025
|
buttonType: "ghostDestructive",
|
|
7085
7026
|
size: "xs",
|
|
@@ -7090,15 +7031,15 @@ function ObjectSearchResultList({
|
|
|
7090
7031
|
)
|
|
7091
7032
|
] })
|
|
7092
7033
|
] }),
|
|
7093
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0,
|
|
7034
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7094
7035
|
import_react_beautiful_dnd4.Droppable,
|
|
7095
7036
|
{
|
|
7096
7037
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
7097
7038
|
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
7098
7039
|
getContainerForClone: getContainerForDnDReparenting,
|
|
7099
|
-
children: (provided) => /* @__PURE__ */ (0,
|
|
7040
|
+
children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
7100
7041
|
selectedListItems.map((item, i) => {
|
|
7101
|
-
return /* @__PURE__ */ (0,
|
|
7042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7102
7043
|
import_react_beautiful_dnd4.Draggable,
|
|
7103
7044
|
{
|
|
7104
7045
|
draggableId: item.id,
|
|
@@ -7116,42 +7057,306 @@ function ObjectSearchResultList({
|
|
|
7116
7057
|
] });
|
|
7117
7058
|
}
|
|
7118
7059
|
|
|
7119
|
-
// src/components/ObjectSearch/
|
|
7120
|
-
var
|
|
7121
|
-
var
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
{
|
|
7139
|
-
value: "asc",
|
|
7140
|
-
label: "Ascending"
|
|
7141
|
-
},
|
|
7060
|
+
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
7061
|
+
var import_jsx_runtime64 = require("@emotion/react/jsx-runtime");
|
|
7062
|
+
var ObjectSearchContainer = ({
|
|
7063
|
+
label,
|
|
7064
|
+
enableDynamicInputToResultId,
|
|
7065
|
+
searchFilters,
|
|
7066
|
+
resultList,
|
|
7067
|
+
children = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ObjectSearchResultList, {})
|
|
7068
|
+
}) => {
|
|
7069
|
+
var _a, _b;
|
|
7070
|
+
const { onSelectItem, selectedListItems, list, dynamicEntryId, onSetQuery, query } = useObjectSearchContext();
|
|
7071
|
+
const { flatVariables } = useVariables(true);
|
|
7072
|
+
const inputValue = (_b = dynamicEntryId != null ? dynamicEntryId : (_a = selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
7073
|
+
const isDynamicEntryIdAvailable = import_react73.default.useMemo(
|
|
7074
|
+
() => Boolean(inputValue && hasReferencedVariables(inputValue)),
|
|
7075
|
+
[inputValue]
|
|
7076
|
+
);
|
|
7077
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
7078
|
+
import_design_system38.ScrollableList,
|
|
7142
7079
|
{
|
|
7143
|
-
|
|
7144
|
-
|
|
7080
|
+
role: "list",
|
|
7081
|
+
css: import_react72.css`
|
|
7082
|
+
> div {
|
|
7083
|
+
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
7084
|
+
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
7085
|
+
}
|
|
7086
|
+
`,
|
|
7087
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DefaultResultList, {})
|
|
7145
7088
|
}
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7089
|
+
);
|
|
7090
|
+
const handleSelectedVariableChange = (selectedValue) => {
|
|
7091
|
+
var _a2;
|
|
7092
|
+
if (!selectedValue) {
|
|
7093
|
+
onSelectItem([]);
|
|
7094
|
+
return;
|
|
7095
|
+
}
|
|
7096
|
+
const { result, errors } = (0, import_canvas9.bindVariables)({
|
|
7097
|
+
value: selectedValue,
|
|
7098
|
+
variables: flatVariables,
|
|
7099
|
+
errorPrefix: "Dynamic input"
|
|
7100
|
+
});
|
|
7101
|
+
if (!result) {
|
|
7102
|
+
onSelectItem([]);
|
|
7103
|
+
return;
|
|
7104
|
+
}
|
|
7105
|
+
const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
|
|
7106
|
+
onSelectItem([
|
|
7107
|
+
{
|
|
7108
|
+
title: selectedValue,
|
|
7109
|
+
contentType: (errors == null ? void 0 : errors.length) ? errors[0] instanceof Error ? errors[0].message : errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
|
|
7110
|
+
// spread any matched list item, overriding the above default props
|
|
7111
|
+
...item,
|
|
7112
|
+
// we want to make sure the ID is our dynamic value
|
|
7113
|
+
id: selectedValue
|
|
7114
|
+
}
|
|
7115
|
+
]);
|
|
7116
|
+
if (hasReferencedVariables(selectedValue)) {
|
|
7117
|
+
onSetQuery({ ...query, dynamicEntryId: selectedValue });
|
|
7118
|
+
}
|
|
7119
|
+
};
|
|
7120
|
+
const showSearchList = !label || !isDynamicEntryIdAvailable || !enableDynamicInputToResultId;
|
|
7121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_design_system38.VerticalRhythm, { children: [
|
|
7122
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_design_system38.VerticalRhythm, { children: [
|
|
7123
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
7124
|
+
InputVariables,
|
|
7125
|
+
{
|
|
7126
|
+
id: "entryId",
|
|
7127
|
+
label,
|
|
7128
|
+
value: inputValue,
|
|
7129
|
+
onChange: (value) => {
|
|
7130
|
+
if (value === inputValue) {
|
|
7131
|
+
return;
|
|
7132
|
+
}
|
|
7133
|
+
handleSelectedVariableChange(value);
|
|
7134
|
+
},
|
|
7135
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: searchFilters }),
|
|
7136
|
+
disableVariables: !enableDynamicInputToResultId
|
|
7137
|
+
}
|
|
7138
|
+
) : searchFilters,
|
|
7139
|
+
showSearchList ? listItems : null
|
|
7140
|
+
] }) }),
|
|
7141
|
+
children
|
|
7142
|
+
] }) });
|
|
7143
|
+
};
|
|
7144
|
+
var DefaultResultList = () => {
|
|
7145
|
+
var _a, _b;
|
|
7146
|
+
const { list, isListLoading } = useObjectSearchContext();
|
|
7147
|
+
if (isListLoading || !list.items) {
|
|
7148
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
7149
|
+
}
|
|
7150
|
+
if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
|
|
7151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.Callout, { type: "info", children: "No results were found" });
|
|
7152
|
+
}
|
|
7153
|
+
return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
7154
|
+
};
|
|
7155
|
+
|
|
7156
|
+
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
7157
|
+
var import_design_system39 = require("@uniformdev/design-system");
|
|
7158
|
+
var import_react76 = require("react");
|
|
7159
|
+
var import_react_use5 = require("react-use");
|
|
7160
|
+
|
|
7161
|
+
// src/utils/createLocationValidator.ts
|
|
7162
|
+
function createLocationValidator(setValue, validate) {
|
|
7163
|
+
return (dispatch) => setValue((previous) => {
|
|
7164
|
+
const { newValue, options } = dispatch(previous);
|
|
7165
|
+
return { newValue, options: validate(newValue, options) };
|
|
7166
|
+
});
|
|
7167
|
+
}
|
|
7168
|
+
|
|
7169
|
+
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
7170
|
+
var import_canvas10 = require("@uniformdev/canvas");
|
|
7171
|
+
var import_react74 = require("react");
|
|
7172
|
+
function useContentDataResourceLocaleInfo({
|
|
7173
|
+
locale,
|
|
7174
|
+
setLocale,
|
|
7175
|
+
dynamicInputs
|
|
7176
|
+
}) {
|
|
7177
|
+
var _a;
|
|
7178
|
+
const setLocaleRef = (0, import_react74.useRef)(setLocale);
|
|
7179
|
+
setLocaleRef.current = setLocale;
|
|
7180
|
+
const { flatVariables } = useVariables();
|
|
7181
|
+
const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
|
|
7182
|
+
const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7183
|
+
(0, import_react74.useEffect)(() => {
|
|
7184
|
+
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7185
|
+
setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
|
|
7186
|
+
}
|
|
7187
|
+
}, [locale, effectiveLocale]);
|
|
7188
|
+
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
7189
|
+
}
|
|
7190
|
+
|
|
7191
|
+
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
7192
|
+
var import_react75 = require("@emotion/react");
|
|
7193
|
+
var ObjectSearchFilterContainerLabel = import_react75.css`
|
|
7194
|
+
align-items: center;
|
|
7195
|
+
display: flex;
|
|
7196
|
+
font-size: var(--fs-sm);
|
|
7197
|
+
font-weight: var(--fw-bold);
|
|
7198
|
+
line-height: 1rem;
|
|
7199
|
+
margin-bottom: var(--spacing-sm);
|
|
7200
|
+
`;
|
|
7201
|
+
var ObjectSearchFilterContainer = import_react75.css`
|
|
7202
|
+
display: grid;
|
|
7203
|
+
gap: var(--spacing-base);
|
|
7204
|
+
`;
|
|
7205
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react75.css`
|
|
7206
|
+
display: grid;
|
|
7207
|
+
grid-template-columns: ${gridColumns};
|
|
7208
|
+
gap: var(--spacing-base);
|
|
7209
|
+
`;
|
|
7210
|
+
|
|
7211
|
+
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
7212
|
+
var import_jsx_runtime65 = require("@emotion/react/jsx-runtime");
|
|
7213
|
+
var ObjectSearchFilter = ({
|
|
7214
|
+
requireContentType,
|
|
7215
|
+
typeSelectorAllTypesOptionText = "All content types",
|
|
7216
|
+
searchInputName = "searchText",
|
|
7217
|
+
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
7218
|
+
selectLabel = "Content Type Select",
|
|
7219
|
+
localeFilterLabel = "Filter by locale",
|
|
7220
|
+
selectOptions
|
|
7221
|
+
}) => {
|
|
7222
|
+
var _a, _b, _c;
|
|
7223
|
+
const { query, onSetQuery, localeOptions, enableFilterByLocale } = useObjectSearchContext();
|
|
7224
|
+
const dynamicInputs = useDataResourceDynamicInputs();
|
|
7225
|
+
const { boundLocale = "", effectiveLocale } = useContentDataResourceLocaleInfo({
|
|
7226
|
+
locale: query.locale,
|
|
7227
|
+
dynamicInputs: dynamicInputs != null ? dynamicInputs : {},
|
|
7228
|
+
setLocale: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" })
|
|
7229
|
+
});
|
|
7230
|
+
const [searchState, setSearchState] = (0, import_react76.useState)({
|
|
7231
|
+
keyword: (_a = query.keyword) != null ? _a : "",
|
|
7232
|
+
contentType: (_b = query.contentType) != null ? _b : "",
|
|
7233
|
+
locale: (_c = query.locale) != null ? _c : ""
|
|
7234
|
+
});
|
|
7235
|
+
const handleFilterChange = (value) => {
|
|
7236
|
+
setSearchState((prev) => {
|
|
7237
|
+
return { ...prev, ...value };
|
|
7238
|
+
});
|
|
7239
|
+
};
|
|
7240
|
+
(0, import_react_use5.useDebounce)(
|
|
7241
|
+
() => {
|
|
7242
|
+
onSetQuery({ ...query, ...searchState });
|
|
7243
|
+
},
|
|
7244
|
+
500,
|
|
7245
|
+
[searchState]
|
|
7246
|
+
);
|
|
7247
|
+
const memoizedSelectOptions = (0, import_react76.useMemo)(() => {
|
|
7248
|
+
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
7249
|
+
return [];
|
|
7250
|
+
}
|
|
7251
|
+
return [
|
|
7252
|
+
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
7253
|
+
...selectOptions != null ? selectOptions : []
|
|
7254
|
+
];
|
|
7255
|
+
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
7256
|
+
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
7257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_design_system39.VerticalRhythm, { gap: "base", children: [
|
|
7258
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
7259
|
+
"fieldset",
|
|
7260
|
+
{
|
|
7261
|
+
css: [
|
|
7262
|
+
ObjectSearchFilterContainer,
|
|
7263
|
+
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
7264
|
+
],
|
|
7265
|
+
children: [
|
|
7266
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7267
|
+
import_design_system39.InputSelect,
|
|
7268
|
+
{
|
|
7269
|
+
label: selectLabel,
|
|
7270
|
+
showLabel: false,
|
|
7271
|
+
onChange: (e) => handleFilterChange({ contentType: e.target.value }),
|
|
7272
|
+
options: memoizedSelectOptions,
|
|
7273
|
+
value: query.contentType,
|
|
7274
|
+
"data-testid": "select-entry"
|
|
7275
|
+
}
|
|
7276
|
+
) : null,
|
|
7277
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7278
|
+
import_design_system39.DebouncedInputKeywordSearch,
|
|
7279
|
+
{
|
|
7280
|
+
inputFieldName: searchInputName,
|
|
7281
|
+
placeholder: searchInputPlaceholderText,
|
|
7282
|
+
onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
|
|
7283
|
+
disabledFieldSubmission: true,
|
|
7284
|
+
defaultValue: searchState.keyword,
|
|
7285
|
+
delay: 300
|
|
7286
|
+
}
|
|
7287
|
+
)
|
|
7288
|
+
]
|
|
7289
|
+
}
|
|
7290
|
+
),
|
|
7291
|
+
enableFilterByLocale && (localeOptions == null ? void 0 : localeOptions.length) && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7292
|
+
InputVariables,
|
|
7293
|
+
{
|
|
7294
|
+
label: localeFilterLabel,
|
|
7295
|
+
id: "locale",
|
|
7296
|
+
value: effectiveLocale,
|
|
7297
|
+
onChange: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" }),
|
|
7298
|
+
disableInlineMenu: true,
|
|
7299
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7300
|
+
import_design_system39.InputSelect,
|
|
7301
|
+
{
|
|
7302
|
+
id: "locale",
|
|
7303
|
+
options: localeOptions,
|
|
7304
|
+
name: "locale",
|
|
7305
|
+
label: "",
|
|
7306
|
+
value: boundLocale,
|
|
7307
|
+
onChange: (e) => handleFilterChange({ locale: e.target.value })
|
|
7308
|
+
}
|
|
7309
|
+
)
|
|
7310
|
+
}
|
|
7311
|
+
)
|
|
7312
|
+
] });
|
|
7313
|
+
};
|
|
7314
|
+
|
|
7315
|
+
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
7316
|
+
var import_jsx_runtime66 = require("@emotion/react/jsx-runtime");
|
|
7317
|
+
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
7318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { children: [
|
|
7319
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
7320
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
7321
|
+
] });
|
|
7322
|
+
};
|
|
7323
|
+
|
|
7324
|
+
// src/components/ObjectSearch/QueryFilter.tsx
|
|
7325
|
+
var import_design_system40 = require("@uniformdev/design-system");
|
|
7326
|
+
var import_react77 = require("react");
|
|
7327
|
+
var import_jsx_runtime67 = require("@emotion/react/jsx-runtime");
|
|
7328
|
+
var QueryFilter = ({
|
|
7329
|
+
requireContentType,
|
|
7330
|
+
queryFilterTitle = "Configure Query",
|
|
7331
|
+
contentTypeLabel = "Filter by content type",
|
|
7332
|
+
typeSelectorAllTypesOptionText = "All content types",
|
|
7333
|
+
contentTypeOptions,
|
|
7334
|
+
searchInputName = "searchText",
|
|
7335
|
+
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
7336
|
+
searchInputLabel = "Query",
|
|
7337
|
+
countLabel = "Count",
|
|
7338
|
+
countValue = 5,
|
|
7339
|
+
sortLabel = "Sort By",
|
|
7340
|
+
sortOptions,
|
|
7341
|
+
sortOrderLabel = "Sort Order",
|
|
7342
|
+
sortOrderOptions = [
|
|
7343
|
+
{
|
|
7344
|
+
value: "asc",
|
|
7345
|
+
label: "Ascending"
|
|
7346
|
+
},
|
|
7347
|
+
{
|
|
7348
|
+
value: "desc",
|
|
7349
|
+
label: "Descending"
|
|
7350
|
+
}
|
|
7351
|
+
],
|
|
7352
|
+
children
|
|
7353
|
+
}) => {
|
|
7354
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
7355
|
+
const { query, onSetQuery } = useObjectSearchContext();
|
|
7356
|
+
const [queryState, setQueryState] = (0, import_react77.useState)({
|
|
7357
|
+
contentType: (_a = query.contentType) != null ? _a : "",
|
|
7358
|
+
keyword: (_b = query.keyword) != null ? _b : "",
|
|
7359
|
+
count: (_c = query.count) != null ? _c : countValue,
|
|
7155
7360
|
sortBy: (_d = query.sortBy) != null ? _d : "",
|
|
7156
7361
|
sortOrder: (_e = query.sortOrder) != null ? _e : ""
|
|
7157
7362
|
});
|
|
@@ -7159,7 +7364,7 @@ var QueryFilter = ({
|
|
|
7159
7364
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
7160
7365
|
onSetQuery({ ...query, ...value });
|
|
7161
7366
|
};
|
|
7162
|
-
(0,
|
|
7367
|
+
(0, import_react77.useEffect)(() => {
|
|
7163
7368
|
onSetQuery(queryState);
|
|
7164
7369
|
}, []);
|
|
7165
7370
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("fieldset", { children: [
|
|
@@ -7284,9 +7489,107 @@ var QueryFilter = ({
|
|
|
7284
7489
|
] });
|
|
7285
7490
|
};
|
|
7286
7491
|
|
|
7287
|
-
// src/components/
|
|
7288
|
-
var
|
|
7492
|
+
// src/components/ObjectSearch/ObjectSearchListOfSearchResults.tsx
|
|
7493
|
+
var import_design_system41 = require("@uniformdev/design-system");
|
|
7289
7494
|
var import_jsx_runtime68 = require("@emotion/react/jsx-runtime");
|
|
7495
|
+
function ObjectSearchListOfSearchResults() {
|
|
7496
|
+
var _a, _b;
|
|
7497
|
+
const { list, isListLoading } = useObjectSearchContext();
|
|
7498
|
+
if (isListLoading) {
|
|
7499
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
7500
|
+
}
|
|
7501
|
+
if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
|
|
7502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system41.Callout, { type: "info", children: "No results were found" });
|
|
7503
|
+
}
|
|
7504
|
+
return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
7505
|
+
}
|
|
7506
|
+
|
|
7507
|
+
// src/components/ObjectSearch/hooks/ControlledObjectSearchProvider.tsx
|
|
7508
|
+
var import_react78 = require("react");
|
|
7509
|
+
var import_jsx_runtime69 = require("@emotion/react/jsx-runtime");
|
|
7510
|
+
var ControlledObjectSearchProvider = ({
|
|
7511
|
+
selectedItems,
|
|
7512
|
+
searchResultItems,
|
|
7513
|
+
selectedItemsLoading,
|
|
7514
|
+
searchResultListLoading,
|
|
7515
|
+
onQueryChange = () => {
|
|
7516
|
+
},
|
|
7517
|
+
onSelectItemsChange,
|
|
7518
|
+
isMulti = false,
|
|
7519
|
+
children,
|
|
7520
|
+
query = {},
|
|
7521
|
+
enableFilterByLocale,
|
|
7522
|
+
localeOptions,
|
|
7523
|
+
dynamicEntryId,
|
|
7524
|
+
isManualSelection
|
|
7525
|
+
}) => {
|
|
7526
|
+
var _a, _b;
|
|
7527
|
+
const { flatVariables } = useVariables(true);
|
|
7528
|
+
const querySearchDeferred = (0, import_react78.useDeferredValue)(query);
|
|
7529
|
+
const innerSelectedItems = (0, import_react78.useRef)(selectedItems);
|
|
7530
|
+
(0, import_react78.useEffect)(() => {
|
|
7531
|
+
if (selectedItems !== void 0) {
|
|
7532
|
+
innerSelectedItems.current = selectedItems;
|
|
7533
|
+
}
|
|
7534
|
+
}, [selectedItems]);
|
|
7535
|
+
const onSetQuery = (0, import_react78.useCallback)(
|
|
7536
|
+
(value) => {
|
|
7537
|
+
const newQuery = { ...query, ...value };
|
|
7538
|
+
onQueryChange(newQuery);
|
|
7539
|
+
},
|
|
7540
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7541
|
+
[onQueryChange]
|
|
7542
|
+
);
|
|
7543
|
+
const onSelectItem = (0, import_react78.useCallback)(
|
|
7544
|
+
(selectedResult) => {
|
|
7545
|
+
var _a2;
|
|
7546
|
+
if (Array.isArray(selectedResult)) {
|
|
7547
|
+
innerSelectedItems.current = selectedResult;
|
|
7548
|
+
onSelectItemsChange(selectedResult);
|
|
7549
|
+
} else {
|
|
7550
|
+
const itemIsAlreadySelected = selectedItems == null ? void 0 : selectedItems.some((item) => item.id === selectedResult.id);
|
|
7551
|
+
const updatedSelectedItems = itemIsAlreadySelected ? (_a2 = selectedItems == null ? void 0 : selectedItems.filter((item) => item.id !== selectedResult.id)) != null ? _a2 : [] : [...selectedItems != null ? selectedItems : [], selectedResult];
|
|
7552
|
+
innerSelectedItems.current = updatedSelectedItems;
|
|
7553
|
+
onSelectItemsChange(updatedSelectedItems);
|
|
7554
|
+
}
|
|
7555
|
+
},
|
|
7556
|
+
[onSelectItemsChange, selectedItems]
|
|
7557
|
+
);
|
|
7558
|
+
const onRemoveAllSelectedItems = (0, import_react78.useCallback)(() => {
|
|
7559
|
+
innerSelectedItems.current = [];
|
|
7560
|
+
onSelectItemsChange([]);
|
|
7561
|
+
}, [onSelectItemsChange]);
|
|
7562
|
+
const list = (0, import_react78.useMemo)(() => ({ items: searchResultItems }), [searchResultItems]);
|
|
7563
|
+
const boundQuery = (0, import_react78.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
7564
|
+
const isLoadingInitially = Boolean(
|
|
7565
|
+
isManualSelection ? !((_a = innerSelectedItems.current) == null ? void 0 : _a.length) && selectedItemsLoading : selectedItemsLoading
|
|
7566
|
+
);
|
|
7567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7568
|
+
ObjectSearchContext.Provider,
|
|
7569
|
+
{
|
|
7570
|
+
value: {
|
|
7571
|
+
boundQuery,
|
|
7572
|
+
onSetQuery,
|
|
7573
|
+
query: querySearchDeferred,
|
|
7574
|
+
onSelectItem,
|
|
7575
|
+
selectedListItems: (_b = isManualSelection ? innerSelectedItems.current : selectedItems) != null ? _b : [],
|
|
7576
|
+
onRemoveAllSelectedItems,
|
|
7577
|
+
list,
|
|
7578
|
+
isSelectedItemsListLoading: isLoadingInitially,
|
|
7579
|
+
isListLoading: searchResultListLoading,
|
|
7580
|
+
isMulti,
|
|
7581
|
+
localeOptions,
|
|
7582
|
+
enableFilterByLocale,
|
|
7583
|
+
dynamicEntryId
|
|
7584
|
+
},
|
|
7585
|
+
children
|
|
7586
|
+
}
|
|
7587
|
+
);
|
|
7588
|
+
};
|
|
7589
|
+
|
|
7590
|
+
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
7591
|
+
var import_react79 = require("react");
|
|
7592
|
+
var import_jsx_runtime70 = require("@emotion/react/jsx-runtime");
|
|
7290
7593
|
function ParamTypeDynamicDataProvider(props) {
|
|
7291
7594
|
const { children } = props;
|
|
7292
7595
|
const {
|
|
@@ -7294,11 +7597,11 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
7294
7597
|
} = useMeshLocation("paramType");
|
|
7295
7598
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
7296
7599
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
7297
|
-
const variables = (0,
|
|
7600
|
+
const variables = (0, import_react79.useMemo)(
|
|
7298
7601
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
7299
7602
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
7300
7603
|
);
|
|
7301
|
-
return /* @__PURE__ */ (0,
|
|
7604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(VariablesProvider, { value: variables, onChange: () => {
|
|
7302
7605
|
}, editVariableComponent: JsonMeshVariableEditor, children });
|
|
7303
7606
|
}
|
|
7304
7607
|
var JsonMeshVariableEditor = ({
|
|
@@ -7307,9 +7610,9 @@ var JsonMeshVariableEditor = ({
|
|
|
7307
7610
|
variable,
|
|
7308
7611
|
context
|
|
7309
7612
|
}) => {
|
|
7310
|
-
const sillyRef = (0,
|
|
7613
|
+
const sillyRef = (0, import_react79.useRef)(false);
|
|
7311
7614
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
7312
|
-
(0,
|
|
7615
|
+
(0, import_react79.useEffect)(() => {
|
|
7313
7616
|
if (sillyRef.current) {
|
|
7314
7617
|
return;
|
|
7315
7618
|
}
|
|
@@ -7337,38 +7640,2110 @@ var JsonMeshVariableEditor = ({
|
|
|
7337
7640
|
return null;
|
|
7338
7641
|
};
|
|
7339
7642
|
|
|
7340
|
-
// src/
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7643
|
+
// src/components/SearchAndFilter/constants.ts
|
|
7644
|
+
var NUMBER_OPERATORS = [
|
|
7645
|
+
{
|
|
7646
|
+
label: "equals...",
|
|
7647
|
+
symbol: "=",
|
|
7648
|
+
value: "eq",
|
|
7649
|
+
editorType: "number"
|
|
7650
|
+
},
|
|
7651
|
+
{
|
|
7652
|
+
label: "does not equal...",
|
|
7653
|
+
symbol: "\u2260",
|
|
7654
|
+
value: "neq",
|
|
7655
|
+
editorType: "number"
|
|
7656
|
+
},
|
|
7657
|
+
{
|
|
7658
|
+
label: "greater than...",
|
|
7659
|
+
symbol: ">",
|
|
7660
|
+
value: "gt",
|
|
7661
|
+
editorType: "number"
|
|
7662
|
+
},
|
|
7663
|
+
{
|
|
7664
|
+
label: "greater than or equal to...",
|
|
7665
|
+
symbol: "\u2265",
|
|
7666
|
+
value: "gte",
|
|
7667
|
+
editorType: "number"
|
|
7668
|
+
},
|
|
7669
|
+
{
|
|
7670
|
+
label: "less than...",
|
|
7671
|
+
symbol: "<",
|
|
7672
|
+
value: "lt",
|
|
7673
|
+
editorType: "number"
|
|
7674
|
+
},
|
|
7675
|
+
{
|
|
7676
|
+
label: "less than or equal to...",
|
|
7677
|
+
symbol: "\u2264",
|
|
7678
|
+
value: "lte",
|
|
7679
|
+
editorType: "number"
|
|
7680
|
+
},
|
|
7681
|
+
{
|
|
7682
|
+
label: "is empty",
|
|
7683
|
+
value: "ndef",
|
|
7684
|
+
editorType: "empty"
|
|
7685
|
+
},
|
|
7686
|
+
{
|
|
7687
|
+
label: "is between...",
|
|
7688
|
+
value: "between",
|
|
7689
|
+
editorType: "numberRange"
|
|
7690
|
+
},
|
|
7691
|
+
{
|
|
7692
|
+
label: "is not empty",
|
|
7693
|
+
value: "def",
|
|
7694
|
+
editorType: "empty"
|
|
7695
|
+
}
|
|
7696
|
+
];
|
|
7697
|
+
var DATE_OPERATORS = [
|
|
7698
|
+
{
|
|
7699
|
+
label: "is",
|
|
7700
|
+
value: "eq",
|
|
7701
|
+
editorType: "date"
|
|
7702
|
+
},
|
|
7703
|
+
{
|
|
7704
|
+
label: "is between...",
|
|
7705
|
+
value: "between",
|
|
7706
|
+
editorType: "dateRange"
|
|
7707
|
+
},
|
|
7708
|
+
{
|
|
7709
|
+
label: "is before...",
|
|
7710
|
+
value: "lt",
|
|
7711
|
+
editorType: "date"
|
|
7712
|
+
},
|
|
7713
|
+
{
|
|
7714
|
+
label: "is after...",
|
|
7715
|
+
value: "gt",
|
|
7716
|
+
editorType: "date"
|
|
7717
|
+
},
|
|
7718
|
+
{
|
|
7719
|
+
label: "is on or before...",
|
|
7720
|
+
value: "lte",
|
|
7721
|
+
editorType: "date"
|
|
7722
|
+
},
|
|
7723
|
+
{
|
|
7724
|
+
label: "is on or after...",
|
|
7725
|
+
value: "gte",
|
|
7726
|
+
editorType: "date"
|
|
7727
|
+
},
|
|
7728
|
+
{
|
|
7729
|
+
label: "is empty",
|
|
7730
|
+
value: "ndef",
|
|
7731
|
+
editorType: "empty"
|
|
7732
|
+
},
|
|
7733
|
+
{
|
|
7734
|
+
label: "is not",
|
|
7735
|
+
value: "neq",
|
|
7736
|
+
editorType: "date"
|
|
7737
|
+
},
|
|
7738
|
+
{
|
|
7739
|
+
label: "is not empty",
|
|
7740
|
+
value: "def",
|
|
7741
|
+
editorType: "empty"
|
|
7742
|
+
}
|
|
7743
|
+
];
|
|
7744
|
+
var TEXTBOX_OPERATORS = [
|
|
7745
|
+
{
|
|
7746
|
+
label: "contains...",
|
|
7747
|
+
value: "match",
|
|
7748
|
+
editorType: "text"
|
|
7749
|
+
},
|
|
7750
|
+
{
|
|
7751
|
+
label: "is",
|
|
7752
|
+
value: "eq",
|
|
7753
|
+
editorType: "text"
|
|
7754
|
+
},
|
|
7755
|
+
{
|
|
7756
|
+
label: "is empty",
|
|
7757
|
+
value: "ndef",
|
|
7758
|
+
editorType: "empty"
|
|
7759
|
+
},
|
|
7760
|
+
{
|
|
7761
|
+
label: "starts with...",
|
|
7762
|
+
value: "starts",
|
|
7763
|
+
editorType: "text"
|
|
7764
|
+
},
|
|
7765
|
+
{
|
|
7766
|
+
label: "is not",
|
|
7767
|
+
value: "neq",
|
|
7768
|
+
editorType: "text"
|
|
7769
|
+
},
|
|
7770
|
+
{
|
|
7771
|
+
label: "is not empty",
|
|
7772
|
+
value: "def",
|
|
7773
|
+
editorType: "empty"
|
|
7774
|
+
}
|
|
7775
|
+
];
|
|
7776
|
+
var USER_OPERATORS = [
|
|
7777
|
+
{
|
|
7778
|
+
label: "contains...",
|
|
7779
|
+
value: "match",
|
|
7780
|
+
editorType: "text"
|
|
7781
|
+
},
|
|
7782
|
+
{
|
|
7783
|
+
label: "is",
|
|
7784
|
+
value: "eq",
|
|
7785
|
+
editorType: "text"
|
|
7786
|
+
},
|
|
7787
|
+
{
|
|
7788
|
+
label: "starts with...",
|
|
7789
|
+
value: "starts",
|
|
7790
|
+
editorType: "text"
|
|
7791
|
+
},
|
|
7792
|
+
{
|
|
7793
|
+
label: "is not",
|
|
7794
|
+
value: "neq",
|
|
7795
|
+
editorType: "text"
|
|
7796
|
+
}
|
|
7797
|
+
];
|
|
7798
|
+
var SYSTEM_DATE_OPERATORS = [
|
|
7799
|
+
{
|
|
7800
|
+
label: "is",
|
|
7801
|
+
value: "sys-date-eq",
|
|
7802
|
+
editorType: "date"
|
|
7803
|
+
},
|
|
7804
|
+
{
|
|
7805
|
+
label: "is between...",
|
|
7806
|
+
value: "sys-date-between",
|
|
7807
|
+
editorType: "dateRange"
|
|
7808
|
+
},
|
|
7809
|
+
{
|
|
7810
|
+
label: "is before...",
|
|
7811
|
+
value: "sys-date-lt",
|
|
7812
|
+
editorType: "date"
|
|
7813
|
+
},
|
|
7814
|
+
{
|
|
7815
|
+
label: "is after...",
|
|
7816
|
+
value: "sys-date-gt",
|
|
7817
|
+
editorType: "date"
|
|
7818
|
+
},
|
|
7819
|
+
{
|
|
7820
|
+
label: "is on or before...",
|
|
7821
|
+
value: "sys-date-lte",
|
|
7822
|
+
editorType: "date"
|
|
7823
|
+
},
|
|
7824
|
+
{
|
|
7825
|
+
label: "is on or after...",
|
|
7826
|
+
value: "sys-date-gte",
|
|
7827
|
+
editorType: "date"
|
|
7828
|
+
},
|
|
7829
|
+
{
|
|
7830
|
+
label: "is not",
|
|
7831
|
+
value: "sys-date-neq",
|
|
7832
|
+
editorType: "date"
|
|
7833
|
+
}
|
|
7834
|
+
];
|
|
7835
|
+
var RICHTEXT_OPERATORS = [
|
|
7836
|
+
{
|
|
7837
|
+
label: "contains...",
|
|
7838
|
+
value: "match",
|
|
7839
|
+
editorType: "text"
|
|
7840
|
+
},
|
|
7841
|
+
{
|
|
7842
|
+
label: "is empty",
|
|
7843
|
+
value: "ndef",
|
|
7844
|
+
editorType: "empty"
|
|
7845
|
+
},
|
|
7846
|
+
{
|
|
7847
|
+
label: "starts with...",
|
|
7848
|
+
value: "starts",
|
|
7849
|
+
editorType: "text"
|
|
7850
|
+
},
|
|
7851
|
+
{
|
|
7852
|
+
label: "is not empty",
|
|
7853
|
+
value: "def",
|
|
7854
|
+
editorType: "empty"
|
|
7855
|
+
}
|
|
7856
|
+
];
|
|
7857
|
+
var CHECKBOX_OPERATORS = [
|
|
7858
|
+
{
|
|
7859
|
+
label: "is checked",
|
|
7860
|
+
value: "def",
|
|
7861
|
+
editorType: "empty"
|
|
7862
|
+
},
|
|
7863
|
+
{
|
|
7864
|
+
label: "is not checked",
|
|
7865
|
+
value: "ndef",
|
|
7866
|
+
editorType: "empty"
|
|
7867
|
+
}
|
|
7868
|
+
];
|
|
7869
|
+
var SYSTEM_FIELD_OPERATORS = [
|
|
7870
|
+
{
|
|
7871
|
+
label: "is",
|
|
7872
|
+
value: "eq",
|
|
7873
|
+
editorType: "singleChoice"
|
|
7874
|
+
},
|
|
7875
|
+
{
|
|
7876
|
+
label: "is any of...",
|
|
7877
|
+
value: "in",
|
|
7878
|
+
editorType: "multiChoice"
|
|
7879
|
+
},
|
|
7880
|
+
{
|
|
7881
|
+
label: "is not",
|
|
7882
|
+
value: "neq",
|
|
7883
|
+
editorType: "singleChoice"
|
|
7884
|
+
},
|
|
7885
|
+
{
|
|
7886
|
+
label: "is none of...",
|
|
7887
|
+
value: "nin",
|
|
7888
|
+
editorType: "multiChoice"
|
|
7889
|
+
}
|
|
7890
|
+
];
|
|
7891
|
+
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
7892
|
+
{
|
|
7893
|
+
label: "is",
|
|
7894
|
+
value: "eq",
|
|
7895
|
+
editorType: "statusSingleChoice"
|
|
7896
|
+
},
|
|
7897
|
+
{
|
|
7898
|
+
label: "is any of...",
|
|
7899
|
+
value: "in",
|
|
7900
|
+
editorType: "statusMultiChoice"
|
|
7901
|
+
},
|
|
7902
|
+
{
|
|
7903
|
+
label: "is not",
|
|
7904
|
+
value: "neq",
|
|
7905
|
+
editorType: "statusSingleChoice"
|
|
7906
|
+
},
|
|
7907
|
+
{
|
|
7908
|
+
label: "is none of...",
|
|
7909
|
+
value: "nin",
|
|
7910
|
+
editorType: "statusMultiChoice"
|
|
7911
|
+
}
|
|
7912
|
+
];
|
|
7913
|
+
var SELECT_OPERATORS = [
|
|
7914
|
+
{
|
|
7915
|
+
label: "is",
|
|
7916
|
+
value: "eq",
|
|
7917
|
+
editorType: "singleChoice"
|
|
7918
|
+
},
|
|
7919
|
+
{
|
|
7920
|
+
label: "is any of...",
|
|
7921
|
+
value: "in",
|
|
7922
|
+
editorType: "multiChoice"
|
|
7923
|
+
},
|
|
7924
|
+
{
|
|
7925
|
+
label: "is empty",
|
|
7926
|
+
value: "ndef",
|
|
7927
|
+
editorType: "empty"
|
|
7928
|
+
},
|
|
7929
|
+
{
|
|
7930
|
+
label: "contains...",
|
|
7931
|
+
value: "match",
|
|
7932
|
+
editorType: "text"
|
|
7933
|
+
},
|
|
7934
|
+
{
|
|
7935
|
+
label: "starts with...",
|
|
7936
|
+
value: "starts",
|
|
7937
|
+
editorType: "text"
|
|
7938
|
+
},
|
|
7939
|
+
{
|
|
7940
|
+
label: "is not",
|
|
7941
|
+
value: "neq",
|
|
7942
|
+
editorType: "singleChoice"
|
|
7943
|
+
},
|
|
7944
|
+
{
|
|
7945
|
+
label: "is none of...",
|
|
7946
|
+
value: "nin",
|
|
7947
|
+
editorType: "multiChoice"
|
|
7948
|
+
},
|
|
7949
|
+
{
|
|
7950
|
+
label: "is not empty",
|
|
7951
|
+
value: "def",
|
|
7952
|
+
editorType: "empty"
|
|
7953
|
+
}
|
|
7954
|
+
];
|
|
7955
|
+
var MULTI_SELECT_OPERATORS = [
|
|
7956
|
+
{
|
|
7957
|
+
label: "is",
|
|
7958
|
+
value: "eq",
|
|
7959
|
+
editorType: "singleChoice"
|
|
7960
|
+
},
|
|
7961
|
+
{
|
|
7962
|
+
label: "is any of...",
|
|
7963
|
+
value: "in",
|
|
7964
|
+
editorType: "multiChoice"
|
|
7965
|
+
},
|
|
7966
|
+
{
|
|
7967
|
+
label: "is empty",
|
|
7968
|
+
value: "ndef",
|
|
7969
|
+
editorType: "empty"
|
|
7970
|
+
},
|
|
7971
|
+
{
|
|
7972
|
+
label: "is not",
|
|
7973
|
+
value: "neq",
|
|
7974
|
+
editorType: "singleChoice"
|
|
7975
|
+
},
|
|
7976
|
+
{
|
|
7977
|
+
label: "is none of...",
|
|
7978
|
+
value: "nin",
|
|
7979
|
+
editorType: "multiChoice"
|
|
7980
|
+
},
|
|
7981
|
+
{
|
|
7982
|
+
label: "is not empty",
|
|
7983
|
+
value: "def",
|
|
7984
|
+
editorType: "empty"
|
|
7985
|
+
}
|
|
7986
|
+
];
|
|
7987
|
+
|
|
7988
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
7989
|
+
var import_design_system43 = require("@uniformdev/design-system");
|
|
7990
|
+
|
|
7991
|
+
// src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
|
|
7992
|
+
var import_react80 = require("@emotion/react");
|
|
7993
|
+
var import_design_system42 = require("@uniformdev/design-system");
|
|
7994
|
+
var SearchAndFilterControlsWrapper = (gridColumns) => import_react80.css`
|
|
7995
|
+
align-items: stretch;
|
|
7996
|
+
display: grid;
|
|
7997
|
+
grid-template-columns: ${gridColumns};
|
|
7998
|
+
gap: var(--spacing-sm);
|
|
7999
|
+
`;
|
|
8000
|
+
var SearchAndFilterOutterControlWrapper = (gridColumns) => import_react80.css`
|
|
8001
|
+
align-items: stretch;
|
|
8002
|
+
display: grid;
|
|
8003
|
+
grid-template-columns: ${gridColumns};
|
|
8004
|
+
gap: var(--spacing-sm);
|
|
8005
|
+
`;
|
|
8006
|
+
var ConditionalFilterRow = import_react80.css`
|
|
8007
|
+
display: grid;
|
|
8008
|
+
grid-template-columns: 35px 1fr;
|
|
8009
|
+
gap: var(--spacing-sm);
|
|
8010
|
+
margin-left: var(--spacing-base);
|
|
8011
|
+
|
|
8012
|
+
${(0, import_design_system42.cq)("380px")} {
|
|
8013
|
+
align-items: center;
|
|
8014
|
+
|
|
8015
|
+
&:after {
|
|
8016
|
+
content: '';
|
|
8017
|
+
display: block;
|
|
8018
|
+
height: 1px;
|
|
8019
|
+
background: var(--gray-300);
|
|
8020
|
+
width: calc(100% - var(--spacing-base));
|
|
8021
|
+
margin-left: var(--spacing-base);
|
|
8022
|
+
}
|
|
8023
|
+
&:last-of-type:after {
|
|
8024
|
+
display: none;
|
|
8025
|
+
}
|
|
8026
|
+
}
|
|
8027
|
+
|
|
8028
|
+
&:nth-of-type(2) {
|
|
8029
|
+
margin-left: 0;
|
|
8030
|
+
grid-template-columns: 50px 1fr;
|
|
8031
|
+
}
|
|
8032
|
+
|
|
8033
|
+
${(0, import_design_system42.cq)("580px")} {
|
|
8034
|
+
&:after {
|
|
8035
|
+
display: none;
|
|
8036
|
+
}
|
|
8037
|
+
}
|
|
8038
|
+
|
|
8039
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
8040
|
+
animation: ${import_design_system42.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
8041
|
+
}
|
|
8042
|
+
`;
|
|
8043
|
+
var ConditionalInputRow = import_react80.css`
|
|
8044
|
+
display: flex;
|
|
8045
|
+
gap: var(--spacing-sm);
|
|
8046
|
+
flex-wrap: wrap;
|
|
8047
|
+
|
|
8048
|
+
${(0, import_design_system42.cq)("380px")} {
|
|
8049
|
+
& > div:nth-child(-n + 2) {
|
|
8050
|
+
width: calc(50% - var(--spacing-sm));
|
|
8051
|
+
}
|
|
8052
|
+
|
|
8053
|
+
& > div:nth-child(n + 3) {
|
|
8054
|
+
width: calc(100% - 48px);
|
|
8055
|
+
}
|
|
8056
|
+
}
|
|
8057
|
+
${(0, import_design_system42.cq)("764px")} {
|
|
8058
|
+
display: grid;
|
|
8059
|
+
grid-template-columns: 200px 160px 1fr 32px;
|
|
8060
|
+
|
|
8061
|
+
& > div:nth-child(n) {
|
|
8062
|
+
width: auto;
|
|
8063
|
+
}
|
|
8064
|
+
}
|
|
8065
|
+
`;
|
|
8066
|
+
var SearchInput = import_react80.css`
|
|
8067
|
+
max-height: 40px;
|
|
8068
|
+
min-height: unset;
|
|
8069
|
+
`;
|
|
8070
|
+
var BindableKeywordSearchInputStyles = import_react80.css`
|
|
8071
|
+
position: relative;
|
|
8072
|
+
width: 100%;
|
|
8073
|
+
|
|
8074
|
+
& [data-lexical-editor='true'] {
|
|
8075
|
+
padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
|
|
8076
|
+
font-size: var(--fs-sm);
|
|
8077
|
+
border-radius: var(--rounded-full);
|
|
8078
|
+
max-height: 40px;
|
|
8079
|
+
min-height: unset;
|
|
8080
|
+
width: 100%;
|
|
8081
|
+
position: relative;
|
|
8082
|
+
white-space: nowrap;
|
|
8083
|
+
}
|
|
8084
|
+
`;
|
|
8085
|
+
var ClearSearchButtonContainer = import_react80.css`
|
|
8086
|
+
align-items: center;
|
|
8087
|
+
display: flex;
|
|
8088
|
+
position: absolute;
|
|
8089
|
+
inset: 0 var(--spacing-lg) 0 auto;
|
|
8090
|
+
`;
|
|
8091
|
+
var ClearSearchButtonStyles = import_react80.css`
|
|
8092
|
+
background: none;
|
|
8093
|
+
border: none;
|
|
8094
|
+
padding: 0;
|
|
8095
|
+
pointer-events: all;
|
|
8096
|
+
`;
|
|
8097
|
+
var FilterButton = import_react80.css`
|
|
8098
|
+
align-items: center;
|
|
8099
|
+
background: var(--white);
|
|
8100
|
+
border: 1px solid var(--gray-300);
|
|
8101
|
+
border-radius: var(--rounded-full);
|
|
8102
|
+
color: var(--typography-base);
|
|
8103
|
+
display: flex;
|
|
8104
|
+
font-size: var(--fs-sm);
|
|
8105
|
+
gap: var(--spacing-sm);
|
|
8106
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
8107
|
+
max-height: 40px;
|
|
8108
|
+
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
8109
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
8110
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
8111
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
8112
|
+
|
|
8113
|
+
svg {
|
|
8114
|
+
color: var(--gray-300);
|
|
8115
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8116
|
+
}
|
|
8117
|
+
|
|
8118
|
+
&:hover,
|
|
8119
|
+
:where([aria-expanded='true']) {
|
|
8120
|
+
outline: none;
|
|
8121
|
+
background: var(--gray-200);
|
|
8122
|
+
border-color: var(--gray-300);
|
|
8123
|
+
|
|
8124
|
+
svg {
|
|
8125
|
+
color: var(--typography-base);
|
|
8126
|
+
}
|
|
8127
|
+
}
|
|
8128
|
+
|
|
8129
|
+
&:disabled {
|
|
8130
|
+
opacity: var(--opacity-50);
|
|
8131
|
+
}
|
|
8132
|
+
`;
|
|
8133
|
+
var FilterButtonText = import_react80.css`
|
|
8134
|
+
overflow: hidden;
|
|
8135
|
+
text-overflow: ellipsis;
|
|
8136
|
+
white-space: nowrap;
|
|
8137
|
+
max-width: 14ch;
|
|
8138
|
+
`;
|
|
8139
|
+
var FilterButtonSelected = import_react80.css`
|
|
8140
|
+
background: var(--gray-100);
|
|
8141
|
+
border-color: var(--gray-300);
|
|
8142
|
+
|
|
8143
|
+
svg {
|
|
8144
|
+
color: var(--accent-dark);
|
|
8145
|
+
}
|
|
8146
|
+
`;
|
|
8147
|
+
var FilterButtonWithOptions = import_react80.css`
|
|
8148
|
+
:where([aria-expanded='true']) {
|
|
8149
|
+
background: var(--purple-rain-100);
|
|
8150
|
+
border-color: var(--accent-light);
|
|
8151
|
+
color: var(--typography-base);
|
|
8152
|
+
box-shadow: var(--elevation-100);
|
|
8153
|
+
|
|
8154
|
+
svg {
|
|
8155
|
+
color: var(--accent-dark);
|
|
8156
|
+
}
|
|
8157
|
+
}
|
|
8158
|
+
`;
|
|
8159
|
+
var SearchIcon = import_react80.css`
|
|
8160
|
+
color: var(--icon-color);
|
|
8161
|
+
position: absolute;
|
|
8162
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
8163
|
+
margin: auto;
|
|
8164
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8165
|
+
`;
|
|
8166
|
+
var AddConditionalBtn = import_react80.css`
|
|
8167
|
+
align-items: center;
|
|
8168
|
+
background: transparent;
|
|
8169
|
+
border: none;
|
|
8170
|
+
color: var(--primary-action-default);
|
|
8171
|
+
display: flex;
|
|
8172
|
+
gap: var(--spacing-sm);
|
|
8173
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8174
|
+
padding: 0;
|
|
8175
|
+
|
|
8176
|
+
&:hover,
|
|
8177
|
+
&:focus {
|
|
8178
|
+
color: var(--primary-action-hover);
|
|
8179
|
+
}
|
|
8180
|
+
|
|
8181
|
+
&:disabled {
|
|
8182
|
+
color: var(--gray-400);
|
|
8183
|
+
}
|
|
8184
|
+
`;
|
|
8185
|
+
var Title = import_react80.css`
|
|
8186
|
+
color: var(--typography-light);
|
|
8187
|
+
|
|
8188
|
+
&:focus {
|
|
8189
|
+
outline: none;
|
|
8190
|
+
}
|
|
8191
|
+
`;
|
|
8192
|
+
var ResetConditionsBtn = import_react80.css`
|
|
8193
|
+
background: transparent;
|
|
8194
|
+
border: none;
|
|
8195
|
+
color: var(--action-destructive-default);
|
|
8196
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8197
|
+
padding: 0;
|
|
8198
|
+
|
|
8199
|
+
&:hover,
|
|
8200
|
+
&:focus {
|
|
8201
|
+
color: var(--action-destructive-hover);
|
|
8202
|
+
}
|
|
8203
|
+
`;
|
|
8204
|
+
var IconBtn = import_react80.css`
|
|
8205
|
+
background: transparent;
|
|
8206
|
+
border: none;
|
|
8207
|
+
padding: var(--spacing-sm);
|
|
8208
|
+
`;
|
|
8209
|
+
var SearchAndFilterOptionsContainer = import_react80.css`
|
|
8210
|
+
background: var(--gray-50);
|
|
8211
|
+
border: 1px solid var(--gray-300);
|
|
8212
|
+
border-radius: var(--rounded-base);
|
|
8213
|
+
container-type: inline-size;
|
|
8214
|
+
display: flex;
|
|
8215
|
+
flex-direction: column;
|
|
8216
|
+
gap: var(--spacing-sm);
|
|
8217
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
8218
|
+
will-change: height;
|
|
8219
|
+
position: relative;
|
|
8220
|
+
z-index: 1;
|
|
8221
|
+
`;
|
|
8222
|
+
var SearchAndFilterOptionsInnerContainer = import_react80.css`
|
|
8223
|
+
display: flex;
|
|
8224
|
+
flex-direction: column;
|
|
8225
|
+
gap: var(--spacing-sm);
|
|
8226
|
+
padding-inline: var(--spacing-md);
|
|
8227
|
+
`;
|
|
8228
|
+
var SearchAndFilterButtonGroup = import_react80.css`
|
|
8229
|
+
margin-top: var(--spacing-xs);
|
|
8230
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
8231
|
+
`;
|
|
8232
|
+
|
|
8233
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8234
|
+
var import_jsx_runtime71 = require("@emotion/react/jsx-runtime");
|
|
8235
|
+
var FilterButton2 = ({
|
|
8236
|
+
text = "Filters",
|
|
8237
|
+
icon = "filter-add",
|
|
8238
|
+
filterCount,
|
|
8239
|
+
hasSelectedValue,
|
|
8240
|
+
dataTestId,
|
|
8241
|
+
...props
|
|
8242
|
+
}) => {
|
|
8243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
8244
|
+
"button",
|
|
8245
|
+
{
|
|
8246
|
+
type: "button",
|
|
8247
|
+
css: [
|
|
8248
|
+
FilterButton,
|
|
8249
|
+
hasSelectedValue ? FilterButtonSelected : void 0,
|
|
8250
|
+
filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
|
|
8251
|
+
],
|
|
8252
|
+
...props,
|
|
8253
|
+
"data-testid": dataTestId,
|
|
8254
|
+
children: [
|
|
8255
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_design_system43.Icon, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
8256
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { css: FilterButtonText, children: text }),
|
|
8257
|
+
filterCount ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_design_system43.Counter, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
8258
|
+
]
|
|
8259
|
+
}
|
|
8260
|
+
);
|
|
8261
|
+
};
|
|
8262
|
+
|
|
8263
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8264
|
+
var import_CgClose5 = require("@react-icons/all-files/cg/CgClose");
|
|
8265
|
+
var import_design_system46 = require("@uniformdev/design-system");
|
|
8266
|
+
var import_lexical11 = require("lexical");
|
|
8267
|
+
var import_react83 = require("react");
|
|
8268
|
+
var import_react_use7 = require("react-use");
|
|
8269
|
+
var import_uuid3 = require("uuid");
|
|
8270
|
+
|
|
8271
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8272
|
+
var import_design_system45 = require("@uniformdev/design-system");
|
|
8273
|
+
var import_react82 = require("react");
|
|
8274
|
+
|
|
8275
|
+
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
8276
|
+
var import_design_system44 = require("@uniformdev/design-system");
|
|
8277
|
+
var import_react81 = require("react");
|
|
8278
|
+
var import_react_use6 = require("react-use");
|
|
8279
|
+
var import_jsx_runtime72 = require("@emotion/react/jsx-runtime");
|
|
8280
|
+
var readOnlyAttributes = {
|
|
8281
|
+
isSearchable: false,
|
|
8282
|
+
menuIsOpen: false,
|
|
8283
|
+
isClearable: false
|
|
8284
|
+
};
|
|
8285
|
+
var FilterMultiChoiceEditor = ({
|
|
8286
|
+
value,
|
|
8287
|
+
options,
|
|
8288
|
+
disabled,
|
|
8289
|
+
readOnly,
|
|
8290
|
+
valueTestId,
|
|
8291
|
+
...props
|
|
8292
|
+
}) => {
|
|
8293
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8294
|
+
const isClearable = !readOnly || !disabled;
|
|
8295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8296
|
+
import_design_system44.InputComboBox,
|
|
8297
|
+
{
|
|
8298
|
+
...props,
|
|
8299
|
+
placeholder: "Type to search...",
|
|
8300
|
+
options,
|
|
8301
|
+
isMulti: true,
|
|
8302
|
+
isClearable,
|
|
8303
|
+
isDisabled: disabled,
|
|
8304
|
+
onChange: (e) => {
|
|
8305
|
+
var _a;
|
|
8306
|
+
return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
|
|
8307
|
+
},
|
|
8308
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
8309
|
+
"aria-readonly": readOnly,
|
|
8310
|
+
styles: {
|
|
8311
|
+
menu(base) {
|
|
8312
|
+
return {
|
|
8313
|
+
...base,
|
|
8314
|
+
minWidth: "max-content"
|
|
8315
|
+
};
|
|
8316
|
+
}
|
|
8317
|
+
},
|
|
8318
|
+
...readOnlyProps
|
|
8319
|
+
}
|
|
8320
|
+
) });
|
|
8321
|
+
};
|
|
8322
|
+
var FilterSingleChoiceEditor = ({
|
|
8323
|
+
options,
|
|
8324
|
+
value,
|
|
8325
|
+
disabled,
|
|
8326
|
+
readOnly,
|
|
8327
|
+
onChange,
|
|
8328
|
+
valueTestId
|
|
8329
|
+
}) => {
|
|
8330
|
+
var _a;
|
|
8331
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8333
|
+
import_design_system44.InputComboBox,
|
|
8334
|
+
{
|
|
8335
|
+
placeholder: "Type to search...",
|
|
8336
|
+
options,
|
|
8337
|
+
isClearable: true,
|
|
8338
|
+
onChange: (e) => {
|
|
8339
|
+
var _a2;
|
|
8340
|
+
return onChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
8341
|
+
},
|
|
8342
|
+
isDisabled: disabled,
|
|
8343
|
+
value: (_a = options == null ? void 0 : options.find((option) => option.value === value)) != null ? _a : null,
|
|
8344
|
+
"aria-readonly": readOnly,
|
|
8345
|
+
styles: {
|
|
8346
|
+
menu(base) {
|
|
8347
|
+
return {
|
|
8348
|
+
...base,
|
|
8349
|
+
minWidth: "max-content"
|
|
8350
|
+
};
|
|
8351
|
+
}
|
|
8352
|
+
},
|
|
8353
|
+
...readOnlyProps
|
|
8354
|
+
}
|
|
8355
|
+
) });
|
|
8356
|
+
};
|
|
8357
|
+
var CustomOptions = ({ label, value }) => {
|
|
8358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system44.StatusBullet, { status: label, message: value });
|
|
8359
|
+
};
|
|
8360
|
+
var StatusMultiEditor = ({
|
|
8361
|
+
options,
|
|
8362
|
+
value,
|
|
8363
|
+
disabled,
|
|
8364
|
+
readOnly,
|
|
8365
|
+
onChange,
|
|
8366
|
+
valueTestId
|
|
8367
|
+
}) => {
|
|
8368
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8370
|
+
import_design_system44.InputComboBox,
|
|
8371
|
+
{
|
|
8372
|
+
options,
|
|
8373
|
+
isMulti: true,
|
|
8374
|
+
onChange: (e) => {
|
|
8375
|
+
var _a;
|
|
8376
|
+
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
8377
|
+
},
|
|
8378
|
+
formatOptionLabel: CustomOptions,
|
|
8379
|
+
"aria-readonly": readOnly,
|
|
8380
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
8381
|
+
isDisabled: disabled,
|
|
8382
|
+
styles: {
|
|
8383
|
+
menu(base) {
|
|
8384
|
+
return {
|
|
8385
|
+
...base,
|
|
8386
|
+
minWidth: "max-content"
|
|
8387
|
+
};
|
|
8388
|
+
}
|
|
8389
|
+
},
|
|
8390
|
+
...readOnlyProps
|
|
8391
|
+
}
|
|
8392
|
+
) });
|
|
8393
|
+
};
|
|
8394
|
+
var StatusSingleEditor = ({
|
|
8395
|
+
options,
|
|
8396
|
+
value,
|
|
8397
|
+
disabled,
|
|
8398
|
+
readOnly,
|
|
8399
|
+
onChange,
|
|
8400
|
+
valueTestId
|
|
8401
|
+
}) => {
|
|
8402
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8404
|
+
import_design_system44.InputComboBox,
|
|
8405
|
+
{
|
|
8406
|
+
options,
|
|
8407
|
+
onChange: (e) => {
|
|
8408
|
+
var _a;
|
|
8409
|
+
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
8410
|
+
},
|
|
8411
|
+
formatOptionLabel: CustomOptions,
|
|
8412
|
+
"aria-readonly": readOnly,
|
|
8413
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
8414
|
+
isDisabled: disabled,
|
|
8415
|
+
styles: {
|
|
8416
|
+
menu(base) {
|
|
8417
|
+
return {
|
|
8418
|
+
...base,
|
|
8419
|
+
minWidth: "max-content"
|
|
8420
|
+
};
|
|
8421
|
+
}
|
|
8422
|
+
},
|
|
8423
|
+
...readOnlyProps
|
|
8424
|
+
}
|
|
8425
|
+
) });
|
|
8426
|
+
};
|
|
8427
|
+
var TextEditor = ({
|
|
8428
|
+
onChange,
|
|
8429
|
+
ariaLabel,
|
|
8430
|
+
value,
|
|
8431
|
+
readOnly,
|
|
8432
|
+
valueTestId
|
|
8433
|
+
}) => {
|
|
8434
|
+
const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
|
|
8435
|
+
(0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8437
|
+
import_design_system44.Input,
|
|
8438
|
+
{
|
|
8439
|
+
showLabel: false,
|
|
8440
|
+
label: ariaLabel,
|
|
8441
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8442
|
+
placeholder: "Enter phrase to search\u2026",
|
|
8443
|
+
value: innerValue,
|
|
8444
|
+
readOnly,
|
|
8445
|
+
"data-testid": valueTestId
|
|
8446
|
+
}
|
|
8447
|
+
);
|
|
8448
|
+
};
|
|
8449
|
+
var NumberRangeEditor = ({
|
|
8450
|
+
onChange,
|
|
8451
|
+
disabled,
|
|
8452
|
+
ariaLabel,
|
|
8453
|
+
value,
|
|
8454
|
+
readOnly,
|
|
8455
|
+
valueTestId
|
|
8456
|
+
}) => {
|
|
8457
|
+
const [minValue, setMinValue] = (0, import_react81.useState)("");
|
|
8458
|
+
const [maxValue, setMaxValue] = (0, import_react81.useState)("");
|
|
8459
|
+
const [error, setError] = (0, import_react81.useState)("");
|
|
8460
|
+
(0, import_react_use6.useDebounce)(
|
|
8461
|
+
() => {
|
|
8462
|
+
if (minValue && maxValue && !error) {
|
|
8463
|
+
onChange([minValue, maxValue]);
|
|
8464
|
+
} else {
|
|
8465
|
+
onChange([]);
|
|
8466
|
+
}
|
|
8467
|
+
},
|
|
8468
|
+
500,
|
|
8469
|
+
[minValue, maxValue]
|
|
8470
|
+
);
|
|
8471
|
+
(0, import_react81.useEffect)(() => {
|
|
8472
|
+
if (!maxValue && !minValue) {
|
|
8473
|
+
return;
|
|
8474
|
+
}
|
|
8475
|
+
const max = Number(maxValue);
|
|
8476
|
+
const min = Number(minValue);
|
|
8477
|
+
if (max < min || min > max) {
|
|
8478
|
+
setError("Please enter a valid numeric range");
|
|
8479
|
+
return;
|
|
8480
|
+
}
|
|
8481
|
+
if (maxValue && !minValue || minValue && !maxValue) {
|
|
8482
|
+
setError("Please enter both a low and high number");
|
|
8483
|
+
return;
|
|
8484
|
+
}
|
|
8485
|
+
if (error) {
|
|
8486
|
+
setError("");
|
|
8487
|
+
}
|
|
8488
|
+
if (min && max) {
|
|
8489
|
+
setMinValue(minValue);
|
|
8490
|
+
setMaxValue(maxValue);
|
|
8491
|
+
}
|
|
8492
|
+
}, [maxValue, minValue, setError]);
|
|
8493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
8494
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8495
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8496
|
+
import_design_system44.Input,
|
|
8497
|
+
{
|
|
8498
|
+
label: `${ariaLabel}-min`,
|
|
8499
|
+
type: "number",
|
|
8500
|
+
showLabel: false,
|
|
8501
|
+
min: 0,
|
|
8502
|
+
placeholder: "Low",
|
|
8503
|
+
onChange: (e) => setMinValue(e.currentTarget.value),
|
|
8504
|
+
"aria-invalid": !error ? false : true,
|
|
8505
|
+
disabled,
|
|
8506
|
+
value: value ? value[0] : "",
|
|
8507
|
+
readOnly,
|
|
8508
|
+
"data-testid": "value-low"
|
|
8509
|
+
}
|
|
8510
|
+
),
|
|
8511
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8512
|
+
import_design_system44.Input,
|
|
8513
|
+
{
|
|
8514
|
+
type: "number",
|
|
8515
|
+
label: `${ariaLabel}-max`,
|
|
8516
|
+
showLabel: false,
|
|
8517
|
+
min: 0,
|
|
8518
|
+
placeholder: "High",
|
|
8519
|
+
onChange: (e) => setMaxValue(e.currentTarget.value),
|
|
8520
|
+
"aria-invalid": !error ? false : true,
|
|
8521
|
+
disabled,
|
|
8522
|
+
value: value ? value[1] : "",
|
|
8523
|
+
readOnly,
|
|
8524
|
+
"data-testid": "value-high"
|
|
8525
|
+
}
|
|
8526
|
+
)
|
|
8527
|
+
] }),
|
|
8528
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ErrorContainer, { errorMessage: error })
|
|
8529
|
+
] });
|
|
8530
|
+
};
|
|
8531
|
+
var NumberEditor = ({
|
|
8532
|
+
ariaLabel,
|
|
8533
|
+
onChange,
|
|
8534
|
+
disabled,
|
|
8535
|
+
value,
|
|
8536
|
+
readOnly,
|
|
8537
|
+
valueTestId
|
|
8538
|
+
}) => {
|
|
8539
|
+
const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
|
|
8540
|
+
(0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8542
|
+
import_design_system44.Input,
|
|
8543
|
+
{
|
|
8544
|
+
label: ariaLabel,
|
|
8545
|
+
type: "number",
|
|
8546
|
+
showLabel: false,
|
|
8547
|
+
min: 0,
|
|
8548
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8549
|
+
disabled,
|
|
8550
|
+
value: innerValue,
|
|
8551
|
+
readOnly,
|
|
8552
|
+
"data-testid": valueTestId
|
|
8553
|
+
}
|
|
8554
|
+
);
|
|
8555
|
+
};
|
|
8556
|
+
var DateEditor = ({
|
|
8557
|
+
onChange,
|
|
8558
|
+
ariaLabel,
|
|
8559
|
+
disabled,
|
|
8560
|
+
value,
|
|
8561
|
+
readOnly,
|
|
8562
|
+
valueTestId
|
|
8563
|
+
}) => {
|
|
8564
|
+
const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
|
|
8565
|
+
(0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
|
|
8566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8567
|
+
import_design_system44.Input,
|
|
8568
|
+
{
|
|
8569
|
+
type: "date",
|
|
8570
|
+
label: ariaLabel,
|
|
8571
|
+
showLabel: false,
|
|
8572
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8573
|
+
disabled,
|
|
8574
|
+
value: innerValue,
|
|
8575
|
+
readOnly,
|
|
8576
|
+
"data-testid": valueTestId
|
|
8577
|
+
}
|
|
8578
|
+
);
|
|
8579
|
+
};
|
|
8580
|
+
var DateRangeEditor = ({
|
|
8581
|
+
ariaLabel,
|
|
8582
|
+
onChange,
|
|
8583
|
+
disabled,
|
|
8584
|
+
value,
|
|
8585
|
+
readOnly,
|
|
8586
|
+
valueTestId
|
|
8587
|
+
}) => {
|
|
8588
|
+
const [minDateValue, setMinDateValue] = (0, import_react81.useState)(value ? value[0] : "");
|
|
8589
|
+
const [maxDateValue, setMaxDateValue] = (0, import_react81.useState)(value ? value[1] : "");
|
|
8590
|
+
const [error, setError] = (0, import_react81.useState)("");
|
|
8591
|
+
(0, import_react_use6.useDebounce)(
|
|
8592
|
+
() => {
|
|
8593
|
+
if (minDateValue && maxDateValue && !error) {
|
|
8594
|
+
onChange([minDateValue, maxDateValue]);
|
|
8595
|
+
} else {
|
|
8596
|
+
onChange([]);
|
|
8597
|
+
}
|
|
8598
|
+
},
|
|
8599
|
+
500,
|
|
8600
|
+
[minDateValue, maxDateValue]
|
|
8601
|
+
);
|
|
8602
|
+
(0, import_react81.useEffect)(() => {
|
|
8603
|
+
if (!minDateValue || !maxDateValue) {
|
|
8604
|
+
return;
|
|
8605
|
+
}
|
|
8606
|
+
const minDate = new Date(minDateValue);
|
|
8607
|
+
const maxDate = new Date(maxDateValue);
|
|
8608
|
+
if (maxDate < minDate) {
|
|
8609
|
+
setError("The max date cannot be lower than the min date");
|
|
8610
|
+
return;
|
|
8611
|
+
}
|
|
8612
|
+
if (maxDate && !minDate) {
|
|
8613
|
+
setError("Please enter both a low and high date");
|
|
8614
|
+
return;
|
|
8615
|
+
}
|
|
8616
|
+
const minDateString = minDate.toDateString();
|
|
8617
|
+
const maxDateString = maxDate.toDateString();
|
|
8618
|
+
if (minDateString === maxDateString || maxDateString === minDateString) {
|
|
8619
|
+
setError("The min and max date cannot be the same");
|
|
8620
|
+
return;
|
|
8621
|
+
}
|
|
8622
|
+
if (minDate > maxDate) {
|
|
8623
|
+
setError("The min date cannot be higher than the max date");
|
|
8624
|
+
return;
|
|
8625
|
+
}
|
|
8626
|
+
if (error) {
|
|
8627
|
+
setError("");
|
|
8628
|
+
}
|
|
8629
|
+
if (minDate && maxDate) {
|
|
8630
|
+
setMinDateValue(minDateValue);
|
|
8631
|
+
setMaxDateValue(maxDateValue);
|
|
8632
|
+
} else {
|
|
8633
|
+
setMinDateValue("");
|
|
8634
|
+
setMaxDateValue("");
|
|
8635
|
+
}
|
|
8636
|
+
}, [minDateValue, maxDateValue, setError]);
|
|
8637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
8638
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8639
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8640
|
+
import_design_system44.Input,
|
|
8641
|
+
{
|
|
8642
|
+
label: `${ariaLabel}-min-date`,
|
|
8643
|
+
type: "date",
|
|
8644
|
+
showLabel: false,
|
|
8645
|
+
value: minDateValue,
|
|
8646
|
+
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
8647
|
+
"aria-invalid": !error ? false : true,
|
|
8648
|
+
disabled,
|
|
8649
|
+
readOnly,
|
|
8650
|
+
"data-testid": "value-low"
|
|
8651
|
+
}
|
|
8652
|
+
),
|
|
8653
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8654
|
+
import_design_system44.Input,
|
|
8655
|
+
{
|
|
8656
|
+
label: `${ariaLabel}-max-date`,
|
|
8657
|
+
type: "date",
|
|
8658
|
+
showLabel: false,
|
|
8659
|
+
value: maxDateValue,
|
|
8660
|
+
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
8661
|
+
"aria-invalid": !error ? false : true,
|
|
8662
|
+
disabled,
|
|
8663
|
+
readOnly,
|
|
8664
|
+
"data-testid": "value-high"
|
|
8665
|
+
}
|
|
8666
|
+
)
|
|
8667
|
+
] }),
|
|
8668
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ErrorContainer, { errorMessage: error })
|
|
8669
|
+
] });
|
|
8670
|
+
};
|
|
8671
|
+
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
8672
|
+
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
8673
|
+
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
8674
|
+
if (!Editor) {
|
|
8675
|
+
return null;
|
|
8676
|
+
}
|
|
8677
|
+
if (editorType === "empty") {
|
|
8678
|
+
return null;
|
|
8679
|
+
}
|
|
8680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Editor, { ...props });
|
|
8681
|
+
};
|
|
8682
|
+
var filterMapper = {
|
|
8683
|
+
multiChoice: FilterMultiChoiceEditor,
|
|
8684
|
+
singleChoice: FilterSingleChoiceEditor,
|
|
8685
|
+
date: DateEditor,
|
|
8686
|
+
dateRange: DateRangeEditor,
|
|
8687
|
+
text: TextEditor,
|
|
8688
|
+
numberRange: NumberRangeEditor,
|
|
8689
|
+
number: NumberEditor,
|
|
8690
|
+
statusMultiChoice: StatusMultiEditor,
|
|
8691
|
+
statusSingleChoice: StatusSingleEditor,
|
|
8692
|
+
empty: null
|
|
8693
|
+
};
|
|
8694
|
+
function withInputVariables(WrappedComponent) {
|
|
8695
|
+
const WithInputVariables = (props) => {
|
|
8696
|
+
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props });
|
|
8698
|
+
}
|
|
8699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8700
|
+
InputVariables,
|
|
8701
|
+
{
|
|
8702
|
+
disableInlineMenu: true,
|
|
8703
|
+
showMenuPosition: "inline-right",
|
|
8704
|
+
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8705
|
+
value: props.value,
|
|
8706
|
+
disabled: props.disabled,
|
|
8707
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props })
|
|
8708
|
+
}
|
|
8709
|
+
);
|
|
8710
|
+
};
|
|
8711
|
+
return WithInputVariables;
|
|
8712
|
+
}
|
|
8713
|
+
function withInputVariablesForMultiValue(WrappedComponent) {
|
|
8714
|
+
const WithInputVariables = (props) => {
|
|
8715
|
+
var _a;
|
|
8716
|
+
if (!props.bindable || props.disabled || props.readOnly) {
|
|
8717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props });
|
|
8718
|
+
}
|
|
8719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8720
|
+
InputVariables,
|
|
8721
|
+
{
|
|
8722
|
+
disableInlineMenu: true,
|
|
8723
|
+
showMenuPosition: "inline-right",
|
|
8724
|
+
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
8725
|
+
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
8726
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props })
|
|
8727
|
+
}
|
|
8728
|
+
);
|
|
8729
|
+
};
|
|
8730
|
+
return WithInputVariables;
|
|
8731
|
+
}
|
|
8732
|
+
var bindableFiltersMapper = {
|
|
8733
|
+
...filterMapper,
|
|
8734
|
+
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
8735
|
+
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
8736
|
+
date: withInputVariables(DateEditor),
|
|
8737
|
+
text: withInputVariables(TextEditor),
|
|
8738
|
+
number: withInputVariables(NumberEditor)
|
|
8739
|
+
};
|
|
8740
|
+
var ErrorContainer = ({ errorMessage }) => {
|
|
8741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8742
|
+
"div",
|
|
8743
|
+
{
|
|
8744
|
+
css: {
|
|
8745
|
+
gridColumn: "span 6",
|
|
8746
|
+
order: 6
|
|
8747
|
+
},
|
|
8748
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system44.FieldMessage, { errorMessage })
|
|
8749
|
+
}
|
|
8750
|
+
);
|
|
8751
|
+
};
|
|
8752
|
+
var twoColumnGrid = {
|
|
8753
|
+
display: "grid",
|
|
8754
|
+
gridTemplateColumns: "1fr 1fr",
|
|
8755
|
+
gap: "var(--spacing-sm);"
|
|
8756
|
+
};
|
|
8757
|
+
|
|
8758
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8759
|
+
var import_jsx_runtime73 = require("@emotion/react/jsx-runtime");
|
|
8760
|
+
var SearchAndFilterContext = (0, import_react82.createContext)({
|
|
8761
|
+
searchTerm: "",
|
|
8762
|
+
setSearchTerm: () => {
|
|
8763
|
+
},
|
|
8764
|
+
filterVisibility: void 0,
|
|
8765
|
+
setFilterVisibility: () => {
|
|
8766
|
+
},
|
|
8767
|
+
filters: [],
|
|
8768
|
+
setFilters: () => {
|
|
8769
|
+
},
|
|
8770
|
+
handleAddFilter: () => {
|
|
8771
|
+
},
|
|
8772
|
+
handleResetFilters: () => {
|
|
8773
|
+
},
|
|
8774
|
+
handleDeleteFilter: () => {
|
|
8775
|
+
},
|
|
8776
|
+
filterOptions: [],
|
|
8777
|
+
validFilterQuery: [],
|
|
8778
|
+
filterMapper: {},
|
|
8779
|
+
totalResults: 0,
|
|
8780
|
+
allowBindingSearchTerm: false
|
|
8781
|
+
});
|
|
8782
|
+
var SearchAndFilterProvider = ({
|
|
8783
|
+
filters,
|
|
8784
|
+
filterOptions,
|
|
8785
|
+
filterVisible = false,
|
|
8786
|
+
defaultSearchTerm = "",
|
|
8787
|
+
onSearchChange,
|
|
8788
|
+
onChange,
|
|
8789
|
+
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
8790
|
+
totalResults,
|
|
8791
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
8792
|
+
children,
|
|
8793
|
+
allowBindingSearchTerm
|
|
8794
|
+
}) => {
|
|
8795
|
+
const [searchTerm, setSearchTerm] = (0, import_react82.useState)(defaultSearchTerm);
|
|
8796
|
+
const deferredSearchTerm = (0, import_react82.useDeferredValue)(searchTerm);
|
|
8797
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react82.useState)(filterVisible);
|
|
8798
|
+
const handleSearchTerm = (0, import_react82.useCallback)(
|
|
8799
|
+
(term) => {
|
|
8800
|
+
setSearchTerm(term);
|
|
8801
|
+
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
8802
|
+
},
|
|
8803
|
+
[setSearchTerm, onSearchChange]
|
|
8804
|
+
);
|
|
8805
|
+
const handleToggleFilterVisibility = (0, import_react82.useCallback)(
|
|
8806
|
+
(visible) => setFilterVisibility(visible),
|
|
8807
|
+
[setFilterVisibility]
|
|
8808
|
+
);
|
|
8809
|
+
const handleAddFilter = (0, import_react82.useCallback)(() => {
|
|
8810
|
+
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
8811
|
+
}, [filters, onChange]);
|
|
8812
|
+
const handleResetFilters = (0, import_react82.useCallback)(() => {
|
|
8813
|
+
onSearchChange == null ? void 0 : onSearchChange("");
|
|
8814
|
+
onChange(resetFilterValues);
|
|
8815
|
+
}, [onChange, resetFilterValues, onSearchChange]);
|
|
8816
|
+
const handleDeleteFilter = (0, import_react82.useCallback)(
|
|
8817
|
+
(index) => {
|
|
8818
|
+
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
8819
|
+
onChange(remainingFilters);
|
|
8820
|
+
},
|
|
8821
|
+
[filters, onChange]
|
|
8822
|
+
);
|
|
8823
|
+
const validFilterQuery = (0, import_react82.useMemo)(() => {
|
|
8824
|
+
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
8825
|
+
if (hasValidFilters) {
|
|
8826
|
+
return filters;
|
|
8827
|
+
}
|
|
8828
|
+
}, [filters]);
|
|
8829
|
+
(0, import_react82.useEffect)(() => {
|
|
8830
|
+
if (filterVisibility) {
|
|
8831
|
+
const handleEscKeyFilterClose = (e) => {
|
|
8832
|
+
if (e.key === "Escape") {
|
|
8833
|
+
setFilterVisibility(false);
|
|
8834
|
+
}
|
|
8835
|
+
};
|
|
8836
|
+
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8837
|
+
return () => {
|
|
8838
|
+
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
8839
|
+
};
|
|
8840
|
+
}
|
|
8841
|
+
}, [filterVisibility]);
|
|
8842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
8843
|
+
SearchAndFilterContext.Provider,
|
|
8844
|
+
{
|
|
8845
|
+
value: {
|
|
8846
|
+
searchTerm: deferredSearchTerm,
|
|
8847
|
+
setSearchTerm: (e) => handleSearchTerm(e),
|
|
8848
|
+
filterVisibility,
|
|
8849
|
+
setFilterVisibility: (e) => handleToggleFilterVisibility(e),
|
|
8850
|
+
filters,
|
|
8851
|
+
setFilters: (e) => onChange(e),
|
|
8852
|
+
handleAddFilter,
|
|
8853
|
+
handleResetFilters,
|
|
8854
|
+
handleDeleteFilter,
|
|
8855
|
+
filterOptions,
|
|
8856
|
+
validFilterQuery,
|
|
8857
|
+
totalResults,
|
|
8858
|
+
filterMapper: filterMapper2,
|
|
8859
|
+
allowBindingSearchTerm
|
|
8860
|
+
},
|
|
8861
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_design_system45.VerticalRhythm, { children })
|
|
8862
|
+
}
|
|
8863
|
+
);
|
|
8864
|
+
};
|
|
8865
|
+
var useSearchAndFilter = () => {
|
|
8866
|
+
const value = (0, import_react82.useContext)(SearchAndFilterContext);
|
|
8867
|
+
return { ...value };
|
|
8868
|
+
};
|
|
8869
|
+
|
|
8870
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8871
|
+
var import_jsx_runtime74 = require("@emotion/react/jsx-runtime");
|
|
8872
|
+
var FilterControls = ({
|
|
8873
|
+
children,
|
|
8874
|
+
hideSearchInput
|
|
8875
|
+
}) => {
|
|
8876
|
+
const {
|
|
8877
|
+
setFilterVisibility,
|
|
8878
|
+
filterVisibility,
|
|
8879
|
+
setSearchTerm,
|
|
8880
|
+
validFilterQuery,
|
|
8881
|
+
searchTerm,
|
|
8882
|
+
allowBindingSearchTerm
|
|
8883
|
+
} = useSearchAndFilter();
|
|
8884
|
+
const editorRef = (0, import_react83.useRef)(null);
|
|
8885
|
+
const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
|
|
8886
|
+
const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react83.useState)("data-resource-search-term-input");
|
|
8887
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react83.useState)(searchTerm);
|
|
8888
|
+
(0, import_react_use7.useDebounce)(
|
|
8889
|
+
() => {
|
|
8890
|
+
setSearchTerm(localeSearchTerm);
|
|
8891
|
+
},
|
|
8892
|
+
300,
|
|
8893
|
+
[localeSearchTerm]
|
|
8894
|
+
);
|
|
8895
|
+
(0, import_react83.useEffect)(() => {
|
|
8896
|
+
if (searchTerm === "") {
|
|
8897
|
+
setLocaleSearchTerm("");
|
|
8898
|
+
setIdToResetInputVariables(`data-resource-search-term-input-${(0, import_uuid3.v4)()}`);
|
|
8899
|
+
}
|
|
8900
|
+
}, [searchTerm]);
|
|
8901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
8902
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8903
|
+
FilterButton2,
|
|
8904
|
+
{
|
|
8905
|
+
"aria-controls": "search-and-filter-options",
|
|
8906
|
+
"aria-label": "filter options",
|
|
8907
|
+
"aria-haspopup": "true",
|
|
8908
|
+
text: "Filter/Sort",
|
|
8909
|
+
"aria-expanded": filterVisibility === true,
|
|
8910
|
+
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
8911
|
+
onClick: () => setFilterVisibility(!filterVisibility),
|
|
8912
|
+
dataTestId: "filters-button"
|
|
8913
|
+
}
|
|
8914
|
+
),
|
|
8915
|
+
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { css: BindableKeywordSearchInputStyles, children: [
|
|
8916
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8917
|
+
InputVariables,
|
|
8918
|
+
{
|
|
8919
|
+
label: "",
|
|
8920
|
+
id: idToResetInputVariables,
|
|
8921
|
+
showMenuPosition: "inline-right",
|
|
8922
|
+
editorRef,
|
|
8923
|
+
value: localeSearchTerm,
|
|
8924
|
+
onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
|
|
8925
|
+
disableVariables: !allowBindingSearchTerm,
|
|
8926
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8927
|
+
import_design_system46.InputKeywordSearch,
|
|
8928
|
+
{
|
|
8929
|
+
placeholder: "Search...",
|
|
8930
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
8931
|
+
value: localeSearchTerm,
|
|
8932
|
+
compact: true,
|
|
8933
|
+
rounded: true,
|
|
8934
|
+
css: SearchInput
|
|
8935
|
+
}
|
|
8936
|
+
)
|
|
8937
|
+
}
|
|
8938
|
+
),
|
|
8939
|
+
hasVariableInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8940
|
+
"button",
|
|
8941
|
+
{
|
|
8942
|
+
css: ClearSearchButtonStyles,
|
|
8943
|
+
onClick: () => {
|
|
8944
|
+
setLocaleSearchTerm("");
|
|
8945
|
+
if (editorRef.current) {
|
|
8946
|
+
if (editorRef.current.getRootElement() !== document.activeElement) {
|
|
8947
|
+
editorRef.current.dispatchCommand(import_lexical11.CLEAR_EDITOR_COMMAND, void 0);
|
|
8948
|
+
}
|
|
8949
|
+
}
|
|
8950
|
+
},
|
|
8951
|
+
type: "button",
|
|
8952
|
+
"data-testid": "keyword-search-clear-button",
|
|
8953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_design_system46.Icon, { icon: import_CgClose5.CgClose, iconColor: "red", size: "1rem" })
|
|
8954
|
+
}
|
|
8955
|
+
) }) : null
|
|
8956
|
+
] }),
|
|
8957
|
+
children
|
|
8958
|
+
] });
|
|
8959
|
+
};
|
|
8960
|
+
|
|
8961
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8962
|
+
var import_design_system48 = require("@uniformdev/design-system");
|
|
8963
|
+
var import_react85 = require("react");
|
|
8964
|
+
|
|
8965
|
+
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
8966
|
+
var import_design_system47 = require("@uniformdev/design-system");
|
|
8967
|
+
var import_react84 = __toESM(require("react"));
|
|
8968
|
+
var import_jsx_runtime75 = require("@emotion/react/jsx-runtime");
|
|
8969
|
+
var SearchAndFilterOptionsContainer2 = ({
|
|
8970
|
+
buttonRow,
|
|
8971
|
+
additionalFiltersContainer,
|
|
8972
|
+
children
|
|
8973
|
+
}) => {
|
|
8974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
8975
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
8976
|
+
buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
8977
|
+
import_design_system47.HorizontalRhythm,
|
|
8978
|
+
{
|
|
8979
|
+
css: SearchAndFilterButtonGroup,
|
|
8980
|
+
gap: "sm",
|
|
8981
|
+
align: "center",
|
|
8982
|
+
justify: "space-between",
|
|
8983
|
+
children: buttonRow
|
|
8984
|
+
}
|
|
8985
|
+
) : null,
|
|
8986
|
+
additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { children: additionalFiltersContainer }) : null
|
|
8987
|
+
] });
|
|
8988
|
+
};
|
|
8989
|
+
var FilterMenu = ({
|
|
8990
|
+
id,
|
|
8991
|
+
filterTitle = "Show results",
|
|
8992
|
+
menuControls,
|
|
8993
|
+
additionalFiltersContainer,
|
|
8994
|
+
children,
|
|
8995
|
+
dataTestId,
|
|
8996
|
+
resetButtonText = "reset"
|
|
8997
|
+
}) => {
|
|
8998
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
8999
|
+
const innerMenuRef = import_react84.default.useRef(null);
|
|
9000
|
+
(0, import_react84.useEffect)(() => {
|
|
9001
|
+
var _a;
|
|
9002
|
+
if (filterVisibility) {
|
|
9003
|
+
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
9004
|
+
}
|
|
9005
|
+
}, [filterVisibility]);
|
|
9006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_design_system47.VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
9007
|
+
SearchAndFilterOptionsContainer2,
|
|
9008
|
+
{
|
|
9009
|
+
buttonRow: menuControls,
|
|
9010
|
+
additionalFiltersContainer,
|
|
9011
|
+
children: [
|
|
9012
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_design_system47.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
9013
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
|
|
9014
|
+
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
9015
|
+
"button",
|
|
9016
|
+
{
|
|
9017
|
+
type: "button",
|
|
9018
|
+
css: ResetConditionsBtn,
|
|
9019
|
+
onClick: () => {
|
|
9020
|
+
handleResetFilters();
|
|
9021
|
+
setFilterVisibility(false);
|
|
9022
|
+
},
|
|
9023
|
+
"data-testid": "reset-filters",
|
|
9024
|
+
children: resetButtonText
|
|
9025
|
+
}
|
|
9026
|
+
) : null
|
|
9027
|
+
] }),
|
|
9028
|
+
children
|
|
9029
|
+
]
|
|
9030
|
+
}
|
|
9031
|
+
) : null });
|
|
9032
|
+
};
|
|
9033
|
+
|
|
9034
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
9035
|
+
var import_jsx_runtime76 = require("@emotion/react/jsx-runtime");
|
|
9036
|
+
var FilterItem = ({
|
|
9037
|
+
index,
|
|
9038
|
+
paramOptions,
|
|
9039
|
+
operatorOptions,
|
|
9040
|
+
valueOptions,
|
|
9041
|
+
onParamChange,
|
|
9042
|
+
onOperatorChange,
|
|
9043
|
+
onValueChange
|
|
9044
|
+
}) => {
|
|
9045
|
+
var _a, _b;
|
|
9046
|
+
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
9047
|
+
const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
|
|
9048
|
+
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
9049
|
+
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
9050
|
+
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
9051
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react85.useMemo)(() => {
|
|
9052
|
+
var _a2;
|
|
9053
|
+
const currentSelectedFilter = filterOptions.find((item) => {
|
|
9054
|
+
var _a3;
|
|
9055
|
+
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
9056
|
+
});
|
|
9057
|
+
const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
|
|
9058
|
+
return filters[index].field === item.value;
|
|
9059
|
+
});
|
|
9060
|
+
const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
|
|
9061
|
+
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
9062
|
+
return filters[index].operator === item.value;
|
|
9063
|
+
});
|
|
9064
|
+
return {
|
|
9065
|
+
selectedFieldValue: selectedFieldValue2,
|
|
9066
|
+
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
9067
|
+
selectedMetaValue: filters[index].value,
|
|
9068
|
+
readOnly: isCurrentFieldReadOnly,
|
|
9069
|
+
bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
|
|
9070
|
+
};
|
|
9071
|
+
}, [filters, filterOptions, index, operatorOptions]);
|
|
9072
|
+
const readOnlyProps = readOnly ? {
|
|
9073
|
+
"aria-readonly": true,
|
|
9074
|
+
isSearchable: false,
|
|
9075
|
+
menuIsOpen: false,
|
|
9076
|
+
isClearable: false
|
|
9077
|
+
} : {};
|
|
9078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
9079
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: index === 0 ? "Where" : "and" }),
|
|
9080
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { css: ConditionalInputRow, children: [
|
|
9081
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
9082
|
+
import_design_system48.InputComboBox,
|
|
9083
|
+
{
|
|
9084
|
+
"aria-label": label,
|
|
9085
|
+
options: paramOptions,
|
|
9086
|
+
onChange: (e) => {
|
|
9087
|
+
var _a2;
|
|
9088
|
+
onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
9089
|
+
},
|
|
9090
|
+
isOptionDisabled: (option) => {
|
|
9091
|
+
var _a2;
|
|
9092
|
+
return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
|
|
9093
|
+
},
|
|
9094
|
+
styles: {
|
|
9095
|
+
menu(base) {
|
|
9096
|
+
return {
|
|
9097
|
+
...base,
|
|
9098
|
+
minWidth: "max-content"
|
|
9099
|
+
};
|
|
9100
|
+
}
|
|
9101
|
+
},
|
|
9102
|
+
value: selectedFieldValue,
|
|
9103
|
+
...readOnlyProps,
|
|
9104
|
+
id: "filter-field",
|
|
9105
|
+
name: `filter-field-${index}`
|
|
9106
|
+
}
|
|
9107
|
+
),
|
|
9108
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
9109
|
+
import_design_system48.InputComboBox,
|
|
9110
|
+
{
|
|
9111
|
+
"aria-label": operatorLabel,
|
|
9112
|
+
options: operatorOptions,
|
|
9113
|
+
onChange: (e) => {
|
|
9114
|
+
var _a2;
|
|
9115
|
+
return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
9116
|
+
},
|
|
9117
|
+
isDisabled: !filters[index].field,
|
|
9118
|
+
value: selectedOperatorValue,
|
|
9119
|
+
styles: {
|
|
9120
|
+
menu(base) {
|
|
9121
|
+
return {
|
|
9122
|
+
...base,
|
|
9123
|
+
minWidth: "max-content"
|
|
9124
|
+
};
|
|
9125
|
+
}
|
|
9126
|
+
},
|
|
9127
|
+
...readOnlyProps,
|
|
9128
|
+
id: "filter-operator",
|
|
9129
|
+
name: `filter-operator-${index}`
|
|
9130
|
+
}
|
|
9131
|
+
),
|
|
9132
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
9133
|
+
FilterEditorRenderer,
|
|
9134
|
+
{
|
|
9135
|
+
"aria-label": metaDataLabel,
|
|
9136
|
+
editorType: metaDataPossibleOptions,
|
|
9137
|
+
options: valueOptions,
|
|
9138
|
+
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
9139
|
+
readOnly,
|
|
9140
|
+
bindable,
|
|
9141
|
+
disabled: !filters[index].operator,
|
|
9142
|
+
value: selectedMetaValue,
|
|
9143
|
+
valueTestId: "filter-value"
|
|
9144
|
+
}
|
|
9145
|
+
),
|
|
9146
|
+
readOnly || index === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
9147
|
+
"button",
|
|
9148
|
+
{
|
|
9149
|
+
type: "button",
|
|
9150
|
+
onClick: () => handleDeleteFilter(index),
|
|
9151
|
+
"aria-label": "delete filter",
|
|
9152
|
+
css: IconBtn,
|
|
9153
|
+
"data-testid": "delete-filter",
|
|
9154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_design_system48.Icon, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
9155
|
+
}
|
|
9156
|
+
)
|
|
9157
|
+
] })
|
|
9158
|
+
] });
|
|
9159
|
+
};
|
|
9160
|
+
var FilterItems = ({
|
|
9161
|
+
addButtonText = "add condition",
|
|
9162
|
+
additionalFiltersContainer
|
|
9163
|
+
}) => {
|
|
9164
|
+
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
9165
|
+
const handleUpdateFilter = (index, prop, value) => {
|
|
9166
|
+
var _a, _b, _c, _d, _e;
|
|
9167
|
+
const next = [...filters];
|
|
9168
|
+
next[index] = { ...next[index], [prop]: value };
|
|
9169
|
+
if (prop === "operator") {
|
|
9170
|
+
if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
|
|
9171
|
+
next[index].value = next[index].value[0];
|
|
9172
|
+
}
|
|
9173
|
+
if (filters[index].operator === "ndef" || filters[index].operator === "def") {
|
|
9174
|
+
next[index].value = "";
|
|
9175
|
+
}
|
|
9176
|
+
if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
|
|
9177
|
+
next[index].value = [next[index].value, ""];
|
|
9178
|
+
}
|
|
9179
|
+
if (value === "def" || value === "true") {
|
|
9180
|
+
next[index].value = "true";
|
|
9181
|
+
}
|
|
9182
|
+
if (value === "ndef" || value === "false") {
|
|
9183
|
+
next[index].value = "false";
|
|
9184
|
+
}
|
|
9185
|
+
}
|
|
9186
|
+
if (prop === "field") {
|
|
9187
|
+
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
9188
|
+
var _a2;
|
|
9189
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
|
|
9190
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((op) => op.value === next[index].field)) == null ? void 0 : _c.operatorOptions) == null ? void 0 : _d[0].value) != null ? _e : "eq";
|
|
9191
|
+
next[index].operator = firstOperatorInAvailableOperators;
|
|
9192
|
+
next[index].value = "";
|
|
9193
|
+
}
|
|
9194
|
+
setFilters(next);
|
|
9195
|
+
};
|
|
9196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
9197
|
+
FilterMenu,
|
|
9198
|
+
{
|
|
9199
|
+
id: "search-and-filter-options",
|
|
9200
|
+
dataTestId: "search-and-filter-options",
|
|
9201
|
+
menuControls: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
9202
|
+
"button",
|
|
9203
|
+
{
|
|
9204
|
+
type: "button",
|
|
9205
|
+
css: AddConditionalBtn,
|
|
9206
|
+
onClick: handleAddFilter,
|
|
9207
|
+
"data-testid": "add-filter",
|
|
9208
|
+
children: [
|
|
9209
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_design_system48.Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
9210
|
+
addButtonText
|
|
9211
|
+
]
|
|
9212
|
+
}
|
|
9213
|
+
),
|
|
9214
|
+
additionalFiltersContainer,
|
|
9215
|
+
children: filters.map((item, i) => {
|
|
9216
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9217
|
+
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
9218
|
+
var _a2;
|
|
9219
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
|
|
9220
|
+
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
9221
|
+
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
9222
|
+
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
9223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
9224
|
+
FilterItem,
|
|
9225
|
+
{
|
|
9226
|
+
index: i,
|
|
9227
|
+
paramOptions: filterOptions,
|
|
9228
|
+
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
9229
|
+
operatorOptions: possibleOperators,
|
|
9230
|
+
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
9231
|
+
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
9232
|
+
valueOptions: possibleValueOptions
|
|
9233
|
+
},
|
|
9234
|
+
i
|
|
9235
|
+
);
|
|
9236
|
+
})
|
|
9237
|
+
}
|
|
9238
|
+
);
|
|
9239
|
+
};
|
|
9240
|
+
|
|
9241
|
+
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9242
|
+
var import_design_system50 = require("@uniformdev/design-system");
|
|
9243
|
+
|
|
9244
|
+
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
9245
|
+
var import_design_system49 = require("@uniformdev/design-system");
|
|
9246
|
+
var import_jsx_runtime77 = require("@emotion/react/jsx-runtime");
|
|
9247
|
+
var SearchAndFilterResultContainer = ({
|
|
9248
|
+
buttonText,
|
|
9249
|
+
clearButtonLabel = "clear",
|
|
9250
|
+
calloutTitle,
|
|
9251
|
+
calloutText,
|
|
9252
|
+
onHandleClear,
|
|
9253
|
+
hideClearButton
|
|
9254
|
+
}) => {
|
|
9255
|
+
const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
|
|
9256
|
+
const automateCalloutTitle = () => {
|
|
9257
|
+
if (searchTerm && !filters.length) {
|
|
9258
|
+
return "No search results found";
|
|
9259
|
+
}
|
|
9260
|
+
if (filters.length && !searchTerm) {
|
|
9261
|
+
return "No results match the selected filters";
|
|
9262
|
+
}
|
|
9263
|
+
return "No matching results found";
|
|
9264
|
+
};
|
|
9265
|
+
if (totalResults && totalResults > 0) {
|
|
9266
|
+
return null;
|
|
9267
|
+
}
|
|
9268
|
+
const handleClearSearch = () => {
|
|
9269
|
+
setSearchTerm("");
|
|
9270
|
+
if (onHandleClear) {
|
|
9271
|
+
onHandleClear();
|
|
9272
|
+
} else {
|
|
9273
|
+
handleResetFilters();
|
|
9274
|
+
}
|
|
9275
|
+
};
|
|
9276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
9277
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system49.HorizontalRhythm, { children: [
|
|
9278
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("span", { children: [
|
|
9279
|
+
totalResults,
|
|
9280
|
+
" results ",
|
|
9281
|
+
searchTerm ? `for "${searchTerm}"` : null
|
|
9282
|
+
] }),
|
|
9283
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
9284
|
+
] }),
|
|
9285
|
+
totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system49.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
9286
|
+
calloutText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Paragraph, { children: calloutText }) : null,
|
|
9287
|
+
hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Button, { buttonType: "tertiaryOutline", size: "xs", onClick: handleClearSearch, children: buttonText != null ? buttonText : "Clear search" })
|
|
9288
|
+
] }) : null
|
|
9289
|
+
] });
|
|
9290
|
+
};
|
|
9291
|
+
|
|
9292
|
+
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9293
|
+
var import_jsx_runtime78 = require("@emotion/react/jsx-runtime");
|
|
9294
|
+
var SearchAndFilter = ({
|
|
9295
|
+
filters,
|
|
9296
|
+
filterOptions,
|
|
9297
|
+
filterVisible,
|
|
9298
|
+
filterControls,
|
|
9299
|
+
viewSwitchControls,
|
|
9300
|
+
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(SearchAndFilterResultContainer, {}),
|
|
9301
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
9302
|
+
additionalFiltersContainer,
|
|
9303
|
+
onChange,
|
|
9304
|
+
defaultSearchTerm,
|
|
9305
|
+
onSearchChange,
|
|
9306
|
+
totalResults,
|
|
9307
|
+
allowBindingSearchTerm = false,
|
|
9308
|
+
resetFilterValues = []
|
|
9309
|
+
}) => {
|
|
9310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9311
|
+
SearchAndFilterProvider,
|
|
9312
|
+
{
|
|
9313
|
+
filters,
|
|
9314
|
+
filterOptions,
|
|
9315
|
+
filterVisible,
|
|
9316
|
+
onChange,
|
|
9317
|
+
defaultSearchTerm,
|
|
9318
|
+
onSearchChange,
|
|
9319
|
+
totalResults,
|
|
9320
|
+
resetFilterValues,
|
|
9321
|
+
filterMapper: filterMapper2,
|
|
9322
|
+
allowBindingSearchTerm,
|
|
9323
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_design_system50.VerticalRhythm, { "data-testid": "search-and-filter", children: [
|
|
9324
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
9325
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9326
|
+
"div",
|
|
9327
|
+
{
|
|
9328
|
+
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
9329
|
+
children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
9330
|
+
}
|
|
9331
|
+
),
|
|
9332
|
+
viewSwitchControls
|
|
9333
|
+
] }),
|
|
9334
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FilterItems, { additionalFiltersContainer }),
|
|
9335
|
+
resultsContainerView
|
|
9336
|
+
] })
|
|
9337
|
+
}
|
|
9338
|
+
);
|
|
9339
|
+
};
|
|
9340
|
+
|
|
9341
|
+
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
9342
|
+
var import_design_system51 = require("@uniformdev/design-system");
|
|
9343
|
+
var import_react86 = require("react");
|
|
9344
|
+
var import_react_use8 = require("react-use");
|
|
9345
|
+
var import_jsx_runtime79 = require("@emotion/react/jsx-runtime");
|
|
9346
|
+
var SearchOnlyContext = (0, import_react86.createContext)({
|
|
9347
|
+
searchTerm: "",
|
|
9348
|
+
setSearchTerm: () => {
|
|
9349
|
+
}
|
|
9350
|
+
});
|
|
9351
|
+
var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
9352
|
+
const { searchTerm, setSearchTerm } = useSearchAndFilter();
|
|
9353
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react86.useState)("");
|
|
9354
|
+
(0, import_react_use8.useDebounce)(
|
|
9355
|
+
() => {
|
|
9356
|
+
setSearchTerm(localeSearchTerm);
|
|
9357
|
+
onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
|
|
9358
|
+
},
|
|
9359
|
+
300,
|
|
9360
|
+
[localeSearchTerm]
|
|
9361
|
+
);
|
|
9362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9363
|
+
SearchOnlyContext.Provider,
|
|
9364
|
+
{
|
|
9365
|
+
value: {
|
|
9366
|
+
searchTerm,
|
|
9367
|
+
setSearchTerm: setLocaleSearchTerm
|
|
9368
|
+
},
|
|
9369
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9370
|
+
import_design_system51.InputKeywordSearch,
|
|
9371
|
+
{
|
|
9372
|
+
placeholder: "Search...",
|
|
9373
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
9374
|
+
value: localeSearchTerm,
|
|
9375
|
+
compact: true,
|
|
9376
|
+
rounded: true
|
|
9377
|
+
}
|
|
9378
|
+
) })
|
|
9379
|
+
}
|
|
9380
|
+
);
|
|
9381
|
+
};
|
|
9382
|
+
|
|
9383
|
+
// src/components/SearchAndFilter/SortItems.tsx
|
|
9384
|
+
var import_design_system53 = require("@uniformdev/design-system");
|
|
9385
|
+
|
|
9386
|
+
// src/components/SearchAndFilter/styles/SortItems.styles.ts
|
|
9387
|
+
var import_react87 = require("@emotion/react");
|
|
9388
|
+
var import_design_system52 = require("@uniformdev/design-system");
|
|
9389
|
+
var ConditionalFilterRow2 = import_react87.css`
|
|
9390
|
+
display: grid;
|
|
9391
|
+
grid-template-columns: 35px 1fr;
|
|
9392
|
+
gap: var(--spacing-sm);
|
|
9393
|
+
margin-left: var(--spacing-base);
|
|
9394
|
+
|
|
9395
|
+
${(0, import_design_system52.cq)("380px")} {
|
|
9396
|
+
align-items: center;
|
|
9397
|
+
|
|
9398
|
+
&:after {
|
|
9399
|
+
content: '';
|
|
9400
|
+
display: block;
|
|
9401
|
+
height: 1px;
|
|
9402
|
+
background: var(--gray-300);
|
|
9403
|
+
width: calc(100% - var(--spacing-base));
|
|
9404
|
+
margin-left: var(--spacing-base);
|
|
9405
|
+
}
|
|
9406
|
+
&:last-of-type:after {
|
|
9407
|
+
display: none;
|
|
9408
|
+
}
|
|
9409
|
+
}
|
|
9410
|
+
|
|
9411
|
+
&:nth-of-type(2) {
|
|
9412
|
+
margin-left: 0;
|
|
9413
|
+
grid-template-columns: 50px 1fr;
|
|
9414
|
+
}
|
|
9415
|
+
|
|
9416
|
+
${(0, import_design_system52.cq)("580px")} {
|
|
9417
|
+
&:after {
|
|
9418
|
+
display: none;
|
|
9419
|
+
}
|
|
9420
|
+
}
|
|
9421
|
+
|
|
9422
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
9423
|
+
animation: ${import_design_system52.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
9424
|
+
}
|
|
9425
|
+
`;
|
|
9426
|
+
var ConditionalInputRow2 = import_react87.css`
|
|
9427
|
+
display: flex;
|
|
9428
|
+
gap: var(--spacing-sm);
|
|
9429
|
+
flex-wrap: wrap;
|
|
9430
|
+
|
|
9431
|
+
${(0, import_design_system52.cq)("380px")} {
|
|
9432
|
+
& > div:nth-child(-n + 2) {
|
|
9433
|
+
width: calc(50% - var(--spacing-sm));
|
|
9434
|
+
}
|
|
9435
|
+
|
|
9436
|
+
& > div:nth-child(n + 3) {
|
|
9437
|
+
width: calc(100% - 48px);
|
|
9438
|
+
}
|
|
9439
|
+
}
|
|
9440
|
+
${(0, import_design_system52.cq)("580px")} {
|
|
9441
|
+
display: grid;
|
|
9442
|
+
grid-template-columns: 200px 160px 1fr 32px;
|
|
9443
|
+
|
|
9444
|
+
& > div:nth-child(n) {
|
|
9445
|
+
width: auto;
|
|
9446
|
+
}
|
|
9447
|
+
}
|
|
9448
|
+
`;
|
|
9449
|
+
var SearchInput2 = import_react87.css`
|
|
9450
|
+
max-height: 40px;
|
|
9451
|
+
min-height: unset;
|
|
9452
|
+
`;
|
|
9453
|
+
var FilterButton3 = import_react87.css`
|
|
9454
|
+
align-items: center;
|
|
9455
|
+
background: var(--white);
|
|
9456
|
+
border: 1px solid var(--gray-300);
|
|
9457
|
+
border-radius: var(--rounded-full);
|
|
9458
|
+
color: var(--typography-base);
|
|
9459
|
+
display: flex;
|
|
9460
|
+
font-size: var(--fs-sm);
|
|
9461
|
+
gap: var(--spacing-sm);
|
|
9462
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
9463
|
+
max-height: 40px;
|
|
9464
|
+
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
9465
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
9466
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
9467
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
9468
|
+
|
|
9469
|
+
svg {
|
|
9470
|
+
color: var(--gray-300);
|
|
9471
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9472
|
+
}
|
|
9473
|
+
|
|
9474
|
+
&:hover,
|
|
9475
|
+
:where([aria-expanded='true']) {
|
|
9476
|
+
outline: none;
|
|
9477
|
+
background: var(--gray-200);
|
|
9478
|
+
border-color: var(--gray-300);
|
|
9479
|
+
|
|
9480
|
+
svg {
|
|
9481
|
+
color: var(--typography-base);
|
|
9482
|
+
}
|
|
9483
|
+
}
|
|
9484
|
+
|
|
9485
|
+
&:disabled {
|
|
9486
|
+
opacity: var(--opacity-50);
|
|
9487
|
+
}
|
|
9488
|
+
`;
|
|
9489
|
+
var FilterButtonText2 = import_react87.css`
|
|
9490
|
+
overflow: hidden;
|
|
9491
|
+
text-overflow: ellipsis;
|
|
9492
|
+
white-space: nowrap;
|
|
9493
|
+
max-width: 14ch;
|
|
9494
|
+
`;
|
|
9495
|
+
var FilterButtonSelected2 = import_react87.css`
|
|
9496
|
+
background: var(--gray-100);
|
|
9497
|
+
border-color: var(--gray-300);
|
|
9498
|
+
|
|
9499
|
+
svg {
|
|
9500
|
+
color: var(--accent-dark);
|
|
9501
|
+
}
|
|
9502
|
+
`;
|
|
9503
|
+
var FilterButtonWithOptions2 = import_react87.css`
|
|
9504
|
+
:where([aria-expanded='true']) {
|
|
9505
|
+
background: var(--purple-rain-100);
|
|
9506
|
+
border-color: var(--accent-light);
|
|
9507
|
+
color: var(--typography-base);
|
|
9508
|
+
box-shadow: var(--elevation-100);
|
|
9509
|
+
|
|
9510
|
+
svg {
|
|
9511
|
+
color: var(--accent-dark);
|
|
9512
|
+
}
|
|
9513
|
+
}
|
|
9514
|
+
`;
|
|
9515
|
+
var SearchIcon2 = import_react87.css`
|
|
9516
|
+
color: var(--icon-color);
|
|
9517
|
+
position: absolute;
|
|
9518
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
9519
|
+
margin: auto;
|
|
9520
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9521
|
+
`;
|
|
9522
|
+
var AddConditionalBtn2 = import_react87.css`
|
|
9523
|
+
align-items: center;
|
|
9524
|
+
background: transparent;
|
|
9525
|
+
border: none;
|
|
9526
|
+
color: var(--primary-action-default);
|
|
9527
|
+
display: flex;
|
|
9528
|
+
gap: var(--spacing-sm);
|
|
9529
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9530
|
+
padding: 0;
|
|
9531
|
+
|
|
9532
|
+
&:hover,
|
|
9533
|
+
&:focus {
|
|
9534
|
+
color: var(--primary-action-hover);
|
|
9535
|
+
}
|
|
9536
|
+
|
|
9537
|
+
&:disabled {
|
|
9538
|
+
color: var(--gray-400);
|
|
9539
|
+
}
|
|
9540
|
+
`;
|
|
9541
|
+
var Title2 = import_react87.css`
|
|
9542
|
+
color: var(--typography-light);
|
|
9543
|
+
|
|
9544
|
+
&:focus {
|
|
9545
|
+
outline: none;
|
|
9546
|
+
}
|
|
9547
|
+
`;
|
|
9548
|
+
var ResetConditionsBtn2 = import_react87.css`
|
|
9549
|
+
background: transparent;
|
|
9550
|
+
border: none;
|
|
9551
|
+
color: var(--action-destructive-default);
|
|
9552
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9553
|
+
padding: 0;
|
|
9554
|
+
|
|
9555
|
+
&:hover,
|
|
9556
|
+
&:focus {
|
|
9557
|
+
color: var(--action-destructive-hover);
|
|
9558
|
+
}
|
|
9559
|
+
`;
|
|
9560
|
+
var IconBtn2 = import_react87.css`
|
|
9561
|
+
background: transparent;
|
|
9562
|
+
border: none;
|
|
9563
|
+
padding: var(--spacing-sm);
|
|
9564
|
+
`;
|
|
9565
|
+
var SearchAndFilterOptionsContainer3 = import_react87.css`
|
|
9566
|
+
background: var(--gray-50);
|
|
9567
|
+
border: 1px solid var(--gray-300);
|
|
9568
|
+
border-radius: var(--rounded-base);
|
|
9569
|
+
container-type: inline-size;
|
|
9570
|
+
display: flex;
|
|
9571
|
+
flex-direction: column;
|
|
9572
|
+
gap: var(--spacing-sm);
|
|
9573
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
9574
|
+
will-change: height;
|
|
9575
|
+
position: relative;
|
|
9576
|
+
z-index: 1;
|
|
9577
|
+
`;
|
|
9578
|
+
var SearchAndFilterOptionsInnerContainer2 = import_react87.css`
|
|
9579
|
+
display: flex;
|
|
9580
|
+
flex-direction: column;
|
|
9581
|
+
gap: var(--spacing-sm);
|
|
9582
|
+
padding-inline: var(--spacing-md);
|
|
9583
|
+
`;
|
|
9584
|
+
var SearchAndFilterButtonGroup2 = import_react87.css`
|
|
9585
|
+
margin-top: var(--spacing-xs);
|
|
9586
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
9587
|
+
`;
|
|
9588
|
+
var SortFilterWrapper = (hiddenLocaleInput) => import_react87.css`
|
|
9589
|
+
align-items: center;
|
|
9590
|
+
border-top: 1px solid var(--gray-300);
|
|
9591
|
+
display: flex;
|
|
9592
|
+
flex-wrap: wrap;
|
|
9593
|
+
gap: var(--spacing-base);
|
|
9594
|
+
padding: var(--spacing-base) var(--spacing-md) 0;
|
|
9595
|
+
position: relative;
|
|
9596
|
+
z-index: 0;
|
|
9597
|
+
|
|
9598
|
+
${(0, import_design_system52.cq)("420px")} {
|
|
9599
|
+
display: grid;
|
|
9600
|
+
grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
|
|
9601
|
+
}
|
|
9602
|
+
`;
|
|
9603
|
+
var SortFilterInputRow = import_react87.css`
|
|
9604
|
+
align-items: center;
|
|
9605
|
+
display: grid;
|
|
9606
|
+
grid-template-columns: 1fr auto;
|
|
9607
|
+
gap: var(--spacing-base);
|
|
9608
|
+
`;
|
|
9609
|
+
var InputVariableWrapper = import_react87.css`
|
|
9610
|
+
flex-grow: 1;
|
|
9611
|
+
|
|
9612
|
+
// we need to override label styles nested within the input variable
|
|
9613
|
+
// as these are slightly different from the default label styles
|
|
9614
|
+
label > span {
|
|
9615
|
+
color: var(--typography-light);
|
|
9616
|
+
}
|
|
9617
|
+
`;
|
|
9618
|
+
|
|
9619
|
+
// src/components/SearchAndFilter/SortItems.tsx
|
|
9620
|
+
var import_jsx_runtime80 = require("@emotion/react/jsx-runtime");
|
|
9621
|
+
var SortItems = ({
|
|
9622
|
+
sortByLabel = "Sort by",
|
|
9623
|
+
localeLabel = "Show locale",
|
|
9624
|
+
sortOptions,
|
|
9625
|
+
sortByValue,
|
|
9626
|
+
onSortChange,
|
|
9627
|
+
localeValue,
|
|
9628
|
+
localeOptions,
|
|
9629
|
+
onLocaleChange,
|
|
9630
|
+
disableSortBinding
|
|
9631
|
+
}) => {
|
|
9632
|
+
var _a, _b;
|
|
9633
|
+
const hideLocaleOptions = !localeOptions || !onLocaleChange;
|
|
9634
|
+
const values = sortByValue == null ? void 0 : sortByValue.split("_");
|
|
9635
|
+
const sortDirection = values == null ? void 0 : values.pop();
|
|
9636
|
+
const sortField = values == null ? void 0 : values.join("_");
|
|
9637
|
+
const currentSelectedOption = (_b = (_a = sortOptions.find((item) => {
|
|
9638
|
+
var _a2;
|
|
9639
|
+
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
9640
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
9641
|
+
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
9642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
9643
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_design_system53.VerticalRhythm, { gap: "xs", children: [
|
|
9644
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { css: Title2, children: sortByLabel }),
|
|
9645
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { css: SortFilterInputRow, children: [
|
|
9646
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
9647
|
+
InputVariables,
|
|
9648
|
+
{
|
|
9649
|
+
disableInlineMenu: disableSortBinding,
|
|
9650
|
+
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9651
|
+
value: sortField,
|
|
9652
|
+
valueToResetTo: "created_at",
|
|
9653
|
+
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
9654
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
9655
|
+
import_design_system53.InputComboBox,
|
|
9656
|
+
{
|
|
9657
|
+
id: "sort-by-field",
|
|
9658
|
+
"aria-label": "Sort by",
|
|
9659
|
+
options: sortOptions,
|
|
9660
|
+
onChange: (e) => {
|
|
9661
|
+
const fieldName = e == null ? void 0 : e.value;
|
|
9662
|
+
onSortChange(`${fieldName}_${sortDirection}`);
|
|
9663
|
+
},
|
|
9664
|
+
styles: {
|
|
9665
|
+
menu(base) {
|
|
9666
|
+
return {
|
|
9667
|
+
...base,
|
|
9668
|
+
minWidth: "max-content"
|
|
9669
|
+
};
|
|
9670
|
+
}
|
|
9671
|
+
},
|
|
9672
|
+
value: currentSelectedOption
|
|
9673
|
+
}
|
|
9674
|
+
)
|
|
9675
|
+
}
|
|
9676
|
+
),
|
|
9677
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
9678
|
+
InputVariables,
|
|
9679
|
+
{
|
|
9680
|
+
disableInlineMenu: disableSortBinding,
|
|
9681
|
+
value: sortDirection,
|
|
9682
|
+
valueToResetTo: "DESC",
|
|
9683
|
+
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9684
|
+
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9685
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
9686
|
+
import_design_system53.SegmentedControl,
|
|
9687
|
+
{
|
|
9688
|
+
noCheckmark: true,
|
|
9689
|
+
name: "sortBy",
|
|
9690
|
+
hideOptionText: true,
|
|
9691
|
+
iconSize: "1rem",
|
|
9692
|
+
size: "xl",
|
|
9693
|
+
options: [
|
|
9694
|
+
{
|
|
9695
|
+
label: "Ascending",
|
|
9696
|
+
icon: "arrow-up",
|
|
9697
|
+
value: `ASC`,
|
|
9698
|
+
tooltip: "Ascending (e.g. A-Z, oldest to newest)",
|
|
9699
|
+
"data-testid": "sort-ascending"
|
|
9700
|
+
},
|
|
9701
|
+
{
|
|
9702
|
+
label: "Descending",
|
|
9703
|
+
icon: "arrow-down",
|
|
9704
|
+
value: `DESC`,
|
|
9705
|
+
tooltip: "Descending (e.g. Z-A, newest to oldest)",
|
|
9706
|
+
"data-testid": "sort-descending"
|
|
9707
|
+
}
|
|
9708
|
+
],
|
|
9709
|
+
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9710
|
+
value: sortDirection
|
|
9711
|
+
}
|
|
9712
|
+
)
|
|
9713
|
+
}
|
|
9714
|
+
)
|
|
9715
|
+
] })
|
|
9716
|
+
] }),
|
|
9717
|
+
hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_design_system53.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
9718
|
+
InputVariables,
|
|
9719
|
+
{
|
|
9720
|
+
label: localeLabelValue,
|
|
9721
|
+
value: localeValue,
|
|
9722
|
+
showMenuPosition: "inline-right",
|
|
9723
|
+
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
9724
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
9725
|
+
import_design_system53.InputSelect,
|
|
9726
|
+
{
|
|
9727
|
+
name: "localeReturned",
|
|
9728
|
+
"aria-label": localeLabelValue,
|
|
9729
|
+
label: localeLabelValue,
|
|
9730
|
+
showLabel: false,
|
|
9731
|
+
"data-testid": "context-locale",
|
|
9732
|
+
onChange: (e) => {
|
|
9733
|
+
var _a2;
|
|
9734
|
+
return onLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
|
|
9735
|
+
},
|
|
9736
|
+
options: localeOptions,
|
|
9737
|
+
value: localeValue
|
|
9738
|
+
}
|
|
9739
|
+
)
|
|
9740
|
+
}
|
|
9741
|
+
) })
|
|
9742
|
+
] });
|
|
9743
|
+
};
|
|
9744
|
+
|
|
9745
|
+
// src/index.ts
|
|
9746
|
+
var import_design_system54 = require("@uniformdev/design-system");
|
|
7372
9747
|
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
7373
9748
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7374
9749
|
0 && (module.exports = {
|
|
@@ -7376,21 +9751,35 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7376
9751
|
$isVariableNode,
|
|
7377
9752
|
AddListButton,
|
|
7378
9753
|
Button,
|
|
9754
|
+
CHECKBOX_OPERATORS,
|
|
7379
9755
|
Callout,
|
|
9756
|
+
ControlledObjectSearchProvider,
|
|
7380
9757
|
ControlledValuePlugin,
|
|
9758
|
+
DATE_OPERATORS,
|
|
7381
9759
|
DISCONNECT_VARIABLE_COMMAND,
|
|
7382
9760
|
DamSelectedItem,
|
|
7383
9761
|
DataRefreshButton,
|
|
7384
9762
|
DataResourceDynamicInputProvider,
|
|
9763
|
+
DataResourceInputContext,
|
|
7385
9764
|
DataResourceVariablesList,
|
|
7386
9765
|
DataResourceVariablesListExplicit,
|
|
7387
9766
|
DataSourceEditor,
|
|
7388
9767
|
DataTypeEditor,
|
|
9768
|
+
DateEditor,
|
|
9769
|
+
DateRangeEditor,
|
|
7389
9770
|
DefaultSearchRow,
|
|
7390
9771
|
DefaultSelectedItem,
|
|
7391
9772
|
DrawerContent,
|
|
7392
9773
|
EDIT_VARIABLE_COMMAND,
|
|
7393
9774
|
EntrySearch,
|
|
9775
|
+
FilterButton,
|
|
9776
|
+
FilterControls,
|
|
9777
|
+
FilterEditorRenderer,
|
|
9778
|
+
FilterItem,
|
|
9779
|
+
FilterItems,
|
|
9780
|
+
FilterMenu,
|
|
9781
|
+
FilterMultiChoiceEditor,
|
|
9782
|
+
FilterSingleChoiceEditor,
|
|
7394
9783
|
Heading,
|
|
7395
9784
|
INSERT_VARIABLE_COMMAND,
|
|
7396
9785
|
Icons,
|
|
@@ -7404,19 +9793,26 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7404
9793
|
LinkButton,
|
|
7405
9794
|
LoadingIndicator,
|
|
7406
9795
|
LoadingOverlay,
|
|
9796
|
+
MULTI_SELECT_OPERATORS,
|
|
7407
9797
|
Menu,
|
|
7408
9798
|
MenuItem,
|
|
7409
9799
|
MeshApp,
|
|
9800
|
+
NUMBER_OPERATORS,
|
|
9801
|
+
NumberEditor,
|
|
9802
|
+
NumberRangeEditor,
|
|
7410
9803
|
OPEN_INSERT_VARIABLE_COMMAND,
|
|
7411
9804
|
ObjectSearchContainer,
|
|
9805
|
+
ObjectSearchContext,
|
|
7412
9806
|
ObjectSearchFilter,
|
|
7413
9807
|
ObjectSearchFilterContainer,
|
|
7414
9808
|
ObjectSearchListItem,
|
|
7415
9809
|
ObjectSearchListItemLoadingSkeleton,
|
|
9810
|
+
ObjectSearchListOfSearchResults,
|
|
7416
9811
|
ObjectSearchProvider,
|
|
7417
9812
|
ObjectSearchResultItem,
|
|
7418
9813
|
ObjectSearchResultItemButton,
|
|
7419
9814
|
ObjectSearchResultList,
|
|
9815
|
+
PUBLISH_STATUS_FIELD_OPERATORS,
|
|
7420
9816
|
ParamTypeDynamicDataProvider,
|
|
7421
9817
|
ParameterConnectionIndicator,
|
|
7422
9818
|
ParameterGroup,
|
|
@@ -7444,6 +9840,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7444
9840
|
ProductSearchRow,
|
|
7445
9841
|
ProductSelectedItem,
|
|
7446
9842
|
QueryFilter,
|
|
9843
|
+
RICHTEXT_OPERATORS,
|
|
7447
9844
|
RequestBody,
|
|
7448
9845
|
RequestHeaders,
|
|
7449
9846
|
RequestMethodSelect,
|
|
@@ -7453,19 +9850,37 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7453
9850
|
RequestUrl,
|
|
7454
9851
|
RequestUrlInput,
|
|
7455
9852
|
ResolvableLoadingValue,
|
|
9853
|
+
SELECT_OPERATORS,
|
|
9854
|
+
SYSTEM_DATE_OPERATORS,
|
|
9855
|
+
SYSTEM_FIELD_OPERATORS,
|
|
7456
9856
|
ScrollableList,
|
|
7457
9857
|
ScrollableListItem,
|
|
9858
|
+
SearchAndFilter,
|
|
9859
|
+
SearchAndFilterContext,
|
|
9860
|
+
SearchAndFilterOptionsContainer,
|
|
9861
|
+
SearchAndFilterProvider,
|
|
9862
|
+
SearchAndFilterResultContainer,
|
|
9863
|
+
SearchOnlyContext,
|
|
9864
|
+
SearchOnlyFilter,
|
|
7458
9865
|
SelectionField,
|
|
9866
|
+
SortItems,
|
|
9867
|
+
StatusMultiEditor,
|
|
9868
|
+
StatusSingleEditor,
|
|
7459
9869
|
Switch,
|
|
9870
|
+
TEXTBOX_OPERATORS,
|
|
9871
|
+
TextEditor,
|
|
7460
9872
|
TextVariableRenderer,
|
|
7461
9873
|
Textarea,
|
|
7462
9874
|
Theme,
|
|
9875
|
+
USER_OPERATORS,
|
|
7463
9876
|
VariableEditor,
|
|
7464
9877
|
VariableNode,
|
|
7465
9878
|
VariablesList,
|
|
7466
9879
|
VariablesPlugin,
|
|
7467
9880
|
VariablesProvider,
|
|
7468
9881
|
badgeIcon,
|
|
9882
|
+
bindQuery,
|
|
9883
|
+
bindableFiltersMapper,
|
|
7469
9884
|
convertConnectedDataToVariable,
|
|
7470
9885
|
createLocationValidator,
|
|
7471
9886
|
damSelectItemImage,
|
|
@@ -7496,6 +9911,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7496
9911
|
entrySearchSelectInput,
|
|
7497
9912
|
entrySearchSelectOption,
|
|
7498
9913
|
entrySearchWrapper,
|
|
9914
|
+
filterMapper,
|
|
7499
9915
|
hasReferencedVariables,
|
|
7500
9916
|
prettifyBindExpression,
|
|
7501
9917
|
productSearchRowActiveIcon,
|
|
@@ -7537,6 +9953,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7537
9953
|
urlEncodeRequestUrl,
|
|
7538
9954
|
useConnectedDataAsVariables,
|
|
7539
9955
|
useContentDataResourceLocaleInfo,
|
|
9956
|
+
useDataResourceDynamicInputs,
|
|
7540
9957
|
useDynamicInputsAsVariables,
|
|
7541
9958
|
useMeshLocation,
|
|
7542
9959
|
useObjectSearchContext,
|
|
@@ -7546,10 +9963,12 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7546
9963
|
useRequest,
|
|
7547
9964
|
useRequestHeader,
|
|
7548
9965
|
useRequestParameter,
|
|
9966
|
+
useSearchAndFilter,
|
|
7549
9967
|
useUniformMeshSdk,
|
|
7550
9968
|
useVariableEditor,
|
|
7551
9969
|
useVariables,
|
|
7552
9970
|
useVariablesMenu,
|
|
9971
|
+
utilityColors,
|
|
7553
9972
|
variableDefaultTextValue,
|
|
7554
9973
|
variablePrefix,
|
|
7555
9974
|
variableSuffix,
|