meticulous-ui 3.10.5 → 3.10.7

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.
@@ -1,19 +1,25 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),d=require("react"),L=require("../Shimmer/Shimmer.cjs"),v=require("styled-components"),w=e=>e&&e.__esModule?e:{default:e},r=w(v),S=r.default.span`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),u=require("react"),S=require("../Shimmer/Shimmer.cjs"),_=require("styled-components"),k=e=>e&&e.__esModule?e:{default:e},r=k(_),q=r.default.span`
2
2
  position: relative;
3
- display: inline-block;
3
+ display: ${({$isAutoHeight:e})=>e?"block":"inline-block"};
4
4
  width: ${({$width:e})=>e};
5
5
  height: ${({$height:e})=>e};
6
+ /* aspect-ratio reserves space for shimmer before image bytes arrive */
7
+ aspect-ratio: ${({$aspectRatio:e})=>e||"unset"};
8
+ /* minHeight ensures shimmer is visible even without an aspectRatio hint */
9
+ min-height: ${({$minHeight:e,$isAutoHeight:t,$aspectRatio:a})=>t&&!a?e:"unset"};
6
10
  border-radius: ${({$borderRadius:e})=>e};
7
11
  overflow: hidden;
8
- `,_=r.default.img`
12
+ `,H=r.default.img`
9
13
  display: block;
10
14
  width: 100%;
11
- height: 100%;
12
- object-fit: cover;
15
+ /* height: 100% breaks in auto-height parents — use auto instead */
16
+ height: ${({$isAutoHeight:e})=>e?"auto":"100%"};
17
+ /* object-fit: cover requires both dimensions to be set */
18
+ object-fit: ${({$isAutoHeight:e})=>e?"initial":"cover"};
13
19
  border-radius: ${({$borderRadius:e})=>e};
14
20
  opacity: ${({$loaded:e})=>e?1:0};
15
21
  transition: opacity 0.5s ease-in-out;
16
- `,q=r.default.div`
22
+ `,R=r.default.div`
17
23
  position: absolute;
18
24
  inset: 0;
19
25
  z-index: 2;
@@ -30,8 +36,8 @@
30
36
  object-fit: cover;
31
37
  transform: scale(1.05);
32
38
  filter: ${({$loaded:e})=>e?"blur(0px)":"blur(12px)"};
33
- opacity: ${({$lowLoaded:e,$loaded:i})=>e&&!i?1:0};
39
+ opacity: ${({$lowLoaded:e,$loaded:t})=>e&&!t?1:0};
34
40
  transition:
35
41
  opacity 0.5s ease-in-out,
36
42
  filter 0.5s ease-in-out;
37
- `,o=e=>{if(e!=null)return typeof e=="number"?`${e}rem`:e},k=({src:e,alt:i="",width:f="100%",height:p="100%",borderRadius:s="0.4rem",loadLow:u=!1,lowSrc:l,...h})=>{const[c,m]=d.useState(!1),[n,$]=d.useState(!1),[a,y]=d.useState(!1),b=()=>m(!0),g=()=>$(!0),x=()=>y(!0),j=u?c:n;return t.jsxs(S,{$width:o(f),$height:o(p),$borderRadius:o(s),children:[!a&&t.jsx(q,{$loaded:j,children:t.jsx(L.default,{borderRadius:s})}),u&&l&&!a&&t.jsx(I,{src:l,alt:"","aria-hidden":"true",$lowLoaded:c,$loaded:n,$borderRadius:o(s),onLoad:b}),!a&&t.jsx(_,{src:e,alt:i,"aria-hidden":i===""?"true":void 0,$loaded:n,$borderRadius:o(s),onLoad:g,onError:x,...h})]})};exports.default=k;
43
+ `,i=e=>{if(e!=null)return typeof e=="number"?`${e}rem`:e},A=({src:e,alt:t="",width:a="100%",height:c="100%",aspectRatio:$,minHeight:f="12rem",borderRadius:s="0.4rem",loadLow:l=!1,lowSrc:h,...b})=>{const[m,g]=u.useState(!1),[n,y]=u.useState(!1),[d,v]=u.useState(!1),j=()=>g(!0),x=()=>y(!0),w=()=>v(!0),L=l?m:n,p=c==="auto";return o.jsxs(q,{$width:i(a),$height:i(c),$aspectRatio:$,$minHeight:i(f),$isAutoHeight:p,$borderRadius:i(s),children:[!d&&o.jsx(R,{$loaded:L,children:o.jsx(S.default,{borderRadius:s})}),l&&h&&!d&&o.jsx(I,{src:h,alt:"","aria-hidden":"true",$lowLoaded:m,$loaded:n,$borderRadius:i(s),onLoad:j}),!d&&o.jsx(H,{src:e,alt:t,"aria-hidden":t===""?"true":void 0,$loaded:n,$isAutoHeight:p,$borderRadius:i(s),onLoad:x,onError:w,...b})]})};exports.default=A;
@@ -1,30 +1,36 @@
1
- import { jsxs as x, jsx as r } from "react/jsx-runtime";
2
- import { useState as d } from "react";
3
- import v from "../Shimmer/Shimmer.js";
4
- import s from "styled-components";
5
- const j = s.span`
1
+ import { jsxs as k, jsx as s } from "react/jsx-runtime";
2
+ import { useState as c } from "react";
3
+ import H from "../Shimmer/Shimmer.js";
4
+ import r from "styled-components";
5
+ const I = r.span`
6
6
  position: relative;
7
- display: inline-block;
7
+ display: ${({ $isAutoHeight: e }) => e ? "block" : "inline-block"};
8
8
  width: ${({ $width: e }) => e};
9
9
  height: ${({ $height: e }) => e};
10
+ /* aspect-ratio reserves space for shimmer before image bytes arrive */
11
+ aspect-ratio: ${({ $aspectRatio: e }) => e || "unset"};
12
+ /* minHeight ensures shimmer is visible even without an aspectRatio hint */
13
+ min-height: ${({ $minHeight: e, $isAutoHeight: t, $aspectRatio: n }) => t && !n ? e : "unset"};
10
14
  border-radius: ${({ $borderRadius: e }) => e};
11
15
  overflow: hidden;
12
- `, I = s.img`
16
+ `, R = r.img`
13
17
  display: block;
14
18
  width: 100%;
15
- height: 100%;
16
- object-fit: cover;
19
+ /* height: 100% breaks in auto-height parents — use auto instead */
20
+ height: ${({ $isAutoHeight: e }) => e ? "auto" : "100%"};
21
+ /* object-fit: cover requires both dimensions to be set */
22
+ object-fit: ${({ $isAutoHeight: e }) => e ? "initial" : "cover"};
17
23
  border-radius: ${({ $borderRadius: e }) => e};
18
24
  opacity: ${({ $loaded: e }) => e ? 1 : 0};
19
25
  transition: opacity 0.5s ease-in-out;
20
- `, k = s.div`
26
+ `, A = r.div`
21
27
  position: absolute;
22
28
  inset: 0;
23
29
  z-index: 2;
24
30
  opacity: ${({ $loaded: e }) => e ? 0 : 1};
25
31
  transition: opacity 0.35s ease-out;
26
32
  pointer-events: none;
27
- `, S = s.img`
33
+ `, S = r.img`
28
34
  position: absolute;
29
35
  inset: 0;
30
36
  z-index: 1;
@@ -44,42 +50,56 @@ const j = s.span`
44
50
  }, O = ({
45
51
  src: e,
46
52
  alt: t = "",
47
- width: p = "100%",
48
- height: u = "100%",
53
+ width: n = "100%",
54
+ height: m = "100%",
55
+ aspectRatio: $,
56
+ minHeight: b = "12rem",
49
57
  borderRadius: i = "0.4rem",
50
- loadLow: c = !1,
51
- lowSrc: l,
52
- ...h
58
+ loadLow: u = !1,
59
+ lowSrc: h,
60
+ ...f
53
61
  }) => {
54
- const [m, $] = d(!1), [n, f] = d(!1), [a, y] = d(!1), b = () => $(!0), g = () => f(!0), L = () => y(!0), w = c ? m : n;
55
- return /* @__PURE__ */ x(j, { $width: o(p), $height: o(u), $borderRadius: o(i), children: [
56
- !a && /* @__PURE__ */ r(k, { $loaded: w, children: /* @__PURE__ */ r(v, { borderRadius: i }) }),
57
- c && l && !a && /* @__PURE__ */ r(
58
- S,
59
- {
60
- src: l,
61
- alt: "",
62
- "aria-hidden": "true",
63
- $lowLoaded: m,
64
- $loaded: n,
65
- $borderRadius: o(i),
66
- onLoad: b
67
- }
68
- ),
69
- !a && /* @__PURE__ */ r(
70
- I,
71
- {
72
- src: e,
73
- alt: t,
74
- "aria-hidden": t === "" ? "true" : void 0,
75
- $loaded: n,
76
- $borderRadius: o(i),
77
- onLoad: g,
78
- onError: L,
79
- ...h
80
- }
81
- )
82
- ] });
62
+ const [l, g] = c(!1), [a, y] = c(!1), [d, v] = c(!1), w = () => g(!0), L = () => y(!0), x = () => v(!0), j = u ? l : a, p = m === "auto";
63
+ return /* @__PURE__ */ k(
64
+ I,
65
+ {
66
+ $width: o(n),
67
+ $height: o(m),
68
+ $aspectRatio: $,
69
+ $minHeight: o(b),
70
+ $isAutoHeight: p,
71
+ $borderRadius: o(i),
72
+ children: [
73
+ !d && /* @__PURE__ */ s(A, { $loaded: j, children: /* @__PURE__ */ s(H, { borderRadius: i }) }),
74
+ u && h && !d && /* @__PURE__ */ s(
75
+ S,
76
+ {
77
+ src: h,
78
+ alt: "",
79
+ "aria-hidden": "true",
80
+ $lowLoaded: l,
81
+ $loaded: a,
82
+ $borderRadius: o(i),
83
+ onLoad: w
84
+ }
85
+ ),
86
+ !d && /* @__PURE__ */ s(
87
+ R,
88
+ {
89
+ src: e,
90
+ alt: t,
91
+ "aria-hidden": t === "" ? "true" : void 0,
92
+ $loaded: a,
93
+ $isAutoHeight: p,
94
+ $borderRadius: o(i),
95
+ onLoad: L,
96
+ onError: x,
97
+ ...f
98
+ }
99
+ )
100
+ ]
101
+ }
102
+ );
83
103
  };
84
104
  export {
85
105
  O as default
package/index.d.ts CHANGED
@@ -474,7 +474,12 @@ export interface ImageProps extends React.HTMLAttributes<HTMLDivElement> {
474
474
  src: string;
475
475
  alt?: string;
476
476
  width?: string | number;
477
+ /** Pass `"auto"` for responsive images. Pair with `aspectRatio` so the shimmer reserves space before image bytes arrive. */
477
478
  height?: string | number;
479
+ /** CSS aspect-ratio hint (e.g. `"16/9"`, `"4/3"`, `"1/1"`). Required for correct shimmer behaviour when `height` is `"auto"`. */
480
+ aspectRatio?: string;
481
+ /** Fallback min-height when `height` is `"auto"` and no `aspectRatio` is given. Defaults to `"12rem"`. */
482
+ minHeight?: string | number;
478
483
  borderRadius?: string | number;
479
484
  loadLow?: boolean;
480
485
  lowSrc?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meticulous-ui",
3
- "version": "3.10.5",
3
+ "version": "3.10.7",
4
4
  "license": "ISC",
5
5
  "description": "A comprehensive React UI component library with a wide range of customizable components, icons, colors, and utilities for building modern web applications.",
6
6
  "types": "./index.d.ts",