@uniformdev/mesh-sdk-react 19.87.0 → 19.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.esm.js +189 -170
- package/dist/index.js +194 -175
- package/dist/index.mjs +189 -170
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -6278,9 +6278,9 @@ var DataRefreshButton = ({
|
|
|
6278
6278
|
};
|
|
6279
6279
|
|
|
6280
6280
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6281
|
-
var
|
|
6281
|
+
var import_react66 = require("@emotion/react");
|
|
6282
6282
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
6283
|
-
var
|
|
6283
|
+
var import_design_system35 = require("@uniformdev/design-system");
|
|
6284
6284
|
|
|
6285
6285
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6286
6286
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
@@ -6298,9 +6298,14 @@ var ObjectSearchContext = (0, import_react64.createContext)({
|
|
|
6298
6298
|
},
|
|
6299
6299
|
selectedListItems: [],
|
|
6300
6300
|
onRemoveAllSelectedItems: () => {
|
|
6301
|
-
}
|
|
6301
|
+
},
|
|
6302
|
+
isMulti: false
|
|
6302
6303
|
});
|
|
6303
|
-
var ObjectSearchProvider = ({
|
|
6304
|
+
var ObjectSearchProvider = ({
|
|
6305
|
+
currentlySelectedItems,
|
|
6306
|
+
isMulti = false,
|
|
6307
|
+
children
|
|
6308
|
+
}) => {
|
|
6304
6309
|
const [query, setQuery] = (0, import_react64.useState)({
|
|
6305
6310
|
contentType: "",
|
|
6306
6311
|
keyword: ""
|
|
@@ -6354,6 +6359,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6354
6359
|
selectedListItems: selectedItems,
|
|
6355
6360
|
onRemoveAllSelectedItems,
|
|
6356
6361
|
list,
|
|
6362
|
+
isMulti,
|
|
6357
6363
|
onSetList
|
|
6358
6364
|
}),
|
|
6359
6365
|
[
|
|
@@ -6364,6 +6370,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6364
6370
|
selectedItems,
|
|
6365
6371
|
onRemoveAllSelectedItems,
|
|
6366
6372
|
list,
|
|
6373
|
+
isMulti,
|
|
6367
6374
|
onSetList
|
|
6368
6375
|
]
|
|
6369
6376
|
);
|
|
@@ -6384,8 +6391,148 @@ function bindQuery(query, inputs) {
|
|
|
6384
6391
|
return result;
|
|
6385
6392
|
}
|
|
6386
6393
|
|
|
6387
|
-
// 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
|
|
6388
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");
|
|
6389
6536
|
var ObjectSearchContainer = ({
|
|
6390
6537
|
label,
|
|
6391
6538
|
enableDynamicInputToResultId,
|
|
@@ -6397,19 +6544,20 @@ var ObjectSearchContainer = ({
|
|
|
6397
6544
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6398
6545
|
const { flatVariables } = useVariables(true);
|
|
6399
6546
|
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6400
|
-
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: [
|
|
6401
6549
|
searchFilters,
|
|
6402
|
-
|
|
6403
|
-
|
|
6550
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6551
|
+
import_design_system35.ScrollableList,
|
|
6404
6552
|
{
|
|
6405
6553
|
role: "list",
|
|
6406
|
-
css:
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
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
|
|
6413
6561
|
}
|
|
6414
6562
|
)
|
|
6415
6563
|
] });
|
|
@@ -6440,8 +6588,8 @@ var ObjectSearchContainer = ({
|
|
|
6440
6588
|
}
|
|
6441
6589
|
]);
|
|
6442
6590
|
};
|
|
6443
|
-
return /* @__PURE__ */ (0,
|
|
6444
|
-
/* @__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)(
|
|
6445
6593
|
InputVariables,
|
|
6446
6594
|
{
|
|
6447
6595
|
label,
|
|
@@ -6459,14 +6607,25 @@ var ObjectSearchContainer = ({
|
|
|
6459
6607
|
children
|
|
6460
6608
|
] }) });
|
|
6461
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
|
+
};
|
|
6462
6621
|
|
|
6463
6622
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6464
|
-
var
|
|
6465
|
-
var
|
|
6623
|
+
var import_design_system36 = require("@uniformdev/design-system");
|
|
6624
|
+
var import_react68 = require("react");
|
|
6466
6625
|
|
|
6467
6626
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6468
|
-
var
|
|
6469
|
-
var ObjectSearchFilterContainerLabel =
|
|
6627
|
+
var import_react67 = require("@emotion/react");
|
|
6628
|
+
var ObjectSearchFilterContainerLabel = import_react67.css`
|
|
6470
6629
|
align-items: center;
|
|
6471
6630
|
display: flex;
|
|
6472
6631
|
font-size: var(--fs-sm);
|
|
@@ -6474,18 +6633,18 @@ var ObjectSearchFilterContainerLabel = import_react66.css`
|
|
|
6474
6633
|
line-height: 1rem;
|
|
6475
6634
|
margin-bottom: var(--spacing-sm);
|
|
6476
6635
|
`;
|
|
6477
|
-
var ObjectSearchFilterContainer =
|
|
6636
|
+
var ObjectSearchFilterContainer = import_react67.css`
|
|
6478
6637
|
display: grid;
|
|
6479
6638
|
gap: var(--spacing-base);
|
|
6480
6639
|
`;
|
|
6481
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6640
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react67.css`
|
|
6482
6641
|
display: grid;
|
|
6483
6642
|
grid-template-columns: ${gridColumns};
|
|
6484
6643
|
gap: var(--spacing-base);
|
|
6485
6644
|
`;
|
|
6486
6645
|
|
|
6487
6646
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6488
|
-
var
|
|
6647
|
+
var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
|
|
6489
6648
|
var ObjectSearchFilter = ({
|
|
6490
6649
|
requireContentType,
|
|
6491
6650
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6495,7 +6654,7 @@ var ObjectSearchFilter = ({
|
|
|
6495
6654
|
selectOptions
|
|
6496
6655
|
}) => {
|
|
6497
6656
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6498
|
-
const [searchState, setSearchState] = (0,
|
|
6657
|
+
const [searchState, setSearchState] = (0, import_react68.useState)({
|
|
6499
6658
|
contentType: "",
|
|
6500
6659
|
keyword: ""
|
|
6501
6660
|
});
|
|
@@ -6505,7 +6664,7 @@ var ObjectSearchFilter = ({
|
|
|
6505
6664
|
});
|
|
6506
6665
|
onSetQuery({ ...query, ...value });
|
|
6507
6666
|
};
|
|
6508
|
-
const memoizedSelectOptions = (0,
|
|
6667
|
+
const memoizedSelectOptions = (0, import_react68.useMemo)(() => {
|
|
6509
6668
|
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
6510
6669
|
return [];
|
|
6511
6670
|
}
|
|
@@ -6518,7 +6677,7 @@ var ObjectSearchFilter = ({
|
|
|
6518
6677
|
];
|
|
6519
6678
|
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6520
6679
|
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6521
|
-
return /* @__PURE__ */ (0,
|
|
6680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
6522
6681
|
"fieldset",
|
|
6523
6682
|
{
|
|
6524
6683
|
css: [
|
|
@@ -6526,8 +6685,8 @@ var ObjectSearchFilter = ({
|
|
|
6526
6685
|
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6527
6686
|
],
|
|
6528
6687
|
children: [
|
|
6529
|
-
memoizedSelectOptions.length ? /* @__PURE__ */ (0,
|
|
6530
|
-
|
|
6688
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6689
|
+
import_design_system36.InputSelect,
|
|
6531
6690
|
{
|
|
6532
6691
|
label: selectLabel,
|
|
6533
6692
|
showLabel: false,
|
|
@@ -6536,8 +6695,8 @@ var ObjectSearchFilter = ({
|
|
|
6536
6695
|
value: query.contentType
|
|
6537
6696
|
}
|
|
6538
6697
|
) : null,
|
|
6539
|
-
/* @__PURE__ */ (0,
|
|
6540
|
-
|
|
6698
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6699
|
+
import_design_system36.InputKeywordSearch,
|
|
6541
6700
|
{
|
|
6542
6701
|
inputFieldName: searchInputName,
|
|
6543
6702
|
placeholder: searchInputPlaceholderText,
|
|
@@ -6553,154 +6712,14 @@ var ObjectSearchFilter = ({
|
|
|
6553
6712
|
};
|
|
6554
6713
|
|
|
6555
6714
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6556
|
-
var
|
|
6715
|
+
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6557
6716
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6558
|
-
return /* @__PURE__ */ (0,
|
|
6559
|
-
label ? /* @__PURE__ */ (0,
|
|
6560
|
-
/* @__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 })
|
|
6561
6720
|
] });
|
|
6562
6721
|
};
|
|
6563
6722
|
|
|
6564
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6565
|
-
var import_design_system36 = require("@uniformdev/design-system");
|
|
6566
|
-
|
|
6567
|
-
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6568
|
-
var import_react68 = require("@emotion/react");
|
|
6569
|
-
var import_design_system35 = require("@uniformdev/design-system");
|
|
6570
|
-
var ObjectListItemContainer = import_react68.css`
|
|
6571
|
-
align-items: center;
|
|
6572
|
-
border: 1px solid var(--gray-300);
|
|
6573
|
-
border-radius: var(--rounded-base);
|
|
6574
|
-
background: var(--white);
|
|
6575
|
-
display: grid;
|
|
6576
|
-
grid-template-columns: 1fr auto;
|
|
6577
|
-
padding: var(--spacing-sm);
|
|
6578
|
-
`;
|
|
6579
|
-
var ObjectListItemContainerDisabled = import_react68.css`
|
|
6580
|
-
opacity: var(--opacity-50);
|
|
6581
|
-
pointer-events: none;
|
|
6582
|
-
`;
|
|
6583
|
-
var ObjectListItemLoading = import_react68.css`
|
|
6584
|
-
animation: ${import_design_system35.skeletonLoading} 1s linear infinite alternate;
|
|
6585
|
-
border-color: transparent;
|
|
6586
|
-
min-height: 42px;
|
|
6587
|
-
position: relative;
|
|
6588
|
-
|
|
6589
|
-
&:before,
|
|
6590
|
-
&:after {
|
|
6591
|
-
background: var(--gray-200);
|
|
6592
|
-
content: '';
|
|
6593
|
-
display: block;
|
|
6594
|
-
height: 1rem;
|
|
6595
|
-
}
|
|
6596
|
-
|
|
6597
|
-
&:before {
|
|
6598
|
-
border-radius: var(--rounded-base);
|
|
6599
|
-
width: 10rem;
|
|
6600
|
-
}
|
|
6601
|
-
|
|
6602
|
-
&:after {
|
|
6603
|
-
border-radius: var(--rounded-full);
|
|
6604
|
-
width: 1rem;
|
|
6605
|
-
}
|
|
6606
|
-
`;
|
|
6607
|
-
var ObjectListItemHeadingGroup = import_react68.css`
|
|
6608
|
-
align-items: center;
|
|
6609
|
-
display: grid;
|
|
6610
|
-
`;
|
|
6611
|
-
var ObjectListItemThumbnail = import_react68.css`
|
|
6612
|
-
width: 30px;
|
|
6613
|
-
object-fit: contain;
|
|
6614
|
-
`;
|
|
6615
|
-
var ObjectListItemTitle = import_react68.css`
|
|
6616
|
-
color: var(--brand-secondary-1);
|
|
6617
|
-
display: block;
|
|
6618
|
-
font-size: var(--fs-sm);
|
|
6619
|
-
`;
|
|
6620
|
-
var ObjectListItemSubtitle = import_react68.css`
|
|
6621
|
-
color: var(--gray-500);
|
|
6622
|
-
display: block;
|
|
6623
|
-
font-size: var(--fs-xs);
|
|
6624
|
-
line-height: 1;
|
|
6625
|
-
`;
|
|
6626
|
-
var ObjectListItemInfoContainer = import_react68.css`
|
|
6627
|
-
align-items: center;
|
|
6628
|
-
display: flex;
|
|
6629
|
-
gap: var(--spacing-sm);
|
|
6630
|
-
justify-content: center;
|
|
6631
|
-
`;
|
|
6632
|
-
var ObjectListItemControlledContent = import_react68.css`
|
|
6633
|
-
display: flex;
|
|
6634
|
-
gap: var(--spacing-sm);
|
|
6635
|
-
`;
|
|
6636
|
-
var ObjectListItemUnControlledContent = import_react68.css`
|
|
6637
|
-
margin-top: var(--spacing-sm);
|
|
6638
|
-
grid-column: 1 / -1;
|
|
6639
|
-
`;
|
|
6640
|
-
|
|
6641
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6642
|
-
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6643
|
-
var ObjectSearchListItem = ({
|
|
6644
|
-
id,
|
|
6645
|
-
title,
|
|
6646
|
-
contentType,
|
|
6647
|
-
image,
|
|
6648
|
-
imageUrl,
|
|
6649
|
-
popoverData,
|
|
6650
|
-
onSelect,
|
|
6651
|
-
isMulti = false,
|
|
6652
|
-
disabled,
|
|
6653
|
-
children
|
|
6654
|
-
}) => {
|
|
6655
|
-
const { onSelectItem, selectedListItems } = useObjectSearchContext();
|
|
6656
|
-
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6657
|
-
const handleSelectItem = () => {
|
|
6658
|
-
var _a;
|
|
6659
|
-
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6660
|
-
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6661
|
-
if (isMulti) {
|
|
6662
|
-
return onSelectItem(selectedItem);
|
|
6663
|
-
}
|
|
6664
|
-
return onSelectItem([selectedItem]);
|
|
6665
|
-
};
|
|
6666
|
-
const selected = selectedListItems.some((item) => item.id === id);
|
|
6667
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6668
|
-
"div",
|
|
6669
|
-
{
|
|
6670
|
-
role: "listitem",
|
|
6671
|
-
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6672
|
-
"data-testid": "list-item",
|
|
6673
|
-
children: [
|
|
6674
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6675
|
-
"div",
|
|
6676
|
-
{
|
|
6677
|
-
role: "button",
|
|
6678
|
-
onClick: handleSelectItem,
|
|
6679
|
-
css: ObjectListItemControlledContent,
|
|
6680
|
-
"aria-disabled": disabled,
|
|
6681
|
-
children: [
|
|
6682
|
-
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6683
|
-
!image || imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6684
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6685
|
-
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6686
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6687
|
-
] })
|
|
6688
|
-
]
|
|
6689
|
-
}
|
|
6690
|
-
),
|
|
6691
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
6692
|
-
selected ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Chip, { text: "selected", size: "xs" }) : null,
|
|
6693
|
-
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6694
|
-
] }),
|
|
6695
|
-
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6696
|
-
]
|
|
6697
|
-
}
|
|
6698
|
-
);
|
|
6699
|
-
};
|
|
6700
|
-
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6701
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6702
|
-
};
|
|
6703
|
-
|
|
6704
6723
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6705
6724
|
var import_design_system38 = require("@uniformdev/design-system");
|
|
6706
6725
|
var import_timeago3 = require("timeago.js");
|