@akinon/ui-avatar 0.5.0 → 1.0.1

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,6 +1,28 @@
1
1
  import * as React from 'react';
2
2
  import type { AvatarGroupProps, AvatarProps } from './types';
3
+ /**
4
+ * Avatar component for Akinon UI.
5
+ *
6
+ * The Avatar component is used to represent individuals or entities with customizable
7
+ * shapes, sizes, and content. It supports images, text, or icons as its content,
8
+ * and offers responsive size configurations for flexible design.
9
+ *
10
+ * The Avatar component adheres to the Akinon design system, ensuring consistent styling
11
+ * and accessibility. It is suitable for user profiles, lists, and other contexts
12
+ * where visual representation is needed.
13
+ */
3
14
  export declare const Avatar: ({ shape, ...restAvatarProps }: AvatarProps) => React.JSX.Element;
4
- export declare const AvatarGroup: ({ maxPopoverPlacement, maxPopoverTrigger, shape, children, ...restAvatarProps }: AvatarGroupProps) => React.JSX.Element;
15
+ /**
16
+ * AvatarGroup component for Akinon UI.
17
+ *
18
+ * The AvatarGroup component is used to display a collection of avatars as a group,
19
+ * with options for size, shape, and maximum visible avatars. It supports a popover
20
+ * for collapsed avatars when the count exceeds the maximum limit.
21
+ *
22
+ * The AvatarGroup component adheres to the Akinon design system, providing consistent
23
+ * styling and functionality. It is ideal for representing teams, participants, or
24
+ * groups in a compact and visually appealing way.
25
+ */
26
+ export declare const AvatarGroup: ({ children, ...restAvatarProps }: AvatarGroupProps) => React.JSX.Element;
5
27
  export type { AvatarGroupProps, AvatarProps };
6
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,MAAM,kCAGhB,WAAW,sBA2Bb,CAAC;AAEF,eAAO,MAAM,WAAW,oFAMrB,gBAAgB,sBAkClB,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,MAAM,kCAGhB,WAAW,sBA2Bb,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,WAAW,qCAGrB,gBAAgB,sBA2BlB,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -16,6 +16,17 @@ const ui_theme_1 = require("@akinon/ui-theme");
16
16
  const cssinjs_1 = require("@ant-design/cssinjs");
17
17
  const antd_1 = require("antd");
18
18
  const React = require("react");
19
+ /**
20
+ * Avatar component for Akinon UI.
21
+ *
22
+ * The Avatar component is used to represent individuals or entities with customizable
23
+ * shapes, sizes, and content. It supports images, text, or icons as its content,
24
+ * and offers responsive size configurations for flexible design.
25
+ *
26
+ * The Avatar component adheres to the Akinon design system, ensuring consistent styling
27
+ * and accessibility. It is suitable for user profiles, lists, and other contexts
28
+ * where visual representation is needed.
29
+ */
19
30
  const Avatar = (_a) => {
20
31
  var { shape = 'circle' } = _a, restAvatarProps = __rest(_a, ["shape"]);
21
32
  const { getPrefixCls, theme } = React.useContext(antd_1.ConfigProvider.ConfigContext);
@@ -37,8 +48,19 @@ const Avatar = (_a) => {
37
48
  return useStyle(React.createElement(antd_1.Avatar, Object.assign({ shape: shape }, restAvatarProps)));
38
49
  };
39
50
  exports.Avatar = Avatar;
51
+ /**
52
+ * AvatarGroup component for Akinon UI.
53
+ *
54
+ * The AvatarGroup component is used to display a collection of avatars as a group,
55
+ * with options for size, shape, and maximum visible avatars. It supports a popover
56
+ * for collapsed avatars when the count exceeds the maximum limit.
57
+ *
58
+ * The AvatarGroup component adheres to the Akinon design system, providing consistent
59
+ * styling and functionality. It is ideal for representing teams, participants, or
60
+ * groups in a compact and visually appealing way.
61
+ */
40
62
  const AvatarGroup = (_a) => {
41
- var { maxPopoverPlacement = 'top', maxPopoverTrigger = 'hover', shape = 'circle', children } = _a, restAvatarProps = __rest(_a, ["maxPopoverPlacement", "maxPopoverTrigger", "shape", "children"]);
63
+ var { children } = _a, restAvatarProps = __rest(_a, ["children"]);
42
64
  const { getPrefixCls, theme } = React.useContext(antd_1.ConfigProvider.ConfigContext);
43
65
  const { token, hashId } = (0, ui_theme_1.useToken)();
44
66
  const useStyle = (0, cssinjs_1.useStyleRegister)({
@@ -54,6 +76,6 @@ const AvatarGroup = (_a) => {
54
76
  [prefixClsWithoutHash]: {}
55
77
  };
56
78
  });
57
- return useStyle(React.createElement(antd_1.Avatar.Group, Object.assign({ maxPopoverPlacement: maxPopoverPlacement, maxPopoverTrigger: maxPopoverTrigger, shape: shape }, restAvatarProps), children));
79
+ return useStyle(React.createElement(antd_1.Avatar.Group, Object.assign({}, restAvatarProps), children));
58
80
  };
59
81
  exports.AvatarGroup = AvatarGroup;
@@ -1,55 +1,131 @@
1
+ /**
2
+ * Breakpoint type for screen size mappings.
3
+ */
1
4
  type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
5
+
6
+ /**
7
+ * Mapping of screen sizes to numbers, used for responsive configurations.
8
+ */
2
9
  type ScreenSizeMap = Partial<Record<Breakpoint, number>>;
3
10
 
11
+ /**
12
+ * Avatar size configuration, supporting predefined sizes, numeric values, or responsive mappings.
13
+ */
4
14
  type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
5
15
 
16
+ /**
17
+ * Props for the Avatar component.
18
+ */
6
19
  export interface AvatarProps {
7
- /** The shape of avatar */
20
+ /**
21
+ * The shape of the avatar.
22
+ */
8
23
  shape?: 'circle' | 'square';
9
- /** The size of the avatar */
24
+
25
+ /**
26
+ * The size of the avatar.
27
+ */
10
28
  size?: AvatarSize;
11
- /** Letter type unit distance between left and right sides */
29
+
30
+ /**
31
+ * Letter type unit distance between left and right sides
32
+ */
12
33
  gap?: number;
13
- /** The address of the image for an image avatar or image element */
34
+
35
+ /**
36
+ * The address of the image for an image avatar or image element
37
+ */
14
38
  src?: React.ReactNode | string;
15
- /** A list of sources to use for different screen resolutions */
39
+
40
+ /**
41
+ * A list of sources to use for different screen resolutions
42
+ */
16
43
  srcSet?: string;
17
- /** Whether the picture is allowed to be dragged */
44
+
45
+ /**
46
+ * Whether the picture is allowed to be dragged
47
+ */
18
48
  draggable?: boolean | 'true' | 'false';
19
- /** Custom icon type for an icon avatar */
49
+
50
+ /**
51
+ * Custom icon type for an icon avatar
52
+ */
20
53
  icon?: React.ReactNode;
21
- /** Additional CSS class name */
54
+
55
+ /**
56
+ * Additional CSS class name
57
+ */
22
58
  className?: string;
23
- /** Additional CSS class name for the root element */
59
+
60
+ /**
61
+ * Additional CSS class name for the root element
62
+ */
24
63
  rootClassName?: string;
25
- /** The content of the avatar */
64
+
65
+ /**
66
+ * The content of the avatar
67
+ */
26
68
  children?: React.ReactNode;
27
- /** This attribute defines the alternative text describing the image */
69
+
70
+ /**
71
+ * This attribute defines the alternative text describing the image
72
+ */
28
73
  alt?: string;
29
- /** CORS settings attributes */
74
+
75
+ /**
76
+ * CORS settings attributes
77
+ */
30
78
  crossOrigin?: 'anonymous' | 'use-credentials';
79
+
80
+ /**
81
+ * Click event handler for the avatar.
82
+ */
31
83
  onClick?: (e?: React.MouseEvent<HTMLElement>) => void;
32
- /** Handler when img load error, return false to prevent default fallback behavior */
84
+
85
+ /**
86
+ * Handler when img load error, return false to prevent default fallback behavior
87
+ */
33
88
  onError?: () => boolean;
34
89
  }
35
90
 
91
+ /**
92
+ * Props for the AvatarGroup component.
93
+ */
36
94
  export interface AvatarGroupProps {
37
- /** Additional CSS class name */
95
+ /**
96
+ * Additional CSS class name
97
+ */
38
98
  className?: string;
39
- /** Additional CSS class name for the root element */
99
+
100
+ /**
101
+ * Additional CSS class name for the root element
102
+ */
40
103
  rootClassName?: string;
41
- /** The content of the avatar group */
104
+
105
+ /**
106
+ * The content of the avatar group
107
+ */
42
108
  children?: React.ReactNode;
43
- /** Maximum number of avatars to display before collapsing */
44
- maxCount?: number;
45
- /** Additional CSS styles for the maximum number of avatars */
46
- maxStyle?: React.CSSProperties;
47
- /** Placement of the popover for the maximum number of avatars */
48
- maxPopoverPlacement?: 'top' | 'bottom';
49
- /** Trigger type for the popover of the maximum number of avatars */
50
- maxPopoverTrigger?: 'hover' | 'focus' | 'click';
51
- /** Size of the avatars in the group */
109
+
110
+ /**
111
+ * Maximum number of avatars to display before collapsing settings
112
+ * @default { popover: { placement: 'top', trigger: 'hover' } }
113
+ */
114
+ max?: {
115
+ popover?: {
116
+ placement?: 'top' | 'bottom';
117
+ trigger?: 'hover' | 'focus' | 'click';
118
+ };
119
+ count?: number;
120
+ };
121
+
122
+ /**
123
+ * Size of the avatars in the group
124
+ */
52
125
  size?: AvatarSize;
53
- /** Shape of the avatars in the group */
126
+
127
+ /**
128
+ * Shape of the avatars in the group
129
+ */
54
130
  shape?: 'circle' | 'square';
55
131
  }
@@ -1,6 +1,28 @@
1
1
  import * as React from 'react';
2
2
  import type { AvatarGroupProps, AvatarProps } from './types';
3
+ /**
4
+ * Avatar component for Akinon UI.
5
+ *
6
+ * The Avatar component is used to represent individuals or entities with customizable
7
+ * shapes, sizes, and content. It supports images, text, or icons as its content,
8
+ * and offers responsive size configurations for flexible design.
9
+ *
10
+ * The Avatar component adheres to the Akinon design system, ensuring consistent styling
11
+ * and accessibility. It is suitable for user profiles, lists, and other contexts
12
+ * where visual representation is needed.
13
+ */
3
14
  export declare const Avatar: ({ shape, ...restAvatarProps }: AvatarProps) => React.JSX.Element;
4
- export declare const AvatarGroup: ({ maxPopoverPlacement, maxPopoverTrigger, shape, children, ...restAvatarProps }: AvatarGroupProps) => React.JSX.Element;
15
+ /**
16
+ * AvatarGroup component for Akinon UI.
17
+ *
18
+ * The AvatarGroup component is used to display a collection of avatars as a group,
19
+ * with options for size, shape, and maximum visible avatars. It supports a popover
20
+ * for collapsed avatars when the count exceeds the maximum limit.
21
+ *
22
+ * The AvatarGroup component adheres to the Akinon design system, providing consistent
23
+ * styling and functionality. It is ideal for representing teams, participants, or
24
+ * groups in a compact and visually appealing way.
25
+ */
26
+ export declare const AvatarGroup: ({ children, ...restAvatarProps }: AvatarGroupProps) => React.JSX.Element;
5
27
  export type { AvatarGroupProps, AvatarProps };
6
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,MAAM,kCAGhB,WAAW,sBA2Bb,CAAC;AAEF,eAAO,MAAM,WAAW,oFAMrB,gBAAgB,sBAkClB,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,MAAM,kCAGhB,WAAW,sBA2Bb,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,WAAW,qCAGrB,gBAAgB,sBA2BlB,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
package/dist/esm/index.js CHANGED
@@ -13,6 +13,17 @@ import { useToken } from '@akinon/ui-theme';
13
13
  import { useStyleRegister } from '@ant-design/cssinjs';
14
14
  import { Avatar as AntAvatar, ConfigProvider } from 'antd';
15
15
  import * as React from 'react';
16
+ /**
17
+ * Avatar component for Akinon UI.
18
+ *
19
+ * The Avatar component is used to represent individuals or entities with customizable
20
+ * shapes, sizes, and content. It supports images, text, or icons as its content,
21
+ * and offers responsive size configurations for flexible design.
22
+ *
23
+ * The Avatar component adheres to the Akinon design system, ensuring consistent styling
24
+ * and accessibility. It is suitable for user profiles, lists, and other contexts
25
+ * where visual representation is needed.
26
+ */
16
27
  export const Avatar = (_a) => {
17
28
  var { shape = 'circle' } = _a, restAvatarProps = __rest(_a, ["shape"]);
18
29
  const { getPrefixCls, theme } = React.useContext(ConfigProvider.ConfigContext);
@@ -33,8 +44,19 @@ export const Avatar = (_a) => {
33
44
  });
34
45
  return useStyle(React.createElement(AntAvatar, Object.assign({ shape: shape }, restAvatarProps)));
35
46
  };
47
+ /**
48
+ * AvatarGroup component for Akinon UI.
49
+ *
50
+ * The AvatarGroup component is used to display a collection of avatars as a group,
51
+ * with options for size, shape, and maximum visible avatars. It supports a popover
52
+ * for collapsed avatars when the count exceeds the maximum limit.
53
+ *
54
+ * The AvatarGroup component adheres to the Akinon design system, providing consistent
55
+ * styling and functionality. It is ideal for representing teams, participants, or
56
+ * groups in a compact and visually appealing way.
57
+ */
36
58
  export const AvatarGroup = (_a) => {
37
- var { maxPopoverPlacement = 'top', maxPopoverTrigger = 'hover', shape = 'circle', children } = _a, restAvatarProps = __rest(_a, ["maxPopoverPlacement", "maxPopoverTrigger", "shape", "children"]);
59
+ var { children } = _a, restAvatarProps = __rest(_a, ["children"]);
38
60
  const { getPrefixCls, theme } = React.useContext(ConfigProvider.ConfigContext);
39
61
  const { token, hashId } = useToken();
40
62
  const useStyle = useStyleRegister({
@@ -50,5 +72,5 @@ export const AvatarGroup = (_a) => {
50
72
  [prefixClsWithoutHash]: {}
51
73
  };
52
74
  });
53
- return useStyle(React.createElement(AntAvatar.Group, Object.assign({ maxPopoverPlacement: maxPopoverPlacement, maxPopoverTrigger: maxPopoverTrigger, shape: shape }, restAvatarProps), children));
75
+ return useStyle(React.createElement(AntAvatar.Group, Object.assign({}, restAvatarProps), children));
54
76
  };
@@ -1,55 +1,131 @@
1
+ /**
2
+ * Breakpoint type for screen size mappings.
3
+ */
1
4
  type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
5
+
6
+ /**
7
+ * Mapping of screen sizes to numbers, used for responsive configurations.
8
+ */
2
9
  type ScreenSizeMap = Partial<Record<Breakpoint, number>>;
3
10
 
11
+ /**
12
+ * Avatar size configuration, supporting predefined sizes, numeric values, or responsive mappings.
13
+ */
4
14
  type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
5
15
 
16
+ /**
17
+ * Props for the Avatar component.
18
+ */
6
19
  export interface AvatarProps {
7
- /** The shape of avatar */
20
+ /**
21
+ * The shape of the avatar.
22
+ */
8
23
  shape?: 'circle' | 'square';
9
- /** The size of the avatar */
24
+
25
+ /**
26
+ * The size of the avatar.
27
+ */
10
28
  size?: AvatarSize;
11
- /** Letter type unit distance between left and right sides */
29
+
30
+ /**
31
+ * Letter type unit distance between left and right sides
32
+ */
12
33
  gap?: number;
13
- /** The address of the image for an image avatar or image element */
34
+
35
+ /**
36
+ * The address of the image for an image avatar or image element
37
+ */
14
38
  src?: React.ReactNode | string;
15
- /** A list of sources to use for different screen resolutions */
39
+
40
+ /**
41
+ * A list of sources to use for different screen resolutions
42
+ */
16
43
  srcSet?: string;
17
- /** Whether the picture is allowed to be dragged */
44
+
45
+ /**
46
+ * Whether the picture is allowed to be dragged
47
+ */
18
48
  draggable?: boolean | 'true' | 'false';
19
- /** Custom icon type for an icon avatar */
49
+
50
+ /**
51
+ * Custom icon type for an icon avatar
52
+ */
20
53
  icon?: React.ReactNode;
21
- /** Additional CSS class name */
54
+
55
+ /**
56
+ * Additional CSS class name
57
+ */
22
58
  className?: string;
23
- /** Additional CSS class name for the root element */
59
+
60
+ /**
61
+ * Additional CSS class name for the root element
62
+ */
24
63
  rootClassName?: string;
25
- /** The content of the avatar */
64
+
65
+ /**
66
+ * The content of the avatar
67
+ */
26
68
  children?: React.ReactNode;
27
- /** This attribute defines the alternative text describing the image */
69
+
70
+ /**
71
+ * This attribute defines the alternative text describing the image
72
+ */
28
73
  alt?: string;
29
- /** CORS settings attributes */
74
+
75
+ /**
76
+ * CORS settings attributes
77
+ */
30
78
  crossOrigin?: 'anonymous' | 'use-credentials';
79
+
80
+ /**
81
+ * Click event handler for the avatar.
82
+ */
31
83
  onClick?: (e?: React.MouseEvent<HTMLElement>) => void;
32
- /** Handler when img load error, return false to prevent default fallback behavior */
84
+
85
+ /**
86
+ * Handler when img load error, return false to prevent default fallback behavior
87
+ */
33
88
  onError?: () => boolean;
34
89
  }
35
90
 
91
+ /**
92
+ * Props for the AvatarGroup component.
93
+ */
36
94
  export interface AvatarGroupProps {
37
- /** Additional CSS class name */
95
+ /**
96
+ * Additional CSS class name
97
+ */
38
98
  className?: string;
39
- /** Additional CSS class name for the root element */
99
+
100
+ /**
101
+ * Additional CSS class name for the root element
102
+ */
40
103
  rootClassName?: string;
41
- /** The content of the avatar group */
104
+
105
+ /**
106
+ * The content of the avatar group
107
+ */
42
108
  children?: React.ReactNode;
43
- /** Maximum number of avatars to display before collapsing */
44
- maxCount?: number;
45
- /** Additional CSS styles for the maximum number of avatars */
46
- maxStyle?: React.CSSProperties;
47
- /** Placement of the popover for the maximum number of avatars */
48
- maxPopoverPlacement?: 'top' | 'bottom';
49
- /** Trigger type for the popover of the maximum number of avatars */
50
- maxPopoverTrigger?: 'hover' | 'focus' | 'click';
51
- /** Size of the avatars in the group */
109
+
110
+ /**
111
+ * Maximum number of avatars to display before collapsing settings
112
+ * @default { popover: { placement: 'top', trigger: 'hover' } }
113
+ */
114
+ max?: {
115
+ popover?: {
116
+ placement?: 'top' | 'bottom';
117
+ trigger?: 'hover' | 'focus' | 'click';
118
+ };
119
+ count?: number;
120
+ };
121
+
122
+ /**
123
+ * Size of the avatars in the group
124
+ */
52
125
  size?: AvatarSize;
53
- /** Shape of the avatars in the group */
126
+
127
+ /**
128
+ * Shape of the avatars in the group
129
+ */
54
130
  shape?: 'circle' | 'square';
55
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/ui-avatar",
3
- "version": "0.5.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
@@ -9,15 +9,15 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "antd": "5.17.0",
13
- "@akinon/ui-theme": "0.7.0"
12
+ "antd": "5.22.6",
13
+ "@akinon/ui-theme": "1.0.1"
14
14
  },
15
15
  "devDependencies": {
16
16
  "clean-package": "2.2.0",
17
17
  "copyfiles": "^2.4.1",
18
18
  "rimraf": "^5.0.5",
19
- "typescript": "^5.2.2",
20
- "@akinon/typescript-config": "0.4.0"
19
+ "typescript": "*",
20
+ "@akinon/typescript-config": "1.0.1"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=18",