colibri-ui 0.7.145 → 0.7.147
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/Avatar/Avatar.module.css +1 -0
- package/Avatar/index.js +12 -7
- package/Avatar/index.props.d.ts +3 -1
- package/base/InputRoot/InputRoot.module.css +0 -1
- package/esm/Avatar/Avatar.module.css +1 -0
- package/esm/Avatar/index.js +12 -7
- package/esm/Avatar/index.props.d.ts +3 -1
- package/esm/base/InputRoot/InputRoot.module.css +0 -1
- package/package.json +1 -1
package/Avatar/Avatar.module.css
CHANGED
package/Avatar/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var tslib = require('tslib');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var classNames = require('classnames/bind');
|
|
7
8
|
var constants = require('./constants.js');
|
|
@@ -17,27 +18,31 @@ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
|
17
18
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
18
19
|
|
|
19
20
|
var clx = classNames__default.default.bind(styles__default.default);
|
|
21
|
+
var getStubImage = function getStubImage(type) {
|
|
22
|
+
return type === index_props.AccountType.Organization ? orgCircle.default : userCircle.default;
|
|
23
|
+
};
|
|
20
24
|
var Avatar = /*#__PURE__*/React.memo(function (props) {
|
|
21
25
|
var avatarURL = props.avatarURL,
|
|
26
|
+
style = props.style,
|
|
22
27
|
_a = props.size,
|
|
23
28
|
size = _a === void 0 ? constants.AvatarSizes.M : _a,
|
|
24
29
|
className = props.className,
|
|
25
30
|
bordered = props.bordered,
|
|
26
|
-
_b = props.
|
|
27
|
-
|
|
31
|
+
_b = props.alt,
|
|
32
|
+
alt = _b === void 0 ? "profile image" : _b,
|
|
28
33
|
_c = props.accountType,
|
|
29
34
|
accountType = _c === void 0 ? index_props.AccountType.Organization : _c;
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
alt: title,
|
|
35
|
+
var stubImageURL = getStubImage(accountType);
|
|
36
|
+
return /*#__PURE__*/React__default.default.createElement("img", tslib.__assign({
|
|
37
|
+
alt: alt,
|
|
34
38
|
src: avatarURL || stubImageURL,
|
|
35
39
|
width: size,
|
|
36
40
|
height: size,
|
|
41
|
+
style: style,
|
|
37
42
|
className: clx(styles__default.default.avatar, {
|
|
38
43
|
avatar_bordered: !!bordered
|
|
39
44
|
}, [className])
|
|
40
|
-
});
|
|
45
|
+
}, props));
|
|
41
46
|
});
|
|
42
47
|
|
|
43
48
|
exports.default = Avatar;
|
package/Avatar/index.props.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
1
2
|
import type { AvatarSizes } from "./constants";
|
|
2
3
|
export declare enum AccountType {
|
|
3
4
|
Person = "person",
|
|
@@ -5,7 +6,8 @@ export declare enum AccountType {
|
|
|
5
6
|
}
|
|
6
7
|
export type AvatarProps = {
|
|
7
8
|
accountType?: AccountType;
|
|
8
|
-
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
alt?: string;
|
|
9
11
|
size?: AvatarSizes | number;
|
|
10
12
|
avatarURL?: string;
|
|
11
13
|
bordered?: boolean;
|
package/esm/Avatar/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign } from 'tslib';
|
|
1
2
|
import React__default, { memo } from 'react';
|
|
2
3
|
import classNames from 'classnames/bind';
|
|
3
4
|
import { AvatarSizes } from './constants.js';
|
|
@@ -7,27 +8,31 @@ import styles from './Avatar.module.css';
|
|
|
7
8
|
import { AccountType } from './index.props.js';
|
|
8
9
|
|
|
9
10
|
var clx = classNames.bind(styles);
|
|
11
|
+
var getStubImage = function getStubImage(type) {
|
|
12
|
+
return type === AccountType.Organization ? orgCircleUrl : userCircleUrl;
|
|
13
|
+
};
|
|
10
14
|
var Avatar = /*#__PURE__*/memo(function (props) {
|
|
11
15
|
var avatarURL = props.avatarURL,
|
|
16
|
+
style = props.style,
|
|
12
17
|
_a = props.size,
|
|
13
18
|
size = _a === void 0 ? AvatarSizes.M : _a,
|
|
14
19
|
className = props.className,
|
|
15
20
|
bordered = props.bordered,
|
|
16
|
-
_b = props.
|
|
17
|
-
|
|
21
|
+
_b = props.alt,
|
|
22
|
+
alt = _b === void 0 ? "profile image" : _b,
|
|
18
23
|
_c = props.accountType,
|
|
19
24
|
accountType = _c === void 0 ? AccountType.Organization : _c;
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
alt: title,
|
|
25
|
+
var stubImageURL = getStubImage(accountType);
|
|
26
|
+
return /*#__PURE__*/React__default.createElement("img", __assign({
|
|
27
|
+
alt: alt,
|
|
24
28
|
src: avatarURL || stubImageURL,
|
|
25
29
|
width: size,
|
|
26
30
|
height: size,
|
|
31
|
+
style: style,
|
|
27
32
|
className: clx(styles.avatar, {
|
|
28
33
|
avatar_bordered: !!bordered
|
|
29
34
|
}, [className])
|
|
30
|
-
});
|
|
35
|
+
}, props));
|
|
31
36
|
});
|
|
32
37
|
|
|
33
38
|
export { Avatar as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
1
2
|
import type { AvatarSizes } from "./constants";
|
|
2
3
|
export declare enum AccountType {
|
|
3
4
|
Person = "person",
|
|
@@ -5,7 +6,8 @@ export declare enum AccountType {
|
|
|
5
6
|
}
|
|
6
7
|
export type AvatarProps = {
|
|
7
8
|
accountType?: AccountType;
|
|
8
|
-
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
alt?: string;
|
|
9
11
|
size?: AvatarSizes | number;
|
|
10
12
|
avatarURL?: string;
|
|
11
13
|
bordered?: boolean;
|