@salutejs/plasma-new-hope 0.146.1-canary.1412.10900761739.0 → 0.146.1-canary.1441.10902378762.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/DatePicker/RangeDate/RangeDate.js +30 -6
- package/cjs/components/DatePicker/RangeDate/RangeDate.js.map +1 -1
- package/cjs/components/DatePicker/SingleDate/SingleDate.js +15 -3
- package/cjs/components/DatePicker/SingleDate/SingleDate.js.map +1 -1
- package/cjs/components/DatePicker/hooks/useDatePicker.js +48 -5
- package/cjs/components/DatePicker/hooks/useDatePicker.js.map +1 -1
- package/cjs/components/DatePicker/utils/dateHelper.js +11 -2
- package/cjs/components/DatePicker/utils/dateHelper.js.map +1 -1
- package/cjs/components/Drawer/Drawer.css +3 -4
- package/cjs/components/Drawer/Drawer.js +1 -1
- package/cjs/components/Drawer/Drawer.styles.js +0 -2
- package/cjs/components/Drawer/Drawer.styles.js.map +1 -1
- package/cjs/components/Drawer/hooks/useDrawer.js +1 -1
- package/cjs/components/Modal/Modal.css +3 -4
- package/cjs/components/Modal/hooks/useModal.js +1 -1
- package/cjs/components/Notification/NotificationsProvider.css +3 -4
- package/cjs/components/Popup/Popup.css +3 -0
- package/cjs/components/Popup/Popup.js +38 -155
- package/cjs/components/Popup/Popup.js.map +1 -1
- package/cjs/components/Popup/Popup.styles.js +9 -21
- package/cjs/components/Popup/Popup.styles.js.map +1 -1
- package/cjs/components/Popup/Popup.styles_141jyqa.css +3 -0
- package/cjs/components/Popup/PopupContext.js +9 -9
- package/cjs/components/Popup/PopupContext.js.map +1 -1
- package/cjs/components/Popup/hooks/usePopup.js +1 -1
- package/cjs/components/Popup/hooks/usePopup.js.map +1 -1
- package/cjs/index.css +3 -4
- package/emotion/cjs/components/DatePicker/DatePicker.template-doc.mdx +13 -10
- package/emotion/cjs/components/DatePicker/RangeDate/RangeDate.js +30 -6
- package/emotion/cjs/components/DatePicker/SingleDate/SingleDate.js +15 -3
- package/emotion/cjs/components/DatePicker/hooks/useDatePicker.js +48 -5
- package/emotion/cjs/components/DatePicker/utils/dateHelper.js +11 -2
- package/emotion/cjs/components/Popup/Popup.js +38 -156
- package/emotion/cjs/components/Popup/Popup.styles.js +5 -25
- package/emotion/cjs/components/Popup/PopupContext.js +9 -10
- package/emotion/cjs/components/Popup/hooks/usePopup.js +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Drawer/Drawer.stories.tsx +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Popup/Popup.stories.tsx +1 -1
- package/emotion/cjs/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -1
- package/emotion/cjs/examples/plasma_web/components/Popup/Popup.stories.tsx +1 -1
- package/emotion/es/components/DatePicker/DatePicker.template-doc.mdx +13 -10
- package/emotion/es/components/DatePicker/RangeDate/RangeDate.js +30 -6
- package/emotion/es/components/DatePicker/SingleDate/SingleDate.js +15 -3
- package/emotion/es/components/DatePicker/hooks/useDatePicker.js +48 -5
- package/emotion/es/components/DatePicker/utils/dateHelper.js +11 -2
- package/emotion/es/components/Popup/Popup.js +39 -156
- package/emotion/es/components/Popup/Popup.styles.js +4 -24
- package/emotion/es/components/Popup/PopupContext.js +10 -10
- package/emotion/es/components/Popup/hooks/usePopup.js +1 -1
- package/emotion/es/examples/plasma_b2c/components/Drawer/Drawer.stories.tsx +1 -1
- package/emotion/es/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -1
- package/emotion/es/examples/plasma_b2c/components/Popup/Popup.stories.tsx +1 -1
- package/emotion/es/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -1
- package/emotion/es/examples/plasma_web/components/Popup/Popup.stories.tsx +1 -1
- package/es/components/DatePicker/RangeDate/RangeDate.js +30 -6
- package/es/components/DatePicker/RangeDate/RangeDate.js.map +1 -1
- package/es/components/DatePicker/SingleDate/SingleDate.js +15 -3
- package/es/components/DatePicker/SingleDate/SingleDate.js.map +1 -1
- package/es/components/DatePicker/hooks/useDatePicker.js +48 -5
- package/es/components/DatePicker/hooks/useDatePicker.js.map +1 -1
- package/es/components/DatePicker/utils/dateHelper.js +11 -2
- package/es/components/DatePicker/utils/dateHelper.js.map +1 -1
- package/es/components/Drawer/Drawer.css +3 -4
- package/es/components/Drawer/Drawer.js +1 -1
- package/es/components/Drawer/Drawer.styles.js +0 -2
- package/es/components/Drawer/Drawer.styles.js.map +1 -1
- package/es/components/Drawer/hooks/useDrawer.js +1 -1
- package/es/components/Modal/Modal.css +3 -4
- package/es/components/Modal/hooks/useModal.js +1 -1
- package/es/components/Notification/NotificationsProvider.css +3 -4
- package/es/components/Popup/Popup.css +3 -0
- package/es/components/Popup/Popup.js +40 -157
- package/es/components/Popup/Popup.js.map +1 -1
- package/es/components/Popup/Popup.styles.js +10 -20
- package/es/components/Popup/Popup.styles.js.map +1 -1
- package/es/components/Popup/Popup.styles_141jyqa.css +3 -0
- package/es/components/Popup/PopupContext.js +10 -10
- package/es/components/Popup/PopupContext.js.map +1 -1
- package/es/components/Popup/hooks/usePopup.js +1 -1
- package/es/components/Popup/hooks/usePopup.js.map +1 -1
- package/es/index.css +3 -4
- package/package.json +4 -4
- package/styled-components/cjs/components/DatePicker/DatePicker.template-doc.mdx +13 -10
- package/styled-components/cjs/components/DatePicker/RangeDate/RangeDate.js +30 -6
- package/styled-components/cjs/components/DatePicker/SingleDate/SingleDate.js +15 -3
- package/styled-components/cjs/components/DatePicker/hooks/useDatePicker.js +48 -5
- package/styled-components/cjs/components/DatePicker/utils/dateHelper.js +11 -2
- package/styled-components/cjs/components/Popup/Popup.js +38 -156
- package/styled-components/cjs/components/Popup/Popup.styles.js +4 -7
- package/styled-components/cjs/components/Popup/PopupContext.js +9 -10
- package/styled-components/cjs/components/Popup/hooks/usePopup.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Drawer/Drawer.stories.tsx +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Popup/Popup.stories.tsx +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Popup/Popup.stories.tsx +1 -1
- package/styled-components/es/components/DatePicker/DatePicker.template-doc.mdx +13 -10
- package/styled-components/es/components/DatePicker/RangeDate/RangeDate.js +30 -6
- package/styled-components/es/components/DatePicker/SingleDate/SingleDate.js +15 -3
- package/styled-components/es/components/DatePicker/hooks/useDatePicker.js +48 -5
- package/styled-components/es/components/DatePicker/utils/dateHelper.js +11 -2
- package/styled-components/es/components/Popup/Popup.js +39 -156
- package/styled-components/es/components/Popup/Popup.styles.js +3 -6
- package/styled-components/es/components/Popup/PopupContext.js +10 -10
- package/styled-components/es/components/Popup/hooks/usePopup.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Drawer/Drawer.stories.tsx +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Popup/Popup.stories.tsx +1 -1
- package/styled-components/es/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -1
- package/styled-components/es/examples/plasma_web/components/Popup/Popup.stories.tsx +1 -1
- package/types/components/DatePicker/RangeDate/RangeDate.d.ts.map +1 -1
- package/types/components/DatePicker/hooks/useDatePicker.d.ts.map +1 -1
- package/types/components/DatePicker/utils/dateHelper.d.ts +10 -1
- package/types/components/DatePicker/utils/dateHelper.d.ts.map +1 -1
- package/types/components/Popup/Popup.d.ts +1 -1
- package/types/components/Popup/Popup.d.ts.map +1 -1
- package/types/components/Popup/Popup.styles.d.ts +0 -1
- package/types/components/Popup/Popup.styles.d.ts.map +1 -1
- package/types/components/Popup/PopupContext.d.ts.map +1 -1
- package/cjs/components/Popup/Popup.styles_8h77g1.css +0 -4
- package/cjs/components/Popup/PopupContext.css +0 -4
- package/es/components/Popup/Popup.styles_8h77g1.css +0 -4
- package/es/components/Popup/PopupContext.css +0 -4
package/cjs/index.css
CHANGED
@@ -258,10 +258,9 @@
|
|
258
258
|
|
259
259
|
.Subtitle_styles_1plleej_b810c19__d9c54bce{font-family:var(--typo-font-family);font-size:var(--typo-font-size);font-style:var(--typo-font-style);-webkit-letter-spacing:var(--typo-font-letter-spacing);-moz-letter-spacing:var(--typo-font-letter-spacing);-ms-letter-spacing:var(--typo-font-letter-spacing);letter-spacing:var(--typo-font-letter-spacing);line-height:var(--typo-font-line-height);font-weight:var(--typo-font-weight);overflow-wrap:break-word;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;}
|
260
260
|
|
261
|
-
|
262
|
-
.
|
263
|
-
.
|
264
|
-
.Popup_styles_8h77g1_p1f40oul__4eb91f42{position:absolute;z-index:var(--p1f40oul-0);left:var(--p1f40oul-1);right:var(--p1f40oul-2);top:var(--p1f40oul-3);bottom:var(--p1f40oul-4);-webkit-transform:var(--p1f40oul-5);-ms-transform:var(--p1f40oul-5);transform:var(--p1f40oul-5);}
|
261
|
+
|
262
|
+
.Popup_styles_141jyqa_p1cjo3us__ed39c2a3{position:relative;max-width:100%;pointer-events:all;}
|
263
|
+
.Popup_styles_141jyqa_p5u7tqa__ed39c2a3{position:absolute;z-index:var(--p5u7tqa-0);left:var(--p5u7tqa-1);right:var(--p5u7tqa-2);top:var(--p5u7tqa-3);bottom:var(--p5u7tqa-4);-webkit-transform:var(--p5u7tqa-5);-ms-transform:var(--p5u7tqa-5);transform:var(--p5u7tqa-5);}
|
265
264
|
|
266
265
|
.NotificationsPortal_6417q6_s19gbs9t__4166aeb6 > .NotificationsPortal_6417q6_popupBaseRoot__4166aeb6{overflow:hidden;}
|
267
266
|
|
@@ -37,17 +37,20 @@ export function App() {
|
|
37
37
|
|
38
38
|
### Формат даты
|
39
39
|
Формат даты задается с помощью свойства `format`.
|
40
|
-
| Обозначение | Отображение
|
41
|
-
|
42
|
-
| DD | 01-31
|
43
|
-
| D | 1-31
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
| Обозначение | Отображение | Описание |
|
41
|
+
|-------------|---------------------------------------|----------------------------------|
|
42
|
+
| DD | 01-31 | Дни месяца, 2 цифры |
|
43
|
+
| D | 1-31 | Дни месяца |
|
44
|
+
| MMMM | January...December / январь...декабрь | Месяц года, полное название |
|
45
|
+
| MMM | Jan...Dec / янв.-дек. | Месяц года, сокращенное название |
|
46
|
+
| MM | 01-12 | Месяц года, 2 цифры |
|
47
|
+
| M | 1-12 | Месяц года |
|
48
|
+
| YYYY | 2024 | Год из 4 цифр |
|
49
|
+
| YY | 24 | Год из 2 цифр |
|
50
|
+
| Q | 1-4 | Квартал |
|
51
|
+
|
49
52
|
При выборе даты в календаре или вводе даты через поле ввода, дата будет приводиться к заданному формату.
|
50
|
-
Свойство `maskWithFormat` позволяет маскировать
|
53
|
+
Свойство `maskWithFormat` позволяет маскировать ввод, кроме случаев когда месяц имеет формат полной записи MMMM:
|
51
54
|
|
52
55
|
```tsx live
|
53
56
|
import React from 'react';
|
@@ -122,7 +122,11 @@ var datePickerRangeRoot = exports.datePickerRangeRoot = function datePickerRange
|
|
122
122
|
_useState8 = _slicedToArray(_useState7, 2),
|
123
123
|
calendarFirstValue = _useState8[0],
|
124
124
|
setCalendarFirstValue = _useState8[1];
|
125
|
-
var _useState9 = (0, _react.useState)((0, _dateHelper.formatInputValue)(
|
125
|
+
var _useState9 = (0, _react.useState)((0, _dateHelper.formatInputValue)({
|
126
|
+
value: defaultFirstDate,
|
127
|
+
format: format,
|
128
|
+
lang: lang
|
129
|
+
})),
|
126
130
|
_useState10 = _slicedToArray(_useState9, 2),
|
127
131
|
inputFirstValue = _useState10[0],
|
128
132
|
setInputFirstValue = _useState10[1];
|
@@ -130,7 +134,11 @@ var datePickerRangeRoot = exports.datePickerRangeRoot = function datePickerRange
|
|
130
134
|
_useState12 = _slicedToArray(_useState11, 2),
|
131
135
|
calendarSecondValue = _useState12[0],
|
132
136
|
setCalendarSecondValue = _useState12[1];
|
133
|
-
var _useState13 = (0, _react.useState)((0, _dateHelper.formatInputValue)(
|
137
|
+
var _useState13 = (0, _react.useState)((0, _dateHelper.formatInputValue)({
|
138
|
+
value: defaultSecondDate,
|
139
|
+
format: format,
|
140
|
+
lang: lang
|
141
|
+
})),
|
134
142
|
_useState14 = _slicedToArray(_useState13, 2),
|
135
143
|
inputSecondValue = _useState14[0],
|
136
144
|
setInputSecondValue = _useState14[1];
|
@@ -249,17 +257,33 @@ var datePickerRangeRoot = exports.datePickerRangeRoot = function datePickerRange
|
|
249
257
|
}, [opened]);
|
250
258
|
(0, _react.useEffect)(function () {
|
251
259
|
setCalendarFirstValue((0, _dateHelper.formatCalendarValue)(defaultFirstDate, format, lang));
|
252
|
-
setInputFirstValue((0, _dateHelper.formatInputValue)(
|
260
|
+
setInputFirstValue((0, _dateHelper.formatInputValue)({
|
261
|
+
value: defaultFirstDate,
|
262
|
+
format: format,
|
263
|
+
lang: lang
|
264
|
+
}));
|
253
265
|
}, [defaultFirstDate]);
|
254
266
|
(0, _react.useEffect)(function () {
|
255
267
|
setCalendarSecondValue((0, _dateHelper.formatCalendarValue)(defaultSecondDate, format, lang));
|
256
|
-
setInputSecondValue((0, _dateHelper.formatInputValue)(
|
268
|
+
setInputSecondValue((0, _dateHelper.formatInputValue)({
|
269
|
+
value: defaultSecondDate,
|
270
|
+
format: format,
|
271
|
+
lang: lang
|
272
|
+
}));
|
257
273
|
}, [defaultSecondDate]);
|
258
274
|
(0, _react.useEffect)(function () {
|
259
275
|
setCalendarFirstValue((0, _dateHelper.formatCalendarValue)(defaultFirstDate, format, lang));
|
260
|
-
setInputFirstValue((0, _dateHelper.formatInputValue)(
|
276
|
+
setInputFirstValue((0, _dateHelper.formatInputValue)({
|
277
|
+
value: defaultFirstDate,
|
278
|
+
format: format,
|
279
|
+
lang: lang
|
280
|
+
}));
|
261
281
|
setCalendarSecondValue((0, _dateHelper.formatCalendarValue)(defaultSecondDate, format, lang));
|
262
|
-
setInputSecondValue((0, _dateHelper.formatInputValue)(
|
282
|
+
setInputSecondValue((0, _dateHelper.formatInputValue)({
|
283
|
+
value: defaultSecondDate,
|
284
|
+
format: format,
|
285
|
+
lang: lang
|
286
|
+
}));
|
263
287
|
}, [format, lang]);
|
264
288
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
265
289
|
ref: rootRef,
|
@@ -92,7 +92,11 @@ var datePickerRoot = exports.datePickerRoot = function datePickerRoot(Root) {
|
|
92
92
|
_useState4 = _slicedToArray(_useState3, 2),
|
93
93
|
calendarValue = _useState4[0],
|
94
94
|
setCalendarValue = _useState4[1];
|
95
|
-
var _useState5 = (0, _react.useState)((0, _dateHelper.formatInputValue)(
|
95
|
+
var _useState5 = (0, _react.useState)((0, _dateHelper.formatInputValue)({
|
96
|
+
value: defaultDate,
|
97
|
+
format: format,
|
98
|
+
lang: lang
|
99
|
+
})),
|
96
100
|
_useState6 = _slicedToArray(_useState5, 2),
|
97
101
|
inputValue = _useState6[0],
|
98
102
|
setInputValue = _useState6[1];
|
@@ -158,11 +162,19 @@ var datePickerRoot = exports.datePickerRoot = function datePickerRoot(Root) {
|
|
158
162
|
}, [opened]);
|
159
163
|
(0, _react.useEffect)(function () {
|
160
164
|
setCalendarValue((0, _dateHelper.formatCalendarValue)(defaultDate, format, lang));
|
161
|
-
setInputValue((0, _dateHelper.formatInputValue)(
|
165
|
+
setInputValue((0, _dateHelper.formatInputValue)({
|
166
|
+
value: defaultDate,
|
167
|
+
format: format,
|
168
|
+
lang: lang
|
169
|
+
}));
|
162
170
|
}, [defaultDate]);
|
163
171
|
(0, _react.useEffect)(function () {
|
164
172
|
setCalendarValue((0, _dateHelper.formatCalendarValue)(defaultDate, format, lang));
|
165
|
-
setInputValue((0, _dateHelper.formatInputValue)(
|
173
|
+
setInputValue((0, _dateHelper.formatInputValue)({
|
174
|
+
value: defaultDate,
|
175
|
+
format: format,
|
176
|
+
lang: lang
|
177
|
+
}));
|
166
178
|
}, [format, lang]);
|
167
179
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
168
180
|
view: view,
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.useDatePicker = void 0;
|
7
7
|
var _DatePicker = /*#__PURE__*/require("../DatePicker.tokens");
|
8
8
|
var _dateHelper = /*#__PURE__*/require("../utils/dateHelper");
|
9
|
+
var _datejs = /*#__PURE__*/require("../../../utils/datejs");
|
9
10
|
var useDatePicker = exports.useDatePicker = function useDatePicker(_ref) {
|
10
11
|
var currentValue = _ref.currentValue,
|
11
12
|
setInputValue = _ref.setInputValue,
|
@@ -44,10 +45,43 @@ var useDatePicker = exports.useDatePicker = function useDatePicker(_ref) {
|
|
44
45
|
var newValue = maskWithFormat ? (0, _dateHelper.getMaskedDateOnInput)(value, format, dateFormatDelimiter(), currentValue) : value;
|
45
46
|
if (!format) {
|
46
47
|
setCalendarValue((0, _dateHelper.formatCalendarValue)(newValue));
|
47
|
-
|
48
|
+
setInputValue((0, _dateHelper.formatInputValue)({
|
49
|
+
value: newValue,
|
50
|
+
format: format,
|
51
|
+
lang: lang
|
52
|
+
}));
|
53
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(event, newValue);
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
* NOTE: если в формате даты есть месяц в полном названии или сокращенном,
|
59
|
+
* нужно дополнительно проводить валидацию на полноту введенной даты.
|
60
|
+
* Иначе dayjs циклически будет пытаться отформатировать некорректную дату.
|
61
|
+
*/
|
62
|
+
var hasMonthFullName = /M{3,4}/g.test(format);
|
63
|
+
var isValidMonth;
|
64
|
+
var isLengthEqual;
|
65
|
+
if (hasMonthFullName) {
|
66
|
+
_datejs.customDayjs.locale(lang);
|
67
|
+
var firstIndexOfMonth = format.indexOf('M');
|
68
|
+
var lastIndexOfMonth = newValue.indexOf(dateFormatDelimiter(), firstIndexOfMonth);
|
69
|
+
var fullMonthName = !lastIndexOfMonth ? newValue.slice(firstIndexOfMonth) : newValue.slice(firstIndexOfMonth, lastIndexOfMonth);
|
70
|
+
var monthFormatting = format.replace(/[^M]/g, '');
|
71
|
+
isValidMonth = (0, _datejs.customDayjs)("01 ".concat(fullMonthName, " 1970"), "DD ".concat(monthFormatting, " YYYY"), true).isValid();
|
72
|
+
isLengthEqual = format.length - monthFormatting.length === newValue.length - fullMonthName.length;
|
73
|
+
}
|
74
|
+
if (!hasMonthFullName && (newValue === null || newValue === void 0 ? void 0 : newValue.length) === (format === null || format === void 0 ? void 0 : format.length) || isValidMonth && isLengthEqual) {
|
48
75
|
setCalendarValue((0, _dateHelper.formatCalendarValue)(newValue, format, lang));
|
49
76
|
}
|
50
|
-
setInputValue((0, _dateHelper.formatInputValue)(
|
77
|
+
setInputValue((0, _dateHelper.formatInputValue)({
|
78
|
+
value: newValue,
|
79
|
+
format: format,
|
80
|
+
lang: lang,
|
81
|
+
hasMonthFullName: hasMonthFullName,
|
82
|
+
isValidMonth: isValidMonth,
|
83
|
+
isLengthEqual: isLengthEqual
|
84
|
+
}));
|
51
85
|
onChangeValue === null || onChangeValue === void 0 || onChangeValue(event, newValue);
|
52
86
|
};
|
53
87
|
var handleCommitDate = function handleCommitDate(date, applyFormat, isCalendarValue, dateInfo) {
|
@@ -61,8 +95,13 @@ var useDatePicker = exports.useDatePicker = function useDatePicker(_ref) {
|
|
61
95
|
}
|
62
96
|
if (isCalendarValue) {
|
63
97
|
setCalendarValue((0, _dateHelper.formatCalendarValue)(date, format, lang));
|
64
|
-
setInputValue((0, _dateHelper.formatInputValue)(
|
65
|
-
|
98
|
+
setInputValue((0, _dateHelper.formatInputValue)({
|
99
|
+
value: date,
|
100
|
+
format: format,
|
101
|
+
lang: lang
|
102
|
+
}));
|
103
|
+
onCommitDate === null || onCommitDate === void 0 || onCommitDate(date, false, true, dateInfo);
|
104
|
+
return;
|
66
105
|
}
|
67
106
|
var formatString = applyFormat ? format : undefined;
|
68
107
|
var _getDateFromFormat = (0, _dateHelper.getDateFromFormat)(date, formatString, lang),
|
@@ -70,7 +109,11 @@ var useDatePicker = exports.useDatePicker = function useDatePicker(_ref) {
|
|
70
109
|
isError = _getDateFromFormat.isError,
|
71
110
|
isSuccess = _getDateFromFormat.isSuccess;
|
72
111
|
setCalendarValue((0, _dateHelper.formatCalendarValue)(newDate, format, lang));
|
73
|
-
setInputValue((0, _dateHelper.formatInputValue)(
|
112
|
+
setInputValue((0, _dateHelper.formatInputValue)({
|
113
|
+
value: newDate,
|
114
|
+
format: format,
|
115
|
+
lang: lang
|
116
|
+
}));
|
74
117
|
onCommitDate === null || onCommitDate === void 0 || onCommitDate(newDate, isError, isSuccess);
|
75
118
|
};
|
76
119
|
return {
|
@@ -5,10 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.getMaskedDateOnInput = exports.getDateFromFormat = exports.getDateFormatDelimiter = exports.formatInputValue = exports.formatCalendarValue = void 0;
|
7
7
|
var _datejs = /*#__PURE__*/require("../../../utils/datejs");
|
8
|
-
var formatInputValue = exports.formatInputValue = function formatInputValue(
|
8
|
+
var formatInputValue = exports.formatInputValue = function formatInputValue(_ref) {
|
9
|
+
var value = _ref.value,
|
10
|
+
format = _ref.format,
|
11
|
+
lang = _ref.lang,
|
12
|
+
hasMonthFullName = _ref.hasMonthFullName,
|
13
|
+
isValidMonth = _ref.isValidMonth,
|
14
|
+
isLengthEqual = _ref.isLengthEqual;
|
9
15
|
if (!value || !lang) {
|
10
16
|
return '';
|
11
17
|
}
|
18
|
+
if (hasMonthFullName && (!isValidMonth || !isLengthEqual)) {
|
19
|
+
return String(value);
|
20
|
+
}
|
12
21
|
if (format && (0, _datejs.customDayjs)(value, format, true).isValid()) {
|
13
22
|
return (0, _datejs.customDayjs)(value, format).locale(lang).format(format);
|
14
23
|
}
|
@@ -62,7 +71,7 @@ var getMaskedDateOnInput = exports.getMaskedDateOnInput = function getMaskedDate
|
|
62
71
|
if (!value) {
|
63
72
|
return '';
|
64
73
|
}
|
65
|
-
if (!format || !delimiter) {
|
74
|
+
if (!format || !delimiter || /M{3,4}/g.test(format)) {
|
66
75
|
return value;
|
67
76
|
}
|
68
77
|
if (value.length >= format.length) {
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.popupRoot = exports.popupConfig = exports.handlePosition = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
-
var _reactDom = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react-dom"));
|
10
9
|
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
11
10
|
var _utils = /*#__PURE__*/require("../../utils");
|
12
11
|
var _Portal = /*#__PURE__*/require("../Portal");
|
@@ -14,9 +13,7 @@ var _PopupContext = /*#__PURE__*/require("./PopupContext");
|
|
14
13
|
var _PopupRoot = /*#__PURE__*/require("./PopupRoot");
|
15
14
|
var _hooks = /*#__PURE__*/require("./hooks");
|
16
15
|
var _Popup = /*#__PURE__*/require("./Popup.tokens");
|
17
|
-
var _Popup2 = /*#__PURE__*/require("./Popup.styles");
|
18
16
|
var _excluded = ["id", "isOpen", "opened", "placement", "offset", "frame", "children", "overlay", "role", "zIndex", "popupInfo", "withAnimation", "className"];
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
20
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
21
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
22
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
@@ -51,8 +48,8 @@ var handlePosition = exports.handlePosition = function handlePosition(placement,
|
|
51
48
|
var bottom;
|
52
49
|
var transform;
|
53
50
|
var placements = placement.split('-');
|
54
|
-
placements.forEach(function (
|
55
|
-
switch (
|
51
|
+
placements.forEach(function (placement) {
|
52
|
+
switch (placement) {
|
56
53
|
case 'left':
|
57
54
|
left = x;
|
58
55
|
break;
|
@@ -85,139 +82,9 @@ var handlePosition = exports.handlePosition = function handlePosition(placement,
|
|
85
82
|
transform: transform
|
86
83
|
};
|
87
84
|
};
|
88
|
-
/*
|
89
|
-
const getPortalParent = (frame: 'document' | string | React.RefObject<HTMLElement>, portalRef) => {
|
90
|
-
if (typeof frame !== 'string' && frame && frame.current) {
|
91
|
-
portalRef.current = frame.current;
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
|
95
|
-
if (typeof frame === 'string' && frame !== 'document') {
|
96
|
-
const element = document.getElementById(frame);
|
97
|
-
if (element) {
|
98
|
-
const portal = document.createElement('div');
|
99
|
-
portal.className = 'frame-portal';
|
100
|
-
portal.style.position = 'relative';
|
101
|
-
portal.style.width = '0';
|
102
|
-
|
103
|
-
element.appendChild(portal);
|
104
|
-
portalRef.current = portal;
|
105
|
-
|
106
|
-
return;
|
107
|
-
//
|
108
|
-
// const portal = document?.querySelector('.frame-portal');
|
109
|
-
// if (!portal) {
|
110
|
-
// portal = document.createElement('div');
|
111
|
-
// document.getElementById(frame)?.appendChild(portal);
|
112
|
-
// }
|
113
|
-
// return portal;
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
const portal = document.getElementById(POPUP_PORTAL_ID);
|
118
|
-
|
119
|
-
if (!portal) {
|
120
|
-
ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
|
121
|
-
}
|
122
|
-
|
123
|
-
portalRef.current = portal;
|
124
|
-
|
125
|
-
let portal;
|
126
|
-
|
127
|
-
const hasFrame = typeof frame !== 'string' && frame && frame.current;
|
128
|
-
if (hasFrame) {
|
129
|
-
portal = frame.current;
|
130
|
-
} else {
|
131
|
-
// ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
|
132
|
-
|
133
|
-
portal = document.getElementById(POPUP_PORTAL_ID);
|
134
|
-
|
135
|
-
if (!portal) {
|
136
|
-
if (typeof frame === 'string' && frame !== 'document') {
|
137
|
-
portal = document.createElement('div');
|
138
|
-
document.getElementById(frame)?.appendChild(portal);
|
139
|
-
} else {
|
140
|
-
portal.className('frame-portal');
|
141
|
-
document.body.appendChild(portal);
|
142
|
-
// ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
|
143
|
-
}
|
144
|
-
}
|
145
|
-
}
|
146
|
-
|
147
|
-
};
|
148
|
-
|
149
|
-
const usePortalContainer = (frame: 'document' | string | React.RefObject<HTMLElement>) => {
|
150
|
-
const portalRef = useRef<HTMLDivElement | null>(null);
|
151
|
-
|
152
|
-
if (typeof frame !== 'string' && frame && frame.current) {
|
153
|
-
return frame.current;
|
154
|
-
}
|
155
|
-
|
156
|
-
if (typeof frame === 'string' && frame !== 'document') {
|
157
|
-
const element = document.getElementById(frame);
|
158
|
-
|
159
|
-
const portal = document?.querySelector('.frame-portal');
|
160
|
-
|
161
|
-
if (portal) {
|
162
|
-
return portal;
|
163
|
-
}
|
164
|
-
|
165
|
-
if (element) {
|
166
|
-
const portal = document.createElement('div');
|
167
|
-
portal.className = 'frame-portal';
|
168
|
-
portal.style.position = 'relative';
|
169
|
-
// portal.style.width = '0';
|
170
|
-
|
171
|
-
element.appendChild(portal);
|
172
|
-
return portal;
|
173
|
-
//
|
174
|
-
// const portal = document?.querySelector('.frame-portal');
|
175
|
-
// if (!portal) {
|
176
|
-
// portal = document.createElement('div');
|
177
|
-
// document.getElementById(frame)?.appendChild(portal);
|
178
|
-
// }
|
179
|
-
// return portal;
|
180
|
-
}
|
181
|
-
}
|
182
|
-
|
183
|
-
const portal = document.getElementById(POPUP_PORTAL_ID);
|
184
|
-
|
185
|
-
if (!portal) {
|
186
|
-
const res = ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
|
187
|
-
|
188
|
-
console.log('!!! res', res);
|
189
|
-
}
|
190
|
-
|
191
|
-
console.log('!!!! portalRef.current', portalRef.current, document.getElementById(POPUP_PORTAL_ID));
|
192
|
-
return portalRef.current;
|
193
|
-
|
194
|
-
let portal;
|
195
|
-
|
196
|
-
const hasFrame = typeof frame !== 'string' && frame && frame.current;
|
197
|
-
if (hasFrame) {
|
198
|
-
portal = frame.current;
|
199
|
-
} else {
|
200
|
-
// ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
|
201
|
-
|
202
|
-
portal = document.getElementById(POPUP_PORTAL_ID);
|
203
|
-
|
204
|
-
if (!portal) {
|
205
|
-
if (typeof frame === 'string' && frame !== 'document') {
|
206
|
-
portal = document.createElement('div');
|
207
|
-
document.getElementById(frame)?.appendChild(portal);
|
208
|
-
} else {
|
209
|
-
portal.className('frame-portal');
|
210
|
-
document.body.appendChild(portal);
|
211
|
-
// ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
|
212
|
-
}
|
213
|
-
}
|
214
|
-
}
|
215
|
-
|
216
|
-
};
|
217
|
-
*/
|
218
85
|
|
219
86
|
/**
|
220
|
-
* Базовый
|
87
|
+
* Базовый копмонент Popup.
|
221
88
|
*/
|
222
89
|
var popupRoot = exports.popupRoot = function popupRoot(Root) {
|
223
90
|
return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, outerRootRef) {
|
@@ -256,11 +123,44 @@ var popupRoot = exports.popupRoot = function popupRoot(Root) {
|
|
256
123
|
var portalRef = (0, _react.useRef)(null);
|
257
124
|
var contentRef = (0, _react.useRef)(null);
|
258
125
|
var innerRef = (0, _plasmaCore.useForkRef)(contentRef, outerRootRef);
|
126
|
+
var _useState = (0, _react.useState)(false),
|
127
|
+
_useState2 = _slicedToArray(_useState, 2),
|
128
|
+
forceRender = _useState2[1];
|
129
|
+
(0, _react.useEffect)(function () {
|
130
|
+
var portal = document.getElementById(_PopupContext.POPUP_PORTAL_ID);
|
131
|
+
if (typeof frame !== 'string' && frame && frame.current) {
|
132
|
+
portal = frame.current;
|
133
|
+
}
|
134
|
+
if (!portal) {
|
135
|
+
portal = document.createElement('div');
|
136
|
+
portal.setAttribute('id', _PopupContext.POPUP_PORTAL_ID);
|
137
|
+
/**
|
138
|
+
* Нужно для того, чтобы во фрейме не происходило скачков контента
|
139
|
+
* при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)
|
140
|
+
*/
|
141
|
+
portal.style.width = '0';
|
142
|
+
if (typeof frame === 'string' && frame !== 'document') {
|
143
|
+
var _document$getElementB;
|
144
|
+
(_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0 || _document$getElementB.appendChild(portal);
|
145
|
+
} else {
|
146
|
+
document.body.appendChild(portal);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
portalRef.current = portal;
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Изменение стейта нужно для того, чтобы Popup
|
153
|
+
* отобразился после записи DOM элемента в portalRef.current
|
154
|
+
*/
|
155
|
+
forceRender(true);
|
156
|
+
}, []);
|
259
157
|
if (!isVisible && !innerIsOpen) {
|
260
158
|
return null;
|
261
159
|
}
|
262
160
|
var cls = (0, _utils.cx)(className, animationInfo !== null && animationInfo !== void 0 && animationInfo.endAnimation ? _Popup.classes.endAnimation : '', animationInfo !== null && animationInfo !== void 0 && animationInfo.endTransition ? _Popup.classes.endTransition : '');
|
263
|
-
|
161
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, portalRef.current && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
|
162
|
+
container: portalRef.current
|
163
|
+
}, /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
264
164
|
className: cls
|
265
165
|
}, rest), overlay, /*#__PURE__*/_react["default"].createElement(_PopupRoot.PopupRoot, {
|
266
166
|
id: innerId,
|
@@ -270,25 +170,7 @@ var popupRoot = exports.popupRoot = function popupRoot(Root) {
|
|
270
170
|
zIndex: zIndex,
|
271
171
|
animationInfo: animationInfo,
|
272
172
|
setVisible: setVisible
|
273
|
-
}, children));
|
274
|
-
if (typeof frame !== 'string' && frame && frame.current) {
|
275
|
-
return /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
|
276
|
-
container: frame.current
|
277
|
-
}, rootNode);
|
278
|
-
}
|
279
|
-
var withFrameId = typeof frame === 'string' && frame !== 'document';
|
280
|
-
var containerElement = withFrameId && document.getElementById(frame);
|
281
|
-
if (containerElement) {
|
282
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_reactDom["default"].createPortal( /*#__PURE__*/_react["default"].createElement(_Popup2.StyledPortalContainer, {
|
283
|
-
ref: portalRef
|
284
|
-
}, portalRef.current && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
|
285
|
-
container: portalRef.current
|
286
|
-
}, rootNode)), containerElement));
|
287
|
-
}
|
288
|
-
var globalPortal = typeof document !== 'undefined' && document.getElementById(_PopupContext.POPUP_PORTAL_ID);
|
289
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, globalPortal && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
|
290
|
-
container: globalPortal
|
291
|
-
}, rootNode));
|
173
|
+
}, children))));
|
292
174
|
});
|
293
175
|
};
|
294
176
|
var popupConfig = exports.popupConfig = {
|
@@ -3,35 +3,15 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.StyledPortal = exports.PopupView = exports.PopupRootContainer = void 0;
|
7
7
|
var _base = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@emotion/styled/base"));
|
8
8
|
var _utils = /*#__PURE__*/require("./utils");
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10
10
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
11
11
|
var StyledPortal = exports.StyledPortal = /*#__PURE__*/(0, _base["default"])("div", {
|
12
|
-
target: "eaqy7mk3",
|
13
|
-
label: "plasma-new-hope__StyledPortal"
|
14
|
-
})(process.env.NODE_ENV === "production" ? {
|
15
|
-
name: "14er37y",
|
16
|
-
styles: "position:fixed;top:0;left:0;right:0;bottom:0;:empty{width:0;pointer-events:none;}:not(:empty){width:auto;pointer-events:auto;}"
|
17
|
-
} : {
|
18
|
-
name: "14er37y",
|
19
|
-
styles: "position:fixed;top:0;left:0;right:0;bottom:0;:empty{width:0;pointer-events:none;}:not(:empty){width:auto;pointer-events:auto;}",
|
20
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtzQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1BvcHVwL1BvcHVwLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IHR5cGUgeyBQb3B1cFJvb3RDb250YWluZXJQcm9wcyB9IGZyb20gJy4vUG9wdXAudHlwZXMnO1xuaW1wb3J0IHsgREVGQVVMVF9aX0lOREVYIH0gZnJvbSAnLi91dGlscyc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWwgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiBmaXhlZDtcbiAgICB0b3A6IDA7XG4gICAgbGVmdDogMDtcbiAgICByaWdodDogMDtcbiAgICBib3R0b206IDA7XG5cbiAgICA6ZW1wdHkge1xuICAgICAgICB3aWR0aDogMDtcbiAgICAgICAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gICAgfVxuXG4gICAgOm5vdCg6ZW1wdHkpIHtcbiAgICAgICAgd2lkdGg6IGF1dG87XG4gICAgICAgIHBvaW50ZXItZXZlbnRzOiBhdXRvO1xuICAgIH1cbmA7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWxDb250YWluZXIgPSBzdHlsZWQuZGl2YFxuICAgIHdpZHRoOiAwO1xuYDtcblxuZXhwb3J0IGNvbnN0IFBvcHVwVmlldyA9IHN0eWxlZC5kaXZgXG4gICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgIG1heC13aWR0aDogMTAwJTtcbiAgICBwb2ludGVyLWV2ZW50czogYWxsO1xuYDtcblxuZXhwb3J0IGNvbnN0IFBvcHVwUm9vdENvbnRhaW5lciA9IHN0eWxlZC5kaXY8UG9wdXBSb290Q29udGFpbmVyUHJvcHM+YFxuICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB6LWluZGV4OiAkeyh7IHpJbmRleCB9KSA9PiB6SW5kZXggfHwgREVGQVVMVF9aX0lOREVYfTtcbiAgICBsZWZ0OiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmxlZnQgfHwgJyd9O1xuICAgIHJpZ2h0OiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnJpZ2h0IHx8ICcnfTtcbiAgICB0b3A6ICR7KHsgcG9zaXRpb24gfSkgPT4gcG9zaXRpb24udG9wIHx8ICcnfTtcbiAgICBib3R0b206ICR7KHsgcG9zaXRpb24gfSkgPT4gcG9zaXRpb24uYm90dG9tIHx8ICcnfTtcbiAgICB0cmFuc2Zvcm06ICR7KHsgcG9zaXRpb24gfSkgPT4gcG9zaXRpb24udHJhbnNmb3JtIHx8ICcnfTtcbmA7XG4iXX0= */",
|
21
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
22
|
-
});
|
23
|
-
var StyledPortalContainer = exports.StyledPortalContainer = /*#__PURE__*/(0, _base["default"])("div", {
|
24
12
|
target: "eaqy7mk2",
|
25
|
-
label: "plasma-new-
|
26
|
-
})(process.env.NODE_ENV === "production" ?
|
27
|
-
name: "k2uqvh",
|
28
|
-
styles: "width:0"
|
29
|
-
} : {
|
30
|
-
name: "k2uqvh",
|
31
|
-
styles: "width:0",
|
32
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXVCK0MiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjLWVtb3Rpb24vY29tcG9uZW50cy9Qb3B1cC9Qb3B1cC5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmltcG9ydCB0eXBlIHsgUG9wdXBSb290Q29udGFpbmVyUHJvcHMgfSBmcm9tICcuL1BvcHVwLnR5cGVzJztcbmltcG9ydCB7IERFRkFVTFRfWl9JTkRFWCB9IGZyb20gJy4vdXRpbHMnO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUG9ydGFsID0gc3R5bGVkLmRpdmBcbiAgICBwb3NpdGlvbjogZml4ZWQ7XG4gICAgdG9wOiAwO1xuICAgIGxlZnQ6IDA7XG4gICAgcmlnaHQ6IDA7XG4gICAgYm90dG9tOiAwO1xuXG4gICAgOmVtcHR5IHtcbiAgICAgICAgd2lkdGg6IDA7XG4gICAgICAgIHBvaW50ZXItZXZlbnRzOiBub25lO1xuICAgIH1cblxuICAgIDpub3QoOmVtcHR5KSB7XG4gICAgICAgIHdpZHRoOiBhdXRvO1xuICAgICAgICBwb2ludGVyLWV2ZW50czogYXV0bztcbiAgICB9XG5gO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUG9ydGFsQ29udGFpbmVyID0gc3R5bGVkLmRpdmBcbiAgICB3aWR0aDogMDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5sZWZ0IHx8ICcnfTtcbiAgICByaWdodDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5yaWdodCB8fCAnJ307XG4gICAgdG9wOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRvcCB8fCAnJ307XG4gICAgYm90dG9tOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmJvdHRvbSB8fCAnJ307XG4gICAgdHJhbnNmb3JtOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRyYW5zZm9ybSB8fCAnJ307XG5gO1xuIl19 */",
|
33
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
34
|
-
});
|
13
|
+
label: "plasma-new-hope__StyledPortal"
|
14
|
+
})(process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtzQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1BvcHVwL1BvcHVwLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IHR5cGUgeyBQb3B1cFJvb3RDb250YWluZXJQcm9wcyB9IGZyb20gJy4vUG9wdXAudHlwZXMnO1xuaW1wb3J0IHsgREVGQVVMVF9aX0lOREVYIH0gZnJvbSAnLi91dGlscyc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWwgPSBzdHlsZWQuZGl2YGA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5sZWZ0IHx8ICcnfTtcbiAgICByaWdodDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5yaWdodCB8fCAnJ307XG4gICAgdG9wOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRvcCB8fCAnJ307XG4gICAgYm90dG9tOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmJvdHRvbSB8fCAnJ307XG4gICAgdHJhbnNmb3JtOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRyYW5zZm9ybSB8fCAnJ307XG5gO1xuIl19 */");
|
35
15
|
var PopupView = exports.PopupView = /*#__PURE__*/(0, _base["default"])("div", {
|
36
16
|
target: "eaqy7mk1",
|
37
17
|
label: "plasma-new-hope__PopupView"
|
@@ -41,7 +21,7 @@ var PopupView = exports.PopupView = /*#__PURE__*/(0, _base["default"])("div", {
|
|
41
21
|
} : {
|
42
22
|
name: "1m82nn4",
|
43
23
|
styles: "position:relative;max-width:100%;pointer-events:all",
|
44
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
24
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9tQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1BvcHVwL1BvcHVwLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IHR5cGUgeyBQb3B1cFJvb3RDb250YWluZXJQcm9wcyB9IGZyb20gJy4vUG9wdXAudHlwZXMnO1xuaW1wb3J0IHsgREVGQVVMVF9aX0lOREVYIH0gZnJvbSAnLi91dGlscyc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWwgPSBzdHlsZWQuZGl2YGA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5sZWZ0IHx8ICcnfTtcbiAgICByaWdodDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5yaWdodCB8fCAnJ307XG4gICAgdG9wOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRvcCB8fCAnJ307XG4gICAgYm90dG9tOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmJvdHRvbSB8fCAnJ307XG4gICAgdHJhbnNmb3JtOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRyYW5zZm9ybSB8fCAnJ307XG5gO1xuIl19 */",
|
45
25
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
46
26
|
});
|
47
27
|
var PopupRootContainer = exports.PopupRootContainer = /*#__PURE__*/(0, _base["default"])("div", {
|
@@ -65,4 +45,4 @@ var PopupRootContainer = exports.PopupRootContainer = /*#__PURE__*/(0, _base["de
|
|
65
45
|
}, ";transform:", function (_ref6) {
|
66
46
|
var position = _ref6.position;
|
67
47
|
return position.transform || '';
|
68
|
-
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
48
|
+
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWFxRSIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1BvcHVwL1BvcHVwLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IHR5cGUgeyBQb3B1cFJvb3RDb250YWluZXJQcm9wcyB9IGZyb20gJy4vUG9wdXAudHlwZXMnO1xuaW1wb3J0IHsgREVGQVVMVF9aX0lOREVYIH0gZnJvbSAnLi91dGlscyc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWwgPSBzdHlsZWQuZGl2YGA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5sZWZ0IHx8ICcnfTtcbiAgICByaWdodDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5yaWdodCB8fCAnJ307XG4gICAgdG9wOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRvcCB8fCAnJ307XG4gICAgYm90dG9tOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmJvdHRvbSB8fCAnJ307XG4gICAgdHJhbnNmb3JtOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRyYW5zZm9ybSB8fCAnJ307XG5gO1xuIl19 */"));
|
@@ -6,11 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.usePopupContext = exports.PopupProvider = exports.POPUP_PORTAL_ID = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
-
var _reactDom = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react-dom"));
|
10
9
|
var _ModalContext = /*#__PURE__*/require("../Modal/ModalContext");
|
11
|
-
var _Popup = /*#__PURE__*/require("./Popup.styles");
|
12
|
-
var _StyledPortal;
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
14
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
15
11
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
16
12
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -27,11 +23,9 @@ var POPUP_PORTAL_ID = exports.POPUP_PORTAL_ID = 'plasma-popup-root';
|
|
27
23
|
var items = [];
|
28
24
|
var PopupContext = /*#__PURE__*/(0, _react.createContext)({
|
29
25
|
items: items,
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
31
26
|
register: function register(_info) {
|
32
27
|
throw new Error('Function not implemented. Add PopupProvider');
|
33
28
|
},
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
35
29
|
unregister: function unregister(_id) {
|
36
30
|
throw new Error('Function not implemented. Add PopupProvider');
|
37
31
|
}
|
@@ -42,7 +36,6 @@ var usePopupContext = exports.usePopupContext = function usePopupContext() {
|
|
42
36
|
var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
|
43
37
|
var children = _ref.children;
|
44
38
|
var prevBodyOverflowY = (0, _react.useRef)(typeof document !== 'undefined' ? document.body.style.overflowY : '');
|
45
|
-
// eslint-disable-next-line no-shadow
|
46
39
|
var _useState = (0, _react.useState)([]),
|
47
40
|
_useState2 = _slicedToArray(_useState, 2),
|
48
41
|
items = _useState2[0],
|
@@ -80,9 +73,15 @@ var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
|
|
80
73
|
register: register,
|
81
74
|
unregister: unregister
|
82
75
|
};
|
76
|
+
(0, _react.useEffect)(function () {
|
77
|
+
return function () {
|
78
|
+
var portal = document.createElement('div');
|
79
|
+
if (portal && document.body.contains(portal)) {
|
80
|
+
document.body.removeChild(portal);
|
81
|
+
}
|
82
|
+
};
|
83
|
+
}, []);
|
83
84
|
return /*#__PURE__*/_react["default"].createElement(PopupContext.Provider, {
|
84
85
|
value: context
|
85
|
-
}, children
|
86
|
-
id: POPUP_PORTAL_ID
|
87
|
-
})), document.body));
|
86
|
+
}, children);
|
88
87
|
};
|
@@ -18,7 +18,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
18
18
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
19
19
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
20
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
21
|
-
// Хук для
|
21
|
+
// Хук для поключения анимации
|
22
22
|
var usePopupAnimation = function usePopupAnimation() {
|
23
23
|
var _useState = (0, _react.useState)(false),
|
24
24
|
_useState2 = _slicedToArray(_useState, 2),
|