@uniformdev/mesh-sdk-react 19.80.0 → 19.80.1-alpha.149
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 +8 -18
- package/dist/index.d.ts +8 -18
- package/dist/index.esm.js +190 -172
- package/dist/index.js +195 -177
- package/dist/index.mjs +190 -172
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -5292,7 +5292,6 @@ var tableCellDragIcon = import_react55.css`
|
|
|
5292
5292
|
`;
|
|
5293
5293
|
var variableName = import_react55.css`
|
|
5294
5294
|
border: none;
|
|
5295
|
-
color: var(--brand-secondary-5);
|
|
5296
5295
|
font-weight: var(--fw-medium);
|
|
5297
5296
|
padding: 0;
|
|
5298
5297
|
background: none;
|
|
@@ -5402,7 +5401,7 @@ function VariablesList() {
|
|
|
5402
5401
|
{
|
|
5403
5402
|
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
5404
5403
|
"aria-label": "Add variable",
|
|
5405
|
-
buttonText: "
|
|
5404
|
+
buttonText: "Add variable",
|
|
5406
5405
|
icon: "math-plus",
|
|
5407
5406
|
css: { marginLeft: "var(--spacing-md)" }
|
|
5408
5407
|
}
|
|
@@ -6279,9 +6278,9 @@ var DataRefreshButton = ({
|
|
|
6279
6278
|
};
|
|
6280
6279
|
|
|
6281
6280
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6282
|
-
var
|
|
6281
|
+
var import_react66 = require("@emotion/react");
|
|
6283
6282
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
6284
|
-
var
|
|
6283
|
+
var import_design_system35 = require("@uniformdev/design-system");
|
|
6285
6284
|
|
|
6286
6285
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6287
6286
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
@@ -6299,9 +6298,14 @@ var ObjectSearchContext = (0, import_react64.createContext)({
|
|
|
6299
6298
|
},
|
|
6300
6299
|
selectedListItems: [],
|
|
6301
6300
|
onRemoveAllSelectedItems: () => {
|
|
6302
|
-
}
|
|
6301
|
+
},
|
|
6302
|
+
isMulti: false
|
|
6303
6303
|
});
|
|
6304
|
-
var ObjectSearchProvider = ({
|
|
6304
|
+
var ObjectSearchProvider = ({
|
|
6305
|
+
currentlySelectedItems,
|
|
6306
|
+
isMulti = false,
|
|
6307
|
+
children
|
|
6308
|
+
}) => {
|
|
6305
6309
|
const [query, setQuery] = (0, import_react64.useState)({
|
|
6306
6310
|
contentType: "",
|
|
6307
6311
|
keyword: ""
|
|
@@ -6355,6 +6359,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6355
6359
|
selectedListItems: selectedItems,
|
|
6356
6360
|
onRemoveAllSelectedItems,
|
|
6357
6361
|
list,
|
|
6362
|
+
isMulti,
|
|
6358
6363
|
onSetList
|
|
6359
6364
|
}),
|
|
6360
6365
|
[
|
|
@@ -6365,6 +6370,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6365
6370
|
selectedItems,
|
|
6366
6371
|
onRemoveAllSelectedItems,
|
|
6367
6372
|
list,
|
|
6373
|
+
isMulti,
|
|
6368
6374
|
onSetList
|
|
6369
6375
|
]
|
|
6370
6376
|
);
|
|
@@ -6385,8 +6391,148 @@ function bindQuery(query, inputs) {
|
|
|
6385
6391
|
return result;
|
|
6386
6392
|
}
|
|
6387
6393
|
|
|
6388
|
-
// src/components/ObjectSearch/
|
|
6394
|
+
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6395
|
+
var import_design_system34 = require("@uniformdev/design-system");
|
|
6396
|
+
|
|
6397
|
+
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6398
|
+
var import_react65 = require("@emotion/react");
|
|
6399
|
+
var import_design_system33 = require("@uniformdev/design-system");
|
|
6400
|
+
var ObjectListItemContainer = import_react65.css`
|
|
6401
|
+
align-items: center;
|
|
6402
|
+
border: 1px solid var(--gray-300);
|
|
6403
|
+
border-radius: var(--rounded-base);
|
|
6404
|
+
background: var(--white);
|
|
6405
|
+
display: grid;
|
|
6406
|
+
grid-template-columns: 1fr auto;
|
|
6407
|
+
padding: var(--spacing-sm);
|
|
6408
|
+
`;
|
|
6409
|
+
var ObjectListItemContainerDisabled = import_react65.css`
|
|
6410
|
+
opacity: var(--opacity-50);
|
|
6411
|
+
pointer-events: none;
|
|
6412
|
+
`;
|
|
6413
|
+
var ObjectListItemLoading = import_react65.css`
|
|
6414
|
+
animation: ${import_design_system33.skeletonLoading} 1s linear infinite alternate;
|
|
6415
|
+
border-color: transparent;
|
|
6416
|
+
min-height: 42px;
|
|
6417
|
+
position: relative;
|
|
6418
|
+
|
|
6419
|
+
&:before,
|
|
6420
|
+
&:after {
|
|
6421
|
+
background: var(--gray-200);
|
|
6422
|
+
content: '';
|
|
6423
|
+
display: block;
|
|
6424
|
+
height: 1rem;
|
|
6425
|
+
}
|
|
6426
|
+
|
|
6427
|
+
&:before {
|
|
6428
|
+
border-radius: var(--rounded-base);
|
|
6429
|
+
width: 10rem;
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6432
|
+
&:after {
|
|
6433
|
+
border-radius: var(--rounded-full);
|
|
6434
|
+
width: 1rem;
|
|
6435
|
+
}
|
|
6436
|
+
`;
|
|
6437
|
+
var ObjectListItemHeadingGroup = import_react65.css`
|
|
6438
|
+
align-items: center;
|
|
6439
|
+
display: grid;
|
|
6440
|
+
`;
|
|
6441
|
+
var ObjectListItemThumbnail = import_react65.css`
|
|
6442
|
+
width: 30px;
|
|
6443
|
+
object-fit: contain;
|
|
6444
|
+
`;
|
|
6445
|
+
var ObjectListItemTitle = import_react65.css`
|
|
6446
|
+
color: var(--brand-secondary-1);
|
|
6447
|
+
display: block;
|
|
6448
|
+
font-size: var(--fs-sm);
|
|
6449
|
+
`;
|
|
6450
|
+
var ObjectListItemSubtitle = import_react65.css`
|
|
6451
|
+
color: var(--gray-500);
|
|
6452
|
+
display: block;
|
|
6453
|
+
font-size: var(--fs-xs);
|
|
6454
|
+
line-height: 1;
|
|
6455
|
+
`;
|
|
6456
|
+
var ObjectListItemInfoContainer = import_react65.css`
|
|
6457
|
+
align-items: center;
|
|
6458
|
+
display: flex;
|
|
6459
|
+
gap: var(--spacing-sm);
|
|
6460
|
+
justify-content: center;
|
|
6461
|
+
`;
|
|
6462
|
+
var ObjectListItemControlledContent = import_react65.css`
|
|
6463
|
+
display: flex;
|
|
6464
|
+
gap: var(--spacing-sm);
|
|
6465
|
+
`;
|
|
6466
|
+
var ObjectListItemUnControlledContent = import_react65.css`
|
|
6467
|
+
margin-top: var(--spacing-sm);
|
|
6468
|
+
grid-column: 1 / -1;
|
|
6469
|
+
`;
|
|
6470
|
+
|
|
6471
|
+
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6389
6472
|
var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
|
|
6473
|
+
var ObjectSearchListItem = ({
|
|
6474
|
+
id,
|
|
6475
|
+
title,
|
|
6476
|
+
contentType,
|
|
6477
|
+
image,
|
|
6478
|
+
imageUrl,
|
|
6479
|
+
popoverData,
|
|
6480
|
+
onSelect,
|
|
6481
|
+
isMulti,
|
|
6482
|
+
disabled,
|
|
6483
|
+
children
|
|
6484
|
+
}) => {
|
|
6485
|
+
const { onSelectItem, selectedListItems, isMulti: globalIsMulti } = useObjectSearchContext();
|
|
6486
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6487
|
+
const handleSelectItem = () => {
|
|
6488
|
+
var _a;
|
|
6489
|
+
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6490
|
+
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6491
|
+
if (isMulti === true || globalIsMulti) {
|
|
6492
|
+
return onSelectItem(selectedItem);
|
|
6493
|
+
}
|
|
6494
|
+
return onSelectItem([selectedItem]);
|
|
6495
|
+
};
|
|
6496
|
+
const selected = selectedListItems.some((item) => item.id === id);
|
|
6497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
6498
|
+
"div",
|
|
6499
|
+
{
|
|
6500
|
+
role: "listitem",
|
|
6501
|
+
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6502
|
+
"data-testid": "list-item",
|
|
6503
|
+
children: [
|
|
6504
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
6505
|
+
"div",
|
|
6506
|
+
{
|
|
6507
|
+
role: "button",
|
|
6508
|
+
onClick: handleSelectItem,
|
|
6509
|
+
css: ObjectListItemControlledContent,
|
|
6510
|
+
"aria-disabled": disabled,
|
|
6511
|
+
children: [
|
|
6512
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6513
|
+
!image || imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6514
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6515
|
+
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6516
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6517
|
+
] })
|
|
6518
|
+
]
|
|
6519
|
+
}
|
|
6520
|
+
),
|
|
6521
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
6522
|
+
selected ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_design_system34.Chip, { text: "selected", size: "xs" }) : null,
|
|
6523
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_design_system34.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6524
|
+
] }),
|
|
6525
|
+
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6526
|
+
]
|
|
6527
|
+
}
|
|
6528
|
+
);
|
|
6529
|
+
};
|
|
6530
|
+
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6532
|
+
};
|
|
6533
|
+
|
|
6534
|
+
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6535
|
+
var import_jsx_runtime60 = require("@emotion/react/jsx-runtime");
|
|
6390
6536
|
var ObjectSearchContainer = ({
|
|
6391
6537
|
label,
|
|
6392
6538
|
enableDynamicInputToResultId,
|
|
@@ -6398,19 +6544,20 @@ var ObjectSearchContainer = ({
|
|
|
6398
6544
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6399
6545
|
const { flatVariables } = useVariables(true);
|
|
6400
6546
|
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6401
|
-
const
|
|
6547
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DefaultResultList, {});
|
|
6548
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6402
6549
|
searchFilters,
|
|
6403
|
-
|
|
6404
|
-
|
|
6550
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6551
|
+
import_design_system35.ScrollableList,
|
|
6405
6552
|
{
|
|
6406
6553
|
role: "list",
|
|
6407
|
-
css:
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
children:
|
|
6554
|
+
css: import_react66.css`
|
|
6555
|
+
> div {
|
|
6556
|
+
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6557
|
+
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6558
|
+
}
|
|
6559
|
+
`,
|
|
6560
|
+
children: listItems
|
|
6414
6561
|
}
|
|
6415
6562
|
)
|
|
6416
6563
|
] });
|
|
@@ -6441,8 +6588,8 @@ var ObjectSearchContainer = ({
|
|
|
6441
6588
|
}
|
|
6442
6589
|
]);
|
|
6443
6590
|
};
|
|
6444
|
-
return /* @__PURE__ */ (0,
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system35.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6592
|
+
/* @__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)(
|
|
6446
6593
|
InputVariables,
|
|
6447
6594
|
{
|
|
6448
6595
|
label,
|
|
@@ -6460,14 +6607,25 @@ var ObjectSearchContainer = ({
|
|
|
6460
6607
|
children
|
|
6461
6608
|
] }) });
|
|
6462
6609
|
};
|
|
6610
|
+
var DefaultResultList = () => {
|
|
6611
|
+
var _a;
|
|
6612
|
+
const { list } = useObjectSearchContext();
|
|
6613
|
+
if (!list.items) {
|
|
6614
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
6615
|
+
}
|
|
6616
|
+
if (list.items.length === 0) {
|
|
6617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system35.Callout, { type: "info", children: "No results were found" });
|
|
6618
|
+
}
|
|
6619
|
+
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
6620
|
+
};
|
|
6463
6621
|
|
|
6464
6622
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6465
|
-
var
|
|
6466
|
-
var
|
|
6623
|
+
var import_design_system36 = require("@uniformdev/design-system");
|
|
6624
|
+
var import_react68 = require("react");
|
|
6467
6625
|
|
|
6468
6626
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6469
|
-
var
|
|
6470
|
-
var ObjectSearchFilterContainerLabel =
|
|
6627
|
+
var import_react67 = require("@emotion/react");
|
|
6628
|
+
var ObjectSearchFilterContainerLabel = import_react67.css`
|
|
6471
6629
|
align-items: center;
|
|
6472
6630
|
display: flex;
|
|
6473
6631
|
font-size: var(--fs-sm);
|
|
@@ -6475,18 +6633,18 @@ var ObjectSearchFilterContainerLabel = import_react66.css`
|
|
|
6475
6633
|
line-height: 1rem;
|
|
6476
6634
|
margin-bottom: var(--spacing-sm);
|
|
6477
6635
|
`;
|
|
6478
|
-
var ObjectSearchFilterContainer =
|
|
6636
|
+
var ObjectSearchFilterContainer = import_react67.css`
|
|
6479
6637
|
display: grid;
|
|
6480
6638
|
gap: var(--spacing-base);
|
|
6481
6639
|
`;
|
|
6482
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6640
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react67.css`
|
|
6483
6641
|
display: grid;
|
|
6484
6642
|
grid-template-columns: ${gridColumns};
|
|
6485
6643
|
gap: var(--spacing-base);
|
|
6486
6644
|
`;
|
|
6487
6645
|
|
|
6488
6646
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6489
|
-
var
|
|
6647
|
+
var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
|
|
6490
6648
|
var ObjectSearchFilter = ({
|
|
6491
6649
|
requireContentType,
|
|
6492
6650
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6496,7 +6654,7 @@ var ObjectSearchFilter = ({
|
|
|
6496
6654
|
selectOptions
|
|
6497
6655
|
}) => {
|
|
6498
6656
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6499
|
-
const [searchState, setSearchState] = (0,
|
|
6657
|
+
const [searchState, setSearchState] = (0, import_react68.useState)({
|
|
6500
6658
|
contentType: "",
|
|
6501
6659
|
keyword: ""
|
|
6502
6660
|
});
|
|
@@ -6506,7 +6664,7 @@ var ObjectSearchFilter = ({
|
|
|
6506
6664
|
});
|
|
6507
6665
|
onSetQuery({ ...query, ...value });
|
|
6508
6666
|
};
|
|
6509
|
-
const memoizedSelectOptions = (0,
|
|
6667
|
+
const memoizedSelectOptions = (0, import_react68.useMemo)(() => {
|
|
6510
6668
|
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
6511
6669
|
return [];
|
|
6512
6670
|
}
|
|
@@ -6519,7 +6677,7 @@ var ObjectSearchFilter = ({
|
|
|
6519
6677
|
];
|
|
6520
6678
|
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6521
6679
|
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6522
|
-
return /* @__PURE__ */ (0,
|
|
6680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
6523
6681
|
"fieldset",
|
|
6524
6682
|
{
|
|
6525
6683
|
css: [
|
|
@@ -6527,8 +6685,8 @@ var ObjectSearchFilter = ({
|
|
|
6527
6685
|
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6528
6686
|
],
|
|
6529
6687
|
children: [
|
|
6530
|
-
memoizedSelectOptions.length ? /* @__PURE__ */ (0,
|
|
6531
|
-
|
|
6688
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6689
|
+
import_design_system36.InputSelect,
|
|
6532
6690
|
{
|
|
6533
6691
|
label: selectLabel,
|
|
6534
6692
|
showLabel: false,
|
|
@@ -6537,8 +6695,8 @@ var ObjectSearchFilter = ({
|
|
|
6537
6695
|
value: query.contentType
|
|
6538
6696
|
}
|
|
6539
6697
|
) : null,
|
|
6540
|
-
/* @__PURE__ */ (0,
|
|
6541
|
-
|
|
6698
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6699
|
+
import_design_system36.InputKeywordSearch,
|
|
6542
6700
|
{
|
|
6543
6701
|
inputFieldName: searchInputName,
|
|
6544
6702
|
placeholder: searchInputPlaceholderText,
|
|
@@ -6554,154 +6712,14 @@ var ObjectSearchFilter = ({
|
|
|
6554
6712
|
};
|
|
6555
6713
|
|
|
6556
6714
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6557
|
-
var
|
|
6715
|
+
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6558
6716
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6559
|
-
return /* @__PURE__ */ (0,
|
|
6560
|
-
label ? /* @__PURE__ */ (0,
|
|
6561
|
-
/* @__PURE__ */ (0,
|
|
6717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { children: [
|
|
6718
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6719
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
6562
6720
|
] });
|
|
6563
6721
|
};
|
|
6564
6722
|
|
|
6565
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6566
|
-
var import_design_system36 = require("@uniformdev/design-system");
|
|
6567
|
-
|
|
6568
|
-
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6569
|
-
var import_react68 = require("@emotion/react");
|
|
6570
|
-
var import_design_system35 = require("@uniformdev/design-system");
|
|
6571
|
-
var ObjectListItemContainer = import_react68.css`
|
|
6572
|
-
align-items: center;
|
|
6573
|
-
border: 1px solid var(--gray-300);
|
|
6574
|
-
border-radius: var(--rounded-base);
|
|
6575
|
-
background: var(--white);
|
|
6576
|
-
display: grid;
|
|
6577
|
-
grid-template-columns: 1fr auto;
|
|
6578
|
-
padding: var(--spacing-sm);
|
|
6579
|
-
`;
|
|
6580
|
-
var ObjectListItemContainerDisabled = import_react68.css`
|
|
6581
|
-
opacity: var(--opacity-50);
|
|
6582
|
-
pointer-events: none;
|
|
6583
|
-
`;
|
|
6584
|
-
var ObjectListItemLoading = import_react68.css`
|
|
6585
|
-
animation: ${import_design_system35.skeletonLoading} 1s linear infinite alternate;
|
|
6586
|
-
border-color: transparent;
|
|
6587
|
-
min-height: 42px;
|
|
6588
|
-
position: relative;
|
|
6589
|
-
|
|
6590
|
-
&:before,
|
|
6591
|
-
&:after {
|
|
6592
|
-
background: var(--gray-200);
|
|
6593
|
-
content: '';
|
|
6594
|
-
display: block;
|
|
6595
|
-
height: 1rem;
|
|
6596
|
-
}
|
|
6597
|
-
|
|
6598
|
-
&:before {
|
|
6599
|
-
border-radius: var(--rounded-base);
|
|
6600
|
-
width: 10rem;
|
|
6601
|
-
}
|
|
6602
|
-
|
|
6603
|
-
&:after {
|
|
6604
|
-
border-radius: var(--rounded-full);
|
|
6605
|
-
width: 1rem;
|
|
6606
|
-
}
|
|
6607
|
-
`;
|
|
6608
|
-
var ObjectListItemHeadingGroup = import_react68.css`
|
|
6609
|
-
align-items: center;
|
|
6610
|
-
display: grid;
|
|
6611
|
-
`;
|
|
6612
|
-
var ObjectListItemThumbnail = import_react68.css`
|
|
6613
|
-
width: 30px;
|
|
6614
|
-
object-fit: contain;
|
|
6615
|
-
`;
|
|
6616
|
-
var ObjectListItemTitle = import_react68.css`
|
|
6617
|
-
color: var(--brand-secondary-1);
|
|
6618
|
-
display: block;
|
|
6619
|
-
font-size: var(--fs-sm);
|
|
6620
|
-
`;
|
|
6621
|
-
var ObjectListItemSubtitle = import_react68.css`
|
|
6622
|
-
color: var(--gray-500);
|
|
6623
|
-
display: block;
|
|
6624
|
-
font-size: var(--fs-xs);
|
|
6625
|
-
line-height: 1;
|
|
6626
|
-
`;
|
|
6627
|
-
var ObjectListItemInfoContainer = import_react68.css`
|
|
6628
|
-
align-items: center;
|
|
6629
|
-
display: flex;
|
|
6630
|
-
gap: var(--spacing-sm);
|
|
6631
|
-
justify-content: center;
|
|
6632
|
-
`;
|
|
6633
|
-
var ObjectListItemControlledContent = import_react68.css`
|
|
6634
|
-
display: flex;
|
|
6635
|
-
gap: var(--spacing-sm);
|
|
6636
|
-
`;
|
|
6637
|
-
var ObjectListItemUnControlledContent = import_react68.css`
|
|
6638
|
-
margin-top: var(--spacing-sm);
|
|
6639
|
-
grid-column: 1 / -1;
|
|
6640
|
-
`;
|
|
6641
|
-
|
|
6642
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6643
|
-
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6644
|
-
var ObjectSearchListItem = ({
|
|
6645
|
-
id,
|
|
6646
|
-
title,
|
|
6647
|
-
contentType,
|
|
6648
|
-
image,
|
|
6649
|
-
imageUrl,
|
|
6650
|
-
popoverData,
|
|
6651
|
-
onSelect,
|
|
6652
|
-
isMulti = false,
|
|
6653
|
-
disabled,
|
|
6654
|
-
children
|
|
6655
|
-
}) => {
|
|
6656
|
-
const { onSelectItem, selectedListItems } = useObjectSearchContext();
|
|
6657
|
-
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6658
|
-
const handleSelectItem = () => {
|
|
6659
|
-
var _a;
|
|
6660
|
-
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6661
|
-
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6662
|
-
if (isMulti) {
|
|
6663
|
-
return onSelectItem(selectedItem);
|
|
6664
|
-
}
|
|
6665
|
-
return onSelectItem([selectedItem]);
|
|
6666
|
-
};
|
|
6667
|
-
const selected = selectedListItems.some((item) => item.id === id);
|
|
6668
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6669
|
-
"div",
|
|
6670
|
-
{
|
|
6671
|
-
role: "listitem",
|
|
6672
|
-
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6673
|
-
"data-testid": "list-item",
|
|
6674
|
-
children: [
|
|
6675
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6676
|
-
"div",
|
|
6677
|
-
{
|
|
6678
|
-
role: "button",
|
|
6679
|
-
onClick: handleSelectItem,
|
|
6680
|
-
css: ObjectListItemControlledContent,
|
|
6681
|
-
"aria-disabled": disabled,
|
|
6682
|
-
children: [
|
|
6683
|
-
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6684
|
-
!image || imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6685
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6686
|
-
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6687
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6688
|
-
] })
|
|
6689
|
-
]
|
|
6690
|
-
}
|
|
6691
|
-
),
|
|
6692
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
6693
|
-
selected ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Chip, { text: "selected", size: "xs" }) : null,
|
|
6694
|
-
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6695
|
-
] }),
|
|
6696
|
-
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6697
|
-
]
|
|
6698
|
-
}
|
|
6699
|
-
);
|
|
6700
|
-
};
|
|
6701
|
-
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6702
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6703
|
-
};
|
|
6704
|
-
|
|
6705
6723
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6706
6724
|
var import_design_system38 = require("@uniformdev/design-system");
|
|
6707
6725
|
var import_timeago3 = require("timeago.js");
|