@salutejs/plasma-new-hope 0.76.5-canary.1180.8748298731.0 → 0.76.5-canary.1188.8748029637.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/cjs/components/Avatar/Avatar.js +3 -28
  2. package/cjs/components/Avatar/Avatar.js.map +1 -1
  3. package/es/components/Avatar/Avatar.js +4 -29
  4. package/es/components/Avatar/Avatar.js.map +1 -1
  5. package/package.json +2 -2
  6. package/styled-components/cjs/components/Avatar/Avatar.js +3 -33
  7. package/styled-components/cjs/components/Avatar/Avatar.template-doc.mdx +2 -52
  8. package/styled-components/cjs/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +1 -26
  9. package/styled-components/cjs/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +18 -36
  10. package/styled-components/cjs/examples/plasma_b2c/components/Radiobox/Radiobox.stories.tsx +37 -42
  11. package/styled-components/cjs/examples/plasma_web/components/Avatar/Avatar.stories.tsx +1 -26
  12. package/styled-components/cjs/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +1 -27
  13. package/styled-components/es/components/Avatar/Avatar.js +3 -34
  14. package/styled-components/es/components/Avatar/Avatar.template-doc.mdx +2 -52
  15. package/styled-components/es/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +1 -26
  16. package/styled-components/es/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +18 -36
  17. package/styled-components/es/examples/plasma_b2c/components/Radiobox/Radiobox.stories.tsx +37 -42
  18. package/styled-components/es/examples/plasma_web/components/Avatar/Avatar.stories.tsx +1 -26
  19. package/styled-components/es/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +1 -27
  20. package/types/components/Avatar/Avatar.d.ts +1 -3
  21. package/types/components/Avatar/Avatar.d.ts.map +1 -1
  22. package/types/components/Avatar/Avatar.types.d.ts +0 -7
  23. package/types/components/Avatar/Avatar.types.d.ts.map +1 -1
  24. package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts +0 -2
  25. package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts.map +1 -1
  26. package/types/examples/plasma_web/components/Avatar/Avatar.d.ts +0 -2
  27. package/types/examples/plasma_web/components/Avatar/Avatar.d.ts.map +1 -1
  28. package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts +0 -1
  29. 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", "statusLabels"];
20
- var StatusLabelsDefault = {
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,28 +33,14 @@ 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(_ref2) {
41
- var url = _ref2.url,
42
- name = _ref2.name,
43
- status = _ref2.status,
44
- ariaLabelProp = _ref2['aria-label'],
45
- statusLabels = _ref2.statusLabels;
46
- if (!url) {
47
- return;
48
- }
49
-
50
- // INFO: включаем aria-label чтобы озвучить что на изображении
51
- var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
52
- return status ? "".concat(ariaLabel, ". ").concat(statusLabels[status]) : ariaLabel;
53
- };
54
36
  var mergedConfig = /*#__PURE__*/common.mergeConfig(Indicator$1.indicatorConfig);
55
37
  var Indicator = /*#__PURE__*/common.component(mergedConfig);
56
38
  var _exp = function _exp() {
57
39
  return Indicator;
58
40
  };
59
41
  var _exp5 = function _exp5() {
60
- return function (_ref3) {
61
- var status = _ref3.status;
42
+ return function (_ref2) {
43
+ var status = _ref2.status;
62
44
  return status === 'active' ? "var(".concat(Avatar_tokens.tokens.statusOnlineColor, ")") : "var(".concat(Avatar_tokens.tokens.statusOfflineColor, ")");
63
45
  };
64
46
  };
@@ -81,20 +63,14 @@ var avatarRoot = function avatarRoot(Root) {
81
63
  _props$focused = props.focused,
82
64
  focused = _props$focused === void 0 ? true : _props$focused,
83
65
  isScalable = props.isScalable,
84
- _props$statusLabels = props.statusLabels,
85
- statusLabels = _props$statusLabels === void 0 ? StatusLabelsDefault : _props$statusLabels,
86
66
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
87
67
  var initials = React.useMemo(function () {
88
68
  return getInitialsForName.getInitialsForName(name);
89
69
  }, [name]);
90
- var ariaLabel = getAriaLabel(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, props), {}, {
91
- statusLabels: statusLabels
92
- }));
93
70
  return /*#__PURE__*/React.createElement(Root, _rollupPluginBabelHelpers.extends({
94
71
  ref: ref,
95
72
  size: avatarSize,
96
73
  className: index.cx(Avatar_tokens.classes.avatarItem, className),
97
- "aria-label": ariaLabel,
98
74
  focused: focused
99
75
  }, rest), /*#__PURE__*/React.createElement(Avatar_styles.Wrapper, {
100
76
  isScalable: isScalable
@@ -104,7 +80,6 @@ var avatarRoot = function avatarRoot(Root) {
104
80
  initials: initials,
105
81
  name: name
106
82
  })), status && /*#__PURE__*/React.createElement(Avatar_styles.StatusIcon, null, /*#__PURE__*/React.createElement(StyledIndicator, {
107
- "aria-label": statusLabels[status],
108
83
  status: status
109
84
  })));
110
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';\nimport type { AvatarProps, StatusLabels } from './Avatar.types';\n\nconst StatusLabelsDefault: StatusLabels = {\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 url,\n name,\n status,\n 'aria-label': ariaLabelProp,\n statusLabels,\n}: Pick<AvatarProps, 'url' | 'status' | 'name' | 'aria-label'> & {\n statusLabels: StatusLabels;\n}) => {\n if (!url) {\n return;\n }\n\n // INFO: включаем aria-label чтобы озвучить что на изображении\n const ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;\n\n return status ? `${ariaLabel}. ${statusLabels[status]}` : ariaLabel;\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 statusLabels = StatusLabelsDefault,\n ...rest\n } = props;\n\n const initials = useMemo(() => getInitialsForName(name), [name]);\n const ariaLabel = getAriaLabel({\n ...props,\n statusLabels,\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={statusLabels[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":["StatusLabelsDefault","active","inactive","getAvatarContent","_ref","customText","url","initials","name","React","createElement","Text","Image","src","alt","getAriaLabel","_ref2","status","ariaLabelProp","statusLabels","ariaLabel","trim","concat","mergedConfig","mergeConfig","indicatorConfig","Indicator","component","_exp","_exp5","_ref3","tokens","statusOnlineColor","statusOfflineColor","StyledIndicator","styled","class","propsAsIs","vars","avatarRoot","Root","forwardRef","props","ref","avatarSize","size","className","_props$focused","focused","isScalable","_props$statusLabels","rest","_excluded","useMemo","getInitialsForName","_objectSpread","_extends","cx","classes","avatarItem","Wrapper","StatusIcon","avatarConfig","tag","layout","base","variations","css","viewCSS","focusedCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,IAAMA,mBAAiC,GAAG;AACtCC,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,IA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MAAAA;KAAO,CAC1D,CAEd,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AACN,EAAC;AAEM,IAAM6C,YAAY,GAAG;AACxBtD,EAAAA,IAAI,EAAE,QAAQ;AACduD,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEzB,UAAU;AAClB0B,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;;;;;"}
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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GAAG,EAAHA,GAAG;AAAEC,MAAAA,QAAQ,EAARA,QAAQ;AAAEC,MAAAA,IAAAA,EAAAA,IAAAA;AAAK,KAAC,CAAW,CAAA,EAEhGe,MAAM,iBACHd,KAAA,CAAAC,aAAA,CAAC2C,wBAAU,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,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, objectSpread2 as _objectSpread2, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
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", "statusLabels"];
16
- var StatusLabelsDefault = {
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,28 +29,14 @@ var getAvatarContent = function getAvatarContent(_ref) {
33
29
  }
34
30
  return /*#__PURE__*/React.createElement(Text, null, initials);
35
31
  };
36
- var getAriaLabel = function getAriaLabel(_ref2) {
37
- var url = _ref2.url,
38
- name = _ref2.name,
39
- status = _ref2.status,
40
- ariaLabelProp = _ref2['aria-label'],
41
- statusLabels = _ref2.statusLabels;
42
- if (!url) {
43
- return;
44
- }
45
-
46
- // INFO: включаем aria-label чтобы озвучить что на изображении
47
- var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
48
- return status ? "".concat(ariaLabel, ". ").concat(statusLabels[status]) : ariaLabel;
49
- };
50
32
  var mergedConfig = /*#__PURE__*/mergeConfig(indicatorConfig);
51
33
  var Indicator = /*#__PURE__*/component(mergedConfig);
52
34
  var _exp = function _exp() {
53
35
  return Indicator;
54
36
  };
55
37
  var _exp5 = function _exp5() {
56
- return function (_ref3) {
57
- var status = _ref3.status;
38
+ return function (_ref2) {
39
+ var status = _ref2.status;
58
40
  return status === 'active' ? "var(".concat(tokens.statusOnlineColor, ")") : "var(".concat(tokens.statusOfflineColor, ")");
59
41
  };
60
42
  };
@@ -77,20 +59,14 @@ var avatarRoot = function avatarRoot(Root) {
77
59
  _props$focused = props.focused,
78
60
  focused = _props$focused === void 0 ? true : _props$focused,
79
61
  isScalable = props.isScalable,
80
- _props$statusLabels = props.statusLabels,
81
- statusLabels = _props$statusLabels === void 0 ? StatusLabelsDefault : _props$statusLabels,
82
62
  rest = _objectWithoutProperties(props, _excluded);
83
63
  var initials = useMemo(function () {
84
64
  return getInitialsForName(name);
85
65
  }, [name]);
86
- var ariaLabel = getAriaLabel(_objectSpread2(_objectSpread2({}, props), {}, {
87
- statusLabels: statusLabels
88
- }));
89
66
  return /*#__PURE__*/React.createElement(Root, _extends({
90
67
  ref: ref,
91
68
  size: avatarSize,
92
69
  className: cx(classes.avatarItem, className),
93
- "aria-label": ariaLabel,
94
70
  focused: focused
95
71
  }, rest), /*#__PURE__*/React.createElement(Wrapper, {
96
72
  isScalable: isScalable
@@ -100,7 +76,6 @@ var avatarRoot = function avatarRoot(Root) {
100
76
  initials: initials,
101
77
  name: name
102
78
  })), status && /*#__PURE__*/React.createElement(StatusIcon, null, /*#__PURE__*/React.createElement(StyledIndicator, {
103
- "aria-label": statusLabels[status],
104
79
  status: status
105
80
  })));
106
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';\nimport type { AvatarProps, StatusLabels } from './Avatar.types';\n\nconst StatusLabelsDefault: StatusLabels = {\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 url,\n name,\n status,\n 'aria-label': ariaLabelProp,\n statusLabels,\n}: Pick<AvatarProps, 'url' | 'status' | 'name' | 'aria-label'> & {\n statusLabels: StatusLabels;\n}) => {\n if (!url) {\n return;\n }\n\n // INFO: включаем aria-label чтобы озвучить что на изображении\n const ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;\n\n return status ? `${ariaLabel}. ${statusLabels[status]}` : ariaLabel;\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 statusLabels = StatusLabelsDefault,\n ...rest\n } = props;\n\n const initials = useMemo(() => getInitialsForName(name), [name]);\n const ariaLabel = getAriaLabel({\n ...props,\n statusLabels,\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={statusLabels[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":["StatusLabelsDefault","active","inactive","getAvatarContent","_ref","customText","url","initials","name","React","createElement","Text","Image","src","alt","getAriaLabel","_ref2","status","ariaLabelProp","statusLabels","ariaLabel","trim","concat","mergedConfig","mergeConfig","indicatorConfig","Indicator","component","_exp","_exp5","_ref3","tokens","statusOnlineColor","statusOfflineColor","StyledIndicator","styled","class","propsAsIs","vars","avatarRoot","Root","forwardRef","props","ref","avatarSize","size","className","_props$focused","focused","isScalable","_props$statusLabels","rest","_excluded","useMemo","getInitialsForName","_objectSpread","_extends","cx","classes","avatarItem","Wrapper","StatusIcon","avatarConfig","tag","layout","base","variations","css","viewCSS","focusedCSS","defaults"],"mappings":";;;;;;;;;;;;;;AAcA,IAAMA,mBAAiC,GAAG;AACtCC,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,IAAI,EAAA,IAAA,EAAEN,UAAiB,CAAC,CAAA;AACpC,GAAA;AAEA,EAAA,IAAIC,GAAG,EAAE;AACL,IAAA,oBAAOG,KAAA,CAAAC,aAAA,CAACE,KAAK,EAAA;AAACC,MAAAA,GAAG,EAAEP,GAAI;AAACQ,MAAAA,GAAG,EAAEN,IAAAA;AAAK,KAAG,CAAA,CAAA;AACzC,GAAA;AAEA,EAAA,oBAAOC,KAAA,CAAAC,aAAA,CAACC,IAAI,EAAA,IAAA,EAAEJ,QAAe,CAAC,CAAA;AAClC,CAAC,CAAA;AAED,IAAMQ,YAAY,GAAGA,SAAfA,YAAYA,CAAAC,KAAA,EAQZ;AAAA,EAAA,IAPFV,GAAG,GAAAU,KAAA,CAAHV,GAAG;IACHE,IAAI,GAAAQ,KAAA,CAAJR,IAAI;IACJS,MAAM,GAAAD,KAAA,CAANC,MA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MACjBE,SAAS,EAAEW,EAAE,CAACC,OAAO,CAACC,UAAU,EAAEb,SAAS,CAAE;AAC7C,MAAA,YAAA,EAAY1B,SAAU;AACtB4B,MAAAA,OAAO,EAAEA,OAAAA;AAAQ,KAAA,EACbG,IAAI,CAER1C,eAAAA,KAAA,CAAAC,aAAA,CAACkD,OAAO,EAAA;AAACX,MAAAA,UAAU,EAAEA,UAAAA;AAAW,KAAA,EAAE9C,gBAAgB,CAAC;AAAEE,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,CAACmD,UAAU,EACPpD,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACwB,eAAe,EAAA;MAAC,YAAYf,EAAAA,YAAY,CAACF,MAAM,CAAE;AAACA,MAAAA,MAAM,EAAEA,MAAAA;KAAO,CAC1D,CAEd,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AACN,EAAC;AAEM,IAAM6C,YAAY,GAAG;AACxBtD,EAAAA,IAAI,EAAE,QAAQ;AACduD,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEzB,UAAU;AAClB0B,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;;;;"}
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,IAAI,EAAA,IAAA,EAAEN,UAAiB,CAAC,CAAA;AACpC,GAAA;AAEA,EAAA,IAAIC,GAAG,EAAE;AACL,IAAA,oBAAOG,KAAA,CAAAC,aAAA,CAACE,KAAK,EAAA;AAACC,MAAAA,GAAG,EAAEP,GAAI;AAACQ,MAAAA,GAAG,EAAEN,IAAAA;AAAK,KAAG,CAAA,CAAA;AACzC,GAAA;AAEA,EAAA,oBAAOC,KAAA,CAAAC,aAAA,CAACC,IAAI,EAAA,IAAA,EAAEJ,QAAe,CAAC,CAAA;AAClC,CAAC,CAAA;AAED,IAAMQ,YAAY,gBAAGC,WAAW,CAACC,eAAe,CAAC,CAAA;AACjD,IAAMC,SAEL,gBAAGC,SAAS,CAACJ,YAAY,CAAU,CAAA;AAAC,IAAAK,IAAA,GAjCnBA,SAiCmBA,IAAAA,GAAA;AA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AA,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.5-canary.1180.8748298731.0",
3
+ "version": "0.76.5-canary.1188.8748029637.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": "a64954f917ad8547ebbf1df4a8b8ab21d16a7907"
105
+ "gitHead": "7853ff8eb53398e657bf4d92e00f6e8180e15e58"
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", "statusLabels"];
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 && {}.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 : 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 StatusLabelsDefault = {
31
- active: 'Активен',
32
- inactive: 'Неактивен'
33
- };
34
25
  var getAvatarContent = function getAvatarContent(_ref) {
35
26
  var customText = _ref.customText,
36
27
  url = _ref.url,
@@ -47,26 +38,12 @@ 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(_ref2) {
51
- var url = _ref2.url,
52
- name = _ref2.name,
53
- status = _ref2.status,
54
- ariaLabelProp = _ref2['aria-label'],
55
- statusLabels = _ref2.statusLabels;
56
- if (!url) {
57
- return;
58
- }
59
-
60
- // INFO: включаем aria-label чтобы озвучить что на изображении
61
- var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
62
- return status ? "".concat(ariaLabel, ". ").concat(statusLabels[status]) : ariaLabel;
63
- };
64
41
  var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Indicator.indicatorConfig);
65
42
  var Indicator = /*#__PURE__*/(0, _engines.component)(mergedConfig);
66
43
  var StyledIndicator = /*#__PURE__*/(0, _styledComponents["default"])(Indicator).withConfig({
67
44
  componentId: "plasma-new-hope__sc-p4w0wq-0"
68
- })(["", ":var(", ");", ":", ""], _Indicator.indicatorTokens.size, _Avatar.tokens.statusIconSize, _Indicator.indicatorTokens.color, function (_ref3) {
69
- var status = _ref3.status;
45
+ })(["", ":var(", ");", ":", ""], _Indicator.indicatorTokens.size, _Avatar.tokens.statusIconSize, _Indicator.indicatorTokens.color, function (_ref2) {
46
+ var status = _ref2.status;
70
47
  return status === 'active' ? "var(".concat(_Avatar.tokens.statusOnlineColor, ")") : "var(".concat(_Avatar.tokens.statusOfflineColor, ")");
71
48
  });
72
49
  var avatarRoot = exports.avatarRoot = function avatarRoot(Root) {
@@ -80,20 +57,14 @@ var avatarRoot = exports.avatarRoot = function avatarRoot(Root) {
80
57
  _props$focused = props.focused,
81
58
  focused = _props$focused === void 0 ? true : _props$focused,
82
59
  isScalable = props.isScalable,
83
- _props$statusLabels = props.statusLabels,
84
- statusLabels = _props$statusLabels === void 0 ? StatusLabelsDefault : _props$statusLabels,
85
60
  rest = _objectWithoutProperties(props, _excluded);
86
61
  var initials = (0, _react.useMemo)(function () {
87
62
  return (0, _utils2.getInitialsForName)(name);
88
63
  }, [name]);
89
- var ariaLabel = getAriaLabel(_objectSpread(_objectSpread({}, props), {}, {
90
- statusLabels: statusLabels
91
- }));
92
64
  return /*#__PURE__*/_react["default"].createElement(Root, _extends({
93
65
  ref: ref,
94
66
  size: avatarSize,
95
67
  className: (0, _utils.cx)(_Avatar.classes.avatarItem, className),
96
- "aria-label": ariaLabel,
97
68
  focused: focused
98
69
  }, rest), /*#__PURE__*/_react["default"].createElement(_Avatar2.Wrapper, {
99
70
  isScalable: isScalable
@@ -103,7 +74,6 @@ var avatarRoot = exports.avatarRoot = function avatarRoot(Root) {
103
74
  initials: initials,
104
75
  name: name
105
76
  })), status && /*#__PURE__*/_react["default"].createElement(_Avatar2.StatusIcon, null, /*#__PURE__*/_react["default"].createElement(StyledIndicator, {
106
- "aria-label": statusLabels[status],
107
77
  status: status
108
78
  })));
109
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={0} name="Иван Фадеев" />
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
- #### Свойство statusLabels
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
  };
@@ -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: ({ visibleCount, totalCount, ...args }: ComponentProps<typeof AvatarGroup>) => {
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" key={index} customText={index + 1} />
44
+ <Avatar size="xxl" customText={index + 1} />
46
45
  ))}
47
46
 
48
- {itemLength > visibleCount && <Avatar size="xxl" customText={`+${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
- {list.map((props) => (
86
- <Avatar role="button" tabIndex={0} focused key={props.name} size="xxl" {...props} />
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
  },
@@ -51,61 +51,56 @@ const items = [
51
51
  { langName, value: 'elixir', label: 'Elixir', disabled: true },
52
52
  ];
53
53
 
54
- const StoryDefault = (props: RadioboxProps) => {
54
+ const StoryDefault = ({ label, description, ...props }: RadioboxProps) => {
55
55
  const value = 0;
56
56
  const [checked, setChecked] = useState(true);
57
57
 
58
58
  return (
59
- <>
60
- <Radiobox
61
- name="item.name"
62
- value={value}
63
- singleLine
64
- label="Label"
65
- description="Description"
66
- checked={checked}
67
- onChange={(event) => {
68
- event.persist();
69
-
70
- setChecked(event.target.checked);
71
- onChange(event);
72
- }}
73
- onFocus={onFocus}
74
- onBlur={onBlur}
75
- {...props}
76
- />
77
- <Radiobox
78
- name="item.name"
79
- value={value}
80
- singleLine
81
- label="Label looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonger"
82
- description="Description looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonger"
83
- checked={checked}
84
- onChange={(event) => {
85
- event.persist();
86
-
87
- setChecked(event.target.checked);
88
- onChange(event);
89
- }}
90
- onFocus={onFocus}
91
- onBlur={onBlur}
92
- {...props}
93
- />
94
- </>
59
+ <Radiobox
60
+ name="item.name"
61
+ value={value}
62
+ singleLine
63
+ label={label}
64
+ description={description}
65
+ checked={checked}
66
+ onChange={(event) => {
67
+ event.persist();
68
+
69
+ setChecked(event.target.checked);
70
+ onChange(event);
71
+ }}
72
+ onFocus={onFocus}
73
+ onBlur={onBlur}
74
+ {...props}
75
+ />
95
76
  );
96
77
  };
97
78
 
98
79
  export const Default: StoryObj<RadioboxProps> = {
80
+ args: {
81
+ ...meta.args,
82
+ label: 'Это label',
83
+ description: 'Это описание',
84
+ },
85
+ render: (args) => <StoryDefault {...args} />,
86
+ };
87
+
88
+ export const LongText: StoryObj<RadioboxProps> = {
89
+ args: {
90
+ ...meta.args,
91
+ label: 'Ооооооооооооооооооооочень длинный label',
92
+ description: 'Ооооооооооооооооооооочень длинный description',
93
+ },
99
94
  render: (args) => <StoryDefault {...args} />,
100
95
  };
101
96
 
102
- const StoryComplex = (props: RadioboxProps) => {
97
+ const StoryRadioGroup = (props: RadioboxProps) => {
103
98
  const [value, setValue] = useState('c');
104
99
 
105
100
  return (
106
- <RadioGroup>
101
+ <RadioGroup aria-labelledby="radiogroup-title-id">
107
102
  <div id="radiogroup-title-id" style={{ margin: '1rem 0', fontWeight: '600' }}>
108
- Radiogroup Title
103
+ Выберите язык программирования для изучения.
109
104
  </div>
110
105
  {items.map((item) => (
111
106
  <Radiobox
@@ -129,6 +124,6 @@ const StoryComplex = (props: RadioboxProps) => {
129
124
  );
130
125
  };
131
126
 
132
- export const Complex: StoryObj<RadioboxProps> = {
133
- render: (args) => <StoryComplex {...args} />,
127
+ export const ExampleRadioGroup: StoryObj<RadioboxProps> = {
128
+ render: (args) => <StoryRadioGroup {...args} />,
134
129
  };