@salutejs/plasma-new-hope 0.195.0-canary.1574.11921374356.0 → 0.195.0-dev.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Autocomplete/Autocomplete.js +1 -7
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Badge/Badge.css +4 -4
- package/cjs/components/Badge/Badge.js +17 -7
- package/cjs/components/Badge/Badge.js.map +1 -1
- package/cjs/components/Badge/Badge.tokens.js +10 -5
- package/cjs/components/Badge/Badge.tokens.js.map +1 -1
- package/cjs/components/Badge/variations/_clear/base.js +1 -1
- package/cjs/components/Badge/variations/_clear/base.js.map +1 -1
- package/cjs/components/Badge/variations/_clear/base_wiboj8.css +1 -0
- package/cjs/components/Badge/variations/_size/base.js +1 -1
- package/cjs/components/Badge/variations/_size/base.js.map +1 -1
- package/{es/components/Badge/variations/_size/base_to0y5x.css → cjs/components/Badge/variations/_size/base_bu5opk.css} +1 -1
- package/cjs/components/Badge/variations/_transparent/base.js +1 -1
- package/cjs/components/Badge/variations/_transparent/base.js.map +1 -1
- package/cjs/components/Badge/variations/_transparent/base_aapqhz.css +1 -0
- package/cjs/components/Badge/variations/_view/base.js +1 -1
- package/cjs/components/Badge/variations/_view/base.js.map +1 -1
- package/cjs/components/Badge/variations/_view/base_j3xzf3.css +1 -0
- package/cjs/index.css +4 -4
- package/emotion/cjs/components/Autocomplete/Autocomplete.js +1 -7
- package/emotion/cjs/components/Badge/Badge.js +17 -7
- package/emotion/cjs/components/Badge/Badge.template-doc.mdx +40 -16
- package/emotion/cjs/components/Badge/Badge.tokens.js +10 -6
- package/emotion/cjs/components/Badge/variations/_clear/base.js +1 -1
- package/emotion/cjs/components/Badge/variations/_size/base.js +2 -1
- package/emotion/cjs/components/Badge/variations/_transparent/base.js +1 -1
- package/emotion/cjs/components/Badge/variations/_view/base.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Badge/Badge.config.js +15 -15
- package/emotion/cjs/examples/plasma_b2c/components/Badge/Badge.stories.tsx +23 -6
- package/emotion/cjs/examples/plasma_web/components/Badge/Badge.config.js +14 -14
- package/emotion/cjs/examples/plasma_web/components/Badge/Badge.stories.tsx +27 -6
- package/emotion/es/components/Autocomplete/Autocomplete.js +1 -7
- package/emotion/es/components/Badge/Badge.js +18 -8
- package/emotion/es/components/Badge/Badge.template-doc.mdx +40 -16
- package/emotion/es/components/Badge/Badge.tokens.js +9 -5
- package/emotion/es/components/Badge/variations/_clear/base.js +2 -2
- package/emotion/es/components/Badge/variations/_size/base.js +3 -2
- package/emotion/es/components/Badge/variations/_transparent/base.js +2 -2
- package/emotion/es/components/Badge/variations/_view/base.js +2 -2
- package/emotion/es/examples/plasma_b2c/components/Badge/Badge.config.js +15 -15
- package/emotion/es/examples/plasma_b2c/components/Badge/Badge.stories.tsx +23 -6
- package/emotion/es/examples/plasma_web/components/Badge/Badge.config.js +14 -14
- package/emotion/es/examples/plasma_web/components/Badge/Badge.stories.tsx +27 -6
- package/es/components/Autocomplete/Autocomplete.js +1 -7
- package/es/components/Autocomplete/Autocomplete.js.map +1 -1
- package/es/components/Badge/Badge.css +4 -4
- package/es/components/Badge/Badge.js +20 -10
- package/es/components/Badge/Badge.js.map +1 -1
- package/es/components/Badge/Badge.tokens.js +10 -6
- package/es/components/Badge/Badge.tokens.js.map +1 -1
- package/es/components/Badge/variations/_clear/base.js +1 -1
- package/es/components/Badge/variations/_clear/base.js.map +1 -1
- package/es/components/Badge/variations/_clear/base_wiboj8.css +1 -0
- package/es/components/Badge/variations/_size/base.js +1 -1
- package/es/components/Badge/variations/_size/base.js.map +1 -1
- package/{cjs/components/Badge/variations/_size/base_to0y5x.css → es/components/Badge/variations/_size/base_bu5opk.css} +1 -1
- package/es/components/Badge/variations/_transparent/base.js +1 -1
- package/es/components/Badge/variations/_transparent/base.js.map +1 -1
- package/es/components/Badge/variations/_transparent/base_aapqhz.css +1 -0
- package/es/components/Badge/variations/_view/base.js +1 -1
- package/es/components/Badge/variations/_view/base.js.map +1 -1
- package/es/components/Badge/variations/_view/base_j3xzf3.css +1 -0
- package/es/index.css +4 -4
- package/package.json +2 -2
- package/styled-components/cjs/components/Autocomplete/Autocomplete.js +1 -7
- package/styled-components/cjs/components/Badge/Badge.js +17 -7
- package/styled-components/cjs/components/Badge/Badge.template-doc.mdx +40 -16
- package/styled-components/cjs/components/Badge/Badge.tokens.js +10 -6
- package/styled-components/cjs/components/Badge/variations/_clear/base.js +1 -1
- package/styled-components/cjs/components/Badge/variations/_size/base.js +2 -1
- package/styled-components/cjs/components/Badge/variations/_transparent/base.js +1 -1
- package/styled-components/cjs/components/Badge/variations/_view/base.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Badge/Badge.config.js +5 -5
- package/styled-components/cjs/examples/plasma_b2c/components/Badge/Badge.stories.tsx +23 -6
- package/styled-components/cjs/examples/plasma_web/components/Badge/Badge.config.js +5 -5
- package/styled-components/cjs/examples/plasma_web/components/Badge/Badge.stories.tsx +27 -6
- package/styled-components/es/components/Autocomplete/Autocomplete.js +1 -7
- package/styled-components/es/components/Badge/Badge.js +18 -8
- package/styled-components/es/components/Badge/Badge.template-doc.mdx +40 -16
- package/styled-components/es/components/Badge/Badge.tokens.js +9 -5
- package/styled-components/es/components/Badge/variations/_clear/base.js +2 -2
- package/styled-components/es/components/Badge/variations/_size/base.js +3 -2
- package/styled-components/es/components/Badge/variations/_transparent/base.js +2 -2
- package/styled-components/es/components/Badge/variations/_view/base.js +2 -2
- package/styled-components/es/examples/plasma_b2c/components/Badge/Badge.config.js +5 -5
- package/styled-components/es/examples/plasma_b2c/components/Badge/Badge.stories.tsx +23 -6
- package/styled-components/es/examples/plasma_web/components/Badge/Badge.config.js +5 -5
- package/styled-components/es/examples/plasma_web/components/Badge/Badge.stories.tsx +27 -6
- package/types/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/components/Autocomplete/Autocomplete.types.d.ts +0 -4
- package/types/components/Autocomplete/Autocomplete.types.d.ts.map +1 -1
- package/types/components/Badge/Badge.d.ts.map +1 -1
- package/types/components/Badge/Badge.tokens.d.ts +8 -4
- package/types/components/Badge/Badge.tokens.d.ts.map +1 -1
- package/types/components/Badge/Badge.types.d.ts +18 -5
- package/types/components/Badge/Badge.types.d.ts.map +1 -1
- package/types/components/Badge/variations/_clear/base.d.ts.map +1 -1
- package/types/components/Badge/variations/_size/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Badge/Badge.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Badge/Badge.d.ts +61 -4
- package/types/examples/plasma_b2c/components/Badge/Badge.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Badge/Badge.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Badge/Badge.d.ts +61 -4
- package/types/examples/plasma_web/components/Badge/Badge.d.ts.map +1 -1
- package/cjs/components/Badge/variations/_clear/base_oopyb7.css +0 -1
- package/cjs/components/Badge/variations/_transparent/base_1l6036y.css +0 -1
- package/cjs/components/Badge/variations/_view/base_qlxank.css +0 -1
- package/es/components/Badge/variations/_clear/base_oopyb7.css +0 -1
- package/es/components/Badge/variations/_transparent/base_1l6036y.css +0 -1
- package/es/components/Badge/variations/_view/base_qlxank.css +0 -1
@@ -52,16 +52,7 @@ export function App() {
|
|
52
52
|
```
|
53
53
|
|
54
54
|
### Вид badge
|
55
|
-
Вид `badge` задается с помощью свойства `view`.
|
56
|
-
|
57
|
-
+ `"primary"` – основной badge;
|
58
|
-
+ `"accent"` – бейдж акцентного цвета;
|
59
|
-
+ `"positive"` – успешное завершение;
|
60
|
-
+ `"warning"` – предупреждение;
|
61
|
-
+ `"negative"` – ошибка;
|
62
|
-
+ `"dark"` – темный badge;
|
63
|
-
+ `"light"` – светлый badge.
|
64
|
-
|
55
|
+
Вид `badge` задается с помощью свойства `view`.
|
65
56
|
Так же на вид badge влияет свойства `transparent` и `clear`.
|
66
57
|
|
67
58
|
```tsx live
|
@@ -72,7 +63,7 @@ export function App() {
|
|
72
63
|
const Badges = ({transparent, clear}) => {
|
73
64
|
return (
|
74
65
|
<div style=\{{ display: 'flex', gap: '0.5rem' }}>
|
75
|
-
<Badge text="Бейдж" size="l" view="
|
66
|
+
<Badge text="Бейдж" size="l" view="default" transparent={transparent} clear={clear} />
|
76
67
|
<Badge text="Бейдж" size="l" view="accent" transparent={transparent} clear={clear} />
|
77
68
|
<Badge text="Бейдж" size="l" view="positive" transparent={transparent} clear={clear} />
|
78
69
|
<Badge text="Бейдж" size="l" view="warning" transparent={transparent} clear={clear} />
|
@@ -94,7 +85,8 @@ export function App() {
|
|
94
85
|
```
|
95
86
|
|
96
87
|
### Иконка слева / справа
|
97
|
-
В левой
|
88
|
+
В левой или правой части badge можно отобразить иконку.
|
89
|
+
Если же нужен Badge с иконкой без текста, нужно использовать `contentLeft`.
|
98
90
|
|
99
91
|
```tsx live
|
100
92
|
import React from 'react';
|
@@ -107,17 +99,49 @@ export function App() {
|
|
107
99
|
<Badge
|
108
100
|
text="Бейдж"
|
109
101
|
size="l"
|
110
|
-
view="
|
102
|
+
view="default"
|
111
103
|
contentLeft={
|
112
104
|
<IconEye color="inherit" size="xs" />
|
113
|
-
}
|
105
|
+
}
|
106
|
+
/>
|
114
107
|
<Badge
|
115
108
|
text="Бейдж"
|
116
109
|
size="l"
|
117
|
-
view="
|
110
|
+
view="default"
|
118
111
|
contentRight={
|
119
112
|
<IconEye color="inherit" size="xs" />
|
120
|
-
}
|
113
|
+
}
|
114
|
+
/>
|
115
|
+
<Badge
|
116
|
+
size="l"
|
117
|
+
view="default"
|
118
|
+
contentLeft={
|
119
|
+
<IconEye color="inherit" size="xs" />
|
120
|
+
}
|
121
|
+
/>
|
122
|
+
</div>
|
123
|
+
);
|
124
|
+
}
|
125
|
+
```
|
126
|
+
|
127
|
+
### Задание цвета текста и фона
|
128
|
+
Цвет текста и фона можно задать с помощью свойств
|
129
|
+
`customColor` и `customBackgroundColor` соответственно.
|
130
|
+
|
131
|
+
```tsx live
|
132
|
+
import React from 'react';
|
133
|
+
import { Badge } from '@salutejs/{{ package }}';
|
134
|
+
|
135
|
+
export function App() {
|
136
|
+
return (
|
137
|
+
<div>
|
138
|
+
<Badge
|
139
|
+
text="Бейдж"
|
140
|
+
size="l"
|
141
|
+
view="default"
|
142
|
+
customColor="antiquewhite"
|
143
|
+
customBackgroundColor="darkolivegreen"
|
144
|
+
/>
|
121
145
|
</div>
|
122
146
|
);
|
123
147
|
}
|
@@ -3,12 +3,17 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.tokens = exports.classes = void 0;
|
6
|
+
exports.tokens = exports.privateTokens = exports.classes = void 0;
|
7
7
|
var classes = exports.classes = {
|
8
8
|
badgePilled: 'badge-pilled',
|
9
9
|
badgeTransparent: 'badge-transparent',
|
10
10
|
badgeClear: 'badge-clear',
|
11
|
-
badgeTruncate: 'badge-truncate'
|
11
|
+
badgeTruncate: 'badge-truncate',
|
12
|
+
iconOnly: 'badge-icon-only'
|
13
|
+
};
|
14
|
+
var privateTokens = exports.privateTokens = {
|
15
|
+
customBackground: '--plasma-badge-custom-background',
|
16
|
+
customColor: '--plasma-badge-custom-color'
|
12
17
|
};
|
13
18
|
var tokens = exports.tokens = {
|
14
19
|
background: '--plasma-badge-background',
|
@@ -16,13 +21,12 @@ var tokens = exports.tokens = {
|
|
16
21
|
backgroundTransparent: '--plasma-badge-background-transparent',
|
17
22
|
colorTransparent: '--plasma-badge-color-transparent',
|
18
23
|
colorClear: '--plasma-badge-color-clear',
|
24
|
+
backgroundClear: '--plasma-badge-background-clear',
|
19
25
|
borderRadius: '--plasma-badge-border-radius',
|
20
26
|
pilledBorderRadius: '--plasma-badge-pilled-border-radius',
|
21
27
|
height: '--plasma-badge-height',
|
22
|
-
|
23
|
-
|
24
|
-
paddingBottom: '--plasma-badge-padding-bottom',
|
25
|
-
paddingLeft: '--plasma-badge-padding-left',
|
28
|
+
padding: '--plasma-badge-padding',
|
29
|
+
paddingIconOnly: '--plasma-badge-padding-icon-only',
|
26
30
|
fontFamily: '--plasma-badge-font-family',
|
27
31
|
fontSize: '--plasma-badge-font-size',
|
28
32
|
fontStyle: '--plasma-badge-font-style',
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Badge = /*#__PURE__*/require("../../Badge.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{color:var(", ");background-color:
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{color:var(", ",var(", "));background-color:var(", ",var(", "));}"], _Badge.classes.badgeClear, _Badge.privateTokens.customColor, _Badge.tokens.colorClear, _Badge.privateTokens.customBackground, _Badge.tokens.backgroundClear);
|
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Badge = /*#__PURE__*/require("../../Badge.tokens");
|
9
|
-
var
|
9
|
+
var _Badge2 = /*#__PURE__*/require("../../Badge.styles");
|
10
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");border-radius:var(", ");height:var(", ");padding:var(", ");&.", "{padding:var(", ");", "{margin:0;}}"], _Badge.tokens.fontFamily, _Badge.tokens.fontSize, _Badge.tokens.fontStyle, _Badge.tokens.fontWeight, _Badge.tokens.letterSpacing, _Badge.tokens.lineHeight, _Badge.tokens.borderRadius, _Badge.tokens.height, _Badge.tokens.padding, _Badge.classes.iconOnly, _Badge.tokens.paddingIconOnly, _Badge2.StyledContentLeft);
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Badge = /*#__PURE__*/require("../../Badge.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{color:var(", ");background-color:var(", ");}"], _Badge.classes.badgeTransparent, _Badge.tokens.colorTransparent, _Badge.tokens.backgroundTransparent);
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["&.", "{color:var(", ",var(", "));background-color:var(", ",var(", "));}"], _Badge.classes.badgeTransparent, _Badge.privateTokens.customColor, _Badge.tokens.colorTransparent, _Badge.privateTokens.customBackground, _Badge.tokens.backgroundTransparent);
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Badge = /*#__PURE__*/require("../../Badge.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["color:var(", ");background-color:var(", ");"], _Badge.tokens.color, _Badge.tokens.background);
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["color:var(", ",var(", "));background-color:var(", ",var(", "));"], _Badge.privateTokens.customColor, _Badge.tokens.color, _Badge.privateTokens.customBackground, _Badge.tokens.background);
|
@@ -22,10 +22,10 @@ var config = exports.config = {
|
|
22
22
|
light: /*#__PURE__*/(0, _styledComponents.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-primary);"], _Badge.badgeTokens.color, _Badge.badgeTokens.background, _Badge.badgeTokens.colorTransparent, _Badge.badgeTokens.backgroundTransparent, _Badge.badgeTokens.colorClear)
|
23
23
|
},
|
24
24
|
size: {
|
25
|
-
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.5rem;", ":1.75rem;", ":0.6875rem;", ":0.
|
26
|
-
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.5rem;", ":0.5625rem;", ":0.
|
27
|
-
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.25rem;", ":0.4375rem;", ":0.
|
28
|
-
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.25rem;", ":1rem;", ":0.25rem;", ":0.
|
25
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":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;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
26
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.5rem;", ":0 0.5625rem;", ":0 0.375rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":-0.0625rem;", ":0.1875rem;", ":0.1875rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
27
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":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;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
28
|
+
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":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;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight)
|
29
29
|
},
|
30
30
|
pilled: {
|
31
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":1.25rem;"], _Badge.badgeTokens.pilledBorderRadius)
|
@@ -34,7 +34,7 @@ var config = exports.config = {
|
|
34
34
|
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
35
35
|
},
|
36
36
|
clear: {
|
37
|
-
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
37
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--surface-clear);"], _Badge.badgeTokens.backgroundClear)
|
38
38
|
},
|
39
39
|
truncate: {
|
40
40
|
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
@@ -34,6 +34,10 @@ const meta: Meta<typeof Badge> = {
|
|
34
34
|
maxWidth: {
|
35
35
|
control: { type: 'text' },
|
36
36
|
},
|
37
|
+
text: {
|
38
|
+
control: { type: 'text' },
|
39
|
+
if: { arg: 'enableText', truthy: true },
|
40
|
+
},
|
37
41
|
...disableProps(['contentLeft', 'contentRight']),
|
38
42
|
},
|
39
43
|
};
|
@@ -43,6 +47,7 @@ export default meta;
|
|
43
47
|
type StoryProps = ComponentProps<typeof Badge> & {
|
44
48
|
enableContentLeft: boolean;
|
45
49
|
enableContentRight: boolean;
|
50
|
+
enableText: boolean;
|
46
51
|
};
|
47
52
|
type Story = StoryObj<StoryProps>;
|
48
53
|
|
@@ -63,13 +68,14 @@ export const Default: Story = {
|
|
63
68
|
},
|
64
69
|
enableContentRight: {
|
65
70
|
control: { type: 'boolean' },
|
66
|
-
if: { arg: '
|
71
|
+
if: { arg: 'enableText', truthy: true },
|
67
72
|
},
|
68
73
|
},
|
69
74
|
args: {
|
70
|
-
text: 'Hello Kitty',
|
71
75
|
view: 'default',
|
72
76
|
size: 'm',
|
77
|
+
enableText: true,
|
78
|
+
text: 'Hello',
|
73
79
|
enableContentLeft: false,
|
74
80
|
enableContentRight: false,
|
75
81
|
clear: false,
|
@@ -77,13 +83,24 @@ export const Default: Story = {
|
|
77
83
|
transparent: false,
|
78
84
|
maxWidth: '',
|
79
85
|
},
|
80
|
-
render: ({ enableContentLeft, enableContentRight, size, ...rest }: StoryProps) => {
|
81
|
-
const iconSize =
|
86
|
+
render: ({ enableContentLeft, enableContentRight, enableText, size, ...rest }: StoryProps) => {
|
87
|
+
const iconSize = () => {
|
88
|
+
switch (size) {
|
89
|
+
case 'l':
|
90
|
+
return '1rem';
|
91
|
+
case 'xs':
|
92
|
+
return '0.625rem';
|
93
|
+
default:
|
94
|
+
return '0.75rem';
|
95
|
+
}
|
96
|
+
};
|
82
97
|
|
83
98
|
return (
|
84
99
|
<Badge
|
85
|
-
contentLeft={
|
86
|
-
|
100
|
+
contentLeft={
|
101
|
+
enableContentLeft || !enableText ? <BellIcon width={iconSize()} height={iconSize()} /> : undefined
|
102
|
+
}
|
103
|
+
contentRight={enableContentRight ? <BellIcon width={iconSize()} height={iconSize()} /> : undefined}
|
87
104
|
size={size}
|
88
105
|
{...rest}
|
89
106
|
/>
|
@@ -22,10 +22,10 @@ var config = exports.config = {
|
|
22
22
|
light: /*#__PURE__*/(0, _styledComponents.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-primary);"], _Badge.badgeTokens.color, _Badge.badgeTokens.background, _Badge.badgeTokens.colorTransparent, _Badge.badgeTokens.backgroundTransparent, _Badge.badgeTokens.colorClear)
|
23
23
|
},
|
24
24
|
size: {
|
25
|
-
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.5rem;", ":1.75rem;", ":0.6875rem;", ":0.
|
26
|
-
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.5rem;", ":0.5625rem;", ":0.
|
27
|
-
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.25rem;", ":0.4375rem;", ":0.
|
28
|
-
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.25rem;", ":1rem;", ":0.25rem;", ":0.
|
25
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":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;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
26
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.375rem;", ":1.5rem;", ":0 0.5625rem;", ":0 0.375rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":-0.0625rem;", ":0.1875rem;", ":0.1875rem;", ":-0.0625rem;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
27
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":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;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight),
|
28
|
+
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":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;"], _Badge.badgeTokens.borderRadius, _Badge.badgeTokens.height, _Badge.badgeTokens.padding, _Badge.badgeTokens.paddingIconOnly, _Badge.badgeTokens.fontFamily, _Badge.badgeTokens.fontSize, _Badge.badgeTokens.fontStyle, _Badge.badgeTokens.fontWeight, _Badge.badgeTokens.letterSpacing, _Badge.badgeTokens.lineHeight, _Badge.badgeTokens.leftContentMarginLeft, _Badge.badgeTokens.leftContentMarginRight, _Badge.badgeTokens.rightContentMarginLeft, _Badge.badgeTokens.rightContentMarginRight)
|
29
29
|
},
|
30
30
|
pilled: {
|
31
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":1.25rem;"], _Badge.badgeTokens.pilledBorderRadius)
|
@@ -34,7 +34,7 @@ var config = exports.config = {
|
|
34
34
|
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
35
35
|
},
|
36
36
|
clear: {
|
37
|
-
"true": /*#__PURE__*/(0, _styledComponents.css)([""])
|
37
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--surface-clear);"], _Badge.badgeTokens.backgroundClear)
|
38
38
|
}
|
39
39
|
}
|
40
40
|
};
|
@@ -31,6 +31,13 @@ const meta: Meta<typeof Badge> = {
|
|
31
31
|
control: { type: 'boolean' },
|
32
32
|
if: { arg: 'clear', truthy: false },
|
33
33
|
},
|
34
|
+
maxWidth: {
|
35
|
+
control: { type: 'text' },
|
36
|
+
},
|
37
|
+
text: {
|
38
|
+
control: { type: 'text' },
|
39
|
+
if: { arg: 'enableText', truthy: true },
|
40
|
+
},
|
34
41
|
...disableProps(['contentLeft', 'contentRight']),
|
35
42
|
},
|
36
43
|
};
|
@@ -40,6 +47,7 @@ export default meta;
|
|
40
47
|
type StoryProps = ComponentProps<typeof Badge> & {
|
41
48
|
enableContentLeft: boolean;
|
42
49
|
enableContentRight: boolean;
|
50
|
+
enableText: boolean;
|
43
51
|
};
|
44
52
|
type Story = StoryObj<StoryProps>;
|
45
53
|
|
@@ -60,26 +68,39 @@ export const Default: Story = {
|
|
60
68
|
},
|
61
69
|
enableContentRight: {
|
62
70
|
control: { type: 'boolean' },
|
63
|
-
if: { arg: '
|
71
|
+
if: { arg: 'enableText', truthy: true },
|
64
72
|
},
|
65
73
|
},
|
66
74
|
args: {
|
67
|
-
text: 'Hello',
|
68
75
|
view: 'default',
|
69
76
|
size: 'm',
|
77
|
+
enableText: true,
|
78
|
+
text: 'Hello',
|
70
79
|
enableContentLeft: false,
|
71
80
|
enableContentRight: false,
|
72
81
|
clear: false,
|
73
82
|
pilled: false,
|
74
83
|
transparent: false,
|
84
|
+
maxWidth: '',
|
75
85
|
},
|
76
|
-
render: ({ enableContentLeft, enableContentRight, size, ...rest }: StoryProps) => {
|
77
|
-
const iconSize =
|
86
|
+
render: ({ enableContentLeft, enableContentRight, enableText, size, ...rest }: StoryProps) => {
|
87
|
+
const iconSize = () => {
|
88
|
+
switch (size) {
|
89
|
+
case 'l':
|
90
|
+
return '1rem';
|
91
|
+
case 'xs':
|
92
|
+
return '0.625rem';
|
93
|
+
default:
|
94
|
+
return '0.75rem';
|
95
|
+
}
|
96
|
+
};
|
78
97
|
|
79
98
|
return (
|
80
99
|
<Badge
|
81
|
-
contentLeft={
|
82
|
-
|
100
|
+
contentLeft={
|
101
|
+
enableContentLeft || !enableText ? <BellIcon width={iconSize()} height={iconSize()} /> : undefined
|
102
|
+
}
|
103
|
+
contentRight={enableContentRight ? <BellIcon width={iconSize()} height={iconSize()} /> : undefined}
|
83
104
|
size={size}
|
84
105
|
{...rest}
|
85
106
|
/>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["value", "
|
1
|
+
var _excluded = ["value", "onChange", "suggestions", "view", "size", "labelPlacement", "disabled", "readOnly", "label", "leftHelper", "contentLeft", "contentRight", "textBefore", "textAfter", "onScroll", "listMaxHeight", "listWidth", "portal", "filter", "onSuggestionSelect", "threshold", "renderList", "renderListEnd", "onSearch", "hintText"];
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -23,7 +23,6 @@ import { useKeyNavigation } from './hooks/useKeyboardNavigation';
|
|
23
23
|
export var autocompleteRoot = function autocompleteRoot(Root) {
|
24
24
|
return /*#__PURE__*/forwardRef(function (_ref, ref) {
|
25
25
|
var outerValue = _ref.value,
|
26
|
-
defaultValue = _ref.defaultValue,
|
27
26
|
onChange = _ref.onChange,
|
28
27
|
suggestions = _ref.suggestions,
|
29
28
|
view = _ref.view,
|
@@ -111,11 +110,6 @@ export var autocompleteRoot = function autocompleteRoot(Root) {
|
|
111
110
|
type: 'reset'
|
112
111
|
});
|
113
112
|
}, [value]);
|
114
|
-
useDidMountEffect(function () {
|
115
|
-
if (defaultValue) {
|
116
|
-
setInnerValue(defaultValue);
|
117
|
-
}
|
118
|
-
}, [defaultValue]);
|
119
113
|
return /*#__PURE__*/React.createElement(Root, {
|
120
114
|
view: view,
|
121
115
|
size: size,
|
@@ -1,5 +1,5 @@
|
|
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 = ["children", "className", "text", "contentLeft", "contentRight", "size", "view", "pilled", "transparent", "clear", "maxWidth"];
|
2
|
+
var _excluded = ["children", "className", "style", "text", "contentLeft", "contentRight", "size", "view", "customColor", "customBackgroundColor", "pilled", "transparent", "clear", "maxWidth"];
|
3
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
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
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; }
|
@@ -16,16 +16,20 @@ import { base as pilledCSS } from './variations/_pilled/base';
|
|
16
16
|
import { base as transparentCSS } from './variations/_transparent/base';
|
17
17
|
import { base as clearCSS } from './variations/_clear/base';
|
18
18
|
import { StyledContentLeft, StyledContentMain, StyledContentRight, base } from './Badge.styles';
|
19
|
-
import { classes } from './Badge.tokens';
|
19
|
+
import { classes, privateTokens } from './Badge.tokens';
|
20
20
|
export var badgeRoot = function badgeRoot(Root) {
|
21
21
|
return /*#__PURE__*/forwardRef(function (props, ref) {
|
22
|
+
var _StyledContentLeft, _StyledContentMain, _StyledContentMain2, _StyledContentRight;
|
22
23
|
var children = props.children,
|
23
24
|
className = props.className,
|
25
|
+
style = props.style,
|
24
26
|
text = props.text,
|
25
27
|
contentLeft = props.contentLeft,
|
26
28
|
contentRight = props.contentRight,
|
27
29
|
size = props.size,
|
28
30
|
view = props.view,
|
31
|
+
customColor = props.customColor,
|
32
|
+
customBackgroundColor = props.customBackgroundColor,
|
29
33
|
_props$pilled = props.pilled,
|
30
34
|
pilled = _props$pilled === void 0 ? false : _props$pilled,
|
31
35
|
_props$transparent = props.transparent,
|
@@ -40,19 +44,25 @@ export var badgeRoot = function badgeRoot(Root) {
|
|
40
44
|
var clearClass = clear ? classes.badgeClear : undefined;
|
41
45
|
var truncateClass = maxWidth !== 'auto' ? classes.badgeTruncate : undefined;
|
42
46
|
var txt = !text && typeof children === 'string' ? children : text;
|
47
|
+
var iconOnlyClass = !txt && contentLeft ? classes.iconOnly : undefined;
|
48
|
+
var BadgeContent = function BadgeContent() {
|
49
|
+
if (contentLeft) {
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, _StyledContentLeft || (_StyledContentLeft = /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft)), txt ? _StyledContentMain || (_StyledContentMain = /*#__PURE__*/React.createElement(StyledContentMain, null, txt)) : children);
|
51
|
+
}
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, txt ? _StyledContentMain2 || (_StyledContentMain2 = /*#__PURE__*/React.createElement(StyledContentMain, null, txt)) : children, contentRight && (_StyledContentRight || (_StyledContentRight = /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight))));
|
53
|
+
};
|
43
54
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
44
55
|
ref: ref,
|
45
|
-
className: cx(pilledClass, transparentClass, clearClass, truncateClass, className),
|
56
|
+
className: cx(pilledClass, transparentClass, clearClass, truncateClass, iconOnlyClass, className),
|
46
57
|
view: view,
|
47
58
|
size: size,
|
48
59
|
pilled: pilled,
|
49
60
|
transparent: transparent,
|
50
|
-
clear: clear
|
51
|
-
|
52
|
-
style: _objectSpread(_objectSpread({}, rest.style), {}, {
|
61
|
+
clear: clear,
|
62
|
+
style: _objectSpread(_objectSpread({}, style), {}, _defineProperty(_defineProperty({
|
53
63
|
maxWidth: maxWidth
|
54
|
-
})
|
55
|
-
}
|
64
|
+
}, privateTokens.customBackground, customBackgroundColor), privateTokens.customColor, customColor))
|
65
|
+
}, rest), /*#__PURE__*/React.createElement(BadgeContent, null));
|
56
66
|
});
|
57
67
|
};
|
58
68
|
export var badgeConfig = {
|
@@ -52,16 +52,7 @@ export function App() {
|
|
52
52
|
```
|
53
53
|
|
54
54
|
### Вид badge
|
55
|
-
Вид `badge` задается с помощью свойства `view`.
|
56
|
-
|
57
|
-
+ `"primary"` – основной badge;
|
58
|
-
+ `"accent"` – бейдж акцентного цвета;
|
59
|
-
+ `"positive"` – успешное завершение;
|
60
|
-
+ `"warning"` – предупреждение;
|
61
|
-
+ `"negative"` – ошибка;
|
62
|
-
+ `"dark"` – темный badge;
|
63
|
-
+ `"light"` – светлый badge.
|
64
|
-
|
55
|
+
Вид `badge` задается с помощью свойства `view`.
|
65
56
|
Так же на вид badge влияет свойства `transparent` и `clear`.
|
66
57
|
|
67
58
|
```tsx live
|
@@ -72,7 +63,7 @@ export function App() {
|
|
72
63
|
const Badges = ({transparent, clear}) => {
|
73
64
|
return (
|
74
65
|
<div style=\{{ display: 'flex', gap: '0.5rem' }}>
|
75
|
-
<Badge text="Бейдж" size="l" view="
|
66
|
+
<Badge text="Бейдж" size="l" view="default" transparent={transparent} clear={clear} />
|
76
67
|
<Badge text="Бейдж" size="l" view="accent" transparent={transparent} clear={clear} />
|
77
68
|
<Badge text="Бейдж" size="l" view="positive" transparent={transparent} clear={clear} />
|
78
69
|
<Badge text="Бейдж" size="l" view="warning" transparent={transparent} clear={clear} />
|
@@ -94,7 +85,8 @@ export function App() {
|
|
94
85
|
```
|
95
86
|
|
96
87
|
### Иконка слева / справа
|
97
|
-
В левой
|
88
|
+
В левой или правой части badge можно отобразить иконку.
|
89
|
+
Если же нужен Badge с иконкой без текста, нужно использовать `contentLeft`.
|
98
90
|
|
99
91
|
```tsx live
|
100
92
|
import React from 'react';
|
@@ -107,17 +99,49 @@ export function App() {
|
|
107
99
|
<Badge
|
108
100
|
text="Бейдж"
|
109
101
|
size="l"
|
110
|
-
view="
|
102
|
+
view="default"
|
111
103
|
contentLeft={
|
112
104
|
<IconEye color="inherit" size="xs" />
|
113
|
-
}
|
105
|
+
}
|
106
|
+
/>
|
114
107
|
<Badge
|
115
108
|
text="Бейдж"
|
116
109
|
size="l"
|
117
|
-
view="
|
110
|
+
view="default"
|
118
111
|
contentRight={
|
119
112
|
<IconEye color="inherit" size="xs" />
|
120
|
-
}
|
113
|
+
}
|
114
|
+
/>
|
115
|
+
<Badge
|
116
|
+
size="l"
|
117
|
+
view="default"
|
118
|
+
contentLeft={
|
119
|
+
<IconEye color="inherit" size="xs" />
|
120
|
+
}
|
121
|
+
/>
|
122
|
+
</div>
|
123
|
+
);
|
124
|
+
}
|
125
|
+
```
|
126
|
+
|
127
|
+
### Задание цвета текста и фона
|
128
|
+
Цвет текста и фона можно задать с помощью свойств
|
129
|
+
`customColor` и `customBackgroundColor` соответственно.
|
130
|
+
|
131
|
+
```tsx live
|
132
|
+
import React from 'react';
|
133
|
+
import { Badge } from '@salutejs/{{ package }}';
|
134
|
+
|
135
|
+
export function App() {
|
136
|
+
return (
|
137
|
+
<div>
|
138
|
+
<Badge
|
139
|
+
text="Бейдж"
|
140
|
+
size="l"
|
141
|
+
view="default"
|
142
|
+
customColor="antiquewhite"
|
143
|
+
customBackgroundColor="darkolivegreen"
|
144
|
+
/>
|
121
145
|
</div>
|
122
146
|
);
|
123
147
|
}
|
@@ -2,7 +2,12 @@ export var classes = {
|
|
2
2
|
badgePilled: 'badge-pilled',
|
3
3
|
badgeTransparent: 'badge-transparent',
|
4
4
|
badgeClear: 'badge-clear',
|
5
|
-
badgeTruncate: 'badge-truncate'
|
5
|
+
badgeTruncate: 'badge-truncate',
|
6
|
+
iconOnly: 'badge-icon-only'
|
7
|
+
};
|
8
|
+
export var privateTokens = {
|
9
|
+
customBackground: '--plasma-badge-custom-background',
|
10
|
+
customColor: '--plasma-badge-custom-color'
|
6
11
|
};
|
7
12
|
export var tokens = {
|
8
13
|
background: '--plasma-badge-background',
|
@@ -10,13 +15,12 @@ export var tokens = {
|
|
10
15
|
backgroundTransparent: '--plasma-badge-background-transparent',
|
11
16
|
colorTransparent: '--plasma-badge-color-transparent',
|
12
17
|
colorClear: '--plasma-badge-color-clear',
|
18
|
+
backgroundClear: '--plasma-badge-background-clear',
|
13
19
|
borderRadius: '--plasma-badge-border-radius',
|
14
20
|
pilledBorderRadius: '--plasma-badge-pilled-border-radius',
|
15
21
|
height: '--plasma-badge-height',
|
16
|
-
|
17
|
-
|
18
|
-
paddingBottom: '--plasma-badge-padding-bottom',
|
19
|
-
paddingLeft: '--plasma-badge-padding-left',
|
22
|
+
padding: '--plasma-badge-padding',
|
23
|
+
paddingIconOnly: '--plasma-badge-padding-icon-only',
|
20
24
|
fontFamily: '--plasma-badge-font-family',
|
21
25
|
fontSize: '--plasma-badge-font-size',
|
22
26
|
fontStyle: '--plasma-badge-font-style',
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
|
-
import { classes, tokens } from '../../Badge.tokens';
|
3
|
-
export var base = /*#__PURE__*/css(["&.", "{color:var(", ");background-color:
|
2
|
+
import { classes, privateTokens, tokens } from '../../Badge.tokens';
|
3
|
+
export var base = /*#__PURE__*/css(["&.", "{color:var(", ",var(", "));background-color:var(", ",var(", "));}"], classes.badgeClear, privateTokens.customColor, tokens.colorClear, privateTokens.customBackground, tokens.backgroundClear);
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
|
-
import { tokens } from '../../Badge.tokens';
|
3
|
-
|
2
|
+
import { classes, tokens } from '../../Badge.tokens';
|
3
|
+
import { StyledContentLeft } from '../../Badge.styles';
|
4
|
+
export var base = /*#__PURE__*/css(["font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");border-radius:var(", ");height:var(", ");padding:var(", ");&.", "{padding:var(", ");", "{margin:0;}}"], tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, tokens.borderRadius, tokens.height, tokens.padding, classes.iconOnly, tokens.paddingIconOnly, StyledContentLeft);
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
|
-
import { classes, tokens } from '../../Badge.tokens';
|
3
|
-
export var base = /*#__PURE__*/css(["&.", "{color:var(", ");background-color:var(", ");}"], classes.badgeTransparent, tokens.colorTransparent, tokens.backgroundTransparent);
|
2
|
+
import { classes, privateTokens, tokens } from '../../Badge.tokens';
|
3
|
+
export var base = /*#__PURE__*/css(["&.", "{color:var(", ",var(", "));background-color:var(", ",var(", "));}"], classes.badgeTransparent, privateTokens.customColor, tokens.colorTransparent, privateTokens.customBackground, tokens.backgroundTransparent);
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
|
-
import { tokens } from '../../Badge.tokens';
|
3
|
-
export var base = /*#__PURE__*/css(["color:var(", ");background-color:var(", ");"], tokens.color, tokens.background);
|
2
|
+
import { privateTokens, tokens } from '../../Badge.tokens';
|
3
|
+
export var base = /*#__PURE__*/css(["color:var(", ",var(", "));background-color:var(", ",var(", "));"], privateTokens.customColor, tokens.color, privateTokens.customBackground, tokens.background);
|