@yamada-ui/image
Advanced tools
Comparing version 1.2.4-dev-20241005224505 to 1.2.4-dev-20241006000212
@@ -10,3 +10,3 @@ import * as _yamada_ui_core from '@yamada-ui/core'; | ||
*/ | ||
fallback?: string | ReactElement; | ||
fallback?: ReactElement | string; | ||
/** | ||
@@ -18,4 +18,8 @@ * - beforeLoadOrError: loads the fallbackImage while loading the src. | ||
*/ | ||
fallbackStrategy?: "onError" | "beforeLoadOrError"; | ||
fallbackStrategy?: "beforeLoadOrError" | "onError"; | ||
/** | ||
* The CSS `object-fit` property. | ||
*/ | ||
fit?: CSSUIProps["objectFit"]; | ||
/** | ||
* The CSS `box-size` property. | ||
@@ -26,6 +30,2 @@ * | ||
size?: CSSUIProps["boxSize"]; | ||
/** | ||
* The CSS `object-fit` property. | ||
*/ | ||
fit?: CSSUIProps["objectFit"]; | ||
} | ||
@@ -32,0 +32,0 @@ interface ImageProps extends Omit<HTMLUIProps<"img">, keyof UseImageProps>, Omit<ThemeProps<"Image">, "size">, UseImageProps, ImageOptions { |
@@ -36,10 +36,10 @@ "use client" | ||
var useImage = ({ | ||
crossOrigin, | ||
ignoreFallback, | ||
loading, | ||
sizes, | ||
src, | ||
srcSet, | ||
onLoad, | ||
onError, | ||
crossOrigin, | ||
sizes, | ||
ignoreFallback | ||
onLoad | ||
}) => { | ||
@@ -93,15 +93,15 @@ const [status, setStatus] = (0, import_react.useState)("pending"); | ||
let { | ||
className, | ||
boxSize, | ||
crossOrigin, | ||
fallback, | ||
fallbackStrategy = "beforeLoadOrError", | ||
fit: objectFit, | ||
fallback, | ||
ignoreFallback, | ||
loading, | ||
referrerPolicy, | ||
src, | ||
srcSet, | ||
loading, | ||
ignoreFallback, | ||
crossOrigin, | ||
className, | ||
fallbackStrategy = "beforeLoadOrError", | ||
onError, | ||
onLoad, | ||
referrerPolicy, | ||
...rest | ||
@@ -137,8 +137,8 @@ } = (0, import_core.omitThemeProps)(mergedProps); | ||
ref, | ||
src, | ||
srcSet, | ||
className: (0, import_utils2.cx)("ui-image", className), | ||
crossOrigin, | ||
loading, | ||
referrerPolicy, | ||
className: (0, import_utils2.cx)("ui-image", className), | ||
src, | ||
srcSet, | ||
__css: css, | ||
@@ -145,0 +145,0 @@ ...ignoreFallback ? { ...rest, onError, onLoad } : rest |
@@ -42,10 +42,10 @@ "use client" | ||
var useImage = ({ | ||
crossOrigin, | ||
ignoreFallback, | ||
loading, | ||
sizes, | ||
src, | ||
srcSet, | ||
onLoad, | ||
onError, | ||
crossOrigin, | ||
sizes, | ||
ignoreFallback | ||
onLoad | ||
}) => { | ||
@@ -99,15 +99,15 @@ const [status, setStatus] = (0, import_react.useState)("pending"); | ||
let { | ||
className, | ||
boxSize, | ||
crossOrigin, | ||
fallback, | ||
fallbackStrategy = "beforeLoadOrError", | ||
fit: objectFit, | ||
fallback, | ||
ignoreFallback, | ||
loading, | ||
referrerPolicy, | ||
src, | ||
srcSet, | ||
loading, | ||
ignoreFallback, | ||
crossOrigin, | ||
className, | ||
fallbackStrategy = "beforeLoadOrError", | ||
onError, | ||
onLoad, | ||
referrerPolicy, | ||
...rest | ||
@@ -143,8 +143,8 @@ } = (0, import_core.omitThemeProps)(mergedProps); | ||
ref, | ||
src, | ||
srcSet, | ||
className: (0, import_utils2.cx)("ui-image", className), | ||
crossOrigin, | ||
loading, | ||
referrerPolicy, | ||
className: (0, import_utils2.cx)("ui-image", className), | ||
src, | ||
srcSet, | ||
__css: css, | ||
@@ -161,3 +161,3 @@ ...ignoreFallback ? { ...rest, onError, onLoad } : rest | ||
var NativeImage = (0, import_core2.ui)("img", { | ||
disableStyleProp: (prop) => ["width", "height"].includes(prop) | ||
disableStyleProp: (prop) => ["height", "width"].includes(prop) | ||
}); | ||
@@ -164,0 +164,0 @@ // Annotate the CommonJS export names for ESM import in node: |
import { HTMLUIProps } from '@yamada-ui/core'; | ||
import { ComponentProps, FC } from 'react'; | ||
interface NativeImageProps extends Omit<HTMLUIProps<"img">, "width" | "height">, Pick<ComponentProps<"img">, "width" | "height"> { | ||
interface NativeImageProps extends Omit<HTMLUIProps<"img">, "height" | "width">, Pick<ComponentProps<"img">, "height" | "width"> { | ||
} | ||
@@ -6,0 +6,0 @@ /** |
@@ -29,3 +29,3 @@ "use client" | ||
var NativeImage = (0, import_core.ui)("img", { | ||
disableStyleProp: (prop) => ["width", "height"].includes(prop) | ||
disableStyleProp: (prop) => ["height", "width"].includes(prop) | ||
}); | ||
@@ -32,0 +32,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -6,10 +6,17 @@ import { ImgHTMLAttributes } from 'react'; | ||
/** | ||
* The image `src` attribute. | ||
* The key used to set the crossOrigin on the HTMLImageElement into which the image will be loaded. | ||
* This tells the browser to request cross-origin access when trying to download the image data. | ||
*/ | ||
src?: string; | ||
crossOrigin?: HTMLImageElementProps["crossOrigin"]; | ||
/** | ||
* The image `srcset` attribute. | ||
* If `true`, opt out of the `fallbackSrc` logic and use as `img`. | ||
* | ||
* @default false | ||
*/ | ||
srcSet?: string; | ||
ignoreFallback?: boolean; | ||
/** | ||
* The image `loading` attribute. | ||
*/ | ||
loading?: HTMLImageElementProps["loading"]; | ||
/** | ||
* The image `sizes` attribute. | ||
@@ -19,6 +26,10 @@ */ | ||
/** | ||
* A callback for when the image `src` has been loaded. | ||
* The image `src` attribute. | ||
*/ | ||
onLoad?: HTMLImageElementProps["onLoad"]; | ||
src?: string; | ||
/** | ||
* The image `srcset` attribute. | ||
*/ | ||
srcSet?: string; | ||
/** | ||
* A callback for when there was an error loading the image `src`. | ||
@@ -28,22 +39,11 @@ */ | ||
/** | ||
* If `true`, opt out of the `fallbackSrc` logic and use as `img`. | ||
* | ||
* @default false | ||
* A callback for when the image `src` has been loaded. | ||
*/ | ||
ignoreFallback?: boolean; | ||
/** | ||
* The key used to set the crossOrigin on the HTMLImageElement into which the image will be loaded. | ||
* This tells the browser to request cross-origin access when trying to download the image data. | ||
*/ | ||
crossOrigin?: HTMLImageElementProps["crossOrigin"]; | ||
/** | ||
* The image `loading` attribute. | ||
*/ | ||
loading?: HTMLImageElementProps["loading"]; | ||
onLoad?: HTMLImageElementProps["onLoad"]; | ||
} | ||
type Status = "loading" | "failed" | "pending" | "loaded"; | ||
declare const shouldShowFallbackImage: (status: Status, fallbackStrategy: "onError" | "beforeLoadOrError") => boolean; | ||
declare const useImage: ({ loading, src, srcSet, onLoad, onError, crossOrigin, sizes, ignoreFallback, }: UseImageProps) => Status; | ||
type Status = "failed" | "loaded" | "loading" | "pending"; | ||
declare const shouldShowFallbackImage: (status: Status, fallbackStrategy: "beforeLoadOrError" | "onError") => boolean; | ||
declare const useImage: ({ crossOrigin, ignoreFallback, loading, sizes, src, srcSet, onError, onLoad, }: UseImageProps) => Status; | ||
type UseImageReturn = ReturnType<typeof useImage>; | ||
export { type UseImageProps, type UseImageReturn, shouldShowFallbackImage, useImage }; |
@@ -32,10 +32,10 @@ "use client" | ||
var useImage = ({ | ||
crossOrigin, | ||
ignoreFallback, | ||
loading, | ||
sizes, | ||
src, | ||
srcSet, | ||
onLoad, | ||
onError, | ||
crossOrigin, | ||
sizes, | ||
ignoreFallback | ||
onLoad | ||
}) => { | ||
@@ -42,0 +42,0 @@ const [status, setStatus] = (0, import_react.useState)("pending"); |
{ | ||
"name": "@yamada-ui/image", | ||
"version": "1.2.4-dev-20241005224505", | ||
"version": "1.2.4-dev-20241006000212", | ||
"description": "Yamada UI media and image component", | ||
@@ -39,4 +39,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@yamada-ui/core": "1.15.2-dev-20241005224505", | ||
"@yamada-ui/utils": "1.5.2" | ||
"@yamada-ui/core": "1.15.2-dev-20241006000212", | ||
"@yamada-ui/utils": "1.5.3-dev-20241006000212" | ||
}, | ||
@@ -43,0 +43,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61869
+ Added@yamada-ui/core@1.15.2-dev-20241006000212(transitive)
+ Added@yamada-ui/portal@1.0.23-dev-20241006000212(transitive)
+ Added@yamada-ui/utils@1.5.3-dev-20241006000212(transitive)
- Removed@yamada-ui/core@1.15.2-dev-20241005224505(transitive)
- Removed@yamada-ui/portal@1.0.23-dev-20241005224505(transitive)
- Removed@yamada-ui/utils@1.5.2(transitive)