@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,75 +1,75 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { headline1, headline2, headline3, headline4 } from '../../tokens';
|
|
3
3
|
import { applyHyphens, applySpacing } from '../../mixins';
|
|
4
|
-
export
|
|
4
|
+
export const Headline1 = styled.div.withConfig({
|
|
5
5
|
displayName: "Headline__Headline1",
|
|
6
6
|
componentId: "sc-ae2aff6b-0"
|
|
7
7
|
})([
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
``,
|
|
9
|
+
` `,
|
|
10
|
+
` `,
|
|
11
|
+
``
|
|
12
12
|
], applyHyphens, applySpacing, headline1);
|
|
13
|
-
export
|
|
13
|
+
export const Headline2 = styled.div.withConfig({
|
|
14
14
|
displayName: "Headline__Headline2",
|
|
15
15
|
componentId: "sc-ae2aff6b-1"
|
|
16
16
|
})([
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
``,
|
|
18
|
+
` `,
|
|
19
|
+
` `,
|
|
20
|
+
``
|
|
21
21
|
], applyHyphens, applySpacing, headline2);
|
|
22
|
-
export
|
|
22
|
+
export const Headline3 = styled.div.withConfig({
|
|
23
23
|
displayName: "Headline__Headline3",
|
|
24
24
|
componentId: "sc-ae2aff6b-2"
|
|
25
25
|
})([
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
``,
|
|
27
|
+
` `,
|
|
28
|
+
` `,
|
|
29
|
+
``
|
|
30
30
|
], applyHyphens, applySpacing, headline3);
|
|
31
|
-
export
|
|
31
|
+
export const Headline4 = styled.div.withConfig({
|
|
32
32
|
displayName: "Headline__Headline4",
|
|
33
33
|
componentId: "sc-ae2aff6b-3"
|
|
34
34
|
})([
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
``,
|
|
36
|
+
` `,
|
|
37
|
+
` `,
|
|
38
|
+
``
|
|
39
39
|
], applyHyphens, applySpacing, headline4);
|
|
40
|
-
export
|
|
40
|
+
export const H1 = styled.h1.withConfig({
|
|
41
41
|
displayName: "Headline__H1",
|
|
42
42
|
componentId: "sc-ae2aff6b-4"
|
|
43
43
|
})([
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
`margin:0;`,
|
|
45
|
+
` `,
|
|
46
|
+
` `,
|
|
47
|
+
``
|
|
48
48
|
], applyHyphens, applySpacing, headline1);
|
|
49
|
-
export
|
|
49
|
+
export const H2 = styled.h2.withConfig({
|
|
50
50
|
displayName: "Headline__H2",
|
|
51
51
|
componentId: "sc-ae2aff6b-5"
|
|
52
52
|
})([
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
`margin:0;`,
|
|
54
|
+
` `,
|
|
55
|
+
` `,
|
|
56
|
+
``
|
|
57
57
|
], applyHyphens, applySpacing, headline2);
|
|
58
|
-
export
|
|
58
|
+
export const H3 = styled.h3.withConfig({
|
|
59
59
|
displayName: "Headline__H3",
|
|
60
60
|
componentId: "sc-ae2aff6b-6"
|
|
61
61
|
})([
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
`margin:0;`,
|
|
63
|
+
` `,
|
|
64
|
+
` `,
|
|
65
|
+
``
|
|
66
66
|
], applyHyphens, applySpacing, headline3);
|
|
67
|
-
export
|
|
67
|
+
export const H4 = styled.h4.withConfig({
|
|
68
68
|
displayName: "Headline__H4",
|
|
69
69
|
componentId: "sc-ae2aff6b-7"
|
|
70
70
|
})([
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
`margin:0;`,
|
|
72
|
+
` `,
|
|
73
|
+
` `,
|
|
74
|
+
``
|
|
75
75
|
], applyHyphens, applySpacing, headline4);
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { paragraph1, paragraph2 } from '../../tokens';
|
|
3
3
|
import { applyHyphens, applySpacing } from '../../mixins';
|
|
4
|
-
export
|
|
4
|
+
export const ParagraphText1 = styled.div.withConfig({
|
|
5
5
|
displayName: "Paragraph__ParagraphText1",
|
|
6
6
|
componentId: "sc-96b4c682-0"
|
|
7
7
|
})([
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
``,
|
|
9
|
+
` `,
|
|
10
|
+
` `,
|
|
11
|
+
``
|
|
12
12
|
], applyHyphens, applySpacing, paragraph1);
|
|
13
|
-
export
|
|
13
|
+
export const ParagraphText2 = styled.div.withConfig({
|
|
14
14
|
displayName: "Paragraph__ParagraphText2",
|
|
15
15
|
componentId: "sc-96b4c682-1"
|
|
16
16
|
})([
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
``,
|
|
18
|
+
` `,
|
|
19
|
+
` `,
|
|
20
|
+
``
|
|
21
21
|
], applyHyphens, applySpacing, paragraph2);
|
|
22
|
-
export
|
|
22
|
+
export const P1 = styled.p.withConfig({
|
|
23
23
|
displayName: "Paragraph__P1",
|
|
24
24
|
componentId: "sc-96b4c682-2"
|
|
25
25
|
})([
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
``,
|
|
27
|
+
` `,
|
|
28
|
+
` `,
|
|
29
|
+
` margin:0;`
|
|
30
30
|
], applyHyphens, applySpacing, paragraph1);
|
|
31
|
-
export
|
|
32
|
-
export
|
|
31
|
+
export const P = P1;
|
|
32
|
+
export const P2 = styled.p.withConfig({
|
|
33
33
|
displayName: "Paragraph__P2",
|
|
34
34
|
componentId: "sc-96b4c682-3"
|
|
35
35
|
})([
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
``,
|
|
37
|
+
` `,
|
|
38
|
+
` `,
|
|
39
|
+
` margin:0;`
|
|
40
40
|
], applyHyphens, applySpacing, paragraph2);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { underline } from '../../tokens';
|
|
3
3
|
import { applyHyphens, applySpacing } from '../../mixins';
|
|
4
|
-
export
|
|
4
|
+
export const Underline = styled.div.withConfig({
|
|
5
5
|
displayName: "Underline",
|
|
6
6
|
componentId: "sc-7613e3f0-0"
|
|
7
7
|
})([
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
``,
|
|
9
|
+
` `,
|
|
10
|
+
` `,
|
|
11
|
+
` text-transform:uppercase;`
|
|
12
12
|
], applyHyphens, applySpacing, underline);
|
package/es/hocs/withAutoFocus.js
CHANGED
|
@@ -1,86 +1,16 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
function _object_spread(target) {
|
|
15
|
-
for(var i = 1; i < arguments.length; i++){
|
|
16
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
-
var ownKeys = Object.keys(source);
|
|
18
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
ownKeys.forEach(function(key) {
|
|
24
|
-
_define_property(target, key, source[key]);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
}
|
|
29
|
-
function _object_without_properties(source, excluded) {
|
|
30
|
-
if (source == null) return {};
|
|
31
|
-
var target = {}, sourceKeys, key, i;
|
|
32
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
33
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
34
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
35
|
-
key = sourceKeys[i];
|
|
36
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
37
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
38
|
-
target[key] = source[key];
|
|
39
|
-
}
|
|
40
|
-
return target;
|
|
41
|
-
}
|
|
42
|
-
target = _object_without_properties_loose(source, excluded);
|
|
43
|
-
if (Object.getOwnPropertySymbols) {
|
|
44
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
45
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
46
|
-
key = sourceKeys[i];
|
|
47
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
48
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
49
|
-
target[key] = source[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return target;
|
|
53
|
-
}
|
|
54
|
-
function _object_without_properties_loose(source, excluded) {
|
|
55
|
-
if (source == null) return {};
|
|
56
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
57
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
58
|
-
key = sourceKeys[i];
|
|
59
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
60
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
61
|
-
target[key] = source[key];
|
|
62
|
-
}
|
|
63
|
-
return target;
|
|
64
|
-
}
|
|
65
1
|
import React, { useEffect, useRef } from 'react';
|
|
66
|
-
export
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"autoFocus",
|
|
70
|
-
"tabIndex",
|
|
71
|
-
"preventScroll"
|
|
72
|
-
]);
|
|
73
|
-
var divRef = useRef(null);
|
|
74
|
-
useEffect(function() {
|
|
2
|
+
export const withAutoFocus = (Component)=>({ autoFocus, tabIndex = -1, preventScroll = true, ...props })=>{
|
|
3
|
+
const divRef = useRef(null);
|
|
4
|
+
useEffect(()=>{
|
|
75
5
|
if (autoFocus && divRef.current) {
|
|
76
6
|
divRef.current.focus({
|
|
77
|
-
preventScroll
|
|
7
|
+
preventScroll
|
|
78
8
|
});
|
|
79
9
|
}
|
|
80
10
|
});
|
|
81
|
-
return /*#__PURE__*/ React.createElement(Component,
|
|
11
|
+
return /*#__PURE__*/ React.createElement(Component, {
|
|
82
12
|
tabIndex: tabIndex,
|
|
83
|
-
ref: divRef
|
|
84
|
-
|
|
13
|
+
ref: divRef,
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
85
16
|
};
|
|
86
|
-
};
|
package/es/hocs/withSkeleton.js
CHANGED
|
@@ -4,17 +4,12 @@ import { applySkeletonGradient } from '../mixins';
|
|
|
4
4
|
/**
|
|
5
5
|
* Делает компонент скелетоном - у него заменяется фоновый цвет,
|
|
6
6
|
* добавляется градиент и текст становится на 100% прозрачным.
|
|
7
|
-
*/ export
|
|
8
|
-
return styled(Component).withConfig({
|
|
7
|
+
*/ export const withSkeleton = (Component)=>styled(Component).withConfig({
|
|
9
8
|
displayName: "withSkeleton",
|
|
10
9
|
componentId: "sc-764f817c-0"
|
|
11
10
|
})([
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
],
|
|
15
|
-
var skeleton = param.skeleton;
|
|
16
|
-
return skeleton && applySkeletonGradient({
|
|
11
|
+
``,
|
|
12
|
+
``
|
|
13
|
+
], ({ skeleton })=>skeleton && applySkeletonGradient({
|
|
17
14
|
lighter: true
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
};
|
|
15
|
+
}));
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_without_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
-
}
|
|
9
|
-
function _iterable_to_array(iter) {
|
|
10
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
11
|
-
}
|
|
12
|
-
function _non_iterable_spread() {
|
|
13
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14
|
-
}
|
|
15
|
-
function _to_consumable_array(arr) {
|
|
16
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
17
|
-
}
|
|
18
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
19
|
-
if (!o) return;
|
|
20
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
21
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
23
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
24
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
25
|
-
}
|
|
26
1
|
import React from 'react';
|
|
27
2
|
/**
|
|
28
3
|
* @param {Function} func
|
|
@@ -30,7 +5,7 @@ import React from 'react';
|
|
|
30
5
|
* @param {boolean} cleanUp
|
|
31
6
|
* https://habr.com/ru/company/domclick/blog/510616/
|
|
32
7
|
*/ export function useDebouncedFunction(func, delay, cleanUp) {
|
|
33
|
-
|
|
8
|
+
const timeoutRef = React.useRef();
|
|
34
9
|
/**
|
|
35
10
|
* Очистка таймера
|
|
36
11
|
*/ function clearTimer() {
|
|
@@ -42,18 +17,11 @@ import React from 'react';
|
|
|
42
17
|
/**
|
|
43
18
|
* Очищаем таймер при анмаунте компонента, если cleanUp выставлен в true
|
|
44
19
|
* и тем самым отменяем последний запланированный вызов
|
|
45
|
-
*/ React.useEffect(
|
|
46
|
-
return cleanUp ? clearTimer : undefined;
|
|
47
|
-
}, [
|
|
20
|
+
*/ React.useEffect(()=>cleanUp ? clearTimer : undefined, [
|
|
48
21
|
cleanUp
|
|
49
22
|
]);
|
|
50
|
-
return
|
|
51
|
-
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
52
|
-
args[_key] = arguments[_key];
|
|
53
|
-
}
|
|
23
|
+
return (...args)=>{
|
|
54
24
|
clearTimer();
|
|
55
|
-
timeoutRef.current = setTimeout(
|
|
56
|
-
return func.apply(void 0, _to_consumable_array(args));
|
|
57
|
-
}, delay);
|
|
25
|
+
timeoutRef.current = setTimeout(()=>func(...args), delay);
|
|
58
26
|
};
|
|
59
27
|
}
|
package/es/hooks/useFocusTrap.js
CHANGED
|
@@ -3,8 +3,8 @@ import { FocusManager } from '../utils/focusManager';
|
|
|
3
3
|
import { focusSelector, isFocusable, isTabble } from '../utils/tabbable';
|
|
4
4
|
import { scopeTab } from '../utils/scopeTab';
|
|
5
5
|
// Находим элемент для фокуса
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const getFocusElement = (node, firstFocusSelector)=>{
|
|
7
|
+
let focusElement = null;
|
|
8
8
|
if (firstFocusSelector) {
|
|
9
9
|
if (typeof firstFocusSelector === 'string') {
|
|
10
10
|
focusElement = node.querySelector(firstFocusSelector);
|
|
@@ -13,10 +13,8 @@ var getFocusElement = function getFocusElement(node, firstFocusSelector) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
if (!focusElement) {
|
|
16
|
-
|
|
17
|
-
focusElement = children.find(
|
|
18
|
-
return isTabble(el);
|
|
19
|
-
}) || null;
|
|
16
|
+
const children = Array.from(node.querySelectorAll(focusSelector));
|
|
17
|
+
focusElement = children.find((el)=>isTabble(el)) || null;
|
|
20
18
|
}
|
|
21
19
|
// Если ничего не нашлось, то может ли сама нода быть под фокусом
|
|
22
20
|
if (!focusElement && isFocusable(node)) {
|
|
@@ -24,24 +22,23 @@ var getFocusElement = function getFocusElement(node, firstFocusSelector) {
|
|
|
24
22
|
}
|
|
25
23
|
return focusElement;
|
|
26
24
|
};
|
|
27
|
-
|
|
28
|
-
if (ref
|
|
29
|
-
ref.current.removeEventListener('animationend',
|
|
25
|
+
const processNode = (node, firstFocusSelector, ref)=>{
|
|
26
|
+
if (ref?.current) {
|
|
27
|
+
ref.current.removeEventListener('animationend', ()=>{
|
|
30
28
|
processNode(node, firstFocusSelector, ref);
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
|
-
|
|
31
|
+
const focusElement = getFocusElement(node, firstFocusSelector);
|
|
34
32
|
if (focusElement) {
|
|
35
33
|
focusElement.focus();
|
|
36
34
|
}
|
|
37
35
|
};
|
|
38
|
-
|
|
36
|
+
const focusManager = new FocusManager();
|
|
39
37
|
/**
|
|
40
38
|
* Захватывает фокус внутри DOM node.
|
|
41
|
-
* */ export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var setRef = useCallback(function(node) {
|
|
39
|
+
* */ export const useFocusTrap = (active = true, firstFocusSelector, focusAfterNode, focusAfterAnimation)=>{
|
|
40
|
+
const ref = useRef();
|
|
41
|
+
const setRef = useCallback((node)=>{
|
|
45
42
|
if (ref.current) {
|
|
46
43
|
focusManager.teardownScopedFocus();
|
|
47
44
|
focusManager.returnFocus();
|
|
@@ -50,9 +47,9 @@ var focusManager = new FocusManager();
|
|
|
50
47
|
focusManager.setupScopedFocus(node);
|
|
51
48
|
focusManager.markForFocusAfter(focusAfterNode);
|
|
52
49
|
// Delay processing the HTML node by a frame. This ensures focus is assigned correctly.
|
|
53
|
-
setTimeout(
|
|
54
|
-
if (
|
|
55
|
-
ref.current.addEventListener('animationend',
|
|
50
|
+
setTimeout(()=>{
|
|
51
|
+
if (ref?.current && node.ownerDocument && focusAfterAnimation) {
|
|
52
|
+
ref.current.addEventListener('animationend', ()=>{
|
|
56
53
|
processNode(node, firstFocusSelector, ref);
|
|
57
54
|
});
|
|
58
55
|
} else if (node.ownerDocument) {
|
|
@@ -67,17 +64,17 @@ var focusManager = new FocusManager();
|
|
|
67
64
|
active,
|
|
68
65
|
firstFocusSelector
|
|
69
66
|
]);
|
|
70
|
-
useEffect(
|
|
67
|
+
useEffect(()=>{
|
|
71
68
|
if (!active) {
|
|
72
69
|
return;
|
|
73
70
|
}
|
|
74
|
-
|
|
71
|
+
const handleKeyDown = (event)=>{
|
|
75
72
|
if (event.key === 'Tab' && ref.current) {
|
|
76
73
|
scopeTab(ref.current, event);
|
|
77
74
|
}
|
|
78
75
|
};
|
|
79
76
|
document.addEventListener('keydown', handleKeyDown);
|
|
80
|
-
return
|
|
77
|
+
return ()=>{
|
|
81
78
|
document.removeEventListener('keydown', handleKeyDown);
|
|
82
79
|
};
|
|
83
80
|
}, [
|
package/es/hooks/useForkRef.js
CHANGED
|
@@ -5,12 +5,12 @@ import { setRef } from '../utils';
|
|
|
5
5
|
* @param {React.Ref<T>} refOne
|
|
6
6
|
* @param {React.Ref<T>} refTwo
|
|
7
7
|
* @return {Function React.Ref}
|
|
8
|
-
*/ export
|
|
9
|
-
return React.useMemo(
|
|
8
|
+
*/ export const useForkRef = (refOne, refTwo)=>{
|
|
9
|
+
return React.useMemo(()=>{
|
|
10
10
|
if (refOne == null && refTwo === null) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return (refOb)=>{
|
|
14
14
|
setRef(refOne, refOb);
|
|
15
15
|
setRef(refTwo, refOb);
|
|
16
16
|
};
|
|
@@ -2,4 +2,4 @@ import { useLayoutEffect, useEffect } from 'react';
|
|
|
2
2
|
import { canUseDOM } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Runs effect safely on server.
|
|
5
|
-
*/ export
|
|
5
|
+
*/ export const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
|
|
@@ -4,20 +4,20 @@ import { useEffect } from 'react';
|
|
|
4
4
|
* @param {React.Ref<T>} ref - реф элемента, за которым нужно следить
|
|
5
5
|
* @callback callback - функция, которая вызывается при изменении элемента
|
|
6
6
|
* @param {Element} element - элемент, размер которого изменился
|
|
7
|
-
*/ export
|
|
8
|
-
useEffect(
|
|
9
|
-
/* istanbul ignore if: убираем проверку на рефы из покрытия */ if (!
|
|
7
|
+
*/ export const useResizeObserver = (ref, callback)=>{
|
|
8
|
+
useEffect(()=>{
|
|
9
|
+
/* istanbul ignore if: убираем проверку на рефы из покрытия */ if (!ref?.current) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
window.requestAnimationFrame(
|
|
12
|
+
const { current } = ref;
|
|
13
|
+
const resizeObserver = new window.ResizeObserver(()=>{
|
|
14
|
+
window.requestAnimationFrame(()=>{
|
|
15
15
|
callback(current);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
resizeObserver.observe(ref.current);
|
|
19
|
-
return
|
|
20
|
-
/* istanbul ignore if: убираем проверку на рефы из покрытия */ if (!
|
|
19
|
+
return ()=>{
|
|
20
|
+
/* istanbul ignore if: убираем проверку на рефы из покрытия */ if (!ref?.current) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
resizeObserver.unobserve(ref.current);
|
package/es/hooks/useUniqId.js
CHANGED
|
@@ -1,59 +1,13 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_with_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return arr;
|
|
8
|
-
}
|
|
9
|
-
function _iterable_to_array_limit(arr, i) {
|
|
10
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11
|
-
if (_i == null) return;
|
|
12
|
-
var _arr = [];
|
|
13
|
-
var _n = true;
|
|
14
|
-
var _d = false;
|
|
15
|
-
var _s, _e;
|
|
16
|
-
try {
|
|
17
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
18
|
-
_arr.push(_s.value);
|
|
19
|
-
if (i && _arr.length === i) break;
|
|
20
|
-
}
|
|
21
|
-
} catch (err) {
|
|
22
|
-
_d = true;
|
|
23
|
-
_e = err;
|
|
24
|
-
} finally{
|
|
25
|
-
try {
|
|
26
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
27
|
-
} finally{
|
|
28
|
-
if (_d) throw _e;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return _arr;
|
|
32
|
-
}
|
|
33
|
-
function _non_iterable_rest() {
|
|
34
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
35
|
-
}
|
|
36
|
-
function _sliced_to_array(arr, i) {
|
|
37
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
38
|
-
}
|
|
39
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
40
|
-
if (!o) return;
|
|
41
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
42
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
43
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
44
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
45
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
46
|
-
}
|
|
47
1
|
import { useState, useContext } from 'react';
|
|
48
2
|
import { SSRContext } from '../components/SSRProvider';
|
|
49
|
-
|
|
3
|
+
let noSSRId = 0;
|
|
50
4
|
export function useUniqId() {
|
|
51
|
-
|
|
52
|
-
|
|
5
|
+
const context = useContext(SSRContext);
|
|
6
|
+
const [id] = useState(()=>{
|
|
53
7
|
if (context.uniqId !== null) {
|
|
54
|
-
return
|
|
8
|
+
return `plasma-uniq-id-ssr-${++context.uniqId}`;
|
|
55
9
|
}
|
|
56
|
-
return
|
|
57
|
-
})
|
|
10
|
+
return `plasma-uniq-id-${++noSSRId}`;
|
|
11
|
+
});
|
|
58
12
|
return id;
|
|
59
13
|
}
|
package/es/mixins/addFocus.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
import { buttonFocused } from '../tokens';
|
|
3
3
|
import 'focus-visible';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
";"
|
|
4
|
+
export const syntheticFocus = (ruleset, focused)=>css([
|
|
5
|
+
`&.focus-visible:focus,&[data-focus-visible-added]{outline:none;`,
|
|
6
|
+
`}`,
|
|
7
|
+
`;`
|
|
9
8
|
], ruleset, focused && ruleset);
|
|
10
|
-
};
|
|
11
9
|
/**
|
|
12
10
|
* Миксин для добавления фокусной рамки к элементу через псевдоэлемент before
|
|
13
11
|
* @param {FocusProps} props
|
|
@@ -27,21 +25,18 @@ export var syntheticFocus = function syntheticFocus(ruleset, focused) {
|
|
|
27
25
|
* outlineRadius: '10em 1em',
|
|
28
26
|
* outlineColor: 'greenyellow',
|
|
29
27
|
* });
|
|
30
|
-
*/ export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
";pointer-events:none;}",
|
|
41
|
-
""
|
|
28
|
+
*/ export const addFocus = ({ lowPerformance, focused, outlined = true, outlineSize = '0.125rem', outlineOffset = outlineSize, outlineColor = buttonFocused, outlineRadius = 0, synthesizeFocus = syntheticFocus })=>outlined && css([
|
|
29
|
+
`position:relative;&::before{content:'';position:absolute;top:-`,
|
|
30
|
+
`;left:-`,
|
|
31
|
+
`;right:-`,
|
|
32
|
+
`;bottom:-`,
|
|
33
|
+
`;display:block;box-sizing:content-box;border:`,
|
|
34
|
+
` solid transparent;border-radius:`,
|
|
35
|
+
`;transition:`,
|
|
36
|
+
`;pointer-events:none;}`,
|
|
37
|
+
``
|
|
42
38
|
], outlineOffset, outlineOffset, outlineOffset, outlineOffset, outlineSize, outlineRadius, lowPerformance ? 'unset' : 'box-shadow 0.2s ease-in-out', synthesizeFocus(css([
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
`&::before{box-shadow:0 0 0 `,
|
|
40
|
+
` `,
|
|
41
|
+
`;}`
|
|
46
42
|
], outlineSize, outlineColor), focused));
|
|
47
|
-
};
|