armtek-uikit-react 1.0.42 → 1.0.44
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/assets/Avatar.scss +5 -1
- package/package.json +1 -1
- package/ui/Avatar/Avatar.d.ts +2 -2
- package/ui/Avatar/Avatar.js +25 -13
- package/ui/Chip/Chip.js +0 -1
package/assets/Avatar.scss
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.44","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*","clsx":"^2.0.0"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
|
package/ui/Avatar/Avatar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, HTMLAttributes } from 'react';
|
|
2
2
|
import { ColorStatusType, SizeType } from '../../types/theme';
|
|
3
3
|
export type AvatarProps = {
|
|
4
4
|
photo?: string;
|
|
@@ -8,7 +8,7 @@ export type AvatarProps = {
|
|
|
8
8
|
icon?: string;
|
|
9
9
|
size?: Exclude<SizeType, 'extraLarge'>;
|
|
10
10
|
status?: Exclude<ColorStatusType, 'info'>;
|
|
11
|
-
}
|
|
11
|
+
} & ComponentPropsWithoutRef<'div'>;
|
|
12
12
|
export declare const getLetters: (name: string) => string;
|
|
13
13
|
declare const Avatar: (props: AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export default Avatar;
|
package/ui/Avatar/Avatar.js
CHANGED
|
@@ -12,10 +12,21 @@ export const getLetters = name => {
|
|
|
12
12
|
return nameParts[0].split('')[0] + (nameParts[1] ? nameParts[1].split('')[0] : '');
|
|
13
13
|
};
|
|
14
14
|
const Avatar = props => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const {
|
|
16
|
+
photo,
|
|
17
|
+
name,
|
|
18
|
+
href,
|
|
19
|
+
linkProps,
|
|
20
|
+
icon,
|
|
21
|
+
size,
|
|
22
|
+
status,
|
|
23
|
+
className,
|
|
24
|
+
...divProps
|
|
25
|
+
} = props;
|
|
26
|
+
let displayIcon = icon;
|
|
27
|
+
if (!props.icon && !props.name && !photo) displayIcon = 'person';
|
|
28
|
+
let content = photo ? /*#__PURE__*/_jsx("img", {
|
|
29
|
+
src: photo,
|
|
19
30
|
className: css.avatar__img,
|
|
20
31
|
alt: props.name,
|
|
21
32
|
title: props.name
|
|
@@ -24,26 +35,27 @@ const Avatar = props => {
|
|
|
24
35
|
children: getLetters(props.name)
|
|
25
36
|
}) : /*#__PURE__*/_jsx("span", {
|
|
26
37
|
className: clsx(css.avatar__icon, 'material_icon_solid'),
|
|
27
|
-
children:
|
|
38
|
+
children: displayIcon
|
|
28
39
|
});
|
|
29
40
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
30
41
|
children: /*#__PURE__*/_jsxs("div", {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
...divProps,
|
|
43
|
+
className: clsx('Arm-avatar', className, {
|
|
44
|
+
[css.avatar__photo]: !!photo
|
|
45
|
+
}, css.avatar, css['avatar_' + size]),
|
|
34
46
|
children: [/*#__PURE__*/_jsx("div", {
|
|
35
47
|
className: css.avatar__inner,
|
|
36
|
-
children:
|
|
37
|
-
href:
|
|
38
|
-
...
|
|
48
|
+
children: href ? /*#__PURE__*/_jsx("a", {
|
|
49
|
+
href: href,
|
|
50
|
+
...linkProps,
|
|
39
51
|
className: css.avatar__innerText,
|
|
40
52
|
children: content
|
|
41
53
|
}) : /*#__PURE__*/_jsx("span", {
|
|
42
54
|
className: css.avatar__innerText,
|
|
43
55
|
children: content
|
|
44
56
|
})
|
|
45
|
-
}),
|
|
46
|
-
className: clsx(css.avatar__status, css['avatar__status_' +
|
|
57
|
+
}), status && /*#__PURE__*/_jsx("span", {
|
|
58
|
+
className: clsx(css.avatar__status, css['avatar__status_' + status])
|
|
47
59
|
})]
|
|
48
60
|
})
|
|
49
61
|
});
|
package/ui/Chip/Chip.js
CHANGED