@kushagradhawan/kookie-ui 0.1.114 → 0.1.115

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 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/components/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,KAAK,aAAa,GAAG,eAAe,CAAC,OAAO,aAAa,CAAC,GAAG;IAC3D;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACjE;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAClE;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC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Y,EAAE,UAAU,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";var X=Object.create;var n=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var oe=(e,o)=>{for(var s in o)n(e,s,{get:o[s],enumerable:!0})},N=(e,o,s,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of Z(o))!ee.call(e,a)&&a!==s&&n(e,a,{get:()=>o[a],enumerable:!(i=Y(o,a))||i.enumerable});return e};var T=(e,o,s)=>(s=e!=null?X($(e)):{},N(o||!e||!e.__esModule?n(s,"default",{value:e,enumerable:!0}):s,e)),te=e=>N(n({},"__esModule",{value:!0}),e);var re={};oe(re,{Image:()=>y});module.exports=te(re);var t=T(require("react")),h=T(require("classnames")),M=require("./image.props.js"),j=require("../helpers/extract-props.js"),k=require("../props/margin.props.js"),R=require("../props/width.props.js"),W=require("../props/height.props.js"),O=require("../props/layout.props.js"),z=require("./skeleton.js");const y=t.forwardRef((e,o)=>{const s=typeof e.width=="number"?e.width:void 0,i=typeof e.height=="number"?e.height:void 0,{as:a="img",asChild:se,className:u,style:P,loading:A="lazy",alt:G,src:m,placeholder:l,showSkeleton:q=!1,fadeIn:I=!0,loadingAriaLabel:F="Loading image...",errorAriaLabel:_="Failed to load image",radius:B,caption:v,onLoad:E,onError:L,...J}=(0,j.extractProps)(e,M.imagePropDefs,k.marginPropDefs,R.widthPropDefs,W.heightPropDefs,O.layoutPropDefs),K=a!=="img"?{width:s,height:i}:{},[p,d]=t.useState("loading"),[Q,g]=t.useState(!!l),C=t.useRef(null),U=t.useCallback(r=>{d("loaded"),g(!1),E?.(r)},[E]),V=t.useCallback(r=>{d("error"),g(!1),L?.(r)},[L]);if(t.useEffect(()=>{const r=C.current;r&&r.complete&&r.naturalWidth>0&&(d("loaded"),g(!1))},[m]),!m)return console.warn("Image component: src prop is required"),null;const c=p==="loading",f=p==="error",b={width:"100%",height:"100%",display:"block",opacity:I?p==="loaded"?1:0:1,transition:I?"opacity 0.3s ease-out":"none"},S=t.createElement(a,{ref:r=>{C.current=r,typeof o=="function"?o(r):o&&(o.current=r)},loading:A,style:{...b,position:"relative",zIndex:1},className:(0,h.default)("rt-reset","rt-Image"),alt:G,src:m,"data-radius":B,onLoad:U,onError:V,"aria-busy":c,"aria-invalid":f,"aria-describedby":f?"image-error":void 0,...K,...J}),w=c&&t.createElement("div",{className:"rt-sr-only","aria-live":"polite",role:"status"},F),x=f&&t.createElement("div",{id:"image-error",className:"rt-sr-only","aria-live":"polite",role:"alert"},_),H=q&&c&&t.createElement(z.Skeleton,{width:"100%",height:"100%",style:{position:"absolute",inset:0}}),D=l&&Q&&t.createElement("img",{style:{...b,position:"absolute",inset:0,filter:"blur(4px)",opacity:.7,zIndex:0},className:(0,h.default)("rt-reset","rt-Image","rt-Image--placeholder"),alt:"",src:l});return v?t.createElement("div",{className:u,style:{display:"flex",flexDirection:"column",...P}},t.createElement("div",{style:{position:"relative",flex:"1 1 0%",minHeight:0}},w,x,H,D,S),t.createElement("div",{className:"rt-Image-caption",style:{flex:"0 0 auto"}},v)):t.createElement("div",{className:u,style:{position:"relative",...P}},w,x,H,D,S)});y.displayName="Image";
1
+ "use strict";var Z=Object.create;var l=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var re=(e,o)=>{for(var i in o)l(e,i,{get:o[i],enumerable:!0})},M=(e,o,i,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of ee(o))!te.call(e,s)&&s!==i&&l(e,s,{get:()=>o[s],enumerable:!(a=$(o,s))||a.enumerable});return e};var k=(e,o,i)=>(i=e!=null?Z(oe(e)):{},M(o||!e||!e.__esModule?l(i,"default",{value:e,enumerable:!0}):i,e)),ie=e=>M(l({},"__esModule",{value:!0}),e);var se={};re(se,{Image:()=>P});module.exports=ie(se);var t=k(require("react")),u=k(require("classnames")),j=require("./image.props.js"),R=require("../helpers/extract-props.js"),W=require("../props/margin.props.js"),O=require("../props/width.props.js"),z=require("../props/height.props.js"),A=require("../props/layout.props.js"),F=require("./skeleton.js");const P=t.forwardRef((e,o)=>{const i=typeof e.width=="number"?e.width:void 0,a=typeof e.height=="number"?e.height:void 0,s="fill"in e&&e.fill===!0,{as:I="img",asChild:ae,className:v,style:E,loading:G="lazy",alt:q,src:m,placeholder:p,showSkeleton:_=!1,fadeIn:n=!0,loadingAriaLabel:B="Loading image...",errorAriaLabel:J="Failed to load image",radius:K,caption:L,onLoad:b,onError:C,...Q}=(0,R.extractProps)(e,j.imagePropDefs,W.marginPropDefs,O.widthPropDefs,z.heightPropDefs,A.layoutPropDefs),U=I!=="img"?{width:i,height:a}:{},[d,g]=t.useState("loading"),[V,c]=t.useState(!!p),S=t.useRef(null),X=t.useCallback(r=>{g("loaded"),c(!1),b?.(r)},[b]),Y=t.useCallback(r=>{g("error"),c(!1),C?.(r)},[C]);if(t.useEffect(()=>{const r=S.current;r&&r.complete&&r.naturalWidth>0&&(g("loaded"),c(!1))},[m]),!m)return console.warn("Image component: src prop is required"),null;const f=d==="loading",h=d==="error",w=d==="loaded",y=s?{display:"block",opacity:n?w?1:0:1,transition:n?"opacity 0.3s ease-out":"none"}:{width:"100%",height:"100%",display:"block",opacity:n?w?1:0:1,transition:n?"opacity 0.3s ease-out":"none"},x=t.createElement(I,{ref:r=>{S.current=r,typeof o=="function"?o(r):o&&(o.current=r)},loading:G,style:s?y:{...y,position:"relative",zIndex:1},className:(0,u.default)("rt-reset","rt-Image"),alt:q,src:m,"data-radius":K,onLoad:X,onError:Y,"aria-busy":f,"aria-invalid":h,"aria-describedby":h?"image-error":void 0,...U,...Q}),H=f&&t.createElement("div",{className:"rt-sr-only","aria-live":"polite",role:"status"},B),D=h&&t.createElement("div",{id:"image-error",className:"rt-sr-only","aria-live":"polite",role:"alert"},J),N=_&&f&&t.createElement(F.Skeleton,{width:"100%",height:"100%",style:{position:"absolute",inset:0}}),T=p&&V&&t.createElement("img",{style:{...y,position:"absolute",inset:0,filter:"blur(4px)",opacity:.7,zIndex:0},className:(0,u.default)("rt-reset","rt-Image","rt-Image--placeholder"),alt:"",src:p});return L?t.createElement("div",{className:v,style:{display:"flex",flexDirection:"column",...E}},t.createElement("div",{style:{position:"relative",flex:"1 1 0%",minHeight:0}},H,D,N,T,x),t.createElement("div",{className:"rt-Image-caption",style:{flex:"0 0 auto"}},L)):t.createElement("div",{className:v,style:{position:"relative",...E}},H,D,N,T,x)});P.displayName="Image";
2
2
  //# sourceMappingURL=image.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/image.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { imagePropDefs } from './image.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\nimport { widthPropDefs } from '../props/width.props.js';\nimport { heightPropDefs } from '../props/height.props.js';\nimport { layoutPropDefs } from '../props/layout.props.js';\nimport { Skeleton } from './skeleton.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { WidthProps } from '../props/width.props.js';\nimport type { HeightProps } from '../props/height.props.js';\nimport type { LayoutProps } from '../props/layout.props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype ImageElement = React.ElementRef<'img'>;\n\ntype ImageOwnProps = GetPropDefTypes<typeof imagePropDefs> & {\n /**\n * Native loading behavior for the image\n * @default 'lazy'\n */\n loading?: 'eager' | 'lazy';\n /**\n * Placeholder image URL to show while the main image is loading (LQIP pattern)\n */\n placeholder?: string;\n /**\n * Shows a skeleton placeholder while loading\n */\n showSkeleton?: boolean;\n /**\n * Whether the image should fade in when loaded\n * @default true\n */\n fadeIn?: boolean;\n /**\n * Callback fired when the image successfully loads\n */\n onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;\n /**\n * Callback fired when the image fails to load\n */\n onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;\n /**\n * Alternative text for the image (required for accessibility)\n */\n alt: string;\n /**\n * Image source URL\n */\n src: string;\n};\n\ninterface CommonImageProps\n extends MarginProps,\n WidthProps,\n HeightProps,\n LayoutProps,\n ImageOwnProps {}\n\ntype ImageImgProps = { as?: 'img' } & ComponentPropsWithout<'img', RemovedProps | 'color' | 'width' | 'height' | 'alt'>;\ntype ImageComponentProps = { as: React.ComponentType<any> } & Record<string, any>;\ntype ImageProps = CommonImageProps & (ImageImgProps | ImageComponentProps);\n\n/**\n * Image component for displaying images with enhanced loading states and accessibility.\n *\n * Supports polymorphic rendering via the `as` prop for Next.js Image compatibility.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Image src=\"/photo.jpg\" alt=\"Team photo\" />\n *\n * // With Next.js Image\n * import NextImage from 'next/image';\n * <Image as={NextImage} src=\"/photo.jpg\" alt=\"...\" width={400} height={300} />\n *\n * // With placeholder and skeleton\n * <Image\n * src=\"/high-res.jpg\"\n * placeholder=\"/low-res.jpg\"\n * showSkeleton\n * alt=\"Product showcase\"\n * />\n *\n * // With caption\n * <Image\n * src=\"/chart.png\"\n * alt=\"Sales data visualization\"\n * caption=\"Q3 2024 Sales Performance\"\n * />\n * ```\n */\nconst Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) => {\n // Extract native width/height before extractProps consumes them (for Next.js Image compatibility)\n const nativeWidth = typeof props.width === 'number' ? props.width : undefined;\n const nativeHeight = typeof props.height === 'number' ? props.height : undefined;\n\n const {\n as: Component = 'img',\n asChild: _asChild, // Extract to prevent passing to DOM element\n className,\n style,\n loading = 'lazy',\n alt,\n src,\n placeholder,\n showSkeleton = false,\n fadeIn = true,\n loadingAriaLabel = 'Loading image...',\n errorAriaLabel = 'Failed to load image',\n radius,\n caption,\n onLoad: userOnLoad,\n onError: userOnError,\n ...restProps\n } = extractProps(\n props,\n imagePropDefs,\n marginPropDefs,\n widthPropDefs,\n heightPropDefs,\n layoutPropDefs,\n );\n\n // When using a custom component (like Next.js Image), pass native width/height\n const isCustomComponent = Component !== 'img';\n const componentDimensionProps = isCustomComponent ? { width: nativeWidth, height: nativeHeight } : {};\n\n const [loadingState, setLoadingState] = React.useState<'loading' | 'loaded' | 'error'>('loading');\n const [showPlaceholder, setShowPlaceholder] = React.useState(!!placeholder);\n const imgRef = React.useRef<HTMLImageElement>(null);\n\n const handleLoad = React.useCallback(\n (event: React.SyntheticEvent<HTMLImageElement>) => {\n setLoadingState('loaded');\n setShowPlaceholder(false);\n userOnLoad?.(event);\n },\n [userOnLoad],\n );\n\n const handleError = React.useCallback(\n (event: React.SyntheticEvent<HTMLImageElement>) => {\n setLoadingState('error');\n setShowPlaceholder(false);\n userOnError?.(event);\n },\n [userOnError],\n );\n\n // Check if image is already cached\n React.useEffect(() => {\n const img = imgRef.current;\n if (img && img.complete && img.naturalWidth > 0) {\n setLoadingState('loaded');\n setShowPlaceholder(false);\n }\n }, [src]);\n\n if (!src) {\n console.warn('Image component: src prop is required');\n return null;\n }\n\n const isLoading = loadingState === 'loading';\n const isError = loadingState === 'error';\n const isLoaded = loadingState === 'loaded';\n\n const imgStyle: React.CSSProperties = {\n width: '100%',\n height: '100%',\n display: 'block',\n opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,\n transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',\n };\n\n const mergeRefs = (node: HTMLImageElement | null) => {\n (imgRef as React.RefObject<HTMLImageElement | null>).current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n };\n\n const imageElement = (\n <Component\n ref={mergeRefs}\n loading={loading}\n style={{ ...imgStyle, position: 'relative', zIndex: 1 }}\n className={classNames('rt-reset', 'rt-Image')}\n alt={alt}\n src={src}\n data-radius={radius}\n onLoad={handleLoad}\n onError={handleError}\n aria-busy={isLoading}\n aria-invalid={isError}\n aria-describedby={isError ? 'image-error' : undefined}\n {...componentDimensionProps}\n {...restProps}\n />\n );\n\n const loadingAnnouncement = isLoading && (\n <div className=\"rt-sr-only\" aria-live=\"polite\" role=\"status\">\n {loadingAriaLabel}\n </div>\n );\n\n const errorAnnouncement = isError && (\n <div id=\"image-error\" className=\"rt-sr-only\" aria-live=\"polite\" role=\"alert\">\n {errorAriaLabel}\n </div>\n );\n\n const skeletonElement = showSkeleton && isLoading && (\n <Skeleton width=\"100%\" height=\"100%\" style={{ position: 'absolute', inset: 0 }} />\n );\n\n const placeholderElement = placeholder && showPlaceholder && (\n <img\n style={{\n ...imgStyle,\n position: 'absolute',\n inset: 0,\n filter: 'blur(4px)',\n opacity: 0.7,\n zIndex: 0,\n }}\n className={classNames('rt-reset', 'rt-Image', 'rt-Image--placeholder')}\n alt=\"\"\n src={placeholder}\n />\n );\n\n // Simple flat structure when no caption\n if (!caption) {\n return (\n <div className={className} style={{ position: 'relative', ...style }}>\n {loadingAnnouncement}\n {errorAnnouncement}\n {skeletonElement}\n {placeholderElement}\n {imageElement}\n </div>\n );\n }\n\n // Flexbox structure when caption is present\n return (\n <div\n className={className}\n style={{\n display: 'flex',\n flexDirection: 'column',\n ...style,\n }}\n >\n <div\n style={{\n position: 'relative',\n flex: '1 1 0%',\n minHeight: 0,\n }}\n >\n {loadingAnnouncement}\n {errorAnnouncement}\n {skeletonElement}\n {placeholderElement}\n {imageElement}\n </div>\n\n <div className=\"rt-Image-caption\" style={{ flex: '0 0 auto' }}>\n {caption}\n </div>\n </div>\n );\n});\n\nImage.displayName = 'Image';\n\nexport { Image };\nexport type { ImageProps };\n"],
5
- "mappings": "8jBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,WAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBAEvBC,EAA8B,4BAC9BC,EAA6B,uCAC7BC,EAA+B,oCAC/BC,EAA8B,mCAC9BC,EAA+B,oCAC/BC,EAA+B,o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b,GAEC8C,EACAC,EACAC,EACAC,EACAN,CACH,EAEA3C,EAAA,cAAC,OAAI,UAAU,mBAAmB,MAAO,CAAE,KAAM,UAAW,GACzD0B,CACH,CACF,EArCE1B,EAAA,cAAC,OAAI,UAAWe,EAAW,MAAO,CAAE,SAAU,WAAY,GAAGC,CAAM,GAChE8B,EACAC,EACAC,EACAC,EACAN,CACH,CAiCN,CAAC,EAED7C,EAAM,YAAc",
6
- "names": ["image_exports", "__export", "Image", "__toCommonJS", "React", "import_classnames", "import_image_props", "import_extract_props", "import_margin_props", "import_width_props", "import_height_props", "import_layout_props", "import_skeleton", "props", "forwardedRef", "nativeWidth", "nativeHeight", "Component", "_asChild", "className", "style", "loading", "alt", "src", "placeholder", "showSkeleton", "fadeIn", "loadingAriaLabel", "errorAriaLabel", "radius", "caption", "userOnLoad", "userOnError", "restProps", "componentDimensionProps", "loadingState", "setLoadingState", "showPlaceholder", "setShowPlaceholder", "imgRef", "handleLoad", "event", "handleError", "img", "isLoading", "isError", "imgStyle", "imageElement", "node", "classNames", "loadingAnnouncement", "errorAnnouncement", "skeletonElement", "placeholderElement"]
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { imagePropDefs } from './image.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\nimport { widthPropDefs } from '../props/width.props.js';\nimport { heightPropDefs } from '../props/height.props.js';\nimport { layoutPropDefs } from '../props/layout.props.js';\nimport { Skeleton } from './skeleton.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { WidthProps } from '../props/width.props.js';\nimport type { HeightProps } from '../props/height.props.js';\nimport type { LayoutProps } from '../props/layout.props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype ImageElement = React.ElementRef<'img'>;\n\ntype ImageOwnProps = GetPropDefTypes<typeof imagePropDefs> & {\n /**\n * Native loading behavior for the image\n * @default 'lazy'\n */\n loading?: 'eager' | 'lazy';\n /**\n * Placeholder image URL to show while the main image is loading (LQIP pattern)\n */\n placeholder?: string;\n /**\n * Shows a skeleton placeholder while loading\n */\n showSkeleton?: boolean;\n /**\n * Whether the image should fade in when loaded\n * @default true\n */\n fadeIn?: boolean;\n /**\n * Callback fired when the image successfully loads\n */\n onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;\n /**\n * Callback fired when the image fails to load\n */\n onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;\n /**\n * Alternative text for the image (required for accessibility)\n */\n alt: string;\n /**\n * Image source URL\n */\n src: string;\n};\n\ninterface CommonImageProps\n extends MarginProps,\n WidthProps,\n HeightProps,\n LayoutProps,\n ImageOwnProps {}\n\ntype ImageImgProps = { as?: 'img' } & ComponentPropsWithout<'img', RemovedProps | 'color' | 'width' | 'height' | 'alt'>;\ntype ImageComponentProps = { as: React.ComponentType<any> } & Record<string, any>;\ntype ImageProps = CommonImageProps & (ImageImgProps | ImageComponentProps);\n\n/**\n * Image component for displaying images with enhanced loading states and accessibility.\n *\n * Supports polymorphic rendering via the `as` prop for Next.js Image compatibility.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Image src=\"/photo.jpg\" alt=\"Team photo\" />\n *\n * // With Next.js Image\n * import NextImage from 'next/image';\n * <Image as={NextImage} src=\"/photo.jpg\" alt=\"...\" width={400} height={300} />\n *\n * // With placeholder and skeleton\n * <Image\n * src=\"/high-res.jpg\"\n * placeholder=\"/low-res.jpg\"\n * showSkeleton\n * alt=\"Product showcase\"\n * />\n *\n * // With caption\n * <Image\n * src=\"/chart.png\"\n * alt=\"Sales data visualization\"\n * caption=\"Q3 2024 Sales Performance\"\n * />\n * ```\n */\nconst Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) => {\n // Extract native width/height before extractProps consumes them (for Next.js Image compatibility)\n const nativeWidth = typeof props.width === 'number' ? props.width : undefined;\n const nativeHeight = typeof props.height === 'number' ? props.height : undefined;\n // Check if fill prop is used (for Next.js Image compatibility)\n const hasFill = 'fill' in props && props.fill === true;\n\n const {\n as: Component = 'img',\n asChild: _asChild, // Extract to prevent passing to DOM element\n className,\n style,\n loading = 'lazy',\n alt,\n src,\n placeholder,\n showSkeleton = false,\n fadeIn = true,\n loadingAriaLabel = 'Loading image...',\n errorAriaLabel = 'Failed to load image',\n radius,\n caption,\n onLoad: userOnLoad,\n onError: userOnError,\n ...restProps\n } = extractProps(\n props,\n imagePropDefs,\n marginPropDefs,\n widthPropDefs,\n heightPropDefs,\n layoutPropDefs,\n );\n\n // When using a custom component (like Next.js Image), pass native width/height\n const isCustomComponent = Component !== 'img';\n const componentDimensionProps = isCustomComponent ? { width: nativeWidth, height: nativeHeight } : {};\n\n const [loadingState, setLoadingState] = React.useState<'loading' | 'loaded' | 'error'>('loading');\n const [showPlaceholder, setShowPlaceholder] = React.useState(!!placeholder);\n const imgRef = React.useRef<HTMLImageElement>(null);\n\n const handleLoad = React.useCallback(\n (event: React.SyntheticEvent<HTMLImageElement>) => {\n setLoadingState('loaded');\n setShowPlaceholder(false);\n userOnLoad?.(event);\n },\n [userOnLoad],\n );\n\n const handleError = React.useCallback(\n (event: React.SyntheticEvent<HTMLImageElement>) => {\n setLoadingState('error');\n setShowPlaceholder(false);\n userOnError?.(event);\n },\n [userOnError],\n );\n\n // Check if image is already cached\n React.useEffect(() => {\n const img = imgRef.current;\n if (img && img.complete && img.naturalWidth > 0) {\n setLoadingState('loaded');\n setShowPlaceholder(false);\n }\n }, [src]);\n\n if (!src) {\n console.warn('Image component: src prop is required');\n return null;\n }\n\n const isLoading = loadingState === 'loading';\n const isError = loadingState === 'error';\n const isLoaded = loadingState === 'loaded';\n\n // When using fill (Next.js Image), don't add dimension/position styles as Next.js handles them\n const imgStyle: React.CSSProperties = hasFill\n ? {\n display: 'block',\n opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,\n transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',\n }\n : {\n width: '100%',\n height: '100%',\n display: 'block',\n opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,\n transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',\n };\n\n const mergeRefs = (node: HTMLImageElement | null) => {\n (imgRef as React.RefObject<HTMLImageElement | null>).current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n };\n\n const imageElement = (\n <Component\n ref={mergeRefs}\n loading={loading}\n style={hasFill ? imgStyle : { ...imgStyle, position: 'relative', zIndex: 1 }}\n className={classNames('rt-reset', 'rt-Image')}\n alt={alt}\n src={src}\n data-radius={radius}\n onLoad={handleLoad}\n onError={handleError}\n aria-busy={isLoading}\n aria-invalid={isError}\n aria-describedby={isError ? 'image-error' : undefined}\n {...componentDimensionProps}\n {...restProps}\n />\n );\n\n const loadingAnnouncement = isLoading && (\n <div className=\"rt-sr-only\" aria-live=\"polite\" role=\"status\">\n {loadingAriaLabel}\n </div>\n );\n\n const errorAnnouncement = isError && (\n <div id=\"image-error\" className=\"rt-sr-only\" aria-live=\"polite\" role=\"alert\">\n {errorAriaLabel}\n </div>\n );\n\n const skeletonElement = showSkeleton && isLoading && (\n <Skeleton width=\"100%\" height=\"100%\" style={{ position: 'absolute', inset: 0 }} />\n );\n\n const placeholderElement = placeholder && showPlaceholder && (\n <img\n style={{\n ...imgStyle,\n position: 'absolute',\n inset: 0,\n filter: 'blur(4px)',\n opacity: 0.7,\n zIndex: 0,\n }}\n className={classNames('rt-reset', 'rt-Image', 'rt-Image--placeholder')}\n alt=\"\"\n src={placeholder}\n />\n );\n\n // Simple flat structure when no caption\n if (!caption) {\n return (\n <div className={className} style={{ position: 'relative', ...style }}>\n {loadingAnnouncement}\n {errorAnnouncement}\n {skeletonElement}\n {placeholderElement}\n {imageElement}\n </div>\n );\n }\n\n // Flexbox structure when caption is present\n return (\n <div\n className={className}\n style={{\n display: 'flex',\n flexDirection: 'column',\n ...style,\n }}\n >\n <div\n style={{\n position: 'relative',\n flex: '1 1 0%',\n minHeight: 0,\n }}\n >\n {loadingAnnouncement}\n {errorAnnouncement}\n {skeletonElement}\n {placeholderElement}\n {imageElement}\n </div>\n\n <div className=\"rt-Image-caption\" style={{ flex: '0 0 auto' }}>\n {caption}\n </div>\n </div>\n );\n});\n\nImage.displayName = 'Image';\n\nexport { Image };\nexport type { ImageProps };\n"],
5
+ "mappings": "kkBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,WAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBAEvBC,EAA8B,4BAC9BC,EAA6B,uCAC7BC,EAA+B,oCAC/BC,EAA8B,mCAC9BC,EAA+B,oCAC/BC,EAA+B,oCAC/BC,EAAyB,yBAyFzB,MAAMV,EAAQE,EAAM,WAAqC,CAACS,EAAOC,IAAiB,CAEhF,MAAMC,EAAc,OAAOF,EAAM,OAAU,SAAWA,EAAM,MAAQ,OAC9DG,EAAe,OAAOH,EAAM,QAAW,SAAWA,EAAM,OAAS,OAEjEI,EAAU,SAAUJ,GAASA,EAAM,OAAS,GAE5C,CACJ,GAAIK,EAAY,MAChB,QAASC,GACT,UAAAC,EACA,MAAAC,EACA,QAAAC,EAAU,OACV,IAAAC,EACA,IAAAC,EACA,YAAAC,EACA,aAAAC,EAAe,GACf,OAAAC,EAAS,GACT,iBAAAC,EAAmB,mBACnB,eAAAC,EAAiB,uBACjB,OAAAC,EACA,QAAAC,EACA,OAAQC,EACR,QAASC,EACT,GAAGC,CACL,KAAI,gBACFrB,EACA,gBACA,iBACA,gBACA,iBACA,gBACF,EAIMsB,EADoBjB,IAAc,MACY,CAAE,MAAOH,EAAa,OAAQC,CAAa,EAAI,CAAC,EAE9F,CAACoB,EAAcC,CAAe,EAAIjC,EAAM,SAAyC,SAAS,EAC1F,CAACkC,EAAiBC,CAAkB,EAAInC,EAAM,SAAS,CAAC,CAACqB,CAAW,EACpEe,EAASpC,EAAM,OAAyB,IAAI,EAE5C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UAAU,aAAa,YAAU,SAAS,KAAK,UACjDwB,CACH,EAGIyB,EAAoBP,GACxB1C,EAAA,cAAC,OAAI,GAAG,cAAc,UAAU,aAAa,YAAU,SAAS,KAAK,SAClEyB,CACH,EAGIyB,EAAkB5B,GAAgBmB,GACtCzC,EAAA,cAAC,YAAS,MAAM,OAAO,OAAO,OAAO,MAAO,CAAE,SAAU,WAAY,MAAO,CAAE,EAAG,EAG5EmD,EAAqB9B,GAAea,GACxClC,EAAA,cAAC,OACC,MAAO,CACL,GAAG4C,EACH,SAAU,WACV,MAAO,EACP,OAAQ,YACR,QAAS,GACT,OAAQ,CACV,EACA,aAAW,EAAAG,SAAW,WAAY,WAAY,uBAAuB,EACrE,IAAI,GACJ,IAAK1B,EACP,EAIF,OAAKM,EAcH3B,EAAA,cAAC,OACC,UAAWgB,EACX,MAAO,CACL,QAAS,OACT,cAAe,SACf,GAAGC,CACL,GAEAjB,EAAA,cAAC,OACC,MAAO,CACL,SAAU,WACV,KAAM,SACN,UAAW,CACb,GAECgD,EACAC,EACAC,EACAC,EACAN,CACH,EAEA7C,EAAA,cAAC,OAAI,UAAU,mBAAmB,MAAO,CAAE,KAAM,UAAW,GACzD2B,CACH,CACF,EArCE3B,EAAA,cAAC,OAAI,UAAWgB,EAAW,MAAO,CAAE,SAAU,WAAY,GAAGC,CAAM,GAChE+B,EACAC,EACAC,EACAC,EACAN,CACH,CAiCN,CAAC,EAED/C,EAAM,YAAc",
6
+ "names": ["image_exports", "__export", "Image", "__toCommonJS", "React", "import_classnames", "import_image_props", "import_extract_props", "import_margin_props", "import_width_props", "import_height_props", "import_layout_props", "import_skeleton", "props", "forwardedRef", "nativeWidth", "nativeHeight", "hasFill", "Component", "_asChild", "className", "style", "loading", "alt", "src", "placeholder", "showSkeleton", "fadeIn", "loadingAriaLabel", "errorAriaLabel", "radius", "caption", "userOnLoad", "userOnError", "restProps", "componentDimensionProps", "loadingState", "setLoadingState", "showPlaceholder", "setShowPlaceholder", "imgRef", "handleLoad", "event", "handleError", "img", "isLoading", "isError", "isLoaded", "imgStyle", "imageElement", "node", "classNames", "loadingAnnouncement", "errorAnnouncement", "skeletonElement", "placeholderElement"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/components/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,KAAK,aAAa,GAAG,eAAe,CAAC,OAAO,aAAa,CAAC,GAAG;IAC3D;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACjE;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAClE;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAA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AY,EAAE,UAAU,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- import*as e from"react";import S from"classnames";import{imagePropDefs as G}from"./image.props.js";import{extractProps as q}from"../helpers/extract-props.js";import{marginPropDefs as F}from"../props/margin.props.js";import{widthPropDefs as _}from"../props/width.props.js";import{heightPropDefs as B}from"../props/height.props.js";import{layoutPropDefs as J}from"../props/layout.props.js";import{Skeleton as K}from"./skeleton.js";const w=e.forwardRef((t,r)=>{const x=typeof t.width=="number"?t.width:void 0,H=typeof t.height=="number"?t.height:void 0,{as:d="img",asChild:Q,className:g,style:c,loading:D="lazy",alt:N,src:s,placeholder:a,showSkeleton:T=!1,fadeIn:f=!0,loadingAriaLabel:M="Loading image...",errorAriaLabel:j="Failed to load image",radius:k,caption:h,onLoad:y,onError:u,...R}=q(t,G,F,_,B,J),W=d!=="img"?{width:x,height:H}:{},[i,n]=e.useState("loading"),[O,m]=e.useState(!!a),P=e.useRef(null),z=e.useCallback(o=>{n("loaded"),m(!1),y?.(o)},[y]),A=e.useCallback(o=>{n("error"),m(!1),u?.(o)},[u]);if(e.useEffect(()=>{const o=P.current;o&&o.complete&&o.naturalWidth>0&&(n("loaded"),m(!1))},[s]),!s)return console.warn("Image component: src prop is required"),null;const l=i==="loading",p=i==="error",I={width:"100%",height:"100%",display:"block",opacity:f?i==="loaded"?1:0:1,transition:f?"opacity 0.3s ease-out":"none"},v=e.createElement(d,{ref:o=>{P.current=o,typeof r=="function"?r(o):r&&(r.current=o)},loading:D,style:{...I,position:"relative",zIndex:1},className:S("rt-reset","rt-Image"),alt:N,src:s,"data-radius":k,onLoad:z,onError:A,"aria-busy":l,"aria-invalid":p,"aria-describedby":p?"image-error":void 0,...W,...R}),E=l&&e.createElement("div",{className:"rt-sr-only","aria-live":"polite",role:"status"},M),L=p&&e.createElement("div",{id:"image-error",className:"rt-sr-only","aria-live":"polite",role:"alert"},j),C=T&&l&&e.createElement(K,{width:"100%",height:"100%",style:{position:"absolute",inset:0}}),b=a&&O&&e.createElement("img",{style:{...I,position:"absolute",inset:0,filter:"blur(4px)",opacity:.7,zIndex:0},className:S("rt-reset","rt-Image","rt-Image--placeholder"),alt:"",src:a});return h?e.createElement("div",{className:g,style:{display:"flex",flexDirection:"column",...c}},e.createElement("div",{style:{position:"relative",flex:"1 1 0%",minHeight:0}},E,L,C,b,v),e.createElement("div",{className:"rt-Image-caption",style:{flex:"0 0 auto"}},h)):e.createElement("div",{className:g,style:{position:"relative",...c}},E,L,C,b,v)});w.displayName="Image";export{w as Image};
1
+ import*as e from"react";import x from"classnames";import{imagePropDefs as q}from"./image.props.js";import{extractProps as _}from"../helpers/extract-props.js";import{marginPropDefs as B}from"../props/margin.props.js";import{widthPropDefs as J}from"../props/width.props.js";import{heightPropDefs as K}from"../props/height.props.js";import{layoutPropDefs as Q}from"../props/layout.props.js";import{Skeleton as U}from"./skeleton.js";const H=e.forwardRef((t,r)=>{const D=typeof t.width=="number"?t.width:void 0,N=typeof t.height=="number"?t.height:void 0,c="fill"in t&&t.fill===!0,{as:f="img",asChild:V,className:h,style:y,loading:T="lazy",alt:M,src:s,placeholder:a,showSkeleton:k=!1,fadeIn:i=!0,loadingAriaLabel:j="Loading image...",errorAriaLabel:R="Failed to load image",radius:W,caption:u,onLoad:P,onError:I,...O}=_(t,q,B,J,K,Q),z=f!=="img"?{width:D,height:N}:{},[n,l]=e.useState("loading"),[A,m]=e.useState(!!a),v=e.useRef(null),F=e.useCallback(o=>{l("loaded"),m(!1),P?.(o)},[P]),G=e.useCallback(o=>{l("error"),m(!1),I?.(o)},[I]);if(e.useEffect(()=>{const o=v.current;o&&o.complete&&o.naturalWidth>0&&(l("loaded"),m(!1))},[s]),!s)return console.warn("Image component: src prop is required"),null;const p=n==="loading",d=n==="error",E=n==="loaded",g=c?{display:"block",opacity:i?E?1:0:1,transition:i?"opacity 0.3s ease-out":"none"}:{width:"100%",height:"100%",display:"block",opacity:i?E?1:0:1,transition:i?"opacity 0.3s ease-out":"none"},L=e.createElement(f,{ref:o=>{v.current=o,typeof r=="function"?r(o):r&&(r.current=o)},loading:T,style:c?g:{...g,position:"relative",zIndex:1},className:x("rt-reset","rt-Image"),alt:M,src:s,"data-radius":W,onLoad:F,onError:G,"aria-busy":p,"aria-invalid":d,"aria-describedby":d?"image-error":void 0,...z,...O}),b=p&&e.createElement("div",{className:"rt-sr-only","aria-live":"polite",role:"status"},j),C=d&&e.createElement("div",{id:"image-error",className:"rt-sr-only","aria-live":"polite",role:"alert"},R),S=k&&p&&e.createElement(U,{width:"100%",height:"100%",style:{position:"absolute",inset:0}}),w=a&&A&&e.createElement("img",{style:{...g,position:"absolute",inset:0,filter:"blur(4px)",opacity:.7,zIndex:0},className:x("rt-reset","rt-Image","rt-Image--placeholder"),alt:"",src:a});return u?e.createElement("div",{className:h,style:{display:"flex",flexDirection:"column",...y}},e.createElement("div",{style:{position:"relative",flex:"1 1 0%",minHeight:0}},b,C,S,w,L),e.createElement("div",{className:"rt-Image-caption",style:{flex:"0 0 auto"}},u)):e.createElement("div",{className:h,style:{position:"relative",...y}},b,C,S,w,L)});H.displayName="Image";export{H as Image};
2
2
  //# sourceMappingURL=image.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/image.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { imagePropDefs } from './image.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\nimport { widthPropDefs } from '../props/width.props.js';\nimport { heightPropDefs } from '../props/height.props.js';\nimport { layoutPropDefs } from '../props/layout.props.js';\nimport { Skeleton } from './skeleton.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { WidthProps } from '../props/width.props.js';\nimport type { HeightProps } from '../props/height.props.js';\nimport type { LayoutProps } from '../props/layout.props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype ImageElement = React.ElementRef<'img'>;\n\ntype ImageOwnProps = GetPropDefTypes<typeof imagePropDefs> & {\n /**\n * Native loading behavior for the image\n * @default 'lazy'\n */\n loading?: 'eager' | 'lazy';\n /**\n * Placeholder image URL to show while the main image is loading (LQIP pattern)\n */\n placeholder?: string;\n /**\n * Shows a skeleton placeholder while loading\n */\n showSkeleton?: boolean;\n /**\n * Whether the image should fade in when loaded\n * @default true\n */\n fadeIn?: boolean;\n /**\n * Callback fired when the image successfully loads\n */\n onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;\n /**\n * Callback fired when the image fails to load\n */\n onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;\n /**\n * Alternative text for the image (required for accessibility)\n */\n alt: string;\n /**\n * Image source URL\n */\n src: string;\n};\n\ninterface CommonImageProps\n extends MarginProps,\n WidthProps,\n HeightProps,\n LayoutProps,\n ImageOwnProps {}\n\ntype ImageImgProps = { as?: 'img' } & ComponentPropsWithout<'img', RemovedProps | 'color' | 'width' | 'height' | 'alt'>;\ntype ImageComponentProps = { as: React.ComponentType<any> } & Record<string, any>;\ntype ImageProps = CommonImageProps & (ImageImgProps | ImageComponentProps);\n\n/**\n * Image component for displaying images with enhanced loading states and accessibility.\n *\n * Supports polymorphic rendering via the `as` prop for Next.js Image compatibility.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Image src=\"/photo.jpg\" alt=\"Team photo\" />\n *\n * // With Next.js Image\n * import NextImage from 'next/image';\n * <Image as={NextImage} src=\"/photo.jpg\" alt=\"...\" width={400} height={300} />\n *\n * // With placeholder and skeleton\n * <Image\n * src=\"/high-res.jpg\"\n * placeholder=\"/low-res.jpg\"\n * showSkeleton\n * alt=\"Product showcase\"\n * />\n *\n * // With caption\n * <Image\n * src=\"/chart.png\"\n * alt=\"Sales data visualization\"\n * caption=\"Q3 2024 Sales Performance\"\n * />\n * ```\n */\nconst Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) => {\n // Extract native width/height before extractProps consumes them (for Next.js Image compatibility)\n const nativeWidth = typeof props.width === 'number' ? props.width : undefined;\n const nativeHeight = typeof props.height === 'number' ? props.height : undefined;\n\n const {\n as: Component = 'img',\n asChild: _asChild, // Extract to prevent passing to DOM element\n className,\n style,\n loading = 'lazy',\n alt,\n src,\n placeholder,\n showSkeleton = false,\n fadeIn = true,\n loadingAriaLabel = 'Loading image...',\n errorAriaLabel = 'Failed to load image',\n radius,\n caption,\n onLoad: userOnLoad,\n onError: userOnError,\n ...restProps\n } = extractProps(\n props,\n imagePropDefs,\n marginPropDefs,\n widthPropDefs,\n heightPropDefs,\n layoutPropDefs,\n );\n\n // When using a custom component (like Next.js Image), pass native width/height\n const isCustomComponent = Component !== 'img';\n const componentDimensionProps = isCustomComponent ? { width: nativeWidth, height: nativeHeight } : {};\n\n const [loadingState, setLoadingState] = React.useState<'loading' | 'loaded' | 'error'>('loading');\n const [showPlaceholder, setShowPlaceholder] = React.useState(!!placeholder);\n const imgRef = React.useRef<HTMLImageElement>(null);\n\n const handleLoad = React.useCallback(\n (event: React.SyntheticEvent<HTMLImageElement>) => {\n setLoadingState('loaded');\n setShowPlaceholder(false);\n userOnLoad?.(event);\n },\n [userOnLoad],\n );\n\n const handleError = React.useCallback(\n (event: React.SyntheticEvent<HTMLImageElement>) => {\n setLoadingState('error');\n setShowPlaceholder(false);\n userOnError?.(event);\n },\n [userOnError],\n );\n\n // Check if image is already cached\n React.useEffect(() => {\n const img = imgRef.current;\n if (img && img.complete && img.naturalWidth > 0) {\n setLoadingState('loaded');\n setShowPlaceholder(false);\n }\n }, [src]);\n\n if (!src) {\n console.warn('Image component: src prop is required');\n return null;\n }\n\n const isLoading = loadingState === 'loading';\n const isError = loadingState === 'error';\n const isLoaded = loadingState === 'loaded';\n\n const imgStyle: React.CSSProperties = {\n width: '100%',\n height: '100%',\n display: 'block',\n opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,\n transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',\n };\n\n const mergeRefs = (node: HTMLImageElement | null) => {\n (imgRef as React.RefObject<HTMLImageElement | null>).current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n };\n\n const imageElement = (\n <Component\n ref={mergeRefs}\n loading={loading}\n style={{ ...imgStyle, position: 'relative', zIndex: 1 }}\n className={classNames('rt-reset', 'rt-Image')}\n alt={alt}\n src={src}\n data-radius={radius}\n onLoad={handleLoad}\n onError={handleError}\n aria-busy={isLoading}\n aria-invalid={isError}\n aria-describedby={isError ? 'image-error' : undefined}\n {...componentDimensionProps}\n {...restProps}\n />\n );\n\n const loadingAnnouncement = isLoading && (\n <div className=\"rt-sr-only\" aria-live=\"polite\" role=\"status\">\n {loadingAriaLabel}\n </div>\n );\n\n const errorAnnouncement = isError && (\n <div id=\"image-error\" className=\"rt-sr-only\" aria-live=\"polite\" role=\"alert\">\n {errorAriaLabel}\n </div>\n );\n\n const skeletonElement = showSkeleton && isLoading && (\n <Skeleton width=\"100%\" height=\"100%\" style={{ position: 'absolute', inset: 0 }} />\n );\n\n const placeholderElement = placeholder && showPlaceholder && (\n <img\n style={{\n ...imgStyle,\n position: 'absolute',\n inset: 0,\n filter: 'blur(4px)',\n opacity: 0.7,\n zIndex: 0,\n }}\n className={classNames('rt-reset', 'rt-Image', 'rt-Image--placeholder')}\n alt=\"\"\n src={placeholder}\n />\n );\n\n // Simple flat structure when no caption\n if (!caption) {\n return (\n <div className={className} style={{ position: 'relative', ...style }}>\n {loadingAnnouncement}\n {errorAnnouncement}\n {skeletonElement}\n {placeholderElement}\n {imageElement}\n </div>\n );\n }\n\n // Flexbox structure when caption is present\n return (\n <div\n className={className}\n style={{\n display: 'flex',\n flexDirection: 'column',\n ...style,\n }}\n >\n <div\n style={{\n position: 'relative',\n flex: '1 1 0%',\n minHeight: 0,\n }}\n >\n {loadingAnnouncement}\n {errorAnnouncement}\n {skeletonElement}\n {placeholderElement}\n {imageElement}\n </div>\n\n <div className=\"rt-Image-caption\" style={{ flex: '0 0 auto' }}>\n {caption}\n </div>\n </div>\n );\n});\n\nImage.displayName = 'Image';\n\nexport { Image };\nexport type { ImageProps };\n"],
5
- "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAEvB,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,gBAAAC,MAAoB,8BAC7B,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,YAAAC,MAAgB,gBAyFzB,MAAMC,EAAQT,EAAM,WAAqC,CAACU,EAAOC,IAAiB,CAEhF,MAAMC,EAAc,OAAOF,EAAM,OAAU,SAAWA,EAAM,MAAQ,OAC9DG,EAAe,OAAOH,EAAM,QAAW,SAAWA,EAAM,OAAS,OAEjE,CACJ,GAAII,EAAY,MAChB,QAASC,EACT,UAAAC,EACA,MAAAC,EACA,QAAAC,EAAU,OACV,IAAAC,EACA,IAAAC,EACA,YAAAC,EACA,aAAAC,EAAe,GACf,OAAAC,EAAS,GACT,iBAAAC,EAAmB,mBACnB,eAAAC,EAAiB,uBACjB,OAAAC,EACA,QAAAC,EACA,OAAQC,EACR,QAASC,EACT,GAAGC,CACL,EAAI3B,EACFO,EACAR,EACAE,EACAC,EACAC,EACAC,CACF,EAIMwB,EADoBjB,IAAc,MACY,CAAE,MAAOF,EAAa,OAAQC,CAAa,EAAI,CAAC,EAE9F,CAACmB,EAAcC,CAAe,EAAIjC,EAAM,SAAyC,SAAS,EAC1F,CAACkC,EAAiBC,CAAkB,EAAInC,EAAM,SAAS,CAAC,CAACqB,CAAW,EACpEe,EAASpC,EAAM,OAAyB,IAAI,EAE5CqC,EAAarC,EAAM,YACtBsC,GAAkD,CACjDL,EAAgB,QAAQ,EACxBE,EAAmB,EAAK,EACxBP,IAAaU,CAAK,CACpB,EACA,CAACV,CAAU,CACb,EAEMW,EAAcvC,EAAM,YAC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AAqB5B,GAAea,GACxClC,EAAA,cAAC,OACC,MAAO,CACL,GAAG2C,EACH,SAAU,WACV,MAAO,EACP,OAAQ,YACR,QAAS,GACT,OAAQ,CACV,EACA,UAAW1C,EAAW,WAAY,WAAY,uBAAuB,EACrE,IAAI,GACJ,IAAKoB,EACP,EAIF,OAAKM,EAcH3B,EAAA,cAAC,OACC,UAAWgB,EACX,MAAO,CACL,QAAS,OACT,cAAe,SACf,GAAGC,CACL,GAEAjB,EAAA,cAAC,OACC,MAAO,CACL,SAAU,WACV,KAAM,SACN,UAAW,CACb,GAEC8C,EACAC,EACAC,EACAC,EACAL,CACH,EAEA5C,EAAA,cAAC,OAAI,UAAU,mBAAmB,MAAO,CAAE,KAAM,UAAW,GACzD2B,CACH,CACF,EArCE3B,EAAA,cAAC,OAAI,UAAWgB,EAAW,MAAO,CAAE,SAAU,WAAY,GAAGC,CAAM,GAChE6B,EACAC,EACAC,EACAC,EACAL,CACH,CAiCN,CAAC,EAEDnC,EAAM,YAAc",
6
- "names": ["React", "classNames", "imagePropDefs", "extractProps", "marginPropDefs", "widthPropDefs", "heightPropDefs", "layoutPropDefs", "Skeleton", "Image", "props", "forwardedRef", "nativeWidth", "nativeHeight", "Component", "_asChild", "className", "style", "loading", "alt", "src", "placeholder", "showSkeleton", "fadeIn", "loadingAriaLabel", "errorAriaLabel", "radius", "caption", "userOnLoad", "userOnError", "restProps", "componentDimensionProps", "loadingState", "setLoadingState", "showPlaceholder", "setShowPlaceholder", "imgRef", "handleLoad", "event", "handleError", "img", "isLoading", "isError", "imgStyle", "imageElement", "node", "loadingAnnouncement", "errorAnnouncement", "skeletonElement", "placeholderElement"]
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { imagePropDefs } from './image.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\nimport { widthPropDefs } from '../props/width.props.js';\nimport { heightPropDefs } from '../props/height.props.js';\nimport { layoutPropDefs } from '../props/layout.props.js';\nimport { Skeleton } from './skeleton.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { MarginProps } from '../props/margin.props.js';\nimport type { WidthProps } from '../props/width.props.js';\nimport type { HeightProps } from '../props/height.props.js';\nimport type { LayoutProps } from '../props/layout.props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype ImageElement = React.ElementRef<'img'>;\n\ntype ImageOwnProps = GetPropDefTypes<typeof imagePropDefs> & {\n /**\n * Native loading behavior for the image\n * @default 'lazy'\n */\n loading?: 'eager' | 'lazy';\n /**\n * Placeholder image URL to show while the main image is loading (LQIP pattern)\n */\n placeholder?: string;\n /**\n * Shows a skeleton placeholder while loading\n */\n showSkeleton?: boolean;\n /**\n * Whether the image should fade in when loaded\n * @default true\n */\n fadeIn?: boolean;\n /**\n * Callback fired when the image successfully loads\n */\n onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;\n /**\n * Callback fired when the image fails to load\n */\n onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;\n /**\n * Alternative text for the image (required for accessibility)\n */\n alt: string;\n /**\n * Image source URL\n */\n src: string;\n};\n\ninterface CommonImageProps\n extends MarginProps,\n WidthProps,\n HeightProps,\n LayoutProps,\n ImageOwnProps {}\n\ntype ImageImgProps = { as?: 'img' } & ComponentPropsWithout<'img', RemovedProps | 'color' | 'width' | 'height' | 'alt'>;\ntype ImageComponentProps = { as: React.ComponentType<any> } & Record<string, any>;\ntype ImageProps = CommonImageProps & (ImageImgProps | ImageComponentProps);\n\n/**\n * Image component for displaying images with enhanced loading states and accessibility.\n *\n * Supports polymorphic rendering via the `as` prop for Next.js Image compatibility.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Image src=\"/photo.jpg\" alt=\"Team photo\" />\n *\n * // With Next.js Image\n * import NextImage from 'next/image';\n * <Image as={NextImage} src=\"/photo.jpg\" alt=\"...\" width={400} height={300} />\n *\n * // With placeholder and skeleton\n * <Image\n * src=\"/high-res.jpg\"\n * placeholder=\"/low-res.jpg\"\n * showSkeleton\n * alt=\"Product showcase\"\n * />\n *\n * // With caption\n * <Image\n * src=\"/chart.png\"\n * alt=\"Sales data visualization\"\n * caption=\"Q3 2024 Sales Performance\"\n * />\n * ```\n */\nconst Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) => {\n // Extract native width/height before extractProps consumes them (for Next.js Image compatibility)\n const nativeWidth = typeof props.width === 'number' ? props.width : undefined;\n const nativeHeight = typeof props.height === 'number' ? props.height : undefined;\n // Check if fill prop is used (for Next.js Image compatibility)\n const hasFill = 'fill' in props && props.fill === true;\n\n const {\n as: Component = 'img',\n asChild: _asChild, // Extract to prevent passing to DOM element\n className,\n style,\n loading = 'lazy',\n alt,\n src,\n placeholder,\n showSkeleton = false,\n fadeIn = true,\n loadingAriaLabel = 'Loading image...',\n errorAriaLabel = 'Failed to load image',\n radius,\n caption,\n onLoad: userOnLoad,\n onError: userOnError,\n ...restProps\n } = extractProps(\n props,\n imagePropDefs,\n marginPropDefs,\n widthPropDefs,\n heightPropDefs,\n layoutPropDefs,\n );\n\n // When using a custom component (like Next.js Image), pass native width/height\n const isCustomComponent = Component !== 'img';\n const componentDimensionProps = isCustomComponent ? { width: nativeWidth, height: nativeHeight } : {};\n\n const [loadingState, setLoadingState] = React.useState<'loading' | 'loaded' | 'error'>('loading');\n const [showPlaceholder, setShowPlaceholder] = React.useState(!!placeholder);\n const imgRef = React.useRef<HTMLImageElement>(null);\n\n const handleLoad = React.useCallback(\n (event: React.SyntheticEvent<HTMLImageElement>) => {\n setLoadingState('loaded');\n setShowPlaceholder(false);\n userOnLoad?.(event);\n },\n [userOnLoad],\n );\n\n const handleError = React.useCallback(\n (event: React.SyntheticEvent<HTMLImageElement>) => {\n setLoadingState('error');\n setShowPlaceholder(false);\n userOnError?.(event);\n },\n [userOnError],\n );\n\n // Check if image is already cached\n React.useEffect(() => {\n const img = imgRef.current;\n if (img && img.complete && img.naturalWidth > 0) {\n setLoadingState('loaded');\n setShowPlaceholder(false);\n }\n }, [src]);\n\n if (!src) {\n console.warn('Image component: src prop is required');\n return null;\n }\n\n const isLoading = loadingState === 'loading';\n const isError = loadingState === 'error';\n const isLoaded = loadingState === 'loaded';\n\n // When using fill (Next.js Image), don't add dimension/position styles as Next.js handles them\n const imgStyle: React.CSSProperties = hasFill\n ? {\n display: 'block',\n opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,\n transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',\n }\n : {\n width: '100%',\n height: '100%',\n display: 'block',\n opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,\n transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',\n };\n\n const mergeRefs = (node: HTMLImageElement | null) => {\n (imgRef as React.RefObject<HTMLImageElement | null>).current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n };\n\n const imageElement = (\n <Component\n ref={mergeRefs}\n loading={loading}\n style={hasFill ? imgStyle : { ...imgStyle, position: 'relative', zIndex: 1 }}\n className={classNames('rt-reset', 'rt-Image')}\n alt={alt}\n src={src}\n data-radius={radius}\n onLoad={handleLoad}\n onError={handleError}\n aria-busy={isLoading}\n aria-invalid={isError}\n aria-describedby={isError ? 'image-error' : undefined}\n {...componentDimensionProps}\n {...restProps}\n />\n );\n\n const loadingAnnouncement = isLoading && (\n <div className=\"rt-sr-only\" aria-live=\"polite\" role=\"status\">\n {loadingAriaLabel}\n </div>\n );\n\n const errorAnnouncement = isError && (\n <div id=\"image-error\" className=\"rt-sr-only\" aria-live=\"polite\" role=\"alert\">\n {errorAriaLabel}\n </div>\n );\n\n const skeletonElement = showSkeleton && isLoading && (\n <Skeleton width=\"100%\" height=\"100%\" style={{ position: 'absolute', inset: 0 }} />\n );\n\n const placeholderElement = placeholder && showPlaceholder && (\n <img\n style={{\n ...imgStyle,\n position: 'absolute',\n inset: 0,\n filter: 'blur(4px)',\n opacity: 0.7,\n zIndex: 0,\n }}\n className={classNames('rt-reset', 'rt-Image', 'rt-Image--placeholder')}\n alt=\"\"\n src={placeholder}\n />\n );\n\n // Simple flat structure when no caption\n if (!caption) {\n return (\n <div className={className} style={{ position: 'relative', ...style }}>\n {loadingAnnouncement}\n {errorAnnouncement}\n {skeletonElement}\n {placeholderElement}\n {imageElement}\n </div>\n );\n }\n\n // Flexbox structure when caption is present\n return (\n <div\n className={className}\n style={{\n display: 'flex',\n flexDirection: 'column',\n ...style,\n }}\n >\n <div\n style={{\n position: 'relative',\n flex: '1 1 0%',\n minHeight: 0,\n }}\n >\n {loadingAnnouncement}\n {errorAnnouncement}\n {skeletonElement}\n {placeholderElement}\n {imageElement}\n </div>\n\n <div className=\"rt-Image-caption\" style={{ flex: '0 0 auto' }}>\n {caption}\n </div>\n </div>\n );\n});\n\nImage.displayName = 'Image';\n\nexport { Image };\nexport type { ImageProps };\n"],
5
+ "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAEvB,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,gBAAAC,MAAoB,8BAC7B,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,YAAAC,MAAgB,gBAyFzB,MAAMC,EAAQT,EAAM,WAAqC,CAACU,EAAOC,IAAiB,CAEhF,MAAMC,EAAc,OAAOF,EAAM,OAAU,SAAWA,EAAM,MAAQ,OAC9DG,EAAe,OAAOH,EAAM,QAAW,SAAWA,EAAM,OAAS,OAEjEI,EAAU,SAAUJ,GAASA,EAAM,OAAS,GAE5C,CACJ,GAAIK,EAAY,MAChB,QAASC,EACT,UAAAC,EACA,MAAAC,EACA,QAAAC,EAAU,OACV,IAAAC,EACA,IAAAC,EACA,YAAAC,EACA,aAAAC,EAAe,GACf,OAAAC,EAAS,GACT,iBAAAC,EAAmB,mBACnB,eAAAC,EAA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AC,EAEDrC,EAAM,YAAc",
6
+ "names": ["React", "classNames", "imagePropDefs", "extractProps", "marginPropDefs", "widthPropDefs", "heightPropDefs", "layoutPropDefs", "Skeleton", "Image", "props", "forwardedRef", "nativeWidth", "nativeHeight", "hasFill", "Component", "_asChild", "className", "style", "loading", "alt", "src", "placeholder", "showSkeleton", "fadeIn", "loadingAriaLabel", "errorAriaLabel", "radius", "caption", "userOnLoad", "userOnError", "restProps", "componentDimensionProps", "loadingState", "setLoadingState", "showPlaceholder", "setShowPlaceholder", "imgRef", "handleLoad", "event", "handleError", "img", "isLoading", "isError", "isLoaded", "imgStyle", "imageElement", "node", "loadingAnnouncement", "errorAnnouncement", "skeletonElement", "placeholderElement"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushagradhawan/kookie-ui",
3
- "version": "0.1.114",
3
+ "version": "0.1.115",
4
4
  "description": "A modern React component library with beautiful design tokens, flexible theming, and comprehensive documentation",
5
5
  "keywords": [
6
6
  "react",
@@ -279,6 +279,6 @@
279
279
  "title": "Base-button Component Props",
280
280
  "description": "Props schema for the base-button component in Kookie UI",
281
281
  "version": "1.0.0",
282
- "generatedAt": "2026-01-08T06:54:17.447Z",
282
+ "generatedAt": "2026-01-08T07:15:59.930Z",
283
283
  "source": "Zod schema"
284
284
  }
@@ -530,6 +530,6 @@
530
530
  "title": "Button Component Props",
531
531
  "description": "Props schema for the button component in Kookie UI",
532
532
  "version": "1.0.0",
533
- "generatedAt": "2026-01-08T06:54:17.453Z",
533
+ "generatedAt": "2026-01-08T07:15:59.936Z",
534
534
  "source": "Zod schema"
535
535
  }
@@ -313,6 +313,6 @@
313
313
  "title": "Icon-button Component Props",
314
314
  "description": "Props schema for the icon-button component in Kookie UI",
315
315
  "version": "1.0.0",
316
- "generatedAt": "2026-01-08T06:54:17.454Z",
316
+ "generatedAt": "2026-01-08T07:15:59.937Z",
317
317
  "source": "Zod schema"
318
318
  }
@@ -3,7 +3,7 @@
3
3
  "title": "Kookie UI Button Components",
4
4
  "description": "Complete JSON Schema collection for all button components in Kookie UI",
5
5
  "version": "1.0.0",
6
- "generatedAt": "2026-01-08T06:54:17.457Z",
6
+ "generatedAt": "2026-01-08T07:15:59.940Z",
7
7
  "source": "Zod schemas",
8
8
  "components": {
9
9
  "base-button": {
@@ -287,7 +287,7 @@
287
287
  "title": "Base-button Component Props",
288
288
  "description": "Props schema for the base-button component in Kookie UI",
289
289
  "version": "1.0.0",
290
- "generatedAt": "2026-01-08T06:54:17.447Z",
290
+ "generatedAt": "2026-01-08T07:15:59.930Z",
291
291
  "source": "Zod schema"
292
292
  },
293
293
  "button": {
@@ -822,7 +822,7 @@
822
822
  "title": "Button Component Props",
823
823
  "description": "Props schema for the button component in Kookie UI",
824
824
  "version": "1.0.0",
825
- "generatedAt": "2026-01-08T06:54:17.453Z",
825
+ "generatedAt": "2026-01-08T07:15:59.936Z",
826
826
  "source": "Zod schema"
827
827
  },
828
828
  "icon-button": {
@@ -1140,7 +1140,7 @@
1140
1140
  "title": "Icon-button Component Props",
1141
1141
  "description": "Props schema for the icon-button component in Kookie UI",
1142
1142
  "version": "1.0.0",
1143
- "generatedAt": "2026-01-08T06:54:17.454Z",
1143
+ "generatedAt": "2026-01-08T07:15:59.937Z",
1144
1144
  "source": "Zod schema"
1145
1145
  },
1146
1146
  "toggle-button": {
@@ -1683,7 +1683,7 @@
1683
1683
  "title": "Toggle-button Component Props",
1684
1684
  "description": "Props schema for the toggle-button component in Kookie UI",
1685
1685
  "version": "1.0.0",
1686
- "generatedAt": "2026-01-08T06:54:17.456Z",
1686
+ "generatedAt": "2026-01-08T07:15:59.939Z",
1687
1687
  "source": "Zod schema"
1688
1688
  },
1689
1689
  "toggle-icon-button": {
@@ -2009,7 +2009,7 @@
2009
2009
  "title": "Toggle-icon-button Component Props",
2010
2010
  "description": "Props schema for the toggle-icon-button component in Kookie UI",
2011
2011
  "version": "1.0.0",
2012
- "generatedAt": "2026-01-08T06:54:17.457Z",
2012
+ "generatedAt": "2026-01-08T07:15:59.940Z",
2013
2013
  "source": "Zod schema"
2014
2014
  }
2015
2015
  }
@@ -538,6 +538,6 @@
538
538
  "title": "Toggle-button Component Props",
539
539
  "description": "Props schema for the toggle-button component in Kookie UI",
540
540
  "version": "1.0.0",
541
- "generatedAt": "2026-01-08T06:54:17.456Z",
541
+ "generatedAt": "2026-01-08T07:15:59.939Z",
542
542
  "source": "Zod schema"
543
543
  }
@@ -321,6 +321,6 @@
321
321
  "title": "Toggle-icon-button Component Props",
322
322
  "description": "Props schema for the toggle-icon-button component in Kookie UI",
323
323
  "version": "1.0.0",
324
- "generatedAt": "2026-01-08T06:54:17.457Z",
324
+ "generatedAt": "2026-01-08T07:15:59.940Z",
325
325
  "source": "Zod schema"
326
326
  }
@@ -100,6 +100,8 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
100
100
  // Extract native width/height before extractProps consumes them (for Next.js Image compatibility)
101
101
  const nativeWidth = typeof props.width === 'number' ? props.width : undefined;
102
102
  const nativeHeight = typeof props.height === 'number' ? props.height : undefined;
103
+ // Check if fill prop is used (for Next.js Image compatibility)
104
+ const hasFill = 'fill' in props && props.fill === true;
103
105
 
104
106
  const {
105
107
  as: Component = 'img',
@@ -172,13 +174,20 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
172
174
  const isError = loadingState === 'error';
173
175
  const isLoaded = loadingState === 'loaded';
174
176
 
175
- const imgStyle: React.CSSProperties = {
176
- width: '100%',
177
- height: '100%',
178
- display: 'block',
179
- opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,
180
- transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',
181
- };
177
+ // When using fill (Next.js Image), don't add dimension/position styles as Next.js handles them
178
+ const imgStyle: React.CSSProperties = hasFill
179
+ ? {
180
+ display: 'block',
181
+ opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,
182
+ transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',
183
+ }
184
+ : {
185
+ width: '100%',
186
+ height: '100%',
187
+ display: 'block',
188
+ opacity: fadeIn ? (isLoaded ? 1 : 0) : 1,
189
+ transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',
190
+ };
182
191
 
183
192
  const mergeRefs = (node: HTMLImageElement | null) => {
184
193
  (imgRef as React.RefObject<HTMLImageElement | null>).current = node;
@@ -193,7 +202,7 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
193
202
  <Component
194
203
  ref={mergeRefs}
195
204
  loading={loading}
196
- style={{ ...imgStyle, position: 'relative', zIndex: 1 }}
205
+ style={hasFill ? imgStyle : { ...imgStyle, position: 'relative', zIndex: 1 }}
197
206
  className={classNames('rt-reset', 'rt-Image')}
198
207
  alt={alt}
199
208
  src={src}