@wavv/ui 2.3.15 → 2.3.16
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,9 +1,9 @@
|
|
|
1
1
|
import { type FileTriggerProps } from 'react-aria-components';
|
|
2
2
|
import type { IconType } from './helpers/getIcon';
|
|
3
|
-
import type { MarginPadding } from './types';
|
|
3
|
+
import type { MarginPadding, Sizes } from './types';
|
|
4
4
|
type Props = {
|
|
5
|
-
/** Size of the avatar in pixels */
|
|
6
|
-
size?: number;
|
|
5
|
+
/** Size of the avatar in pixels or string (tiny = 24px, small = 32px, medium = 100px, large = 160px) */
|
|
6
|
+
size?: Sizes | number;
|
|
7
7
|
/** URL of the avatar image */
|
|
8
8
|
url?: string;
|
|
9
9
|
/** Icon to display as fallback when no URL or initials are provided */
|
|
@@ -21,5 +21,5 @@ type Props = {
|
|
|
21
21
|
/** Callback when file validation fails */
|
|
22
22
|
onError?: (error: 'type' | 'size') => void;
|
|
23
23
|
} & MarginPadding & Pick<FileTriggerProps, 'acceptedFileTypes' | 'onSelect'>;
|
|
24
|
-
declare const Avatar: ({ size, url, icon, initials, acceptedFileTypes, onSelect, onError, maxFileSize, onRemove, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare const Avatar: ({ size: sizeProp, url, icon, initials, acceptedFileTypes, onSelect, onError, maxFileSize, onRemove, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
export default Avatar;
|
|
@@ -6,7 +6,14 @@ import parseFileSize from "../utils/parseFileSize.js";
|
|
|
6
6
|
import Button from "./Button/index.js";
|
|
7
7
|
import getIcon from "./helpers/getIcon.js";
|
|
8
8
|
import { marginProps, paddingProps } from "./helpers/styledProps.js";
|
|
9
|
-
const Avatar = ({ size =
|
|
9
|
+
const Avatar = ({ size: sizeProp = 'small', url, icon, initials, acceptedFileTypes, onSelect, onError, maxFileSize, onRemove, ...props })=>{
|
|
10
|
+
const sizes = {
|
|
11
|
+
tiny: 24,
|
|
12
|
+
small: 32,
|
|
13
|
+
medium: 100,
|
|
14
|
+
large: 160
|
|
15
|
+
};
|
|
16
|
+
const size = 'string' == typeof sizeProp ? sizes[sizeProp] : sizeProp;
|
|
10
17
|
const imageSize = size - 4;
|
|
11
18
|
const hasUpload = !!acceptedFileTypes || !!onSelect;
|
|
12
19
|
const handleFileSelect = (files)=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavv/ui",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
"@rsbuild/core": "1.6.15",
|
|
69
69
|
"@rsbuild/plugin-react": "^1.4.2",
|
|
70
70
|
"@rsbuild/plugin-svgr": "^1.2.3",
|
|
71
|
-
"@rslib/core": "^0.
|
|
72
|
-
"@storybook/addon-docs": "^10.1.
|
|
73
|
-
"@storybook/addon-links": "^10.1.
|
|
74
|
-
"@storybook/addon-themes": "^10.1.
|
|
71
|
+
"@rslib/core": "^0.19.0",
|
|
72
|
+
"@storybook/addon-docs": "^10.1.11",
|
|
73
|
+
"@storybook/addon-links": "^10.1.11",
|
|
74
|
+
"@storybook/addon-themes": "^10.1.11",
|
|
75
75
|
"@storybook/test-runner": "^0.24.2",
|
|
76
76
|
"@svgr/core": "^8.1.0",
|
|
77
77
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"change-case": "^5.4.4",
|
|
92
92
|
"chromatic": "^13.3.4",
|
|
93
93
|
"jest": "^30.2.0",
|
|
94
|
-
"lefthook": "^2.0.
|
|
94
|
+
"lefthook": "^2.0.13",
|
|
95
95
|
"ncp": "^2.0.0",
|
|
96
96
|
"path": "^0.12.7",
|
|
97
97
|
"phone": "^3.1.69",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"react-dom": "^19.2.3",
|
|
105
105
|
"replace": "^1.2.2",
|
|
106
106
|
"signale": "^1.4.0",
|
|
107
|
-
"storybook": "^10.1.
|
|
107
|
+
"storybook": "^10.1.11",
|
|
108
108
|
"storybook-react-rsbuild": "^3.2.0",
|
|
109
109
|
"tsc-files": "^1.1.4",
|
|
110
110
|
"tslib": "^2.8.1",
|