@salutejs/plasma-new-hope 0.76.3-canary.1180.8720362393.0 → 0.76.3-canary.1180.8732245904.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Avatar/Avatar.js +3 -9
- package/cjs/components/Avatar/Avatar.js.map +1 -1
- package/es/components/Avatar/Avatar.js +3 -9
- package/es/components/Avatar/Avatar.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Avatar/Avatar.js +3 -9
- package/styled-components/es/components/Avatar/Avatar.js +3 -9
- package/types/components/Avatar/Avatar.d.ts.map +1 -1
@@ -38,21 +38,15 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
38
38
|
return /*#__PURE__*/React.createElement(Avatar_styles.Text, null, initials);
|
39
39
|
};
|
40
40
|
var getAriaLabel = function getAriaLabel(props) {
|
41
|
-
var
|
42
|
-
url = props.url,
|
41
|
+
var url = props.url,
|
43
42
|
name = props.name,
|
44
43
|
status = props.status,
|
45
44
|
ariaLabelProp = props['aria-label'],
|
46
45
|
role = props.role,
|
47
46
|
statusDict = props.statusDict;
|
48
47
|
|
49
|
-
// INFO: В этих сценариях aria-label не нужен
|
50
|
-
if (customText || !role || role !== 'button') {
|
51
|
-
return undefined;
|
52
|
-
}
|
53
|
-
|
54
48
|
// INFO: включаем aria-label чтобы озвучить что на изображении
|
55
|
-
if (url) {
|
49
|
+
if (url && role && role === 'button') {
|
56
50
|
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
57
51
|
return status ? "".concat(ariaLabel, ". ").concat(statusDict[status]) : ariaLabel;
|
58
52
|
}
|
@@ -98,7 +92,7 @@ var avatarRoot = function avatarRoot(Root) {
|
|
98
92
|
return getAriaLabel(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, props), {}, {
|
99
93
|
statusDict: statusDict
|
100
94
|
}));
|
101
|
-
}, [name, url, rest.role, status,
|
95
|
+
}, [name, url, rest.role, status, statusDict, rest['aria-label']]);
|
102
96
|
return /*#__PURE__*/React.createElement(Root, _rollupPluginBabelHelpers.extends({
|
103
97
|
ref: ref,
|
104
98
|
size: avatarSize,
|
@@ -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';\nimport type { AvatarProps, StatusDict } from './Avatar.types';\n\nconst StatusDictDefault = {\n active: 'Активен',\n inactive: 'Неактивен',\n};\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 getAriaLabel = (\n props: Pick<AvatarProps, 'url' | 'status' | 'role' | 'name' | '
|
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';\nimport type { AvatarProps, StatusDict } from './Avatar.types';\n\nconst StatusDictDefault = {\n active: 'Активен',\n inactive: 'Неактивен',\n};\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 getAriaLabel = (\n props: Pick<AvatarProps, 'url' | 'status' | 'role' | 'name' | 'aria-label'> & {\n statusDict: StatusDict;\n },\n) => {\n const { url, name, status, 'aria-label': ariaLabelProp, role, statusDict } = props;\n\n // INFO: включаем aria-label чтобы озвучить что на изображении\n if (url && role && role === 'button') {\n const ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;\n\n return status ? `${ariaLabel}. ${statusDict[status]}` : ariaLabel;\n }\n\n return undefined;\n};\n\nconst mergedConfig = mergeConfig(indicatorConfig);\n\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 statusDict = StatusDictDefault,\n ...rest\n } = props;\n\n const initials = useMemo(() => getInitialsForName(name), [name]);\n const ariaLabel = useMemo(\n () =>\n getAriaLabel({\n ...props,\n statusDict,\n }),\n [name, url, rest.role, status, statusDict, rest['aria-label']],\n );\n\n return (\n <Root\n ref={ref}\n size={avatarSize}\n className={cx(classes.avatarItem, className)}\n aria-label={ariaLabel}\n focused={focused}\n {...rest}\n >\n <Wrapper isScalable={isScalable}>{getAvatarContent({ customText, url, initials, name })}</Wrapper>\n\n {status && (\n <StatusIcon>\n <StyledIndicator aria-label={statusDict[status]} 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":["StatusDictDefault","active","inactive","getAvatarContent","_ref","customText","url","initials","name","React","createElement","Text","Image","src","alt","getAriaLabel","props","status","ariaLabelProp","role","statusDict","ariaLabel","trim","concat","undefined","mergedConfig","mergeConfig","indicatorConfig","Indicator","component","_exp","_exp5","_ref2","tokens","statusOnlineColor","statusOfflineColor","StyledIndicator","styled","class","propsAsIs","vars","avatarRoot","Root","forwardRef","ref","avatarSize","size","className","_props$focused","focused","isScalable","_props$statusDict","rest","_excluded","useMemo","getInitialsForName","_objectSpread","_extends","cx","classes","avatarItem","Wrapper","StatusIcon","avatarConfig","tag","layout","base","variations","css","viewCSS","focusedCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,IAAMA,iBAAiB,GAAG;AACtBC,EAAAA,MAAM,EAAE,SAAS;AACjBC,EAAAA,QAAQ,EAAE,WAAA;AACd,CAAC,CAAA;AAED,IAAMC,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,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,wBAAU,EACPrD,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAAC0B,eAAe,EAAA;MAAC,YAAYhB,EAAAA,UAAU,CAACH,MAAM,CAAE;AAACA,MAAAA,MAAM,EAAEA,MAAAA;KAAO,CACxD,CAEd,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AACN,EAAC;AAEM,IAAM8C,YAAY,GAAG;AACxBvD,EAAAA,IAAI,EAAE,QAAQ;AACdwD,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAExB,UAAU;AAClByB,EAAAA,IAAI,EAAJA,kBAAI;AACJC,EAAAA,UAAU,EAAE;AACRrB,IAAAA,IAAI,EAAE;AACFsB,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDpB,IAAAA,OAAO,EAAE;AACLmB,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNzB,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
|
@@ -34,21 +34,15 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
34
34
|
return /*#__PURE__*/React.createElement(Text, null, initials);
|
35
35
|
};
|
36
36
|
var getAriaLabel = function getAriaLabel(props) {
|
37
|
-
var
|
38
|
-
url = props.url,
|
37
|
+
var url = props.url,
|
39
38
|
name = props.name,
|
40
39
|
status = props.status,
|
41
40
|
ariaLabelProp = props['aria-label'],
|
42
41
|
role = props.role,
|
43
42
|
statusDict = props.statusDict;
|
44
43
|
|
45
|
-
// INFO: В этих сценариях aria-label не нужен
|
46
|
-
if (customText || !role || role !== 'button') {
|
47
|
-
return undefined;
|
48
|
-
}
|
49
|
-
|
50
44
|
// INFO: включаем aria-label чтобы озвучить что на изображении
|
51
|
-
if (url) {
|
45
|
+
if (url && role && role === 'button') {
|
52
46
|
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
53
47
|
return status ? "".concat(ariaLabel, ". ").concat(statusDict[status]) : ariaLabel;
|
54
48
|
}
|
@@ -94,7 +88,7 @@ var avatarRoot = function avatarRoot(Root) {
|
|
94
88
|
return getAriaLabel(_objectSpread2(_objectSpread2({}, props), {}, {
|
95
89
|
statusDict: statusDict
|
96
90
|
}));
|
97
|
-
}, [name, url, rest.role, status,
|
91
|
+
}, [name, url, rest.role, status, statusDict, rest['aria-label']]);
|
98
92
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
99
93
|
ref: ref,
|
100
94
|
size: avatarSize,
|
@@ -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';\nimport type { AvatarProps, StatusDict } from './Avatar.types';\n\nconst StatusDictDefault = {\n active: 'Активен',\n inactive: 'Неактивен',\n};\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 getAriaLabel = (\n props: Pick<AvatarProps, 'url' | 'status' | 'role' | 'name' | '
|
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';\nimport type { AvatarProps, StatusDict } from './Avatar.types';\n\nconst StatusDictDefault = {\n active: 'Активен',\n inactive: 'Неактивен',\n};\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 getAriaLabel = (\n props: Pick<AvatarProps, 'url' | 'status' | 'role' | 'name' | 'aria-label'> & {\n statusDict: StatusDict;\n },\n) => {\n const { url, name, status, 'aria-label': ariaLabelProp, role, statusDict } = props;\n\n // INFO: включаем aria-label чтобы озвучить что на изображении\n if (url && role && role === 'button') {\n const ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;\n\n return status ? `${ariaLabel}. ${statusDict[status]}` : ariaLabel;\n }\n\n return undefined;\n};\n\nconst mergedConfig = mergeConfig(indicatorConfig);\n\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 statusDict = StatusDictDefault,\n ...rest\n } = props;\n\n const initials = useMemo(() => getInitialsForName(name), [name]);\n const ariaLabel = useMemo(\n () =>\n getAriaLabel({\n ...props,\n statusDict,\n }),\n [name, url, rest.role, status, statusDict, rest['aria-label']],\n );\n\n return (\n <Root\n ref={ref}\n size={avatarSize}\n className={cx(classes.avatarItem, className)}\n aria-label={ariaLabel}\n focused={focused}\n {...rest}\n >\n <Wrapper isScalable={isScalable}>{getAvatarContent({ customText, url, initials, name })}</Wrapper>\n\n {status && (\n <StatusIcon>\n <StyledIndicator aria-label={statusDict[status]} 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":["StatusDictDefault","active","inactive","getAvatarContent","_ref","customText","url","initials","name","React","createElement","Text","Image","src","alt","getAriaLabel","props","status","ariaLabelProp","role","statusDict","ariaLabel","trim","concat","undefined","mergedConfig","mergeConfig","indicatorConfig","Indicator","component","_exp","_exp5","_ref2","tokens","statusOnlineColor","statusOfflineColor","StyledIndicator","styled","class","propsAsIs","vars","avatarRoot","Root","forwardRef","ref","avatarSize","size","className","_props$focused","focused","isScalable","_props$statusDict","rest","_excluded","useMemo","getInitialsForName","_objectSpread","_extends","cx","classes","avatarItem","Wrapper","StatusIcon","avatarConfig","tag","layout","base","variations","css","viewCSS","focusedCSS","defaults"],"mappings":";;;;;;;;;;;;;;AAcA,IAAMA,iBAAiB,GAAG;AACtBC,EAAAA,MAAM,EAAE,SAAS;AACjBC,EAAAA,QAAQ,EAAE,WAAA;AACd,CAAC,CAAA;AAED,IAAMC,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,GA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AAEE,MAAAA,UAAU,EAAVA,UAAU;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,QAAQ,EAARA,QAAQ;AAAEC,MAAAA,IAAAA,EAAAA,IAAAA;AAAK,KAAC,CAAW,CAAA,EAEhGS,MAAM,iBACHR,KAAA,CAAAC,aAAA,CAACoD,UAAU,EACPrD,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAAC0B,eAAe,EAAA;MAAC,YAAYhB,EAAAA,UAAU,CAACH,MAAM,CAAE;AAACA,MAAAA,MAAM,EAAEA,MAAAA;KAAO,CACxD,CAEd,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AACN,EAAC;AAEM,IAAM8C,YAAY,GAAG;AACxBvD,EAAAA,IAAI,EAAE,QAAQ;AACdwD,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAExB,UAAU;AAClByB,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRrB,IAAAA,IAAI,EAAE;AACFsB,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDpB,IAAAA,OAAO,EAAE;AACLmB,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNzB,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.1180.
|
3
|
+
"version": "0.76.3-canary.1180.8732245904.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -102,5 +102,5 @@
|
|
102
102
|
"react-popper": "2.3.0",
|
103
103
|
"storeon": "3.1.5"
|
104
104
|
},
|
105
|
-
"gitHead": "
|
105
|
+
"gitHead": "a6e0a9b3f42a33eddfe430d91b61c98517dd13a4"
|
106
106
|
}
|
@@ -48,21 +48,15 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
48
48
|
return /*#__PURE__*/_react["default"].createElement(_Avatar2.Text, null, initials);
|
49
49
|
};
|
50
50
|
var getAriaLabel = function getAriaLabel(props) {
|
51
|
-
var
|
52
|
-
url = props.url,
|
51
|
+
var url = props.url,
|
53
52
|
name = props.name,
|
54
53
|
status = props.status,
|
55
54
|
ariaLabelProp = props['aria-label'],
|
56
55
|
role = props.role,
|
57
56
|
statusDict = props.statusDict;
|
58
57
|
|
59
|
-
// INFO: В этих сценариях aria-label не нужен
|
60
|
-
if (customText || !role || role !== 'button') {
|
61
|
-
return undefined;
|
62
|
-
}
|
63
|
-
|
64
58
|
// INFO: включаем aria-label чтобы озвучить что на изображении
|
65
|
-
if (url) {
|
59
|
+
if (url && role && role === 'button') {
|
66
60
|
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
67
61
|
return status ? "".concat(ariaLabel, ". ").concat(statusDict[status]) : ariaLabel;
|
68
62
|
}
|
@@ -97,7 +91,7 @@ var avatarRoot = exports.avatarRoot = function avatarRoot(Root) {
|
|
97
91
|
return getAriaLabel(_objectSpread(_objectSpread({}, props), {}, {
|
98
92
|
statusDict: statusDict
|
99
93
|
}));
|
100
|
-
}, [name, url, rest.role, status,
|
94
|
+
}, [name, url, rest.role, status, statusDict, rest['aria-label']]);
|
101
95
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
102
96
|
ref: ref,
|
103
97
|
size: avatarSize,
|
@@ -39,21 +39,15 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
39
39
|
return /*#__PURE__*/React.createElement(Text, null, initials);
|
40
40
|
};
|
41
41
|
var getAriaLabel = function getAriaLabel(props) {
|
42
|
-
var
|
43
|
-
url = props.url,
|
42
|
+
var url = props.url,
|
44
43
|
name = props.name,
|
45
44
|
status = props.status,
|
46
45
|
ariaLabelProp = props['aria-label'],
|
47
46
|
role = props.role,
|
48
47
|
statusDict = props.statusDict;
|
49
48
|
|
50
|
-
// INFO: В этих сценариях aria-label не нужен
|
51
|
-
if (customText || !role || role !== 'button') {
|
52
|
-
return undefined;
|
53
|
-
}
|
54
|
-
|
55
49
|
// INFO: включаем aria-label чтобы озвучить что на изображении
|
56
|
-
if (url) {
|
50
|
+
if (url && role && role === 'button') {
|
57
51
|
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
58
52
|
return status ? "".concat(ariaLabel, ". ").concat(statusDict[status]) : ariaLabel;
|
59
53
|
}
|
@@ -88,7 +82,7 @@ export var avatarRoot = function avatarRoot(Root) {
|
|
88
82
|
return getAriaLabel(_objectSpread(_objectSpread({}, props), {}, {
|
89
83
|
statusDict: statusDict
|
90
84
|
}));
|
91
|
-
}, [name, url, rest.role, status,
|
85
|
+
}, [name, url, rest.role, status, statusDict, rest['aria-label']]);
|
92
86
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
93
87
|
ref: ref,
|
94
88
|
size: avatarSize,
|
@@ -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;AASlE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,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;AASlE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAqD9D,eAAO,MAAM,UAAU,SAAU,UAAU,cAAc,EAAE,WAAW,CAAC;;;;;;;;;wCA4CtE,CAAC;AAEF,eAAO,MAAM,YAAY;;;mBA9CQ,UAAU,cAAc,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;CA8DtE,CAAC"}
|