kui-complex 0.0.49 → 0.0.51
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/DesktopInputWithMonthPicker/cjs/index.js +5 -8
- package/DesktopInputWithMonthPicker/cjs/index.js.map +1 -1
- package/DesktopInputWithMonthPicker/cjs/package.json +1 -2
- package/DesktopInputWithMonthPicker/index.js +6 -8
- package/DesktopInputWithMonthPicker/index.js.map +1 -1
- package/DesktopInputWithMonthPicker/package.json +1 -2
- package/InputForDatepicker/cjs/index.js +5 -8
- package/InputForDatepicker/cjs/index.js.map +1 -1
- package/InputForDatepicker/cjs/package.json +1 -2
- package/InputForDatepicker/index.js +6 -8
- package/InputForDatepicker/index.js.map +1 -1
- package/InputForDatepicker/package.json +1 -2
- package/InputPassword/cjs/index.js +8 -56
- package/InputPassword/cjs/index.js.map +1 -1
- package/InputPassword/index.js +1 -31
- package/InputPassword/index.js.map +1 -1
- package/InputPhoneWithForm/cjs/index.js +53 -17
- package/InputPhoneWithForm/cjs/index.js.map +1 -1
- package/InputPhoneWithForm/index.js +33 -16
- package/InputPhoneWithForm/index.js.map +1 -1
- package/InputTextAreaMobile/cjs/index.js +4 -52
- package/InputTextAreaMobile/cjs/index.js.map +1 -1
- package/InputTextAreaMobile/index.js +1 -31
- package/InputTextAreaMobile/index.js.map +1 -1
- package/InputWithController/cjs/index.js +3 -52
- package/InputWithController/cjs/index.js.map +1 -1
- package/InputWithController/index.d.ts +1 -1
- package/InputWithController/index.js +1 -31
- package/InputWithController/index.js.map +1 -1
- package/InputWithDatePicker/cjs/index.js +75 -41
- package/InputWithDatePicker/cjs/index.js.map +1 -1
- package/InputWithDatePicker/cjs/package.json +1 -2
- package/InputWithDatePicker/index.js +34 -17
- package/InputWithDatePicker/index.js.map +1 -1
- package/InputWithDatePicker/package.json +1 -2
- package/InputWithMask/cjs/index.js +1 -9
- package/InputWithMask/cjs/index.js.map +1 -1
- package/InputWithMask/index.js +1 -9
- package/InputWithMask/index.js.map +1 -1
- package/InputWithMonthPicker/cjs/index.js +5 -8
- package/InputWithMonthPicker/cjs/index.js.map +1 -1
- package/InputWithMonthPicker/cjs/package.json +1 -2
- package/InputWithMonthPicker/index.js +6 -8
- package/InputWithMonthPicker/index.js.map +1 -1
- package/InputWithMonthPicker/package.json +1 -2
- package/MobileInputWithMonthPicker/cjs/index.js +5 -8
- package/MobileInputWithMonthPicker/cjs/index.js.map +1 -1
- package/MobileInputWithMonthPicker/cjs/package.json +1 -2
- package/MobileInputWithMonthPicker/index.js +6 -8
- package/MobileInputWithMonthPicker/index.js.map +1 -1
- package/MobileInputWithMonthPicker/package.json +1 -2
- package/TestForm/cjs/index.js +40 -71
- package/TestForm/cjs/index.js.map +1 -1
- package/TestForm/cjs/package.json +0 -1
- package/TestForm/index.js +41 -71
- package/TestForm/index.js.map +1 -1
- package/TestForm/package.json +0 -1
- package/cjs/index.js +40 -71
- package/cjs/index.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +41 -71
- package/index.js.map +1 -1
- package/package.json +1 -1
package/TestForm/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as yup from 'yup';
|
|
|
4
4
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { forwardRef, useRef, useEffect, useState } from 'react';
|
|
7
|
-
import { InputWithAdornments, Grid, theme, Caption, Divider, Button, Modal, IconButton, InputWithCountryDropdown, Switch as Switch$1, LinearProgress
|
|
7
|
+
import { InputWithAdornments, Grid, theme, Caption, InputWithMask as InputWithMask$1, Divider, Button, Modal, IconButton, InputWithCountryDropdown, Switch as Switch$1, LinearProgress } from 'kui-basic';
|
|
8
8
|
import { jsx as jsx$1, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import { HalfArrowIcon, CalendarIcon, CheckIcon, ArrowBackIcon, ArrowNextIcon, ClosedEyeIcon, OpenEyeIcon } from 'kui-icon';
|
|
@@ -12,7 +12,6 @@ import { css } from '@emotion/react';
|
|
|
12
12
|
import DatePicker from 'react-datepicker';
|
|
13
13
|
import { DateTime } from 'luxon';
|
|
14
14
|
import _ from 'lodash';
|
|
15
|
-
import InputMask from 'react-input-mask';
|
|
16
15
|
import ru from 'date-fns/locale/ru';
|
|
17
16
|
|
|
18
17
|
/******************************************************************************
|
|
@@ -58,31 +57,6 @@ function __makeTemplateObject(cooked, raw) {
|
|
|
58
57
|
return cooked;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
function setRef(ref, value) {
|
|
62
|
-
if (typeof ref === "function") {
|
|
63
|
-
ref(value);
|
|
64
|
-
}
|
|
65
|
-
else if (ref) {
|
|
66
|
-
ref.current = value;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function useForkRef() {
|
|
70
|
-
var refs = [];
|
|
71
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
72
|
-
refs[_i] = arguments[_i];
|
|
73
|
-
}
|
|
74
|
-
return React.useMemo(function () {
|
|
75
|
-
if (refs.every(function (ref) { return ref == null; })) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
return function (instance) {
|
|
79
|
-
refs.forEach(function (ref) {
|
|
80
|
-
setRef(ref, instance);
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
}, refs);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
60
|
var InputWithController = forwardRef(function (_a, ref) {
|
|
87
61
|
var form = _a.form, name = _a.name, error = _a.error, value = _a.value, inputProps = __rest(_a, ["form", "name", "error", "value"]);
|
|
88
62
|
var handleChange = function (e, field) {
|
|
@@ -91,10 +65,6 @@ var InputWithController = forwardRef(function (_a, ref) {
|
|
|
91
65
|
inputProps.onChange(e);
|
|
92
66
|
}
|
|
93
67
|
};
|
|
94
|
-
var forwardedRef = function (elem, field) {
|
|
95
|
-
useForkRef(ref);
|
|
96
|
-
field.ref(elem);
|
|
97
|
-
};
|
|
98
68
|
var getError = function (fieldState) {
|
|
99
69
|
var _a;
|
|
100
70
|
return typeof error !== "undefined" && String(error).length > 0
|
|
@@ -105,7 +75,7 @@ var InputWithController = forwardRef(function (_a, ref) {
|
|
|
105
75
|
var field = _a.field, fieldState = _a.fieldState;
|
|
106
76
|
return (jsx(InputWithAdornments, __assign({ message: getError(fieldState) }, field, inputProps, { onChange: function (e) {
|
|
107
77
|
return handleChange(e, field);
|
|
108
|
-
}, value: typeof value !== "undefined" ? value : field.value || "",
|
|
78
|
+
}, value: typeof value !== "undefined" ? value : field.value || "", inputRef: ref })));
|
|
109
79
|
} }));
|
|
110
80
|
});
|
|
111
81
|
|
|
@@ -255,19 +225,18 @@ var Wrapper$4 = styled.div(templateObject_1$b || (templateObject_1$b = __makeTem
|
|
|
255
225
|
var StyledInput = styled(InputWithAdornments)(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n cursor: pointer;\n input,\n label {\n cursor: pointer !important;\n }\n"], ["\n cursor: pointer;\n input,\n label {\n cursor: pointer !important;\n }\n"])));
|
|
256
226
|
var templateObject_1$b, templateObject_2$5;
|
|
257
227
|
|
|
258
|
-
var InputForDatepicker = forwardRef(function (
|
|
259
|
-
var onClick =
|
|
260
|
-
var onChange = props.onChange, readOnly = props.readOnly, disabled = props.disabled, mask = props.mask, handleCLick = props.handleCLick, startIcon = props.startIcon, other = __rest(props, ["onChange", "readOnly", "disabled", "mask", "handleCLick", "startIcon"]);
|
|
228
|
+
var InputForDatepicker = forwardRef(function (props, ref) {
|
|
229
|
+
var onClick = props.onClick, disabled = props.disabled, handleClick = props.handleClick, startIcon = props.startIcon, other = __rest(props, ["onClick", "disabled", "handleClick", "startIcon"]);
|
|
261
230
|
var handleIconClick = function () {
|
|
262
|
-
if (
|
|
263
|
-
|
|
231
|
+
if (handleClick) {
|
|
232
|
+
handleClick();
|
|
264
233
|
}
|
|
265
234
|
else {
|
|
266
235
|
onClick();
|
|
267
236
|
}
|
|
268
237
|
};
|
|
269
238
|
var Icon = function () { return (jsx(IconWrapper, __assign({ disabled: disabled, onClick: handleIconClick }, { children: startIcon || jsx(CalendarIcon, { width: 19, height: 21 }) }))); };
|
|
270
|
-
return (jsx(
|
|
239
|
+
return (jsx(InputWithMask$1, __assign({ disabled: disabled, endIcon: !startIcon && jsx(Icon, {}), startIcon: startIcon && jsx(Icon, {}) }, other, { ref: ref })));
|
|
271
240
|
});
|
|
272
241
|
var IconWrapper = styled.div(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n display: flex;\n align-items: center;\n cursor: pointer;\n z-index: 1;\n"], ["\n display: flex;\n align-items: center;\n cursor: pointer;\n z-index: 1;\n"])));
|
|
273
242
|
var templateObject_1$a;
|
|
@@ -347,6 +316,31 @@ var CalendarStandardContainer = forwardRef(function (_a, ref) {
|
|
|
347
316
|
var DatePickerContainer = styled.div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n padding: 0;\n border: none !important;\n border-radius: 0 !important;\n background: transparent !important;\n overflow: hidden;\n width: 100%;\n height: 100%;\n .react-datepicker__header {\n background-color: transparent !important;\n }\n .react-datepicker__month-container {\n width: 100%;\n height: 100%;\n }\n .react-datepicker__day-names {\n display: flex;\n justify-content: space-between;\n .react-datepicker__day-name {\n font-family: \"Inter\", sans-serif;\n font-weight: 600;\n font-size: 14px;\n color: ", ";\n text-transform: uppercase;\n margin: 0;\n width: 33px;\n line-height: normal;\n }\n }\n .react-datepicker__month {\n padding: 0;\n margin: 20px 0 0 !important;\n border: none;\n width: 100%;\n height: calc(100% - 85px);\n .react-datepicker__week {\n display: flex;\n justify-content: space-between;\n }\n }\n .react-datepicker__week {\n margin-bottom: 10px;\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n .react-datepicker__day {\n width: 33px;\n height: 33px;\n user-select: none;\n border-radius: 50% !important;\n transition: background ease-out 0.3s;\n border: 1px solid transparent;\n margin: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 500;\n font-size: 16px;\n &:hover {\n background: ", ";\n }\n &:active {\n background: ", ";\n }\n }\n .react-datepicker__day--outside-month,\n .react-datepicker__day--disabled {\n color: #a6aebc;\n p {\n color: #a6aebc;\n }\n }\n .react-datepicker__day--keyboard-selected {\n background: transparent;\n color: inherit;\n }\n .react-datepicker__day--selected {\n background: white;\n border: 1px solid #e1e4e8;\n color: ", ";\n p {\n color: ", ";\n }\n }\n .react-datepicker__day--selected.warning_day {\n border-color: ", ";\n background-color: ", ";\n color: ", ";\n }\n @media (max-width: 600px) {\n .react-datepicker__day {\n max-width: 48px;\n max-height: 48px;\n width: calc((100vw - (18px * 7)) / 7);\n height: calc((100vw - (18px * 7)) / 7);\n }\n .react-datepicker__day-names {\n .react-datepicker__day-name {\n max-width: 48px;\n width: calc((100vw - (18px * 7)) / 7);\n }\n }\n }\n @media (max-width: 350px) {\n .react-datepicker__day {\n width: calc((100vw - (6px * 7)) / 7);\n height: calc((100vw - (6px * 7)) / 7);\n }\n .react-datepicker__day-names {\n .react-datepicker__day-name {\n width: calc((100vw - (6px * 7)) / 7);\n }\n }\n }\n"], ["\n padding: 0;\n border: none !important;\n border-radius: 0 !important;\n background: transparent !important;\n overflow: hidden;\n width: 100%;\n height: 100%;\n .react-datepicker__header {\n background-color: transparent !important;\n }\n .react-datepicker__month-container {\n width: 100%;\n height: 100%;\n }\n .react-datepicker__day-names {\n display: flex;\n justify-content: space-between;\n .react-datepicker__day-name {\n font-family: \"Inter\", sans-serif;\n font-weight: 600;\n font-size: 14px;\n color: ", ";\n text-transform: uppercase;\n margin: 0;\n width: 33px;\n line-height: normal;\n }\n }\n .react-datepicker__month {\n padding: 0;\n margin: 20px 0 0 !important;\n border: none;\n width: 100%;\n height: calc(100% - 85px);\n .react-datepicker__week {\n display: flex;\n justify-content: space-between;\n }\n }\n .react-datepicker__week {\n margin-bottom: 10px;\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n .react-datepicker__day {\n width: 33px;\n height: 33px;\n user-select: none;\n border-radius: 50% !important;\n transition: background ease-out 0.3s;\n border: 1px solid transparent;\n margin: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 500;\n font-size: 16px;\n &:hover {\n background: ", ";\n }\n &:active {\n background: ", ";\n }\n }\n .react-datepicker__day--outside-month,\n .react-datepicker__day--disabled {\n color: #a6aebc;\n p {\n color: #a6aebc;\n }\n }\n .react-datepicker__day--keyboard-selected {\n background: transparent;\n color: inherit;\n }\n .react-datepicker__day--selected {\n background: white;\n border: 1px solid #e1e4e8;\n color: ", ";\n p {\n color: ", ";\n }\n }\n .react-datepicker__day--selected.warning_day {\n border-color: ", ";\n background-color: ", ";\n color: ", ";\n }\n @media (max-width: 600px) {\n .react-datepicker__day {\n max-width: 48px;\n max-height: 48px;\n width: calc((100vw - (18px * 7)) / 7);\n height: calc((100vw - (18px * 7)) / 7);\n }\n .react-datepicker__day-names {\n .react-datepicker__day-name {\n max-width: 48px;\n width: calc((100vw - (18px * 7)) / 7);\n }\n }\n }\n @media (max-width: 350px) {\n .react-datepicker__day {\n width: calc((100vw - (6px * 7)) / 7);\n height: calc((100vw - (6px * 7)) / 7);\n }\n .react-datepicker__day-names {\n .react-datepicker__day-name {\n width: calc((100vw - (6px * 7)) / 7);\n }\n }\n }\n"])), theme.palette.grey.fiftyP, theme.palette.background.light3, theme.palette.background.light3, theme.palette.brand.main, theme.palette.brand.main, theme.palette.grey.fifteenB, theme.palette.red.seventy, theme.palette.grey.zero);
|
|
348
317
|
var templateObject_1$7;
|
|
349
318
|
|
|
319
|
+
function setRef(ref, value) {
|
|
320
|
+
if (typeof ref === "function") {
|
|
321
|
+
ref(value);
|
|
322
|
+
}
|
|
323
|
+
else if (ref) {
|
|
324
|
+
ref.current = value;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function useForkRef() {
|
|
328
|
+
var refs = [];
|
|
329
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
330
|
+
refs[_i] = arguments[_i];
|
|
331
|
+
}
|
|
332
|
+
return React.useMemo(function () {
|
|
333
|
+
if (refs.every(function (ref) { return ref == null; })) {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
return function (instance) {
|
|
337
|
+
refs.forEach(function (ref) {
|
|
338
|
+
setRef(ref, instance);
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
}, refs);
|
|
342
|
+
}
|
|
343
|
+
|
|
350
344
|
var generateYearRange = function (offsetFromCurrent, maxYearCount) {
|
|
351
345
|
if (!offsetFromCurrent || !maxYearCount)
|
|
352
346
|
return [];
|
|
@@ -414,15 +408,8 @@ var InputWithDatePicker = forwardRef(function (_a, ref) {
|
|
|
414
408
|
var handleDateChange = function (newDate) {
|
|
415
409
|
setDate(newDate);
|
|
416
410
|
};
|
|
417
|
-
var forwardedRef =
|
|
418
|
-
|
|
419
|
-
// eslint-disable-next-line no-param-reassign
|
|
420
|
-
// @ts-ignore
|
|
421
|
-
ref.current = elem;
|
|
422
|
-
}
|
|
423
|
-
field.ref(elem);
|
|
424
|
-
};
|
|
425
|
-
return (jsxs(Fragment, { children: [jsx$1(InputForDatepicker, __assign({ mask: "99.99.9999", name: name, handleCLick: handleModalOpen, value: formattedValue || value, onChange: handleChange, disabled: disabled, message: error, ref: forwardedRef }, props)), jsxs(StyledModal, __assign({ title: title, description: description, isOpen: isModalOpen, handleClose: handleModalClose, alignTitle: alignTitle }, { children: [jsx$1(ContentWrapper$1, { children: jsx$1(DatePicker, __assign({ inline: true, selected: date || formattedDate, onChange: handleDateChange, calendarContainer: StyledCalendarStandardContainer, renderCustomHeader: function (headProps) { return (jsx$1(CalendarHeaderWithSelect, __assign({ yearOptions: yearList, max: max, min: min }, headProps))); }, renderDayContents: function (day) { return (jsx$1(DayContent, { children: day })); }, maxDate: max === null || max === void 0 ? void 0 : max.toJSDate(), minDate: min === null || min === void 0 ? void 0 : min.toJSDate() }, datePickerProps)) }), jsx$1(ModalFooter, { fullWidth: true, disabled: !formattedDate && !date, onClick: acceptWithDateSelected, label: footerLabel })] }))] }));
|
|
411
|
+
var forwardedRef = useForkRef(ref, field.ref);
|
|
412
|
+
return (jsxs(Fragment, { children: [jsx$1(InputForDatepicker, __assign({ mask: "00.00.0000", name: name, handleClick: handleModalOpen, value: formattedValue || value, onChange: handleChange, disabled: disabled, message: error, ref: forwardedRef }, props)), jsxs(StyledModal, __assign({ title: title, description: description, isOpen: isModalOpen, handleClose: handleModalClose, alignTitle: alignTitle }, { children: [jsx$1(ContentWrapper$1, { children: jsx$1(DatePicker, __assign({ inline: true, selected: date || formattedDate, onChange: handleDateChange, calendarContainer: StyledCalendarStandardContainer, renderCustomHeader: function (headProps) { return (jsx$1(CalendarHeaderWithSelect, __assign({ yearOptions: yearList, max: max, min: min }, headProps))); }, renderDayContents: function (day) { return (jsx$1(DayContent, { children: day })); }, maxDate: max === null || max === void 0 ? void 0 : max.toJSDate(), minDate: min === null || min === void 0 ? void 0 : min.toJSDate() }, datePickerProps)) }), jsx$1(ModalFooter, { fullWidth: true, disabled: !formattedDate && !date, onClick: acceptWithDateSelected, label: footerLabel })] }))] }));
|
|
426
413
|
});
|
|
427
414
|
InputWithDatePicker.defaultProps = {
|
|
428
415
|
title: "Дата рождения",
|
|
@@ -556,29 +543,20 @@ var InputPhoneWithForm = forwardRef(function (props, ref) {
|
|
|
556
543
|
};
|
|
557
544
|
var handleChange = function (e) {
|
|
558
545
|
phoneRegister.field.onChange(e);
|
|
559
|
-
if (other.onChange) {
|
|
560
|
-
other.onChange(e);
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
var forwardedRef = function (elem) {
|
|
564
|
-
if (ref) {
|
|
565
|
-
// eslint-disable-next-line no-param-reassign
|
|
566
|
-
// @ts-ignore
|
|
567
|
-
ref.current = elem;
|
|
568
|
-
}
|
|
569
|
-
phoneRegister.field.ref(elem);
|
|
570
|
-
};
|
|
571
|
-
useEffect(function () {
|
|
572
546
|
if (!codeRegister.field.value) {
|
|
573
547
|
codeRegister.field.onChange({
|
|
574
548
|
target: { value: "7", name: "".concat(name, ".phoneCode") },
|
|
575
549
|
type: "change",
|
|
576
550
|
});
|
|
577
551
|
}
|
|
578
|
-
|
|
552
|
+
if (other.onChange) {
|
|
553
|
+
other.onChange(e);
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
var forwardedRef = useForkRef(ref, phoneRegister.field.ref);
|
|
579
557
|
return (jsx(InputWithCountryDropdown, __assign({ message: errorMessage,
|
|
580
558
|
// @ts-ignore
|
|
581
|
-
hiddenInputProps: __assign(__assign(
|
|
559
|
+
hiddenInputProps: __assign(__assign({}, codeRegister.field), hiddenInputProps), onSelectCountry: handleCountryChange }, phoneRegister.field, other, { onChange: handleChange, ref: forwardedRef, autoComplete: "false" })));
|
|
582
560
|
});
|
|
583
561
|
InputPhoneWithForm.defaultProps = {
|
|
584
562
|
name: "phone",
|
|
@@ -678,14 +656,6 @@ var InputWithMask = forwardRef(function (_a, ref) {
|
|
|
678
656
|
inputProps.onChange(e);
|
|
679
657
|
}
|
|
680
658
|
};
|
|
681
|
-
var forwardedRef = function (elem, field) {
|
|
682
|
-
if (ref) {
|
|
683
|
-
// eslint-disable-next-line no-param-reassign
|
|
684
|
-
// @ts-ignore
|
|
685
|
-
ref.current = elem;
|
|
686
|
-
}
|
|
687
|
-
field.ref(elem);
|
|
688
|
-
};
|
|
689
659
|
var getError = function (fieldState) {
|
|
690
660
|
var _a;
|
|
691
661
|
return typeof error !== "undefined" && String(error).length > 0
|
|
@@ -696,7 +666,7 @@ var InputWithMask = forwardRef(function (_a, ref) {
|
|
|
696
666
|
var field = _a.field, fieldState = _a.fieldState;
|
|
697
667
|
return (jsx(InputWithMask$1, __assign({ message: getError(fieldState) }, field, inputProps, { onChange: function (e) {
|
|
698
668
|
return handleChange(e, field);
|
|
699
|
-
},
|
|
669
|
+
}, inputRef: ref })));
|
|
700
670
|
} }));
|
|
701
671
|
});
|
|
702
672
|
|