@neurodyn/react-room-viewer 0.0.20 → 0.0.21
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.js +47 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1088,6 +1088,13 @@ var __webpack_modules__ = {
|
|
|
1088
1088
|
overflow: hidden;
|
|
1089
1089
|
}
|
|
1090
1090
|
|
|
1091
|
+
.line-clamp-3 {
|
|
1092
|
+
-webkit-line-clamp: 3;
|
|
1093
|
+
-webkit-box-orient: vertical;
|
|
1094
|
+
display: -webkit-box;
|
|
1095
|
+
overflow: hidden;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1091
1098
|
.block {
|
|
1092
1099
|
display: block;
|
|
1093
1100
|
}
|
|
@@ -2957,6 +2964,10 @@ var __webpack_modules__ = {
|
|
|
2957
2964
|
overflow-wrap: break-word;
|
|
2958
2965
|
}
|
|
2959
2966
|
|
|
2967
|
+
.wrap-anywhere {
|
|
2968
|
+
overflow-wrap: anywhere;
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2960
2971
|
.whitespace-nowrap {
|
|
2961
2972
|
white-space: nowrap;
|
|
2962
2973
|
}
|
|
@@ -3428,6 +3439,10 @@ var __webpack_modules__ = {
|
|
|
3428
3439
|
scale: var(--tw-scale-x) var(--tw-scale-y);
|
|
3429
3440
|
}
|
|
3430
3441
|
|
|
3442
|
+
.group-hover\\:border-icons-normal:is(:where(.group):hover *) {
|
|
3443
|
+
border-color: var(--v-icons-normal);
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3431
3446
|
.group-hover\\:opacity-100:is(:where(.group):hover *) {
|
|
3432
3447
|
opacity: 1;
|
|
3433
3448
|
}
|
|
@@ -3772,10 +3787,6 @@ var __webpack_modules__ = {
|
|
|
3772
3787
|
}
|
|
3773
3788
|
}
|
|
3774
3789
|
|
|
3775
|
-
.hover\\:border-icons-normal:hover {
|
|
3776
|
-
border-color: var(--v-icons-normal);
|
|
3777
|
-
}
|
|
3778
|
-
|
|
3779
3790
|
.hover\\:bg-accent:hover {
|
|
3780
3791
|
background-color: var(--accent);
|
|
3781
3792
|
}
|
|
@@ -8857,6 +8868,10 @@ const RESOURCE_IDENTITY_ANSWERS = {
|
|
|
8857
8868
|
function resolveResourceIdentityAnswers(type) {
|
|
8858
8869
|
return RESOURCE_IDENTITY_ANSWERS[resolveResourceProfile(type).identity];
|
|
8859
8870
|
}
|
|
8871
|
+
function getResourceProductName(type, object, material, fallback = '') {
|
|
8872
|
+
const { namesProduct } = resolveMaterialRoleAnswers(type);
|
|
8873
|
+
return namesProduct ? material?.name ?? object?.name ?? object?.kit?.name ?? fallback : object?.kit?.name ?? object?.name ?? material?.name ?? fallback;
|
|
8874
|
+
}
|
|
8860
8875
|
function getMaterialId(material) {
|
|
8861
8876
|
return material.hid ?? '';
|
|
8862
8877
|
}
|
|
@@ -8939,7 +8954,7 @@ function useRoomViewerWallResourceMaterialOptions() {
|
|
|
8939
8954
|
}
|
|
8940
8955
|
function useRoomViewerMaterialCatalog({ includeEmbeddedObject = false } = {}) {
|
|
8941
8956
|
const { material, tinuuid, embeddedObject, selectedObject, setMaterial, setTinuuid, apiKey, baseURL, source, widgetSession, setAccessError, setLoadError } = useRoomViewerResource();
|
|
8942
|
-
const { type } = useRoomViewerMetadata();
|
|
8957
|
+
const { type, name } = useRoomViewerMetadata();
|
|
8943
8958
|
const ownerUuid = embeddedObject?.owner?.uuid;
|
|
8944
8959
|
const { data, error, isFetchingNextPage, fetchNextPage, hasNextPage, isLoading } = useInfiniteQuery({
|
|
8945
8960
|
queryKey: roomViewerOwnerObjectsQueryKey(ownerUuid, {
|
|
@@ -9031,6 +9046,7 @@ function useRoomViewerMaterialCatalog({ includeEmbeddedObject = false } = {}) {
|
|
|
9031
9046
|
return {
|
|
9032
9047
|
materialId,
|
|
9033
9048
|
name: ('material-name' === catalogLabel ? material.name : object.kit?.name ?? object.name) ?? material.name ?? '',
|
|
9049
|
+
productName: getResourceProductName(type, object, material, name),
|
|
9034
9050
|
material,
|
|
9035
9051
|
tinuuid: object.tinuuid
|
|
9036
9052
|
};
|
|
@@ -9039,7 +9055,9 @@ function useRoomViewerMaterialCatalog({ includeEmbeddedObject = false } = {}) {
|
|
|
9039
9055
|
catalogsEveryMaterial,
|
|
9040
9056
|
catalogLabel,
|
|
9041
9057
|
composition,
|
|
9042
|
-
objects
|
|
9058
|
+
objects,
|
|
9059
|
+
type,
|
|
9060
|
+
name
|
|
9043
9061
|
]);
|
|
9044
9062
|
const selectedCollection = 'color-design' === composition && selectedObject?.tinuuid === tinuuid && selectedObject?.kit?.uuid ? objects.find((object)=>getCollapseKey(object) === getCollapseKey(selectedObject)) : void 0;
|
|
9045
9063
|
const selectedMaterialId = selectedCollection?.tinuuid !== tinuuid && selectedCollection ? getMaterialId(selectedCollection.materials?.[0] ?? {}) : material ? getMaterialId(material) : '';
|
|
@@ -18602,14 +18620,14 @@ function MaterialSelectionContent({ className, gridClassName, titleClassName, on
|
|
|
18602
18620
|
className: "grid min-h-max grid-cols-3 gap-x-2 gap-y-2",
|
|
18603
18621
|
"data-testid": "material-selection-grid-items",
|
|
18604
18622
|
children: [
|
|
18605
|
-
materialItems.map(({ materialId, material, tinuuid,
|
|
18623
|
+
materialItems.map(({ materialId, material, tinuuid, productName })=>{
|
|
18606
18624
|
const isSelected = materialId === selectedMaterialId;
|
|
18607
18625
|
const previewUrl = getMaterialPreviewUrl(material);
|
|
18608
18626
|
return /*#__PURE__*/ jsxs("button", {
|
|
18609
18627
|
type: "button",
|
|
18610
18628
|
"data-selected": isSelected,
|
|
18611
18629
|
"aria-pressed": isSelected,
|
|
18612
|
-
className:
|
|
18630
|
+
className: "group flex min-w-0 flex-col gap-1 rounded-lg bg-background-containers text-left focus-visible:ring-2 focus-visible:ring-icons-normal focus-visible:outline-hidden",
|
|
18613
18631
|
onClick: ()=>handleSelectMaterial(materialId),
|
|
18614
18632
|
onKeyDown: (event)=>{
|
|
18615
18633
|
if ('Enter' === event.key || ' ' === event.key) {
|
|
@@ -18618,23 +18636,28 @@ function MaterialSelectionContent({ className, gridClassName, titleClassName, on
|
|
|
18618
18636
|
}
|
|
18619
18637
|
},
|
|
18620
18638
|
children: [
|
|
18621
|
-
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18639
|
+
/*#__PURE__*/ jsxs("span", {
|
|
18640
|
+
className: "relative grid aspect-square w-full shrink-0 place-items-center overflow-hidden rounded-lg border border-border p-1 transition group-hover:border-icons-normal",
|
|
18641
|
+
children: [
|
|
18642
|
+
previewUrl ? /*#__PURE__*/ jsx_runtime_jsx("img", {
|
|
18643
|
+
src: previewUrl,
|
|
18644
|
+
alt: "",
|
|
18645
|
+
className: "size-full rounded-md object-cover"
|
|
18646
|
+
}) : /*#__PURE__*/ jsx_runtime_jsx(image_Image, {
|
|
18647
|
+
className: "size-6 text-icons-normal"
|
|
18648
|
+
}),
|
|
18649
|
+
isSelected && /*#__PURE__*/ jsx_runtime_jsx("span", {
|
|
18650
|
+
className: "absolute top-1 right-1 grid size-6 place-items-center rounded-full bg-icons-blue text-icons-white",
|
|
18651
|
+
"data-testid": "material-selection-selected-check",
|
|
18652
|
+
children: /*#__PURE__*/ jsx_runtime_jsx(CheckDone, {
|
|
18653
|
+
className: "size-4"
|
|
18654
|
+
})
|
|
18655
|
+
})
|
|
18656
|
+
]
|
|
18627
18657
|
}),
|
|
18628
18658
|
/*#__PURE__*/ jsx_runtime_jsx("span", {
|
|
18629
|
-
className: "
|
|
18630
|
-
children:
|
|
18631
|
-
}),
|
|
18632
|
-
isSelected && /*#__PURE__*/ jsx_runtime_jsx("span", {
|
|
18633
|
-
className: "absolute top-1 right-1 grid size-6 place-items-center rounded-full bg-icons-blue text-icons-white",
|
|
18634
|
-
"data-testid": "material-selection-selected-check",
|
|
18635
|
-
children: /*#__PURE__*/ jsx_runtime_jsx(CheckDone, {
|
|
18636
|
-
className: "size-4"
|
|
18637
|
-
})
|
|
18659
|
+
className: "typo-base-12 line-clamp-3 w-full wrap-anywhere text-text-base",
|
|
18660
|
+
children: productName
|
|
18638
18661
|
})
|
|
18639
18662
|
]
|
|
18640
18663
|
}, `${tinuuid}-${materialId}`);
|
|
@@ -19220,7 +19243,6 @@ function ProductCardSlot_getMaterialPreviewUrl(material) {
|
|
|
19220
19243
|
function ProductCardSlot({ actions, band, slot, presentation }) {
|
|
19221
19244
|
const { t } = useTranslation();
|
|
19222
19245
|
const { displayUnit, name, type } = useRoomViewerMetadata();
|
|
19223
|
-
const { namesProduct } = resolveMaterialRoleAnswers(type);
|
|
19224
19246
|
const { containerRef } = useRoomViewerSceneState();
|
|
19225
19247
|
const { material, selectedObject, tinuuid } = useRoomViewerResource();
|
|
19226
19248
|
const { variantItems, selectedTinuuid, selectVariant } = useRoomViewerVariantCatalog();
|
|
@@ -19228,7 +19250,7 @@ function ProductCardSlot({ actions, band, slot, presentation }) {
|
|
|
19228
19250
|
const unitLabel = t(`units.${displayUnit}`);
|
|
19229
19251
|
const isOpen = actions.isMaterialSelectionOpen;
|
|
19230
19252
|
const actionLabel = isOpen ? t('floor.scene.hideCatalog') : t(`resourceType.${type}.${presentation.actionLabelResourceTypeKey}`);
|
|
19231
|
-
const materialName =
|
|
19253
|
+
const materialName = getResourceProductName(type, selectedObject, material, name);
|
|
19232
19254
|
const previewUrl = ProductCardSlot_getMaterialPreviewUrl(material) ?? selectedObject?.preview?.subRes?.small ?? selectedObject?.preview?.url ?? selectedObject?.mainPreview;
|
|
19233
19255
|
const selectedVariant = variantItems.find((item)=>item.tinuuid === selectedTinuuid);
|
|
19234
19256
|
const isVariantSelectionCurrent = Boolean(selectedVariant);
|