@uniformdev/mesh-sdk-react 19.87.0 → 19.88.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 +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.esm.js +195 -172
- package/dist/index.js +217 -194
- package/dist/index.mjs +195 -172
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -2654,13 +2654,14 @@ function useConnectedDataAsVariables(connectedData) {
|
|
|
2654
2654
|
}
|
|
2655
2655
|
|
|
2656
2656
|
// src/hooks/useDynamicInputsAsVariables.tsx
|
|
2657
|
+
import { LOCALE_DYNAMIC_INPUT_NAME } from "@uniformdev/canvas";
|
|
2657
2658
|
import { useMemo as useMemo4 } from "react";
|
|
2658
2659
|
import { Fragment as Fragment4, jsx as jsx26 } from "@emotion/react/jsx-runtime";
|
|
2659
2660
|
function useDynamicInputsAsVariables(dynamicInputs) {
|
|
2660
2661
|
return useMemo4(() => {
|
|
2661
2662
|
const result = Object.entries(dynamicInputs).reduce(
|
|
2662
2663
|
(acc, [name, input3]) => {
|
|
2663
|
-
const source = `from ${input3.type === "path" ? "URL path" : "query string"}`;
|
|
2664
|
+
const source = `from ${name === LOCALE_DYNAMIC_INPUT_NAME ? "current locale" : input3.type === "path" ? "URL path" : "query string"}`;
|
|
2664
2665
|
acc[name] = {
|
|
2665
2666
|
readOnly: true,
|
|
2666
2667
|
type: input3.type,
|
|
@@ -2944,6 +2945,7 @@ function VariableChip({
|
|
|
2944
2945
|
tooltip,
|
|
2945
2946
|
reference,
|
|
2946
2947
|
onClick,
|
|
2948
|
+
clickToEdit,
|
|
2947
2949
|
isFresh,
|
|
2948
2950
|
selected,
|
|
2949
2951
|
disabled
|
|
@@ -2951,7 +2953,7 @@ function VariableChip({
|
|
|
2951
2953
|
const hasClickEvent = !!onClick;
|
|
2952
2954
|
const referenceIsValidFr = isFresh ? true : referenceIsValid;
|
|
2953
2955
|
const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? Fragment5 : UndefinedVariableReference;
|
|
2954
|
-
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent ? "Click to edit" : void 0;
|
|
2956
|
+
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
|
|
2955
2957
|
return /* @__PURE__ */ jsx29(
|
|
2956
2958
|
MultilineChip,
|
|
2957
2959
|
{
|
|
@@ -3968,6 +3970,7 @@ function VariableNodeComponent({
|
|
|
3968
3970
|
displayName: state.isLoading ? /* @__PURE__ */ jsx33(LoadingIndicator2, { size: "sm" }) : state.displayName,
|
|
3969
3971
|
selected: isSelected,
|
|
3970
3972
|
disabled: readOnly,
|
|
3973
|
+
clickToEdit: state.hasClickEvent,
|
|
3971
3974
|
onClick: state.hasClickEvent ? () => {
|
|
3972
3975
|
setSelected(!isSelected);
|
|
3973
3976
|
editor.dispatchCommand(EDIT_VARIABLE_COMMAND, {
|
|
@@ -4459,6 +4462,7 @@ function VariablesComposer(props) {
|
|
|
4459
4462
|
/* @__PURE__ */ jsx37(
|
|
4460
4463
|
OnChangePlugin,
|
|
4461
4464
|
{
|
|
4465
|
+
ignoreSelectionChange: true,
|
|
4462
4466
|
onChange: (state) => {
|
|
4463
4467
|
editorState.current = state;
|
|
4464
4468
|
if (updateTimeout.current) {
|
|
@@ -6140,9 +6144,9 @@ var DataRefreshButton = ({
|
|
|
6140
6144
|
};
|
|
6141
6145
|
|
|
6142
6146
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6143
|
-
import { css as
|
|
6147
|
+
import { css as css32 } from "@emotion/react";
|
|
6144
6148
|
import { bindVariables } from "@uniformdev/canvas";
|
|
6145
|
-
import { Container, IconsProvider, ScrollableList, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
|
|
6149
|
+
import { Callout as Callout5, Container, IconsProvider, ScrollableList, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
|
|
6146
6150
|
|
|
6147
6151
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6148
6152
|
import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
|
|
@@ -6167,9 +6171,14 @@ var ObjectSearchContext = createContext5({
|
|
|
6167
6171
|
},
|
|
6168
6172
|
selectedListItems: [],
|
|
6169
6173
|
onRemoveAllSelectedItems: () => {
|
|
6170
|
-
}
|
|
6174
|
+
},
|
|
6175
|
+
isMulti: false
|
|
6171
6176
|
});
|
|
6172
|
-
var ObjectSearchProvider = ({
|
|
6177
|
+
var ObjectSearchProvider = ({
|
|
6178
|
+
currentlySelectedItems,
|
|
6179
|
+
isMulti = false,
|
|
6180
|
+
children
|
|
6181
|
+
}) => {
|
|
6173
6182
|
const [query, setQuery] = useState15({
|
|
6174
6183
|
contentType: "",
|
|
6175
6184
|
keyword: ""
|
|
@@ -6223,6 +6232,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6223
6232
|
selectedListItems: selectedItems,
|
|
6224
6233
|
onRemoveAllSelectedItems,
|
|
6225
6234
|
list,
|
|
6235
|
+
isMulti,
|
|
6226
6236
|
onSetList
|
|
6227
6237
|
}),
|
|
6228
6238
|
[
|
|
@@ -6233,6 +6243,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6233
6243
|
selectedItems,
|
|
6234
6244
|
onRemoveAllSelectedItems,
|
|
6235
6245
|
list,
|
|
6246
|
+
isMulti,
|
|
6236
6247
|
onSetList
|
|
6237
6248
|
]
|
|
6238
6249
|
);
|
|
@@ -6253,8 +6264,148 @@ function bindQuery(query, inputs) {
|
|
|
6253
6264
|
return result;
|
|
6254
6265
|
}
|
|
6255
6266
|
|
|
6256
|
-
// src/components/ObjectSearch/
|
|
6267
|
+
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6268
|
+
import { Chip, Popover } from "@uniformdev/design-system";
|
|
6269
|
+
|
|
6270
|
+
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6271
|
+
import { css as css31 } from "@emotion/react";
|
|
6272
|
+
import { skeletonLoading } from "@uniformdev/design-system";
|
|
6273
|
+
var ObjectListItemContainer = css31`
|
|
6274
|
+
align-items: center;
|
|
6275
|
+
border: 1px solid var(--gray-300);
|
|
6276
|
+
border-radius: var(--rounded-base);
|
|
6277
|
+
background: var(--white);
|
|
6278
|
+
display: grid;
|
|
6279
|
+
grid-template-columns: 1fr auto;
|
|
6280
|
+
padding: var(--spacing-sm);
|
|
6281
|
+
`;
|
|
6282
|
+
var ObjectListItemContainerDisabled = css31`
|
|
6283
|
+
opacity: var(--opacity-50);
|
|
6284
|
+
pointer-events: none;
|
|
6285
|
+
`;
|
|
6286
|
+
var ObjectListItemLoading = css31`
|
|
6287
|
+
animation: ${skeletonLoading} 1s linear infinite alternate;
|
|
6288
|
+
border-color: transparent;
|
|
6289
|
+
min-height: 42px;
|
|
6290
|
+
position: relative;
|
|
6291
|
+
|
|
6292
|
+
&:before,
|
|
6293
|
+
&:after {
|
|
6294
|
+
background: var(--gray-200);
|
|
6295
|
+
content: '';
|
|
6296
|
+
display: block;
|
|
6297
|
+
height: 1rem;
|
|
6298
|
+
}
|
|
6299
|
+
|
|
6300
|
+
&:before {
|
|
6301
|
+
border-radius: var(--rounded-base);
|
|
6302
|
+
width: 10rem;
|
|
6303
|
+
}
|
|
6304
|
+
|
|
6305
|
+
&:after {
|
|
6306
|
+
border-radius: var(--rounded-full);
|
|
6307
|
+
width: 1rem;
|
|
6308
|
+
}
|
|
6309
|
+
`;
|
|
6310
|
+
var ObjectListItemHeadingGroup = css31`
|
|
6311
|
+
align-items: center;
|
|
6312
|
+
display: grid;
|
|
6313
|
+
`;
|
|
6314
|
+
var ObjectListItemThumbnail = css31`
|
|
6315
|
+
width: 30px;
|
|
6316
|
+
object-fit: contain;
|
|
6317
|
+
`;
|
|
6318
|
+
var ObjectListItemTitle = css31`
|
|
6319
|
+
color: var(--brand-secondary-1);
|
|
6320
|
+
display: block;
|
|
6321
|
+
font-size: var(--fs-sm);
|
|
6322
|
+
`;
|
|
6323
|
+
var ObjectListItemSubtitle = css31`
|
|
6324
|
+
color: var(--gray-500);
|
|
6325
|
+
display: block;
|
|
6326
|
+
font-size: var(--fs-xs);
|
|
6327
|
+
line-height: 1;
|
|
6328
|
+
`;
|
|
6329
|
+
var ObjectListItemInfoContainer = css31`
|
|
6330
|
+
align-items: center;
|
|
6331
|
+
display: flex;
|
|
6332
|
+
gap: var(--spacing-sm);
|
|
6333
|
+
justify-content: center;
|
|
6334
|
+
`;
|
|
6335
|
+
var ObjectListItemControlledContent = css31`
|
|
6336
|
+
display: flex;
|
|
6337
|
+
gap: var(--spacing-sm);
|
|
6338
|
+
`;
|
|
6339
|
+
var ObjectListItemUnControlledContent = css31`
|
|
6340
|
+
margin-top: var(--spacing-sm);
|
|
6341
|
+
grid-column: 1 / -1;
|
|
6342
|
+
`;
|
|
6343
|
+
|
|
6344
|
+
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6257
6345
|
import { jsx as jsx59, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
|
|
6346
|
+
var ObjectSearchListItem = ({
|
|
6347
|
+
id,
|
|
6348
|
+
title,
|
|
6349
|
+
contentType,
|
|
6350
|
+
image,
|
|
6351
|
+
imageUrl,
|
|
6352
|
+
popoverData,
|
|
6353
|
+
onSelect,
|
|
6354
|
+
isMulti,
|
|
6355
|
+
disabled,
|
|
6356
|
+
children
|
|
6357
|
+
}) => {
|
|
6358
|
+
const { onSelectItem, selectedListItems, isMulti: globalIsMulti } = useObjectSearchContext();
|
|
6359
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6360
|
+
const handleSelectItem = () => {
|
|
6361
|
+
var _a;
|
|
6362
|
+
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6363
|
+
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6364
|
+
if (isMulti === true || globalIsMulti) {
|
|
6365
|
+
return onSelectItem(selectedItem);
|
|
6366
|
+
}
|
|
6367
|
+
return onSelectItem([selectedItem]);
|
|
6368
|
+
};
|
|
6369
|
+
const selected = selectedListItems.some((item) => item.id === id);
|
|
6370
|
+
return /* @__PURE__ */ jsxs34(
|
|
6371
|
+
"div",
|
|
6372
|
+
{
|
|
6373
|
+
role: "listitem",
|
|
6374
|
+
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6375
|
+
"data-testid": "list-item",
|
|
6376
|
+
children: [
|
|
6377
|
+
/* @__PURE__ */ jsxs34(
|
|
6378
|
+
"div",
|
|
6379
|
+
{
|
|
6380
|
+
role: "button",
|
|
6381
|
+
onClick: handleSelectItem,
|
|
6382
|
+
css: ObjectListItemControlledContent,
|
|
6383
|
+
"aria-disabled": disabled,
|
|
6384
|
+
children: [
|
|
6385
|
+
!imageUrl ? null : /* @__PURE__ */ jsx59("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6386
|
+
!image || imageUrl ? null : /* @__PURE__ */ jsx59("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6387
|
+
/* @__PURE__ */ jsxs34("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6388
|
+
!contentType ? null : /* @__PURE__ */ jsx59("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6389
|
+
/* @__PURE__ */ jsx59("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6390
|
+
] })
|
|
6391
|
+
]
|
|
6392
|
+
}
|
|
6393
|
+
),
|
|
6394
|
+
/* @__PURE__ */ jsxs34("div", { css: ObjectListItemInfoContainer, children: [
|
|
6395
|
+
selected ? /* @__PURE__ */ jsx59(Chip, { text: "selected", size: "xs" }) : null,
|
|
6396
|
+
!popoverData ? null : /* @__PURE__ */ jsx59(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6397
|
+
] }),
|
|
6398
|
+
!children ? null : /* @__PURE__ */ jsx59("div", { css: ObjectListItemUnControlledContent, children })
|
|
6399
|
+
]
|
|
6400
|
+
}
|
|
6401
|
+
);
|
|
6402
|
+
};
|
|
6403
|
+
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6404
|
+
return /* @__PURE__ */ jsx59("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6405
|
+
};
|
|
6406
|
+
|
|
6407
|
+
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6408
|
+
import { jsx as jsx60, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
|
|
6258
6409
|
var ObjectSearchContainer = ({
|
|
6259
6410
|
label,
|
|
6260
6411
|
enableDynamicInputToResultId,
|
|
@@ -6266,19 +6417,20 @@ var ObjectSearchContainer = ({
|
|
|
6266
6417
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6267
6418
|
const { flatVariables } = useVariables(true);
|
|
6268
6419
|
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6269
|
-
const
|
|
6420
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx60(DefaultResultList, {});
|
|
6421
|
+
const body = /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
|
|
6270
6422
|
searchFilters,
|
|
6271
|
-
|
|
6423
|
+
/* @__PURE__ */ jsx60(
|
|
6272
6424
|
ScrollableList,
|
|
6273
6425
|
{
|
|
6274
6426
|
role: "list",
|
|
6275
|
-
css:
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
children:
|
|
6427
|
+
css: css32`
|
|
6428
|
+
> div {
|
|
6429
|
+
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6430
|
+
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6431
|
+
}
|
|
6432
|
+
`,
|
|
6433
|
+
children: listItems
|
|
6282
6434
|
}
|
|
6283
6435
|
)
|
|
6284
6436
|
] });
|
|
@@ -6309,8 +6461,8 @@ var ObjectSearchContainer = ({
|
|
|
6309
6461
|
}
|
|
6310
6462
|
]);
|
|
6311
6463
|
};
|
|
6312
|
-
return /* @__PURE__ */
|
|
6313
|
-
/* @__PURE__ */
|
|
6464
|
+
return /* @__PURE__ */ jsx60(IconsProvider, { children: /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
|
|
6465
|
+
/* @__PURE__ */ jsx60(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx60(
|
|
6314
6466
|
InputVariables,
|
|
6315
6467
|
{
|
|
6316
6468
|
label,
|
|
@@ -6328,14 +6480,25 @@ var ObjectSearchContainer = ({
|
|
|
6328
6480
|
children
|
|
6329
6481
|
] }) });
|
|
6330
6482
|
};
|
|
6483
|
+
var DefaultResultList = () => {
|
|
6484
|
+
var _a;
|
|
6485
|
+
const { list } = useObjectSearchContext();
|
|
6486
|
+
if (!list.items) {
|
|
6487
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx60(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
6488
|
+
}
|
|
6489
|
+
if (list.items.length === 0) {
|
|
6490
|
+
return /* @__PURE__ */ jsx60(Callout5, { type: "info", children: "No results were found" });
|
|
6491
|
+
}
|
|
6492
|
+
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx60(ObjectSearchListItem, { ...item }, item.id));
|
|
6493
|
+
};
|
|
6331
6494
|
|
|
6332
6495
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6333
6496
|
import { InputKeywordSearch as InputKeywordSearch2, InputSelect as InputSelect6 } from "@uniformdev/design-system";
|
|
6334
6497
|
import { useMemo as useMemo15, useState as useState16 } from "react";
|
|
6335
6498
|
|
|
6336
6499
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6337
|
-
import { css as
|
|
6338
|
-
var ObjectSearchFilterContainerLabel =
|
|
6500
|
+
import { css as css33 } from "@emotion/react";
|
|
6501
|
+
var ObjectSearchFilterContainerLabel = css33`
|
|
6339
6502
|
align-items: center;
|
|
6340
6503
|
display: flex;
|
|
6341
6504
|
font-size: var(--fs-sm);
|
|
@@ -6343,18 +6506,18 @@ var ObjectSearchFilterContainerLabel = css32`
|
|
|
6343
6506
|
line-height: 1rem;
|
|
6344
6507
|
margin-bottom: var(--spacing-sm);
|
|
6345
6508
|
`;
|
|
6346
|
-
var ObjectSearchFilterContainer =
|
|
6509
|
+
var ObjectSearchFilterContainer = css33`
|
|
6347
6510
|
display: grid;
|
|
6348
6511
|
gap: var(--spacing-base);
|
|
6349
6512
|
`;
|
|
6350
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6513
|
+
var ObjectSearchFilterGrid = (gridColumns) => css33`
|
|
6351
6514
|
display: grid;
|
|
6352
6515
|
grid-template-columns: ${gridColumns};
|
|
6353
6516
|
gap: var(--spacing-base);
|
|
6354
6517
|
`;
|
|
6355
6518
|
|
|
6356
6519
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6357
|
-
import { jsx as
|
|
6520
|
+
import { jsx as jsx61, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
|
|
6358
6521
|
var ObjectSearchFilter = ({
|
|
6359
6522
|
requireContentType,
|
|
6360
6523
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6387,7 +6550,7 @@ var ObjectSearchFilter = ({
|
|
|
6387
6550
|
];
|
|
6388
6551
|
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6389
6552
|
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6390
|
-
return /* @__PURE__ */
|
|
6553
|
+
return /* @__PURE__ */ jsxs36(
|
|
6391
6554
|
"fieldset",
|
|
6392
6555
|
{
|
|
6393
6556
|
css: [
|
|
@@ -6395,7 +6558,7 @@ var ObjectSearchFilter = ({
|
|
|
6395
6558
|
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6396
6559
|
],
|
|
6397
6560
|
children: [
|
|
6398
|
-
memoizedSelectOptions.length ? /* @__PURE__ */
|
|
6561
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ jsx61(
|
|
6399
6562
|
InputSelect6,
|
|
6400
6563
|
{
|
|
6401
6564
|
label: selectLabel,
|
|
@@ -6405,7 +6568,7 @@ var ObjectSearchFilter = ({
|
|
|
6405
6568
|
value: query.contentType
|
|
6406
6569
|
}
|
|
6407
6570
|
) : null,
|
|
6408
|
-
/* @__PURE__ */
|
|
6571
|
+
/* @__PURE__ */ jsx61(
|
|
6409
6572
|
InputKeywordSearch2,
|
|
6410
6573
|
{
|
|
6411
6574
|
inputFieldName: searchInputName,
|
|
@@ -6422,154 +6585,14 @@ var ObjectSearchFilter = ({
|
|
|
6422
6585
|
};
|
|
6423
6586
|
|
|
6424
6587
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6425
|
-
import { jsx as
|
|
6588
|
+
import { jsx as jsx62, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
|
|
6426
6589
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6427
|
-
return /* @__PURE__ */
|
|
6428
|
-
label ? /* @__PURE__ */
|
|
6429
|
-
/* @__PURE__ */
|
|
6590
|
+
return /* @__PURE__ */ jsxs37("div", { children: [
|
|
6591
|
+
label ? /* @__PURE__ */ jsx62("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6592
|
+
/* @__PURE__ */ jsx62("div", { css: ObjectSearchFilterContainer, children })
|
|
6430
6593
|
] });
|
|
6431
6594
|
};
|
|
6432
6595
|
|
|
6433
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6434
|
-
import { Chip, Popover } from "@uniformdev/design-system";
|
|
6435
|
-
|
|
6436
|
-
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6437
|
-
import { css as css33 } from "@emotion/react";
|
|
6438
|
-
import { skeletonLoading } from "@uniformdev/design-system";
|
|
6439
|
-
var ObjectListItemContainer = css33`
|
|
6440
|
-
align-items: center;
|
|
6441
|
-
border: 1px solid var(--gray-300);
|
|
6442
|
-
border-radius: var(--rounded-base);
|
|
6443
|
-
background: var(--white);
|
|
6444
|
-
display: grid;
|
|
6445
|
-
grid-template-columns: 1fr auto;
|
|
6446
|
-
padding: var(--spacing-sm);
|
|
6447
|
-
`;
|
|
6448
|
-
var ObjectListItemContainerDisabled = css33`
|
|
6449
|
-
opacity: var(--opacity-50);
|
|
6450
|
-
pointer-events: none;
|
|
6451
|
-
`;
|
|
6452
|
-
var ObjectListItemLoading = css33`
|
|
6453
|
-
animation: ${skeletonLoading} 1s linear infinite alternate;
|
|
6454
|
-
border-color: transparent;
|
|
6455
|
-
min-height: 42px;
|
|
6456
|
-
position: relative;
|
|
6457
|
-
|
|
6458
|
-
&:before,
|
|
6459
|
-
&:after {
|
|
6460
|
-
background: var(--gray-200);
|
|
6461
|
-
content: '';
|
|
6462
|
-
display: block;
|
|
6463
|
-
height: 1rem;
|
|
6464
|
-
}
|
|
6465
|
-
|
|
6466
|
-
&:before {
|
|
6467
|
-
border-radius: var(--rounded-base);
|
|
6468
|
-
width: 10rem;
|
|
6469
|
-
}
|
|
6470
|
-
|
|
6471
|
-
&:after {
|
|
6472
|
-
border-radius: var(--rounded-full);
|
|
6473
|
-
width: 1rem;
|
|
6474
|
-
}
|
|
6475
|
-
`;
|
|
6476
|
-
var ObjectListItemHeadingGroup = css33`
|
|
6477
|
-
align-items: center;
|
|
6478
|
-
display: grid;
|
|
6479
|
-
`;
|
|
6480
|
-
var ObjectListItemThumbnail = css33`
|
|
6481
|
-
width: 30px;
|
|
6482
|
-
object-fit: contain;
|
|
6483
|
-
`;
|
|
6484
|
-
var ObjectListItemTitle = css33`
|
|
6485
|
-
color: var(--brand-secondary-1);
|
|
6486
|
-
display: block;
|
|
6487
|
-
font-size: var(--fs-sm);
|
|
6488
|
-
`;
|
|
6489
|
-
var ObjectListItemSubtitle = css33`
|
|
6490
|
-
color: var(--gray-500);
|
|
6491
|
-
display: block;
|
|
6492
|
-
font-size: var(--fs-xs);
|
|
6493
|
-
line-height: 1;
|
|
6494
|
-
`;
|
|
6495
|
-
var ObjectListItemInfoContainer = css33`
|
|
6496
|
-
align-items: center;
|
|
6497
|
-
display: flex;
|
|
6498
|
-
gap: var(--spacing-sm);
|
|
6499
|
-
justify-content: center;
|
|
6500
|
-
`;
|
|
6501
|
-
var ObjectListItemControlledContent = css33`
|
|
6502
|
-
display: flex;
|
|
6503
|
-
gap: var(--spacing-sm);
|
|
6504
|
-
`;
|
|
6505
|
-
var ObjectListItemUnControlledContent = css33`
|
|
6506
|
-
margin-top: var(--spacing-sm);
|
|
6507
|
-
grid-column: 1 / -1;
|
|
6508
|
-
`;
|
|
6509
|
-
|
|
6510
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6511
|
-
import { jsx as jsx62, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
|
|
6512
|
-
var ObjectSearchListItem = ({
|
|
6513
|
-
id,
|
|
6514
|
-
title,
|
|
6515
|
-
contentType,
|
|
6516
|
-
image,
|
|
6517
|
-
imageUrl,
|
|
6518
|
-
popoverData,
|
|
6519
|
-
onSelect,
|
|
6520
|
-
isMulti = false,
|
|
6521
|
-
disabled,
|
|
6522
|
-
children
|
|
6523
|
-
}) => {
|
|
6524
|
-
const { onSelectItem, selectedListItems } = useObjectSearchContext();
|
|
6525
|
-
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6526
|
-
const handleSelectItem = () => {
|
|
6527
|
-
var _a;
|
|
6528
|
-
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6529
|
-
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6530
|
-
if (isMulti) {
|
|
6531
|
-
return onSelectItem(selectedItem);
|
|
6532
|
-
}
|
|
6533
|
-
return onSelectItem([selectedItem]);
|
|
6534
|
-
};
|
|
6535
|
-
const selected = selectedListItems.some((item) => item.id === id);
|
|
6536
|
-
return /* @__PURE__ */ jsxs37(
|
|
6537
|
-
"div",
|
|
6538
|
-
{
|
|
6539
|
-
role: "listitem",
|
|
6540
|
-
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6541
|
-
"data-testid": "list-item",
|
|
6542
|
-
children: [
|
|
6543
|
-
/* @__PURE__ */ jsxs37(
|
|
6544
|
-
"div",
|
|
6545
|
-
{
|
|
6546
|
-
role: "button",
|
|
6547
|
-
onClick: handleSelectItem,
|
|
6548
|
-
css: ObjectListItemControlledContent,
|
|
6549
|
-
"aria-disabled": disabled,
|
|
6550
|
-
children: [
|
|
6551
|
-
!imageUrl ? null : /* @__PURE__ */ jsx62("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6552
|
-
!image || imageUrl ? null : /* @__PURE__ */ jsx62("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6553
|
-
/* @__PURE__ */ jsxs37("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6554
|
-
!contentType ? null : /* @__PURE__ */ jsx62("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6555
|
-
/* @__PURE__ */ jsx62("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6556
|
-
] })
|
|
6557
|
-
]
|
|
6558
|
-
}
|
|
6559
|
-
),
|
|
6560
|
-
/* @__PURE__ */ jsxs37("div", { css: ObjectListItemInfoContainer, children: [
|
|
6561
|
-
selected ? /* @__PURE__ */ jsx62(Chip, { text: "selected", size: "xs" }) : null,
|
|
6562
|
-
!popoverData ? null : /* @__PURE__ */ jsx62(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6563
|
-
] }),
|
|
6564
|
-
!children ? null : /* @__PURE__ */ jsx62("div", { css: ObjectListItemUnControlledContent, children })
|
|
6565
|
-
]
|
|
6566
|
-
}
|
|
6567
|
-
);
|
|
6568
|
-
};
|
|
6569
|
-
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6570
|
-
return /* @__PURE__ */ jsx62("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6571
|
-
};
|
|
6572
|
-
|
|
6573
6596
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6574
6597
|
import { Badge, Button as Button4, Popover as Popover2 } from "@uniformdev/design-system";
|
|
6575
6598
|
import { format as timeagoFormat } from "timeago.js";
|
|
@@ -7113,7 +7136,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
7113
7136
|
import {
|
|
7114
7137
|
AddListButton as AddListButton2,
|
|
7115
7138
|
Button as Button6,
|
|
7116
|
-
Callout as
|
|
7139
|
+
Callout as Callout6,
|
|
7117
7140
|
DrawerContent,
|
|
7118
7141
|
Heading,
|
|
7119
7142
|
Input as Input6,
|
|
@@ -7152,7 +7175,7 @@ export {
|
|
|
7152
7175
|
$isVariableNode,
|
|
7153
7176
|
AddListButton2 as AddListButton,
|
|
7154
7177
|
Button6 as Button,
|
|
7155
|
-
|
|
7178
|
+
Callout6 as Callout,
|
|
7156
7179
|
ControlledValuePlugin,
|
|
7157
7180
|
DISCONNECT_VARIABLE_COMMAND,
|
|
7158
7181
|
DamSelectedItem,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.88.1-alpha.7+69b3ccba4",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK for React",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@lexical/selection": "^0.12.0",
|
|
51
51
|
"@lexical/utils": "^0.12.0",
|
|
52
52
|
"@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v4.10.1/react-icons-all-files-4.10.1.tgz",
|
|
53
|
-
"@uniformdev/canvas": "19.
|
|
54
|
-
"@uniformdev/design-system": "19.
|
|
55
|
-
"@uniformdev/mesh-sdk": "19.
|
|
53
|
+
"@uniformdev/canvas": "19.88.1-alpha.7+69b3ccba4",
|
|
54
|
+
"@uniformdev/design-system": "19.88.1-alpha.7+69b3ccba4",
|
|
55
|
+
"@uniformdev/mesh-sdk": "19.88.1-alpha.7+69b3ccba4",
|
|
56
56
|
"dequal": "^2.0.3",
|
|
57
57
|
"lexical": "^0.12.0",
|
|
58
58
|
"mitt": "^3.0.0",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "69b3ccba4050c4ff412c4f226f54a36d74cf9a39"
|
|
90
90
|
}
|