@salutejs/plasma-new-hope 0.194.0-canary.1568.11891833298.0 → 0.194.1-canary.1569.11907567976.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Switch/Switch.css +1 -1
- package/cjs/components/Switch/Switch.tokens.js +2 -1
- package/cjs/components/Switch/Switch.tokens.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/cjs/components/Switch/_toggleSize/base.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_o6rjc1.css +1 -0
- package/cjs/index.css +1 -1
- package/emotion/cjs/components/Switch/Switch.tokens.js +2 -1
- package/emotion/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +8 -8
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +8 -8
- package/emotion/es/components/Switch/Switch.tokens.js +2 -1
- package/emotion/es/components/Switch/_toggleSize/base.js +2 -2
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +8 -8
- package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_web/components/Switch/Switch.outline.config.js +8 -8
- package/es/components/Switch/Switch.css +1 -1
- package/es/components/Switch/Switch.tokens.js +2 -1
- package/es/components/Switch/Switch.tokens.js.map +1 -1
- package/es/components/Switch/_toggleSize/base.js +1 -1
- package/es/components/Switch/_toggleSize/base.js.map +1 -1
- package/es/components/Switch/_toggleSize/base_o6rjc1.css +1 -0
- package/es/index.css +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Switch/Switch.tokens.js +2 -1
- package/styled-components/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +1 -1
- package/styled-components/es/components/Switch/Switch.tokens.js +2 -1
- package/styled-components/es/components/Switch/_toggleSize/base.js +2 -2
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.outline.config.js +1 -1
- package/types/components/Switch/Switch.tokens.d.ts +2 -1
- package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
- package/types/components/Switch/_toggleSize/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_1d0b3t4.css +0 -1
- package/emotion/cjs/components/Card/Card.api.mdx +0 -184
- package/emotion/es/components/Card/Card.api.mdx +0 -184
- package/es/components/Switch/_toggleSize/base_1d0b3t4.css +0 -1
- package/styled-components/cjs/components/Card/Card.api.mdx +0 -184
- package/styled-components/es/components/Card/Card.api.mdx +0 -184
@@ -1,4 +1,4 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
2
|
import { tokens } from '../Switch.tokens';
|
3
|
-
import { StyledTrigger } from '../Switch.styles';
|
4
|
-
export var base = /*#__PURE__*/css(["", "{box-sizing:border-box;flex:0 0 var(", ");border-style:solid;border-width:var(", ");border-radius:var(", ");width:var(", ");height:var(", ");&::after{width:var(", ");height:var(", ");border-radius:var(", ");margin:auto var(", ");}}:active:not([disabled]) ", "::after{width:calc(var(", ") * var(", ",1));}"], StyledTrigger, tokens.trackWidth, tokens.
|
3
|
+
import { StyledInput, StyledTrigger } from '../Switch.styles';
|
4
|
+
export var base = /*#__PURE__*/css(["", "{box-sizing:border-box;flex:0 0 var(", ");border-style:solid;border-width:var(", ");border-radius:var(", ");width:var(", ");height:var(", ");&::after{width:var(", ");height:var(", ");border-radius:var(", ");margin:auto var(", ");}}", ":checked ~ ", "{border-width:var(", ",var(", "));}:active:not([disabled]) ", "::after{width:calc(var(", ") * var(", ",1));}"], StyledTrigger, tokens.trackWidth, tokens.trackBorderWidthOff, tokens.trackBorderRadius, tokens.trackWidth, tokens.trackHeight, tokens.thumbSize, tokens.thumbSize, tokens.thumbBorderRadius, tokens.thumbOffset, StyledInput, StyledTrigger, tokens.trackBorderWidthOn, tokens.trackBorderWidthOff, StyledTrigger, tokens.thumbSize, tokens.thumbPressScale);
|
@@ -19,7 +19,7 @@ export var config = {
|
|
19
19
|
s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":
|
22
|
+
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBackgroundColorOn, switchTokens.trackBackgroundColorOnHover, switchTokens.trackBackgroundColorOff, switchTokens.trackBackgroundColorOffHover, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
|
23
23
|
},
|
24
24
|
disabled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
|
@@ -19,7 +19,7 @@ export var config = {
|
|
19
19
|
s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":0.875rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--outline-accent-hover);", ":var(--text-tertiary);", ":var(--text-accent);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.
|
22
|
+
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":0.0625rem;", ":var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--outline-accent-hover);", ":var(--text-tertiary);", ":var(--text-accent);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBorderWidthOn, switchTokens.trackBorderWidthOff, switchTokens.trackBorderColorOff, switchTokens.trackBorderColorOffHover, switchTokens.trackBorderColorOn, switchTokens.trackBorderColorOnHover, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
|
23
23
|
},
|
24
24
|
disabled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
|
@@ -19,7 +19,7 @@ export var config = {
|
|
19
19
|
s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":
|
22
|
+
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBackgroundColorOn, switchTokens.trackBackgroundColorOnHover, switchTokens.trackBackgroundColorOff, switchTokens.trackBackgroundColorOffHover, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
|
23
23
|
},
|
24
24
|
disabled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
|
@@ -19,7 +19,7 @@ export var config = {
|
|
19
19
|
s: /*#__PURE__*/css(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":0.875rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], switchTokens.trackWidth, switchTokens.trackHeight, switchTokens.trackBorderRadius, switchTokens.trackHeight, switchTokens.thumbSize, switchTokens.thumbBorderRadius, switchTokens.thumbSize, switchTokens.thumbOffset, switchTokens.thumbPressScale)
|
20
20
|
},
|
21
21
|
view: {
|
22
|
-
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--outline-accent-hover);", ":var(--text-tertiary);", ":var(--text-accent);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.
|
22
|
+
"default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":0.0625rem;", ":var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--outline-accent-hover);", ":var(--text-tertiary);", ":var(--text-accent);", ":0 1px 1px rgba(0,0,0,0.11);"], switchTokens.labelColor, switchTokens.descriptionColor, switchTokens.trackBorderWidthOn, switchTokens.trackBorderWidthOff, switchTokens.trackBorderColorOff, switchTokens.trackBorderColorOffHover, switchTokens.trackBorderColorOn, switchTokens.trackBorderColorOnHover, switchTokens.thumbBackgroundColorOff, switchTokens.thumbBackgroundColorOn, switchTokens.thumbBoxShadow)
|
23
23
|
},
|
24
24
|
disabled: {
|
25
25
|
"true": /*#__PURE__*/css(["", ":0.4;"], switchTokens.disabledOpacity)
|
@@ -20,7 +20,8 @@ export declare const tokens: {
|
|
20
20
|
verticalGap: string;
|
21
21
|
trackWidth: string;
|
22
22
|
trackHeight: string;
|
23
|
-
|
23
|
+
trackBorderWidthOn: string;
|
24
|
+
trackBorderWidthOff: string;
|
24
25
|
trackBorderColorOn: string;
|
25
26
|
trackBorderColorOnHover: string;
|
26
27
|
trackBorderColorOff: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;IAwBf,6DAA6D
|
1
|
+
{"version":3,"file":"Switch.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;IAwBf,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;CAkChE,CAAC;AAEF,eAAO,MAAM,OAAO;;;CAGnB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/components/Switch/_toggleSize/base.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/components/Switch/_toggleSize/base.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,0CA2BhB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.config.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Switch/Switch.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"Switch.config.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Switch/Switch.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGlB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.outline.config.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Switch/Switch.outline.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"Switch.outline.config.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_b2c/components/Switch/Switch.outline.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyGlB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.config.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_web/components/Switch/Switch.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"Switch.config.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_web/components/Switch/Switch.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGlB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.outline.config.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_web/components/Switch/Switch.outline.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"Switch.outline.config.d.ts","sourceRoot":"","sources":["../../../../../src/examples/plasma_web/components/Switch/Switch.outline.config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyGlB,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
.b1wld3h3 .s2cs3kf{box-sizing:border-box;-webkit-flex:0 0 var(--plasma-switch__track-width);-ms-flex:0 0 var(--plasma-switch__track-width);flex:0 0 var(--plasma-switch__track-width);border-style:solid;border-width:var(--plasma-switch__track-border);border-radius:var(--plasma-switch__track-border-radius);width:var(--plasma-switch__track-width);height:var(--plasma-switch__track-height);}.b1wld3h3 .s2cs3kf::after{width:var(--plasma-switch__thumb-size);height:var(--plasma-switch__thumb-size);border-radius:var(--plasma-switch__thumb-border-radius);margin:auto var(--plasma-switch__thumb-offset);}.b1wld3h3:active:not([disabled]) .s2cs3kf::after{width:calc(var(--plasma-switch__thumb-size) * var(--plasma-switch__thumb-scale,1));}
|
@@ -1,184 +0,0 @@
|
|
1
|
-
---
|
2
|
-
id: card
|
3
|
-
title: Card
|
4
|
-
---
|
5
|
-
|
6
|
-
отличия от https://plasma.sberdevices.ru/b2c/components/card/:
|
7
|
-
* избавляемся от CardBody
|
8
|
-
* убираем дублирование disabled
|
9
|
-
|
10
|
-
примеры дизайна https://www.figma.com/design/MXl0ZkXEqEhIFDS2H6b3yk/StarDS-Cards?node-id=2-690&node-type=instance&t=TJN8Nqyiky3Dfw2T-0
|
11
|
-
|
12
|
-
другие либы:
|
13
|
-
https://ant.design/components/card#
|
14
|
-
https://mui.com/material-ui/react-card/
|
15
|
-
|
16
|
-
```tsx live
|
17
|
-
import React, { ReactNode } from "react";
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Набор часто встречающихся скруглений.
|
21
|
-
*/
|
22
|
-
|
23
|
-
export const radiuses = {
|
24
|
-
250: 15.625,
|
25
|
-
32: 2,
|
26
|
-
28: 1.75,
|
27
|
-
24: 1.5,
|
28
|
-
20: 1.25,
|
29
|
-
18: 1.125,
|
30
|
-
16: 1,
|
31
|
-
14: 0.875,
|
32
|
-
12: 0.75,
|
33
|
-
8: 0.5,
|
34
|
-
0: 0,
|
35
|
-
};
|
36
|
-
|
37
|
-
export type Roundness = keyof typeof radiuses;
|
38
|
-
|
39
|
-
export interface RoundnessProps {
|
40
|
-
/** Скругленность */
|
41
|
-
roundness: Roundness;
|
42
|
-
}
|
43
|
-
|
44
|
-
interface Card {
|
45
|
-
/** Компонент в фокусе */
|
46
|
-
focused?: boolean;
|
47
|
-
/** Увеличение по фокусу */
|
48
|
-
scaleOnFocus?: boolean;
|
49
|
-
/** Компонент неактивен */
|
50
|
-
disabled?: boolean;
|
51
|
-
/** Добавить рамку при фокусе */
|
52
|
-
outlined?: boolean;
|
53
|
-
/** Цвет подложки */
|
54
|
-
background?: string;
|
55
|
-
/** Делает карточку квадратной */
|
56
|
-
square?: boolean;
|
57
|
-
/** Заголовок */
|
58
|
-
title?: string | ReactNode;
|
59
|
-
/** Подзаголовок */
|
60
|
-
subtitle?: string | ReactNode;
|
61
|
-
/** Расположение заголовка и подзаголовка, пока нет в дизайне */
|
62
|
-
titlePlacement?: "inner" | "outer";
|
63
|
-
/** Выравнивание заголовка и подзаголовка */
|
64
|
-
titleAlign?: "left" | "center";
|
65
|
-
/** Подвал, или вынести в
|
66
|
-
* <CardContent footer={<CardTimeline />} /> или <CardFooter><CardTimeline /></CardFooter>
|
67
|
-
* */
|
68
|
-
footer?: ReactNode;
|
69
|
-
}
|
70
|
-
|
71
|
-
const ratios = {
|
72
|
-
"1 / 1": "100",
|
73
|
-
"1/1": "100",
|
74
|
-
"3 / 4": "133.3333",
|
75
|
-
"3/4": "133.3333",
|
76
|
-
"4 / 3": "75",
|
77
|
-
"4/3": "75",
|
78
|
-
"9 / 16": "177.7778",
|
79
|
-
"9/16": "177.7778",
|
80
|
-
"16 / 9": "56.25",
|
81
|
-
"16/9": "56.25",
|
82
|
-
"1 / 2": "200",
|
83
|
-
"1/2": "200",
|
84
|
-
"2 / 1": "50",
|
85
|
-
"2/1": "50",
|
86
|
-
};
|
87
|
-
|
88
|
-
export type Ratio = keyof typeof ratios;
|
89
|
-
|
90
|
-
/**
|
91
|
-
* CardMedia из текущей реализации
|
92
|
-
* Стоит ли заменить пропсом `cover?: ReactNode;` в Card как в Ant?
|
93
|
-
* а width и height передавать в style...
|
94
|
-
*
|
95
|
-
* имхо, нет. у Card может быть title и subtitle под карточкой
|
96
|
-
* скорее всего, на них свойство height не должно распространяться
|
97
|
-
* стоит подождать финальный дизайн
|
98
|
-
*/
|
99
|
-
interface CardMedia {
|
100
|
-
base?: "img" | "div";
|
101
|
-
height?: string | number;
|
102
|
-
ratio?: Ratio;
|
103
|
-
customRatio?: string;
|
104
|
-
}
|
105
|
-
|
106
|
-
interface CardContent {
|
107
|
-
topLeft?: string | ReactNode;
|
108
|
-
topRight?: string | ReactNode;
|
109
|
-
bottomLeft?: string | ReactNode;
|
110
|
-
bottomRight?: string | ReactNode;
|
111
|
-
children?: ReactNode;
|
112
|
-
}
|
113
|
-
|
114
|
-
/** или */
|
115
|
-
interface CardContent {
|
116
|
-
placement?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
117
|
-
children?: ReactNode;
|
118
|
-
}
|
119
|
-
|
120
|
-
interface CardTimeline {
|
121
|
-
/**
|
122
|
-
* Описание, например время до конца фильма. Возможно,
|
123
|
-
* не нужно и стоит указывать bottomRight контент
|
124
|
-
*/
|
125
|
-
text?: string;
|
126
|
-
progress?: string | number;
|
127
|
-
/**
|
128
|
-
* Не увеличивать высоту карточки
|
129
|
-
* @default true
|
130
|
-
*/
|
131
|
-
inline?: boolean;
|
132
|
-
}
|
133
|
-
```
|
134
|
-
|
135
|
-
```tsx live
|
136
|
-
<Card title="Title" subtitle="Subtitle">
|
137
|
-
<CardContent placement="top-left">
|
138
|
-
<SomeIcon />
|
139
|
-
</CardContent>
|
140
|
-
<CardContent placement="top-right">
|
141
|
-
<SaveButton saved={isSaved} />
|
142
|
-
</CardContent>
|
143
|
-
<CardContent placement="bottom-right">18+</CardContent>
|
144
|
-
</Card>;
|
145
|
-
|
146
|
-
<Card title="Title" subtitle="Subtitle">
|
147
|
-
<CardContent
|
148
|
-
topLeft={<SomeIcon />}
|
149
|
-
topRight={<SaveButton saved={isSaved} />}
|
150
|
-
bottomRight="18+"
|
151
|
-
/>
|
152
|
-
</Card>;
|
153
|
-
|
154
|
-
<Card title="Title" subtitle="Subtitle">
|
155
|
-
<CardMedia src={someSrc} alt="trailer" />
|
156
|
-
<CardContent
|
157
|
-
topLeft={<SomeIcon />}
|
158
|
-
topRight={<SaveButton saved={isSaved} />}
|
159
|
-
bottomRight="18+"
|
160
|
-
/>
|
161
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
162
|
-
</Card>;
|
163
|
-
|
164
|
-
<Card title="Title" subtitle="Subtitle">
|
165
|
-
<CardContent topLeft={<SomeIcon />} topRight={<SaveButton saved={isSaved} />}>
|
166
|
-
<CardMedia src={someSrc} alt="trailer" />
|
167
|
-
</CardContent>
|
168
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
169
|
-
</Card>;
|
170
|
-
|
171
|
-
<Card
|
172
|
-
title="Title"
|
173
|
-
subtitle="Subtitle"
|
174
|
-
// как в ant, но кажется, что так менее гибко
|
175
|
-
cover={<CardMedia src={someSrc} alt="trailer" />}
|
176
|
-
square
|
177
|
-
>
|
178
|
-
<CardContent
|
179
|
-
topLeft={<SomeIcon />}
|
180
|
-
topRight={<SaveButton saved={isSaved} />}
|
181
|
-
/>
|
182
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
183
|
-
</Card>;
|
184
|
-
```
|
@@ -1,184 +0,0 @@
|
|
1
|
-
---
|
2
|
-
id: card
|
3
|
-
title: Card
|
4
|
-
---
|
5
|
-
|
6
|
-
отличия от https://plasma.sberdevices.ru/b2c/components/card/:
|
7
|
-
* избавляемся от CardBody
|
8
|
-
* убираем дублирование disabled
|
9
|
-
|
10
|
-
примеры дизайна https://www.figma.com/design/MXl0ZkXEqEhIFDS2H6b3yk/StarDS-Cards?node-id=2-690&node-type=instance&t=TJN8Nqyiky3Dfw2T-0
|
11
|
-
|
12
|
-
другие либы:
|
13
|
-
https://ant.design/components/card#
|
14
|
-
https://mui.com/material-ui/react-card/
|
15
|
-
|
16
|
-
```tsx live
|
17
|
-
import React, { ReactNode } from "react";
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Набор часто встречающихся скруглений.
|
21
|
-
*/
|
22
|
-
|
23
|
-
export const radiuses = {
|
24
|
-
250: 15.625,
|
25
|
-
32: 2,
|
26
|
-
28: 1.75,
|
27
|
-
24: 1.5,
|
28
|
-
20: 1.25,
|
29
|
-
18: 1.125,
|
30
|
-
16: 1,
|
31
|
-
14: 0.875,
|
32
|
-
12: 0.75,
|
33
|
-
8: 0.5,
|
34
|
-
0: 0,
|
35
|
-
};
|
36
|
-
|
37
|
-
export type Roundness = keyof typeof radiuses;
|
38
|
-
|
39
|
-
export interface RoundnessProps {
|
40
|
-
/** Скругленность */
|
41
|
-
roundness: Roundness;
|
42
|
-
}
|
43
|
-
|
44
|
-
interface Card {
|
45
|
-
/** Компонент в фокусе */
|
46
|
-
focused?: boolean;
|
47
|
-
/** Увеличение по фокусу */
|
48
|
-
scaleOnFocus?: boolean;
|
49
|
-
/** Компонент неактивен */
|
50
|
-
disabled?: boolean;
|
51
|
-
/** Добавить рамку при фокусе */
|
52
|
-
outlined?: boolean;
|
53
|
-
/** Цвет подложки */
|
54
|
-
background?: string;
|
55
|
-
/** Делает карточку квадратной */
|
56
|
-
square?: boolean;
|
57
|
-
/** Заголовок */
|
58
|
-
title?: string | ReactNode;
|
59
|
-
/** Подзаголовок */
|
60
|
-
subtitle?: string | ReactNode;
|
61
|
-
/** Расположение заголовка и подзаголовка, пока нет в дизайне */
|
62
|
-
titlePlacement?: "inner" | "outer";
|
63
|
-
/** Выравнивание заголовка и подзаголовка */
|
64
|
-
titleAlign?: "left" | "center";
|
65
|
-
/** Подвал, или вынести в
|
66
|
-
* <CardContent footer={<CardTimeline />} /> или <CardFooter><CardTimeline /></CardFooter>
|
67
|
-
* */
|
68
|
-
footer?: ReactNode;
|
69
|
-
}
|
70
|
-
|
71
|
-
const ratios = {
|
72
|
-
"1 / 1": "100",
|
73
|
-
"1/1": "100",
|
74
|
-
"3 / 4": "133.3333",
|
75
|
-
"3/4": "133.3333",
|
76
|
-
"4 / 3": "75",
|
77
|
-
"4/3": "75",
|
78
|
-
"9 / 16": "177.7778",
|
79
|
-
"9/16": "177.7778",
|
80
|
-
"16 / 9": "56.25",
|
81
|
-
"16/9": "56.25",
|
82
|
-
"1 / 2": "200",
|
83
|
-
"1/2": "200",
|
84
|
-
"2 / 1": "50",
|
85
|
-
"2/1": "50",
|
86
|
-
};
|
87
|
-
|
88
|
-
export type Ratio = keyof typeof ratios;
|
89
|
-
|
90
|
-
/**
|
91
|
-
* CardMedia из текущей реализации
|
92
|
-
* Стоит ли заменить пропсом `cover?: ReactNode;` в Card как в Ant?
|
93
|
-
* а width и height передавать в style...
|
94
|
-
*
|
95
|
-
* имхо, нет. у Card может быть title и subtitle под карточкой
|
96
|
-
* скорее всего, на них свойство height не должно распространяться
|
97
|
-
* стоит подождать финальный дизайн
|
98
|
-
*/
|
99
|
-
interface CardMedia {
|
100
|
-
base?: "img" | "div";
|
101
|
-
height?: string | number;
|
102
|
-
ratio?: Ratio;
|
103
|
-
customRatio?: string;
|
104
|
-
}
|
105
|
-
|
106
|
-
interface CardContent {
|
107
|
-
topLeft?: string | ReactNode;
|
108
|
-
topRight?: string | ReactNode;
|
109
|
-
bottomLeft?: string | ReactNode;
|
110
|
-
bottomRight?: string | ReactNode;
|
111
|
-
children?: ReactNode;
|
112
|
-
}
|
113
|
-
|
114
|
-
/** или */
|
115
|
-
interface CardContent {
|
116
|
-
placement?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
117
|
-
children?: ReactNode;
|
118
|
-
}
|
119
|
-
|
120
|
-
interface CardTimeline {
|
121
|
-
/**
|
122
|
-
* Описание, например время до конца фильма. Возможно,
|
123
|
-
* не нужно и стоит указывать bottomRight контент
|
124
|
-
*/
|
125
|
-
text?: string;
|
126
|
-
progress?: string | number;
|
127
|
-
/**
|
128
|
-
* Не увеличивать высоту карточки
|
129
|
-
* @default true
|
130
|
-
*/
|
131
|
-
inline?: boolean;
|
132
|
-
}
|
133
|
-
```
|
134
|
-
|
135
|
-
```tsx live
|
136
|
-
<Card title="Title" subtitle="Subtitle">
|
137
|
-
<CardContent placement="top-left">
|
138
|
-
<SomeIcon />
|
139
|
-
</CardContent>
|
140
|
-
<CardContent placement="top-right">
|
141
|
-
<SaveButton saved={isSaved} />
|
142
|
-
</CardContent>
|
143
|
-
<CardContent placement="bottom-right">18+</CardContent>
|
144
|
-
</Card>;
|
145
|
-
|
146
|
-
<Card title="Title" subtitle="Subtitle">
|
147
|
-
<CardContent
|
148
|
-
topLeft={<SomeIcon />}
|
149
|
-
topRight={<SaveButton saved={isSaved} />}
|
150
|
-
bottomRight="18+"
|
151
|
-
/>
|
152
|
-
</Card>;
|
153
|
-
|
154
|
-
<Card title="Title" subtitle="Subtitle">
|
155
|
-
<CardMedia src={someSrc} alt="trailer" />
|
156
|
-
<CardContent
|
157
|
-
topLeft={<SomeIcon />}
|
158
|
-
topRight={<SaveButton saved={isSaved} />}
|
159
|
-
bottomRight="18+"
|
160
|
-
/>
|
161
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
162
|
-
</Card>;
|
163
|
-
|
164
|
-
<Card title="Title" subtitle="Subtitle">
|
165
|
-
<CardContent topLeft={<SomeIcon />} topRight={<SaveButton saved={isSaved} />}>
|
166
|
-
<CardMedia src={someSrc} alt="trailer" />
|
167
|
-
</CardContent>
|
168
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
169
|
-
</Card>;
|
170
|
-
|
171
|
-
<Card
|
172
|
-
title="Title"
|
173
|
-
subtitle="Subtitle"
|
174
|
-
// как в ant, но кажется, что так менее гибко
|
175
|
-
cover={<CardMedia src={someSrc} alt="trailer" />}
|
176
|
-
square
|
177
|
-
>
|
178
|
-
<CardContent
|
179
|
-
topLeft={<SomeIcon />}
|
180
|
-
topRight={<SaveButton saved={isSaved} />}
|
181
|
-
/>
|
182
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
183
|
-
</Card>;
|
184
|
-
```
|
@@ -1 +0,0 @@
|
|
1
|
-
.b1wld3h3 .s2cs3kf{box-sizing:border-box;-webkit-flex:0 0 var(--plasma-switch__track-width);-ms-flex:0 0 var(--plasma-switch__track-width);flex:0 0 var(--plasma-switch__track-width);border-style:solid;border-width:var(--plasma-switch__track-border);border-radius:var(--plasma-switch__track-border-radius);width:var(--plasma-switch__track-width);height:var(--plasma-switch__track-height);}.b1wld3h3 .s2cs3kf::after{width:var(--plasma-switch__thumb-size);height:var(--plasma-switch__thumb-size);border-radius:var(--plasma-switch__thumb-border-radius);margin:auto var(--plasma-switch__thumb-offset);}.b1wld3h3:active:not([disabled]) .s2cs3kf::after{width:calc(var(--plasma-switch__thumb-size) * var(--plasma-switch__thumb-scale,1));}
|
@@ -1,184 +0,0 @@
|
|
1
|
-
---
|
2
|
-
id: card
|
3
|
-
title: Card
|
4
|
-
---
|
5
|
-
|
6
|
-
отличия от https://plasma.sberdevices.ru/b2c/components/card/:
|
7
|
-
* избавляемся от CardBody
|
8
|
-
* убираем дублирование disabled
|
9
|
-
|
10
|
-
примеры дизайна https://www.figma.com/design/MXl0ZkXEqEhIFDS2H6b3yk/StarDS-Cards?node-id=2-690&node-type=instance&t=TJN8Nqyiky3Dfw2T-0
|
11
|
-
|
12
|
-
другие либы:
|
13
|
-
https://ant.design/components/card#
|
14
|
-
https://mui.com/material-ui/react-card/
|
15
|
-
|
16
|
-
```tsx live
|
17
|
-
import React, { ReactNode } from "react";
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Набор часто встречающихся скруглений.
|
21
|
-
*/
|
22
|
-
|
23
|
-
export const radiuses = {
|
24
|
-
250: 15.625,
|
25
|
-
32: 2,
|
26
|
-
28: 1.75,
|
27
|
-
24: 1.5,
|
28
|
-
20: 1.25,
|
29
|
-
18: 1.125,
|
30
|
-
16: 1,
|
31
|
-
14: 0.875,
|
32
|
-
12: 0.75,
|
33
|
-
8: 0.5,
|
34
|
-
0: 0,
|
35
|
-
};
|
36
|
-
|
37
|
-
export type Roundness = keyof typeof radiuses;
|
38
|
-
|
39
|
-
export interface RoundnessProps {
|
40
|
-
/** Скругленность */
|
41
|
-
roundness: Roundness;
|
42
|
-
}
|
43
|
-
|
44
|
-
interface Card {
|
45
|
-
/** Компонент в фокусе */
|
46
|
-
focused?: boolean;
|
47
|
-
/** Увеличение по фокусу */
|
48
|
-
scaleOnFocus?: boolean;
|
49
|
-
/** Компонент неактивен */
|
50
|
-
disabled?: boolean;
|
51
|
-
/** Добавить рамку при фокусе */
|
52
|
-
outlined?: boolean;
|
53
|
-
/** Цвет подложки */
|
54
|
-
background?: string;
|
55
|
-
/** Делает карточку квадратной */
|
56
|
-
square?: boolean;
|
57
|
-
/** Заголовок */
|
58
|
-
title?: string | ReactNode;
|
59
|
-
/** Подзаголовок */
|
60
|
-
subtitle?: string | ReactNode;
|
61
|
-
/** Расположение заголовка и подзаголовка, пока нет в дизайне */
|
62
|
-
titlePlacement?: "inner" | "outer";
|
63
|
-
/** Выравнивание заголовка и подзаголовка */
|
64
|
-
titleAlign?: "left" | "center";
|
65
|
-
/** Подвал, или вынести в
|
66
|
-
* <CardContent footer={<CardTimeline />} /> или <CardFooter><CardTimeline /></CardFooter>
|
67
|
-
* */
|
68
|
-
footer?: ReactNode;
|
69
|
-
}
|
70
|
-
|
71
|
-
const ratios = {
|
72
|
-
"1 / 1": "100",
|
73
|
-
"1/1": "100",
|
74
|
-
"3 / 4": "133.3333",
|
75
|
-
"3/4": "133.3333",
|
76
|
-
"4 / 3": "75",
|
77
|
-
"4/3": "75",
|
78
|
-
"9 / 16": "177.7778",
|
79
|
-
"9/16": "177.7778",
|
80
|
-
"16 / 9": "56.25",
|
81
|
-
"16/9": "56.25",
|
82
|
-
"1 / 2": "200",
|
83
|
-
"1/2": "200",
|
84
|
-
"2 / 1": "50",
|
85
|
-
"2/1": "50",
|
86
|
-
};
|
87
|
-
|
88
|
-
export type Ratio = keyof typeof ratios;
|
89
|
-
|
90
|
-
/**
|
91
|
-
* CardMedia из текущей реализации
|
92
|
-
* Стоит ли заменить пропсом `cover?: ReactNode;` в Card как в Ant?
|
93
|
-
* а width и height передавать в style...
|
94
|
-
*
|
95
|
-
* имхо, нет. у Card может быть title и subtitle под карточкой
|
96
|
-
* скорее всего, на них свойство height не должно распространяться
|
97
|
-
* стоит подождать финальный дизайн
|
98
|
-
*/
|
99
|
-
interface CardMedia {
|
100
|
-
base?: "img" | "div";
|
101
|
-
height?: string | number;
|
102
|
-
ratio?: Ratio;
|
103
|
-
customRatio?: string;
|
104
|
-
}
|
105
|
-
|
106
|
-
interface CardContent {
|
107
|
-
topLeft?: string | ReactNode;
|
108
|
-
topRight?: string | ReactNode;
|
109
|
-
bottomLeft?: string | ReactNode;
|
110
|
-
bottomRight?: string | ReactNode;
|
111
|
-
children?: ReactNode;
|
112
|
-
}
|
113
|
-
|
114
|
-
/** или */
|
115
|
-
interface CardContent {
|
116
|
-
placement?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
117
|
-
children?: ReactNode;
|
118
|
-
}
|
119
|
-
|
120
|
-
interface CardTimeline {
|
121
|
-
/**
|
122
|
-
* Описание, например время до конца фильма. Возможно,
|
123
|
-
* не нужно и стоит указывать bottomRight контент
|
124
|
-
*/
|
125
|
-
text?: string;
|
126
|
-
progress?: string | number;
|
127
|
-
/**
|
128
|
-
* Не увеличивать высоту карточки
|
129
|
-
* @default true
|
130
|
-
*/
|
131
|
-
inline?: boolean;
|
132
|
-
}
|
133
|
-
```
|
134
|
-
|
135
|
-
```tsx live
|
136
|
-
<Card title="Title" subtitle="Subtitle">
|
137
|
-
<CardContent placement="top-left">
|
138
|
-
<SomeIcon />
|
139
|
-
</CardContent>
|
140
|
-
<CardContent placement="top-right">
|
141
|
-
<SaveButton saved={isSaved} />
|
142
|
-
</CardContent>
|
143
|
-
<CardContent placement="bottom-right">18+</CardContent>
|
144
|
-
</Card>;
|
145
|
-
|
146
|
-
<Card title="Title" subtitle="Subtitle">
|
147
|
-
<CardContent
|
148
|
-
topLeft={<SomeIcon />}
|
149
|
-
topRight={<SaveButton saved={isSaved} />}
|
150
|
-
bottomRight="18+"
|
151
|
-
/>
|
152
|
-
</Card>;
|
153
|
-
|
154
|
-
<Card title="Title" subtitle="Subtitle">
|
155
|
-
<CardMedia src={someSrc} alt="trailer" />
|
156
|
-
<CardContent
|
157
|
-
topLeft={<SomeIcon />}
|
158
|
-
topRight={<SaveButton saved={isSaved} />}
|
159
|
-
bottomRight="18+"
|
160
|
-
/>
|
161
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
162
|
-
</Card>;
|
163
|
-
|
164
|
-
<Card title="Title" subtitle="Subtitle">
|
165
|
-
<CardContent topLeft={<SomeIcon />} topRight={<SaveButton saved={isSaved} />}>
|
166
|
-
<CardMedia src={someSrc} alt="trailer" />
|
167
|
-
</CardContent>
|
168
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
169
|
-
</Card>;
|
170
|
-
|
171
|
-
<Card
|
172
|
-
title="Title"
|
173
|
-
subtitle="Subtitle"
|
174
|
-
// как в ant, но кажется, что так менее гибко
|
175
|
-
cover={<CardMedia src={someSrc} alt="trailer" />}
|
176
|
-
square
|
177
|
-
>
|
178
|
-
<CardContent
|
179
|
-
topLeft={<SomeIcon />}
|
180
|
-
topRight={<SaveButton saved={isSaved} />}
|
181
|
-
/>
|
182
|
-
<CardTimeline text="еще 1ч 23мин" progress={56} />
|
183
|
-
</Card>;
|
184
|
-
```
|