@salutejs/plasma-core 1.226.1-next-sbcom.0 → 1.227.0-dev.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/__helpers/IconPlaceholder.js +6 -9
- package/__helpers/index.js +1 -1
- package/collectPackageInfo.js +4 -4
- package/components/Badge/Badge.js +30 -103
- package/components/Badge/index.js +1 -1
- package/components/Basebox/Basebox.js +33 -42
- package/components/Basebox/index.js +1 -1
- package/components/Button/Button.js +28 -67
- package/components/Button/Button.mixins.js +22 -76
- package/components/Button/Button.props.js +5 -5
- package/components/Button/createButton.js +14 -145
- package/components/Button/index.js +4 -4
- package/components/Card/Card.js +34 -162
- package/components/Card/CardBody.js +4 -4
- package/components/Card/CardContent.js +14 -23
- package/components/Card/CardMedia.js +20 -91
- package/components/Card/CardPrice.js +18 -60
- package/components/Card/CardTypography.js +43 -52
- package/components/Card/index.js +5 -5
- package/components/Carousel/Carousel.js +46 -64
- package/components/Carousel/CarouselItem.js +21 -93
- package/components/Carousel/hooks.js +62 -121
- package/components/Carousel/index.js +3 -3
- package/components/Carousel/utils.js +59 -73
- package/components/Fade/Fade.js +6 -9
- package/components/Fade/index.js +1 -1
- package/components/Field/Field.js +48 -63
- package/components/Field/Field.statuses.js +3 -3
- package/components/Field/index.js +2 -2
- package/components/Image/Image.js +34 -115
- package/components/Image/index.js +1 -1
- package/components/Input/Input.js +7 -7
- package/components/Input/Input.mixins.js +9 -12
- package/components/Input/index.js +1 -1
- package/components/ModalBase/ModalBase.js +22 -100
- package/components/ModalBase/ModalBaseContext.js +6 -9
- package/components/ModalBase/ModalOverlay.js +28 -111
- package/components/ModalBase/hooks.js +15 -43
- package/components/ModalBase/index.js +2 -2
- package/components/PaginationDots/PaginationDot.js +11 -17
- package/components/PaginationDots/PaginationDots.js +4 -7
- package/components/PaginationDots/index.js +3 -3
- package/components/PaginationDots/usePaginationDots.js +10 -11
- package/components/Popup/Popup.js +52 -205
- package/components/Popup/index.js +1 -1
- package/components/PopupBase/PopupBase.js +35 -169
- package/components/PopupBase/PopupBaseContext.js +26 -86
- package/components/PopupBase/PopupBaseRoot.js +31 -169
- package/components/PopupBase/hooks.js +23 -97
- package/components/PopupBase/index.js +3 -3
- package/components/PopupBase/utils.js +32 -78
- package/components/Price/Price.js +15 -90
- package/components/Price/index.js +1 -1
- package/components/RadioGroup/RadioGroup.js +6 -127
- package/components/RadioGroup/index.js +1 -1
- package/components/SSRProvider/SSRProvider.js +4 -5
- package/components/SSRProvider/index.js +1 -1
- package/components/Skeleton/LineSkeleton.js +23 -95
- package/components/Skeleton/RectSkeleton.js +20 -93
- package/components/Skeleton/Skeleton.js +2 -2
- package/components/Skeleton/TextSkeleton.js +11 -55
- package/components/Skeleton/index.js +3 -3
- package/components/Slider/Double.js +52 -203
- package/components/Slider/Handle.js +28 -158
- package/components/Slider/Single.js +29 -177
- package/components/Slider/Slider.js +5 -7
- package/components/Slider/SliderBase.js +39 -48
- package/components/Slider/ThumbBase.js +19 -95
- package/components/Slider/index.js +3 -3
- package/components/Slider/utils.js +2 -2
- package/components/Spinner/Spinner.js +28 -100
- package/components/Spinner/SpinnerSvg.js +9 -78
- package/components/Spinner/index.js +1 -1
- package/components/Switch/Switch.js +49 -220
- package/components/Switch/index.js +1 -1
- package/components/Tabs/TabItem.js +33 -168
- package/components/Tabs/Tabs.js +32 -170
- package/components/Tabs/TabsContext.js +12 -42
- package/components/Tabs/createTabsController.js +33 -168
- package/components/Tabs/index.js +4 -4
- package/components/TextArea/TextArea.js +20 -30
- package/components/TextArea/index.js +1 -1
- package/components/TextField/index.js +3 -3
- package/components/Toast/Toast.js +15 -16
- package/components/Toast/ToastContext.js +4 -8
- package/components/Toast/ToastController.js +44 -101
- package/components/Toast/ToastProvider.js +37 -142
- package/components/Toast/index.js +3 -3
- package/components/Toast/useToast.js +6 -6
- package/components/Typography/Body.js +18 -18
- package/components/Typography/Button.js +13 -13
- package/components/Typography/Caption.js +8 -8
- package/components/Typography/Display.js +18 -18
- package/components/Typography/Footnote.js +13 -13
- package/components/Typography/Headline.js +43 -43
- package/components/Typography/Paragraph.js +24 -24
- package/components/Typography/Underline.js +8 -8
- package/es/__helpers/IconPlaceholder.js +5 -8
- package/es/collectPackageInfo.js +3 -3
- package/es/components/Badge/Badge.js +27 -100
- package/es/components/Basebox/Basebox.js +28 -37
- package/es/components/Button/Button.js +24 -63
- package/es/components/Button/Button.mixins.js +19 -73
- package/es/components/Button/Button.props.js +3 -3
- package/es/components/Button/createButton.js +12 -143
- package/es/components/Card/Card.js +29 -157
- package/es/components/Card/CardBody.js +2 -2
- package/es/components/Card/CardContent.js +12 -21
- package/es/components/Card/CardMedia.js +17 -88
- package/es/components/Card/CardPrice.js +13 -55
- package/es/components/Card/CardTypography.js +43 -52
- package/es/components/Carousel/Carousel.js +45 -63
- package/es/components/Carousel/CarouselItem.js +18 -90
- package/es/components/Carousel/hooks.js +58 -117
- package/es/components/Carousel/utils.js +58 -72
- package/es/components/Fade/Fade.js +5 -8
- package/es/components/Field/Field.js +44 -59
- package/es/components/Field/Field.statuses.js +4 -4
- package/es/components/Image/Image.js +31 -112
- package/es/components/Input/Input.js +4 -4
- package/es/components/Input/Input.mixins.js +6 -9
- package/es/components/ModalBase/ModalBase.js +16 -94
- package/es/components/ModalBase/ModalBaseContext.js +6 -9
- package/es/components/ModalBase/ModalOverlay.js +23 -106
- package/es/components/ModalBase/hooks.js +12 -40
- package/es/components/PaginationDots/PaginationDot.js +9 -15
- package/es/components/PaginationDots/PaginationDots.js +3 -6
- package/es/components/PaginationDots/usePaginationDots.js +9 -10
- package/es/components/Popup/Popup.js +48 -201
- package/es/components/PopupBase/PopupBase.js +27 -161
- package/es/components/PopupBase/PopupBaseContext.js +25 -85
- package/es/components/PopupBase/PopupBaseRoot.js +26 -164
- package/es/components/PopupBase/hooks.js +21 -95
- package/es/components/PopupBase/utils.js +31 -77
- package/es/components/Price/Price.js +12 -87
- package/es/components/RadioGroup/RadioGroup.js +5 -126
- package/es/components/SSRProvider/SSRProvider.js +3 -4
- package/es/components/Skeleton/LineSkeleton.js +18 -90
- package/es/components/Skeleton/RectSkeleton.js +16 -89
- package/es/components/Skeleton/Skeleton.js +2 -2
- package/es/components/Skeleton/TextSkeleton.js +7 -51
- package/es/components/Slider/Double.js +49 -200
- package/es/components/Slider/Handle.js +23 -153
- package/es/components/Slider/Single.js +26 -174
- package/es/components/Slider/Slider.js +2 -4
- package/es/components/Slider/SliderBase.js +36 -45
- package/es/components/Slider/ThumbBase.js +16 -92
- package/es/components/Slider/index.js +1 -1
- package/es/components/Slider/utils.js +2 -2
- package/es/components/Spinner/Spinner.js +23 -95
- package/es/components/Spinner/SpinnerSvg.js +8 -77
- package/es/components/Switch/Switch.js +45 -216
- package/es/components/Tabs/TabItem.js +28 -163
- package/es/components/Tabs/Tabs.js +28 -166
- package/es/components/Tabs/TabsContext.js +11 -41
- package/es/components/Tabs/createTabsController.js +28 -163
- package/es/components/TextArea/TextArea.js +18 -28
- package/es/components/Toast/Toast.js +10 -11
- package/es/components/Toast/ToastContext.js +3 -7
- package/es/components/Toast/ToastController.js +38 -95
- package/es/components/Toast/ToastProvider.js +34 -139
- package/es/components/Toast/useToast.js +4 -4
- package/es/components/Typography/Body.js +15 -15
- package/es/components/Typography/Button.js +10 -10
- package/es/components/Typography/Caption.js +5 -5
- package/es/components/Typography/Display.js +15 -15
- package/es/components/Typography/Footnote.js +10 -10
- package/es/components/Typography/Headline.js +40 -40
- package/es/components/Typography/Paragraph.js +21 -21
- package/es/components/Typography/Underline.js +5 -5
- package/es/hocs/withAutoFocus.js +8 -78
- package/es/hocs/withSkeleton.js +5 -10
- package/es/hooks/useDebouncedFunction.js +4 -36
- package/es/hooks/useFocusTrap.js +18 -21
- package/es/hooks/useForkRef.js +3 -3
- package/es/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/es/hooks/useResizeObserver.js +8 -8
- package/es/hooks/useUniqId.js +6 -52
- package/es/mixins/addFocus.js +17 -22
- package/es/mixins/applyDisabled.js +6 -9
- package/es/mixins/applyEllipsis.js +2 -4
- package/es/mixins/applyMaxLines.js +3 -6
- package/es/mixins/applyNoSelect.js +2 -4
- package/es/mixins/applyOutline.js +2 -4
- package/es/mixins/applyRoundness.js +4 -7
- package/es/mixins/applyScrollSnap.js +4 -7
- package/es/mixins/applySkeletonGradient.js +6 -9
- package/es/mixins/applyView.js +2 -5
- package/es/mixins/blur.js +2 -5
- package/es/mixins/shadows.js +1 -1
- package/es/tokens/colors.js +48 -48
- package/es/tokens/typography.js +18 -18
- package/es/utils/__tests__/formatters.test.js +2 -2
- package/es/utils/animatedScrollTo.js +24 -34
- package/es/utils/canUseDOM.js +1 -1
- package/es/utils/extractTextFrom.js +3 -7
- package/es/utils/focusManager.js +40 -47
- package/es/utils/formatCurrency.js +4 -4
- package/es/utils/formatters.js +6 -14
- package/es/utils/react.js +4 -4
- package/es/utils/roundness.js +2 -4
- package/es/utils/scopeTab.js +5 -5
- package/es/utils/setRef.js +1 -1
- package/es/utils/tabbable.js +16 -25
- package/es/utils/toCssSize.js +1 -3
- package/es/utils/transformStyles.js +5 -60
- package/hocs/index.js +2 -2
- package/hocs/withAutoFocus.js +9 -79
- package/hocs/withSkeleton.js +8 -13
- package/hooks/index.js +6 -6
- package/hooks/useDebouncedFunction.js +5 -37
- package/hooks/useFocusTrap.js +22 -25
- package/hooks/useForkRef.js +5 -5
- package/hooks/useIsomorphicLayoutEffect.js +3 -3
- package/hooks/useResizeObserver.js +9 -9
- package/hooks/useUniqId.js +8 -54
- package/mixins/addFocus.js +19 -24
- package/mixins/applyDisabled.js +7 -10
- package/mixins/applyEllipsis.js +3 -5
- package/mixins/applyMaxLines.js +4 -7
- package/mixins/applyNoSelect.js +3 -5
- package/mixins/applyOutline.js +3 -5
- package/mixins/applyRoundness.js +5 -8
- package/mixins/applyScrollSnap.js +5 -8
- package/mixins/applySkeletonGradient.js +8 -11
- package/mixins/applyView.js +3 -6
- package/mixins/blur.js +2 -5
- package/mixins/index.js +11 -11
- package/mixins/shadows.js +1 -1
- package/package.json +13 -18
- package/tokens/colors.js +48 -48
- package/tokens/typography.js +18 -18
- package/utils/__tests__/formatters.test.js +3 -3
- package/utils/animatedScrollTo.js +24 -34
- package/utils/canUseDOM.js +1 -1
- package/utils/extractTextFrom.js +4 -8
- package/utils/focusManager.js +41 -48
- package/utils/formatCurrency.js +4 -4
- package/utils/formatters.js +6 -14
- package/utils/index.js +10 -10
- package/utils/react.js +7 -7
- package/utils/roundness.js +2 -4
- package/utils/scopeTab.js +6 -6
- package/utils/setRef.js +1 -1
- package/utils/tabbable.js +16 -25
- package/utils/toCssSize.js +1 -3
- package/utils/transformStyles.js +5 -60
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const disabledCss = css([
|
|
3
|
+
`opacity:0.4;cursor:not-allowed;&:hover,&:active{transform:none;}`
|
|
4
4
|
]);
|
|
5
5
|
/**
|
|
6
6
|
* Миксин неактивной кнопки
|
|
7
|
-
*/ export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"}",
|
|
12
|
-
""
|
|
7
|
+
*/ export const applyDisabled = ({ disabled, $disabled })=>css([
|
|
8
|
+
`&:disabled{`,
|
|
9
|
+
`}`,
|
|
10
|
+
``
|
|
13
11
|
], disabledCss, (disabled || $disabled) && disabledCss);
|
|
14
|
-
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
"overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"
|
|
2
|
+
export const applyEllipsis = ()=>css([
|
|
3
|
+
`overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`
|
|
5
4
|
]);
|
|
6
|
-
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"display:-webkit-box;overflow:hidden;box-sizing:border-box;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:",
|
|
6
|
-
";"
|
|
2
|
+
export const applyMaxLines = ({ maxLines })=>maxLines && css([
|
|
3
|
+
`display:-webkit-box;overflow:hidden;box-sizing:border-box;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:`,
|
|
4
|
+
`;`
|
|
7
5
|
], maxLines);
|
|
8
|
-
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
"user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);"
|
|
2
|
+
export const applyNoSelect = ()=>css([
|
|
3
|
+
`user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);`
|
|
5
4
|
]);
|
|
6
|
-
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
"position:relative;&::before{content:'';position:absolute;top:var(--plasma-outline-offset);left:var(--plasma-outline-offset);right:var(--plasma-outline-offset);bottom:var(--plasma-outline-offset);display:block;box-sizing:border-box;border:var(--plasma-outline-offset) solid transparent;border-radius:var(--plasma-outline-radius);transition:box-shadow 0.2s ease-in-out;pointer-events:none;}&:focus::before{box-shadow:0 0 0 var(--plasma-outline-size) var(--plasma-outline-radius);}"
|
|
2
|
+
export const applyOutline = ()=>css([
|
|
3
|
+
`position:relative;&::before{content:'';position:absolute;top:var(--plasma-outline-offset);left:var(--plasma-outline-offset);right:var(--plasma-outline-offset);bottom:var(--plasma-outline-offset);display:block;box-sizing:border-box;border:var(--plasma-outline-offset) solid transparent;border-radius:var(--plasma-outline-radius);transition:box-shadow 0.2s ease-in-out;pointer-events:none;}&:focus::before{box-shadow:0 0 0 var(--plasma-outline-size) var(--plasma-outline-radius);}`
|
|
5
4
|
]);
|
|
6
|
-
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
/**
|
|
3
3
|
* Набор часто встречающихся скруглений.
|
|
4
|
-
*/ export
|
|
4
|
+
*/ export const radiuses = {
|
|
5
5
|
250: 15.625,
|
|
6
6
|
32: 2,
|
|
7
7
|
28: 1.75,
|
|
@@ -16,10 +16,7 @@ import { css } from 'styled-components';
|
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Миксин скругленности.
|
|
19
|
-
*/ export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"border-radius:",
|
|
23
|
-
"rem;"
|
|
19
|
+
*/ export const applyRoundness = ({ roundness })=>css([
|
|
20
|
+
`border-radius:`,
|
|
21
|
+
`rem;`
|
|
24
22
|
], radiuses[roundness]);
|
|
25
|
-
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
";scroll-snap-stop:",
|
|
7
|
-
";"
|
|
2
|
+
export const applyScrollSnap = ({ scrollSnapAlign, scrollSnapStop })=>scrollSnapAlign && css([
|
|
3
|
+
`scroll-snap-align:`,
|
|
4
|
+
`;scroll-snap-stop:`,
|
|
5
|
+
`;`
|
|
8
6
|
], scrollSnapAlign, scrollSnapStop);
|
|
9
|
-
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { css, keyframes } from 'styled-components';
|
|
2
2
|
import { skeletonGradient, skeletonGradientLighter } from '../tokens';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const loading = keyframes([
|
|
4
|
+
`from{transform:translateX(0);}to{transform:translateX(100vw);}`
|
|
5
5
|
]);
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
" 4s linear infinite;background-image:",
|
|
11
|
-
";top:0;left:-100vw;width:200vw;height:100%;}"
|
|
6
|
+
export const applySkeletonGradient = ({ lighter })=>css([
|
|
7
|
+
`position:relative;overflow:hidden;z-index:1;&::before{content:'';position:absolute;animation:`,
|
|
8
|
+
` 4s linear infinite;background-image:`,
|
|
9
|
+
`;top:0;left:-100vw;width:200vw;height:100%;}`
|
|
12
10
|
], loading, lighter ? skeletonGradientLighter : skeletonGradient);
|
|
13
|
-
};
|
package/es/mixins/applyView.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { accent, white, text, buttonAccent, buttonSecondary, buttonSuccess, buttonWarning, buttonCritical, buttonChecked, transparent, background, blackSecondary } from '../tokens';
|
|
2
2
|
/**
|
|
3
3
|
* Общие цветовые стили оформления кнопок, баджей и т.п.
|
|
4
|
-
*/ export
|
|
4
|
+
*/ export const views = {
|
|
5
5
|
accent: {
|
|
6
6
|
backgroundColor: accent,
|
|
7
7
|
color: white
|
|
@@ -43,7 +43,4 @@ import { accent, white, text, buttonAccent, buttonSecondary, buttonSuccess, butt
|
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
45
|
* Миксин для применения общих цветовых стилей.
|
|
46
|
-
*/ export
|
|
47
|
-
var view = param.view;
|
|
48
|
-
return views[view];
|
|
49
|
-
};
|
|
46
|
+
*/ export const applyView = ({ view })=>views[view];
|
package/es/mixins/blur.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const blurs = {
|
|
2
2
|
small: '27px',
|
|
3
3
|
medium: '37px',
|
|
4
4
|
large: '50px'
|
|
5
5
|
};
|
|
6
|
-
export
|
|
7
|
-
var blur = param.blur;
|
|
8
|
-
return blur && "backdrop-filter: blur(".concat(blurs[blur], ");");
|
|
9
|
-
};
|
|
6
|
+
export const applyBlur = ({ blur })=>blur && `backdrop-filter: blur(${blurs[blur]});`;
|
package/es/mixins/shadows.js
CHANGED
package/es/tokens/colors.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
1
|
+
export const white = 'var(--plasma-colors-white)';
|
|
2
|
+
export const whitePrimary = 'var(--plasma-colors-white-primary)';
|
|
3
|
+
export const whiteSecondary = 'var(--plasma-colors-white-secondary)';
|
|
4
|
+
export const whiteTertiary = 'var(--plasma-colors-white-tertiary)';
|
|
5
|
+
export const black = 'var(--plasma-colors-black)';
|
|
6
|
+
export const blackPrimary = 'var(--plasma-colors-black-primary)';
|
|
7
|
+
export const blackSecondary = 'var(--plasma-colors-black-secondary)';
|
|
8
|
+
export const blackTertiary = 'var(--plasma-colors-black-tertiary)';
|
|
9
|
+
export const dark01 = 'var(--plasma-colors-dark01)';
|
|
10
|
+
export const dark02 = 'var(--plasma-colors-dark02)';
|
|
11
|
+
export const dark03 = 'var(--plasma-colors-dark03)';
|
|
12
|
+
export const transparent = 'var(--plasma-colors-transparent)';
|
|
13
|
+
export const text = 'var(--plasma-colors-text)';
|
|
14
|
+
export const primary = 'var(--plasma-colors-primary)';
|
|
15
|
+
export const secondary = 'var(--plasma-colors-secondary)';
|
|
16
|
+
export const tertiary = 'var(--plasma-colors-tertiary)';
|
|
17
|
+
export const inverse = 'var(--plasma-colors-inverse)';
|
|
18
|
+
export const paragraph = 'var(--plasma-colors-paragraph)';
|
|
19
|
+
export const background = 'var(--plasma-colors-background)';
|
|
20
|
+
export const backgroundPrimary = 'var(--plasma-colors-background-primary)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
21
|
+
export const backgroundSecondary = 'var(--plasma-colors-background-secondary)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
22
|
+
export const backgroundTertiary = 'var(--plasma-colors-background-tertiary)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
23
|
+
export const success = 'var(--plasma-colors-success)';
|
|
24
|
+
export const warning = 'var(--plasma-colors-warning)';
|
|
25
|
+
export const critical = 'var(--plasma-colors-critical)';
|
|
26
|
+
export const overlay = 'var(--plasma-colors-overlay)';
|
|
27
|
+
export const surfaceLiquid01 = 'var(--plasma-colors-surface-liquid01)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
28
|
+
export const surfaceLiquid02 = 'var(--plasma-colors-surface-liquid02)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
29
|
+
export const surfaceLiquid03 = 'var(--plasma-colors-surface-liquid03)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
30
|
+
export const surfaceSolid01 = 'var(--plasma-colors-surface-solid01)';
|
|
31
|
+
export const surfaceSolid02 = 'var(--plasma-colors-surface-solid02)';
|
|
32
|
+
export const surfaceSolid03 = 'var(--plasma-colors-surface-solid03)';
|
|
33
|
+
export const surfaceCard = 'var(--plasma-colors-surface-card)';
|
|
34
|
+
export const buttonPrimary = 'var(--plasma-colors-button-primary)';
|
|
35
|
+
export const buttonSecondary = 'var(--plasma-colors-button-secondary)';
|
|
36
|
+
export const buttonSuccess = 'var(--plasma-colors-button-success)';
|
|
37
|
+
export const buttonWarning = 'var(--plasma-colors-button-warning)';
|
|
38
|
+
export const buttonCritical = 'var(--plasma-colors-button-critical)';
|
|
39
|
+
export const buttonChecked = 'var(--plasma-colors-button-checked)';
|
|
40
|
+
export const speechBubbleSent = 'var(--plasma-colors-speech-bubble-sent)';
|
|
41
|
+
export const speechBubbleReceived = 'var(--plasma-colors-speech-bubble-received)';
|
|
42
|
+
export const accent = 'var(--plasma-colors-accent)';
|
|
43
|
+
export const buttonAccent = 'var(--plasma-colors-button-accent)';
|
|
44
|
+
export const buttonFocused = 'var(--plasma-colors-button-focused)';
|
|
45
|
+
export const gradient = 'var(--plasma-colors-gradient)';
|
|
46
|
+
export const voicePhraseGradient = 'var(--plasma-colors-voice-phrase-gradient)';
|
|
47
|
+
export const skeletonGradient = 'var(--plasma-colors-skeleton-gradient)';
|
|
48
|
+
export const skeletonGradientLighter = 'var(--plasma-colors-skeleton-gradient-lighter)';
|
package/es/tokens/typography.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const body1 = {
|
|
2
2
|
fontFamily: 'var(--plasma-typo-body1-font-family)',
|
|
3
3
|
fontWeight: 'var(--plasma-typo-body1-font-weight)',
|
|
4
4
|
fontStyle: 'var(--plasma-typo-body1-font-style)',
|
|
@@ -6,7 +6,7 @@ export var body1 = {
|
|
|
6
6
|
letterSpacing: 'var(--plasma-typo-body1-letter-spacing)',
|
|
7
7
|
lineHeight: 'var(--plasma-typo-body1-line-height)'
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export const body2 = {
|
|
10
10
|
fontFamily: 'var(--plasma-typo-body2-font-family)',
|
|
11
11
|
fontWeight: 'var(--plasma-typo-body2-font-weight)',
|
|
12
12
|
fontStyle: 'var(--plasma-typo-body2-font-style)',
|
|
@@ -14,7 +14,7 @@ export var body2 = {
|
|
|
14
14
|
letterSpacing: 'var(--plasma-typo-body2-letter-spacing)',
|
|
15
15
|
lineHeight: 'var(--plasma-typo-body2-line-height)'
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export const body3 = {
|
|
18
18
|
fontFamily: 'var(--plasma-typo-body3-font-family)',
|
|
19
19
|
fontWeight: 'var(--plasma-typo-body3-font-weight)',
|
|
20
20
|
fontStyle: 'var(--plasma-typo-body3-font-style)',
|
|
@@ -22,7 +22,7 @@ export var body3 = {
|
|
|
22
22
|
letterSpacing: 'var(--plasma-typo-body3-letter-spacing)',
|
|
23
23
|
lineHeight: 'var(--plasma-typo-body3-line-height)'
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export const button1 = {
|
|
26
26
|
fontFamily: 'var(--plasma-typo-button1-font-family)',
|
|
27
27
|
fontWeight: 'var(--plasma-typo-button1-font-weight)',
|
|
28
28
|
fontStyle: 'var(--plasma-typo-button1-font-style)',
|
|
@@ -30,7 +30,7 @@ export var button1 = {
|
|
|
30
30
|
letterSpacing: 'var(--plasma-typo-button1-letter-spacing)',
|
|
31
31
|
lineHeight: 'var(--plasma-typo-button1-line-height)'
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export const button2 = {
|
|
34
34
|
fontFamily: 'var(--plasma-typo-button2-font-family)',
|
|
35
35
|
fontWeight: 'var(--plasma-typo-button2-font-weight)',
|
|
36
36
|
fontStyle: 'var(--plasma-typo-button2-font-style)',
|
|
@@ -38,7 +38,7 @@ export var button2 = {
|
|
|
38
38
|
letterSpacing: 'var(--plasma-typo-button2-letter-spacing)',
|
|
39
39
|
lineHeight: 'var(--plasma-typo-button2-line-height)'
|
|
40
40
|
};
|
|
41
|
-
export
|
|
41
|
+
export const caption = {
|
|
42
42
|
fontFamily: 'var(--plasma-typo-caption-font-family)',
|
|
43
43
|
fontWeight: 'var(--plasma-typo-caption-font-weight)',
|
|
44
44
|
fontStyle: 'var(--plasma-typo-caption-font-style)',
|
|
@@ -46,7 +46,7 @@ export var caption = {
|
|
|
46
46
|
letterSpacing: 'var(--plasma-typo-caption-letter-spacing)',
|
|
47
47
|
lineHeight: 'var(--plasma-typo-caption-line-height)'
|
|
48
48
|
};
|
|
49
|
-
export
|
|
49
|
+
export const display1 = {
|
|
50
50
|
fontFamily: 'var(--plasma-typo-display1-font-family)',
|
|
51
51
|
fontWeight: 'var(--plasma-typo-display1-font-weight)',
|
|
52
52
|
fontStyle: 'var(--plasma-typo-display1-font-style)',
|
|
@@ -54,7 +54,7 @@ export var display1 = {
|
|
|
54
54
|
letterSpacing: 'var(--plasma-typo-display1-letter-spacing)',
|
|
55
55
|
lineHeight: 'var(--plasma-typo-display1-line-height)'
|
|
56
56
|
};
|
|
57
|
-
export
|
|
57
|
+
export const display2 = {
|
|
58
58
|
fontFamily: 'var(--plasma-typo-display2-font-family)',
|
|
59
59
|
fontWeight: 'var(--plasma-typo-display2-font-weight)',
|
|
60
60
|
fontStyle: 'var(--plasma-typo-display2-font-style)',
|
|
@@ -62,7 +62,7 @@ export var display2 = {
|
|
|
62
62
|
letterSpacing: 'var(--plasma-typo-display2-letter-spacing)',
|
|
63
63
|
lineHeight: 'var(--plasma-typo-display2-line-height)'
|
|
64
64
|
};
|
|
65
|
-
export
|
|
65
|
+
export const display3 = {
|
|
66
66
|
fontFamily: 'var(--plasma-typo-display3-font-family)',
|
|
67
67
|
fontWeight: 'var(--plasma-typo-display3-font-weight)',
|
|
68
68
|
fontStyle: 'var(--plasma-typo-display3-font-style)',
|
|
@@ -70,7 +70,7 @@ export var display3 = {
|
|
|
70
70
|
letterSpacing: 'var(--plasma-typo-display3-letter-spacing)',
|
|
71
71
|
lineHeight: 'var(--plasma-typo-display3-line-height)'
|
|
72
72
|
};
|
|
73
|
-
export
|
|
73
|
+
export const footnote1 = {
|
|
74
74
|
fontFamily: 'var(--plasma-typo-footnote1-font-family)',
|
|
75
75
|
fontWeight: 'var(--plasma-typo-footnote1-font-weight)',
|
|
76
76
|
fontStyle: 'var(--plasma-typo-footnote1-font-style)',
|
|
@@ -78,7 +78,7 @@ export var footnote1 = {
|
|
|
78
78
|
letterSpacing: 'var(--plasma-typo-footnote1-letter-spacing)',
|
|
79
79
|
lineHeight: 'var(--plasma-typo-footnote1-line-height)'
|
|
80
80
|
};
|
|
81
|
-
export
|
|
81
|
+
export const footnote2 = {
|
|
82
82
|
fontFamily: 'var(--plasma-typo-footnote2-font-family)',
|
|
83
83
|
fontWeight: 'var(--plasma-typo-footnote2-font-weight)',
|
|
84
84
|
fontStyle: 'var(--plasma-typo-footnote2-font-style)',
|
|
@@ -86,7 +86,7 @@ export var footnote2 = {
|
|
|
86
86
|
letterSpacing: 'var(--plasma-typo-footnote2-letter-spacing)',
|
|
87
87
|
lineHeight: 'var(--plasma-typo-footnote2-line-height)'
|
|
88
88
|
};
|
|
89
|
-
export
|
|
89
|
+
export const headline1 = {
|
|
90
90
|
fontFamily: 'var(--plasma-typo-headline1-font-family)',
|
|
91
91
|
fontWeight: 'var(--plasma-typo-headline1-font-weight)',
|
|
92
92
|
fontStyle: 'var(--plasma-typo-headline1-font-style)',
|
|
@@ -94,7 +94,7 @@ export var headline1 = {
|
|
|
94
94
|
letterSpacing: 'var(--plasma-typo-headline1-letter-spacing)',
|
|
95
95
|
lineHeight: 'var(--plasma-typo-headline1-line-height)'
|
|
96
96
|
};
|
|
97
|
-
export
|
|
97
|
+
export const headline2 = {
|
|
98
98
|
fontFamily: 'var(--plasma-typo-headline2-font-family)',
|
|
99
99
|
fontWeight: 'var(--plasma-typo-headline2-font-weight)',
|
|
100
100
|
fontStyle: 'var(--plasma-typo-headline2-font-style)',
|
|
@@ -102,7 +102,7 @@ export var headline2 = {
|
|
|
102
102
|
letterSpacing: 'var(--plasma-typo-headline2-letter-spacing)',
|
|
103
103
|
lineHeight: 'var(--plasma-typo-headline2-line-height)'
|
|
104
104
|
};
|
|
105
|
-
export
|
|
105
|
+
export const headline3 = {
|
|
106
106
|
fontFamily: 'var(--plasma-typo-headline3-font-family)',
|
|
107
107
|
fontWeight: 'var(--plasma-typo-headline3-font-weight)',
|
|
108
108
|
fontStyle: 'var(--plasma-typo-headline3-font-style)',
|
|
@@ -110,7 +110,7 @@ export var headline3 = {
|
|
|
110
110
|
letterSpacing: 'var(--plasma-typo-headline3-letter-spacing)',
|
|
111
111
|
lineHeight: 'var(--plasma-typo-headline3-line-height)'
|
|
112
112
|
};
|
|
113
|
-
export
|
|
113
|
+
export const headline4 = {
|
|
114
114
|
fontFamily: 'var(--plasma-typo-headline4-font-family)',
|
|
115
115
|
fontWeight: 'var(--plasma-typo-headline4-font-weight)',
|
|
116
116
|
fontStyle: 'var(--plasma-typo-headline4-font-style)',
|
|
@@ -118,7 +118,7 @@ export var headline4 = {
|
|
|
118
118
|
letterSpacing: 'var(--plasma-typo-headline4-letter-spacing)',
|
|
119
119
|
lineHeight: 'var(--plasma-typo-headline4-line-height)'
|
|
120
120
|
};
|
|
121
|
-
export
|
|
121
|
+
export const paragraph1 = {
|
|
122
122
|
fontFamily: 'var(--plasma-typo-paragraph1-font-family)',
|
|
123
123
|
fontWeight: 'var(--plasma-typo-paragraph1-font-weight)',
|
|
124
124
|
fontStyle: 'var(--plasma-typo-paragraph1-font-style)',
|
|
@@ -126,7 +126,7 @@ export var paragraph1 = {
|
|
|
126
126
|
letterSpacing: 'var(--plasma-typo-paragraph1-letter-spacing)',
|
|
127
127
|
lineHeight: 'var(--plasma-typo-paragraph1-line-height)'
|
|
128
128
|
};
|
|
129
|
-
export
|
|
129
|
+
export const paragraph2 = {
|
|
130
130
|
fontFamily: 'var(--plasma-typo-paragraph2-font-family)',
|
|
131
131
|
fontWeight: 'var(--plasma-typo-paragraph2-font-weight)',
|
|
132
132
|
fontStyle: 'var(--plasma-typo-paragraph2-font-style)',
|
|
@@ -134,7 +134,7 @@ export var paragraph2 = {
|
|
|
134
134
|
letterSpacing: 'var(--plasma-typo-paragraph2-letter-spacing)',
|
|
135
135
|
lineHeight: 'var(--plasma-typo-paragraph2-line-height)'
|
|
136
136
|
};
|
|
137
|
-
export
|
|
137
|
+
export const underline = {
|
|
138
138
|
fontFamily: 'var(--plasma-typo-underline-font-family)',
|
|
139
139
|
fontWeight: 'var(--plasma-typo-underline-font-weight)',
|
|
140
140
|
fontStyle: 'var(--plasma-typo-underline-font-style)',
|
|
@@ -48,7 +48,7 @@ test.each([
|
|
|
48
48
|
11,
|
|
49
49
|
'декабря'
|
|
50
50
|
]
|
|
51
|
-
])("monthLongName(%s) return '%s'",
|
|
51
|
+
])("monthLongName(%s) return '%s'", (index, monthName)=>{
|
|
52
52
|
expect(monthLongName(index)).toBe(monthName);
|
|
53
53
|
});
|
|
54
54
|
test.each([
|
|
@@ -100,6 +100,6 @@ test.each([
|
|
|
100
100
|
11,
|
|
101
101
|
'дек'
|
|
102
102
|
]
|
|
103
|
-
])("monthShortName(%s) return '%s'",
|
|
103
|
+
])("monthShortName(%s) return '%s'", (index, monthName)=>{
|
|
104
104
|
expect(monthShortName(index)).toBe(monthName);
|
|
105
105
|
});
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
const DEFAULT_DURATION = 300;
|
|
2
2
|
// https://css-tricks.com/emulating-css-timing-functions-javascript/
|
|
3
|
-
|
|
4
|
-
linear:
|
|
5
|
-
return t;
|
|
6
|
-
},
|
|
3
|
+
const tfs = {
|
|
4
|
+
linear: (t)=>t,
|
|
7
5
|
// eslint-disable-next-line
|
|
8
|
-
easeIn:
|
|
9
|
-
return Math.pow(t, 1.675);
|
|
10
|
-
},
|
|
6
|
+
easeIn: (t)=>Math.pow(t, 1.675),
|
|
11
7
|
// eslint-disable-next-line
|
|
12
|
-
easeOut:
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
easeInOut: function easeInOut(t) {
|
|
16
|
-
return 0.5 * (Math.sin((t - 0.5) * Math.PI) + 1);
|
|
17
|
-
}
|
|
8
|
+
easeOut: (t)=>1 - Math.pow(1 - t, 1.675),
|
|
9
|
+
easeInOut: (t)=>0.5 * (Math.sin((t - 0.5) * Math.PI) + 1)
|
|
18
10
|
};
|
|
19
11
|
/**
|
|
20
12
|
* Плавная прокрутка по горизонтали
|
|
@@ -22,18 +14,17 @@ var tfs = {
|
|
|
22
14
|
* @param {number} pos
|
|
23
15
|
* @param {number} duration
|
|
24
16
|
* @param {string} timingFunction
|
|
25
|
-
*/ export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var handleNewAnimationFrame = function handleNewAnimationFrame1() {
|
|
17
|
+
*/ export const animatedScrollToX = (elem, pos, duration = DEFAULT_DURATION, timingFunction = 'easeInOut')=>{
|
|
18
|
+
let startTime;
|
|
19
|
+
const startX = elem.scrollLeft;
|
|
20
|
+
const endX = Math.max(0, Math.min(elem.scrollWidth - elem.clientWidth, pos));
|
|
21
|
+
const handleNewAnimationFrame = ()=>{
|
|
31
22
|
startTime = startTime || Date.now();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
const timePos = Math.min(1, Math.max(1, Date.now() - startTime) / duration);
|
|
24
|
+
const scrollPos = tfs[timingFunction](timePos);
|
|
25
|
+
const left = startX + (endX - startX) * scrollPos;
|
|
35
26
|
elem.scrollTo({
|
|
36
|
-
left
|
|
27
|
+
left
|
|
37
28
|
});
|
|
38
29
|
if (timePos !== 1) window.requestAnimationFrame(handleNewAnimationFrame);
|
|
39
30
|
};
|
|
@@ -45,18 +36,17 @@ var tfs = {
|
|
|
45
36
|
* @param {number} pos
|
|
46
37
|
* @param {number} duration
|
|
47
38
|
* @param {string} timingFunction
|
|
48
|
-
*/ export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var handleNewAnimationFrame = function handleNewAnimationFrame1() {
|
|
39
|
+
*/ export const animatedScrollToY = (elem, pos, duration = DEFAULT_DURATION, timingFunction = 'easeInOut')=>{
|
|
40
|
+
let startTime;
|
|
41
|
+
const startY = elem.scrollTop;
|
|
42
|
+
const endY = Math.max(0, Math.min(elem.scrollHeight - elem.clientHeight, pos));
|
|
43
|
+
const handleNewAnimationFrame = ()=>{
|
|
54
44
|
startTime = startTime || Date.now();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
const timePos = Math.min(1, Math.max(1, Date.now() - startTime) / duration);
|
|
46
|
+
const scrollPos = tfs[timingFunction](timePos);
|
|
47
|
+
const top = startY + (endY - startY) * scrollPos;
|
|
58
48
|
elem.scrollTo({
|
|
59
|
-
top
|
|
49
|
+
top
|
|
60
50
|
});
|
|
61
51
|
if (timePos !== 1) window.requestAnimationFrame(handleNewAnimationFrame);
|
|
62
52
|
};
|
package/es/utils/canUseDOM.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This constant tells you whether can DOM be used.
|
|
3
3
|
* https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
|
|
4
|
-
*/ export
|
|
4
|
+
*/ export const canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
function _type_of(obj) {
|
|
2
|
-
"@swc/helpers - typeof";
|
|
3
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
4
|
-
}
|
|
5
1
|
import { isValidElement, Children } from 'react';
|
|
6
|
-
export
|
|
7
|
-
switch(typeof textSource
|
|
2
|
+
export const extractTextFrom = (textSource)=>{
|
|
3
|
+
switch(typeof textSource){
|
|
8
4
|
case 'string':
|
|
9
5
|
return textSource;
|
|
10
6
|
case 'number':
|
|
@@ -14,7 +10,7 @@ export var extractTextFrom = function extractTextFrom1(textSource) {
|
|
|
14
10
|
if (!isValidElement(textSource) || !textSource.props || !textSource.props.children) {
|
|
15
11
|
return '';
|
|
16
12
|
}
|
|
17
|
-
return Children.map(textSource.props.children,
|
|
13
|
+
return Children.map(textSource.props.children, (child)=>{
|
|
18
14
|
return extractTextFrom(child);
|
|
19
15
|
}).join('');
|
|
20
16
|
}
|