@sesionario/blocks 1.31.0 → 1.31.1
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.cjs +41 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1173,6 +1173,9 @@ function useZoomPanGestures(options = {}) {
|
|
|
1173
1173
|
clearSnapBack
|
|
1174
1174
|
};
|
|
1175
1175
|
}
|
|
1176
|
+
function isBrokenImage(img) {
|
|
1177
|
+
return img.complete && img.naturalWidth === 0;
|
|
1178
|
+
}
|
|
1176
1179
|
function SafeImage({
|
|
1177
1180
|
src,
|
|
1178
1181
|
fallback,
|
|
@@ -1181,10 +1184,17 @@ function SafeImage({
|
|
|
1181
1184
|
...imgProps
|
|
1182
1185
|
}) {
|
|
1183
1186
|
const [failed, setFailed] = React7.useState(false);
|
|
1187
|
+
const imgRef = React7.useRef(null);
|
|
1184
1188
|
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
1185
|
-
React7.
|
|
1189
|
+
React7.useLayoutEffect(() => {
|
|
1186
1190
|
setFailed(false);
|
|
1187
1191
|
}, [resolvedSrc]);
|
|
1192
|
+
React7.useLayoutEffect(() => {
|
|
1193
|
+
const img = imgRef.current;
|
|
1194
|
+
if (img && isBrokenImage(img)) {
|
|
1195
|
+
setFailed(true);
|
|
1196
|
+
}
|
|
1197
|
+
}, [resolvedSrc, failed]);
|
|
1188
1198
|
if (!resolvedSrc || failed) {
|
|
1189
1199
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
|
|
1190
1200
|
}
|
|
@@ -1192,6 +1202,7 @@ function SafeImage({
|
|
|
1192
1202
|
"img",
|
|
1193
1203
|
{
|
|
1194
1204
|
...imgProps,
|
|
1205
|
+
ref: imgRef,
|
|
1195
1206
|
src: resolvedSrc,
|
|
1196
1207
|
alt,
|
|
1197
1208
|
onError: (event) => {
|
|
@@ -2141,23 +2152,27 @@ function TenantAvatar({
|
|
|
2141
2152
|
}) {
|
|
2142
2153
|
const sizeClass = size === "sm" ? "size-6" : "size-8";
|
|
2143
2154
|
const textClass = size === "sm" ? "text-xs" : "text-sm";
|
|
2144
|
-
|
|
2155
|
+
const initials = getInitials(name);
|
|
2156
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2145
2157
|
"div",
|
|
2146
2158
|
{
|
|
2147
2159
|
className: cn(
|
|
2148
|
-
"flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium",
|
|
2160
|
+
"relative flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium",
|
|
2149
2161
|
sizeClass
|
|
2150
2162
|
),
|
|
2151
2163
|
style: avatarFallbackStyle(name),
|
|
2152
|
-
children:
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2164
|
+
children: [
|
|
2165
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: textClass, children: initials }),
|
|
2166
|
+
logo ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2167
|
+
SafeImage,
|
|
2168
|
+
{
|
|
2169
|
+
src: logo,
|
|
2170
|
+
alt: "",
|
|
2171
|
+
className: "absolute inset-0 size-full object-cover",
|
|
2172
|
+
fallback: null
|
|
2173
|
+
}
|
|
2174
|
+
) : null
|
|
2175
|
+
]
|
|
2161
2176
|
}
|
|
2162
2177
|
);
|
|
2163
2178
|
}
|
|
@@ -2677,30 +2692,26 @@ function MenuAvatar({
|
|
|
2677
2692
|
sizeClass
|
|
2678
2693
|
}) {
|
|
2679
2694
|
const initials = getInitials(name);
|
|
2680
|
-
|
|
2681
|
-
"span",
|
|
2682
|
-
{
|
|
2683
|
-
className: "flex size-full items-center justify-center text-xs font-semibold",
|
|
2684
|
-
style: avatarFallbackStyle(name),
|
|
2685
|
-
children: initials
|
|
2686
|
-
}
|
|
2687
|
-
);
|
|
2688
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2695
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2689
2696
|
"span",
|
|
2690
2697
|
{
|
|
2691
2698
|
className: cn(
|
|
2692
2699
|
"relative flex shrink-0 overflow-hidden rounded-full",
|
|
2693
2700
|
sizeClass
|
|
2694
2701
|
),
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
{
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2702
|
+
style: avatarFallbackStyle(name),
|
|
2703
|
+
children: [
|
|
2704
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-full items-center justify-center text-xs font-semibold", children: initials }),
|
|
2705
|
+
image ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2706
|
+
SafeImage,
|
|
2707
|
+
{
|
|
2708
|
+
src: image,
|
|
2709
|
+
alt: "",
|
|
2710
|
+
className: "absolute inset-0 aspect-square size-full object-cover",
|
|
2711
|
+
fallback: null
|
|
2712
|
+
}
|
|
2713
|
+
) : null
|
|
2714
|
+
]
|
|
2704
2715
|
}
|
|
2705
2716
|
);
|
|
2706
2717
|
}
|