@dmsi/wedgekit-react 0.0.441 → 0.0.442
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/{chunk-IMOIZFJZ.js → chunk-DNYGKNQM.js} +1 -1
- package/dist/chunk-ETAEB3TA.js +19 -0
- package/dist/{chunk-G5DEC7H3.js → chunk-YCDDBSVU.js} +16 -23
- package/dist/components/CalendarRange.cjs +38 -40
- package/dist/components/CalendarRange.css +23 -11
- package/dist/components/CalendarRange.js +3 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +38 -40
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +23 -11
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +3 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +38 -40
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +23 -11
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +3 -3
- package/dist/components/DataGrid/PinnedColumns.cjs +38 -40
- package/dist/components/DataGrid/PinnedColumns.css +23 -11
- package/dist/components/DataGrid/PinnedColumns.js +3 -3
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +38 -40
- package/dist/components/DataGrid/TableBody/LoadingCell.css +23 -11
- package/dist/components/DataGrid/TableBody/LoadingCell.js +3 -3
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +38 -40
- package/dist/components/DataGrid/TableBody/TableBodyRow.css +23 -11
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +3 -3
- package/dist/components/DataGrid/TableBody/index.cjs +38 -40
- package/dist/components/DataGrid/TableBody/index.css +23 -11
- package/dist/components/DataGrid/TableBody/index.js +3 -3
- package/dist/components/DataGrid/index.cjs +38 -40
- package/dist/components/DataGrid/index.css +23 -11
- package/dist/components/DataGrid/index.js +3 -3
- package/dist/components/DataGrid/utils.cjs +38 -40
- package/dist/components/DataGrid/utils.css +23 -11
- package/dist/components/DataGrid/utils.js +3 -3
- package/dist/components/DateInput.cjs +38 -40
- package/dist/components/DateInput.css +23 -11
- package/dist/components/DateInput.js +3 -3
- package/dist/components/DateRangeInput.cjs +38 -40
- package/dist/components/DateRangeInput.css +23 -11
- package/dist/components/DateRangeInput.js +3 -3
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +38 -40
- package/dist/components/MobileDataGrid/ColumnSelector/index.css +23 -11
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +3 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +38 -40
- package/dist/components/MobileDataGrid/MobileDataGridHeader.css +23 -11
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +3 -3
- package/dist/components/MobileDataGrid/index.cjs +61 -63
- package/dist/components/MobileDataGrid/index.css +23 -11
- package/dist/components/MobileDataGrid/index.js +3 -3
- package/dist/components/ProductImagePreview/ProductPrimaryImage.cjs +29 -83
- package/dist/components/ProductImagePreview/ProductPrimaryImage.js +1 -3
- package/dist/components/ProductImagePreview/index.cjs +44 -77
- package/dist/components/ProductImagePreview/index.js +2 -3
- package/dist/components/SkeletonParagraph.cjs +12 -2
- package/dist/components/SkeletonParagraph.js +1 -1
- package/dist/components/index.cjs +105 -98
- package/dist/components/index.css +23 -11
- package/dist/components/index.js +3 -3
- package/dist/index.css +23 -11
- package/package.json +1 -1
- package/src/components/ProductImagePreview/ProductPrimaryImage.tsx +24 -34
- package/src/components/SkeletonParagraph.tsx +20 -2
- package/src/index.css +27 -0
- package/dist/chunk-ESCNCQGI.js +0 -9
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useRef, useState, useCallback, useMemo, useEffect } from "react";
|
|
2
2
|
import type { CSSProperties } from "react";
|
|
3
|
-
import { Spinner } from "../Spinner";
|
|
4
3
|
import type { ProductPreviewImage } from "./index";
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
const placeholderImageUri = "/placeholder.svg";
|
|
6
6
|
|
|
7
7
|
export type ProductPrimaryImageProps = {
|
|
8
8
|
image?: ProductPreviewImage;
|
|
@@ -44,8 +44,6 @@ export function ProductPrimaryImage({
|
|
|
44
44
|
const rafRef = useRef<number | null>(null);
|
|
45
45
|
const [active, setActive] = useState(false);
|
|
46
46
|
const [, forceRerender] = useState(0);
|
|
47
|
-
const [imageLoading, setImageLoading] = useState(true);
|
|
48
|
-
const [imageError, setImageError] = useState(false);
|
|
49
47
|
|
|
50
48
|
// Memoize image src to prevent unnecessary re-requests
|
|
51
49
|
const imageSrc = useMemo(() => image?.src, [image?.src]);
|
|
@@ -83,7 +81,8 @@ export function ProductPrimaryImage({
|
|
|
83
81
|
React.PointerEventHandler<HTMLDivElement>
|
|
84
82
|
>(
|
|
85
83
|
(e) => {
|
|
86
|
-
if (
|
|
84
|
+
if (isPlaceholder) return;
|
|
85
|
+
if (!zoomEnabled || !active) return;
|
|
87
86
|
|
|
88
87
|
// Ignore touch events to prevent zoom on mobile
|
|
89
88
|
if (e.pointerType === "touch") return;
|
|
@@ -123,7 +122,7 @@ export function ProductPrimaryImage({
|
|
|
123
122
|
true,
|
|
124
123
|
);
|
|
125
124
|
},
|
|
126
|
-
[zoomEnabled, active,
|
|
125
|
+
[isPlaceholder, zoomEnabled, active, zoomLensSize, onZoomPositionChange],
|
|
127
126
|
);
|
|
128
127
|
|
|
129
128
|
// Set up non-passive wheel event listener to properly prevent default
|
|
@@ -149,12 +148,16 @@ export function ProductPrimaryImage({
|
|
|
149
148
|
};
|
|
150
149
|
}, [scrollToZoomEnabled, zoomEnabled, active, onScrollZoom]);
|
|
151
150
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
const handleImgError = useCallback(
|
|
152
|
+
(e: React.SyntheticEvent<HTMLImageElement>) => {
|
|
153
|
+
if (!placeholderImageUri) return;
|
|
154
|
+
const img = e.currentTarget;
|
|
155
|
+
// Prevent infinite loop if placeholder also 404s
|
|
156
|
+
if (img.src === placeholderImageUri) return;
|
|
157
|
+
img.src = placeholderImageUri;
|
|
158
|
+
},
|
|
159
|
+
[],
|
|
160
|
+
);
|
|
158
161
|
|
|
159
162
|
const pt = lastPointRef.current;
|
|
160
163
|
let lensStyle: CSSProperties | undefined;
|
|
@@ -190,28 +193,15 @@ export function ProductPrimaryImage({
|
|
|
190
193
|
onPointerLeave={handlePointerLeave}
|
|
191
194
|
onPointerMove={handlePointerMove}
|
|
192
195
|
>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
key={imageSrc}
|
|
203
|
-
src={imageError ? "/placeholder.svg" : imageSrc}
|
|
204
|
-
alt={image?.alt || "Product image"}
|
|
205
|
-
className="object-cover min-w-full min-h-full select-none"
|
|
206
|
-
draggable={false}
|
|
207
|
-
loading="lazy"
|
|
208
|
-
onLoad={() => setImageLoading(false)}
|
|
209
|
-
onError={() => {
|
|
210
|
-
setImageLoading(false);
|
|
211
|
-
setImageError(true);
|
|
212
|
-
}}
|
|
213
|
-
/>
|
|
214
|
-
)}
|
|
196
|
+
<img
|
|
197
|
+
key={imageSrc}
|
|
198
|
+
src={imageSrc ?? placeholderImageUri}
|
|
199
|
+
alt={image?.alt || "Product image"}
|
|
200
|
+
className="object-cover min-w-full min-h-full select-none"
|
|
201
|
+
draggable={false}
|
|
202
|
+
loading="lazy"
|
|
203
|
+
onError={handleImgError}
|
|
204
|
+
/>
|
|
215
205
|
{zoomEnabled && active && lensStyle && (
|
|
216
206
|
<div
|
|
217
207
|
aria-hidden
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
interface SkeletonParagraphProps {
|
|
2
|
+
/** Optional custom class names to further style/size the skeleton */
|
|
3
|
+
className?: string;
|
|
4
|
+
/** Height of the skeleton (tailwind height utility), defaults to h-6 */
|
|
5
|
+
heightClassName?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A shimmering paragraph skeleton placeholder.
|
|
10
|
+
* Provides an animated left-to-right shimmer to indicate loading text content.
|
|
11
|
+
*/
|
|
12
|
+
export function SkeletonParagraph({
|
|
13
|
+
className = "",
|
|
14
|
+
heightClassName = "h-6",
|
|
15
|
+
}: SkeletonParagraphProps) {
|
|
2
16
|
return (
|
|
3
|
-
<div
|
|
17
|
+
<div
|
|
18
|
+
aria-label="Loading content"
|
|
19
|
+
role="status"
|
|
20
|
+
className={`skeleton-paragraph ${heightClassName} w-full min-w-32 rounded-xs ${className}`}
|
|
21
|
+
/>
|
|
4
22
|
);
|
|
5
23
|
}
|
package/src/index.css
CHANGED
|
@@ -634,6 +634,33 @@
|
|
|
634
634
|
); /* Created for Main Navigation */
|
|
635
635
|
}
|
|
636
636
|
|
|
637
|
+
/* Skeleton / Shimmer */
|
|
638
|
+
.skeleton-paragraph {
|
|
639
|
+
position: relative;
|
|
640
|
+
overflow: hidden;
|
|
641
|
+
background-color: theme("colors.neutral.100");
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.skeleton-paragraph::after {
|
|
645
|
+
content: "";
|
|
646
|
+
position: absolute;
|
|
647
|
+
inset: 0;
|
|
648
|
+
transform: translateX(-100%);
|
|
649
|
+
background-image: linear-gradient(
|
|
650
|
+
90deg,
|
|
651
|
+
rgba(255, 255, 255, 0) 0%,
|
|
652
|
+
rgba(255, 255, 255, 0.6) 50%,
|
|
653
|
+
rgba(255, 255, 255, 0) 100%
|
|
654
|
+
);
|
|
655
|
+
animation: skeleton-shimmer 1.4s ease-in-out infinite;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
@keyframes skeleton-shimmer {
|
|
659
|
+
100% {
|
|
660
|
+
transform: translateX(100%);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
637
664
|
@import "./darkmode.css";
|
|
638
665
|
@import "./brand.css";
|
|
639
666
|
|
package/dist/chunk-ESCNCQGI.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// src/components/SkeletonParagraph.tsx
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
function SkeletonParagraph() {
|
|
4
|
-
return /* @__PURE__ */ jsx("div", { className: "h-[24px] bg-gradient-to-r from-neutral-100 to-[#f7f7f7] w-full rounded-xs min-w-32 " });
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
SkeletonParagraph
|
|
9
|
-
};
|