@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
|
@@ -19,24 +19,11 @@ _export(exports, {
|
|
|
19
19
|
return modalBaseOverlayClass;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function _define_property(obj, key, value) {
|
|
28
|
-
if (key in obj) {
|
|
29
|
-
Object.defineProperty(obj, key, {
|
|
30
|
-
value: value,
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true
|
|
34
|
-
});
|
|
35
|
-
} else {
|
|
36
|
-
obj[key] = value;
|
|
37
|
-
}
|
|
38
|
-
return obj;
|
|
39
|
-
}
|
|
22
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
23
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
|
|
24
|
+
const _PopupBaseRoot = require("../PopupBase/PopupBaseRoot");
|
|
25
|
+
const _PopupBase = require("../PopupBase");
|
|
26
|
+
const _ModalBaseContext = require("./ModalBaseContext");
|
|
40
27
|
function _getRequireWildcardCache(nodeInterop) {
|
|
41
28
|
if (typeof WeakMap !== "function") return null;
|
|
42
29
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -78,98 +65,29 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
78
65
|
}
|
|
79
66
|
return newObj;
|
|
80
67
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
84
|
-
var ownKeys = Object.keys(source);
|
|
85
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
86
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
87
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
ownKeys.forEach(function(key) {
|
|
91
|
-
_define_property(target, key, source[key]);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return target;
|
|
95
|
-
}
|
|
96
|
-
function _object_without_properties(source, excluded) {
|
|
97
|
-
if (source == null) return {};
|
|
98
|
-
var target = {}, sourceKeys, key, i;
|
|
99
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
100
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
101
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
102
|
-
key = sourceKeys[i];
|
|
103
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
104
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
105
|
-
target[key] = source[key];
|
|
106
|
-
}
|
|
107
|
-
return target;
|
|
108
|
-
}
|
|
109
|
-
target = _object_without_properties_loose(source, excluded);
|
|
110
|
-
if (Object.getOwnPropertySymbols) {
|
|
111
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
112
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
113
|
-
key = sourceKeys[i];
|
|
114
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
115
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
116
|
-
target[key] = source[key];
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return target;
|
|
120
|
-
}
|
|
121
|
-
function _object_without_properties_loose(source, excluded) {
|
|
122
|
-
if (source == null) return {};
|
|
123
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
124
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
125
|
-
key = sourceKeys[i];
|
|
126
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
127
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
128
|
-
target[key] = source[key];
|
|
129
|
-
}
|
|
130
|
-
return target;
|
|
131
|
-
}
|
|
132
|
-
var modalBaseOverlayClass = 'modal-base-overlay';
|
|
133
|
-
var Overlay = _styledcomponents.default.div.withConfig({
|
|
68
|
+
const modalBaseOverlayClass = 'modal-base-overlay';
|
|
69
|
+
const Overlay = _styledcomponents.default.div.withConfig({
|
|
134
70
|
displayName: "ModalOverlay__Overlay",
|
|
135
71
|
componentId: "sc-e7f59b8c-0"
|
|
136
72
|
})([
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
],
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
";"
|
|
147
|
-
], zIndex || _PopupBaseRoot.DEFAULT_Z_INDEX);
|
|
148
|
-
}, function(param) {
|
|
149
|
-
var $withBlur = param.$withBlur;
|
|
73
|
+
`position:fixed;width:100%;height:100%;top:0;left:0;`,
|
|
74
|
+
` `,
|
|
75
|
+
`;background-color:`,
|
|
76
|
+
`;backdrop-filter:var(--backdrop-filter);cursor:`,
|
|
77
|
+
`;`
|
|
78
|
+
], ({ zIndex })=>(0, _styledcomponents.css)([
|
|
79
|
+
`z-index:`,
|
|
80
|
+
`;`
|
|
81
|
+
], zIndex || _PopupBaseRoot.DEFAULT_Z_INDEX), ({ $withBlur })=>{
|
|
150
82
|
return (0, _styledcomponents.css)([
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
83
|
+
`--background-color:`,
|
|
84
|
+
`;--backdrop-filter:`,
|
|
85
|
+
`;`
|
|
154
86
|
], $withBlur ? 'var(--plasma-modal-blur-overlay-color)' : 'var(--plasma-modal-overlay-color)', $withBlur ? 'blur(1rem)' : 'none');
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var clickable = param.clickable;
|
|
160
|
-
return clickable ? 'pointer' : 'default';
|
|
161
|
-
});
|
|
162
|
-
var ModalOverlay = function ModalOverlay(_0) {
|
|
163
|
-
var id = _0.id, withBlur = _0.withBlur, onOverlayClick = _0.onOverlayClick, onClose = _0.onClose, zIndex = _0.zIndex, _0_closeOnOverlayClick = _0.closeOnOverlayClick, closeOnOverlayClick = _0_closeOnOverlayClick === void 0 ? true : _0_closeOnOverlayClick, rest = _object_without_properties(_0, [
|
|
164
|
-
"id",
|
|
165
|
-
"withBlur",
|
|
166
|
-
"onOverlayClick",
|
|
167
|
-
"onClose",
|
|
168
|
-
"zIndex",
|
|
169
|
-
"closeOnOverlayClick"
|
|
170
|
-
]);
|
|
171
|
-
var popupController = (0, _PopupBase.usePopupBaseContext)();
|
|
172
|
-
var onModalOverlayKeyDown = (0, _react.useCallback)(function(event) {
|
|
87
|
+
}, ({ transparent })=>transparent ? 'transparent' : 'var(--background-color)', ({ clickable })=>clickable ? 'pointer' : 'default');
|
|
88
|
+
const ModalOverlay = ({ id, withBlur, onOverlayClick, onClose, zIndex, closeOnOverlayClick = true, ...rest })=>{
|
|
89
|
+
const popupController = (0, _PopupBase.usePopupBaseContext)();
|
|
90
|
+
const onModalOverlayKeyDown = (0, _react.useCallback)((event)=>{
|
|
173
91
|
if (!closeOnOverlayClick) {
|
|
174
92
|
return;
|
|
175
93
|
}
|
|
@@ -185,18 +103,17 @@ var ModalOverlay = function ModalOverlay(_0) {
|
|
|
185
103
|
onOverlayClick,
|
|
186
104
|
onClose
|
|
187
105
|
]);
|
|
188
|
-
|
|
189
|
-
return (0, _ModalBaseContext.getIdLastModal)(popupController.items) !== id;
|
|
190
|
-
}, [
|
|
106
|
+
const transparent = (0, _react.useMemo)(()=>(0, _ModalBaseContext.getIdLastModal)(popupController.items) !== id, [
|
|
191
107
|
id,
|
|
192
108
|
popupController.items
|
|
193
109
|
]);
|
|
194
|
-
return /*#__PURE__*/ _react.default.createElement(Overlay,
|
|
110
|
+
return /*#__PURE__*/ _react.default.createElement(Overlay, {
|
|
195
111
|
className: modalBaseOverlayClass,
|
|
196
112
|
transparent: transparent,
|
|
197
113
|
clickable: closeOnOverlayClick,
|
|
198
114
|
onClick: onModalOverlayKeyDown,
|
|
199
115
|
zIndex: zIndex,
|
|
200
|
-
$withBlur: withBlur
|
|
201
|
-
|
|
116
|
+
$withBlur: withBlur,
|
|
117
|
+
...rest
|
|
118
|
+
});
|
|
202
119
|
};
|
|
@@ -8,43 +8,14 @@ Object.defineProperty(exports, "useModal", {
|
|
|
8
8
|
return useModal;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
value: value,
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
obj[key] = value;
|
|
24
|
-
}
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
|
-
function _object_spread(target) {
|
|
28
|
-
for(var i = 1; i < arguments.length; i++){
|
|
29
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
30
|
-
var ownKeys = Object.keys(source);
|
|
31
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
32
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
33
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
ownKeys.forEach(function(key) {
|
|
37
|
-
_define_property(target, key, source[key]);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return target;
|
|
41
|
-
}
|
|
42
|
-
var ESCAPE_KEYCODE = 27;
|
|
43
|
-
var useModal = function useModal(param) {
|
|
44
|
-
var id = param.id, popupInfo = param.popupInfo, onEscKeyDown = param.onEscKeyDown, onClose = param.onClose, _param_closeOnEsc = param.closeOnEsc, closeOnEsc = _param_closeOnEsc === void 0 ? true : _param_closeOnEsc;
|
|
45
|
-
var popupController = (0, _PopupBase.usePopupBaseContext)();
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const _PopupBase = require("../PopupBase");
|
|
13
|
+
const _ModalBaseContext = require("./ModalBaseContext");
|
|
14
|
+
const ESCAPE_KEYCODE = 27;
|
|
15
|
+
const useModal = ({ id, popupInfo, onEscKeyDown, onClose, closeOnEsc = true })=>{
|
|
16
|
+
const popupController = (0, _PopupBase.usePopupBaseContext)();
|
|
46
17
|
// При ESC закрывает текущее окно, если это возможно
|
|
47
|
-
|
|
18
|
+
const onKeyDown = (0, _react.useCallback)((event)=>{
|
|
48
19
|
if (!closeOnEsc) {
|
|
49
20
|
return;
|
|
50
21
|
}
|
|
@@ -63,9 +34,9 @@ var useModal = function useModal(param) {
|
|
|
63
34
|
popupController.items,
|
|
64
35
|
closeOnEsc
|
|
65
36
|
]);
|
|
66
|
-
(0, _react.useEffect)(
|
|
37
|
+
(0, _react.useEffect)(()=>{
|
|
67
38
|
window.addEventListener('keydown', onKeyDown);
|
|
68
|
-
return
|
|
39
|
+
return ()=>{
|
|
69
40
|
window.removeEventListener('keydown', onKeyDown);
|
|
70
41
|
};
|
|
71
42
|
}, [
|
|
@@ -74,13 +45,14 @@ var useModal = function useModal(param) {
|
|
|
74
45
|
popupController.items,
|
|
75
46
|
closeOnEsc
|
|
76
47
|
]);
|
|
77
|
-
|
|
78
|
-
id
|
|
48
|
+
const modalInfo = {
|
|
49
|
+
id,
|
|
79
50
|
info: {
|
|
80
51
|
isModal: true
|
|
81
|
-
}
|
|
82
|
-
|
|
52
|
+
},
|
|
53
|
+
...popupInfo
|
|
54
|
+
};
|
|
83
55
|
return {
|
|
84
|
-
modalInfo
|
|
56
|
+
modalInfo
|
|
85
57
|
};
|
|
86
58
|
};
|
|
@@ -19,5 +19,5 @@ _export(exports, {
|
|
|
19
19
|
return _ModalOverlay.modalBaseOverlayClass;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const _ModalBase = require("./ModalBase");
|
|
23
|
+
const _ModalOverlay = require("./ModalOverlay");
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "PaginationDot", {
|
|
|
8
8
|
return PaginationDot;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_wildcard(require("styled-components"));
|
|
12
|
+
const _tokens = require("../../tokens");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
15
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -51,21 +51,15 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
}
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
const PaginationDot = _styledcomponents.default.li.withConfig({
|
|
55
55
|
displayName: "PaginationDot",
|
|
56
56
|
componentId: "sc-184538f4-0"
|
|
57
57
|
})([
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
], _tokens.surfaceLiquid03,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var isActive = param.isActive;
|
|
67
|
-
return isActive && (0, _styledcomponents.css)([
|
|
68
|
-
"width:1.75rem;background:",
|
|
69
|
-
";"
|
|
70
|
-
], _tokens.primary);
|
|
71
|
-
});
|
|
58
|
+
`width:0.375rem;height:0.375rem;border-radius:1rem;background:`,
|
|
59
|
+
`;transition:`,
|
|
60
|
+
`;font-size:0.5rem;& + &{margin-left:0.375rem;}&:focus{outline:0 none;}`,
|
|
61
|
+
``
|
|
62
|
+
], _tokens.surfaceLiquid03, ({ theme })=>theme.lowPerformance ? 'unset' : 'width 0.1s ease-in-out, background 0.3s ease-in-out', ({ isActive })=>isActive && (0, _styledcomponents.css)([
|
|
63
|
+
`width:1.75rem;background:`,
|
|
64
|
+
`;`
|
|
65
|
+
], _tokens.primary));
|
|
@@ -8,20 +8,17 @@ Object.defineProperty(exports, "PaginationDots", {
|
|
|
8
8
|
return PaginationDots;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
11
|
+
const _styledcomponents = /*#__PURE__*/ _interop_require_default(require("styled-components"));
|
|
12
12
|
function _interop_require_default(obj) {
|
|
13
13
|
return obj && obj.__esModule ? obj : {
|
|
14
14
|
default: obj
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
var tmp = param['aria-hidden'], ariaHidden = tmp === void 0 ? 'true' : tmp;
|
|
19
|
-
return {
|
|
17
|
+
const PaginationDots = _styledcomponents.default.ul.attrs(({ 'aria-hidden': ariaHidden = 'true' })=>({
|
|
20
18
|
'aria-hidden': ariaHidden
|
|
21
|
-
}
|
|
22
|
-
}).withConfig({
|
|
19
|
+
})).withConfig({
|
|
23
20
|
displayName: "PaginationDots",
|
|
24
21
|
componentId: "sc-dd6e00ec-0"
|
|
25
22
|
})([
|
|
26
|
-
|
|
23
|
+
`display:flex;flex-wrap:wrap;align-self:center;align-items:center;margin:0;padding:0;list-style:none;`
|
|
27
24
|
]);
|
|
@@ -19,6 +19,6 @@ _export(exports, {
|
|
|
19
19
|
return _usePaginationDots.usePaginationDots;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const _usePaginationDots = require("./usePaginationDots");
|
|
23
|
+
const _PaginationDots = require("./PaginationDots");
|
|
24
|
+
const _PaginationDot = require("./PaginationDot");
|
|
@@ -8,17 +8,16 @@ Object.defineProperty(exports, "usePaginationDots", {
|
|
|
8
8
|
return usePaginationDots;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var direction = 0;
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
const usePaginationDots = ({ items, index, visibleItems = 7 })=>{
|
|
13
|
+
const activeId = items[index].id;
|
|
14
|
+
const prevIndex = (0, _react.useRef)(null);
|
|
15
|
+
let direction = 0;
|
|
17
16
|
if (prevIndex.current !== null) {
|
|
18
17
|
direction = index > prevIndex.current ? 1 : -1;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
let start;
|
|
20
|
+
let end;
|
|
22
21
|
if (direction === 1) {
|
|
23
22
|
end = Math.min(Math.max(index + 2, visibleItems), items.length);
|
|
24
23
|
start = Math.max(end - visibleItems, 0);
|
|
@@ -30,10 +29,10 @@ var usePaginationDots = function usePaginationDots(param) {
|
|
|
30
29
|
end = Math.min(start + visibleItems, items.length);
|
|
31
30
|
start = end - visibleItems;
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
const sliced = items.slice(start, end);
|
|
34
33
|
prevIndex.current = index;
|
|
35
34
|
return {
|
|
36
|
-
sliced
|
|
37
|
-
activeId
|
|
35
|
+
sliced,
|
|
36
|
+
activeId
|
|
38
37
|
};
|
|
39
38
|
};
|