@dt-dds/react-avatar 1.0.0-beta.58 → 1.0.0-beta.60
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 +16 -0
- package/README.md +1 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @dt-ui/react-avatar
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.60
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat: persist avatar active state
|
|
8
|
+
|
|
9
|
+
## 1.0.0-beta.59
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix: update responsive font styles
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @dt-dds/themes@1.0.0-beta.9
|
|
16
|
+
- @dt-dds/react-core@1.0.0-beta.50
|
|
17
|
+
- @dt-dds/react-tooltip@1.0.0-beta.58
|
|
18
|
+
|
|
3
19
|
## 1.0.0-beta.58
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ This component can contain upto two simple characters by passing a string in pro
|
|
|
33
33
|
| `size` | `enum<AvatarSize>` | medium | Sets the Avatar size given the available options |
|
|
34
34
|
| `imageSrc` | `string` | - | Optional profile image path (will only work with "Profile" type) |
|
|
35
35
|
| `dataTestId` | `string` | avatar | Avatar test identifier |
|
|
36
|
+
| `isActive` | `Boolean` | false | Persist the Avatar active state |
|
|
36
37
|
|
|
37
38
|
## Stack
|
|
38
39
|
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,7 @@ type AvatarSize = (typeof AvatarSize)[keyof typeof AvatarSize];
|
|
|
19
19
|
interface AvatarStyledProps {
|
|
20
20
|
type: AvatarType;
|
|
21
21
|
size: AvatarSize;
|
|
22
|
+
isActive?: boolean;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
interface AvatarProps extends AvatarStyledProps {
|
|
@@ -27,8 +28,9 @@ interface AvatarProps extends AvatarStyledProps {
|
|
|
27
28
|
dataTestId?: string;
|
|
28
29
|
customInitials?: string;
|
|
29
30
|
hasTooltip?: boolean;
|
|
31
|
+
isActive?: boolean;
|
|
30
32
|
}
|
|
31
|
-
declare const Avatar: ({ title, type, size, imageSrc, dataTestId, customInitials, hasTooltip, }: AvatarProps) => react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare const Avatar: ({ title, type, size, imageSrc, dataTestId, customInitials, hasTooltip, isActive, }: AvatarProps) => react_jsx_runtime.JSX.Element;
|
|
32
34
|
|
|
33
35
|
declare module '@emotion/react' {
|
|
34
36
|
interface Theme extends CustomTheme {
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ type AvatarSize = (typeof AvatarSize)[keyof typeof AvatarSize];
|
|
|
19
19
|
interface AvatarStyledProps {
|
|
20
20
|
type: AvatarType;
|
|
21
21
|
size: AvatarSize;
|
|
22
|
+
isActive?: boolean;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
interface AvatarProps extends AvatarStyledProps {
|
|
@@ -27,8 +28,9 @@ interface AvatarProps extends AvatarStyledProps {
|
|
|
27
28
|
dataTestId?: string;
|
|
28
29
|
customInitials?: string;
|
|
29
30
|
hasTooltip?: boolean;
|
|
31
|
+
isActive?: boolean;
|
|
30
32
|
}
|
|
31
|
-
declare const Avatar: ({ title, type, size, imageSrc, dataTestId, customInitials, hasTooltip, }: AvatarProps) => react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare const Avatar: ({ title, type, size, imageSrc, dataTestId, customInitials, hasTooltip, isActive, }: AvatarProps) => react_jsx_runtime.JSX.Element;
|
|
32
34
|
|
|
33
35
|
declare module '@emotion/react' {
|
|
34
36
|
interface Theme extends CustomTheme {
|
package/dist/index.js
CHANGED
|
@@ -272,7 +272,7 @@ var AvatarSize = {
|
|
|
272
272
|
|
|
273
273
|
// src/Avatar.styled.ts
|
|
274
274
|
var AvatarStyled = import_styled.default.div`
|
|
275
|
-
${({ theme, type, size }) => {
|
|
275
|
+
${({ theme, type, size, isActive }) => {
|
|
276
276
|
let styles = `
|
|
277
277
|
& > * {
|
|
278
278
|
width: 100%;
|
|
@@ -322,7 +322,7 @@ var AvatarStyled = import_styled.default.div`
|
|
|
322
322
|
color: ${theme.palette.content.contrast};
|
|
323
323
|
|
|
324
324
|
& > * {
|
|
325
|
-
background-color: ${theme.palette.primary.default};
|
|
325
|
+
background-color: ${isActive ? theme.palette.primary.dark : theme.palette.primary.default};
|
|
326
326
|
|
|
327
327
|
&:hover {
|
|
328
328
|
background-color: ${theme.palette.primary.dark};
|
|
@@ -383,7 +383,8 @@ var Avatar = ({
|
|
|
383
383
|
imageSrc = "",
|
|
384
384
|
dataTestId,
|
|
385
385
|
customInitials,
|
|
386
|
-
hasTooltip = true
|
|
386
|
+
hasTooltip = true,
|
|
387
|
+
isActive = false
|
|
387
388
|
}) => {
|
|
388
389
|
const [showThumbnail, setShowThumbnail] = (0, import_react3.useState)(false);
|
|
389
390
|
const handleImageError = () => {
|
|
@@ -402,6 +403,7 @@ var Avatar = ({
|
|
|
402
403
|
"data-testid": dataTestId != null ? dataTestId : "avatar",
|
|
403
404
|
size,
|
|
404
405
|
type,
|
|
406
|
+
isActive,
|
|
405
407
|
children: type === AvatarType.Profile ? renderProfileImage() : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { children: customInitials ? customInitials.substring(0, 2) : acronymGenerator(title) })
|
|
406
408
|
}
|
|
407
409
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -237,7 +237,7 @@ var AvatarSize = {
|
|
|
237
237
|
|
|
238
238
|
// src/Avatar.styled.ts
|
|
239
239
|
var AvatarStyled = styled.div`
|
|
240
|
-
${({ theme, type, size }) => {
|
|
240
|
+
${({ theme, type, size, isActive }) => {
|
|
241
241
|
let styles = `
|
|
242
242
|
& > * {
|
|
243
243
|
width: 100%;
|
|
@@ -287,7 +287,7 @@ var AvatarStyled = styled.div`
|
|
|
287
287
|
color: ${theme.palette.content.contrast};
|
|
288
288
|
|
|
289
289
|
& > * {
|
|
290
|
-
background-color: ${theme.palette.primary.default};
|
|
290
|
+
background-color: ${isActive ? theme.palette.primary.dark : theme.palette.primary.default};
|
|
291
291
|
|
|
292
292
|
&:hover {
|
|
293
293
|
background-color: ${theme.palette.primary.dark};
|
|
@@ -348,7 +348,8 @@ var Avatar = ({
|
|
|
348
348
|
imageSrc = "",
|
|
349
349
|
dataTestId,
|
|
350
350
|
customInitials,
|
|
351
|
-
hasTooltip = true
|
|
351
|
+
hasTooltip = true,
|
|
352
|
+
isActive = false
|
|
352
353
|
}) => {
|
|
353
354
|
const [showThumbnail, setShowThumbnail] = useState(false);
|
|
354
355
|
const handleImageError = () => {
|
|
@@ -367,6 +368,7 @@ var Avatar = ({
|
|
|
367
368
|
"data-testid": dataTestId != null ? dataTestId : "avatar",
|
|
368
369
|
size,
|
|
369
370
|
type,
|
|
371
|
+
isActive,
|
|
370
372
|
children: type === AvatarType.Profile ? renderProfileImage() : /* @__PURE__ */ jsx58("div", { children: customInitials ? customInitials.substring(0, 2) : acronymGenerator(title) })
|
|
371
373
|
}
|
|
372
374
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dt-dds/react-avatar",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.60",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js"
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"test:update:snapshot": "jest -u"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dt-dds/react-core": "1.0.0-beta.
|
|
24
|
-
"@dt-dds/react-tooltip": "1.0.0-beta.
|
|
25
|
-
"@dt-dds/themes": "1.0.0-beta.
|
|
23
|
+
"@dt-dds/react-core": "1.0.0-beta.50",
|
|
24
|
+
"@dt-dds/react-tooltip": "1.0.0-beta.58",
|
|
25
|
+
"@dt-dds/themes": "1.0.0-beta.9"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.22.9",
|