@salutejs/plasma-new-hope 0.240.1-canary.1705.12790178134.0 → 0.241.0-canary.1696.12814018283.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/Avatar/Avatar.js +40 -3
- package/cjs/components/Avatar/Avatar.js.map +1 -1
- package/cjs/components/Avatar/Avatar.styles.js +32 -1
- package/cjs/components/Avatar/Avatar.styles.js.map +1 -1
- package/cjs/components/Avatar/Avatar.styles_131qvfx.css +8 -0
- package/cjs/components/Avatar/Avatar.tokens.js +41 -2
- package/cjs/components/Avatar/Avatar.tokens.js.map +1 -1
- package/cjs/components/Avatar/utils/index.js +21 -0
- package/cjs/components/Avatar/utils/index.js.map +1 -0
- package/cjs/components/Combobox/ComboboxOld/Combobox.css +6 -6
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxDivider/ComboboxDivider.css +6 -6
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxFooter/ComboboxFooter.css +6 -6
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxGroup/ComboboxGroup.css +6 -6
- package/cjs/components/Combobox/ComboboxOld/ui/ComboboxHeader/ComboboxHeader.css +6 -6
- package/cjs/components/Dropdown/Dropdown.css +6 -6
- package/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
- package/cjs/components/Dropdown/Dropdown.tokens.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.css +6 -6
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.css +6 -6
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +3 -3
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js.map +1 -1
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles_z6xd28.css +7 -0
- package/cjs/index.css +14 -11
- package/emotion/cjs/components/Avatar/Avatar.js +40 -4
- package/emotion/cjs/components/Avatar/Avatar.styles.js +29 -10
- package/emotion/cjs/components/Avatar/Avatar.template-doc.mdx +54 -0
- package/emotion/cjs/components/Avatar/Avatar.tokens.js +41 -2
- package/emotion/cjs/components/Avatar/utils/index.js +15 -1
- package/emotion/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
- package/emotion/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +8 -8
- package/emotion/cjs/examples/plasma_b2c/components/Avatar/Avatar.config.js +25 -7
- package/emotion/cjs/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +134 -1
- package/emotion/cjs/examples/plasma_web/components/Avatar/Avatar.config.js +25 -7
- package/emotion/cjs/examples/plasma_web/components/Avatar/Avatar.stories.tsx +134 -1
- package/emotion/es/components/Avatar/Avatar.js +42 -6
- package/emotion/es/components/Avatar/Avatar.styles.js +29 -10
- package/emotion/es/components/Avatar/Avatar.template-doc.mdx +54 -0
- package/emotion/es/components/Avatar/Avatar.tokens.js +41 -2
- package/emotion/es/components/Avatar/utils/index.js +14 -1
- package/emotion/es/components/Dropdown/Dropdown.tokens.js +0 -1
- package/emotion/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +8 -8
- package/emotion/es/examples/plasma_b2c/components/Avatar/Avatar.config.js +25 -7
- package/emotion/es/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +134 -1
- package/emotion/es/examples/plasma_web/components/Avatar/Avatar.config.js +25 -7
- package/emotion/es/examples/plasma_web/components/Avatar/Avatar.stories.tsx +134 -1
- package/es/components/Avatar/Avatar.js +41 -4
- package/es/components/Avatar/Avatar.js.map +1 -1
- package/es/components/Avatar/Avatar.styles.js +30 -2
- package/es/components/Avatar/Avatar.styles.js.map +1 -1
- package/es/components/Avatar/Avatar.styles_131qvfx.css +8 -0
- package/es/components/Avatar/Avatar.tokens.js +41 -2
- package/es/components/Avatar/Avatar.tokens.js.map +1 -1
- package/es/components/Avatar/utils/index.js +17 -0
- package/es/components/Avatar/utils/index.js.map +1 -0
- package/es/components/Combobox/ComboboxOld/Combobox.css +6 -6
- package/es/components/Combobox/ComboboxOld/ui/ComboboxDivider/ComboboxDivider.css +6 -6
- package/es/components/Combobox/ComboboxOld/ui/ComboboxFooter/ComboboxFooter.css +6 -6
- package/es/components/Combobox/ComboboxOld/ui/ComboboxGroup/ComboboxGroup.css +6 -6
- package/es/components/Combobox/ComboboxOld/ui/ComboboxHeader/ComboboxHeader.css +6 -6
- package/es/components/Dropdown/Dropdown.css +6 -6
- package/es/components/Dropdown/Dropdown.tokens.js +0 -1
- package/es/components/Dropdown/Dropdown.tokens.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownInner/DropdownInner.css +6 -6
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.css +6 -6
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +3 -3
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js.map +1 -1
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles_z6xd28.css +7 -0
- package/es/index.css +14 -11
- package/package.json +5 -22
- package/styled-components/cjs/components/Avatar/Avatar.js +39 -3
- package/styled-components/cjs/components/Avatar/Avatar.styles.js +18 -2
- package/styled-components/cjs/components/Avatar/Avatar.template-doc.mdx +54 -0
- package/styled-components/cjs/components/Avatar/Avatar.tokens.js +41 -2
- package/styled-components/cjs/components/Avatar/utils/index.js +15 -1
- package/styled-components/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
- package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +2 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Avatar/Avatar.config.js +22 -4
- package/styled-components/cjs/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +134 -1
- package/styled-components/cjs/examples/plasma_web/components/Avatar/Avatar.config.js +22 -4
- package/styled-components/cjs/examples/plasma_web/components/Avatar/Avatar.stories.tsx +134 -1
- package/styled-components/es/components/Avatar/Avatar.js +41 -5
- package/styled-components/es/components/Avatar/Avatar.styles.js +18 -2
- package/styled-components/es/components/Avatar/Avatar.template-doc.mdx +54 -0
- package/styled-components/es/components/Avatar/Avatar.tokens.js +41 -2
- package/styled-components/es/components/Avatar/utils/index.js +14 -1
- package/styled-components/es/components/Dropdown/Dropdown.tokens.js +0 -1
- package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +2 -2
- package/styled-components/es/examples/plasma_b2c/components/Avatar/Avatar.config.js +22 -4
- package/styled-components/es/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +134 -1
- package/styled-components/es/examples/plasma_web/components/Avatar/Avatar.config.js +22 -4
- package/styled-components/es/examples/plasma_web/components/Avatar/Avatar.stories.tsx +134 -1
- package/types/components/Avatar/Avatar.d.ts +3 -21
- package/types/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/components/Avatar/Avatar.styles.d.ts +59 -0
- package/types/components/Avatar/Avatar.styles.d.ts.map +1 -1
- package/types/components/Avatar/Avatar.tokens.d.ts +37 -0
- package/types/components/Avatar/Avatar.tokens.d.ts.map +1 -1
- package/types/components/Avatar/Avatar.types.d.ts +47 -2
- package/types/components/Avatar/Avatar.types.d.ts.map +1 -1
- package/types/components/Avatar/utils/index.d.ts +1 -0
- package/types/components/Avatar/utils/index.d.ts.map +1 -1
- package/types/components/Badge/Badge.types.d.ts +8 -21
- package/types/components/Badge/Badge.types.d.ts.map +1 -1
- package/types/components/Counter/Counter.d.ts +2 -12
- package/types/components/Counter/Counter.d.ts.map +1 -1
- package/types/components/Counter/Counter.types.d.ts +1 -2
- package/types/components/Counter/Counter.types.d.ts.map +1 -1
- package/types/components/Dropdown/Dropdown.tokens.d.ts +0 -1
- package/types/components/Dropdown/Dropdown.tokens.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Avatar/Avatar.config.d.ts +18 -0
- package/types/examples/plasma_b2c/components/Avatar/Avatar.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts +138 -6
- package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Badge/Badge.d.ts +8 -48
- package/types/examples/plasma_b2c/components/Badge/Badge.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Counter/Counter.d.ts +1 -6
- package/types/examples/plasma_b2c/components/Counter/Counter.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Avatar/Avatar.config.d.ts +18 -0
- package/types/examples/plasma_web/components/Avatar/Avatar.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Avatar/Avatar.d.ts +138 -6
- package/types/examples/plasma_web/components/Avatar/Avatar.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Badge/Badge.d.ts +8 -48
- package/types/examples/plasma_web/components/Badge/Badge.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Counter/Counter.d.ts +1 -6
- package/types/examples/plasma_web/components/Counter/Counter.d.ts.map +1 -1
- package/cjs/components/Avatar/Avatar.styles_1gd252x.css +0 -5
- package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles_vp2tis.css +0 -7
- package/es/components/Avatar/Avatar.styles_1gd252x.css +0 -5
- package/es/components/Dropdown/ui/DropdownItem/DropdownItem.styles_vp2tis.css +0 -7
@@ -1,3 +1,4 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import type { ComponentProps } from 'react';
|
2
3
|
import type { StoryObj, Meta } from '@storybook/react';
|
3
4
|
import { disableProps } from '@salutejs/plasma-sb-utils';
|
@@ -6,6 +7,11 @@ import { argTypesFromConfig, WithTheme } from '../../../_helpers';
|
|
6
7
|
|
7
8
|
import { Avatar, mergedConfig } from './Avatar';
|
8
9
|
|
10
|
+
const extraPlacements = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
|
11
|
+
const extraType = ['', 'badge', 'counter'];
|
12
|
+
const counterViews = ['default', 'accent', 'positive', 'warning', 'negative', 'dark', 'light'];
|
13
|
+
const badgeViews = ['default', 'accent', 'positive', 'warning', 'negative', 'dark', 'light'];
|
14
|
+
|
9
15
|
const meta: Meta<typeof Avatar> = {
|
10
16
|
title: 'b2c/Data Display/Avatar',
|
11
17
|
decorators: [WithTheme],
|
@@ -13,12 +19,69 @@ const meta: Meta<typeof Avatar> = {
|
|
13
19
|
argTypes: {
|
14
20
|
...argTypesFromConfig(mergedConfig),
|
15
21
|
status: { control: 'select', options: ['active', 'inactive'] },
|
22
|
+
type: {
|
23
|
+
control: 'select',
|
24
|
+
options: extraType,
|
25
|
+
if: { arg: 'hasExtra', truthy: true },
|
26
|
+
},
|
27
|
+
extraPlacement: {
|
28
|
+
control: 'select',
|
29
|
+
options: extraPlacements,
|
30
|
+
if: { arg: 'hasExtra', truthy: true },
|
31
|
+
},
|
32
|
+
counterView: {
|
33
|
+
control: 'select',
|
34
|
+
options: counterViews,
|
35
|
+
if: { arg: 'type', eq: 'counter' },
|
36
|
+
},
|
37
|
+
count: {
|
38
|
+
control: 'number',
|
39
|
+
if: { arg: 'type', eq: 'counter' },
|
40
|
+
},
|
41
|
+
maxCount: {
|
42
|
+
control: 'number',
|
43
|
+
if: { arg: 'type', eq: 'counter' },
|
44
|
+
},
|
45
|
+
badgeView: {
|
46
|
+
control: 'select',
|
47
|
+
options: badgeViews,
|
48
|
+
if: { arg: 'type', eq: 'badge' },
|
49
|
+
},
|
50
|
+
text: {
|
51
|
+
control: 'text',
|
52
|
+
if: { arg: 'type', eq: 'badge' },
|
53
|
+
},
|
54
|
+
customColor: {
|
55
|
+
control: 'color',
|
56
|
+
if: { arg: 'type', eq: 'badge' },
|
57
|
+
},
|
58
|
+
customBackgroundColor: {
|
59
|
+
control: 'color',
|
60
|
+
if: { arg: 'type', eq: 'badge' },
|
61
|
+
},
|
62
|
+
pilled: {
|
63
|
+
control: 'boolean',
|
64
|
+
if: { arg: 'type', eq: 'badge' },
|
65
|
+
},
|
16
66
|
},
|
17
67
|
};
|
18
68
|
|
19
69
|
export default meta;
|
20
70
|
|
21
|
-
type
|
71
|
+
type StoryProps = ComponentProps<typeof Avatar> & {
|
72
|
+
enableContentLeft: boolean;
|
73
|
+
enableContentRight: boolean;
|
74
|
+
};
|
75
|
+
type Story = StoryObj<StoryProps>;
|
76
|
+
|
77
|
+
const BellIcon = (props) => (
|
78
|
+
<svg width="100%" viewBox="0 0 24 24" fill="none" {...props}>
|
79
|
+
<path
|
80
|
+
d="M11.501 21.28c1.088 0 1.978-.889 1.978-1.977H9.524c0 1.088.88 1.978 1.977 1.978zm5.933-5.932v-4.944c0-3.035-1.622-5.576-4.45-6.248v-.673c0-.82-.662-1.483-1.483-1.483-.82 0-1.483.662-1.483 1.483v.672c-2.838.673-4.45 3.204-4.45 6.25v4.943l-1.275 1.276c-.623.623-.188 1.69.692 1.69h13.022c.88 0 1.325-1.067.702-1.69l-1.275-1.276z"
|
81
|
+
fill="currentColor"
|
82
|
+
/>
|
83
|
+
</svg>
|
84
|
+
);
|
22
85
|
|
23
86
|
export const Default: Story = {
|
24
87
|
args: {
|
@@ -27,10 +90,56 @@ export const Default: Story = {
|
|
27
90
|
name: 'Иван Фадеев',
|
28
91
|
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
29
92
|
isScalable: false,
|
93
|
+
hasExtra: false,
|
94
|
+
extraPlacement: 'top-right',
|
95
|
+
type: undefined,
|
96
|
+
counterView: 'accent',
|
97
|
+
count: 3,
|
98
|
+
maxCount: 10,
|
99
|
+
badgeView: 'accent',
|
100
|
+
text: '31',
|
101
|
+
pilled: true,
|
102
|
+
enableContentLeft: false,
|
103
|
+
enableContentRight: false,
|
30
104
|
},
|
31
105
|
argTypes: {
|
106
|
+
enableContentLeft: {
|
107
|
+
control: { type: 'boolean' },
|
108
|
+
if: { arg: 'type', eq: 'badge' },
|
109
|
+
},
|
110
|
+
enableContentRight: {
|
111
|
+
control: { type: 'boolean' },
|
112
|
+
if: { arg: 'type', eq: 'badge' },
|
113
|
+
},
|
32
114
|
...disableProps(['focused']),
|
33
115
|
},
|
116
|
+
render: ({ enableContentLeft, enableContentRight, size, ...rest }: StoryProps) => {
|
117
|
+
const iconSize = () => {
|
118
|
+
switch (size) {
|
119
|
+
case 'xxl':
|
120
|
+
return '1rem';
|
121
|
+
case 'm':
|
122
|
+
return '0.625rem';
|
123
|
+
default:
|
124
|
+
return '0.75rem';
|
125
|
+
}
|
126
|
+
};
|
127
|
+
|
128
|
+
return (
|
129
|
+
<>
|
130
|
+
<Avatar
|
131
|
+
contentLeft={enableContentLeft ? <BellIcon width={iconSize()} height={iconSize()} /> : undefined}
|
132
|
+
contentRight={
|
133
|
+
!enableContentLeft && enableContentRight ? (
|
134
|
+
<BellIcon width={iconSize()} height={iconSize()} />
|
135
|
+
) : undefined
|
136
|
+
}
|
137
|
+
size={size}
|
138
|
+
{...rest}
|
139
|
+
/>
|
140
|
+
</>
|
141
|
+
);
|
142
|
+
},
|
34
143
|
};
|
35
144
|
|
36
145
|
export const Accessibility: Story = {
|
@@ -42,6 +151,14 @@ export const Accessibility: Story = {
|
|
42
151
|
size: 'xxl',
|
43
152
|
status: 'active',
|
44
153
|
focused: true,
|
154
|
+
hasExtra: false,
|
155
|
+
extraPlacement: 'top-right',
|
156
|
+
type: undefined,
|
157
|
+
counterView: 'accent',
|
158
|
+
count: 3,
|
159
|
+
maxCount: 10,
|
160
|
+
badgeView: 'accent',
|
161
|
+
text: '31',
|
45
162
|
},
|
46
163
|
};
|
47
164
|
|
@@ -55,6 +172,14 @@ export const AccessibilityWithURL: Story = {
|
|
55
172
|
focused: true,
|
56
173
|
name: 'Микула Селянинович',
|
57
174
|
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
175
|
+
hasExtra: false,
|
176
|
+
extraPlacement: 'top-right',
|
177
|
+
type: undefined,
|
178
|
+
counterView: 'accent',
|
179
|
+
count: 3,
|
180
|
+
maxCount: 10,
|
181
|
+
badgeView: 'accent',
|
182
|
+
text: '31',
|
58
183
|
},
|
59
184
|
};
|
60
185
|
|
@@ -67,5 +192,13 @@ export const AccessibilityWithCustomText: Story = {
|
|
67
192
|
status: 'inactive',
|
68
193
|
focused: true,
|
69
194
|
customText: 'ФИО',
|
195
|
+
hasExtra: false,
|
196
|
+
extraPlacement: 'top-right',
|
197
|
+
type: undefined,
|
198
|
+
counterView: 'accent',
|
199
|
+
count: 3,
|
200
|
+
maxCount: 10,
|
201
|
+
badgeView: 'accent',
|
202
|
+
text: '31',
|
70
203
|
},
|
71
204
|
};
|
@@ -10,14 +10,32 @@ export var config = {
|
|
10
10
|
"default": /*#__PURE__*/css(["", ":var(--text-accent-gradient);", ":linear-gradient(94deg,rgba(62,121,240,0.2) 6.49%,rgba(39,198,229,0.2) 93.51%);", ":var(--surface-positive);", ":var(--surface-solid-tertiary);", ":1.02;"], tokens.color, tokens.backgroundColor, tokens.statusOnlineColor, tokens.statusOfflineColor, tokens.scaleHover)
|
11
11
|
},
|
12
12
|
size: {
|
13
|
-
xxl: /*#__PURE__*/css(["", ":6.25rem;", ":2rem;", ":600;", ":2rem;", ":0.75rem;"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize),
|
14
|
-
l: /*#__PURE__*/css(["", ":3rem;", ":1.25rem;", ":600;", ":1.25rem;", ":0.5rem;"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize),
|
15
|
-
m: /*#__PURE__*/css(["", ":2.25rem;", ":0.875rem;", ":600;", ":0.875rem;", ":0.5rem;"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize),
|
16
|
-
s: /*#__PURE__*/css(["", ":1.5rem;", ":0.5rem;", ":600;", ":0.5rem;", ":0.375rem;"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize),
|
13
|
+
xxl: /*#__PURE__*/css(["", ":6.25rem;", ":2rem;", ":600;", ":2rem;", ":0.75rem;", ":0.5rem;", ":1.75rem;", ":0 0.6875rem;", ":0 0.375rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":-0.0625rem;", ":0.25rem;", ":0.25rem;", ":-0.0625rem;", ":1.25rem;", ":1rem;", ":1.75rem;", ":0 0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize, tokens.badgeBorderRadius, tokens.badgeHeight, tokens.badgePadding, tokens.badgePaddingIconOnly, tokens.badgeFontFamily, tokens.badgeFontSize, tokens.badgeFontStyle, tokens.badgeFontWeight, tokens.badgeLetterSpacing, tokens.badgeLineHeight, tokens.badgeLeftContentMarginLeft, tokens.badgeLeftContentMarginRight, tokens.badgeRightContentMarginLeft, tokens.badgeRightContentMarginRight, tokens.badgePilledBorderRadius, tokens.counterBorderRadius, tokens.counterHeight, tokens.counterPadding, tokens.counterFontFamily, tokens.counterFontSize, tokens.counterFontStyle, tokens.counterFontWeight, tokens.counterLetterSpacing, tokens.counterLineHeight),
|
14
|
+
l: /*#__PURE__*/css(["", ":3rem;", ":1.25rem;", ":600;", ":1.25rem;", ":0.5rem;", ":2;", ":0.375rem;", ":1.25rem;", ":0 0.4375rem;", ":0 0.25rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);", ":-0.0625rem;", ":0.125rem;", ":0.125rem;", ":-0.0625rem;", ":1.25rem;", ":1rem;", ":1.25rem;", ":0 0.375rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize, tokens.extraPlacementFactor, tokens.badgeBorderRadius, tokens.badgeHeight, tokens.badgePadding, tokens.badgePaddingIconOnly, tokens.badgeFontFamily, tokens.badgeFontSize, tokens.badgeFontStyle, tokens.badgeFontWeight, tokens.badgeLetterSpacing, tokens.badgeLineHeight, tokens.badgeLeftContentMarginLeft, tokens.badgeLeftContentMarginRight, tokens.badgeRightContentMarginLeft, tokens.badgeRightContentMarginRight, tokens.badgePilledBorderRadius, tokens.counterBorderRadius, tokens.counterHeight, tokens.counterPadding, tokens.counterFontFamily, tokens.counterFontSize, tokens.counterFontStyle, tokens.counterFontWeight, tokens.counterLetterSpacing, tokens.counterLineHeight),
|
15
|
+
m: /*#__PURE__*/css(["", ":2.25rem;", ":0.875rem;", ":600;", ":0.875rem;", ":0.5rem;", ":2;", ":0.25rem;", ":1rem;", ":0 0.25rem;", ":0 0.188rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);", ":-0.0625rem;", ":0.125rem;", ":0.125rem;", ":-0.0625rem;", ":1.25rem;", ":1rem;", ":1rem;", ":0 0.25rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize, tokens.extraPlacementFactor, tokens.badgeBorderRadius, tokens.badgeHeight, tokens.badgePadding, tokens.badgePaddingIconOnly, tokens.badgeFontFamily, tokens.badgeFontSize, tokens.badgeFontStyle, tokens.badgeFontWeight, tokens.badgeLetterSpacing, tokens.badgeLineHeight, tokens.badgeLeftContentMarginLeft, tokens.badgeLeftContentMarginRight, tokens.badgeRightContentMarginLeft, tokens.badgeRightContentMarginRight, tokens.badgePilledBorderRadius, tokens.counterBorderRadius, tokens.counterHeight, tokens.counterPadding, tokens.counterFontFamily, tokens.counterFontSize, tokens.counterFontStyle, tokens.counterFontWeight, tokens.counterLetterSpacing, tokens.counterLineHeight),
|
16
|
+
s: /*#__PURE__*/css(["", ":1.5rem;", ":0.5rem;", ":600;", ":0.5rem;", ":0.375rem;", ":1;", ":1rem;", ":0.75rem;", ":0 0.125rem;", ":var(--plasma-typo-body-xxs-font-family);", ":var(--plasma-typo-body-xxs-font-size);", ":var(--plasma-typo-body-xxs-font-style);", ":var(--plasma-typo-body-xxs-font-weight);", ":var(--plasma-typo-body-xxs-letter-spacing);", ":var(--plasma-typo-body-xxs-line-height);"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize, tokens.extraPlacementFactor, tokens.counterBorderRadius, tokens.counterHeight, tokens.counterPadding, tokens.counterFontFamily, tokens.counterFontSize, tokens.counterFontStyle, tokens.counterFontWeight, tokens.counterLetterSpacing, tokens.counterLineHeight),
|
17
17
|
fit: /*#__PURE__*/css(["", ":100%;", ":0;", ":0;", ":0;", ":0;"], tokens.avatarSize, tokens.fontSize, tokens.fontWeight, tokens.lineHeight, tokens.statusIconSize)
|
18
18
|
},
|
19
19
|
focused: {
|
20
20
|
"true": /*#__PURE__*/css(["", ":0.1rem;", ":-0.2rem;", ":var(--surface-accent);"], tokens.outlineSize, tokens.outlineOffset, tokens.outlineColor)
|
21
|
+
},
|
22
|
+
badgeView: {
|
23
|
+
"default": /*#__PURE__*/css(["", ":var(--inverse-text-primary);", ":var(--surface-solid-default);", ":var(--text-primary);", ":var(--surface-transparent-secondary);", ":var(--text-primary);", ":var(--surface-clear);"], tokens.badgeColor, tokens.badgeBackground, tokens.badgeColorTransparent, tokens.badgeBackgroundTransparent, tokens.badgeColorClear, tokens.badgeBackgroundClear),
|
24
|
+
accent: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--surface-accent);", ":var(--text-accent);", ":var(--surface-transparent-accent);", ":var(--text-accent);", ":var(--surface-clear)"], tokens.badgeColor, tokens.badgeBackground, tokens.badgeColorTransparent, tokens.badgeBackgroundTransparent, tokens.badgeColorClear, tokens.badgeBackgroundClear),
|
25
|
+
positive: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--surface-positive);", ":var(--text-positive);", ":var(--surface-transparent-positive);", ":var(--text-positive);", ":var(--surface-clear)"], tokens.badgeColor, tokens.badgeBackground, tokens.badgeColorTransparent, tokens.badgeBackgroundTransparent, tokens.badgeColorClear, tokens.badgeBackgroundClear),
|
26
|
+
warning: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--surface-warning);", ":var(--text-warning);", ":var(--surface-transparent-warning);", ":var(--text-warning);", ":var(--surface-clear)"], tokens.badgeColor, tokens.badgeBackground, tokens.badgeColorTransparent, tokens.badgeBackgroundTransparent, tokens.badgeColorClear, tokens.badgeBackgroundClear),
|
27
|
+
negative: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--surface-negative);", ":var(--text-negative);", ":var(--surface-transparent-negative);", ":var(--text-negative);", ":var(--surface-clear)"], tokens.badgeColor, tokens.badgeBackground, tokens.badgeColorTransparent, tokens.badgeBackgroundTransparent, tokens.badgeColorClear, tokens.badgeBackgroundClear),
|
28
|
+
dark: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--on-light-surface-solid-default);", ":var(--on-dark-text-primary);", ":var(--on-light-surface-transparent-deep);", ":var(--on-light-text-pri ", ":var(--surface-clear)mary);"], tokens.badgeColor, tokens.badgeBackground, tokens.badgeColorTransparent, tokens.badgeBackgroundTransparent, tokens.badgeColorClear, tokens.badgeBackgroundClear),
|
29
|
+
light: /*#__PURE__*/css(["", ":var(--on-light-text-primary);", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-text-primary);", ":var(--on-dark-surface-transparent-card);", ":var(--on-dark-text-prima ", ":var(--surface-clear)ry);"], tokens.badgeColor, tokens.badgeBackground, tokens.badgeColorTransparent, tokens.badgeBackgroundTransparent, tokens.badgeColorClear, tokens.badgeBackgroundClear)
|
30
|
+
},
|
31
|
+
counterView: {
|
32
|
+
"default": /*#__PURE__*/css(["", ":var(--inverse-text-primary);", ":var(--surface-solid-default);"], tokens.counterColor, tokens.counterBackground),
|
33
|
+
accent: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--surface-accent);"], tokens.counterColor, tokens.counterBackground),
|
34
|
+
positive: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--surface-positive);"], tokens.counterColor, tokens.counterBackground),
|
35
|
+
warning: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--surface-warning);"], tokens.counterColor, tokens.counterBackground),
|
36
|
+
negative: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--surface-negative);"], tokens.counterColor, tokens.counterBackground),
|
37
|
+
dark: /*#__PURE__*/css(["", ":var(--on-dark-text-primary);", ":var(--on-light-surface-solid-default);"], tokens.counterColor, tokens.counterBackground),
|
38
|
+
light: /*#__PURE__*/css(["", ":var(--on-light-text-primary);", ":var(--on-dark-surface-solid-default);"], tokens.counterColor, tokens.counterBackground)
|
21
39
|
}
|
22
40
|
}
|
23
41
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import type { ComponentProps } from 'react';
|
2
3
|
import type { StoryObj, Meta } from '@storybook/react';
|
3
4
|
import { disableProps } from '@salutejs/plasma-sb-utils';
|
@@ -6,6 +7,11 @@ import { argTypesFromConfig, WithTheme } from '../../../_helpers';
|
|
6
7
|
|
7
8
|
import { Avatar, mergedConfig } from './Avatar';
|
8
9
|
|
10
|
+
const extraPlacements = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
|
11
|
+
const extraType = ['', 'badge', 'counter'];
|
12
|
+
const counterViews = ['default', 'accent', 'positive', 'warning', 'negative', 'dark', 'light'];
|
13
|
+
const badgeViews = ['default', 'accent', 'positive', 'warning', 'negative', 'dark', 'light'];
|
14
|
+
|
9
15
|
const meta: Meta<typeof Avatar> = {
|
10
16
|
title: 'web/Data Display/Avatar',
|
11
17
|
decorators: [WithTheme],
|
@@ -13,12 +19,69 @@ const meta: Meta<typeof Avatar> = {
|
|
13
19
|
argTypes: {
|
14
20
|
...argTypesFromConfig(mergedConfig),
|
15
21
|
status: { control: 'select', options: ['active', 'inactive'] },
|
22
|
+
type: {
|
23
|
+
control: 'select',
|
24
|
+
options: extraType,
|
25
|
+
if: { arg: 'hasExtra', truthy: true },
|
26
|
+
},
|
27
|
+
extraPlacement: {
|
28
|
+
control: 'select',
|
29
|
+
options: extraPlacements,
|
30
|
+
if: { arg: 'hasExtra', truthy: true },
|
31
|
+
},
|
32
|
+
counterView: {
|
33
|
+
control: 'select',
|
34
|
+
options: counterViews,
|
35
|
+
if: { arg: 'type', eq: 'counter' },
|
36
|
+
},
|
37
|
+
count: {
|
38
|
+
control: 'number',
|
39
|
+
if: { arg: 'type', eq: 'counter' },
|
40
|
+
},
|
41
|
+
maxCount: {
|
42
|
+
control: 'number',
|
43
|
+
if: { arg: 'type', eq: 'counter' },
|
44
|
+
},
|
45
|
+
badgeView: {
|
46
|
+
control: 'select',
|
47
|
+
options: badgeViews,
|
48
|
+
if: { arg: 'type', eq: 'badge' },
|
49
|
+
},
|
50
|
+
text: {
|
51
|
+
control: 'text',
|
52
|
+
if: { arg: 'type', eq: 'badge' },
|
53
|
+
},
|
54
|
+
customColor: {
|
55
|
+
control: 'color',
|
56
|
+
if: { arg: 'type', eq: 'badge' },
|
57
|
+
},
|
58
|
+
customBackgroundColor: {
|
59
|
+
control: 'color',
|
60
|
+
if: { arg: 'type', eq: 'badge' },
|
61
|
+
},
|
62
|
+
pilled: {
|
63
|
+
control: 'boolean',
|
64
|
+
if: { arg: 'type', eq: 'badge' },
|
65
|
+
},
|
16
66
|
},
|
17
67
|
};
|
18
68
|
|
19
69
|
export default meta;
|
20
70
|
|
21
|
-
type
|
71
|
+
type StoryProps = ComponentProps<typeof Avatar> & {
|
72
|
+
enableContentLeft: boolean;
|
73
|
+
enableContentRight: boolean;
|
74
|
+
};
|
75
|
+
type Story = StoryObj<StoryProps>;
|
76
|
+
|
77
|
+
const BellIcon = (props) => (
|
78
|
+
<svg width="100%" viewBox="0 0 24 24" fill="none" {...props}>
|
79
|
+
<path
|
80
|
+
d="M11.501 21.28c1.088 0 1.978-.889 1.978-1.977H9.524c0 1.088.88 1.978 1.977 1.978zm5.933-5.932v-4.944c0-3.035-1.622-5.576-4.45-6.248v-.673c0-.82-.662-1.483-1.483-1.483-.82 0-1.483.662-1.483 1.483v.672c-2.838.673-4.45 3.204-4.45 6.25v4.943l-1.275 1.276c-.623.623-.188 1.69.692 1.69h13.022c.88 0 1.325-1.067.702-1.69l-1.275-1.276z"
|
81
|
+
fill="currentColor"
|
82
|
+
/>
|
83
|
+
</svg>
|
84
|
+
);
|
22
85
|
|
23
86
|
export const Default: Story = {
|
24
87
|
args: {
|
@@ -27,10 +90,56 @@ export const Default: Story = {
|
|
27
90
|
name: 'Иван Фадеев',
|
28
91
|
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
29
92
|
isScalable: false,
|
93
|
+
hasExtra: false,
|
94
|
+
extraPlacement: 'top-right',
|
95
|
+
type: undefined,
|
96
|
+
counterView: 'accent',
|
97
|
+
count: 3,
|
98
|
+
maxCount: 10,
|
99
|
+
badgeView: 'accent',
|
100
|
+
text: '31',
|
101
|
+
pilled: true,
|
102
|
+
enableContentLeft: false,
|
103
|
+
enableContentRight: false,
|
30
104
|
},
|
31
105
|
argTypes: {
|
106
|
+
enableContentLeft: {
|
107
|
+
control: { type: 'boolean' },
|
108
|
+
if: { arg: 'type', eq: 'badge' },
|
109
|
+
},
|
110
|
+
enableContentRight: {
|
111
|
+
control: { type: 'boolean' },
|
112
|
+
if: { arg: 'type', eq: 'badge' },
|
113
|
+
},
|
32
114
|
...disableProps(['focused']),
|
33
115
|
},
|
116
|
+
render: ({ enableContentLeft, enableContentRight, size, ...rest }: StoryProps) => {
|
117
|
+
const iconSize = () => {
|
118
|
+
switch (size) {
|
119
|
+
case 'xxl':
|
120
|
+
return '1rem';
|
121
|
+
case 'm':
|
122
|
+
return '0.625rem';
|
123
|
+
default:
|
124
|
+
return '0.75rem';
|
125
|
+
}
|
126
|
+
};
|
127
|
+
|
128
|
+
return (
|
129
|
+
<>
|
130
|
+
<Avatar
|
131
|
+
contentLeft={enableContentLeft ? <BellIcon width={iconSize()} height={iconSize()} /> : undefined}
|
132
|
+
contentRight={
|
133
|
+
!enableContentLeft && enableContentRight ? (
|
134
|
+
<BellIcon width={iconSize()} height={iconSize()} />
|
135
|
+
) : undefined
|
136
|
+
}
|
137
|
+
size={size}
|
138
|
+
{...rest}
|
139
|
+
/>
|
140
|
+
</>
|
141
|
+
);
|
142
|
+
},
|
34
143
|
};
|
35
144
|
|
36
145
|
export const Accessibility: Story = {
|
@@ -42,6 +151,14 @@ export const Accessibility: Story = {
|
|
42
151
|
size: 'xxl',
|
43
152
|
status: 'active',
|
44
153
|
focused: true,
|
154
|
+
hasExtra: false,
|
155
|
+
extraPlacement: 'top-right',
|
156
|
+
type: undefined,
|
157
|
+
counterView: 'accent',
|
158
|
+
count: 3,
|
159
|
+
maxCount: 10,
|
160
|
+
badgeView: 'accent',
|
161
|
+
text: '31',
|
45
162
|
},
|
46
163
|
};
|
47
164
|
|
@@ -55,6 +172,14 @@ export const AccessibilityWithURL: Story = {
|
|
55
172
|
focused: true,
|
56
173
|
name: 'Микула Селянинович',
|
57
174
|
url: 'https://avatars.githubusercontent.com/u/1813468?v=4',
|
175
|
+
hasExtra: false,
|
176
|
+
extraPlacement: 'top-right',
|
177
|
+
type: undefined,
|
178
|
+
counterView: 'accent',
|
179
|
+
count: 3,
|
180
|
+
maxCount: 10,
|
181
|
+
badgeView: 'accent',
|
182
|
+
text: '31',
|
58
183
|
},
|
59
184
|
};
|
60
185
|
|
@@ -67,5 +192,13 @@ export const AccessibilityWithCustomText: Story = {
|
|
67
192
|
status: 'inactive',
|
68
193
|
focused: true,
|
69
194
|
customText: 'ФИО',
|
195
|
+
hasExtra: false,
|
196
|
+
extraPlacement: 'top-right',
|
197
|
+
type: undefined,
|
198
|
+
counterView: 'accent',
|
199
|
+
count: 3,
|
200
|
+
maxCount: 10,
|
201
|
+
badgeView: 'accent',
|
202
|
+
text: '31',
|
70
203
|
},
|
71
204
|
};
|
@@ -1,29 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { RootProps } from '../../engines';
|
3
|
-
import type { AvatarProps
|
4
|
-
export declare const avatarRoot: (Root: RootProps<HTMLDivElement, AvatarProps>) => React.ForwardRefExoticComponent<React.
|
5
|
-
size: "m" | "s" | "l" | "xxl" | "fit";
|
6
|
-
name?: string | undefined;
|
7
|
-
url?: string | undefined;
|
8
|
-
customText?: string | undefined;
|
9
|
-
status?: "active" | "inactive" | undefined;
|
10
|
-
isScalable?: boolean | undefined;
|
11
|
-
focused?: boolean | undefined;
|
12
|
-
statusLabels?: StatusLabels | undefined;
|
13
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
3
|
+
import type { AvatarProps } from './Avatar.types';
|
4
|
+
export declare const avatarRoot: (Root: RootProps<HTMLDivElement, AvatarProps>) => React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
|
14
5
|
export declare const avatarConfig: {
|
15
6
|
name: string;
|
16
7
|
tag: string;
|
17
|
-
layout: (Root: RootProps<HTMLDivElement, AvatarProps>) => React.ForwardRefExoticComponent<React.
|
18
|
-
size: "m" | "s" | "l" | "xxl" | "fit";
|
19
|
-
name?: string | undefined;
|
20
|
-
url?: string | undefined;
|
21
|
-
customText?: string | undefined;
|
22
|
-
status?: "active" | "inactive" | undefined;
|
23
|
-
isScalable?: boolean | undefined;
|
24
|
-
focused?: boolean | undefined;
|
25
|
-
statusLabels?: StatusLabels | undefined;
|
26
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
8
|
+
layout: (Root: RootProps<HTMLDivElement, AvatarProps>) => React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
|
27
9
|
base: import("@linaria/core").LinariaClassName;
|
28
10
|
variations: {
|
29
11
|
size: {
|
@@ -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,
|
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,EAAgB,MAAM,gBAAgB,CAAC;AAuDhE,eAAO,MAAM,UAAU,SAAU,UAAU,cAAc,EAAE,WAAW,CAAC,uFAiFtE,CAAC;AAEF,eAAO,MAAM,YAAY;;;mBAnFQ,UAAU,cAAc,EAAE,WAAW,CAAC;;;;;;;;;;;;;CAmGtE,CAAC"}
|
@@ -7,4 +7,63 @@ export declare const Wrapper: import("@linaria/react").StyledComponent<import("r
|
|
7
7
|
export declare const StatusIcon: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
8
8
|
export declare const Image: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
|
9
9
|
export declare const Text: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
10
|
+
export declare const ExtraContent: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
11
|
+
export declare const ExtraBadge: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("../../engines/types").PropsType<import("../../engines/types").Variants> & ((import("react").HTMLAttributes<HTMLDivElement> & {
|
12
|
+
text?: string | undefined;
|
13
|
+
customColor?: string | undefined;
|
14
|
+
customBackgroundColor?: string | undefined;
|
15
|
+
maxWidth?: import("csstype").Property.Width<string | number> | undefined;
|
16
|
+
size?: string | undefined;
|
17
|
+
view?: string | undefined;
|
18
|
+
} & {
|
19
|
+
contentLeft?: import("react").ReactNode;
|
20
|
+
contentRight?: undefined;
|
21
|
+
} & {
|
22
|
+
clear?: true | undefined;
|
23
|
+
pilled?: undefined;
|
24
|
+
transparent?: undefined;
|
25
|
+
} & import("react").RefAttributes<HTMLDivElement>) | (import("react").HTMLAttributes<HTMLDivElement> & {
|
26
|
+
text?: string | undefined;
|
27
|
+
customColor?: string | undefined;
|
28
|
+
customBackgroundColor?: string | undefined;
|
29
|
+
maxWidth?: import("csstype").Property.Width<string | number> | undefined;
|
30
|
+
size?: string | undefined;
|
31
|
+
view?: string | undefined;
|
32
|
+
} & {
|
33
|
+
contentLeft?: import("react").ReactNode;
|
34
|
+
contentRight?: undefined;
|
35
|
+
} & {
|
36
|
+
pilled?: boolean | undefined;
|
37
|
+
transparent?: boolean | undefined;
|
38
|
+
clear?: undefined;
|
39
|
+
} & import("react").RefAttributes<HTMLDivElement>) | (import("react").HTMLAttributes<HTMLDivElement> & {
|
40
|
+
text?: string | undefined;
|
41
|
+
customColor?: string | undefined;
|
42
|
+
customBackgroundColor?: string | undefined;
|
43
|
+
maxWidth?: import("csstype").Property.Width<string | number> | undefined;
|
44
|
+
size?: string | undefined;
|
45
|
+
view?: string | undefined;
|
46
|
+
} & {
|
47
|
+
contentLeft?: undefined;
|
48
|
+
contentRight?: import("react").ReactNode;
|
49
|
+
} & {
|
50
|
+
clear?: true | undefined;
|
51
|
+
pilled?: undefined;
|
52
|
+
transparent?: undefined;
|
53
|
+
} & import("react").RefAttributes<HTMLDivElement>) | (import("react").HTMLAttributes<HTMLDivElement> & {
|
54
|
+
text?: string | undefined;
|
55
|
+
customColor?: string | undefined;
|
56
|
+
customBackgroundColor?: string | undefined;
|
57
|
+
maxWidth?: import("csstype").Property.Width<string | number> | undefined;
|
58
|
+
size?: string | undefined;
|
59
|
+
view?: string | undefined;
|
60
|
+
} & {
|
61
|
+
contentLeft?: undefined;
|
62
|
+
contentRight?: import("react").ReactNode;
|
63
|
+
} & {
|
64
|
+
pilled?: boolean | undefined;
|
65
|
+
transparent?: boolean | undefined;
|
66
|
+
clear?: undefined;
|
67
|
+
} & import("react").RefAttributes<HTMLDivElement>))>;
|
68
|
+
export declare const ExtraCounter: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("../../engines/types").PropsType<import("../../engines/types").Variants> & import("react").HTMLAttributes<HTMLDivElement> & import("../Counter/Counter.types").CustomCounterProps & import("react").RefAttributes<HTMLDivElement>>;
|
10
69
|
//# sourceMappingURL=Avatar.styles.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.styles.ts"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"Avatar.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.styles.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7C,eAAO,MAAM,IAAI,0CAEhB,CAAC;AAEF,eAAO,MAAM,OAAO;iBAA6B,WAAW,CAAC,YAAY,CAAC;EAczE,CAAC;AAEF,eAAO,MAAM,UAAU,qKAItB,CAAC;AAEF,eAAO,MAAM,KAAK,4KAIjB,CAAC;AAEF,eAAO,MAAM,IAAI,uKAUhB,CAAC;AAEF,eAAO,MAAM,YAAY,qKA0BxB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAsBtB,CAAC;AAEF,eAAO,MAAM,YAAY,mTAYxB,CAAC"}
|
@@ -1,5 +1,9 @@
|
|
1
1
|
export declare const classes: {
|
2
2
|
avatarItem: string;
|
3
|
+
extraPlacementTopRight: string;
|
4
|
+
extraPlacementTopLeft: string;
|
5
|
+
extraPlacementBottomLeft: string;
|
6
|
+
extraPlacementBottomRight: string;
|
3
7
|
};
|
4
8
|
export declare const tokens: {
|
5
9
|
avatarSize: string;
|
@@ -16,5 +20,38 @@ export declare const tokens: {
|
|
16
20
|
outlineSize: string;
|
17
21
|
outlineOffset: string;
|
18
22
|
scaleHover: string;
|
23
|
+
extraPlacementFactor: string;
|
24
|
+
badgeBackground: string;
|
25
|
+
badgeColor: string;
|
26
|
+
badgeBackgroundTransparent: string;
|
27
|
+
badgeColorTransparent: string;
|
28
|
+
badgeColorClear: string;
|
29
|
+
badgeBackgroundClear: string;
|
30
|
+
badgeBorderRadius: string;
|
31
|
+
badgePilledBorderRadius: string;
|
32
|
+
badgeHeight: string;
|
33
|
+
badgePadding: string;
|
34
|
+
badgePaddingIconOnly: string;
|
35
|
+
badgeFontFamily: string;
|
36
|
+
badgeFontSize: string;
|
37
|
+
badgeFontStyle: string;
|
38
|
+
badgeFontWeight: string;
|
39
|
+
badgeLetterSpacing: string;
|
40
|
+
badgeLineHeight: string;
|
41
|
+
badgeLeftContentMarginLeft: string;
|
42
|
+
badgeLeftContentMarginRight: string;
|
43
|
+
badgeRightContentMarginLeft: string;
|
44
|
+
badgeRightContentMarginRight: string;
|
45
|
+
counterBackground: string;
|
46
|
+
counterColor: string;
|
47
|
+
counterBorderRadius: string;
|
48
|
+
counterHeight: string;
|
49
|
+
counterPadding: string;
|
50
|
+
counterFontFamily: string;
|
51
|
+
counterFontSize: string;
|
52
|
+
counterFontStyle: string;
|
53
|
+
counterFontWeight: string;
|
54
|
+
counterLetterSpacing: string;
|
55
|
+
counterLineHeight: string;
|
19
56
|
};
|
20
57
|
//# sourceMappingURL=Avatar.tokens.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Avatar.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO
|
1
|
+
{"version":3,"file":"Avatar.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;CAMnB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDlB,CAAC"}
|
@@ -1,6 +1,39 @@
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
2
|
+
import type { CustomCounterProps } from '../Counter/Counter.types';
|
3
|
+
import type { CustomBadgeProps } from '../Badge/Badge.types';
|
4
|
+
declare type Only<T, U> = {
|
5
|
+
[P in keyof T]: T[P];
|
6
|
+
} & {
|
7
|
+
[P in keyof U]?: never;
|
8
|
+
};
|
9
|
+
declare type OneOf<T, U> = Only<T, U> | Only<U, T>;
|
10
|
+
declare type ExtraBadgeProps = {
|
11
|
+
/**
|
12
|
+
* Вид Badge
|
13
|
+
* @default
|
14
|
+
* default
|
15
|
+
*/
|
16
|
+
badgeView?: string;
|
17
|
+
/**
|
18
|
+
* Компонент c округлым border-radius
|
19
|
+
*/
|
20
|
+
pilled?: boolean;
|
21
|
+
} & Omit<CustomBadgeProps, 'size' | 'view' | 'maxWidth'>;
|
22
|
+
declare type ExtraCounterProps = {
|
23
|
+
/**
|
24
|
+
* Вид Counter
|
25
|
+
* @default
|
26
|
+
* default
|
27
|
+
*/
|
28
|
+
counterView?: string;
|
29
|
+
/**
|
30
|
+
* Отображаемое число. Не может быть меньше 1.
|
31
|
+
*/
|
32
|
+
count?: number;
|
33
|
+
} & Omit<CustomCounterProps, 'size' | 'view' | 'count'>;
|
34
|
+
declare type ExtraProps = OneOf<ExtraBadgeProps, ExtraCounterProps>;
|
2
35
|
declare type CustomAvatarProps = {
|
3
|
-
size
|
36
|
+
size?: string;
|
4
37
|
name?: string;
|
5
38
|
url?: string;
|
6
39
|
customText?: string;
|
@@ -13,7 +46,19 @@ declare type CustomAvatarProps = {
|
|
13
46
|
* { active: 'Активен', inactive: 'Неактивен' }
|
14
47
|
*/
|
15
48
|
statusLabels?: StatusLabels;
|
16
|
-
|
49
|
+
/**
|
50
|
+
* Включить отображение дополнительного элемента
|
51
|
+
*/
|
52
|
+
hasExtra?: boolean;
|
53
|
+
/**
|
54
|
+
* Тип дополнительного элемента
|
55
|
+
*/
|
56
|
+
type?: 'badge' | 'counter';
|
57
|
+
/**
|
58
|
+
* Расположение дополнительного элемента
|
59
|
+
*/
|
60
|
+
extraPlacement?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
61
|
+
} & ExtraProps;
|
17
62
|
export declare type StatusLabels = Record<'active' | 'inactive', string>;
|
18
63
|
export declare type AvatarProps = HTMLAttributes<HTMLDivElement> & CustomAvatarProps;
|
19
64
|
export {};
|
@@ -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,
|
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,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,aAAK,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI;KACb,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACvB,GACG;KACK,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK;CACzB,CAAC;AAEN,aAAK,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE3C,aAAK,eAAe,GAAG;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;AAEzD,aAAK,iBAAiB,GAAG;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAExD,aAAK,UAAU,GAAG,KAAK,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AAE5D,aAAK,iBAAiB,GAAG;IAErB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,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;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;CAC9E,GAAG,UAAU,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"}
|