@availity/mui-avatar 0.3.2 → 0.3.4
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/CHANGELOG.md +7 -0
- package/dist/index.js +5 -6
- package/dist/index.mjs +5 -6
- package/package.json +4 -5
- package/src/lib/Avatar.stories.tsx +36 -0
- package/src/lib/Avatar.tsx +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.3.4](https://github.com/Availity/element/compare/@availity/mui-avatar@0.3.3...@availity/mui-avatar@0.3.4) (2025-01-08)
|
|
6
|
+
|
|
7
|
+
## [0.3.3](https://github.com/Availity/element/compare/@availity/mui-avatar@0.3.2...@availity/mui-avatar@0.3.3) (2025-01-06)
|
|
8
|
+
|
|
9
|
+
### Dependency Updates
|
|
10
|
+
|
|
11
|
+
* `mui-icon` updated to version `0.3.2`
|
|
5
12
|
## [0.3.2](https://github.com/Availity/element/compare/@availity/mui-avatar@0.3.1...@availity/mui-avatar@0.3.2) (2025-01-03)
|
|
6
13
|
|
|
7
14
|
### Dependency Updates
|
package/dist/index.js
CHANGED
|
@@ -86,16 +86,15 @@ module.exports = __toCommonJS(src_exports);
|
|
|
86
86
|
// src/lib/Avatar.tsx
|
|
87
87
|
var import_Avatar = __toESM(require("@mui/material/Avatar"));
|
|
88
88
|
var import_react = __toESM(require("react"));
|
|
89
|
-
var import_design_tokens = require("@availity/design-tokens");
|
|
90
89
|
var import_api_axios = require("@availity/api-axios");
|
|
91
90
|
var import_mui_icon = require("@availity/mui-icon");
|
|
92
91
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
93
92
|
var sizeStyling = {
|
|
94
|
-
xs: { width: 18, height: 18, fontSize:
|
|
95
|
-
s: { width: 24, height: 24, fontSize:
|
|
96
|
-
m: { width: 40, height: 40, fontSize:
|
|
97
|
-
l: { width: 80, height: 80, fontSize:
|
|
98
|
-
xl: { width: 140, height: 140, fontSize:
|
|
93
|
+
xs: { width: 18, height: 18, fontSize: "caption.fontSize" },
|
|
94
|
+
s: { width: 24, height: 24, fontSize: "caption.fontSize" },
|
|
95
|
+
m: { width: 40, height: 40, fontSize: "h5.fontSize", fontWeight: "fontWeightBold" },
|
|
96
|
+
l: { width: 80, height: 80, fontSize: "h3.fontSize", fontWeight: "fontWeightBold" },
|
|
97
|
+
xl: { width: 140, height: 140, fontSize: "h1.fontSize", fontWeight: "fontWeightBold" }
|
|
99
98
|
};
|
|
100
99
|
var getInitials = (name, size) => {
|
|
101
100
|
if (name.split(" ").length > 1 && size !== "xs") {
|
package/dist/index.mjs
CHANGED
|
@@ -53,16 +53,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
53
53
|
// src/lib/Avatar.tsx
|
|
54
54
|
import { default as MuiAvatar } from "@mui/material/Avatar";
|
|
55
55
|
import React, { useEffect } from "react";
|
|
56
|
-
import { tokens } from "@availity/design-tokens";
|
|
57
56
|
import { avSettingsApi } from "@availity/api-axios";
|
|
58
57
|
import { UserIcon } from "@availity/mui-icon";
|
|
59
58
|
import { jsx } from "react/jsx-runtime";
|
|
60
59
|
var sizeStyling = {
|
|
61
|
-
xs: { width: 18, height: 18, fontSize:
|
|
62
|
-
s: { width: 24, height: 24, fontSize:
|
|
63
|
-
m: { width: 40, height: 40, fontSize:
|
|
64
|
-
l: { width: 80, height: 80, fontSize:
|
|
65
|
-
xl: { width: 140, height: 140, fontSize:
|
|
60
|
+
xs: { width: 18, height: 18, fontSize: "caption.fontSize" },
|
|
61
|
+
s: { width: 24, height: 24, fontSize: "caption.fontSize" },
|
|
62
|
+
m: { width: 40, height: 40, fontSize: "h5.fontSize", fontWeight: "fontWeightBold" },
|
|
63
|
+
l: { width: 80, height: 80, fontSize: "h3.fontSize", fontWeight: "fontWeightBold" },
|
|
64
|
+
xl: { width: 140, height: 140, fontSize: "h1.fontSize", fontWeight: "fontWeightBold" }
|
|
66
65
|
};
|
|
67
66
|
var getInitials = (name, size) => {
|
|
68
67
|
if (name.split(" ").length > 1 && size !== "xs") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-avatar",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Availity MUI Avatar Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@availity/mui-icon": "^0.12.
|
|
35
|
+
"@availity/mui-icon": "^0.12.1",
|
|
36
36
|
"@mui/material": "^5.15.15",
|
|
37
37
|
"react": "18.2.0",
|
|
38
38
|
"react-dom": "18.2.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"typescript": "^5.4.5"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@availity/mui-icon": "^0.12.
|
|
43
|
+
"@availity/mui-icon": "^0.12.1",
|
|
44
44
|
"@mui/material": "^5.11.9",
|
|
45
45
|
"react": ">=16.3.0"
|
|
46
46
|
},
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@availity/api-axios": "^9.0.4"
|
|
52
|
-
"@availity/design-tokens": "^0.14.1"
|
|
51
|
+
"@availity/api-axios": "^9.0.4"
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
4
|
import { Avatar, AvatarProps } from './Avatar';
|
|
5
5
|
import { HomeIcon } from '@availity/mui-icon';
|
|
6
|
+
import Grid from '@mui/material/Unstable_Grid2';
|
|
6
7
|
|
|
7
8
|
const meta: Meta<typeof Avatar> = {
|
|
8
9
|
title: 'Components/Avatar/Avatar',
|
|
@@ -44,3 +45,38 @@ export const _IconAvatar: StoryObj<typeof Avatar> = {
|
|
|
44
45
|
</Avatar>
|
|
45
46
|
),
|
|
46
47
|
};
|
|
48
|
+
|
|
49
|
+
export const _Sizes: StoryObj<typeof Avatar> = {
|
|
50
|
+
render: (args: AvatarProps) => (
|
|
51
|
+
<Grid container spacing={1}>
|
|
52
|
+
<Grid xs={2}>XSmall</Grid>
|
|
53
|
+
<Grid xs={10}>
|
|
54
|
+
<Avatar {...args} size="xs"/>
|
|
55
|
+
</Grid>
|
|
56
|
+
<Grid xs={2}>Small</Grid>
|
|
57
|
+
<Grid xs={10}>
|
|
58
|
+
<Avatar {...args} size="s"/>
|
|
59
|
+
</Grid>
|
|
60
|
+
<Grid xs={2}>Medium</Grid>
|
|
61
|
+
<Grid xs={10}>
|
|
62
|
+
<Avatar {...args} size="m"/>
|
|
63
|
+
</Grid>
|
|
64
|
+
<Grid xs={2}>Large</Grid>
|
|
65
|
+
<Grid xs={10}>
|
|
66
|
+
<Avatar {...args} size="l"/>
|
|
67
|
+
</Grid>
|
|
68
|
+
<Grid xs={2}>XLarge</Grid>
|
|
69
|
+
<Grid xs={10}>
|
|
70
|
+
<Avatar {...args} size="xl"/>
|
|
71
|
+
</Grid>
|
|
72
|
+
</Grid>
|
|
73
|
+
),
|
|
74
|
+
args: {
|
|
75
|
+
children: 'John Doe',
|
|
76
|
+
},
|
|
77
|
+
parameters: {
|
|
78
|
+
controls: {
|
|
79
|
+
include: 'children'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
package/src/lib/Avatar.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { default as MuiAvatar, AvatarProps as MuiAvatarProps } from '@mui/material/Avatar';
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
|
-
import { tokens } from '@availity/design-tokens';
|
|
4
3
|
import { avSettingsApi } from '@availity/api-axios';
|
|
5
4
|
import { UserIcon } from '@availity/mui-icon';
|
|
6
5
|
|
|
@@ -11,11 +10,11 @@ export interface AvatarProps extends Omit<MuiAvatarProps, 'variant'> {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
const sizeStyling = {
|
|
14
|
-
xs: { width: 18, height: 18, fontSize:
|
|
15
|
-
s: { width: 24, height: 24, fontSize:
|
|
16
|
-
m: { width: 40, height: 40, fontSize:
|
|
17
|
-
l: { width: 80, height: 80, fontSize:
|
|
18
|
-
xl: { width: 140, height: 140, fontSize:
|
|
13
|
+
xs: { width: 18, height: 18, fontSize: 'caption.fontSize' },
|
|
14
|
+
s: { width: 24, height: 24, fontSize: 'caption.fontSize' },
|
|
15
|
+
m: { width: 40, height: 40, fontSize: 'h5.fontSize', fontWeight: 'fontWeightBold' },
|
|
16
|
+
l: { width: 80, height: 80, fontSize: 'h3.fontSize', fontWeight: 'fontWeightBold' },
|
|
17
|
+
xl: { width: 140, height: 140, fontSize: 'h1.fontSize', fontWeight: 'fontWeightBold' },
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
const getInitials = (name: string, size: 'xs' | 's' | 'm' | 'l' | 'xl'): string => {
|