@macive/ui 0.0.18 → 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/src/components/ActionList/components/Section/Section.js +3 -1
- package/dist/src/components/Image/Image.js +9 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/components/ActionList/components/Section/Section.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,9 @@ function Section({ section, hasMultipleSections, isFirst, actionRole, onActionAn
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
//@ts-expect-error key prop
|
|
20
|
+
const actionMarkup = section.items.map(({ content, helpText, onAction, key, ...item }, index) => {
|
|
21
|
+
// Explicitly exclude `key` from being spread into Item
|
|
20
22
|
return ((0, jsx_runtime_1.jsx)("li", { role: actionRole === 'menuitem' ? 'presentation' : undefined, children: (0, jsx_runtime_1.jsx)(Item_1.Item, { content: content, helpText: helpText, role: actionRole, onAction: handleAction(onAction), ...item }) }, `${content}-${index}`));
|
|
21
23
|
});
|
|
22
24
|
let titleMarkup = null;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Image = exports.fallbackImageSVG = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
/* eslint-disable @next/next/no-img-element */
|
|
6
5
|
const react_1 = require("react");
|
|
7
6
|
exports.fallbackImageSVG = `
|
|
8
7
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="#ccc">
|
|
@@ -47,16 +46,15 @@ const imageStyles = `
|
|
|
47
46
|
.loader {
|
|
48
47
|
width: 40px;
|
|
49
48
|
height: 40px;
|
|
49
|
+
z-index: 1; /* Ensure loader is above background */
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
.image {
|
|
53
53
|
width: 100%;
|
|
54
54
|
height: 100%;
|
|
55
55
|
object-fit: cover;
|
|
56
|
-
position: absolute;
|
|
57
|
-
top: 0;
|
|
58
|
-
left: 0;
|
|
59
56
|
transition: opacity 0.3s ease-in-out;
|
|
57
|
+
z-index: 2; /* Ensure image is above loader */
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
.image-loading {
|
|
@@ -69,8 +67,10 @@ function Image({ alt, sourceSet, source, crossOrigin, onLoad, onError, className
|
|
|
69
67
|
const [isInView, setIsInView] = (0, react_1.useState)(!lazy);
|
|
70
68
|
const imgRef = (0, react_1.useRef)(null);
|
|
71
69
|
(0, react_1.useEffect)(() => {
|
|
72
|
-
if (!lazy)
|
|
70
|
+
if (!lazy) {
|
|
71
|
+
setIsInView(true); // Ensure non-lazy images load immediately
|
|
73
72
|
return;
|
|
73
|
+
}
|
|
74
74
|
const currentImgRef = imgRef.current;
|
|
75
75
|
if (!currentImgRef)
|
|
76
76
|
return;
|
|
@@ -129,7 +129,10 @@ function Image({ alt, sourceSet, source, crossOrigin, onLoad, onError, className
|
|
|
129
129
|
...(rounded ? { borderRadius: 'var(--p-border-radius-3)' } : {}),
|
|
130
130
|
...style,
|
|
131
131
|
};
|
|
132
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("style", { children: imageStyles }), (0, jsx_runtime_1.jsxs)("div", { style: combinedStyle, className: `image-wrapper ${className || ''}`, children: [isLoading && (0, jsx_runtime_1.jsx)("img", { src: loaderImageURL, alt: 'Loading', className: 'loader' }), (0, jsx_runtime_1.jsx)("img", { ...rest, ref: imgRef, alt: alt, src: imgSrc !== null && imgSrc !== void 0 ? imgSrc : undefined, crossOrigin: crossOrigin, srcSet: sourceSet === null || sourceSet === void 0 ? void 0 : sourceSet.map(({ source, descriptor }) => `${source} ${descriptor || ''}`).join(', '), className: `image ${isLoading ? 'image-loading' : ''}`, loading: lazy ? 'lazy' : 'eager',
|
|
132
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("style", { children: imageStyles }), (0, jsx_runtime_1.jsxs)("div", { style: combinedStyle, className: `image-wrapper ${className || ''}`, children: [isLoading && ((0, jsx_runtime_1.jsx)("img", { src: loaderImageURL, alt: 'Loading', className: 'loader', "aria-hidden": 'true' })), (0, jsx_runtime_1.jsx)("img", { ...rest, ref: imgRef, alt: alt, src: imgSrc !== null && imgSrc !== void 0 ? imgSrc : undefined, crossOrigin: crossOrigin, srcSet: sourceSet === null || sourceSet === void 0 ? void 0 : sourceSet.map(({ source, descriptor }) => `${source} ${descriptor || ''}`).join(', '), className: `image ${isLoading ? 'image-loading' : ''}`, loading: lazy ? 'lazy' : 'eager', onLoad: () => {
|
|
133
|
+
setIsLoading(false); // Ensure isLoading is false on direct load
|
|
134
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
|
135
|
+
}, onError: (e) => {
|
|
133
136
|
e.currentTarget.src = fallbackImageURL;
|
|
134
137
|
setIsLoading(false);
|
|
135
138
|
onError === null || onError === void 0 ? void 0 : onError();
|