@heroui/image 2.2.6 → 2.2.9

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Next UI
3
+ Copyright (c) 2020 Next UI Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -15,10 +15,10 @@ npm i @heroui/image
15
15
  ## Contribution
16
16
 
17
17
  Yes please! See the
18
- [contributing guidelines](https://github.com/frontio-ai/heroui/blob/master/CONTRIBUTING.md)
18
+ [contributing guidelines](https://github.com/heroui-inc/heroui/blob/master/CONTRIBUTING.md)
19
19
  for details.
20
20
 
21
21
  ## License
22
22
 
23
23
  This project is licensed under the terms of the
24
- [MIT license](https://github.com/frontio-ai/heroui/blob/master/LICENSE).
24
+ [MIT license](https://github.com/heroui-inc/heroui/blob/master/LICENSE).
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  useImage
4
- } from "./chunk-DSOLHU5M.mjs";
4
+ } from "./chunk-Q3TXVV4U.mjs";
5
5
 
6
6
  // src/image.tsx
7
7
  import { cloneElement } from "react";
@@ -77,6 +77,8 @@ function useImage(originalProps) {
77
77
  crossOrigin,
78
78
  ...otherProps,
79
79
  style: {
80
+ // img has `height: auto` by default
81
+ // passing the custom height here to override if it is specified
80
82
  ...(otherProps == null ? void 0 : otherProps.height) && { height: h },
81
83
  ...props2.style,
82
84
  ...otherProps.style
@@ -0,0 +1,12 @@
1
+ import * as _heroui_system from '@heroui/system';
2
+ import { UseImageProps } from './use-image.mjs';
3
+ import 'tailwind-variants';
4
+ import 'react';
5
+ import '@heroui/theme';
6
+ import '@heroui/react-utils';
7
+
8
+ interface ImageProps extends Omit<UseImageProps, "showSkeleton"> {
9
+ }
10
+ declare const Image: _heroui_system.InternalForwardRefRenderFunction<"img", ImageProps, never>;
11
+
12
+ export { type ImageProps, Image as default };
package/dist/image.d.ts CHANGED
@@ -9,4 +9,4 @@ interface ImageProps extends Omit<UseImageProps, "showSkeleton"> {
9
9
  }
10
10
  declare const Image: _heroui_system.InternalForwardRefRenderFunction<"img", ImageProps, never>;
11
11
 
12
- export { ImageProps, Image as default };
12
+ export { type ImageProps, Image as default };
package/dist/image.js CHANGED
@@ -104,6 +104,8 @@ function useImage(originalProps) {
104
104
  crossOrigin,
105
105
  ...otherProps,
106
106
  style: {
107
+ // img has `height: auto` by default
108
+ // passing the custom height here to override if it is specified
107
109
  ...(otherProps == null ? void 0 : otherProps.height) && { height: h },
108
110
  ...props2.style,
109
111
  ...otherProps.style
@@ -187,5 +189,3 @@ var Image = (0, import_system2.forwardRef)((props, ref) => {
187
189
  });
188
190
  Image.displayName = "HeroUI.Image";
189
191
  var image_default = Image;
190
- // Annotate the CommonJS export names for ESM import in node:
191
- 0 && (module.exports = {});
package/dist/image.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  image_default
4
- } from "./chunk-MLPFQTYO.mjs";
5
- import "./chunk-DSOLHU5M.mjs";
4
+ } from "./chunk-3TCFMHK3.mjs";
5
+ import "./chunk-Q3TXVV4U.mjs";
6
6
  export {
7
7
  image_default as default
8
8
  };
@@ -0,0 +1,7 @@
1
+ export { default as Image, ImageProps } from './image.mjs';
2
+ export { useImage } from './use-image.mjs';
3
+ import '@heroui/system';
4
+ import 'tailwind-variants';
5
+ import 'react';
6
+ import '@heroui/theme';
7
+ import '@heroui/react-utils';
package/dist/index.js CHANGED
@@ -19,12 +19,12 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
 
21
21
  // src/index.ts
22
- var src_exports = {};
23
- __export(src_exports, {
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
24
  Image: () => image_default,
25
25
  useImage: () => useImage
26
26
  });
27
- module.exports = __toCommonJS(src_exports);
27
+ module.exports = __toCommonJS(index_exports);
28
28
 
29
29
  // src/image.tsx
30
30
  var import_react3 = require("react");
@@ -107,6 +107,8 @@ function useImage(originalProps) {
107
107
  crossOrigin,
108
108
  ...otherProps,
109
109
  style: {
110
+ // img has `height: auto` by default
111
+ // passing the custom height here to override if it is specified
110
112
  ...(otherProps == null ? void 0 : otherProps.height) && { height: h },
111
113
  ...props2.style,
112
114
  ...otherProps.style
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  image_default
4
- } from "./chunk-MLPFQTYO.mjs";
4
+ } from "./chunk-3TCFMHK3.mjs";
5
5
  import {
6
6
  useImage
7
- } from "./chunk-DSOLHU5M.mjs";
7
+ } from "./chunk-Q3TXVV4U.mjs";
8
8
  export {
9
9
  image_default as Image,
10
10
  useImage
@@ -0,0 +1,142 @@
1
+ import * as tailwind_variants from 'tailwind-variants';
2
+ import * as react from 'react';
3
+ import { ImgHTMLAttributes } from 'react';
4
+ import * as _heroui_system from '@heroui/system';
5
+ import { PropGetter, HTMLHeroUIProps } from '@heroui/system';
6
+ import { ImageVariantProps, SlotsToClasses, ImageSlots } from '@heroui/theme';
7
+ import { ReactRef } from '@heroui/react-utils';
8
+
9
+ type NativeImageProps = ImgHTMLAttributes<HTMLImageElement>;
10
+ interface Props extends HTMLHeroUIProps<"img"> {
11
+ /**
12
+ * Ref to the DOM node.
13
+ */
14
+ ref?: ReactRef<HTMLImageElement | null>;
15
+ /**
16
+ * Whether to add a blurred effect to the image.
17
+ * @default false
18
+ */
19
+ isBlurred?: boolean;
20
+ /**
21
+ * A fallback image.
22
+ */
23
+ fallbackSrc?: React.ReactNode;
24
+ /**
25
+ * Whether to disable the loading skeleton.
26
+ * @default false
27
+ */
28
+ disableSkeleton?: boolean;
29
+ /**
30
+ * A callback for when the image `src` has been loaded
31
+ */
32
+ onLoad?: NativeImageProps["onLoad"];
33
+ /**
34
+ * A loading strategy to use for the image.
35
+ */
36
+ loading?: NativeImageProps["loading"];
37
+ /**
38
+ * Whether to remove the wrapper element. This will cause the image to be rendered as a direct child of the parent element.
39
+ * If you set this prop as `true` neither the skeleton nor the zoom effect will work.
40
+ * @default false
41
+ */
42
+ removeWrapper?: boolean;
43
+ /**
44
+ * Controlled loading state.
45
+ */
46
+ isLoading?: boolean;
47
+ /**
48
+ * Function called when image failed to load
49
+ */
50
+ onError?: () => void;
51
+ /**
52
+ * Classname or List of classes to change the classNames of the element.
53
+ * if `className` is passed, it will be added to the base slot.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * <Image classNames={{
58
+ * base:"base-classes", // image classes
59
+ * wrapper: "wrapper-classes",
60
+ * blurredImg: "blurredImg-classes", // this is a cloned version of the img
61
+ * }} />
62
+ * ```
63
+ */
64
+ classNames?: SlotsToClasses<ImageSlots>;
65
+ }
66
+ type UseImageProps = Props & ImageVariantProps;
67
+ declare function useImage(originalProps: UseImageProps): {
68
+ Component: _heroui_system.As<any>;
69
+ domRef: react.RefObject<HTMLImageElement>;
70
+ slots: {
71
+ wrapper: (slotProps?: ({
72
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
73
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
74
+ isZoomed?: boolean | undefined;
75
+ showSkeleton?: boolean | undefined;
76
+ disableAnimation?: boolean | undefined;
77
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
78
+ zoomedWrapper: (slotProps?: ({
79
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
80
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
81
+ isZoomed?: boolean | undefined;
82
+ showSkeleton?: boolean | undefined;
83
+ disableAnimation?: boolean | undefined;
84
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
85
+ img: (slotProps?: ({
86
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
87
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
88
+ isZoomed?: boolean | undefined;
89
+ showSkeleton?: boolean | undefined;
90
+ disableAnimation?: boolean | undefined;
91
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
92
+ blurredImg: (slotProps?: ({
93
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
94
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
95
+ isZoomed?: boolean | undefined;
96
+ showSkeleton?: boolean | undefined;
97
+ disableAnimation?: boolean | undefined;
98
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
99
+ } & {
100
+ wrapper: (slotProps?: ({
101
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
102
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
103
+ isZoomed?: boolean | undefined;
104
+ showSkeleton?: boolean | undefined;
105
+ disableAnimation?: boolean | undefined;
106
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
107
+ zoomedWrapper: (slotProps?: ({
108
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
109
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
110
+ isZoomed?: boolean | undefined;
111
+ showSkeleton?: boolean | undefined;
112
+ disableAnimation?: boolean | undefined;
113
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
114
+ img: (slotProps?: ({
115
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
116
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
117
+ isZoomed?: boolean | undefined;
118
+ showSkeleton?: boolean | undefined;
119
+ disableAnimation?: boolean | undefined;
120
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
121
+ blurredImg: (slotProps?: ({
122
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
123
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
124
+ isZoomed?: boolean | undefined;
125
+ showSkeleton?: boolean | undefined;
126
+ disableAnimation?: boolean | undefined;
127
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
128
+ } & {};
129
+ classNames: SlotsToClasses<"img" | "wrapper" | "zoomedWrapper" | "blurredImg"> | undefined;
130
+ isBlurred: boolean | undefined;
131
+ disableSkeleton: boolean;
132
+ fallbackSrc: react.ReactNode;
133
+ removeWrapper: boolean;
134
+ isZoomed: boolean | undefined;
135
+ isLoading: boolean | undefined;
136
+ getImgProps: PropGetter;
137
+ getWrapperProps: PropGetter;
138
+ getBlurredImgProps: PropGetter;
139
+ };
140
+ type UseImageReturn = ReturnType<typeof useImage>;
141
+
142
+ export { type UseImageProps, type UseImageReturn, useImage };
@@ -69,74 +69,74 @@ declare function useImage(originalProps: UseImageProps): {
69
69
  domRef: react.RefObject<HTMLImageElement>;
70
70
  slots: {
71
71
  wrapper: (slotProps?: ({
72
- radius?: "none" | "sm" | "md" | "lg" | "full" | undefined;
73
- shadow?: "none" | "sm" | "md" | "lg" | undefined;
72
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
73
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
74
74
  isZoomed?: boolean | undefined;
75
75
  showSkeleton?: boolean | undefined;
76
76
  disableAnimation?: boolean | undefined;
77
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
77
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
78
78
  zoomedWrapper: (slotProps?: ({
79
- radius?: "none" | "sm" | "md" | "lg" | "full" | undefined;
80
- shadow?: "none" | "sm" | "md" | "lg" | undefined;
79
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
80
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
81
81
  isZoomed?: boolean | undefined;
82
82
  showSkeleton?: boolean | undefined;
83
83
  disableAnimation?: boolean | undefined;
84
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
84
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
85
85
  img: (slotProps?: ({
86
- radius?: "none" | "sm" | "md" | "lg" | "full" | undefined;
87
- shadow?: "none" | "sm" | "md" | "lg" | undefined;
86
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
87
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
88
88
  isZoomed?: boolean | undefined;
89
89
  showSkeleton?: boolean | undefined;
90
90
  disableAnimation?: boolean | undefined;
91
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
91
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
92
92
  blurredImg: (slotProps?: ({
93
- radius?: "none" | "sm" | "md" | "lg" | "full" | undefined;
94
- shadow?: "none" | "sm" | "md" | "lg" | undefined;
93
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
94
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
95
95
  isZoomed?: boolean | undefined;
96
96
  showSkeleton?: boolean | undefined;
97
97
  disableAnimation?: boolean | undefined;
98
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
98
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
99
99
  } & {
100
100
  wrapper: (slotProps?: ({
101
- radius?: "none" | "sm" | "md" | "lg" | "full" | undefined;
102
- shadow?: "none" | "sm" | "md" | "lg" | undefined;
101
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
102
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
103
103
  isZoomed?: boolean | undefined;
104
104
  showSkeleton?: boolean | undefined;
105
105
  disableAnimation?: boolean | undefined;
106
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
106
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
107
107
  zoomedWrapper: (slotProps?: ({
108
- radius?: "none" | "sm" | "md" | "lg" | "full" | undefined;
109
- shadow?: "none" | "sm" | "md" | "lg" | undefined;
108
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
109
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
110
110
  isZoomed?: boolean | undefined;
111
111
  showSkeleton?: boolean | undefined;
112
112
  disableAnimation?: boolean | undefined;
113
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
113
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
114
114
  img: (slotProps?: ({
115
- radius?: "none" | "sm" | "md" | "lg" | "full" | undefined;
116
- shadow?: "none" | "sm" | "md" | "lg" | undefined;
115
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
116
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
117
117
  isZoomed?: boolean | undefined;
118
118
  showSkeleton?: boolean | undefined;
119
119
  disableAnimation?: boolean | undefined;
120
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
120
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
121
121
  blurredImg: (slotProps?: ({
122
- radius?: "none" | "sm" | "md" | "lg" | "full" | undefined;
123
- shadow?: "none" | "sm" | "md" | "lg" | undefined;
122
+ radius?: "lg" | "none" | "full" | "sm" | "md" | undefined;
123
+ shadow?: "lg" | "none" | "sm" | "md" | undefined;
124
124
  isZoomed?: boolean | undefined;
125
125
  showSkeleton?: boolean | undefined;
126
126
  disableAnimation?: boolean | undefined;
127
- } & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
127
+ } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
128
128
  } & {};
129
- classNames: SlotsToClasses<"wrapper" | "zoomedWrapper" | "img" | "blurredImg"> | undefined;
129
+ classNames: SlotsToClasses<"img" | "wrapper" | "zoomedWrapper" | "blurredImg"> | undefined;
130
130
  isBlurred: boolean | undefined;
131
131
  disableSkeleton: boolean;
132
132
  fallbackSrc: react.ReactNode;
133
133
  removeWrapper: boolean;
134
134
  isZoomed: boolean | undefined;
135
135
  isLoading: boolean | undefined;
136
- getImgProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
137
- getWrapperProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
138
- getBlurredImgProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
136
+ getImgProps: PropGetter;
137
+ getWrapperProps: PropGetter;
138
+ getBlurredImgProps: PropGetter;
139
139
  };
140
140
  type UseImageReturn = ReturnType<typeof useImage>;
141
141
 
142
- export { UseImageProps, UseImageReturn, useImage };
142
+ export { type UseImageProps, type UseImageReturn, useImage };
package/dist/use-image.js CHANGED
@@ -100,6 +100,8 @@ function useImage(originalProps) {
100
100
  crossOrigin,
101
101
  ...otherProps,
102
102
  style: {
103
+ // img has `height: auto` by default
104
+ // passing the custom height here to override if it is specified
103
105
  ...(otherProps == null ? void 0 : otherProps.height) && { height: h },
104
106
  ...props2.style,
105
107
  ...otherProps.style
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  useImage
4
- } from "./chunk-DSOLHU5M.mjs";
4
+ } from "./chunk-Q3TXVV4U.mjs";
5
5
  export {
6
6
  useImage
7
7
  };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@heroui/image",
3
- "version": "2.2.6",
3
+ "version": "2.2.9",
4
4
  "description": "A simple image component",
5
5
  "keywords": [
6
6
  "image"
7
7
  ],
8
- "author": "Junior Garcia <jrgarciadev@gmail.com>",
8
+ "author": "HeroUI <support@heroui.com>",
9
9
  "homepage": "https://heroui.com",
10
10
  "license": "MIT",
11
11
  "main": "dist/index.js",
@@ -27,13 +27,13 @@
27
27
  "peerDependencies": {
28
28
  "react": ">=18 || >=19.0.0-rc.0",
29
29
  "react-dom": ">=18 || >=19.0.0-rc.0",
30
- "@heroui/theme": ">=2.4.0",
31
- "@heroui/system": ">=2.4.0"
30
+ "@heroui/theme": ">=2.4.6",
31
+ "@heroui/system": ">=2.4.7"
32
32
  },
33
33
  "dependencies": {
34
- "@heroui/shared-utils": "2.1.3",
35
- "@heroui/react-utils": "2.1.4",
36
- "@heroui/use-image": "2.1.3"
34
+ "@heroui/shared-utils": "2.1.6",
35
+ "@heroui/react-utils": "2.1.7",
36
+ "@heroui/use-image": "2.1.6"
37
37
  },
38
38
  "clean-package": "../../../clean-package.config.json",
39
39
  "module": "dist/index.mjs",