@salutejs/plasma-new-hope 0.76.3-canary.1180.8732245904.0 → 0.76.3-canary.22.8733068927.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Avatar/Avatar.js +1 -29
- package/cjs/components/Avatar/Avatar.js.map +1 -1
- package/es/components/Avatar/Avatar.js +2 -30
- package/es/components/Avatar/Avatar.js.map +1 -1
- package/package.json +4 -4
- package/styled-components/cjs/components/Avatar/Avatar.js +1 -34
- package/styled-components/cjs/components/Avatar/Avatar.template-doc.mdx +2 -52
- package/styled-components/cjs/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +1 -26
- package/styled-components/cjs/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +18 -36
- package/styled-components/cjs/examples/plasma_web/components/Avatar/Avatar.stories.tsx +1 -26
- package/styled-components/cjs/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +1 -27
- package/styled-components/es/components/Avatar/Avatar.js +1 -35
- package/styled-components/es/components/Avatar/Avatar.template-doc.mdx +2 -52
- package/styled-components/es/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +1 -26
- package/styled-components/es/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +18 -36
- package/styled-components/es/examples/plasma_web/components/Avatar/Avatar.stories.tsx +1 -26
- package/styled-components/es/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +1 -27
- package/types/components/Avatar/Avatar.d.ts +1 -3
- package/types/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/components/Avatar/Avatar.types.d.ts +0 -7
- package/types/components/Avatar/Avatar.types.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts +0 -2
- package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Avatar/Avatar.d.ts +0 -2
- package/types/examples/plasma_web/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts +0 -1
- package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts.map +1 -1
@@ -16,11 +16,7 @@ var base = require('./variations/_size/base.js');
|
|
16
16
|
var base$1 = require('./variations/_focused/base.js');
|
17
17
|
var getInitialsForName = require('./utils/getInitialsForName.js');
|
18
18
|
|
19
|
-
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"
|
20
|
-
var StatusDictDefault = {
|
21
|
-
active: 'Активен',
|
22
|
-
inactive: 'Неактивен'
|
23
|
-
};
|
19
|
+
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"];
|
24
20
|
var getAvatarContent = function getAvatarContent(_ref) {
|
25
21
|
var customText = _ref.customText,
|
26
22
|
url = _ref.url,
|
@@ -37,21 +33,6 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
37
33
|
}
|
38
34
|
return /*#__PURE__*/React.createElement(Avatar_styles.Text, null, initials);
|
39
35
|
};
|
40
|
-
var getAriaLabel = function getAriaLabel(props) {
|
41
|
-
var url = props.url,
|
42
|
-
name = props.name,
|
43
|
-
status = props.status,
|
44
|
-
ariaLabelProp = props['aria-label'],
|
45
|
-
role = props.role,
|
46
|
-
statusDict = props.statusDict;
|
47
|
-
|
48
|
-
// INFO: включаем aria-label чтобы озвучить что на изображении
|
49
|
-
if (url && role && role === 'button') {
|
50
|
-
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
51
|
-
return status ? "".concat(ariaLabel, ". ").concat(statusDict[status]) : ariaLabel;
|
52
|
-
}
|
53
|
-
return undefined;
|
54
|
-
};
|
55
36
|
var mergedConfig = /*#__PURE__*/common.mergeConfig(Indicator$1.indicatorConfig);
|
56
37
|
var Indicator = /*#__PURE__*/common.component(mergedConfig);
|
57
38
|
var _exp = function _exp() {
|
@@ -82,22 +63,14 @@ var avatarRoot = function avatarRoot(Root) {
|
|
82
63
|
_props$focused = props.focused,
|
83
64
|
focused = _props$focused === void 0 ? true : _props$focused,
|
84
65
|
isScalable = props.isScalable,
|
85
|
-
_props$statusDict = props.statusDict,
|
86
|
-
statusDict = _props$statusDict === void 0 ? StatusDictDefault : _props$statusDict,
|
87
66
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
88
67
|
var initials = React.useMemo(function () {
|
89
68
|
return getInitialsForName.getInitialsForName(name);
|
90
69
|
}, [name]);
|
91
|
-
var ariaLabel = React.useMemo(function () {
|
92
|
-
return getAriaLabel(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, props), {}, {
|
93
|
-
statusDict: statusDict
|
94
|
-
}));
|
95
|
-
}, [name, url, rest.role, status, statusDict, rest['aria-label']]);
|
96
70
|
return /*#__PURE__*/React.createElement(Root, _rollupPluginBabelHelpers.extends({
|
97
71
|
ref: ref,
|
98
72
|
size: avatarSize,
|
99
73
|
className: index.cx(Avatar_tokens.classes.avatarItem, className),
|
100
|
-
"aria-label": ariaLabel,
|
101
74
|
focused: focused
|
102
75
|
}, rest), /*#__PURE__*/React.createElement(Avatar_styles.Wrapper, {
|
103
76
|
isScalable: isScalable
|
@@ -107,7 +80,6 @@ var avatarRoot = function avatarRoot(Root) {
|
|
107
80
|
initials: initials,
|
108
81
|
name: name
|
109
82
|
})), status && /*#__PURE__*/React.createElement(Avatar_styles.StatusIcon, null, /*#__PURE__*/React.createElement(StyledIndicator, {
|
110
|
-
"aria-label": statusDict[status],
|
111
83
|
status: status
|
112
84
|
})));
|
113
85
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, useMemo, ReactElement } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component, mergeConfig } from '../../engines';\nimport { cx } from '../../utils';\nimport { indicatorConfig, indicatorTokens } from '../Indicator';\n\nimport { classes, tokens } from './Avatar.tokens';\nimport { base, Wrapper, Image, StatusIcon, Text } from './Avatar.styles';\nimport { base as viewCSS } from './variations/_size/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { getInitialsForName } from './utils';\
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, useMemo, ReactElement } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component, mergeConfig } from '../../engines';\nimport { cx } from '../../utils';\nimport { indicatorConfig, indicatorTokens } from '../Indicator';\n\nimport { classes, tokens } from './Avatar.tokens';\nimport { base, Wrapper, Image, StatusIcon, Text } from './Avatar.styles';\nimport { AvatarProps } from './Avatar.types';\nimport { base as viewCSS } from './variations/_size/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { getInitialsForName } from './utils';\n\nconst getAvatarContent = ({\n customText,\n url,\n initials,\n name,\n}: Omit<AvatarProps, 'size'> & { initials?: string }): ReactElement => {\n if (customText) {\n return <Text>{customText}</Text>;\n }\n\n if (url) {\n return <Image src={url} alt={name} />;\n }\n\n return <Text>{initials}</Text>;\n};\n\nconst mergedConfig = mergeConfig(indicatorConfig);\nconst Indicator: React.FunctionComponent<\n React.HTMLAttributes<HTMLDivElement> & { status: AvatarProps['status'] }\n> = component(mergedConfig) as never;\n\nconst StyledIndicator = styled(Indicator)`\n ${indicatorTokens.size}: var(${tokens.statusIconSize});\n ${indicatorTokens.color}: ${({ status }) =>\n status === 'active' ? `var(${tokens.statusOnlineColor})` : `var(${tokens.statusOfflineColor})`}\n`;\n\nexport const avatarRoot = (Root: RootProps<HTMLDivElement, AvatarProps>) => {\n return forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const {\n size: avatarSize,\n name,\n url,\n customText,\n status,\n className,\n focused = true,\n isScalable,\n ...rest\n } = props;\n\n const initials = useMemo(() => getInitialsForName(name), [name]);\n\n return (\n <Root ref={ref} size={avatarSize} className={cx(classes.avatarItem, className)} focused={focused} {...rest}>\n <Wrapper isScalable={isScalable}>{getAvatarContent({ customText, url, initials, name })}</Wrapper>\n\n {status && (\n <StatusIcon>\n <StyledIndicator status={status} />\n </StatusIcon>\n )}\n </Root>\n );\n });\n};\n\nexport const avatarConfig = {\n name: 'Avatar',\n tag: 'div',\n layout: avatarRoot,\n base,\n variations: {\n size: {\n css: viewCSS,\n },\n focused: {\n css: focusedCSS,\n },\n },\n defaults: {\n size: 'm',\n },\n};\n"],"names":["getAvatarContent","_ref","customText","url","initials","name","React","createElement","Text","Image","src","alt","mergedConfig","mergeConfig","indicatorConfig","Indicator","component","_exp","_exp5","_ref2","status","concat","tokens","statusOnlineColor","statusOfflineColor","StyledIndicator","styled","class","propsAsIs","vars","avatarRoot","Root","forwardRef","props","ref","avatarSize","size","className","_props$focused","focused","isScalable","rest","_excluded","useMemo","getInitialsForName","_extends","cx","classes","avatarItem","Wrapper","StatusIcon","avatarConfig","tag","layout","base","variations","css","viewCSS","focusedCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,IAAMA,gBAAgB,GAAGA,SAAnBA,gBAAgBA,CAAAC,IAAA,EAKiD;AAAA,EAAA,IAJnEC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,IAAAA,GAAAA,IAAAA,CAAAA,IAAAA,CAAAA;AAEA,EAAA,IAAIH,UAAU,EAAE;AACZ,IAAA,oBAAOI,KAAA,CAAAC,aAAA,CAACC,kBAAI,EAAA,IAAA,EAAEN,UAAiB,CAAC,CAAA;AACpC,GAAA;AAEA,EAAA,IAAIC,GAAG,EAAE;AACL,IAAA,oBAAOG,KAAA,CAAAC,aAAA,CAACE,mBAAK,EAAA;AAACC,MAAAA,GAAG,EAAEP,GAAI;AAACQ,MAAAA,GAAG,EAAEN,IAAAA;AAAK,KAAG,CAAA,CAAA;AACzC,GAAA;AAEA,EAAA,oBAAOC,KAAA,CAAAC,aAAA,CAACC,kBAAI,EAAA,IAAA,EAAEJ,QAAe,CAAC,CAAA;AAClC,CAAC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AAAA,MAAM,EAAEvB,UAAU;AAClBwB,EAAAA,IAAI,EAAJA,kBAAI;AACJC,EAAAA,UAAU,EAAE;AACRnB,IAAAA,IAAI,EAAE;AACFoB,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDlB,IAAAA,OAAO,EAAE;AACLiB,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNvB,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import './Avatar_13f2qzh.css';
|
2
|
-
import { objectWithoutProperties as _objectWithoutProperties,
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
3
3
|
import React, { forwardRef, useMemo } from 'react';
|
4
4
|
import { styled } from '@linaria/react';
|
5
5
|
import '@linaria/core';
|
@@ -12,11 +12,7 @@ import { base as base$1 } from './variations/_size/base.js';
|
|
12
12
|
import { base as base$2 } from './variations/_focused/base.js';
|
13
13
|
import { getInitialsForName } from './utils/getInitialsForName.js';
|
14
14
|
|
15
|
-
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"
|
16
|
-
var StatusDictDefault = {
|
17
|
-
active: 'Активен',
|
18
|
-
inactive: 'Неактивен'
|
19
|
-
};
|
15
|
+
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"];
|
20
16
|
var getAvatarContent = function getAvatarContent(_ref) {
|
21
17
|
var customText = _ref.customText,
|
22
18
|
url = _ref.url,
|
@@ -33,21 +29,6 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
33
29
|
}
|
34
30
|
return /*#__PURE__*/React.createElement(Text, null, initials);
|
35
31
|
};
|
36
|
-
var getAriaLabel = function getAriaLabel(props) {
|
37
|
-
var url = props.url,
|
38
|
-
name = props.name,
|
39
|
-
status = props.status,
|
40
|
-
ariaLabelProp = props['aria-label'],
|
41
|
-
role = props.role,
|
42
|
-
statusDict = props.statusDict;
|
43
|
-
|
44
|
-
// INFO: включаем aria-label чтобы озвучить что на изображении
|
45
|
-
if (url && role && role === 'button') {
|
46
|
-
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
47
|
-
return status ? "".concat(ariaLabel, ". ").concat(statusDict[status]) : ariaLabel;
|
48
|
-
}
|
49
|
-
return undefined;
|
50
|
-
};
|
51
32
|
var mergedConfig = /*#__PURE__*/mergeConfig(indicatorConfig);
|
52
33
|
var Indicator = /*#__PURE__*/component(mergedConfig);
|
53
34
|
var _exp = function _exp() {
|
@@ -78,22 +59,14 @@ var avatarRoot = function avatarRoot(Root) {
|
|
78
59
|
_props$focused = props.focused,
|
79
60
|
focused = _props$focused === void 0 ? true : _props$focused,
|
80
61
|
isScalable = props.isScalable,
|
81
|
-
_props$statusDict = props.statusDict,
|
82
|
-
statusDict = _props$statusDict === void 0 ? StatusDictDefault : _props$statusDict,
|
83
62
|
rest = _objectWithoutProperties(props, _excluded);
|
84
63
|
var initials = useMemo(function () {
|
85
64
|
return getInitialsForName(name);
|
86
65
|
}, [name]);
|
87
|
-
var ariaLabel = useMemo(function () {
|
88
|
-
return getAriaLabel(_objectSpread2(_objectSpread2({}, props), {}, {
|
89
|
-
statusDict: statusDict
|
90
|
-
}));
|
91
|
-
}, [name, url, rest.role, status, statusDict, rest['aria-label']]);
|
92
66
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
93
67
|
ref: ref,
|
94
68
|
size: avatarSize,
|
95
69
|
className: cx(classes.avatarItem, className),
|
96
|
-
"aria-label": ariaLabel,
|
97
70
|
focused: focused
|
98
71
|
}, rest), /*#__PURE__*/React.createElement(Wrapper, {
|
99
72
|
isScalable: isScalable
|
@@ -103,7 +76,6 @@ var avatarRoot = function avatarRoot(Root) {
|
|
103
76
|
initials: initials,
|
104
77
|
name: name
|
105
78
|
})), status && /*#__PURE__*/React.createElement(StatusIcon, null, /*#__PURE__*/React.createElement(StyledIndicator, {
|
106
|
-
"aria-label": statusDict[status],
|
107
79
|
status: status
|
108
80
|
})));
|
109
81
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, useMemo, ReactElement } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component, mergeConfig } from '../../engines';\nimport { cx } from '../../utils';\nimport { indicatorConfig, indicatorTokens } from '../Indicator';\n\nimport { classes, tokens } from './Avatar.tokens';\nimport { base, Wrapper, Image, StatusIcon, Text } from './Avatar.styles';\nimport { base as viewCSS } from './variations/_size/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { getInitialsForName } from './utils';\
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, useMemo, ReactElement } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component, mergeConfig } from '../../engines';\nimport { cx } from '../../utils';\nimport { indicatorConfig, indicatorTokens } from '../Indicator';\n\nimport { classes, tokens } from './Avatar.tokens';\nimport { base, Wrapper, Image, StatusIcon, Text } from './Avatar.styles';\nimport { AvatarProps } from './Avatar.types';\nimport { base as viewCSS } from './variations/_size/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { getInitialsForName } from './utils';\n\nconst getAvatarContent = ({\n customText,\n url,\n initials,\n name,\n}: Omit<AvatarProps, 'size'> & { initials?: string }): ReactElement => {\n if (customText) {\n return <Text>{customText}</Text>;\n }\n\n if (url) {\n return <Image src={url} alt={name} />;\n }\n\n return <Text>{initials}</Text>;\n};\n\nconst mergedConfig = mergeConfig(indicatorConfig);\nconst Indicator: React.FunctionComponent<\n React.HTMLAttributes<HTMLDivElement> & { status: AvatarProps['status'] }\n> = component(mergedConfig) as never;\n\nconst StyledIndicator = styled(Indicator)`\n ${indicatorTokens.size}: var(${tokens.statusIconSize});\n ${indicatorTokens.color}: ${({ status }) =>\n status === 'active' ? `var(${tokens.statusOnlineColor})` : `var(${tokens.statusOfflineColor})`}\n`;\n\nexport const avatarRoot = (Root: RootProps<HTMLDivElement, AvatarProps>) => {\n return forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const {\n size: avatarSize,\n name,\n url,\n customText,\n status,\n className,\n focused = true,\n isScalable,\n ...rest\n } = props;\n\n const initials = useMemo(() => getInitialsForName(name), [name]);\n\n return (\n <Root ref={ref} size={avatarSize} className={cx(classes.avatarItem, className)} focused={focused} {...rest}>\n <Wrapper isScalable={isScalable}>{getAvatarContent({ customText, url, initials, name })}</Wrapper>\n\n {status && (\n <StatusIcon>\n <StyledIndicator status={status} />\n </StatusIcon>\n )}\n </Root>\n );\n });\n};\n\nexport const avatarConfig = {\n name: 'Avatar',\n tag: 'div',\n layout: avatarRoot,\n base,\n variations: {\n size: {\n css: viewCSS,\n },\n focused: {\n css: focusedCSS,\n },\n },\n defaults: {\n size: 'm',\n },\n};\n"],"names":["getAvatarContent","_ref","customText","url","initials","name","React","createElement","Text","Image","src","alt","mergedConfig","mergeConfig","indicatorConfig","Indicator","component","_exp","_exp5","_ref2","status","concat","tokens","statusOnlineColor","statusOfflineColor","StyledIndicator","styled","class","propsAsIs","vars","avatarRoot","Root","forwardRef","props","ref","avatarSize","size","className","_props$focused","focused","isScalable","rest","_excluded","useMemo","getInitialsForName","_extends","cx","classes","avatarItem","Wrapper","StatusIcon","avatarConfig","tag","layout","base","variations","css","viewCSS","focusedCSS","defaults"],"mappings":";;;;;;;;;;;;;;AAcA,IAAMA,gBAAgB,GAAGA,SAAnBA,gBAAgBA,CAAAC,IAAA,EAKiD;AAAA,EAAA,IAJnEC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,IAAAA,GAAAA,IAAAA,CAAAA,IAAAA,CAAAA;AAEA,EAAA,IAA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A,QAAQ,EAARA,QAAQ;AAAEC,MAAAA,IAAAA,EAAAA,IAAAA;AAAK,KAAC,CAAW,CAAA,EAEhGe,MAAM,iBACHd,KAAA,CAAAC,aAAA,CAAC2C,UAAU,EACP5C,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACkB,eAAe,EAAA;AAACL,MAAAA,MAAM,EAAEA,MAAAA;KAAO,CACxB,CAEd,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AACN,EAAC;AAEM,IAAM+B,YAAY,GAAG;AACxB9C,EAAAA,IAAI,EAAE,QAAQ;AACd+C,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEvB,UAAU;AAClBwB,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRnB,IAAAA,IAAI,EAAE;AACFoB,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDlB,IAAAA,OAAO,EAAE;AACLiB,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNvB,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.76.3-canary.
|
3
|
+
"version": "0.76.3-canary.22.8733068927.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -67,7 +67,7 @@
|
|
67
67
|
"@rollup/plugin-babel": "^6.0.3",
|
68
68
|
"@rollup/plugin-commonjs": "^25.0.4",
|
69
69
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
70
|
-
"@salutejs/plasma-sb-utils": "0.156.
|
70
|
+
"@salutejs/plasma-sb-utils": "0.156.1-canary.22.8733068927.0",
|
71
71
|
"@storybook/addon-docs": "^7.6.17",
|
72
72
|
"@storybook/addon-essentials": "^7.6.17",
|
73
73
|
"@storybook/addons": "^7.6.17",
|
@@ -97,10 +97,10 @@
|
|
97
97
|
"@linaria/core": "5.0.2",
|
98
98
|
"@linaria/react": "5.0.3",
|
99
99
|
"@popperjs/core": "2.11.8",
|
100
|
-
"@salutejs/plasma-core": "1.158.
|
100
|
+
"@salutejs/plasma-core": "1.158.1-canary.22.8733068927.0",
|
101
101
|
"focus-visible": "5.2.0",
|
102
102
|
"react-popper": "2.3.0",
|
103
103
|
"storeon": "3.1.5"
|
104
104
|
},
|
105
|
-
"gitHead": "
|
105
|
+
"gitHead": "7fd625a71bc25a9e8f5aa10a2437998685e91519"
|
106
106
|
}
|
@@ -15,22 +15,13 @@ var _Avatar2 = /*#__PURE__*/require("./Avatar.styles");
|
|
15
15
|
var _base = /*#__PURE__*/require("./variations/_size/base");
|
16
16
|
var _base2 = /*#__PURE__*/require("./variations/_focused/base");
|
17
17
|
var _utils2 = /*#__PURE__*/require("./utils");
|
18
|
-
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"
|
18
|
+
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"];
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
21
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
22
22
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
24
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
25
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
26
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
27
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
28
23
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
29
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
30
|
-
var StatusDictDefault = {
|
31
|
-
active: 'Активен',
|
32
|
-
inactive: 'Неактивен'
|
33
|
-
};
|
34
25
|
var getAvatarContent = function getAvatarContent(_ref) {
|
35
26
|
var customText = _ref.customText,
|
36
27
|
url = _ref.url,
|
@@ -47,21 +38,6 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
47
38
|
}
|
48
39
|
return /*#__PURE__*/_react["default"].createElement(_Avatar2.Text, null, initials);
|
49
40
|
};
|
50
|
-
var getAriaLabel = function getAriaLabel(props) {
|
51
|
-
var url = props.url,
|
52
|
-
name = props.name,
|
53
|
-
status = props.status,
|
54
|
-
ariaLabelProp = props['aria-label'],
|
55
|
-
role = props.role,
|
56
|
-
statusDict = props.statusDict;
|
57
|
-
|
58
|
-
// INFO: включаем aria-label чтобы озвучить что на изображении
|
59
|
-
if (url && role && role === 'button') {
|
60
|
-
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
61
|
-
return status ? "".concat(ariaLabel, ". ").concat(statusDict[status]) : ariaLabel;
|
62
|
-
}
|
63
|
-
return undefined;
|
64
|
-
};
|
65
41
|
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Indicator.indicatorConfig);
|
66
42
|
var Indicator = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
67
43
|
var StyledIndicator = /*#__PURE__*/(0, _styledComponents["default"])(Indicator).withConfig({
|
@@ -81,22 +57,14 @@ var avatarRoot = exports.avatarRoot = function avatarRoot(Root) {
|
|
81
57
|
_props$focused = props.focused,
|
82
58
|
focused = _props$focused === void 0 ? true : _props$focused,
|
83
59
|
isScalable = props.isScalable,
|
84
|
-
_props$statusDict = props.statusDict,
|
85
|
-
statusDict = _props$statusDict === void 0 ? StatusDictDefault : _props$statusDict,
|
86
60
|
rest = _objectWithoutProperties(props, _excluded);
|
87
61
|
var initials = (0, _react.useMemo)(function () {
|
88
62
|
return (0, _utils2.getInitialsForName)(name);
|
89
63
|
}, [name]);
|
90
|
-
var ariaLabel = (0, _react.useMemo)(function () {
|
91
|
-
return getAriaLabel(_objectSpread(_objectSpread({}, props), {}, {
|
92
|
-
statusDict: statusDict
|
93
|
-
}));
|
94
|
-
}, [name, url, rest.role, status, statusDict, rest['aria-label']]);
|
95
64
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
96
65
|
ref: ref,
|
97
66
|
size: avatarSize,
|
98
67
|
className: (0, _utils.cx)(_Avatar.classes.avatarItem, className),
|
99
|
-
"aria-label": ariaLabel,
|
100
68
|
focused: focused
|
101
69
|
}, rest), /*#__PURE__*/_react["default"].createElement(_Avatar2.Wrapper, {
|
102
70
|
isScalable: isScalable
|
@@ -106,7 +74,6 @@ var avatarRoot = exports.avatarRoot = function avatarRoot(Root) {
|
|
106
74
|
initials: initials,
|
107
75
|
name: name
|
108
76
|
})), status && /*#__PURE__*/_react["default"].createElement(_Avatar2.StatusIcon, null, /*#__PURE__*/_react["default"].createElement(StyledIndicator, {
|
109
|
-
"aria-label": statusDict[status],
|
110
77
|
status: status
|
111
78
|
})));
|
112
79
|
});
|
@@ -81,32 +81,7 @@ export function App() {
|
|
81
81
|
```
|
82
82
|
|
83
83
|
### Доступность
|
84
|
-
|
85
|
-
#### Avatar c использованием изображения
|
86
|
-
|
87
|
-
В данном случае руководствуемся принципом универсального дизайна, т.е. незрячий должен получить ту же информацию, что и зрячий.
|
88
|
-
|
89
|
-
Поэтому добавляем/используем свойства: `role`, `tabIndex` и `aria-label`.
|
90
|
-
|
91
|
-
Примечание:
|
92
|
-
- если указано свойство `name` то `aria-label` можно опустить;
|
93
|
-
|
94
|
-
```tsx live
|
95
|
-
import React from 'react';
|
96
|
-
import { Avatar } from '@salutejs/{{ package }}';
|
97
|
-
|
98
|
-
export function App() {
|
99
|
-
return (
|
100
|
-
<>
|
101
|
-
<Avatar role="button" tabIndex={0} name="Иван Фадеев" url="https://avatars.githubusercontent.com/u/1813468?v=4" />
|
102
|
-
</>
|
103
|
-
);
|
104
|
-
}
|
105
|
-
```
|
106
|
-
|
107
|
-
#### Avatar c текстом
|
108
|
-
|
109
|
-
В этом случае достаточно указать свойство `name`.
|
84
|
+
Добавляем `"role"` и `"tabIndex"`.
|
110
85
|
|
111
86
|
```tsx live
|
112
87
|
import React from 'react';
|
@@ -115,33 +90,8 @@ import { Avatar } from '@salutejs/{{ package }}';
|
|
115
90
|
export function App() {
|
116
91
|
return (
|
117
92
|
<>
|
118
|
-
<Avatar role="button" tabIndex=
|
93
|
+
<Avatar role="button" tabIndex="0" name="Иван Фадеев" />
|
119
94
|
</>
|
120
95
|
);
|
121
96
|
}
|
122
97
|
```
|
123
|
-
|
124
|
-
#### Avatar и статус
|
125
|
-
|
126
|
-
Если указано свойство `status` его значение будет так же озвучено в комбинации со свойством `name` или `aria-label`.
|
127
|
-
|
128
|
-
```tsx live
|
129
|
-
import React from 'react';
|
130
|
-
import { Avatar } from '@salutejs/{{ package }}';
|
131
|
-
|
132
|
-
export function App() {
|
133
|
-
return (
|
134
|
-
<>
|
135
|
-
<Avatar role="button" tabIndex={0} name="Иван Фадеев" status="inactive" />
|
136
|
-
</>
|
137
|
-
);
|
138
|
-
}
|
139
|
-
```
|
140
|
-
|
141
|
-
Озвучит как `ИФ. Неактивен`. (В данном примере озвучиваются инициалы, производное от ФИО)
|
142
|
-
|
143
|
-
#### Свойство statusDict
|
144
|
-
|
145
|
-
Опциональное свойство для корректной озвучки значений свойства `status`.
|
146
|
-
|
147
|
-
По-умолчанию стоит значение для русскоговорящих `{ active: 'Активен', inactive: 'Неактивен' }`.
|
@@ -34,38 +34,13 @@ export const Default: Story = {
|
|
34
34
|
};
|
35
35
|
|
36
36
|
export const Accessibility: Story = {
|
37
|
-
args: {
|
38
|
-
role: 'button',
|
39
|
-
name: 'Геннадий Силуянович',
|
40
|
-
tabIndex: 0,
|
41
|
-
view: 'default',
|
42
|
-
size: 'xxl',
|
43
|
-
status: 'active',
|
44
|
-
focused: true,
|
45
|
-
},
|
46
|
-
};
|
47
|
-
|
48
|
-
export const AccessibilityWithURL: Story = {
|
49
37
|
args: {
|
50
38
|
role: 'button',
|
51
39
|
tabIndex: 0,
|
52
40
|
view: 'default',
|
53
41
|
size: 'xxl',
|
42
|
+
name: 'Иван Фадеев',
|
54
43
|
status: 'active',
|
55
44
|
focused: true,
|
56
|
-
name: 'Микула Селянинович',
|
57
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
58
|
-
},
|
59
|
-
};
|
60
|
-
|
61
|
-
export const AccessibilityWithCustomText: Story = {
|
62
|
-
args: {
|
63
|
-
role: 'button',
|
64
|
-
tabIndex: 0,
|
65
|
-
view: 'default',
|
66
|
-
size: 'xxl',
|
67
|
-
status: 'inactive',
|
68
|
-
focused: true,
|
69
|
-
customText: 'ФИО',
|
70
45
|
},
|
71
46
|
};
|
package/styled-components/cjs/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx
CHANGED
@@ -8,7 +8,6 @@ import { Avatar } from '../Avatar/Avatar';
|
|
8
8
|
import { AvatarGroup } from './AvatarGroup';
|
9
9
|
|
10
10
|
type Story = StoryObj<ComponentProps<typeof AvatarGroup>>;
|
11
|
-
type Avatar = ComponentProps<typeof Avatar>;
|
12
11
|
|
13
12
|
const meta: Meta<typeof AvatarGroup> = {
|
14
13
|
title: 'plasma_b2c/AvatarGroup',
|
@@ -34,57 +33,40 @@ export const Default: Story = {
|
|
34
33
|
|
35
34
|
export const DynamicSize: Story = {
|
36
35
|
args: { totalCount: 10, visibleCount: 3 },
|
37
|
-
render: (
|
38
|
-
const itemLength = totalCount;
|
36
|
+
render: (args: ComponentProps<typeof AvatarGroup>) => {
|
37
|
+
const itemLength = args.totalCount;
|
39
38
|
|
40
39
|
return (
|
41
40
|
<AvatarGroup {...args}>
|
42
|
-
{Array(visibleCount)
|
41
|
+
{Array(args.visibleCount)
|
43
42
|
.fill(true)
|
44
43
|
.map((_, index) => (
|
45
|
-
<Avatar size="xxl"
|
44
|
+
<Avatar size="xxl" customText={index + 1} />
|
46
45
|
))}
|
47
46
|
|
48
|
-
{itemLength > visibleCount &&
|
47
|
+
{itemLength > args.visibleCount && (
|
48
|
+
<Avatar size="xxl" customText={`+${itemLength - args.visibleCount}`} />
|
49
|
+
)}
|
49
50
|
</AvatarGroup>
|
50
51
|
);
|
51
52
|
},
|
52
53
|
};
|
53
54
|
|
54
|
-
const list: Array<Avatar> = [
|
55
|
-
{
|
56
|
-
name: 'Илья Муромец',
|
57
|
-
status: 'active',
|
58
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
59
|
-
},
|
60
|
-
{
|
61
|
-
name: 'Алеша Попович',
|
62
|
-
status: 'active',
|
63
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
64
|
-
},
|
65
|
-
{
|
66
|
-
name: 'Добрыня Никитич',
|
67
|
-
status: 'active',
|
68
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
69
|
-
},
|
70
|
-
{
|
71
|
-
name: 'Микула Селянинович',
|
72
|
-
status: 'inactive',
|
73
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
74
|
-
},
|
75
|
-
{
|
76
|
-
name: 'Ставр Годинович',
|
77
|
-
status: 'inactive',
|
78
|
-
},
|
79
|
-
];
|
80
|
-
|
81
55
|
export const Accessibility: Story = {
|
82
56
|
render: (args: ComponentProps<typeof AvatarGroup>) => {
|
83
57
|
return (
|
84
58
|
<AvatarGroup {...args}>
|
85
|
-
{
|
86
|
-
|
87
|
-
|
59
|
+
{Array(5)
|
60
|
+
.fill(true)
|
61
|
+
.map(() => (
|
62
|
+
<Avatar
|
63
|
+
role="button"
|
64
|
+
tabIndex={0}
|
65
|
+
focused
|
66
|
+
size="xxl"
|
67
|
+
url="https://avatars.githubusercontent.com/u/1813468?v=4"
|
68
|
+
/>
|
69
|
+
))}
|
88
70
|
</AvatarGroup>
|
89
71
|
);
|
90
72
|
},
|
@@ -34,38 +34,13 @@ export const Default: Story = {
|
|
34
34
|
};
|
35
35
|
|
36
36
|
export const Accessibility: Story = {
|
37
|
-
args: {
|
38
|
-
role: 'button',
|
39
|
-
name: 'Геннадий Силуянович',
|
40
|
-
tabIndex: 0,
|
41
|
-
view: 'default',
|
42
|
-
size: 'xxl',
|
43
|
-
status: 'active',
|
44
|
-
focused: true,
|
45
|
-
},
|
46
|
-
};
|
47
|
-
|
48
|
-
export const AccessibilityWithURL: Story = {
|
49
37
|
args: {
|
50
38
|
role: 'button',
|
51
39
|
tabIndex: 0,
|
52
40
|
view: 'default',
|
53
41
|
size: 'xxl',
|
42
|
+
name: 'Иван Фадеев',
|
54
43
|
status: 'active',
|
55
44
|
focused: true,
|
56
|
-
name: 'Микула Селянинович',
|
57
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
58
|
-
},
|
59
|
-
};
|
60
|
-
|
61
|
-
export const AccessibilityWithCustomText: Story = {
|
62
|
-
args: {
|
63
|
-
role: 'button',
|
64
|
-
tabIndex: 0,
|
65
|
-
view: 'default',
|
66
|
-
size: 'xxl',
|
67
|
-
status: 'inactive',
|
68
|
-
focused: true,
|
69
|
-
customText: 'ФИО',
|
70
45
|
},
|
71
46
|
};
|
@@ -30,36 +30,10 @@ export const Default: Story = {
|
|
30
30
|
export const Accessibility: Story = {
|
31
31
|
args: {
|
32
32
|
role: 'button',
|
33
|
-
name: 'Геннадий Силуянович',
|
34
33
|
tabIndex: 0,
|
35
34
|
view: 'default',
|
36
35
|
size: 'xxl',
|
37
|
-
|
38
|
-
focused: true,
|
39
|
-
},
|
40
|
-
};
|
41
|
-
|
42
|
-
export const AccessibilityWithURL: Story = {
|
43
|
-
args: {
|
44
|
-
role: 'button',
|
45
|
-
tabIndex: 0,
|
46
|
-
view: 'default',
|
47
|
-
size: 'xxl',
|
48
|
-
status: 'active',
|
49
|
-
focused: true,
|
50
|
-
name: 'Микула Селянинович',
|
51
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
52
|
-
},
|
53
|
-
};
|
54
|
-
|
55
|
-
export const AccessibilityWithCustomText: Story = {
|
56
|
-
args: {
|
57
|
-
role: 'button',
|
58
|
-
tabIndex: 0,
|
59
|
-
view: 'default',
|
60
|
-
size: 'xxl',
|
61
|
-
status: 'inactive',
|
36
|
+
name: 'Иван Фадеев',
|
62
37
|
focused: true,
|
63
|
-
customText: 'ФИО',
|
64
38
|
},
|
65
39
|
};
|
@@ -1,11 +1,5 @@
|
|
1
|
-
|
2
|
-
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable", "statusDict"];
|
1
|
+
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"];
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
6
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
7
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
8
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
11
5
|
import React, { forwardRef, useMemo } from 'react';
|
@@ -18,10 +12,6 @@ import { base, Wrapper, Image, StatusIcon, Text } from './Avatar.styles';
|
|
18
12
|
import { base as viewCSS } from './variations/_size/base';
|
19
13
|
import { base as focusedCSS } from './variations/_focused/base';
|
20
14
|
import { getInitialsForName } from './utils';
|
21
|
-
var StatusDictDefault = {
|
22
|
-
active: 'Активен',
|
23
|
-
inactive: 'Неактивен'
|
24
|
-
};
|
25
15
|
var getAvatarContent = function getAvatarContent(_ref) {
|
26
16
|
var customText = _ref.customText,
|
27
17
|
url = _ref.url,
|
@@ -38,21 +28,6 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
38
28
|
}
|
39
29
|
return /*#__PURE__*/React.createElement(Text, null, initials);
|
40
30
|
};
|
41
|
-
var getAriaLabel = function getAriaLabel(props) {
|
42
|
-
var url = props.url,
|
43
|
-
name = props.name,
|
44
|
-
status = props.status,
|
45
|
-
ariaLabelProp = props['aria-label'],
|
46
|
-
role = props.role,
|
47
|
-
statusDict = props.statusDict;
|
48
|
-
|
49
|
-
// INFO: включаем aria-label чтобы озвучить что на изображении
|
50
|
-
if (url && role && role === 'button') {
|
51
|
-
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
52
|
-
return status ? "".concat(ariaLabel, ". ").concat(statusDict[status]) : ariaLabel;
|
53
|
-
}
|
54
|
-
return undefined;
|
55
|
-
};
|
56
31
|
var mergedConfig = /*#__PURE__*/mergeConfig(indicatorConfig);
|
57
32
|
var Indicator = /*#__PURE__*/component(mergedConfig);
|
58
33
|
var StyledIndicator = /*#__PURE__*/styled(Indicator).withConfig({
|
@@ -72,22 +47,14 @@ export var avatarRoot = function avatarRoot(Root) {
|
|
72
47
|
_props$focused = props.focused,
|
73
48
|
focused = _props$focused === void 0 ? true : _props$focused,
|
74
49
|
isScalable = props.isScalable,
|
75
|
-
_props$statusDict = props.statusDict,
|
76
|
-
statusDict = _props$statusDict === void 0 ? StatusDictDefault : _props$statusDict,
|
77
50
|
rest = _objectWithoutProperties(props, _excluded);
|
78
51
|
var initials = useMemo(function () {
|
79
52
|
return getInitialsForName(name);
|
80
53
|
}, [name]);
|
81
|
-
var ariaLabel = useMemo(function () {
|
82
|
-
return getAriaLabel(_objectSpread(_objectSpread({}, props), {}, {
|
83
|
-
statusDict: statusDict
|
84
|
-
}));
|
85
|
-
}, [name, url, rest.role, status, statusDict, rest['aria-label']]);
|
86
54
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
87
55
|
ref: ref,
|
88
56
|
size: avatarSize,
|
89
57
|
className: cx(classes.avatarItem, className),
|
90
|
-
"aria-label": ariaLabel,
|
91
58
|
focused: focused
|
92
59
|
}, rest), /*#__PURE__*/React.createElement(Wrapper, {
|
93
60
|
isScalable: isScalable
|
@@ -97,7 +64,6 @@ export var avatarRoot = function avatarRoot(Root) {
|
|
97
64
|
initials: initials,
|
98
65
|
name: name
|
99
66
|
})), status && /*#__PURE__*/React.createElement(StatusIcon, null, /*#__PURE__*/React.createElement(StyledIndicator, {
|
100
|
-
"aria-label": statusDict[status],
|
101
67
|
status: status
|
102
68
|
})));
|
103
69
|
});
|
@@ -81,32 +81,7 @@ export function App() {
|
|
81
81
|
```
|
82
82
|
|
83
83
|
### Доступность
|
84
|
-
|
85
|
-
#### Avatar c использованием изображения
|
86
|
-
|
87
|
-
В данном случае руководствуемся принципом универсального дизайна, т.е. незрячий должен получить ту же информацию, что и зрячий.
|
88
|
-
|
89
|
-
Поэтому добавляем/используем свойства: `role`, `tabIndex` и `aria-label`.
|
90
|
-
|
91
|
-
Примечание:
|
92
|
-
- если указано свойство `name` то `aria-label` можно опустить;
|
93
|
-
|
94
|
-
```tsx live
|
95
|
-
import React from 'react';
|
96
|
-
import { Avatar } from '@salutejs/{{ package }}';
|
97
|
-
|
98
|
-
export function App() {
|
99
|
-
return (
|
100
|
-
<>
|
101
|
-
<Avatar role="button" tabIndex={0} name="Иван Фадеев" url="https://avatars.githubusercontent.com/u/1813468?v=4" />
|
102
|
-
</>
|
103
|
-
);
|
104
|
-
}
|
105
|
-
```
|
106
|
-
|
107
|
-
#### Avatar c текстом
|
108
|
-
|
109
|
-
В этом случае достаточно указать свойство `name`.
|
84
|
+
Добавляем `"role"` и `"tabIndex"`.
|
110
85
|
|
111
86
|
```tsx live
|
112
87
|
import React from 'react';
|
@@ -115,33 +90,8 @@ import { Avatar } from '@salutejs/{{ package }}';
|
|
115
90
|
export function App() {
|
116
91
|
return (
|
117
92
|
<>
|
118
|
-
<Avatar role="button" tabIndex=
|
93
|
+
<Avatar role="button" tabIndex="0" name="Иван Фадеев" />
|
119
94
|
</>
|
120
95
|
);
|
121
96
|
}
|
122
97
|
```
|
123
|
-
|
124
|
-
#### Avatar и статус
|
125
|
-
|
126
|
-
Если указано свойство `status` его значение будет так же озвучено в комбинации со свойством `name` или `aria-label`.
|
127
|
-
|
128
|
-
```tsx live
|
129
|
-
import React from 'react';
|
130
|
-
import { Avatar } from '@salutejs/{{ package }}';
|
131
|
-
|
132
|
-
export function App() {
|
133
|
-
return (
|
134
|
-
<>
|
135
|
-
<Avatar role="button" tabIndex={0} name="Иван Фадеев" status="inactive" />
|
136
|
-
</>
|
137
|
-
);
|
138
|
-
}
|
139
|
-
```
|
140
|
-
|
141
|
-
Озвучит как `ИФ. Неактивен`. (В данном примере озвучиваются инициалы, производное от ФИО)
|
142
|
-
|
143
|
-
#### Свойство statusDict
|
144
|
-
|
145
|
-
Опциональное свойство для корректной озвучки значений свойства `status`.
|
146
|
-
|
147
|
-
По-умолчанию стоит значение для русскоговорящих `{ active: 'Активен', inactive: 'Неактивен' }`.
|
@@ -34,38 +34,13 @@ export const Default: Story = {
|
|
34
34
|
};
|
35
35
|
|
36
36
|
export const Accessibility: Story = {
|
37
|
-
args: {
|
38
|
-
role: 'button',
|
39
|
-
name: 'Геннадий Силуянович',
|
40
|
-
tabIndex: 0,
|
41
|
-
view: 'default',
|
42
|
-
size: 'xxl',
|
43
|
-
status: 'active',
|
44
|
-
focused: true,
|
45
|
-
},
|
46
|
-
};
|
47
|
-
|
48
|
-
export const AccessibilityWithURL: Story = {
|
49
37
|
args: {
|
50
38
|
role: 'button',
|
51
39
|
tabIndex: 0,
|
52
40
|
view: 'default',
|
53
41
|
size: 'xxl',
|
42
|
+
name: 'Иван Фадеев',
|
54
43
|
status: 'active',
|
55
44
|
focused: true,
|
56
|
-
name: 'Микула Селянинович',
|
57
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
58
|
-
},
|
59
|
-
};
|
60
|
-
|
61
|
-
export const AccessibilityWithCustomText: Story = {
|
62
|
-
args: {
|
63
|
-
role: 'button',
|
64
|
-
tabIndex: 0,
|
65
|
-
view: 'default',
|
66
|
-
size: 'xxl',
|
67
|
-
status: 'inactive',
|
68
|
-
focused: true,
|
69
|
-
customText: 'ФИО',
|
70
45
|
},
|
71
46
|
};
|
package/styled-components/es/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx
CHANGED
@@ -8,7 +8,6 @@ import { Avatar } from '../Avatar/Avatar';
|
|
8
8
|
import { AvatarGroup } from './AvatarGroup';
|
9
9
|
|
10
10
|
type Story = StoryObj<ComponentProps<typeof AvatarGroup>>;
|
11
|
-
type Avatar = ComponentProps<typeof Avatar>;
|
12
11
|
|
13
12
|
const meta: Meta<typeof AvatarGroup> = {
|
14
13
|
title: 'plasma_b2c/AvatarGroup',
|
@@ -34,57 +33,40 @@ export const Default: Story = {
|
|
34
33
|
|
35
34
|
export const DynamicSize: Story = {
|
36
35
|
args: { totalCount: 10, visibleCount: 3 },
|
37
|
-
render: (
|
38
|
-
const itemLength = totalCount;
|
36
|
+
render: (args: ComponentProps<typeof AvatarGroup>) => {
|
37
|
+
const itemLength = args.totalCount;
|
39
38
|
|
40
39
|
return (
|
41
40
|
<AvatarGroup {...args}>
|
42
|
-
{Array(visibleCount)
|
41
|
+
{Array(args.visibleCount)
|
43
42
|
.fill(true)
|
44
43
|
.map((_, index) => (
|
45
|
-
<Avatar size="xxl"
|
44
|
+
<Avatar size="xxl" customText={index + 1} />
|
46
45
|
))}
|
47
46
|
|
48
|
-
{itemLength > visibleCount &&
|
47
|
+
{itemLength > args.visibleCount && (
|
48
|
+
<Avatar size="xxl" customText={`+${itemLength - args.visibleCount}`} />
|
49
|
+
)}
|
49
50
|
</AvatarGroup>
|
50
51
|
);
|
51
52
|
},
|
52
53
|
};
|
53
54
|
|
54
|
-
const list: Array<Avatar> = [
|
55
|
-
{
|
56
|
-
name: 'Илья Муромец',
|
57
|
-
status: 'active',
|
58
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
59
|
-
},
|
60
|
-
{
|
61
|
-
name: 'Алеша Попович',
|
62
|
-
status: 'active',
|
63
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
64
|
-
},
|
65
|
-
{
|
66
|
-
name: 'Добрыня Никитич',
|
67
|
-
status: 'active',
|
68
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
69
|
-
},
|
70
|
-
{
|
71
|
-
name: 'Микула Селянинович',
|
72
|
-
status: 'inactive',
|
73
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
74
|
-
},
|
75
|
-
{
|
76
|
-
name: 'Ставр Годинович',
|
77
|
-
status: 'inactive',
|
78
|
-
},
|
79
|
-
];
|
80
|
-
|
81
55
|
export const Accessibility: Story = {
|
82
56
|
render: (args: ComponentProps<typeof AvatarGroup>) => {
|
83
57
|
return (
|
84
58
|
<AvatarGroup {...args}>
|
85
|
-
{
|
86
|
-
|
87
|
-
|
59
|
+
{Array(5)
|
60
|
+
.fill(true)
|
61
|
+
.map(() => (
|
62
|
+
<Avatar
|
63
|
+
role="button"
|
64
|
+
tabIndex={0}
|
65
|
+
focused
|
66
|
+
size="xxl"
|
67
|
+
url="https://avatars.githubusercontent.com/u/1813468?v=4"
|
68
|
+
/>
|
69
|
+
))}
|
88
70
|
</AvatarGroup>
|
89
71
|
);
|
90
72
|
},
|
@@ -34,38 +34,13 @@ export const Default: Story = {
|
|
34
34
|
};
|
35
35
|
|
36
36
|
export const Accessibility: Story = {
|
37
|
-
args: {
|
38
|
-
role: 'button',
|
39
|
-
name: 'Геннадий Силуянович',
|
40
|
-
tabIndex: 0,
|
41
|
-
view: 'default',
|
42
|
-
size: 'xxl',
|
43
|
-
status: 'active',
|
44
|
-
focused: true,
|
45
|
-
},
|
46
|
-
};
|
47
|
-
|
48
|
-
export const AccessibilityWithURL: Story = {
|
49
37
|
args: {
|
50
38
|
role: 'button',
|
51
39
|
tabIndex: 0,
|
52
40
|
view: 'default',
|
53
41
|
size: 'xxl',
|
42
|
+
name: 'Иван Фадеев',
|
54
43
|
status: 'active',
|
55
44
|
focused: true,
|
56
|
-
name: 'Микула Селянинович',
|
57
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
58
|
-
},
|
59
|
-
};
|
60
|
-
|
61
|
-
export const AccessibilityWithCustomText: Story = {
|
62
|
-
args: {
|
63
|
-
role: 'button',
|
64
|
-
tabIndex: 0,
|
65
|
-
view: 'default',
|
66
|
-
size: 'xxl',
|
67
|
-
status: 'inactive',
|
68
|
-
focused: true,
|
69
|
-
customText: 'ФИО',
|
70
45
|
},
|
71
46
|
};
|
@@ -30,36 +30,10 @@ export const Default: Story = {
|
|
30
30
|
export const Accessibility: Story = {
|
31
31
|
args: {
|
32
32
|
role: 'button',
|
33
|
-
name: 'Геннадий Силуянович',
|
34
33
|
tabIndex: 0,
|
35
34
|
view: 'default',
|
36
35
|
size: 'xxl',
|
37
|
-
|
38
|
-
focused: true,
|
39
|
-
},
|
40
|
-
};
|
41
|
-
|
42
|
-
export const AccessibilityWithURL: Story = {
|
43
|
-
args: {
|
44
|
-
role: 'button',
|
45
|
-
tabIndex: 0,
|
46
|
-
view: 'default',
|
47
|
-
size: 'xxl',
|
48
|
-
status: 'active',
|
49
|
-
focused: true,
|
50
|
-
name: 'Микула Селянинович',
|
51
|
-
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
52
|
-
},
|
53
|
-
};
|
54
|
-
|
55
|
-
export const AccessibilityWithCustomText: Story = {
|
56
|
-
args: {
|
57
|
-
role: 'button',
|
58
|
-
tabIndex: 0,
|
59
|
-
view: 'default',
|
60
|
-
size: 'xxl',
|
61
|
-
status: 'inactive',
|
36
|
+
name: 'Иван Фадеев',
|
62
37
|
focused: true,
|
63
|
-
customText: 'ФИО',
|
64
38
|
},
|
65
39
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { RootProps } from '../../engines';
|
3
|
-
import
|
3
|
+
import { AvatarProps } from './Avatar.types';
|
4
4
|
export declare const avatarRoot: (Root: RootProps<HTMLDivElement, AvatarProps>) => React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
5
5
|
size: "m" | "s" | "l" | "xxl" | "fit";
|
6
6
|
name?: string | undefined;
|
@@ -9,7 +9,6 @@ export declare const avatarRoot: (Root: RootProps<HTMLDivElement, AvatarProps>)
|
|
9
9
|
status?: "active" | "inactive" | undefined;
|
10
10
|
isScalable?: boolean | undefined;
|
11
11
|
focused?: boolean | undefined;
|
12
|
-
statusDict?: StatusDict | undefined;
|
13
12
|
} & React.RefAttributes<HTMLDivElement>>;
|
14
13
|
export declare const avatarConfig: {
|
15
14
|
name: string;
|
@@ -22,7 +21,6 @@ export declare const avatarConfig: {
|
|
22
21
|
status?: "active" | "inactive" | undefined;
|
23
22
|
isScalable?: boolean | undefined;
|
24
23
|
focused?: boolean | undefined;
|
25
|
-
statusDict?: StatusDict | undefined;
|
26
24
|
} & React.RefAttributes<HTMLDivElement>>;
|
27
25
|
base: import("@linaria/core").LinariaClassName;
|
28
26
|
variations: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAGjE,OAAO,EAAE,SAAS,EAA0B,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAGjE,OAAO,EAAE,SAAS,EAA0B,MAAM,eAAe,CAAC;AAMlE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiC7C,eAAO,MAAM,UAAU,SAAU,UAAU,cAAc,EAAE,WAAW,CAAC;;;;;;;;wCA4BtE,CAAC;AAEF,eAAO,MAAM,YAAY;;;mBA9BQ,UAAU,cAAc,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;CA8CtE,CAAC"}
|
@@ -7,14 +7,7 @@ declare type CustomAvatarProps = {
|
|
7
7
|
status?: 'active' | 'inactive';
|
8
8
|
isScalable?: boolean;
|
9
9
|
focused?: boolean;
|
10
|
-
/**
|
11
|
-
* Словарь для озвучивания значений свойства status [a11y]
|
12
|
-
* @default
|
13
|
-
* { active: 'Активен', inactive: 'Неактивен' }
|
14
|
-
*/
|
15
|
-
statusDict?: StatusDict;
|
16
10
|
};
|
17
|
-
export declare type StatusDict = Record<'active' | 'inactive', string>;
|
18
11
|
export declare type AvatarProps = HTMLAttributes<HTMLDivElement> & CustomAvatarProps;
|
19
12
|
export {};
|
20
13
|
//# sourceMappingURL=Avatar.types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.types.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,aAAK,iBAAiB,GAAG;IAErB,IAAI,EAAE,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC;IAEtC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAE/B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,OAAO,CAAC,EAAE,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"Avatar.types.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,aAAK,iBAAiB,GAAG;IAErB,IAAI,EAAE,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC;IAEtC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAE/B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,oBAAY,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG,iBAAiB,CAAC"}
|
@@ -35,7 +35,6 @@ export declare const mergedConfig: import("../../../../engines").ComponentConfig
|
|
35
35
|
status?: "active" | "inactive" | undefined;
|
36
36
|
isScalable?: boolean | undefined;
|
37
37
|
focused?: boolean | undefined;
|
38
|
-
statusDict?: import("../../../../components/Avatar/Avatar.types").StatusDict | undefined;
|
39
38
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
40
39
|
export declare const Avatar: import("react").FunctionComponent<import("../../../../engines/types").PropsType<{
|
41
40
|
view: {
|
@@ -59,6 +58,5 @@ export declare const Avatar: import("react").FunctionComponent<import("../../../
|
|
59
58
|
status?: "active" | "inactive" | undefined;
|
60
59
|
isScalable?: boolean | undefined;
|
61
60
|
focused?: boolean | undefined;
|
62
|
-
statusDict?: import("../../../../components/Avatar/Avatar.types").StatusDict | undefined;
|
63
61
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
64
62
|
//# sourceMappingURL=Avatar.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Avatar/Avatar.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,YAAY
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Avatar/Avatar.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAAoC,CAAC;AAE9D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;kDAA0B,CAAC"}
|
@@ -35,7 +35,6 @@ export declare const mergedConfig: import("../../../../engines").ComponentConfig
|
|
35
35
|
status?: "active" | "inactive" | undefined;
|
36
36
|
isScalable?: boolean | undefined;
|
37
37
|
focused?: boolean | undefined;
|
38
|
-
statusDict?: import("../../../../components/Avatar/Avatar.types").StatusDict | undefined;
|
39
38
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
40
39
|
export declare const Avatar: import("react").FunctionComponent<import("../../../../engines/types").PropsType<{
|
41
40
|
view: {
|
@@ -59,6 +58,5 @@ export declare const Avatar: import("react").FunctionComponent<import("../../../
|
|
59
58
|
status?: "active" | "inactive" | undefined;
|
60
59
|
isScalable?: boolean | undefined;
|
61
60
|
focused?: boolean | undefined;
|
62
|
-
statusDict?: import("../../../../components/Avatar/Avatar.types").StatusDict | undefined;
|
63
61
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
64
62
|
//# sourceMappingURL=Avatar.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_web/components/Avatar/Avatar.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,YAAY
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_web/components/Avatar/Avatar.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAAoC,CAAC;AAE9D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;kDAA0B,CAAC"}
|
@@ -21,6 +21,5 @@ export declare const Avatar: import("react").FunctionComponent<import("../../../
|
|
21
21
|
status?: "active" | "inactive" | undefined;
|
22
22
|
isScalable?: boolean | undefined;
|
23
23
|
focused?: boolean | undefined;
|
24
|
-
statusDict?: import("../../../../components/Avatar/Avatar.types").StatusDict | undefined;
|
25
24
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
26
25
|
//# sourceMappingURL=Avatar.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/examples/sds_engineer/components/Avatar/Avatar.tsx"],"names":[],"mappings":";AAOA,eAAO,MAAM,MAAM
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/examples/sds_engineer/components/Avatar/Avatar.tsx"],"names":[],"mappings":";AAOA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;kDAA0B,CAAC"}
|