twico-ui 1.37.0 → 1.37.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/CHANGELOG.md +7 -0
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -122,7 +122,9 @@ interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, "al
|
|
|
122
122
|
src?: string;
|
|
123
123
|
/** Alternative text (required for accessibility; pass "" for decorative images). */
|
|
124
124
|
alt: string;
|
|
125
|
-
/** object-fit value.
|
|
125
|
+
/** object-fit value. When set, the image fills its container by default (`width`/`height: 100%`); pass an
|
|
126
|
+
* explicit `width`/`height` (or size the container / `style`) to give it a fixed box that `fit` crops within
|
|
127
|
+
* — an explicit `width`/`height` now wins over the fill (#378). */
|
|
126
128
|
fit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
127
129
|
/** Border radius token (e.g. "md", "lg", "full"). */
|
|
128
130
|
radius?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -122,7 +122,9 @@ interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, "al
|
|
|
122
122
|
src?: string;
|
|
123
123
|
/** Alternative text (required for accessibility; pass "" for decorative images). */
|
|
124
124
|
alt: string;
|
|
125
|
-
/** object-fit value.
|
|
125
|
+
/** object-fit value. When set, the image fills its container by default (`width`/`height: 100%`); pass an
|
|
126
|
+
* explicit `width`/`height` (or size the container / `style`) to give it a fixed box that `fit` crops within
|
|
127
|
+
* — an explicit `width`/`height` now wins over the fill (#378). */
|
|
126
128
|
fit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
127
129
|
/** Border radius token (e.g. "md", "lg", "full"). */
|
|
128
130
|
radius?: string;
|
package/dist/index.mjs
CHANGED
|
@@ -304,6 +304,8 @@ var Image = React51__default.forwardRef(function Image2({
|
|
|
304
304
|
className = "",
|
|
305
305
|
style,
|
|
306
306
|
onError,
|
|
307
|
+
width,
|
|
308
|
+
height,
|
|
307
309
|
...rest
|
|
308
310
|
}, ref) {
|
|
309
311
|
const __twcStyles = useScopedStyles("twc-image-styles", IMAGE_CSS);
|
|
@@ -313,6 +315,14 @@ var Image = React51__default.forwardRef(function Image2({
|
|
|
313
315
|
objectFit: fit,
|
|
314
316
|
borderRadius: radius ? `var(--radius-${radius})` : void 0,
|
|
315
317
|
aspectRatio,
|
|
318
|
+
// #378: only when `fit` is set, also emit explicit width/height as inline style — that's the sole case
|
|
319
|
+
// where the `[data-fit] { width/height: 100% }` rule overrides the width/height ATTRIBUTES (a
|
|
320
|
+
// presentational attr loses to a real CSS rule), silently sizing `<Image width height fit>` to the
|
|
321
|
+
// container/intrinsic size. Inline style beats that rule so the props mean what they say (object-fit
|
|
322
|
+
// still crops within the box), placed before `...style` so a caller's own `style` still wins. Gated on
|
|
323
|
+
// `fit` so the no-fit path stays attribute-only — a consumer's own CSS/className can still override it.
|
|
324
|
+
...fit && width != null ? { width } : null,
|
|
325
|
+
...fit && height != null ? { height } : null,
|
|
316
326
|
...style
|
|
317
327
|
};
|
|
318
328
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -326,6 +336,8 @@ var Image = React51__default.forwardRef(function Image2({
|
|
|
326
336
|
loading,
|
|
327
337
|
className: `twc-image ${className}`.trim(),
|
|
328
338
|
"data-fit": fit || void 0,
|
|
339
|
+
width,
|
|
340
|
+
height,
|
|
329
341
|
style: s,
|
|
330
342
|
onError: (e) => {
|
|
331
343
|
onError?.(e);
|