@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
package/tokens/colors.js
CHANGED
|
@@ -154,51 +154,51 @@ _export(exports, {
|
|
|
154
154
|
return whiteTertiary;
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
157
|
+
const white = 'var(--plasma-colors-white)';
|
|
158
|
+
const whitePrimary = 'var(--plasma-colors-white-primary)';
|
|
159
|
+
const whiteSecondary = 'var(--plasma-colors-white-secondary)';
|
|
160
|
+
const whiteTertiary = 'var(--plasma-colors-white-tertiary)';
|
|
161
|
+
const black = 'var(--plasma-colors-black)';
|
|
162
|
+
const blackPrimary = 'var(--plasma-colors-black-primary)';
|
|
163
|
+
const blackSecondary = 'var(--plasma-colors-black-secondary)';
|
|
164
|
+
const blackTertiary = 'var(--plasma-colors-black-tertiary)';
|
|
165
|
+
const dark01 = 'var(--plasma-colors-dark01)';
|
|
166
|
+
const dark02 = 'var(--plasma-colors-dark02)';
|
|
167
|
+
const dark03 = 'var(--plasma-colors-dark03)';
|
|
168
|
+
const transparent = 'var(--plasma-colors-transparent)';
|
|
169
|
+
const text = 'var(--plasma-colors-text)';
|
|
170
|
+
const primary = 'var(--plasma-colors-primary)';
|
|
171
|
+
const secondary = 'var(--plasma-colors-secondary)';
|
|
172
|
+
const tertiary = 'var(--plasma-colors-tertiary)';
|
|
173
|
+
const inverse = 'var(--plasma-colors-inverse)';
|
|
174
|
+
const paragraph = 'var(--plasma-colors-paragraph)';
|
|
175
|
+
const background = 'var(--plasma-colors-background)';
|
|
176
|
+
const backgroundPrimary = 'var(--plasma-colors-background-primary)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
177
|
+
const backgroundSecondary = 'var(--plasma-colors-background-secondary)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
178
|
+
const backgroundTertiary = 'var(--plasma-colors-background-tertiary)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
179
|
+
const success = 'var(--plasma-colors-success)';
|
|
180
|
+
const warning = 'var(--plasma-colors-warning)';
|
|
181
|
+
const critical = 'var(--plasma-colors-critical)';
|
|
182
|
+
const overlay = 'var(--plasma-colors-overlay)';
|
|
183
|
+
const surfaceLiquid01 = 'var(--plasma-colors-surface-liquid01)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
184
|
+
const surfaceLiquid02 = 'var(--plasma-colors-surface-liquid02)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
185
|
+
const surfaceLiquid03 = 'var(--plasma-colors-surface-liquid03)'; // ToDo: https://github.com/salute-developers/plasma/issues/1107
|
|
186
|
+
const surfaceSolid01 = 'var(--plasma-colors-surface-solid01)';
|
|
187
|
+
const surfaceSolid02 = 'var(--plasma-colors-surface-solid02)';
|
|
188
|
+
const surfaceSolid03 = 'var(--plasma-colors-surface-solid03)';
|
|
189
|
+
const surfaceCard = 'var(--plasma-colors-surface-card)';
|
|
190
|
+
const buttonPrimary = 'var(--plasma-colors-button-primary)';
|
|
191
|
+
const buttonSecondary = 'var(--plasma-colors-button-secondary)';
|
|
192
|
+
const buttonSuccess = 'var(--plasma-colors-button-success)';
|
|
193
|
+
const buttonWarning = 'var(--plasma-colors-button-warning)';
|
|
194
|
+
const buttonCritical = 'var(--plasma-colors-button-critical)';
|
|
195
|
+
const buttonChecked = 'var(--plasma-colors-button-checked)';
|
|
196
|
+
const speechBubbleSent = 'var(--plasma-colors-speech-bubble-sent)';
|
|
197
|
+
const speechBubbleReceived = 'var(--plasma-colors-speech-bubble-received)';
|
|
198
|
+
const accent = 'var(--plasma-colors-accent)';
|
|
199
|
+
const buttonAccent = 'var(--plasma-colors-button-accent)';
|
|
200
|
+
const buttonFocused = 'var(--plasma-colors-button-focused)';
|
|
201
|
+
const gradient = 'var(--plasma-colors-gradient)';
|
|
202
|
+
const voicePhraseGradient = 'var(--plasma-colors-voice-phrase-gradient)';
|
|
203
|
+
const skeletonGradient = 'var(--plasma-colors-skeleton-gradient)';
|
|
204
|
+
const skeletonGradientLighter = 'var(--plasma-colors-skeleton-gradient-lighter)';
|
package/tokens/typography.js
CHANGED
|
@@ -64,7 +64,7 @@ _export(exports, {
|
|
|
64
64
|
return underline;
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
const body1 = {
|
|
68
68
|
fontFamily: 'var(--plasma-typo-body1-font-family)',
|
|
69
69
|
fontWeight: 'var(--plasma-typo-body1-font-weight)',
|
|
70
70
|
fontStyle: 'var(--plasma-typo-body1-font-style)',
|
|
@@ -72,7 +72,7 @@ var body1 = {
|
|
|
72
72
|
letterSpacing: 'var(--plasma-typo-body1-letter-spacing)',
|
|
73
73
|
lineHeight: 'var(--plasma-typo-body1-line-height)'
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
const body2 = {
|
|
76
76
|
fontFamily: 'var(--plasma-typo-body2-font-family)',
|
|
77
77
|
fontWeight: 'var(--plasma-typo-body2-font-weight)',
|
|
78
78
|
fontStyle: 'var(--plasma-typo-body2-font-style)',
|
|
@@ -80,7 +80,7 @@ var body2 = {
|
|
|
80
80
|
letterSpacing: 'var(--plasma-typo-body2-letter-spacing)',
|
|
81
81
|
lineHeight: 'var(--plasma-typo-body2-line-height)'
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
const body3 = {
|
|
84
84
|
fontFamily: 'var(--plasma-typo-body3-font-family)',
|
|
85
85
|
fontWeight: 'var(--plasma-typo-body3-font-weight)',
|
|
86
86
|
fontStyle: 'var(--plasma-typo-body3-font-style)',
|
|
@@ -88,7 +88,7 @@ var body3 = {
|
|
|
88
88
|
letterSpacing: 'var(--plasma-typo-body3-letter-spacing)',
|
|
89
89
|
lineHeight: 'var(--plasma-typo-body3-line-height)'
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
const button1 = {
|
|
92
92
|
fontFamily: 'var(--plasma-typo-button1-font-family)',
|
|
93
93
|
fontWeight: 'var(--plasma-typo-button1-font-weight)',
|
|
94
94
|
fontStyle: 'var(--plasma-typo-button1-font-style)',
|
|
@@ -96,7 +96,7 @@ var button1 = {
|
|
|
96
96
|
letterSpacing: 'var(--plasma-typo-button1-letter-spacing)',
|
|
97
97
|
lineHeight: 'var(--plasma-typo-button1-line-height)'
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
const button2 = {
|
|
100
100
|
fontFamily: 'var(--plasma-typo-button2-font-family)',
|
|
101
101
|
fontWeight: 'var(--plasma-typo-button2-font-weight)',
|
|
102
102
|
fontStyle: 'var(--plasma-typo-button2-font-style)',
|
|
@@ -104,7 +104,7 @@ var button2 = {
|
|
|
104
104
|
letterSpacing: 'var(--plasma-typo-button2-letter-spacing)',
|
|
105
105
|
lineHeight: 'var(--plasma-typo-button2-line-height)'
|
|
106
106
|
};
|
|
107
|
-
|
|
107
|
+
const caption = {
|
|
108
108
|
fontFamily: 'var(--plasma-typo-caption-font-family)',
|
|
109
109
|
fontWeight: 'var(--plasma-typo-caption-font-weight)',
|
|
110
110
|
fontStyle: 'var(--plasma-typo-caption-font-style)',
|
|
@@ -112,7 +112,7 @@ var caption = {
|
|
|
112
112
|
letterSpacing: 'var(--plasma-typo-caption-letter-spacing)',
|
|
113
113
|
lineHeight: 'var(--plasma-typo-caption-line-height)'
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
const display1 = {
|
|
116
116
|
fontFamily: 'var(--plasma-typo-display1-font-family)',
|
|
117
117
|
fontWeight: 'var(--plasma-typo-display1-font-weight)',
|
|
118
118
|
fontStyle: 'var(--plasma-typo-display1-font-style)',
|
|
@@ -120,7 +120,7 @@ var display1 = {
|
|
|
120
120
|
letterSpacing: 'var(--plasma-typo-display1-letter-spacing)',
|
|
121
121
|
lineHeight: 'var(--plasma-typo-display1-line-height)'
|
|
122
122
|
};
|
|
123
|
-
|
|
123
|
+
const display2 = {
|
|
124
124
|
fontFamily: 'var(--plasma-typo-display2-font-family)',
|
|
125
125
|
fontWeight: 'var(--plasma-typo-display2-font-weight)',
|
|
126
126
|
fontStyle: 'var(--plasma-typo-display2-font-style)',
|
|
@@ -128,7 +128,7 @@ var display2 = {
|
|
|
128
128
|
letterSpacing: 'var(--plasma-typo-display2-letter-spacing)',
|
|
129
129
|
lineHeight: 'var(--plasma-typo-display2-line-height)'
|
|
130
130
|
};
|
|
131
|
-
|
|
131
|
+
const display3 = {
|
|
132
132
|
fontFamily: 'var(--plasma-typo-display3-font-family)',
|
|
133
133
|
fontWeight: 'var(--plasma-typo-display3-font-weight)',
|
|
134
134
|
fontStyle: 'var(--plasma-typo-display3-font-style)',
|
|
@@ -136,7 +136,7 @@ var display3 = {
|
|
|
136
136
|
letterSpacing: 'var(--plasma-typo-display3-letter-spacing)',
|
|
137
137
|
lineHeight: 'var(--plasma-typo-display3-line-height)'
|
|
138
138
|
};
|
|
139
|
-
|
|
139
|
+
const footnote1 = {
|
|
140
140
|
fontFamily: 'var(--plasma-typo-footnote1-font-family)',
|
|
141
141
|
fontWeight: 'var(--plasma-typo-footnote1-font-weight)',
|
|
142
142
|
fontStyle: 'var(--plasma-typo-footnote1-font-style)',
|
|
@@ -144,7 +144,7 @@ var footnote1 = {
|
|
|
144
144
|
letterSpacing: 'var(--plasma-typo-footnote1-letter-spacing)',
|
|
145
145
|
lineHeight: 'var(--plasma-typo-footnote1-line-height)'
|
|
146
146
|
};
|
|
147
|
-
|
|
147
|
+
const footnote2 = {
|
|
148
148
|
fontFamily: 'var(--plasma-typo-footnote2-font-family)',
|
|
149
149
|
fontWeight: 'var(--plasma-typo-footnote2-font-weight)',
|
|
150
150
|
fontStyle: 'var(--plasma-typo-footnote2-font-style)',
|
|
@@ -152,7 +152,7 @@ var footnote2 = {
|
|
|
152
152
|
letterSpacing: 'var(--plasma-typo-footnote2-letter-spacing)',
|
|
153
153
|
lineHeight: 'var(--plasma-typo-footnote2-line-height)'
|
|
154
154
|
};
|
|
155
|
-
|
|
155
|
+
const headline1 = {
|
|
156
156
|
fontFamily: 'var(--plasma-typo-headline1-font-family)',
|
|
157
157
|
fontWeight: 'var(--plasma-typo-headline1-font-weight)',
|
|
158
158
|
fontStyle: 'var(--plasma-typo-headline1-font-style)',
|
|
@@ -160,7 +160,7 @@ var headline1 = {
|
|
|
160
160
|
letterSpacing: 'var(--plasma-typo-headline1-letter-spacing)',
|
|
161
161
|
lineHeight: 'var(--plasma-typo-headline1-line-height)'
|
|
162
162
|
};
|
|
163
|
-
|
|
163
|
+
const headline2 = {
|
|
164
164
|
fontFamily: 'var(--plasma-typo-headline2-font-family)',
|
|
165
165
|
fontWeight: 'var(--plasma-typo-headline2-font-weight)',
|
|
166
166
|
fontStyle: 'var(--plasma-typo-headline2-font-style)',
|
|
@@ -168,7 +168,7 @@ var headline2 = {
|
|
|
168
168
|
letterSpacing: 'var(--plasma-typo-headline2-letter-spacing)',
|
|
169
169
|
lineHeight: 'var(--plasma-typo-headline2-line-height)'
|
|
170
170
|
};
|
|
171
|
-
|
|
171
|
+
const headline3 = {
|
|
172
172
|
fontFamily: 'var(--plasma-typo-headline3-font-family)',
|
|
173
173
|
fontWeight: 'var(--plasma-typo-headline3-font-weight)',
|
|
174
174
|
fontStyle: 'var(--plasma-typo-headline3-font-style)',
|
|
@@ -176,7 +176,7 @@ var headline3 = {
|
|
|
176
176
|
letterSpacing: 'var(--plasma-typo-headline3-letter-spacing)',
|
|
177
177
|
lineHeight: 'var(--plasma-typo-headline3-line-height)'
|
|
178
178
|
};
|
|
179
|
-
|
|
179
|
+
const headline4 = {
|
|
180
180
|
fontFamily: 'var(--plasma-typo-headline4-font-family)',
|
|
181
181
|
fontWeight: 'var(--plasma-typo-headline4-font-weight)',
|
|
182
182
|
fontStyle: 'var(--plasma-typo-headline4-font-style)',
|
|
@@ -184,7 +184,7 @@ var headline4 = {
|
|
|
184
184
|
letterSpacing: 'var(--plasma-typo-headline4-letter-spacing)',
|
|
185
185
|
lineHeight: 'var(--plasma-typo-headline4-line-height)'
|
|
186
186
|
};
|
|
187
|
-
|
|
187
|
+
const paragraph1 = {
|
|
188
188
|
fontFamily: 'var(--plasma-typo-paragraph1-font-family)',
|
|
189
189
|
fontWeight: 'var(--plasma-typo-paragraph1-font-weight)',
|
|
190
190
|
fontStyle: 'var(--plasma-typo-paragraph1-font-style)',
|
|
@@ -192,7 +192,7 @@ var paragraph1 = {
|
|
|
192
192
|
letterSpacing: 'var(--plasma-typo-paragraph1-letter-spacing)',
|
|
193
193
|
lineHeight: 'var(--plasma-typo-paragraph1-line-height)'
|
|
194
194
|
};
|
|
195
|
-
|
|
195
|
+
const paragraph2 = {
|
|
196
196
|
fontFamily: 'var(--plasma-typo-paragraph2-font-family)',
|
|
197
197
|
fontWeight: 'var(--plasma-typo-paragraph2-font-weight)',
|
|
198
198
|
fontStyle: 'var(--plasma-typo-paragraph2-font-style)',
|
|
@@ -200,7 +200,7 @@ var paragraph2 = {
|
|
|
200
200
|
letterSpacing: 'var(--plasma-typo-paragraph2-letter-spacing)',
|
|
201
201
|
lineHeight: 'var(--plasma-typo-paragraph2-line-height)'
|
|
202
202
|
};
|
|
203
|
-
|
|
203
|
+
const underline = {
|
|
204
204
|
fontFamily: 'var(--plasma-typo-underline-font-family)',
|
|
205
205
|
fontWeight: 'var(--plasma-typo-underline-font-weight)',
|
|
206
206
|
fontStyle: 'var(--plasma-typo-underline-font-style)',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
5
|
+
const _formatters = require("../formatters");
|
|
6
6
|
test.each([
|
|
7
7
|
[
|
|
8
8
|
0,
|
|
@@ -52,7 +52,7 @@ test.each([
|
|
|
52
52
|
11,
|
|
53
53
|
'декабря'
|
|
54
54
|
]
|
|
55
|
-
])("monthLongName(%s) return '%s'",
|
|
55
|
+
])("monthLongName(%s) return '%s'", (index, monthName)=>{
|
|
56
56
|
expect((0, _formatters.monthLongName)(index)).toBe(monthName);
|
|
57
57
|
});
|
|
58
58
|
test.each([
|
|
@@ -104,6 +104,6 @@ test.each([
|
|
|
104
104
|
11,
|
|
105
105
|
'дек'
|
|
106
106
|
]
|
|
107
|
-
])("monthShortName(%s) return '%s'",
|
|
107
|
+
])("monthShortName(%s) return '%s'", (index, monthName)=>{
|
|
108
108
|
expect((0, _formatters.monthShortName)(index)).toBe(monthName);
|
|
109
109
|
});
|
|
@@ -16,53 +16,43 @@ _export(exports, {
|
|
|
16
16
|
return animatedScrollToY;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
const DEFAULT_DURATION = 300;
|
|
20
20
|
// https://css-tricks.com/emulating-css-timing-functions-javascript/
|
|
21
|
-
|
|
22
|
-
linear:
|
|
23
|
-
return t;
|
|
24
|
-
},
|
|
21
|
+
const tfs = {
|
|
22
|
+
linear: (t)=>t,
|
|
25
23
|
// eslint-disable-next-line
|
|
26
|
-
easeIn:
|
|
27
|
-
return Math.pow(t, 1.675);
|
|
28
|
-
},
|
|
24
|
+
easeIn: (t)=>Math.pow(t, 1.675),
|
|
29
25
|
// eslint-disable-next-line
|
|
30
|
-
easeOut:
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
easeInOut: function easeInOut(t) {
|
|
34
|
-
return 0.5 * (Math.sin((t - 0.5) * Math.PI) + 1);
|
|
35
|
-
}
|
|
26
|
+
easeOut: (t)=>1 - Math.pow(1 - t, 1.675),
|
|
27
|
+
easeInOut: (t)=>0.5 * (Math.sin((t - 0.5) * Math.PI) + 1)
|
|
36
28
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var handleNewAnimationFrame = function handleNewAnimationFrame1() {
|
|
29
|
+
const animatedScrollToX = (elem, pos, duration = DEFAULT_DURATION, timingFunction = 'easeInOut')=>{
|
|
30
|
+
let startTime;
|
|
31
|
+
const startX = elem.scrollLeft;
|
|
32
|
+
const endX = Math.max(0, Math.min(elem.scrollWidth - elem.clientWidth, pos));
|
|
33
|
+
const handleNewAnimationFrame = ()=>{
|
|
43
34
|
startTime = startTime || Date.now();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
const timePos = Math.min(1, Math.max(1, Date.now() - startTime) / duration);
|
|
36
|
+
const scrollPos = tfs[timingFunction](timePos);
|
|
37
|
+
const left = startX + (endX - startX) * scrollPos;
|
|
47
38
|
elem.scrollTo({
|
|
48
|
-
left
|
|
39
|
+
left
|
|
49
40
|
});
|
|
50
41
|
if (timePos !== 1) window.requestAnimationFrame(handleNewAnimationFrame);
|
|
51
42
|
};
|
|
52
43
|
window.requestAnimationFrame(handleNewAnimationFrame);
|
|
53
44
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var handleNewAnimationFrame = function handleNewAnimationFrame1() {
|
|
45
|
+
const animatedScrollToY = (elem, pos, duration = DEFAULT_DURATION, timingFunction = 'easeInOut')=>{
|
|
46
|
+
let startTime;
|
|
47
|
+
const startY = elem.scrollTop;
|
|
48
|
+
const endY = Math.max(0, Math.min(elem.scrollHeight - elem.clientHeight, pos));
|
|
49
|
+
const handleNewAnimationFrame = ()=>{
|
|
60
50
|
startTime = startTime || Date.now();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
const timePos = Math.min(1, Math.max(1, Date.now() - startTime) / duration);
|
|
52
|
+
const scrollPos = tfs[timingFunction](timePos);
|
|
53
|
+
const top = startY + (endY - startY) * scrollPos;
|
|
64
54
|
elem.scrollTo({
|
|
65
|
-
top
|
|
55
|
+
top
|
|
66
56
|
});
|
|
67
57
|
if (timePos !== 1) window.requestAnimationFrame(handleNewAnimationFrame);
|
|
68
58
|
};
|
package/utils/canUseDOM.js
CHANGED
|
@@ -11,4 +11,4 @@ Object.defineProperty(exports, "canUseDOM", {
|
|
|
11
11
|
return canUseDOM;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
const canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
package/utils/extractTextFrom.js
CHANGED
|
@@ -8,13 +8,9 @@ Object.defineProperty(exports, "extractTextFrom", {
|
|
|
8
8
|
return extractTextFrom;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
15
|
-
}
|
|
16
|
-
var extractTextFrom = function extractTextFrom1(textSource) {
|
|
17
|
-
switch(typeof textSource === "undefined" ? "undefined" : _type_of(textSource)){
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const extractTextFrom = (textSource)=>{
|
|
13
|
+
switch(typeof textSource){
|
|
18
14
|
case 'string':
|
|
19
15
|
return textSource;
|
|
20
16
|
case 'number':
|
|
@@ -24,7 +20,7 @@ var extractTextFrom = function extractTextFrom1(textSource) {
|
|
|
24
20
|
if (!(0, _react.isValidElement)(textSource) || !textSource.props || !textSource.props.children) {
|
|
25
21
|
return '';
|
|
26
22
|
}
|
|
27
|
-
return _react.Children.map(textSource.props.children,
|
|
23
|
+
return _react.Children.map(textSource.props.children, (child)=>{
|
|
28
24
|
return extractTextFrom(child);
|
|
29
25
|
}).join('');
|
|
30
26
|
}
|
package/utils/focusManager.js
CHANGED
|
@@ -8,12 +8,7 @@ Object.defineProperty(exports, "FocusManager", {
|
|
|
8
8
|
return FocusManager;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
function _class_call_check(instance, Constructor) {
|
|
13
|
-
if (!(instance instanceof Constructor)) {
|
|
14
|
-
throw new TypeError("Cannot call a class as a function");
|
|
15
|
-
}
|
|
16
|
-
}
|
|
11
|
+
const _tabbable = require("./tabbable");
|
|
17
12
|
function _define_property(obj, key, value) {
|
|
18
13
|
if (key in obj) {
|
|
19
14
|
Object.defineProperty(obj, key, {
|
|
@@ -27,45 +22,43 @@ function _define_property(obj, key, value) {
|
|
|
27
22
|
}
|
|
28
23
|
return obj;
|
|
29
24
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
};
|
|
25
|
+
class FocusManager {
|
|
26
|
+
constructor(){
|
|
27
|
+
// массив с элементами, которые нужно зафокусить после анмаунта
|
|
28
|
+
_define_property(this, "focusAfterElements", []);
|
|
29
|
+
// массив с trap нодами
|
|
30
|
+
_define_property(this, "focusNodes", []);
|
|
31
|
+
_define_property(this, "handleFocus", ()=>{
|
|
32
|
+
// Фокус всегда должен находиться внутри необходимой ноды
|
|
33
|
+
const focusNode = this.focusNodes[this.focusNodes.length - 1];
|
|
34
|
+
if (!focusNode || focusNode.contains(document.activeElement)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Выделяем первый tabbable элемент
|
|
38
|
+
const el = (0, _tabbable.findTabbableDescendants)(focusNode)[0] || focusNode;
|
|
39
|
+
el.focus();
|
|
40
|
+
});
|
|
41
|
+
// добавление на фокус после анмаунта
|
|
42
|
+
_define_property(this, "markForFocusAfter", (focusAfterNode)=>{
|
|
43
|
+
const node = focusAfterNode && focusAfterNode.current ? focusAfterNode.current : document.activeElement;
|
|
44
|
+
this.focusAfterElements.push(node);
|
|
45
|
+
});
|
|
46
|
+
// фокус на необходимый элемент
|
|
47
|
+
_define_property(this, "returnFocus", ()=>{
|
|
48
|
+
const toFocus = this.focusAfterElements.pop() ?? null;
|
|
49
|
+
if (toFocus) {
|
|
50
|
+
toFocus.focus();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
// при маунте ноды
|
|
54
|
+
_define_property(this, "setupScopedFocus", (element)=>{
|
|
55
|
+
this.focusNodes.push(element);
|
|
56
|
+
document.addEventListener('focusin', this.handleFocus, true);
|
|
57
|
+
});
|
|
58
|
+
// при анмаунте
|
|
59
|
+
_define_property(this, "teardownScopedFocus", ()=>{
|
|
60
|
+
this.focusNodes.pop();
|
|
61
|
+
document.removeEventListener('focusin', this.handleFocus);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
package/utils/formatCurrency.js
CHANGED
|
@@ -14,11 +14,11 @@ Object.defineProperty(exports, "formatCurrency", {
|
|
|
14
14
|
return formatCurrency;
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const formatCurrency = (value, currency, minimumFractionDigits)=>{
|
|
18
|
+
const formatter = new Intl.NumberFormat('ru', {
|
|
19
19
|
style: 'currency',
|
|
20
|
-
currency
|
|
21
|
-
minimumFractionDigits
|
|
20
|
+
currency,
|
|
21
|
+
minimumFractionDigits
|
|
22
22
|
});
|
|
23
23
|
return formatter.format(value);
|
|
24
24
|
};
|
package/utils/formatters.js
CHANGED
|
@@ -25,22 +25,14 @@ _export(exports, {
|
|
|
25
25
|
return padZeroNumber;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return "".concat(value).padStart(2, '0');
|
|
33
|
-
};
|
|
34
|
-
var monthName = function monthName(val, monthFormat) {
|
|
35
|
-
var targetMonth = new Date(2000, val, 1);
|
|
28
|
+
const last = (array)=>array[array.length - 1];
|
|
29
|
+
const padZeroNumber = (value)=>`${value}`.padStart(2, '0');
|
|
30
|
+
const monthName = (val, monthFormat)=>{
|
|
31
|
+
const targetMonth = new Date(2000, val, 1);
|
|
36
32
|
return last(new Intl.DateTimeFormat('ru-RU', {
|
|
37
33
|
day: 'numeric',
|
|
38
34
|
month: monthFormat
|
|
39
35
|
}).formatToParts(targetMonth)).value;
|
|
40
36
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
var monthShortName = function monthShortName(val) {
|
|
45
|
-
return monthName(val, 'short').replace('.', '');
|
|
46
|
-
};
|
|
37
|
+
const monthLongName = (val)=>monthName(val, 'long');
|
|
38
|
+
const monthShortName = (val)=>monthName(val, 'short').replace('.', '');
|
package/utils/index.js
CHANGED
|
@@ -55,13 +55,13 @@ _export(exports, {
|
|
|
55
55
|
return _transformStyles.transformStyles;
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
const _animatedScrollTo = require("./animatedScrollTo");
|
|
59
|
+
const _canUseDOM = require("./canUseDOM");
|
|
60
|
+
const _roundness = require("./roundness");
|
|
61
|
+
const _extractTextFrom = require("./extractTextFrom");
|
|
62
|
+
const _formatters = require("./formatters");
|
|
63
|
+
const _formatCurrency = require("./formatCurrency");
|
|
64
|
+
const _setRef = require("./setRef");
|
|
65
|
+
const _toCssSize = require("./toCssSize");
|
|
66
|
+
const _transformStyles = require("./transformStyles");
|
|
67
|
+
const _react = require("./react");
|
package/utils/react.js
CHANGED
|
@@ -19,9 +19,9 @@ _export(exports, {
|
|
|
19
19
|
return safeUseId;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
23
|
+
const _reactdom = /*#__PURE__*/ _interop_require_default(require("react-dom"));
|
|
24
|
+
const _useUniqId = require("../hooks/useUniqId");
|
|
25
25
|
function _interop_require_default(obj) {
|
|
26
26
|
return obj && obj.__esModule ? obj : {
|
|
27
27
|
default: obj
|
|
@@ -29,14 +29,14 @@ function _interop_require_default(obj) {
|
|
|
29
29
|
}
|
|
30
30
|
// TODO: https://github.com/salute-developers/plasma/issues/233
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
|
|
32
|
+
const { flushSync } = _reactdom.default;
|
|
33
33
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const { useId } = _react.default;
|
|
35
|
+
const IS_REACT_18 = _reactdom.default.version.split('.')[0] === '18';
|
|
36
36
|
function safeFlushSync(fn) {
|
|
37
37
|
if (!IS_REACT_18) {
|
|
38
38
|
return fn();
|
|
39
39
|
}
|
|
40
40
|
return flushSync(fn);
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
const safeUseId = !IS_REACT_18 ? _useUniqId.useUniqId : useId;
|
package/utils/roundness.js
CHANGED
|
@@ -21,7 +21,7 @@ _export(exports, {
|
|
|
21
21
|
return pins;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
const pins = {
|
|
25
25
|
'square-square': 'r',
|
|
26
26
|
'square-clear': 'r 0 0 r',
|
|
27
27
|
'clear-square': '0 r r 0',
|
|
@@ -30,8 +30,7 @@ var pins = {
|
|
|
30
30
|
'circle-clear': 'h 0 0 h',
|
|
31
31
|
'circle-circle': 'h'
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
return matrixKey && pins[matrixKey].split(' ').map(function(char) {
|
|
33
|
+
const convertRoundnessMatrix = (matrixKey, r, h)=>matrixKey && pins[matrixKey].split(' ').map((char)=>{
|
|
35
34
|
switch(char){
|
|
36
35
|
case 'r':
|
|
37
36
|
return r;
|
|
@@ -41,4 +40,3 @@ var convertRoundnessMatrix = function convertRoundnessMatrix(matrixKey, r, h) {
|
|
|
41
40
|
return char;
|
|
42
41
|
}
|
|
43
42
|
}).join(' ');
|
|
44
|
-
};
|