@salutejs/plasma-new-hope 0.76.5-canary.1188.8748029637.0 → 0.76.5-dev.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Avatar/Avatar.js +28 -3
- package/cjs/components/Avatar/Avatar.js.map +1 -1
- package/es/components/Avatar/Avatar.js +29 -4
- package/es/components/Avatar/Avatar.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Avatar/Avatar.js +33 -3
- package/styled-components/cjs/components/Avatar/Avatar.template-doc.mdx +52 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +26 -1
- package/styled-components/cjs/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +36 -18
- package/styled-components/cjs/examples/plasma_b2c/components/Radiobox/Radiobox.stories.tsx +42 -37
- package/styled-components/cjs/examples/plasma_web/components/Avatar/Avatar.stories.tsx +26 -1
- package/styled-components/cjs/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +27 -1
- package/styled-components/es/components/Avatar/Avatar.js +34 -3
- package/styled-components/es/components/Avatar/Avatar.template-doc.mdx +52 -2
- package/styled-components/es/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +26 -1
- package/styled-components/es/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +36 -18
- package/styled-components/es/examples/plasma_b2c/components/Radiobox/Radiobox.stories.tsx +42 -37
- package/styled-components/es/examples/plasma_web/components/Avatar/Avatar.stories.tsx +26 -1
- package/styled-components/es/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +27 -1
- package/types/components/Avatar/Avatar.d.ts +3 -1
- package/types/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/components/Avatar/Avatar.types.d.ts +7 -0
- package/types/components/Avatar/Avatar.types.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts +2 -0
- package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Avatar/Avatar.d.ts +2 -0
- package/types/examples/plasma_web/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts +1 -0
- package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts.map +1 -1
@@ -34,13 +34,38 @@ 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 = {
|
37
49
|
args: {
|
38
50
|
role: 'button',
|
39
51
|
tabIndex: 0,
|
40
52
|
view: 'default',
|
41
53
|
size: 'xxl',
|
42
|
-
name: 'Иван Фадеев',
|
43
54
|
status: 'active',
|
44
55
|
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: 'ФИО',
|
45
70
|
},
|
46
71
|
};
|
@@ -30,10 +30,36 @@ export const Default: Story = {
|
|
30
30
|
export const Accessibility: Story = {
|
31
31
|
args: {
|
32
32
|
role: 'button',
|
33
|
+
name: 'Геннадий Силуянович',
|
33
34
|
tabIndex: 0,
|
34
35
|
view: 'default',
|
35
36
|
size: 'xxl',
|
36
|
-
|
37
|
+
status: 'active',
|
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',
|
37
62
|
focused: true,
|
63
|
+
customText: 'ФИО',
|
38
64
|
},
|
39
65
|
};
|
@@ -1,5 +1,11 @@
|
|
1
|
-
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable", "statusLabels"];
|
2
3
|
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 : 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); }
|
3
9
|
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; }
|
4
10
|
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; }
|
5
11
|
import React, { forwardRef, useMemo } from 'react';
|
@@ -12,6 +18,10 @@ import { base, Wrapper, Image, StatusIcon, Text } from './Avatar.styles';
|
|
12
18
|
import { base as viewCSS } from './variations/_size/base';
|
13
19
|
import { base as focusedCSS } from './variations/_focused/base';
|
14
20
|
import { getInitialsForName } from './utils';
|
21
|
+
var StatusLabelsDefault = {
|
22
|
+
active: 'Активен',
|
23
|
+
inactive: 'Неактивен'
|
24
|
+
};
|
15
25
|
var getAvatarContent = function getAvatarContent(_ref) {
|
16
26
|
var customText = _ref.customText,
|
17
27
|
url = _ref.url,
|
@@ -28,12 +38,26 @@ var getAvatarContent = function getAvatarContent(_ref) {
|
|
28
38
|
}
|
29
39
|
return /*#__PURE__*/React.createElement(Text, null, initials);
|
30
40
|
};
|
41
|
+
var getAriaLabel = function getAriaLabel(_ref2) {
|
42
|
+
var url = _ref2.url,
|
43
|
+
name = _ref2.name,
|
44
|
+
status = _ref2.status,
|
45
|
+
ariaLabelProp = _ref2['aria-label'],
|
46
|
+
statusLabels = _ref2.statusLabels;
|
47
|
+
if (!url) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
|
51
|
+
// INFO: включаем aria-label чтобы озвучить что на изображении
|
52
|
+
var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
|
53
|
+
return status ? "".concat(ariaLabel, ". ").concat(statusLabels[status]) : ariaLabel;
|
54
|
+
};
|
31
55
|
var mergedConfig = /*#__PURE__*/mergeConfig(indicatorConfig);
|
32
56
|
var Indicator = /*#__PURE__*/component(mergedConfig);
|
33
57
|
var StyledIndicator = /*#__PURE__*/styled(Indicator).withConfig({
|
34
58
|
componentId: "plasma-new-hope__sc-p4w0wq-0"
|
35
|
-
})(["", ":var(", ");", ":", ""], indicatorTokens.size, tokens.statusIconSize, indicatorTokens.color, function (
|
36
|
-
var status =
|
59
|
+
})(["", ":var(", ");", ":", ""], indicatorTokens.size, tokens.statusIconSize, indicatorTokens.color, function (_ref3) {
|
60
|
+
var status = _ref3.status;
|
37
61
|
return status === 'active' ? "var(".concat(tokens.statusOnlineColor, ")") : "var(".concat(tokens.statusOfflineColor, ")");
|
38
62
|
});
|
39
63
|
export var avatarRoot = function avatarRoot(Root) {
|
@@ -47,14 +71,20 @@ export var avatarRoot = function avatarRoot(Root) {
|
|
47
71
|
_props$focused = props.focused,
|
48
72
|
focused = _props$focused === void 0 ? true : _props$focused,
|
49
73
|
isScalable = props.isScalable,
|
74
|
+
_props$statusLabels = props.statusLabels,
|
75
|
+
statusLabels = _props$statusLabels === void 0 ? StatusLabelsDefault : _props$statusLabels,
|
50
76
|
rest = _objectWithoutProperties(props, _excluded);
|
51
77
|
var initials = useMemo(function () {
|
52
78
|
return getInitialsForName(name);
|
53
79
|
}, [name]);
|
80
|
+
var ariaLabel = getAriaLabel(_objectSpread(_objectSpread({}, props), {}, {
|
81
|
+
statusLabels: statusLabels
|
82
|
+
}));
|
54
83
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
55
84
|
ref: ref,
|
56
85
|
size: avatarSize,
|
57
86
|
className: cx(classes.avatarItem, className),
|
87
|
+
"aria-label": ariaLabel,
|
58
88
|
focused: focused
|
59
89
|
}, rest), /*#__PURE__*/React.createElement(Wrapper, {
|
60
90
|
isScalable: isScalable
|
@@ -64,6 +94,7 @@ export var avatarRoot = function avatarRoot(Root) {
|
|
64
94
|
initials: initials,
|
65
95
|
name: name
|
66
96
|
})), status && /*#__PURE__*/React.createElement(StatusIcon, null, /*#__PURE__*/React.createElement(StyledIndicator, {
|
97
|
+
"aria-label": statusLabels[status],
|
67
98
|
status: status
|
68
99
|
})));
|
69
100
|
});
|
@@ -81,7 +81,32 @@ export function App() {
|
|
81
81
|
```
|
82
82
|
|
83
83
|
### Доступность
|
84
|
-
|
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`.
|
85
110
|
|
86
111
|
```tsx live
|
87
112
|
import React from 'react';
|
@@ -90,8 +115,33 @@ import { Avatar } from '@salutejs/{{ package }}';
|
|
90
115
|
export function App() {
|
91
116
|
return (
|
92
117
|
<>
|
93
|
-
<Avatar role="button" tabIndex=
|
118
|
+
<Avatar role="button" tabIndex={0} name="Иван Фадеев" />
|
94
119
|
</>
|
95
120
|
);
|
96
121
|
}
|
97
122
|
```
|
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,13 +34,38 @@ 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 = {
|
37
49
|
args: {
|
38
50
|
role: 'button',
|
39
51
|
tabIndex: 0,
|
40
52
|
view: 'default',
|
41
53
|
size: 'xxl',
|
42
|
-
name: 'Иван Фадеев',
|
43
54
|
status: 'active',
|
44
55
|
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: 'ФИО',
|
45
70
|
},
|
46
71
|
};
|
package/styled-components/es/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx
CHANGED
@@ -8,6 +8,7 @@ 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>;
|
11
12
|
|
12
13
|
const meta: Meta<typeof AvatarGroup> = {
|
13
14
|
title: 'plasma_b2c/AvatarGroup',
|
@@ -33,40 +34,57 @@ export const Default: Story = {
|
|
33
34
|
|
34
35
|
export const DynamicSize: Story = {
|
35
36
|
args: { totalCount: 10, visibleCount: 3 },
|
36
|
-
render: (args: ComponentProps<typeof AvatarGroup>) => {
|
37
|
-
const itemLength =
|
37
|
+
render: ({ visibleCount, totalCount, ...args }: ComponentProps<typeof AvatarGroup>) => {
|
38
|
+
const itemLength = totalCount;
|
38
39
|
|
39
40
|
return (
|
40
41
|
<AvatarGroup {...args}>
|
41
|
-
{Array(
|
42
|
+
{Array(visibleCount)
|
42
43
|
.fill(true)
|
43
44
|
.map((_, index) => (
|
44
|
-
<Avatar size="xxl" customText={index + 1} />
|
45
|
+
<Avatar size="xxl" key={index} customText={index + 1} />
|
45
46
|
))}
|
46
47
|
|
47
|
-
{itemLength >
|
48
|
-
<Avatar size="xxl" customText={`+${itemLength - args.visibleCount}`} />
|
49
|
-
)}
|
48
|
+
{itemLength > visibleCount && <Avatar size="xxl" customText={`+${itemLength - visibleCount}`} />}
|
50
49
|
</AvatarGroup>
|
51
50
|
);
|
52
51
|
},
|
53
52
|
};
|
54
53
|
|
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
|
+
|
55
81
|
export const Accessibility: Story = {
|
56
82
|
render: (args: ComponentProps<typeof AvatarGroup>) => {
|
57
83
|
return (
|
58
84
|
<AvatarGroup {...args}>
|
59
|
-
{
|
60
|
-
.
|
61
|
-
|
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
|
-
))}
|
85
|
+
{list.map((props) => (
|
86
|
+
<Avatar role="button" tabIndex={0} focused key={props.name} size="xxl" {...props} />
|
87
|
+
))}
|
70
88
|
</AvatarGroup>
|
71
89
|
);
|
72
90
|
},
|
@@ -51,56 +51,61 @@ const items = [
|
|
51
51
|
{ langName, value: 'elixir', label: 'Elixir', disabled: true },
|
52
52
|
];
|
53
53
|
|
54
|
-
const StoryDefault = (
|
54
|
+
const StoryDefault = (props: RadioboxProps) => {
|
55
55
|
const value = 0;
|
56
56
|
const [checked, setChecked] = useState(true);
|
57
57
|
|
58
58
|
return (
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
event
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
+
</>
|
76
95
|
);
|
77
96
|
};
|
78
97
|
|
79
98
|
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
|
-
},
|
94
99
|
render: (args) => <StoryDefault {...args} />,
|
95
100
|
};
|
96
101
|
|
97
|
-
const
|
102
|
+
const StoryComplex = (props: RadioboxProps) => {
|
98
103
|
const [value, setValue] = useState('c');
|
99
104
|
|
100
105
|
return (
|
101
|
-
<RadioGroup
|
106
|
+
<RadioGroup>
|
102
107
|
<div id="radiogroup-title-id" style={{ margin: '1rem 0', fontWeight: '600' }}>
|
103
|
-
|
108
|
+
Radiogroup Title
|
104
109
|
</div>
|
105
110
|
{items.map((item) => (
|
106
111
|
<Radiobox
|
@@ -124,6 +129,6 @@ const StoryRadioGroup = (props: RadioboxProps) => {
|
|
124
129
|
);
|
125
130
|
};
|
126
131
|
|
127
|
-
export const
|
128
|
-
render: (args) => <
|
132
|
+
export const Complex: StoryObj<RadioboxProps> = {
|
133
|
+
render: (args) => <StoryComplex {...args} />,
|
129
134
|
};
|
@@ -34,13 +34,38 @@ 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 = {
|
37
49
|
args: {
|
38
50
|
role: 'button',
|
39
51
|
tabIndex: 0,
|
40
52
|
view: 'default',
|
41
53
|
size: 'xxl',
|
42
|
-
name: 'Иван Фадеев',
|
43
54
|
status: 'active',
|
44
55
|
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: 'ФИО',
|
45
70
|
},
|
46
71
|
};
|
@@ -30,10 +30,36 @@ export const Default: Story = {
|
|
30
30
|
export const Accessibility: Story = {
|
31
31
|
args: {
|
32
32
|
role: 'button',
|
33
|
+
name: 'Геннадий Силуянович',
|
33
34
|
tabIndex: 0,
|
34
35
|
view: 'default',
|
35
36
|
size: 'xxl',
|
36
|
-
|
37
|
+
status: 'active',
|
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',
|
37
62
|
focused: true,
|
63
|
+
customText: 'ФИО',
|
38
64
|
},
|
39
65
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { RootProps } from '../../engines';
|
3
|
-
import { AvatarProps } from './Avatar.types';
|
3
|
+
import type { AvatarProps, StatusLabels } 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,6 +9,7 @@ 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
|
+
statusLabels?: StatusLabels | undefined;
|
12
13
|
} & React.RefAttributes<HTMLDivElement>>;
|
13
14
|
export declare const avatarConfig: {
|
14
15
|
name: string;
|
@@ -21,6 +22,7 @@ export declare const avatarConfig: {
|
|
21
22
|
status?: "active" | "inactive" | undefined;
|
22
23
|
isScalable?: boolean | undefined;
|
23
24
|
focused?: boolean | undefined;
|
25
|
+
statusLabels?: StatusLabels | undefined;
|
24
26
|
} & React.RefAttributes<HTMLDivElement>>;
|
25
27
|
base: import("@linaria/core").LinariaClassName;
|
26
28
|
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;AASlE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAuDhE,eAAO,MAAM,UAAU,SAAU,UAAU,cAAc,EAAE,WAAW,CAAC;;;;;;;;;wCAwCtE,CAAC;AAEF,eAAO,MAAM,YAAY;;;mBA1CQ,UAAU,cAAc,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;CA0DtE,CAAC"}
|
@@ -7,7 +7,14 @@ 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
|
+
statusLabels?: StatusLabels;
|
10
16
|
};
|
17
|
+
export declare type StatusLabels = Record<'active' | 'inactive', string>;
|
11
18
|
export declare type AvatarProps = HTMLAttributes<HTMLDivElement> & CustomAvatarProps;
|
12
19
|
export {};
|
13
20
|
//# 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;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF,oBAAY,YAAY,GAAG,MAAM,CAAC,QAAQ,GAAG,UAAU,EAAE,MAAM,CAAC,CAAC;AAEjE,oBAAY,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG,iBAAiB,CAAC"}
|
@@ -35,6 +35,7 @@ export declare const mergedConfig: import("../../../../engines").ComponentConfig
|
|
35
35
|
status?: "active" | "inactive" | undefined;
|
36
36
|
isScalable?: boolean | undefined;
|
37
37
|
focused?: boolean | undefined;
|
38
|
+
statusLabels?: import("../../../../components/Avatar/Avatar.types").StatusLabels | undefined;
|
38
39
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
39
40
|
export declare const Avatar: import("react").FunctionComponent<import("../../../../engines/types").PropsType<{
|
40
41
|
view: {
|
@@ -58,5 +59,6 @@ export declare const Avatar: import("react").FunctionComponent<import("../../../
|
|
58
59
|
status?: "active" | "inactive" | undefined;
|
59
60
|
isScalable?: boolean | undefined;
|
60
61
|
focused?: boolean | undefined;
|
62
|
+
statusLabels?: import("../../../../components/Avatar/Avatar.types").StatusLabels | undefined;
|
61
63
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
62
64
|
//# 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,6 +35,7 @@ export declare const mergedConfig: import("../../../../engines").ComponentConfig
|
|
35
35
|
status?: "active" | "inactive" | undefined;
|
36
36
|
isScalable?: boolean | undefined;
|
37
37
|
focused?: boolean | undefined;
|
38
|
+
statusLabels?: import("../../../../components/Avatar/Avatar.types").StatusLabels | undefined;
|
38
39
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
39
40
|
export declare const Avatar: import("react").FunctionComponent<import("../../../../engines/types").PropsType<{
|
40
41
|
view: {
|
@@ -58,5 +59,6 @@ export declare const Avatar: import("react").FunctionComponent<import("../../../
|
|
58
59
|
status?: "active" | "inactive" | undefined;
|
59
60
|
isScalable?: boolean | undefined;
|
60
61
|
focused?: boolean | undefined;
|
62
|
+
statusLabels?: import("../../../../components/Avatar/Avatar.types").StatusLabels | undefined;
|
61
63
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
62
64
|
//# 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,5 +21,6 @@ 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
|
+
statusLabels?: import("../../../../components/Avatar/Avatar.types").StatusLabels | undefined;
|
24
25
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
25
26
|
//# 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"}
|