@uniformdev/mesh-sdk-react 19.79.0 → 19.79.1-alpha.7
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 +21 -19
- package/dist/index.d.ts +21 -19
- package/dist/index.esm.js +230 -200
- package/dist/index.js +251 -221
- package/dist/index.mjs +230 -200
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -2856,13 +2856,14 @@ function useConnectedDataAsVariables(connectedData) {
|
|
|
2856
2856
|
}
|
|
2857
2857
|
|
|
2858
2858
|
// src/hooks/useDynamicInputsAsVariables.tsx
|
|
2859
|
+
var import_canvas = require("@uniformdev/canvas");
|
|
2859
2860
|
var import_react26 = require("react");
|
|
2860
2861
|
var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
|
|
2861
2862
|
function useDynamicInputsAsVariables(dynamicInputs) {
|
|
2862
2863
|
return (0, import_react26.useMemo)(() => {
|
|
2863
2864
|
const result = Object.entries(dynamicInputs).reduce(
|
|
2864
2865
|
(acc, [name, input3]) => {
|
|
2865
|
-
const source = `from ${input3.type === "path" ? "URL path" : "query string"}`;
|
|
2866
|
+
const source = `from ${name === import_canvas.LOCALE_DYNAMIC_INPUT_NAME ? "current locale" : input3.type === "path" ? "URL path" : "query string"}`;
|
|
2866
2867
|
acc[name] = {
|
|
2867
2868
|
readOnly: true,
|
|
2868
2869
|
type: input3.type,
|
|
@@ -2981,11 +2982,11 @@ var import_lite = require("dequal/lite");
|
|
|
2981
2982
|
var import_react30 = require("react");
|
|
2982
2983
|
|
|
2983
2984
|
// src/components/Variables/util/deserializeVariablesEditorState.ts
|
|
2984
|
-
var
|
|
2985
|
+
var import_canvas2 = require("@uniformdev/canvas");
|
|
2985
2986
|
var import_lexical = require("lexical");
|
|
2986
2987
|
function deserializeVariablesEditorState(serialized) {
|
|
2987
2988
|
const result = [];
|
|
2988
|
-
(0,
|
|
2989
|
+
(0, import_canvas2.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
|
|
2989
2990
|
if (type === "text") {
|
|
2990
2991
|
const node = {
|
|
2991
2992
|
type: import_lexical.TextNode.getType(),
|
|
@@ -3112,7 +3113,7 @@ var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerCont
|
|
|
3112
3113
|
var import_useLexicalNodeSelection = require("@lexical/react/useLexicalNodeSelection");
|
|
3113
3114
|
var import_selection = require("@lexical/selection");
|
|
3114
3115
|
var import_utils2 = require("@lexical/utils");
|
|
3115
|
-
var
|
|
3116
|
+
var import_canvas4 = require("@uniformdev/canvas");
|
|
3116
3117
|
var import_design_system18 = require("@uniformdev/design-system");
|
|
3117
3118
|
var import_lexical4 = require("lexical");
|
|
3118
3119
|
var import_react39 = require("react");
|
|
@@ -3132,6 +3133,7 @@ function VariableChip({
|
|
|
3132
3133
|
tooltip,
|
|
3133
3134
|
reference,
|
|
3134
3135
|
onClick,
|
|
3136
|
+
clickToEdit,
|
|
3135
3137
|
isFresh,
|
|
3136
3138
|
selected,
|
|
3137
3139
|
disabled
|
|
@@ -3139,7 +3141,7 @@ function VariableChip({
|
|
|
3139
3141
|
const hasClickEvent = !!onClick;
|
|
3140
3142
|
const referenceIsValidFr = isFresh ? true : referenceIsValid;
|
|
3141
3143
|
const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react31.Fragment : UndefinedVariableReference;
|
|
3142
|
-
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0;
|
|
3144
|
+
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
|
|
3143
3145
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3144
3146
|
import_design_system15.MultilineChip,
|
|
3145
3147
|
{
|
|
@@ -3186,7 +3188,7 @@ var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerCont
|
|
|
3186
3188
|
var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
|
|
3187
3189
|
var import_utils = require("@lexical/utils");
|
|
3188
3190
|
var import_AiFillPlusCircle = require("@react-icons/all-files/ai/AiFillPlusCircle");
|
|
3189
|
-
var
|
|
3191
|
+
var import_canvas3 = require("@uniformdev/canvas");
|
|
3190
3192
|
var import_design_system17 = require("@uniformdev/design-system");
|
|
3191
3193
|
var import_lite2 = require("dequal/lite");
|
|
3192
3194
|
var import_lexical3 = require("lexical");
|
|
@@ -3660,7 +3662,7 @@ function useVariablesMenu({
|
|
|
3660
3662
|
var _a;
|
|
3661
3663
|
const targetVariable = variables[value];
|
|
3662
3664
|
if (overwriteExistingValue) {
|
|
3663
|
-
setVariablesEditorValue(editor, (0,
|
|
3665
|
+
setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(value));
|
|
3664
3666
|
return true;
|
|
3665
3667
|
}
|
|
3666
3668
|
const variableNode = $createVariableNode(value, {
|
|
@@ -3830,7 +3832,7 @@ function VariablesPlugin({
|
|
|
3830
3832
|
if (!disableVariables) {
|
|
3831
3833
|
const targetVariable = variablesRef.current.variables[reference];
|
|
3832
3834
|
if (overwriteExistingValue) {
|
|
3833
|
-
setVariablesEditorValue(editor, (0,
|
|
3835
|
+
setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(reference));
|
|
3834
3836
|
return true;
|
|
3835
3837
|
}
|
|
3836
3838
|
const variableNode = $createVariableNode(reference, {
|
|
@@ -4030,7 +4032,7 @@ var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
|
|
|
4030
4032
|
* (albeit it won't get the fancy chip-node)
|
|
4031
4033
|
*/
|
|
4032
4034
|
getTextContent() {
|
|
4033
|
-
return (0,
|
|
4035
|
+
return (0, import_canvas4.createVariableReference)(this.reference);
|
|
4034
4036
|
}
|
|
4035
4037
|
/** Creates the DOM wrapper that hosts the node */
|
|
4036
4038
|
createDOM() {
|
|
@@ -4146,6 +4148,7 @@ function VariableNodeComponent({
|
|
|
4146
4148
|
displayName: state.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system18.LoadingIndicator, { size: "sm" }) : state.displayName,
|
|
4147
4149
|
selected: isSelected,
|
|
4148
4150
|
disabled: readOnly,
|
|
4151
|
+
clickToEdit: state.hasClickEvent,
|
|
4149
4152
|
onClick: state.hasClickEvent ? () => {
|
|
4150
4153
|
setSelected(!isSelected);
|
|
4151
4154
|
editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
|
|
@@ -4261,6 +4264,10 @@ var inputCompact = import_react41.css`
|
|
|
4261
4264
|
padding-block: var(--spacing-sm);
|
|
4262
4265
|
font-size: var(--fs-sm);
|
|
4263
4266
|
`;
|
|
4267
|
+
var inputDisabled = import_react41.css`
|
|
4268
|
+
cursor: not-allowed;
|
|
4269
|
+
opacity: var(--opacity-50);
|
|
4270
|
+
`;
|
|
4264
4271
|
var placeholderCaption = import_react41.css`
|
|
4265
4272
|
position: absolute;
|
|
4266
4273
|
color: var(--gray-400);
|
|
@@ -4279,10 +4286,10 @@ var React10 = __toESM(require("react"));
|
|
|
4279
4286
|
var import_react42 = require("react");
|
|
4280
4287
|
|
|
4281
4288
|
// src/components/Variables/util/hasReferencedVariables.ts
|
|
4282
|
-
var
|
|
4289
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
4283
4290
|
function hasReferencedVariables(value) {
|
|
4284
4291
|
let result = false;
|
|
4285
|
-
(0,
|
|
4292
|
+
(0, import_canvas5.parseVariableExpression)(value, (token, type) => {
|
|
4286
4293
|
if (type === "variable") {
|
|
4287
4294
|
result = true;
|
|
4288
4295
|
return false;
|
|
@@ -4526,8 +4533,8 @@ function VariableField({
|
|
|
4526
4533
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
4527
4534
|
}
|
|
4528
4535
|
) : null;
|
|
4529
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
4530
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { htmlFor: id, css: labelText, children: [
|
|
4536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { "data-testid": "variable-field", children: [
|
|
4537
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { htmlFor: id, css: labelText, "data-testid": "field-name", children: [
|
|
4531
4538
|
variableSelector,
|
|
4532
4539
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: label })
|
|
4533
4540
|
] }),
|
|
@@ -4568,7 +4575,7 @@ function SingleLineTextPlugin() {
|
|
|
4568
4575
|
}
|
|
4569
4576
|
|
|
4570
4577
|
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
4571
|
-
var
|
|
4578
|
+
var import_canvas6 = require("@uniformdev/canvas");
|
|
4572
4579
|
var import_lexical8 = require("lexical");
|
|
4573
4580
|
|
|
4574
4581
|
// src/components/Variables/util/variableExpression.ts
|
|
@@ -4587,7 +4594,7 @@ function serializeRecursive(node, buffer) {
|
|
|
4587
4594
|
buffer.push(node.text.replace(variablePrefix, "\\${"));
|
|
4588
4595
|
}
|
|
4589
4596
|
if (node.type === VariableNode.getType()) {
|
|
4590
|
-
buffer.push((0,
|
|
4597
|
+
buffer.push((0, import_canvas6.createVariableReference)(node.reference));
|
|
4591
4598
|
}
|
|
4592
4599
|
if (node.type === import_lexical8.LineBreakNode.getType()) {
|
|
4593
4600
|
buffer.push("\n");
|
|
@@ -4633,6 +4640,7 @@ function VariablesComposer(props) {
|
|
|
4633
4640
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4634
4641
|
import_LexicalOnChangePlugin.OnChangePlugin,
|
|
4635
4642
|
{
|
|
4643
|
+
ignoreSelectionChange: true,
|
|
4636
4644
|
onChange: (state) => {
|
|
4637
4645
|
editorState.current = state;
|
|
4638
4646
|
if (updateTimeout.current) {
|
|
@@ -4804,6 +4812,7 @@ function InputVariables(props) {
|
|
|
4804
4812
|
dispatch({ type: "cancelEdit" });
|
|
4805
4813
|
}
|
|
4806
4814
|
},
|
|
4815
|
+
css: disabled ? inputDisabled : "",
|
|
4807
4816
|
children: [
|
|
4808
4817
|
useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4809
4818
|
InputVariablesOverlayMenu,
|
|
@@ -4905,7 +4914,7 @@ function InputVariablesOverlayMenu({
|
|
|
4905
4914
|
|
|
4906
4915
|
// src/components/Variables/ParameterConnectionIndicator.tsx
|
|
4907
4916
|
var import_CgUsbC2 = require("@react-icons/all-files/cg/CgUsbC");
|
|
4908
|
-
var
|
|
4917
|
+
var import_canvas7 = require("@uniformdev/canvas");
|
|
4909
4918
|
var import_design_system22 = require("@uniformdev/design-system");
|
|
4910
4919
|
var import_react51 = require("react");
|
|
4911
4920
|
|
|
@@ -5010,7 +5019,7 @@ function ParameterConnectionIndicator({
|
|
|
5010
5019
|
}) {
|
|
5011
5020
|
const hasVariablesInValue = (0, import_react51.useMemo)(() => {
|
|
5012
5021
|
let result = false;
|
|
5013
|
-
(0,
|
|
5022
|
+
(0, import_canvas7.bindVariablesToObject)({
|
|
5014
5023
|
value,
|
|
5015
5024
|
variables: {},
|
|
5016
5025
|
handleBinding: () => {
|
|
@@ -5287,7 +5296,6 @@ var tableCellDragIcon = import_react55.css`
|
|
|
5287
5296
|
`;
|
|
5288
5297
|
var variableName = import_react55.css`
|
|
5289
5298
|
border: none;
|
|
5290
|
-
color: var(--brand-secondary-5);
|
|
5291
5299
|
font-weight: var(--fw-medium);
|
|
5292
5300
|
padding: 0;
|
|
5293
5301
|
background: none;
|
|
@@ -5306,7 +5314,7 @@ var variableValue = import_react55.css`
|
|
|
5306
5314
|
// src/components/Variables/VariablesList.tsx
|
|
5307
5315
|
var import_jsx_runtime43 = require("@emotion/react/jsx-runtime");
|
|
5308
5316
|
function VariablesList() {
|
|
5309
|
-
const { variables, dispatch } = useVariables();
|
|
5317
|
+
const { variables, dispatch, readOnly } = useVariables();
|
|
5310
5318
|
const sorted = variablesToList(variables).filter((variable) => !variable.system);
|
|
5311
5319
|
const onDragEnd = (res) => {
|
|
5312
5320
|
var _a, _b;
|
|
@@ -5333,7 +5341,7 @@ function VariablesList() {
|
|
|
5333
5341
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system25.TableCellHead, {})
|
|
5334
5342
|
] }) }),
|
|
5335
5343
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system25.TableBody, { children: [
|
|
5336
|
-
sorted.map(({ name, displayName, default: defaultValue
|
|
5344
|
+
sorted.map(({ name, displayName, default: defaultValue }, index) => {
|
|
5337
5345
|
const text = displayName != null ? displayName : name;
|
|
5338
5346
|
const textValue = variableDefaultTextValue(defaultValue);
|
|
5339
5347
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -5352,7 +5360,7 @@ function VariablesList() {
|
|
|
5352
5360
|
css: tableRow(snapshot.isDragging),
|
|
5353
5361
|
"data-dragging": snapshot.isDragging,
|
|
5354
5362
|
children: [
|
|
5355
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system25.TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5363
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system25.TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: readOnly ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { css: variableName, children: text }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5356
5364
|
"button",
|
|
5357
5365
|
{
|
|
5358
5366
|
css: variableName,
|
|
@@ -5392,12 +5400,12 @@ function VariablesList() {
|
|
|
5392
5400
|
provided.placeholder
|
|
5393
5401
|
] })
|
|
5394
5402
|
] }) }) }),
|
|
5395
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5403
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5396
5404
|
import_design_system25.AddListButton,
|
|
5397
5405
|
{
|
|
5398
5406
|
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
5399
5407
|
"aria-label": "Add variable",
|
|
5400
|
-
buttonText: "
|
|
5408
|
+
buttonText: "Add variable",
|
|
5401
5409
|
icon: "math-plus",
|
|
5402
5410
|
css: { marginLeft: "var(--spacing-md)" }
|
|
5403
5411
|
}
|
|
@@ -6274,12 +6282,12 @@ var DataRefreshButton = ({
|
|
|
6274
6282
|
};
|
|
6275
6283
|
|
|
6276
6284
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6277
|
-
var
|
|
6278
|
-
var
|
|
6279
|
-
var
|
|
6285
|
+
var import_react66 = require("@emotion/react");
|
|
6286
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
6287
|
+
var import_design_system35 = require("@uniformdev/design-system");
|
|
6280
6288
|
|
|
6281
6289
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6282
|
-
var
|
|
6290
|
+
var import_canvas8 = require("@uniformdev/canvas");
|
|
6283
6291
|
var import_react64 = require("react");
|
|
6284
6292
|
var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
|
|
6285
6293
|
var ObjectSearchContext = (0, import_react64.createContext)({
|
|
@@ -6294,12 +6302,19 @@ var ObjectSearchContext = (0, import_react64.createContext)({
|
|
|
6294
6302
|
},
|
|
6295
6303
|
selectedListItems: [],
|
|
6296
6304
|
onRemoveAllSelectedItems: () => {
|
|
6297
|
-
}
|
|
6305
|
+
},
|
|
6306
|
+
isMulti: false
|
|
6298
6307
|
});
|
|
6299
|
-
var ObjectSearchProvider = ({
|
|
6308
|
+
var ObjectSearchProvider = ({
|
|
6309
|
+
currentlySelectedItems,
|
|
6310
|
+
isMulti = false,
|
|
6311
|
+
children,
|
|
6312
|
+
defaultQuery
|
|
6313
|
+
}) => {
|
|
6300
6314
|
const [query, setQuery] = (0, import_react64.useState)({
|
|
6301
6315
|
contentType: "",
|
|
6302
|
-
keyword: ""
|
|
6316
|
+
keyword: "",
|
|
6317
|
+
...defaultQuery
|
|
6303
6318
|
});
|
|
6304
6319
|
const { flatVariables } = useVariables(true);
|
|
6305
6320
|
const querySearchDeferred = (0, import_react64.useDeferredValue)(query);
|
|
@@ -6350,6 +6365,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6350
6365
|
selectedListItems: selectedItems,
|
|
6351
6366
|
onRemoveAllSelectedItems,
|
|
6352
6367
|
list,
|
|
6368
|
+
isMulti,
|
|
6353
6369
|
onSetList
|
|
6354
6370
|
}),
|
|
6355
6371
|
[
|
|
@@ -6360,6 +6376,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6360
6376
|
selectedItems,
|
|
6361
6377
|
onRemoveAllSelectedItems,
|
|
6362
6378
|
list,
|
|
6379
|
+
isMulti,
|
|
6363
6380
|
onSetList
|
|
6364
6381
|
]
|
|
6365
6382
|
);
|
|
@@ -6369,7 +6386,7 @@ function useObjectSearchContext() {
|
|
|
6369
6386
|
return (0, import_react64.useContext)(ObjectSearchContext);
|
|
6370
6387
|
}
|
|
6371
6388
|
function bindQuery(query, inputs) {
|
|
6372
|
-
const { result, errors } = (0,
|
|
6389
|
+
const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
|
|
6373
6390
|
value: query,
|
|
6374
6391
|
variables: inputs,
|
|
6375
6392
|
errorPrefix: "Dynamic input"
|
|
@@ -6380,8 +6397,148 @@ function bindQuery(query, inputs) {
|
|
|
6380
6397
|
return result;
|
|
6381
6398
|
}
|
|
6382
6399
|
|
|
6383
|
-
// src/components/ObjectSearch/
|
|
6400
|
+
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6401
|
+
var import_design_system34 = require("@uniformdev/design-system");
|
|
6402
|
+
|
|
6403
|
+
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6404
|
+
var import_react65 = require("@emotion/react");
|
|
6405
|
+
var import_design_system33 = require("@uniformdev/design-system");
|
|
6406
|
+
var ObjectListItemContainer = import_react65.css`
|
|
6407
|
+
align-items: center;
|
|
6408
|
+
border: 1px solid var(--gray-300);
|
|
6409
|
+
border-radius: var(--rounded-base);
|
|
6410
|
+
background: var(--white);
|
|
6411
|
+
display: grid;
|
|
6412
|
+
grid-template-columns: 1fr auto;
|
|
6413
|
+
padding: var(--spacing-sm);
|
|
6414
|
+
`;
|
|
6415
|
+
var ObjectListItemContainerDisabled = import_react65.css`
|
|
6416
|
+
opacity: var(--opacity-50);
|
|
6417
|
+
pointer-events: none;
|
|
6418
|
+
`;
|
|
6419
|
+
var ObjectListItemLoading = import_react65.css`
|
|
6420
|
+
animation: ${import_design_system33.skeletonLoading} 1s linear infinite alternate;
|
|
6421
|
+
border-color: transparent;
|
|
6422
|
+
min-height: 42px;
|
|
6423
|
+
position: relative;
|
|
6424
|
+
|
|
6425
|
+
&:before,
|
|
6426
|
+
&:after {
|
|
6427
|
+
background: var(--gray-200);
|
|
6428
|
+
content: '';
|
|
6429
|
+
display: block;
|
|
6430
|
+
height: 1rem;
|
|
6431
|
+
}
|
|
6432
|
+
|
|
6433
|
+
&:before {
|
|
6434
|
+
border-radius: var(--rounded-base);
|
|
6435
|
+
width: 10rem;
|
|
6436
|
+
}
|
|
6437
|
+
|
|
6438
|
+
&:after {
|
|
6439
|
+
border-radius: var(--rounded-full);
|
|
6440
|
+
width: 1rem;
|
|
6441
|
+
}
|
|
6442
|
+
`;
|
|
6443
|
+
var ObjectListItemHeadingGroup = import_react65.css`
|
|
6444
|
+
align-items: center;
|
|
6445
|
+
display: grid;
|
|
6446
|
+
`;
|
|
6447
|
+
var ObjectListItemThumbnail = import_react65.css`
|
|
6448
|
+
width: 30px;
|
|
6449
|
+
object-fit: contain;
|
|
6450
|
+
`;
|
|
6451
|
+
var ObjectListItemTitle = import_react65.css`
|
|
6452
|
+
color: var(--brand-secondary-1);
|
|
6453
|
+
display: block;
|
|
6454
|
+
font-size: var(--fs-sm);
|
|
6455
|
+
`;
|
|
6456
|
+
var ObjectListItemSubtitle = import_react65.css`
|
|
6457
|
+
color: var(--gray-500);
|
|
6458
|
+
display: block;
|
|
6459
|
+
font-size: var(--fs-xs);
|
|
6460
|
+
line-height: 1;
|
|
6461
|
+
`;
|
|
6462
|
+
var ObjectListItemInfoContainer = import_react65.css`
|
|
6463
|
+
align-items: center;
|
|
6464
|
+
display: flex;
|
|
6465
|
+
gap: var(--spacing-sm);
|
|
6466
|
+
justify-content: center;
|
|
6467
|
+
`;
|
|
6468
|
+
var ObjectListItemControlledContent = import_react65.css`
|
|
6469
|
+
display: flex;
|
|
6470
|
+
gap: var(--spacing-sm);
|
|
6471
|
+
`;
|
|
6472
|
+
var ObjectListItemUnControlledContent = import_react65.css`
|
|
6473
|
+
margin-top: var(--spacing-sm);
|
|
6474
|
+
grid-column: 1 / -1;
|
|
6475
|
+
`;
|
|
6476
|
+
|
|
6477
|
+
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6384
6478
|
var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
|
|
6479
|
+
var ObjectSearchListItem = ({
|
|
6480
|
+
id,
|
|
6481
|
+
title,
|
|
6482
|
+
contentType,
|
|
6483
|
+
image,
|
|
6484
|
+
imageUrl,
|
|
6485
|
+
popoverData,
|
|
6486
|
+
onSelect,
|
|
6487
|
+
isMulti,
|
|
6488
|
+
disabled,
|
|
6489
|
+
children
|
|
6490
|
+
}) => {
|
|
6491
|
+
const { onSelectItem, selectedListItems, isMulti: globalIsMulti } = useObjectSearchContext();
|
|
6492
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6493
|
+
const handleSelectItem = () => {
|
|
6494
|
+
var _a;
|
|
6495
|
+
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6496
|
+
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6497
|
+
if (isMulti === true || globalIsMulti) {
|
|
6498
|
+
return onSelectItem(selectedItem);
|
|
6499
|
+
}
|
|
6500
|
+
return onSelectItem([selectedItem]);
|
|
6501
|
+
};
|
|
6502
|
+
const selected = selectedListItems.some((item) => item.id === id);
|
|
6503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
6504
|
+
"div",
|
|
6505
|
+
{
|
|
6506
|
+
role: "listitem",
|
|
6507
|
+
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6508
|
+
"data-testid": "list-item",
|
|
6509
|
+
children: [
|
|
6510
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
6511
|
+
"div",
|
|
6512
|
+
{
|
|
6513
|
+
role: "button",
|
|
6514
|
+
onClick: handleSelectItem,
|
|
6515
|
+
css: ObjectListItemControlledContent,
|
|
6516
|
+
"aria-disabled": disabled,
|
|
6517
|
+
children: [
|
|
6518
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6519
|
+
!image || imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6520
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6521
|
+
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6522
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6523
|
+
] })
|
|
6524
|
+
]
|
|
6525
|
+
}
|
|
6526
|
+
),
|
|
6527
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
6528
|
+
selected ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_design_system34.Chip, { text: "selected", size: "xs" }) : null,
|
|
6529
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_design_system34.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6530
|
+
] }),
|
|
6531
|
+
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6532
|
+
]
|
|
6533
|
+
}
|
|
6534
|
+
);
|
|
6535
|
+
};
|
|
6536
|
+
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6538
|
+
};
|
|
6539
|
+
|
|
6540
|
+
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6541
|
+
var import_jsx_runtime60 = require("@emotion/react/jsx-runtime");
|
|
6385
6542
|
var ObjectSearchContainer = ({
|
|
6386
6543
|
label,
|
|
6387
6544
|
enableDynamicInputToResultId,
|
|
@@ -6393,21 +6550,22 @@ var ObjectSearchContainer = ({
|
|
|
6393
6550
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6394
6551
|
const { flatVariables } = useVariables(true);
|
|
6395
6552
|
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6396
|
-
const
|
|
6553
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6554
|
+
import_design_system35.ScrollableList,
|
|
6555
|
+
{
|
|
6556
|
+
role: "list",
|
|
6557
|
+
css: import_react66.css`
|
|
6558
|
+
> div {
|
|
6559
|
+
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6560
|
+
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6561
|
+
}
|
|
6562
|
+
`,
|
|
6563
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DefaultResultList, {})
|
|
6564
|
+
}
|
|
6565
|
+
);
|
|
6566
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6397
6567
|
searchFilters,
|
|
6398
|
-
|
|
6399
|
-
import_design_system33.ScrollableList,
|
|
6400
|
-
{
|
|
6401
|
-
role: "list",
|
|
6402
|
-
css: import_react65.css`
|
|
6403
|
-
> div {
|
|
6404
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6405
|
-
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6406
|
-
}
|
|
6407
|
-
`,
|
|
6408
|
-
children: resultList
|
|
6409
|
-
}
|
|
6410
|
-
)
|
|
6568
|
+
listItems
|
|
6411
6569
|
] });
|
|
6412
6570
|
const handleSelectedVariableChange = (selectedValue) => {
|
|
6413
6571
|
var _a2;
|
|
@@ -6415,7 +6573,7 @@ var ObjectSearchContainer = ({
|
|
|
6415
6573
|
onSelectItem([]);
|
|
6416
6574
|
return;
|
|
6417
6575
|
}
|
|
6418
|
-
const { result, errors } = (0,
|
|
6576
|
+
const { result, errors } = (0, import_canvas9.bindVariables)({
|
|
6419
6577
|
value: selectedValue,
|
|
6420
6578
|
variables: flatVariables,
|
|
6421
6579
|
errorPrefix: "Dynamic input"
|
|
@@ -6436,8 +6594,8 @@ var ObjectSearchContainer = ({
|
|
|
6436
6594
|
}
|
|
6437
6595
|
]);
|
|
6438
6596
|
};
|
|
6439
|
-
return /* @__PURE__ */ (0,
|
|
6440
|
-
/* @__PURE__ */ (0,
|
|
6597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system35.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6598
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system35.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6441
6599
|
InputVariables,
|
|
6442
6600
|
{
|
|
6443
6601
|
label,
|
|
@@ -6455,14 +6613,25 @@ var ObjectSearchContainer = ({
|
|
|
6455
6613
|
children
|
|
6456
6614
|
] }) });
|
|
6457
6615
|
};
|
|
6616
|
+
var DefaultResultList = () => {
|
|
6617
|
+
var _a;
|
|
6618
|
+
const { list } = useObjectSearchContext();
|
|
6619
|
+
if (!list.items) {
|
|
6620
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
6621
|
+
}
|
|
6622
|
+
if (list.items.length === 0) {
|
|
6623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system35.Callout, { type: "info", children: "No results were found" });
|
|
6624
|
+
}
|
|
6625
|
+
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
6626
|
+
};
|
|
6458
6627
|
|
|
6459
6628
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6460
|
-
var
|
|
6461
|
-
var
|
|
6629
|
+
var import_design_system36 = require("@uniformdev/design-system");
|
|
6630
|
+
var import_react68 = require("react");
|
|
6462
6631
|
|
|
6463
6632
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6464
|
-
var
|
|
6465
|
-
var ObjectSearchFilterContainerLabel =
|
|
6633
|
+
var import_react67 = require("@emotion/react");
|
|
6634
|
+
var ObjectSearchFilterContainerLabel = import_react67.css`
|
|
6466
6635
|
align-items: center;
|
|
6467
6636
|
display: flex;
|
|
6468
6637
|
font-size: var(--fs-sm);
|
|
@@ -6470,18 +6639,18 @@ var ObjectSearchFilterContainerLabel = import_react66.css`
|
|
|
6470
6639
|
line-height: 1rem;
|
|
6471
6640
|
margin-bottom: var(--spacing-sm);
|
|
6472
6641
|
`;
|
|
6473
|
-
var ObjectSearchFilterContainer =
|
|
6642
|
+
var ObjectSearchFilterContainer = import_react67.css`
|
|
6474
6643
|
display: grid;
|
|
6475
6644
|
gap: var(--spacing-base);
|
|
6476
6645
|
`;
|
|
6477
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6646
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react67.css`
|
|
6478
6647
|
display: grid;
|
|
6479
6648
|
grid-template-columns: ${gridColumns};
|
|
6480
6649
|
gap: var(--spacing-base);
|
|
6481
6650
|
`;
|
|
6482
6651
|
|
|
6483
6652
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6484
|
-
var
|
|
6653
|
+
var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
|
|
6485
6654
|
var ObjectSearchFilter = ({
|
|
6486
6655
|
requireContentType,
|
|
6487
6656
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6490,10 +6659,11 @@ var ObjectSearchFilter = ({
|
|
|
6490
6659
|
selectLabel = "Content Type Select",
|
|
6491
6660
|
selectOptions
|
|
6492
6661
|
}) => {
|
|
6662
|
+
var _a, _b;
|
|
6493
6663
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6494
|
-
const [searchState, setSearchState] = (0,
|
|
6495
|
-
contentType: "",
|
|
6496
|
-
keyword: ""
|
|
6664
|
+
const [searchState, setSearchState] = (0, import_react68.useState)({
|
|
6665
|
+
contentType: (_a = query.contentType) != null ? _a : "",
|
|
6666
|
+
keyword: (_b = query.keyword) != null ? _b : ""
|
|
6497
6667
|
});
|
|
6498
6668
|
const handleFilterChange = (value) => {
|
|
6499
6669
|
setSearchState((prev) => {
|
|
@@ -6501,20 +6671,20 @@ var ObjectSearchFilter = ({
|
|
|
6501
6671
|
});
|
|
6502
6672
|
onSetQuery({ ...query, ...value });
|
|
6503
6673
|
};
|
|
6504
|
-
const memoizedSelectOptions = (0,
|
|
6674
|
+
const memoizedSelectOptions = (0, import_react68.useMemo)(() => {
|
|
6505
6675
|
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
6506
6676
|
return [];
|
|
6507
6677
|
}
|
|
6508
6678
|
return [
|
|
6509
6679
|
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
6510
6680
|
...selectOptions ? selectOptions.map((option) => {
|
|
6511
|
-
var
|
|
6512
|
-
return { name: option == null ? void 0 : option.name, label: (
|
|
6681
|
+
var _a2;
|
|
6682
|
+
return { name: option == null ? void 0 : option.name, label: (_a2 = option.label) != null ? _a2 : option == null ? void 0 : option.name, id: option.id };
|
|
6513
6683
|
}) : []
|
|
6514
6684
|
];
|
|
6515
6685
|
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6516
6686
|
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6517
|
-
return /* @__PURE__ */ (0,
|
|
6687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
6518
6688
|
"fieldset",
|
|
6519
6689
|
{
|
|
6520
6690
|
css: [
|
|
@@ -6522,8 +6692,8 @@ var ObjectSearchFilter = ({
|
|
|
6522
6692
|
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6523
6693
|
],
|
|
6524
6694
|
children: [
|
|
6525
|
-
memoizedSelectOptions.length ? /* @__PURE__ */ (0,
|
|
6526
|
-
|
|
6695
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6696
|
+
import_design_system36.InputSelect,
|
|
6527
6697
|
{
|
|
6528
6698
|
label: selectLabel,
|
|
6529
6699
|
showLabel: false,
|
|
@@ -6532,8 +6702,8 @@ var ObjectSearchFilter = ({
|
|
|
6532
6702
|
value: query.contentType
|
|
6533
6703
|
}
|
|
6534
6704
|
) : null,
|
|
6535
|
-
/* @__PURE__ */ (0,
|
|
6536
|
-
|
|
6705
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6706
|
+
import_design_system36.InputKeywordSearch,
|
|
6537
6707
|
{
|
|
6538
6708
|
inputFieldName: searchInputName,
|
|
6539
6709
|
placeholder: searchInputPlaceholderText,
|
|
@@ -6549,154 +6719,14 @@ var ObjectSearchFilter = ({
|
|
|
6549
6719
|
};
|
|
6550
6720
|
|
|
6551
6721
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6552
|
-
var
|
|
6722
|
+
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6553
6723
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6554
|
-
return /* @__PURE__ */ (0,
|
|
6555
|
-
label ? /* @__PURE__ */ (0,
|
|
6556
|
-
/* @__PURE__ */ (0,
|
|
6724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { children: [
|
|
6725
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6726
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
6557
6727
|
] });
|
|
6558
6728
|
};
|
|
6559
6729
|
|
|
6560
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6561
|
-
var import_design_system36 = require("@uniformdev/design-system");
|
|
6562
|
-
|
|
6563
|
-
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6564
|
-
var import_react68 = require("@emotion/react");
|
|
6565
|
-
var import_design_system35 = require("@uniformdev/design-system");
|
|
6566
|
-
var ObjectListItemContainer = import_react68.css`
|
|
6567
|
-
align-items: center;
|
|
6568
|
-
border: 1px solid var(--gray-300);
|
|
6569
|
-
border-radius: var(--rounded-base);
|
|
6570
|
-
background: var(--white);
|
|
6571
|
-
display: grid;
|
|
6572
|
-
grid-template-columns: 1fr auto;
|
|
6573
|
-
padding: var(--spacing-sm);
|
|
6574
|
-
`;
|
|
6575
|
-
var ObjectListItemContainerDisabled = import_react68.css`
|
|
6576
|
-
opacity: var(--opacity-50);
|
|
6577
|
-
pointer-events: none;
|
|
6578
|
-
`;
|
|
6579
|
-
var ObjectListItemLoading = import_react68.css`
|
|
6580
|
-
animation: ${import_design_system35.skeletonLoading} 1s linear infinite alternate;
|
|
6581
|
-
border-color: transparent;
|
|
6582
|
-
min-height: 42px;
|
|
6583
|
-
position: relative;
|
|
6584
|
-
|
|
6585
|
-
&:before,
|
|
6586
|
-
&:after {
|
|
6587
|
-
background: var(--gray-200);
|
|
6588
|
-
content: '';
|
|
6589
|
-
display: block;
|
|
6590
|
-
height: 1rem;
|
|
6591
|
-
}
|
|
6592
|
-
|
|
6593
|
-
&:before {
|
|
6594
|
-
border-radius: var(--rounded-base);
|
|
6595
|
-
width: 10rem;
|
|
6596
|
-
}
|
|
6597
|
-
|
|
6598
|
-
&:after {
|
|
6599
|
-
border-radius: var(--rounded-full);
|
|
6600
|
-
width: 1rem;
|
|
6601
|
-
}
|
|
6602
|
-
`;
|
|
6603
|
-
var ObjectListItemHeadingGroup = import_react68.css`
|
|
6604
|
-
align-items: center;
|
|
6605
|
-
display: grid;
|
|
6606
|
-
`;
|
|
6607
|
-
var ObjectListItemThumbnail = import_react68.css`
|
|
6608
|
-
width: 30px;
|
|
6609
|
-
object-fit: contain;
|
|
6610
|
-
`;
|
|
6611
|
-
var ObjectListItemTitle = import_react68.css`
|
|
6612
|
-
color: var(--brand-secondary-1);
|
|
6613
|
-
display: block;
|
|
6614
|
-
font-size: var(--fs-sm);
|
|
6615
|
-
`;
|
|
6616
|
-
var ObjectListItemSubtitle = import_react68.css`
|
|
6617
|
-
color: var(--gray-500);
|
|
6618
|
-
display: block;
|
|
6619
|
-
font-size: var(--fs-xs);
|
|
6620
|
-
line-height: 1;
|
|
6621
|
-
`;
|
|
6622
|
-
var ObjectListItemInfoContainer = import_react68.css`
|
|
6623
|
-
align-items: center;
|
|
6624
|
-
display: flex;
|
|
6625
|
-
gap: var(--spacing-sm);
|
|
6626
|
-
justify-content: center;
|
|
6627
|
-
`;
|
|
6628
|
-
var ObjectListItemControlledContent = import_react68.css`
|
|
6629
|
-
display: flex;
|
|
6630
|
-
gap: var(--spacing-sm);
|
|
6631
|
-
`;
|
|
6632
|
-
var ObjectListItemUnControlledContent = import_react68.css`
|
|
6633
|
-
margin-top: var(--spacing-sm);
|
|
6634
|
-
grid-column: 1 / -1;
|
|
6635
|
-
`;
|
|
6636
|
-
|
|
6637
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6638
|
-
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6639
|
-
var ObjectSearchListItem = ({
|
|
6640
|
-
id,
|
|
6641
|
-
title,
|
|
6642
|
-
contentType,
|
|
6643
|
-
image,
|
|
6644
|
-
imageUrl,
|
|
6645
|
-
popoverData,
|
|
6646
|
-
onSelect,
|
|
6647
|
-
isMulti = false,
|
|
6648
|
-
disabled,
|
|
6649
|
-
children
|
|
6650
|
-
}) => {
|
|
6651
|
-
const { onSelectItem, selectedListItems } = useObjectSearchContext();
|
|
6652
|
-
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6653
|
-
const handleSelectItem = () => {
|
|
6654
|
-
var _a;
|
|
6655
|
-
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6656
|
-
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6657
|
-
if (isMulti) {
|
|
6658
|
-
return onSelectItem(selectedItem);
|
|
6659
|
-
}
|
|
6660
|
-
return onSelectItem([selectedItem]);
|
|
6661
|
-
};
|
|
6662
|
-
const selected = selectedListItems.some((item) => item.id === id);
|
|
6663
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6664
|
-
"div",
|
|
6665
|
-
{
|
|
6666
|
-
role: "listitem",
|
|
6667
|
-
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6668
|
-
"data-testid": "list-item",
|
|
6669
|
-
children: [
|
|
6670
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6671
|
-
"div",
|
|
6672
|
-
{
|
|
6673
|
-
role: "button",
|
|
6674
|
-
onClick: handleSelectItem,
|
|
6675
|
-
css: ObjectListItemControlledContent,
|
|
6676
|
-
"aria-disabled": disabled,
|
|
6677
|
-
children: [
|
|
6678
|
-
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6679
|
-
!image || imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6680
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6681
|
-
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6682
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6683
|
-
] })
|
|
6684
|
-
]
|
|
6685
|
-
}
|
|
6686
|
-
),
|
|
6687
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
6688
|
-
selected ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Chip, { text: "selected", size: "xs" }) : null,
|
|
6689
|
-
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6690
|
-
] }),
|
|
6691
|
-
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6692
|
-
]
|
|
6693
|
-
}
|
|
6694
|
-
);
|
|
6695
|
-
};
|
|
6696
|
-
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6697
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6698
|
-
};
|
|
6699
|
-
|
|
6700
6730
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6701
6731
|
var import_design_system38 = require("@uniformdev/design-system");
|
|
6702
6732
|
var import_timeago3 = require("timeago.js");
|
|
@@ -6844,13 +6874,13 @@ var ObjectSearchResultItem = ({
|
|
|
6844
6874
|
onSelectItem({ id, title: id });
|
|
6845
6875
|
onRemove == null ? void 0 : onRemove();
|
|
6846
6876
|
};
|
|
6847
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { css: ObjectSearchResultItemContainer, children: [
|
|
6877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
|
|
6848
6878
|
disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
6849
6879
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { css: ObjectSearchContentContainer, children: [
|
|
6850
6880
|
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
6851
6881
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { children: [
|
|
6852
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
|
|
6853
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
|
|
6882
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
|
|
6883
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
|
|
6854
6884
|
title != null ? title : name,
|
|
6855
6885
|
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
6856
6886
|
] }),
|
|
@@ -7020,14 +7050,14 @@ var QueryFilter = ({
|
|
|
7020
7050
|
],
|
|
7021
7051
|
children
|
|
7022
7052
|
}) => {
|
|
7023
|
-
var _a, _b, _c, _d;
|
|
7053
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7024
7054
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
7025
7055
|
const [queryState, setQueryState] = (0, import_react72.useState)({
|
|
7026
|
-
contentType: "",
|
|
7027
|
-
keyword: "",
|
|
7056
|
+
contentType: (_a = query.contentType) != null ? _a : "",
|
|
7057
|
+
keyword: (_b = query.contentType) != null ? _b : "",
|
|
7028
7058
|
count: countValue != null ? countValue : 5,
|
|
7029
|
-
sortBy: (
|
|
7030
|
-
sortOrder: (
|
|
7059
|
+
sortBy: (_c = sortOptions[0].id) != null ? _c : "",
|
|
7060
|
+
sortOrder: (_d = sortOrderOptions[0].id) != null ? _d : ""
|
|
7031
7061
|
});
|
|
7032
7062
|
const handleFilterChange = (value) => {
|
|
7033
7063
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
@@ -7043,7 +7073,7 @@ var QueryFilter = ({
|
|
|
7043
7073
|
InputVariables,
|
|
7044
7074
|
{
|
|
7045
7075
|
label: searchInputLabel,
|
|
7046
|
-
value: (
|
|
7076
|
+
value: (_e = queryState.keyword) != null ? _e : "",
|
|
7047
7077
|
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
7048
7078
|
disableInlineMenu: true,
|
|
7049
7079
|
id: "qf_searchText",
|
|
@@ -7067,7 +7097,7 @@ var QueryFilter = ({
|
|
|
7067
7097
|
{
|
|
7068
7098
|
label: contentTypeLabel,
|
|
7069
7099
|
id: "qf_contentType",
|
|
7070
|
-
value: (
|
|
7100
|
+
value: (_f = queryState.contentType) != null ? _f : "",
|
|
7071
7101
|
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
7072
7102
|
disableInlineMenu: true,
|
|
7073
7103
|
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|