@heroui/avatar 2.2.7 → 2.2.10
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 +1 -1
- package/README.md +2 -2
- package/dist/avatar-group-context.d.mts +13 -0
- package/dist/avatar-group.d.mts +14 -0
- package/dist/avatar-group.d.ts +1 -1
- package/dist/avatar-group.js +1 -4
- package/dist/avatar-group.mjs +2 -2
- package/dist/avatar-icon.d.mts +5 -0
- package/dist/avatar.d.mts +12 -0
- package/dist/avatar.d.ts +1 -1
- package/dist/avatar.js +1 -4
- package/dist/avatar.mjs +1 -1
- package/dist/{chunk-SXMLSBOY.mjs → chunk-A6PX3NG3.mjs} +1 -2
- package/dist/{chunk-NB7VH5TP.mjs → chunk-H44CU6UA.mjs} +1 -1
- package/dist/index.d.mts +12 -0
- package/dist/index.js +4 -5
- package/dist/index.mjs +2 -2
- package/dist/use-avatar-group.d.mts +67 -0
- package/dist/use-avatar-group.d.ts +2 -2
- package/dist/use-avatar.d.mts +207 -0
- package/dist/use-avatar.d.ts +36 -36
- package/package.json +10 -10
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@ npm i @heroui/avatar
|
|
|
15
15
|
## Contribution
|
|
16
16
|
|
|
17
17
|
Yes please! See the
|
|
18
|
-
[contributing guidelines](https://github.com/
|
|
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/
|
|
24
|
+
[MIT license](https://github.com/heroui-inc/heroui/blob/master/LICENSE).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ContextType } from './use-avatar-group.mjs';
|
|
3
|
+
import '@heroui/system';
|
|
4
|
+
import '@heroui/theme';
|
|
5
|
+
import '@heroui/react-utils';
|
|
6
|
+
import './avatar.mjs';
|
|
7
|
+
import './use-avatar.mjs';
|
|
8
|
+
import 'tailwind-variants';
|
|
9
|
+
|
|
10
|
+
declare const AvatarGroupProvider: react.Provider<ContextType>;
|
|
11
|
+
declare const useAvatarGroupContext: () => ContextType;
|
|
12
|
+
|
|
13
|
+
export { AvatarGroupProvider, useAvatarGroupContext };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _heroui_system from '@heroui/system';
|
|
2
|
+
import { UseAvatarGroupProps } from './use-avatar-group.mjs';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '@heroui/theme';
|
|
5
|
+
import '@heroui/react-utils';
|
|
6
|
+
import './avatar.mjs';
|
|
7
|
+
import './use-avatar.mjs';
|
|
8
|
+
import 'tailwind-variants';
|
|
9
|
+
|
|
10
|
+
interface AvatarGroupProps extends UseAvatarGroupProps {
|
|
11
|
+
}
|
|
12
|
+
declare const AvatarGroup: _heroui_system.InternalForwardRefRenderFunction<"div", AvatarGroupProps, never>;
|
|
13
|
+
|
|
14
|
+
export { type AvatarGroupProps, AvatarGroup as default };
|
package/dist/avatar-group.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ interface AvatarGroupProps extends UseAvatarGroupProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const AvatarGroup: _heroui_system.InternalForwardRefRenderFunction<"div", AvatarGroupProps, never>;
|
|
13
13
|
|
|
14
|
-
export { AvatarGroupProps, AvatarGroup as default };
|
|
14
|
+
export { type AvatarGroupProps, AvatarGroup as default };
|
package/dist/avatar-group.js
CHANGED
|
@@ -299,8 +299,7 @@ var Avatar = (0, import_system2.forwardRef)((props, ref) => {
|
|
|
299
299
|
ref
|
|
300
300
|
});
|
|
301
301
|
const fallback = (0, import_react3.useMemo)(() => {
|
|
302
|
-
if (!showFallback && src)
|
|
303
|
-
return null;
|
|
302
|
+
if (!showFallback && src) return null;
|
|
304
303
|
if (fallbackComponent) {
|
|
305
304
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "aria-label": alt, className: slots.fallback({ class: classNames == null ? void 0 : classNames.fallback }), role: "img", children: fallbackComponent });
|
|
306
305
|
}
|
|
@@ -336,5 +335,3 @@ var AvatarGroup = (0, import_system3.forwardRef)((props, ref) => {
|
|
|
336
335
|
});
|
|
337
336
|
AvatarGroup.displayName = "HeroUI.AvatarGroup";
|
|
338
337
|
var avatar_group_default = AvatarGroup;
|
|
339
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
340
|
-
0 && (module.exports = {});
|
package/dist/avatar-group.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
avatar_group_default
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-H44CU6UA.mjs";
|
|
5
|
+
import "./chunk-A6PX3NG3.mjs";
|
|
6
6
|
import "./chunk-25E6VDTZ.mjs";
|
|
7
7
|
import "./chunk-QH65JCLF.mjs";
|
|
8
8
|
import "./chunk-LTC67JRI.mjs";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as _heroui_system from '@heroui/system';
|
|
2
|
+
import { UseAvatarProps } from './use-avatar.mjs';
|
|
3
|
+
import 'tailwind-variants';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '@heroui/theme';
|
|
6
|
+
import '@heroui/react-utils';
|
|
7
|
+
|
|
8
|
+
interface AvatarProps extends UseAvatarProps {
|
|
9
|
+
}
|
|
10
|
+
declare const Avatar: _heroui_system.InternalForwardRefRenderFunction<"span", AvatarProps, never>;
|
|
11
|
+
|
|
12
|
+
export { type AvatarProps, Avatar as default };
|
package/dist/avatar.d.ts
CHANGED
package/dist/avatar.js
CHANGED
|
@@ -218,8 +218,7 @@ var Avatar = (0, import_system2.forwardRef)((props, ref) => {
|
|
|
218
218
|
ref
|
|
219
219
|
});
|
|
220
220
|
const fallback = (0, import_react2.useMemo)(() => {
|
|
221
|
-
if (!showFallback && src)
|
|
222
|
-
return null;
|
|
221
|
+
if (!showFallback && src) return null;
|
|
223
222
|
if (fallbackComponent) {
|
|
224
223
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "aria-label": alt, className: slots.fallback({ class: classNames == null ? void 0 : classNames.fallback }), role: "img", children: fallbackComponent });
|
|
225
224
|
}
|
|
@@ -232,5 +231,3 @@ var Avatar = (0, import_system2.forwardRef)((props, ref) => {
|
|
|
232
231
|
});
|
|
233
232
|
Avatar.displayName = "HeroUI.Avatar";
|
|
234
233
|
var avatar_default = Avatar;
|
|
235
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
236
|
-
0 && (module.exports = {});
|
package/dist/avatar.mjs
CHANGED
|
@@ -30,8 +30,7 @@ var Avatar = forwardRef((props, ref) => {
|
|
|
30
30
|
ref
|
|
31
31
|
});
|
|
32
32
|
const fallback = useMemo(() => {
|
|
33
|
-
if (!showFallback && src)
|
|
34
|
-
return null;
|
|
33
|
+
if (!showFallback && src) return null;
|
|
35
34
|
if (fallbackComponent) {
|
|
36
35
|
return /* @__PURE__ */ jsx("div", { "aria-label": alt, className: slots.fallback({ class: classNames == null ? void 0 : classNames.fallback }), role: "img", children: fallbackComponent });
|
|
37
36
|
}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Avatar, AvatarProps } from './avatar.mjs';
|
|
2
|
+
export { default as AvatarGroup, AvatarGroupProps } from './avatar-group.mjs';
|
|
3
|
+
export { useAvatar } from './use-avatar.mjs';
|
|
4
|
+
export { useAvatarGroup } from './use-avatar-group.mjs';
|
|
5
|
+
export { AvatarIcon } from './avatar-icon.mjs';
|
|
6
|
+
export { AvatarGroupProvider, useAvatarGroupContext } from './avatar-group-context.mjs';
|
|
7
|
+
import '@heroui/system';
|
|
8
|
+
import 'tailwind-variants';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@heroui/theme';
|
|
11
|
+
import '@heroui/react-utils';
|
|
12
|
+
import 'react/jsx-runtime';
|
package/dist/index.js
CHANGED
|
@@ -19,8 +19,8 @@ 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
|
|
23
|
-
__export(
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
24
|
Avatar: () => avatar_default,
|
|
25
25
|
AvatarGroup: () => avatar_group_default,
|
|
26
26
|
AvatarGroupProvider: () => AvatarGroupProvider,
|
|
@@ -29,7 +29,7 @@ __export(src_exports, {
|
|
|
29
29
|
useAvatarGroup: () => useAvatarGroup,
|
|
30
30
|
useAvatarGroupContext: () => useAvatarGroupContext
|
|
31
31
|
});
|
|
32
|
-
module.exports = __toCommonJS(
|
|
32
|
+
module.exports = __toCommonJS(index_exports);
|
|
33
33
|
|
|
34
34
|
// src/avatar.tsx
|
|
35
35
|
var import_react2 = require("react");
|
|
@@ -226,8 +226,7 @@ var Avatar = (0, import_system2.forwardRef)((props, ref) => {
|
|
|
226
226
|
ref
|
|
227
227
|
});
|
|
228
228
|
const fallback = (0, import_react2.useMemo)(() => {
|
|
229
|
-
if (!showFallback && src)
|
|
230
|
-
return null;
|
|
229
|
+
if (!showFallback && src) return null;
|
|
231
230
|
if (fallbackComponent) {
|
|
232
231
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "aria-label": alt, className: slots.fallback({ class: classNames == null ? void 0 : classNames.fallback }), role: "img", children: fallbackComponent });
|
|
233
232
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
avatar_group_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-H44CU6UA.mjs";
|
|
5
5
|
import {
|
|
6
6
|
avatar_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-A6PX3NG3.mjs";
|
|
8
8
|
import {
|
|
9
9
|
AvatarIcon
|
|
10
10
|
} from "./chunk-25E6VDTZ.mjs";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import * as _heroui_system from '@heroui/system';
|
|
4
|
+
import { PropGetter, HTMLHeroUIProps } from '@heroui/system';
|
|
5
|
+
import { AvatarGroupVariantProps, SlotsToClasses, AvatarGroupSlots } from '@heroui/theme';
|
|
6
|
+
import { ReactRef } from '@heroui/react-utils';
|
|
7
|
+
import { AvatarProps } from './avatar.mjs';
|
|
8
|
+
import './use-avatar.mjs';
|
|
9
|
+
import 'tailwind-variants';
|
|
10
|
+
|
|
11
|
+
interface Props extends HTMLHeroUIProps<"div"> {
|
|
12
|
+
/**
|
|
13
|
+
* Ref to the DOM node.
|
|
14
|
+
*/
|
|
15
|
+
ref?: ReactRef<HTMLDivElement | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the avatars should be displayed in a grid
|
|
18
|
+
*/
|
|
19
|
+
isGrid?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The maximum number of visible avatars
|
|
22
|
+
* @default 5
|
|
23
|
+
*/
|
|
24
|
+
max?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Control the number of avatar not visible
|
|
27
|
+
*/
|
|
28
|
+
total?: number;
|
|
29
|
+
/**
|
|
30
|
+
* This allows you to render a custom count component.
|
|
31
|
+
*/
|
|
32
|
+
renderCount?: (count: number) => ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Classname or List of classes to change the classNames of the avatar group.
|
|
35
|
+
* if `className` is passed, it will be added to the base slot.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* <AvatarGroup classNames={{
|
|
40
|
+
* base: "base-classes",
|
|
41
|
+
* count: "count-classes"
|
|
42
|
+
* }} />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
classNames?: SlotsToClasses<AvatarGroupSlots>;
|
|
46
|
+
}
|
|
47
|
+
type UseAvatarGroupProps = Props & Omit<AvatarGroupVariantProps, "children" | "isGrid"> & Partial<Pick<AvatarProps, "size" | "color" | "radius" | "isDisabled" | "isBordered">>;
|
|
48
|
+
type ContextType = {
|
|
49
|
+
size?: AvatarProps["size"];
|
|
50
|
+
color?: AvatarProps["color"];
|
|
51
|
+
radius?: AvatarProps["radius"];
|
|
52
|
+
isGrid?: boolean;
|
|
53
|
+
isBordered?: AvatarProps["isBordered"];
|
|
54
|
+
isDisabled?: AvatarProps["isDisabled"];
|
|
55
|
+
};
|
|
56
|
+
declare function useAvatarGroup(props?: UseAvatarGroupProps): {
|
|
57
|
+
Component: _heroui_system.As<any>;
|
|
58
|
+
context: ContextType;
|
|
59
|
+
remainingCount: number;
|
|
60
|
+
clones: react.ReactElement<any, string | react.JSXElementConstructor<any>>[];
|
|
61
|
+
renderCount: ((count: number) => ReactNode) | undefined;
|
|
62
|
+
getAvatarGroupProps: PropGetter;
|
|
63
|
+
getAvatarGroupCountProps: () => AvatarProps;
|
|
64
|
+
};
|
|
65
|
+
type UseAvatarReturn = ReturnType<typeof useAvatarGroup>;
|
|
66
|
+
|
|
67
|
+
export { type ContextType, type UseAvatarGroupProps, type UseAvatarReturn, useAvatarGroup };
|
|
@@ -59,9 +59,9 @@ declare function useAvatarGroup(props?: UseAvatarGroupProps): {
|
|
|
59
59
|
remainingCount: number;
|
|
60
60
|
clones: react.ReactElement<any, string | react.JSXElementConstructor<any>>[];
|
|
61
61
|
renderCount: ((count: number) => ReactNode) | undefined;
|
|
62
|
-
getAvatarGroupProps: PropGetter
|
|
62
|
+
getAvatarGroupProps: PropGetter;
|
|
63
63
|
getAvatarGroupCountProps: () => AvatarProps;
|
|
64
64
|
};
|
|
65
65
|
type UseAvatarReturn = ReturnType<typeof useAvatarGroup>;
|
|
66
66
|
|
|
67
|
-
export { ContextType, UseAvatarGroupProps, UseAvatarReturn, useAvatarGroup };
|
|
67
|
+
export { type ContextType, type UseAvatarGroupProps, type UseAvatarReturn, useAvatarGroup };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import * as _heroui_system from '@heroui/system';
|
|
4
|
+
import { PropGetter, HTMLHeroUIProps } from '@heroui/system';
|
|
5
|
+
import { AvatarVariantProps, SlotsToClasses, AvatarSlots } from '@heroui/theme';
|
|
6
|
+
import { ReactRef } from '@heroui/react-utils';
|
|
7
|
+
|
|
8
|
+
interface Props extends HTMLHeroUIProps<"span"> {
|
|
9
|
+
/**
|
|
10
|
+
* Ref to the DOM node.
|
|
11
|
+
*/
|
|
12
|
+
ref?: ReactRef<HTMLSpanElement | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Ref to the Image DOM node.
|
|
15
|
+
*/
|
|
16
|
+
imgRef?: ReactRef<HTMLImageElement>;
|
|
17
|
+
/**
|
|
18
|
+
* The name of the person in the avatar. -
|
|
19
|
+
* if **src** has loaded, the name will be used as the **alt** attribute of the **img**
|
|
20
|
+
* - If **src** is not loaded, the name will be used to create the initials
|
|
21
|
+
*/
|
|
22
|
+
name?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Image source.
|
|
25
|
+
*/
|
|
26
|
+
src?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Image alt text.
|
|
29
|
+
*/
|
|
30
|
+
alt?: string;
|
|
31
|
+
icon?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the avatar can be focused.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
isFocusable?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* If `true`, the fallback logic will be skipped.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
ignoreFallback?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If `false`, the avatar will show the background color while loading.
|
|
44
|
+
*/
|
|
45
|
+
showFallback?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Function to get the initials to display
|
|
48
|
+
*/
|
|
49
|
+
getInitials?: (name: string) => string;
|
|
50
|
+
/**
|
|
51
|
+
* Custom fallback component.
|
|
52
|
+
*/
|
|
53
|
+
fallback?: React.ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Function called when image failed to load
|
|
56
|
+
*/
|
|
57
|
+
onError?: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* The component used to render the image.
|
|
60
|
+
* @default "img"
|
|
61
|
+
*/
|
|
62
|
+
ImgComponent?: React.ElementType;
|
|
63
|
+
/**
|
|
64
|
+
* Props to pass to the image component.
|
|
65
|
+
*/
|
|
66
|
+
imgProps?: React.ImgHTMLAttributes<HTMLImageElement>;
|
|
67
|
+
/**
|
|
68
|
+
* Classname or List of classes to change the classNames of the avatar.
|
|
69
|
+
* if `className` is passed, it will be added to the base slot.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* <Avatar classNames={{
|
|
74
|
+
* base:"base-classes",
|
|
75
|
+
* img: "image-classes",
|
|
76
|
+
* name: "name-classes",
|
|
77
|
+
* icon: "icon-classes",
|
|
78
|
+
* fallback: "fallback-classes"
|
|
79
|
+
* }} />
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
classNames?: SlotsToClasses<AvatarSlots>;
|
|
83
|
+
}
|
|
84
|
+
type UseAvatarProps = Props & Omit<AvatarVariantProps, "children" | "isInGroup" | "isInGridGroup">;
|
|
85
|
+
declare function useAvatar(originalProps?: UseAvatarProps): {
|
|
86
|
+
Component: _heroui_system.As<any>;
|
|
87
|
+
ImgComponent: react.ElementType<any>;
|
|
88
|
+
src: string | undefined;
|
|
89
|
+
alt: string;
|
|
90
|
+
icon: react.ReactNode;
|
|
91
|
+
name: string | undefined;
|
|
92
|
+
imgRef: react.RefObject<HTMLImageElement>;
|
|
93
|
+
slots: {
|
|
94
|
+
base: (slotProps?: ({
|
|
95
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
96
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
97
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
98
|
+
isDisabled?: boolean | undefined;
|
|
99
|
+
isBordered?: boolean | undefined;
|
|
100
|
+
isInGroup?: boolean | undefined;
|
|
101
|
+
isInGridGroup?: boolean | undefined;
|
|
102
|
+
disableAnimation?: boolean | undefined;
|
|
103
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
104
|
+
img: (slotProps?: ({
|
|
105
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
106
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
107
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
108
|
+
isDisabled?: boolean | undefined;
|
|
109
|
+
isBordered?: boolean | undefined;
|
|
110
|
+
isInGroup?: boolean | undefined;
|
|
111
|
+
isInGridGroup?: boolean | undefined;
|
|
112
|
+
disableAnimation?: boolean | undefined;
|
|
113
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
114
|
+
fallback: (slotProps?: ({
|
|
115
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
116
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
117
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
118
|
+
isDisabled?: boolean | undefined;
|
|
119
|
+
isBordered?: boolean | undefined;
|
|
120
|
+
isInGroup?: boolean | undefined;
|
|
121
|
+
isInGridGroup?: boolean | undefined;
|
|
122
|
+
disableAnimation?: boolean | undefined;
|
|
123
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
124
|
+
name: (slotProps?: ({
|
|
125
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
126
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
127
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
128
|
+
isDisabled?: boolean | undefined;
|
|
129
|
+
isBordered?: boolean | undefined;
|
|
130
|
+
isInGroup?: boolean | undefined;
|
|
131
|
+
isInGridGroup?: boolean | undefined;
|
|
132
|
+
disableAnimation?: boolean | undefined;
|
|
133
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
134
|
+
icon: (slotProps?: ({
|
|
135
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
136
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
137
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
138
|
+
isDisabled?: boolean | undefined;
|
|
139
|
+
isBordered?: boolean | undefined;
|
|
140
|
+
isInGroup?: boolean | undefined;
|
|
141
|
+
isInGridGroup?: boolean | undefined;
|
|
142
|
+
disableAnimation?: boolean | undefined;
|
|
143
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
144
|
+
} & {
|
|
145
|
+
base: (slotProps?: ({
|
|
146
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
147
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
148
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
149
|
+
isDisabled?: boolean | undefined;
|
|
150
|
+
isBordered?: boolean | undefined;
|
|
151
|
+
isInGroup?: boolean | undefined;
|
|
152
|
+
isInGridGroup?: boolean | undefined;
|
|
153
|
+
disableAnimation?: boolean | undefined;
|
|
154
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
155
|
+
img: (slotProps?: ({
|
|
156
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
157
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
158
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
159
|
+
isDisabled?: boolean | undefined;
|
|
160
|
+
isBordered?: boolean | undefined;
|
|
161
|
+
isInGroup?: boolean | undefined;
|
|
162
|
+
isInGridGroup?: boolean | undefined;
|
|
163
|
+
disableAnimation?: boolean | undefined;
|
|
164
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
165
|
+
fallback: (slotProps?: ({
|
|
166
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
167
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
168
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
169
|
+
isDisabled?: boolean | undefined;
|
|
170
|
+
isBordered?: boolean | undefined;
|
|
171
|
+
isInGroup?: boolean | undefined;
|
|
172
|
+
isInGridGroup?: boolean | undefined;
|
|
173
|
+
disableAnimation?: boolean | undefined;
|
|
174
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
175
|
+
name: (slotProps?: ({
|
|
176
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
177
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
178
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
179
|
+
isDisabled?: boolean | undefined;
|
|
180
|
+
isBordered?: boolean | undefined;
|
|
181
|
+
isInGroup?: boolean | undefined;
|
|
182
|
+
isInGridGroup?: boolean | undefined;
|
|
183
|
+
disableAnimation?: boolean | undefined;
|
|
184
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
185
|
+
icon: (slotProps?: ({
|
|
186
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
187
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
188
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
189
|
+
isDisabled?: boolean | undefined;
|
|
190
|
+
isBordered?: boolean | undefined;
|
|
191
|
+
isInGroup?: boolean | undefined;
|
|
192
|
+
isInGridGroup?: boolean | undefined;
|
|
193
|
+
disableAnimation?: boolean | undefined;
|
|
194
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
195
|
+
} & {};
|
|
196
|
+
classNames: SlotsToClasses<"base" | "img" | "fallback" | "name" | "icon"> | undefined;
|
|
197
|
+
fallback: react.ReactNode;
|
|
198
|
+
isImgLoaded: boolean;
|
|
199
|
+
showFallback: boolean;
|
|
200
|
+
ignoreFallback: boolean;
|
|
201
|
+
getInitials: (name: string) => string;
|
|
202
|
+
getAvatarProps: PropGetter;
|
|
203
|
+
getImageProps: PropGetter;
|
|
204
|
+
};
|
|
205
|
+
type UseAvatarReturn = ReturnType<typeof useAvatar>;
|
|
206
|
+
|
|
207
|
+
export { type UseAvatarProps, type UseAvatarReturn, useAvatar };
|
package/dist/use-avatar.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import * as _heroui_system from '@heroui/system';
|
|
4
|
-
import { PropGetter,
|
|
4
|
+
import { PropGetter, HTMLHeroUIProps } from '@heroui/system';
|
|
5
5
|
import { AvatarVariantProps, SlotsToClasses, AvatarSlots } from '@heroui/theme';
|
|
6
6
|
import { ReactRef } from '@heroui/react-utils';
|
|
7
7
|
|
|
@@ -94,114 +94,114 @@ declare function useAvatar(originalProps?: UseAvatarProps): {
|
|
|
94
94
|
base: (slotProps?: ({
|
|
95
95
|
size?: "sm" | "md" | "lg" | undefined;
|
|
96
96
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
97
|
-
radius?: "sm" | "md" | "lg" | "
|
|
98
|
-
isBordered?: boolean | undefined;
|
|
97
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
99
98
|
isDisabled?: boolean | undefined;
|
|
99
|
+
isBordered?: boolean | undefined;
|
|
100
100
|
isInGroup?: boolean | undefined;
|
|
101
101
|
isInGridGroup?: boolean | undefined;
|
|
102
102
|
disableAnimation?: boolean | undefined;
|
|
103
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
103
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
104
104
|
img: (slotProps?: ({
|
|
105
105
|
size?: "sm" | "md" | "lg" | undefined;
|
|
106
106
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
107
|
-
radius?: "sm" | "md" | "lg" | "
|
|
108
|
-
isBordered?: boolean | undefined;
|
|
107
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
109
108
|
isDisabled?: boolean | undefined;
|
|
109
|
+
isBordered?: boolean | undefined;
|
|
110
110
|
isInGroup?: boolean | undefined;
|
|
111
111
|
isInGridGroup?: 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
|
fallback: (slotProps?: ({
|
|
115
115
|
size?: "sm" | "md" | "lg" | undefined;
|
|
116
116
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
117
|
-
radius?: "sm" | "md" | "lg" | "
|
|
118
|
-
isBordered?: boolean | undefined;
|
|
117
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
119
118
|
isDisabled?: boolean | undefined;
|
|
119
|
+
isBordered?: boolean | undefined;
|
|
120
120
|
isInGroup?: boolean | undefined;
|
|
121
121
|
isInGridGroup?: boolean | undefined;
|
|
122
122
|
disableAnimation?: boolean | undefined;
|
|
123
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
123
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
124
124
|
name: (slotProps?: ({
|
|
125
125
|
size?: "sm" | "md" | "lg" | undefined;
|
|
126
126
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
127
|
-
radius?: "sm" | "md" | "lg" | "
|
|
128
|
-
isBordered?: boolean | undefined;
|
|
127
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
129
128
|
isDisabled?: boolean | undefined;
|
|
129
|
+
isBordered?: boolean | undefined;
|
|
130
130
|
isInGroup?: boolean | undefined;
|
|
131
131
|
isInGridGroup?: boolean | undefined;
|
|
132
132
|
disableAnimation?: boolean | undefined;
|
|
133
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
133
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
134
134
|
icon: (slotProps?: ({
|
|
135
135
|
size?: "sm" | "md" | "lg" | undefined;
|
|
136
136
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
137
|
-
radius?: "sm" | "md" | "lg" | "
|
|
138
|
-
isBordered?: boolean | undefined;
|
|
137
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
139
138
|
isDisabled?: boolean | undefined;
|
|
139
|
+
isBordered?: boolean | undefined;
|
|
140
140
|
isInGroup?: boolean | undefined;
|
|
141
141
|
isInGridGroup?: boolean | undefined;
|
|
142
142
|
disableAnimation?: boolean | undefined;
|
|
143
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
143
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
144
144
|
} & {
|
|
145
145
|
base: (slotProps?: ({
|
|
146
146
|
size?: "sm" | "md" | "lg" | undefined;
|
|
147
147
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
148
|
-
radius?: "sm" | "md" | "lg" | "
|
|
149
|
-
isBordered?: boolean | undefined;
|
|
148
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
150
149
|
isDisabled?: boolean | undefined;
|
|
150
|
+
isBordered?: boolean | undefined;
|
|
151
151
|
isInGroup?: boolean | undefined;
|
|
152
152
|
isInGridGroup?: boolean | undefined;
|
|
153
153
|
disableAnimation?: boolean | undefined;
|
|
154
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
154
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
155
155
|
img: (slotProps?: ({
|
|
156
156
|
size?: "sm" | "md" | "lg" | undefined;
|
|
157
157
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
158
|
-
radius?: "sm" | "md" | "lg" | "
|
|
159
|
-
isBordered?: boolean | undefined;
|
|
158
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
160
159
|
isDisabled?: boolean | undefined;
|
|
160
|
+
isBordered?: boolean | undefined;
|
|
161
161
|
isInGroup?: boolean | undefined;
|
|
162
162
|
isInGridGroup?: boolean | undefined;
|
|
163
163
|
disableAnimation?: boolean | undefined;
|
|
164
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
164
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
165
165
|
fallback: (slotProps?: ({
|
|
166
166
|
size?: "sm" | "md" | "lg" | undefined;
|
|
167
167
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
168
|
-
radius?: "sm" | "md" | "lg" | "
|
|
169
|
-
isBordered?: boolean | undefined;
|
|
168
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
170
169
|
isDisabled?: boolean | undefined;
|
|
170
|
+
isBordered?: boolean | undefined;
|
|
171
171
|
isInGroup?: boolean | undefined;
|
|
172
172
|
isInGridGroup?: boolean | undefined;
|
|
173
173
|
disableAnimation?: boolean | undefined;
|
|
174
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
174
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
175
175
|
name: (slotProps?: ({
|
|
176
176
|
size?: "sm" | "md" | "lg" | undefined;
|
|
177
177
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
178
|
-
radius?: "sm" | "md" | "lg" | "
|
|
179
|
-
isBordered?: boolean | undefined;
|
|
178
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
180
179
|
isDisabled?: boolean | undefined;
|
|
180
|
+
isBordered?: boolean | undefined;
|
|
181
181
|
isInGroup?: boolean | undefined;
|
|
182
182
|
isInGridGroup?: boolean | undefined;
|
|
183
183
|
disableAnimation?: boolean | undefined;
|
|
184
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
184
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
185
185
|
icon: (slotProps?: ({
|
|
186
186
|
size?: "sm" | "md" | "lg" | undefined;
|
|
187
187
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
|
|
188
|
-
radius?: "sm" | "md" | "lg" | "
|
|
189
|
-
isBordered?: boolean | undefined;
|
|
188
|
+
radius?: "sm" | "md" | "lg" | "full" | "none" | undefined;
|
|
190
189
|
isDisabled?: boolean | undefined;
|
|
190
|
+
isBordered?: boolean | undefined;
|
|
191
191
|
isInGroup?: boolean | undefined;
|
|
192
192
|
isInGridGroup?: boolean | undefined;
|
|
193
193
|
disableAnimation?: boolean | undefined;
|
|
194
|
-
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
|
|
194
|
+
} & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string;
|
|
195
195
|
} & {};
|
|
196
|
-
classNames: SlotsToClasses<"
|
|
196
|
+
classNames: SlotsToClasses<"base" | "img" | "fallback" | "name" | "icon"> | undefined;
|
|
197
197
|
fallback: react.ReactNode;
|
|
198
198
|
isImgLoaded: boolean;
|
|
199
199
|
showFallback: boolean;
|
|
200
200
|
ignoreFallback: boolean;
|
|
201
|
-
getInitials: (
|
|
202
|
-
getAvatarProps: PropGetter
|
|
203
|
-
getImageProps: PropGetter
|
|
201
|
+
getInitials: (name: string) => string;
|
|
202
|
+
getAvatarProps: PropGetter;
|
|
203
|
+
getImageProps: PropGetter;
|
|
204
204
|
};
|
|
205
205
|
type UseAvatarReturn = ReturnType<typeof useAvatar>;
|
|
206
206
|
|
|
207
|
-
export { UseAvatarProps, UseAvatarReturn, useAvatar };
|
|
207
|
+
export { type UseAvatarProps, type UseAvatarReturn, useAvatar };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroui/avatar",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.10",
|
|
4
4
|
"description": "The Avatar component is used to represent a user, and displays the profile picture, initials or fallback icon.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"avatar"
|
|
7
7
|
],
|
|
8
|
-
"author": "
|
|
8
|
+
"author": "HeroUI <support@heroui.com>",
|
|
9
9
|
"homepage": "https://heroui.com",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"main": "dist/index.js",
|
|
@@ -27,16 +27,16 @@
|
|
|
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.
|
|
31
|
-
"@heroui/system": ">=2.4.
|
|
30
|
+
"@heroui/theme": ">=2.4.6",
|
|
31
|
+
"@heroui/system": ">=2.4.7"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@react-aria/interactions": "3.
|
|
35
|
-
"@react-aria/focus": "3.19.
|
|
36
|
-
"@react-aria/utils": "3.
|
|
37
|
-
"@heroui/shared-utils": "2.1.
|
|
38
|
-
"@heroui/react-utils": "2.1.
|
|
39
|
-
"@heroui/use-image": "2.1.
|
|
34
|
+
"@react-aria/interactions": "3.23.0",
|
|
35
|
+
"@react-aria/focus": "3.19.1",
|
|
36
|
+
"@react-aria/utils": "3.27.0",
|
|
37
|
+
"@heroui/shared-utils": "2.1.6",
|
|
38
|
+
"@heroui/react-utils": "2.1.7",
|
|
39
|
+
"@heroui/use-image": "2.1.6"
|
|
40
40
|
},
|
|
41
41
|
"clean-package": "../../../clean-package.config.json",
|
|
42
42
|
"module": "dist/index.mjs",
|