kui-complex 0.0.61 → 0.0.64
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/ButtonSelect/cjs/index.js +65 -99
- package/ButtonSelect/cjs/index.js.map +1 -1
- package/ButtonSelect/index.d.ts +13 -12
- package/ButtonSelect/index.js +67 -101
- package/ButtonSelect/index.js.map +1 -1
- package/CalendarHeaderWithSelect/cjs/index.js +65 -99
- package/CalendarHeaderWithSelect/cjs/index.js.map +1 -1
- package/CalendarHeaderWithSelect/index.d.ts +4 -3
- package/CalendarHeaderWithSelect/index.js +67 -101
- package/CalendarHeaderWithSelect/index.js.map +1 -1
- package/InputDropdown/cjs/index.js +2 -7
- package/InputDropdown/cjs/index.js.map +1 -1
- package/InputDropdown/index.js +2 -7
- package/InputDropdown/index.js.map +1 -1
- package/InputMultiSelect/cjs/index.js +237 -0
- package/InputMultiSelect/cjs/index.js.map +1 -0
- package/InputMultiSelect/cjs/package.json +10 -0
- package/InputMultiSelect/index.d.ts +24 -0
- package/InputMultiSelect/index.js +231 -0
- package/InputMultiSelect/index.js.map +1 -0
- package/InputMultiSelect/package.json +10 -0
- package/InputMultiSelectOption/cjs/index.js +60 -0
- package/InputMultiSelectOption/cjs/index.js.map +1 -0
- package/InputMultiSelectOption/cjs/package.json +9 -0
- package/InputMultiSelectOption/index.d.ts +14 -0
- package/InputMultiSelectOption/index.js +54 -0
- package/InputMultiSelectOption/index.js.map +1 -0
- package/InputMultiSelectOption/package.json +9 -0
- package/InputSelect/cjs/index.js +68 -102
- package/InputSelect/cjs/index.js.map +1 -1
- package/InputSelect/index.d.ts +16 -18
- package/InputSelect/index.js +68 -102
- package/InputSelect/index.js.map +1 -1
- package/InputSelectBase/cjs/index.js +171 -0
- package/InputSelectBase/cjs/index.js.map +1 -0
- package/InputSelectBase/cjs/package.json +9 -0
- package/InputSelectBase/index.d.ts +23 -0
- package/InputSelectBase/index.js +165 -0
- package/InputSelectBase/index.js.map +1 -0
- package/InputSelectBase/package.json +9 -0
- package/InputSelectDropdown/cjs/index.js +19 -41
- package/InputSelectDropdown/cjs/index.js.map +1 -1
- package/InputSelectDropdown/index.d.ts +6 -6
- package/InputSelectDropdown/index.js +20 -42
- package/InputSelectDropdown/index.js.map +1 -1
- package/InputSelectOption/cjs/index.js +53 -0
- package/InputSelectOption/cjs/index.js.map +1 -0
- package/InputSelectOption/cjs/package.json +9 -0
- package/InputSelectOption/index.d.ts +14 -0
- package/InputSelectOption/index.js +47 -0
- package/InputSelectOption/index.js.map +1 -0
- package/InputSelectOption/package.json +9 -0
- package/InputSelectWithController/cjs/index.js +223 -0
- package/InputSelectWithController/cjs/index.js.map +1 -0
- package/InputSelectWithController/cjs/package.json +10 -0
- package/InputSelectWithController/index.d.ts +22 -0
- package/InputSelectWithController/index.js +217 -0
- package/InputSelectWithController/index.js.map +1 -0
- package/InputSelectWithController/package.json +10 -0
- package/InputWithDatePicker/cjs/index.js +67 -101
- package/InputWithDatePicker/cjs/index.js.map +1 -1
- package/InputWithDatePicker/index.js +69 -103
- package/InputWithDatePicker/index.js.map +1 -1
- package/RadioButtons/cjs/index.js +80 -0
- package/RadioButtons/cjs/index.js.map +1 -0
- package/RadioButtons/cjs/package.json +9 -0
- package/RadioButtons/index.d.ts +27 -0
- package/RadioButtons/index.js +78 -0
- package/RadioButtons/index.js.map +1 -0
- package/RadioButtons/package.json +9 -0
- package/RadioButtonsWithController/cjs/index.js +102 -0
- package/RadioButtonsWithController/cjs/index.js.map +1 -0
- package/RadioButtonsWithController/cjs/package.json +10 -0
- package/RadioButtonsWithController/index.d.ts +31 -0
- package/RadioButtonsWithController/index.js +100 -0
- package/RadioButtonsWithController/index.js.map +1 -0
- package/RadioButtonsWithController/package.json +10 -0
- package/RadioGroupWithLabel/cjs/index.js +149 -0
- package/RadioGroupWithLabel/cjs/index.js.map +1 -0
- package/RadioGroupWithLabel/cjs/package.json +10 -0
- package/RadioGroupWithLabel/index.d.ts +34 -0
- package/RadioGroupWithLabel/index.js +143 -0
- package/RadioGroupWithLabel/index.js.map +1 -0
- package/RadioGroupWithLabel/package.json +10 -0
- package/SelectMonth/cjs/index.js +66 -100
- package/SelectMonth/cjs/index.js.map +1 -1
- package/SelectMonth/index.d.ts +13 -12
- package/SelectMonth/index.js +67 -101
- package/SelectMonth/index.js.map +1 -1
- package/SelectYear/cjs/index.js +66 -100
- package/SelectYear/cjs/index.js.map +1 -1
- package/SelectYear/index.d.ts +13 -12
- package/SelectYear/index.js +67 -101
- package/SelectYear/index.js.map +1 -1
- package/TestForm/cjs/index.js +76 -99
- package/TestForm/cjs/index.js.map +1 -1
- package/TestForm/index.js +77 -100
- package/TestForm/index.js.map +1 -1
- package/cjs/index.js +344 -182
- package/cjs/index.js.map +1 -1
- package/index.d.ts +88 -29
- package/index.js +341 -184
- package/index.js.map +1 -1
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { css, Global } from '@emotion/react';
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { forwardRef, useEffect, useState, useRef } from 'react';
|
|
8
8
|
import { jsx, jsxs as jsxs$1, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
9
|
-
import { Caption, theme, Button, Container, Grid, InputWithAdornments, Heading, InputWithMask as InputWithMask$1, IconButton, LinearProgress, Divider, Modal, Switch as Switch$1, InputWithCountryDropdown } from 'kui-basic';
|
|
9
|
+
import { Caption, theme, Button, Container, Grid, InputWithAdornments, Heading, InputWithMask as InputWithMask$1, IconButton, LinearProgress, Divider, Modal, Switch as Switch$1, InputWithCountryDropdown, Checkbox, Radio, InputMessage } from 'kui-basic';
|
|
10
10
|
import { useNavigate } from 'react-router-dom';
|
|
11
11
|
import { DateTime } from 'luxon';
|
|
12
12
|
import { HalfArrowIcon, PrevArrowIcon, NextArrowIcon, CalendarIcon, ArrowBackIcon, ArrowNextIcon, ClosedEyeIcon, OpenEyeIcon, CheckIcon } from 'kui-icon';
|
|
@@ -58,6 +58,16 @@ function __rest(s, e) {
|
|
|
58
58
|
return t;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
function __spreadArray(to, from, pack) {
|
|
62
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
63
|
+
if (ar || !(i in from)) {
|
|
64
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
65
|
+
ar[i] = from[i];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
69
|
+
}
|
|
70
|
+
|
|
61
71
|
function __makeTemplateObject(cooked, raw) {
|
|
62
72
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
63
73
|
return cooked;
|
|
@@ -75,15 +85,15 @@ var UndefinedAvatar = forwardRef(function (_a, ref) {
|
|
|
75
85
|
.join("");
|
|
76
86
|
return (jsx(Wrapper$8, __assign({ "data-testid": "undefined_avatar", ref: ref }, { children: jsx(Caption, __assign({ size: "xs", weight: 600, colorGroup: "brand", color: "main" }, otherProps, { children: formattedLabel })) })));
|
|
77
87
|
});
|
|
78
|
-
var Wrapper$8 = styled.div(templateObject_1$
|
|
79
|
-
var templateObject_1$
|
|
88
|
+
var Wrapper$8 = styled.div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n &,\n p {\n transition: all ease-out 0.3s;\n }\n @media (min-width: 900px) {\n &:hover {\n background-color: ", ";\n p {\n color: white;\n }\n }\n }\n"], ["\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n &,\n p {\n transition: all ease-out 0.3s;\n }\n @media (min-width: 900px) {\n &:hover {\n background-color: ", ";\n p {\n color: white;\n }\n }\n }\n"])), theme.palette.brand.light, theme.palette.brand.main);
|
|
89
|
+
var templateObject_1$x;
|
|
80
90
|
|
|
81
91
|
var Avatar = forwardRef(function (props, ref) {
|
|
82
92
|
var size = props.size, fullName = props.fullName, imageUrl = props.imageUrl, otherProps = __rest(props, ["size", "fullName", "imageUrl"]);
|
|
83
93
|
return (jsx$1(Wrapper$7, __assign({ css: sizeStyles[size], ref: ref }, otherProps, { children: imageUrl ? (jsx$1(StyledImage, { "data-testid": "avatar_image", src: imageUrl, alt: "avatar" })) : (jsx$1(StyledUndefinedAvatar, { label: fullName, avatarSize: size })) })));
|
|
84
94
|
});
|
|
85
|
-
var Wrapper$7 = styled.div(templateObject_1$
|
|
86
|
-
var StyledImage = styled.img(templateObject_2$
|
|
95
|
+
var Wrapper$7 = styled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n border-radius: 50%;\n overflow: hidden;\n cursor: pointer;\n"], ["\n border-radius: 50%;\n overflow: hidden;\n cursor: pointer;\n"])));
|
|
96
|
+
var StyledImage = styled.img(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n border-radius: 50%;\n object-fit: cover;\n"], ["\n width: 100%;\n height: 100%;\n border-radius: 50%;\n object-fit: cover;\n"])));
|
|
87
97
|
var largeAvatarCSS = function (_a) {
|
|
88
98
|
var avatarSize = _a.avatarSize;
|
|
89
99
|
return avatarSize === "lg" && css(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n font-size: 32px;\n "], ["\n font-size: 32px;\n "])));
|
|
@@ -92,10 +102,10 @@ var StyledUndefinedAvatar = styled(UndefinedAvatar, {
|
|
|
92
102
|
shouldForwardProp: function (prop) { return prop !== "size"; },
|
|
93
103
|
})(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), largeAvatarCSS);
|
|
94
104
|
var sizeStyles = {
|
|
95
|
-
s: css(templateObject_5$
|
|
105
|
+
s: css(templateObject_5$2 || (templateObject_5$2 = __makeTemplateObject(["\n width: 40px;\n height: 40px;\n @media (max-width: 600px) {\n width: 32px;\n height: 32px;\n }\n "], ["\n width: 40px;\n height: 40px;\n @media (max-width: 600px) {\n width: 32px;\n height: 32px;\n }\n "]))),
|
|
96
106
|
lg: css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: 80px;\n height: 80px;\n "], ["\n width: 80px;\n height: 80px;\n "]))),
|
|
97
107
|
};
|
|
98
|
-
var templateObject_1$
|
|
108
|
+
var templateObject_1$w, templateObject_2$i, templateObject_3$7, templateObject_4$4, templateObject_5$2, templateObject_6;
|
|
99
109
|
|
|
100
110
|
var ButtonTab = forwardRef(function (_a, ref) {
|
|
101
111
|
var index = _a.index, onClick = _a.onClick, isActive = _a.isActive, label = _a.label;
|
|
@@ -104,9 +114,9 @@ var ButtonTab = forwardRef(function (_a, ref) {
|
|
|
104
114
|
};
|
|
105
115
|
return (jsx$1(StyledButton, __assign({ variant: isActive ? "orange" : "white", captionWeight: isActive ? 600 : 400, onClick: handleClick, css: !isActive && inactiveStyles, size: "s", ref: ref }, { children: label })));
|
|
106
116
|
});
|
|
107
|
-
var StyledButton = styled(Button)(templateObject_1$
|
|
108
|
-
var inactiveStyles = css(templateObject_2$
|
|
109
|
-
var templateObject_1$
|
|
117
|
+
var StyledButton = styled(Button)(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n margin-right: 24px;\n &:last-of-type {\n margin-right: 0;\n }\n"], ["\n margin-right: 24px;\n &:last-of-type {\n margin-right: 0;\n }\n"])));
|
|
118
|
+
var inactiveStyles = css(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\n p {\n color: ", ";\n }\n"], ["\n p {\n color: ", ";\n }\n"])), theme.palette.grey.seventy);
|
|
119
|
+
var templateObject_1$v, templateObject_2$h;
|
|
110
120
|
|
|
111
121
|
var ButtonsPanel = forwardRef(function (_a, ref) {
|
|
112
122
|
var tabs = _a.tabs, tabPanels = _a.tabPanels, paths = _a.paths, activeTab = _a.activeTab, isSticky = _a.isSticky, onChange = _a.onChange, otherProps = __rest(_a, ["tabs", "tabPanels", "paths", "activeTab", "isSticky", "onChange"]);
|
|
@@ -124,14 +134,14 @@ var ButtonsPanel = forwardRef(function (_a, ref) {
|
|
|
124
134
|
useEffect(function () {
|
|
125
135
|
setValue(Number(activeTab));
|
|
126
136
|
}, [activeTab]);
|
|
127
|
-
return (jsxs(Fragment, { children: [jsx$1(StyledContainer$
|
|
137
|
+
return (jsxs(Fragment, { children: [jsx$1(StyledContainer$2, __assign({ css: isSticky && { position: "sticky" }, ref: ref }, otherProps, { children: jsx$1(Container, { children: tabs.map(function (item, index) { return (jsx$1(ButtonTab, { index: index, onClick: handleChange, isActive: index === value, label: item.label }, item.label)); }) }) })), tabPanels.map(function (item, index) { return (jsx$1(Content, __assign({ role: "tabpanel", hidden: value !== index }, { children: value === index && jsx$1(Fragment, { children: item }) }), index)); })] }));
|
|
128
138
|
});
|
|
129
139
|
ButtonsPanel.defaultProps = {
|
|
130
140
|
isSticky: false,
|
|
131
141
|
};
|
|
132
|
-
var Content = styled.div(templateObject_1$
|
|
133
|
-
var StyledContainer$
|
|
134
|
-
var templateObject_1$
|
|
142
|
+
var Content = styled.div(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n height: 100%;\n"], ["\n height: 100%;\n"])));
|
|
143
|
+
var StyledContainer$2 = styled.div(templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\n background: ", ";\n top: 80px;\n z-index: 4;\n padding-top: 16px;\n padding-bottom: 24px;\n @media (max-width: 1200px) {\n padding-bottom: 18px;\n }\n @media (max-width: 600px) {\n top: 48px;\n }\n"], ["\n background: ", ";\n top: 80px;\n z-index: 4;\n padding-top: 16px;\n padding-bottom: 24px;\n @media (max-width: 1200px) {\n padding-bottom: 18px;\n }\n @media (max-width: 600px) {\n top: 48px;\n }\n"])), theme.palette.grey.zero);
|
|
144
|
+
var templateObject_1$u, templateObject_2$g;
|
|
135
145
|
|
|
136
146
|
var InputDropdown = forwardRef(function (props, ref) {
|
|
137
147
|
var isOpen = props.isOpen, handleClose = props.handleClose, buttonRef = props.buttonRef, children = props.children, endComponent = props.endComponent, otherProps = __rest(props, ["isOpen", "handleClose", "buttonRef", "children", "endComponent"]);
|
|
@@ -152,14 +162,11 @@ var InputDropdown = forwardRef(function (props, ref) {
|
|
|
152
162
|
};
|
|
153
163
|
});
|
|
154
164
|
useEffect(function () {
|
|
155
|
-
var _a
|
|
165
|
+
var _a;
|
|
156
166
|
if (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) {
|
|
157
|
-
var inputMessage = (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(".KUI-InputMessage");
|
|
158
167
|
if (isOpen) {
|
|
159
168
|
buttonRef.current.style.zIndex = "4";
|
|
160
|
-
|
|
161
|
-
inputMessage.style.opacity = "0";
|
|
162
|
-
var scrollContainer = (_b = dropdownRef.current) === null || _b === void 0 ? void 0 : _b.children[0].children[0];
|
|
169
|
+
var scrollContainer = (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.children[0].children[0];
|
|
163
170
|
if (scrollContainer) {
|
|
164
171
|
var hasScroll = scrollContainer.scrollHeight > scrollContainer.clientHeight;
|
|
165
172
|
setIsScrollable(hasScroll);
|
|
@@ -167,8 +174,6 @@ var InputDropdown = forwardRef(function (props, ref) {
|
|
|
167
174
|
}
|
|
168
175
|
else {
|
|
169
176
|
buttonRef.current.style.zIndex = "1";
|
|
170
|
-
if (inputMessage)
|
|
171
|
-
inputMessage.style.opacity = "1";
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
179
|
}, [isOpen]);
|
|
@@ -182,13 +187,13 @@ var InputDropdown = forwardRef(function (props, ref) {
|
|
|
182
187
|
ref.current = elem;
|
|
183
188
|
dropdownRef.current = elem;
|
|
184
189
|
};
|
|
185
|
-
return (jsxs$1(StyledDropdown$1, __assign({ "data-testid": "input_dropdown", container: true, ref: forwardedRef, isOpen: isOpen }, otherProps, { children: [jsx(StyledWrapper$
|
|
190
|
+
return (jsxs$1(StyledDropdown$1, __assign({ "data-testid": "input_dropdown", container: true, ref: forwardedRef, isOpen: isOpen }, otherProps, { children: [jsx(StyledWrapper$2, __assign({ isScrollable: isScrollable }, { children: jsx(ScrollingContainer, __assign({ isScrollable: isScrollable, className: "KUI-InputDropdown_scroll" }, { children: children })) })), endComponent] })));
|
|
186
191
|
});
|
|
187
|
-
var StyledDropdown$1 = styled(Grid)(templateObject_1$
|
|
192
|
+
var StyledDropdown$1 = styled(Grid)(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n width: 100%;\n display: ", ";\n position: absolute;\n background: ", ";\n z-index: 3;\n top: 50px;\n box-shadow: 0px 26px 34px 0px #0000001a;\n border-radius: 0 0 8px 8px;\n user-select: none;\n"], ["\n width: 100%;\n display: ", ";\n position: absolute;\n background: ", ";\n z-index: 3;\n top: 50px;\n box-shadow: 0px 26px 34px 0px #0000001a;\n border-radius: 0 0 8px 8px;\n user-select: none;\n"])), function (_a) {
|
|
188
193
|
var isOpen = _a.isOpen;
|
|
189
194
|
return (isOpen ? "flex" : "none");
|
|
190
195
|
}, theme.palette.grey.zero);
|
|
191
|
-
var StyledWrapper$
|
|
196
|
+
var StyledWrapper$2 = styled.div(templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["\n width: 100%;\n box-sizing: border-box;\n padding: ", ";\n"], ["\n width: 100%;\n box-sizing: border-box;\n padding: ", ";\n"])), function (_a) {
|
|
192
197
|
var isScrollable = _a.isScrollable;
|
|
193
198
|
return isScrollable ? "14px 8px 8px 0" : "14px 0px 8px 0";
|
|
194
199
|
});
|
|
@@ -196,116 +201,88 @@ var ScrollingContainer = styled.div(templateObject_3$6 || (templateObject_3$6 =
|
|
|
196
201
|
var isScrollable = _a.isScrollable;
|
|
197
202
|
return (isScrollable ? "4px" : "0px");
|
|
198
203
|
}, theme.palette.grey.fifteenB, theme.palette.grey.thirty);
|
|
199
|
-
var templateObject_1$
|
|
204
|
+
var templateObject_1$t, templateObject_2$f, templateObject_3$6;
|
|
200
205
|
|
|
201
206
|
var InputSelectDropdown = forwardRef(function (_a, ref) {
|
|
202
|
-
var options = _a.options, inputRef = _a.inputRef, isOpenDropdown = _a.isOpenDropdown, handleCloseDropdown = _a.handleCloseDropdown, handleSelect = _a.handleSelect, selectedValue = _a.selectedValue;
|
|
203
|
-
var
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (isOpenDropdown) {
|
|
207
|
-
var element = document.querySelector("[data-value=autocomplete_option_".concat(selectedValue, "]"));
|
|
208
|
-
var coordinates = element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
|
|
209
|
-
if (coordinates && inputRef.current && element) {
|
|
210
|
-
(_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
211
|
-
top: coordinates.top -
|
|
212
|
-
inputRef.current.clientHeight -
|
|
213
|
-
element.clientHeight,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
207
|
+
var options = _a.options, inputRef = _a.inputRef, isOpenDropdown = _a.isOpenDropdown, handleCloseDropdown = _a.handleCloseDropdown, handleSelect = _a.handleSelect, selectedValue = _a.selectedValue, renderOption = _a.renderOption;
|
|
208
|
+
var handleClick = function (option) {
|
|
209
|
+
if (!option.disabled) {
|
|
210
|
+
handleSelect(option);
|
|
216
211
|
}
|
|
217
|
-
}, [isOpenDropdown]);
|
|
218
|
-
var forwardedRef = function (elem) {
|
|
219
|
-
if (ref) {
|
|
220
|
-
if (typeof ref === "function")
|
|
221
|
-
ref(elem);
|
|
222
|
-
else
|
|
223
|
-
ref.current = elem;
|
|
224
|
-
}
|
|
225
|
-
dropdownRef.current = elem;
|
|
226
212
|
};
|
|
227
|
-
return (jsx
|
|
213
|
+
return (jsx(StyledDropdown, __assign({ buttonRef: inputRef, isOpen: isOpenDropdown, handleClose: handleCloseDropdown, ref: ref }, { children: options.map(function (option, key) { return (jsx(OptionWrapper, __assign({ disabled: option.disabled, onClick: function () { return handleClick(option); }, "data-value": "autocomplete_option_".concat(option.value), "data-testid": "autocomplete_option_".concat(key) }, { children: renderOption(option, selectedValue) }), option.label)); }) })));
|
|
228
214
|
});
|
|
229
|
-
var OptionWrapper = styled.div(templateObject_1$
|
|
230
|
-
var
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
names === null || names === void 0 ? void 0 : names.forEach(function (field) {
|
|
239
|
-
if (fieldValue) {
|
|
240
|
-
fieldValue = fieldValue[field];
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
return fieldValue;
|
|
244
|
-
};
|
|
245
|
-
var getFormError = function (name, form) {
|
|
246
|
-
var names = name === null || name === void 0 ? void 0 : name.split(".");
|
|
247
|
-
var fieldError = form === null || form === void 0 ? void 0 : form.formState.errors;
|
|
248
|
-
names === null || names === void 0 ? void 0 : names.forEach(function (field) {
|
|
249
|
-
if (fieldError) {
|
|
250
|
-
// @ts-ignore
|
|
251
|
-
fieldError = fieldError[field];
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
return fieldError === null || fieldError === void 0 ? void 0 : fieldError.message;
|
|
255
|
-
};
|
|
215
|
+
var OptionWrapper = styled.div(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n width: 100%;\n padding: 2px 0;\n cursor: ", ";\n p {\n color: ", ";\n }\n"], ["\n width: 100%;\n padding: 2px 0;\n cursor: ", ";\n p {\n color: ", ";\n }\n"])), function (_a) {
|
|
216
|
+
var disabled = _a.disabled;
|
|
217
|
+
return (disabled ? "auto" : "pointer");
|
|
218
|
+
}, function (_a) {
|
|
219
|
+
var disabled = _a.disabled;
|
|
220
|
+
return disabled ? theme.palette.grey.fiftyP : theme.palette.grey.seventy;
|
|
221
|
+
});
|
|
222
|
+
var StyledDropdown = styled(InputDropdown)(templateObject_2$e || (templateObject_2$e = __makeTemplateObject(["\n .KUI-InputDropdown_scroll {\n max-height: 142px;\n padding: 0 4px;\n }\n"], ["\n .KUI-InputDropdown_scroll {\n max-height: 142px;\n padding: 0 4px;\n }\n"])));
|
|
223
|
+
var templateObject_1$s, templateObject_2$e;
|
|
256
224
|
|
|
257
|
-
|
|
258
|
-
var
|
|
259
|
-
var options =
|
|
260
|
-
var _c = useState(false),
|
|
261
|
-
var _d = useState(defaultValue || getFormValue(name, form)), value = _d[0], setValue = _d[1];
|
|
262
|
-
var error = getFormError(name, form);
|
|
225
|
+
function InputSelectBase(_a) {
|
|
226
|
+
var _b;
|
|
227
|
+
var options = _a.options, name = _a.name, disabled = _a.disabled, handleChange = _a.handleChange, iconProps = _a.iconProps, renderOption = _a.renderOption, selectedLabel = _a.selectedLabel, selectedValue = _a.selectedValue, error = _a.error, inputProps = __rest(_a, ["options", "name", "disabled", "handleChange", "iconProps", "renderOption", "selectedLabel", "selectedValue", "error"]);
|
|
228
|
+
var _c = useState(false), isDropdownOpen = _c[0], setIsDropdownOpen = _c[1];
|
|
263
229
|
var inputRef = useRef(null);
|
|
264
|
-
var selectedLabel = (_a = options === null || options === void 0 ? void 0 : options.find(function (option) { return String(option.value) === String(value); })) === null || _a === void 0 ? void 0 : _a.label;
|
|
265
|
-
var register = form === null || form === void 0 ? void 0 : form.register(name);
|
|
266
230
|
var handleOpenDropdown = function () {
|
|
267
231
|
var _a, _b, _c, _d;
|
|
268
232
|
if ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) {
|
|
269
233
|
(_d = (_c = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _c === void 0 ? void 0 : _c.parentElement) === null || _d === void 0 ? void 0 : _d.parentElement.focus();
|
|
270
234
|
}
|
|
271
|
-
|
|
235
|
+
setIsDropdownOpen(function (prev) { return !prev; });
|
|
272
236
|
};
|
|
273
237
|
var handleCloseDropdown = function () {
|
|
274
|
-
|
|
238
|
+
setIsDropdownOpen(false);
|
|
275
239
|
};
|
|
276
240
|
var handleSelect = function (option) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
handleChange(option.value);
|
|
280
|
-
}
|
|
281
|
-
if (form) {
|
|
282
|
-
register === null || register === void 0 ? void 0 : register.onChange({
|
|
283
|
-
target: { value: option.value, name: name },
|
|
284
|
-
type: "change",
|
|
285
|
-
});
|
|
286
|
-
}
|
|
241
|
+
if (handleChange)
|
|
242
|
+
handleChange(option);
|
|
287
243
|
handleCloseDropdown();
|
|
288
244
|
};
|
|
289
|
-
|
|
290
|
-
if (ref) {
|
|
291
|
-
// eslint-disable-next-line no-param-reassign
|
|
292
|
-
// @ts-ignore
|
|
293
|
-
ref.current = e;
|
|
294
|
-
}
|
|
295
|
-
// @ts-ignore
|
|
296
|
-
inputRef.current = e;
|
|
297
|
-
register === null || register === void 0 ? void 0 : register.ref(e);
|
|
298
|
-
};
|
|
299
|
-
return (jsxs(Wrapper$6, { children: [jsx$1("input", { name: name, autoComplete: "off", hidden: true }), jsx$1(StyledInput, __assign({ onClick: handleOpenDropdown, readOnly: true, value: selectedLabel, message: error }, other, { endIcon: !props.disabled && (jsx$1(HalfArrowIcon, __assign({ width: 12, height: 13, css: [
|
|
245
|
+
return (jsxs(Wrapper$6, { children: [jsx$1("input", { name: name, autoComplete: "off", hidden: true }), jsx$1(StyledInput, __assign({ onClick: handleOpenDropdown, ref: inputRef, disabled: disabled, readOnly: true, value: selectedLabel, message: error, isDropdownOpen: isDropdownOpen, isLabelShrink: Boolean(selectedValue) || selectedValue === 0 }, inputProps, { endIcon: !disabled && (jsx$1(HalfArrowIcon, __assign({ width: 12, height: 13, css: [
|
|
300
246
|
{ transition: "all linear .2s" },
|
|
301
|
-
|
|
302
|
-
] }, iconProps))) }
|
|
247
|
+
isDropdownOpen && { transform: "rotate(180deg)" },
|
|
248
|
+
] }, iconProps))) })), options.length > 0 && !disabled && (jsx$1(InputSelectDropdown, { options: options, inputRef: {
|
|
303
249
|
current: (_b = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _b === void 0 ? void 0 : _b.parentElement,
|
|
304
|
-
}, isOpenDropdown:
|
|
250
|
+
}, isOpenDropdown: isDropdownOpen, handleCloseDropdown: handleCloseDropdown, handleSelect: handleSelect, selectedValue: selectedValue, renderOption: renderOption }))] }));
|
|
251
|
+
}
|
|
252
|
+
var Wrapper$6 = styled.div(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n position: relative;\n text-align: left;\n"], ["\n position: relative;\n text-align: left;\n"])));
|
|
253
|
+
var StyledInput = styled(InputWithAdornments)(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["\n cursor: pointer;\n input,\n label {\n cursor: pointer !important;\n }\n .KUI-InputMessage {\n opacity: ", ";\n }\n"], ["\n cursor: pointer;\n input,\n label {\n cursor: pointer !important;\n }\n .KUI-InputMessage {\n opacity: ", ";\n }\n"])), function (_a) {
|
|
254
|
+
var isDropdownOpen = _a.isDropdownOpen;
|
|
255
|
+
return (isDropdownOpen ? 0 : 1);
|
|
305
256
|
});
|
|
306
|
-
var
|
|
307
|
-
|
|
308
|
-
|
|
257
|
+
var templateObject_1$r, templateObject_2$d;
|
|
258
|
+
|
|
259
|
+
function InputSelectOption(props) {
|
|
260
|
+
var option = props.option, selectedValue = props.selectedValue;
|
|
261
|
+
return (jsx(StyledOption$1, __assign({ selected: selectedValue === option.value }, { children: jsx(Caption, __assign({ size: "sm", weight: 500 }, { children: option.label })) })));
|
|
262
|
+
}
|
|
263
|
+
var StyledOption$1 = styled.div(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n padding: 8px;\n transition: all ease-out 0.3s;\n border-radius: 4px;\n background-color: ", ";\n &:hover {\n background-color: ", ";\n }\n"], ["\n padding: 8px;\n transition: all ease-out 0.3s;\n border-radius: 4px;\n background-color: ", ";\n &:hover {\n background-color: ", ";\n }\n"])), function (_a) {
|
|
264
|
+
var selected = _a.selected;
|
|
265
|
+
return selected ? theme.palette.background.light1 : theme.palette.grey.zero;
|
|
266
|
+
}, theme.palette.background.light1);
|
|
267
|
+
var templateObject_1$q;
|
|
268
|
+
|
|
269
|
+
function InputSelect(_a) {
|
|
270
|
+
var _b;
|
|
271
|
+
var options = _a.options, name = _a.name, handleChange = _a.handleChange; _a.form; var valueProp = _a.value, inputProps = __rest(_a, ["options", "name", "handleChange", "form", "value"]);
|
|
272
|
+
var _c = useState(valueProp), value = _c[0], setValue = _c[1];
|
|
273
|
+
var selectedLabel = (_b = options.find(function (option) { return String(option.value) === String(value); })) === null || _b === void 0 ? void 0 : _b.label;
|
|
274
|
+
var handleSelect = function (option) {
|
|
275
|
+
setValue(option.value);
|
|
276
|
+
if (handleChange) {
|
|
277
|
+
handleChange(option.value);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
useEffect(function () {
|
|
281
|
+
if (typeof valueProp !== "undefined")
|
|
282
|
+
setValue(valueProp);
|
|
283
|
+
}, [valueProp]);
|
|
284
|
+
return (jsx(InputSelectBase, __assign({ options: options, handleChange: handleSelect, selectedLabel: selectedLabel, selectedValue: value, name: name, renderOption: function (option, selectedValue) { return (jsx(InputSelectOption, { option: option, selectedValue: selectedValue })); } }, inputProps)));
|
|
285
|
+
}
|
|
309
286
|
|
|
310
287
|
var checkDisabled$1 = function (year, min, max) {
|
|
311
288
|
return (min && year <= min) || (max && year >= max);
|
|
@@ -346,25 +323,25 @@ var CalendarHeaderWithSelect = forwardRef(function (_a, ref) {
|
|
|
346
323
|
var maxMonth = (max === null || max === void 0 ? void 0 : max.year) === currentYear ? max === null || max === void 0 ? void 0 : max.month : 11;
|
|
347
324
|
return (jsx(Wrapper$5, __assign({ ref: ref }, { children: jsxs$1(Grid, __assign({ container: true, spacing: 2 }, { children: [jsx(Grid, __assign({ item: true, xs: 6 }, { children: jsx(SelectYear, { min: min === null || min === void 0 ? void 0 : min.year, max: max === null || max === void 0 ? void 0 : max.year, yearOptions: yearOptions, value: year, handleChange: changeYear }) })), jsx(Grid, __assign({ item: true, xs: 6 }, { children: jsx(SelectMonth, { min: (Number(min === null || min === void 0 ? void 0 : min.year) >= currentYear && minMonth), max: (Number(max === null || max === void 0 ? void 0 : max.year) <= currentYear && maxMonth), value: month, handleChange: changeMonth }) }))] })) })));
|
|
348
325
|
});
|
|
349
|
-
var Wrapper$5 = styled.div(templateObject_1$
|
|
350
|
-
var templateObject_1$
|
|
326
|
+
var Wrapper$5 = styled.div(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n margin-bottom: 24px;\n @media (max-width: 900px) {\n padding: 0 18px;\n margin-bottom: 20px;\n }\n"], ["\n margin-bottom: 24px;\n @media (max-width: 900px) {\n padding: 0 18px;\n margin-bottom: 20px;\n }\n"])));
|
|
327
|
+
var templateObject_1$p;
|
|
351
328
|
|
|
352
329
|
var CalendarStandardContainer = forwardRef(function (_a, ref) {
|
|
353
330
|
_a.arrowProps; _a.showPopperArrow; var props = __rest(_a, ["arrowProps", "showPopperArrow"]);
|
|
354
331
|
return jsx(DatePickerContainer, __assign({ ref: ref }, props));
|
|
355
332
|
});
|
|
356
|
-
var DatePickerContainer = styled.div(templateObject_1$
|
|
357
|
-
var templateObject_1$
|
|
333
|
+
var DatePickerContainer = styled.div(templateObject_1$o || (templateObject_1$o = __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--today {\n color: ", ";\n background-color: ", ";\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--today {\n color: ", ";\n background-color: ", ";\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.light, theme.palette.brand.main, theme.palette.brand.main, theme.palette.grey.fifteenB, theme.palette.red.seventy, theme.palette.grey.zero);
|
|
334
|
+
var templateObject_1$o;
|
|
358
335
|
|
|
359
336
|
var CalendarStandardHeader = forwardRef(function (_a, ref) {
|
|
360
337
|
var decreaseMonth = _a.decreaseMonth, increaseMonth = _a.increaseMonth, nextMonthButtonDisabled = _a.nextMonthButtonDisabled, prevMonthButtonDisabled = _a.prevMonthButtonDisabled, date = _a.date;
|
|
361
338
|
var title = _.capitalize(date.toLocaleString("ru", { month: "long", year: "numeric" })).slice(0, -3);
|
|
362
339
|
return (jsxs$1(HeaderWrapper, __assign({ container: true, alignItems: "center", justify: "space-between", ref: ref }, { children: [jsx(Grid, __assign({ item: true }, { children: jsx(StyledHeading, __assign({ size: "h4" }, { children: title })) })), jsx(Grid, __assign({ item: true }, { children: jsxs$1(Grid, __assign({ container: true, spacing: 2 }, { children: [jsx(Grid, __assign({ item: true }, { children: jsx(CircleButtonStyled, __assign({ isCircle: true, size: "xs", "data-testid": "prev_month_button", variant: "white", disabled: prevMonthButtonDisabled, onClick: decreaseMonth }, { children: jsx(PrevArrowIcon, { width: 10, height: 10 }) })) })), jsx(Grid, __assign({ item: true }, { children: jsx(CircleButtonStyled, __assign({ isCircle: true, size: "xs", variant: "white", disabled: nextMonthButtonDisabled, onClick: increaseMonth }, { children: jsx(NextArrowIcon, { width: 10, height: 10 }) })) }))] })) }))] })));
|
|
363
340
|
});
|
|
364
|
-
var HeaderWrapper = styled(Grid)(templateObject_1$
|
|
365
|
-
var StyledHeading = styled(Heading)(templateObject_2$
|
|
366
|
-
var CircleButtonStyled = styled(Button)(templateObject_3$
|
|
367
|
-
var templateObject_1$
|
|
341
|
+
var HeaderWrapper = styled(Grid)(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["\n padding: 0 6px 34px;\n @media (max-width: 600px) {\n h2 {\n font-size: 16px;\n }\n }\n"], ["\n padding: 0 6px 34px;\n @media (max-width: 600px) {\n h2 {\n font-size: 16px;\n }\n }\n"])));
|
|
342
|
+
var StyledHeading = styled(Heading)(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["\n @media (max-width: 600px) {\n font-weight: 700;\n }\n"], ["\n @media (max-width: 600px) {\n font-weight: 700;\n }\n"])));
|
|
343
|
+
var CircleButtonStyled = styled(Button)(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n border-color: transparent !important;\n &:disabled {\n background-color: white !important;\n }\n"], ["\n border-color: transparent !important;\n &:disabled {\n background-color: white !important;\n }\n"])));
|
|
344
|
+
var templateObject_1$n, templateObject_2$c, templateObject_3$5;
|
|
368
345
|
|
|
369
346
|
var InputForDatepicker = forwardRef(function (props, ref) {
|
|
370
347
|
var onClick = props.onClick, disabled = props.disabled, handleClick = props.handleClick, startIcon = props.startIcon, other = __rest(props, ["onClick", "disabled", "handleClick", "startIcon"]);
|
|
@@ -379,23 +356,23 @@ var InputForDatepicker = forwardRef(function (props, ref) {
|
|
|
379
356
|
var Icon = function () { return (jsx(IconWrapper, __assign({ disabled: disabled, onClick: handleIconClick }, { children: startIcon || jsx(CalendarIcon, { width: 19, height: 21 }) }))); };
|
|
380
357
|
return (jsx(InputWithMask$1, __assign({ disabled: disabled, endIcon: !startIcon && jsx(Icon, {}), startIcon: startIcon && jsx(Icon, {}) }, other, { ref: ref })));
|
|
381
358
|
});
|
|
382
|
-
var IconWrapper = styled.div(templateObject_1$
|
|
383
|
-
var templateObject_1$
|
|
359
|
+
var IconWrapper = styled.div(templateObject_1$m || (templateObject_1$m = __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"])));
|
|
360
|
+
var templateObject_1$m;
|
|
384
361
|
|
|
385
362
|
var MonthPickerContainer = forwardRef(function (_a, ref) {
|
|
386
363
|
_a.arrowProps; _a.showPopperArrow; var props = __rest(_a, ["arrowProps", "showPopperArrow"]);
|
|
387
|
-
return jsx(StyledContainer, __assign({ ref: ref }, props));
|
|
364
|
+
return jsx(StyledContainer$1, __assign({ ref: ref }, props));
|
|
388
365
|
});
|
|
389
|
-
var StyledContainer = styled.div(templateObject_1$
|
|
390
|
-
var templateObject_1$
|
|
366
|
+
var StyledContainer$1 = styled.div(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n border-radius: 12px !important;\n border: 1px solid ", " !important;\n background: #fff;\n overflow: hidden;\n z-index: 5;\n .react-datepicker-wrapper,\n .react-datepicker__input-container {\n display: block;\n width: 100%;\n }\n .react-datepicker__header,\n .react-datepicker__header:not(.react-datepicker__header--has-time-select) {\n padding: 0;\n border: none;\n background-color: #fff;\n }\n .react-datepicker__month {\n margin: 0px 8px 8px !important;\n border-radius: 12px;\n border: 1px solid ", ";\n width: 238px;\n height: 169px;\n display: flex;\n flex-direction: column;\n }\n .react-datepicker__month-text {\n margin: 4px !important;\n /*width: auto !important;*/\n width: calc(100% / 3) !important;\n position: relative;\n display: flex !important;\n justify-content: center;\n align-items: center;\n }\n\n .react-datepicker__month-wrapper {\n height: calc(100% / 4);\n display: flex;\n }\n\n .react-datepicker__month-text:after {\n content: \"\";\n display: block;\n height: calc(100% + 8px);\n width: 1px;\n position: absolute;\n top: -4px;\n right: -4px;\n background: ", ";\n }\n\n .react-datepicker__month-text:nth-child(3n):after {\n content: none;\n }\n\n .react-datepicker__month--selected,\n .react-datepicker__month-text--keyboard-selected {\n background-color: ", " !important;\n border-radius: 8px !important;\n color: white !important;\n }\n .react-datepicker__month-wrapper {\n border-bottom: 1px solid ", ";\n }\n\n .react-datepicker__month-wrapper:last-child {\n border-bottom: none;\n }\n\n @media (max-width: 600px) {\n .react-datepicker__month-container {\n width: 100%;\n height: 100%;\n }\n .react-datepicker__month {\n margin: 0px 16px 16px !important;\n height: calc(100% - 58px);\n text-align: center;\n width: auto;\n }\n .react-datepicker__month-text {\n margin: 8px !important;\n }\n .react-datepicker__month-text:after {\n height: calc(100% + 16px);\n top: -8px;\n right: -8px;\n }\n .react-datepicker__month-text:nth-child(3n):after {\n content: none;\n }\n }\n @media (max-width: 600px) {\n width: 100%;\n height: 262px;\n box-shadow: 0px 5px 16px rgba(0, 0, 0, 0.1);\n }\n"], ["\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n border-radius: 12px !important;\n border: 1px solid ", " !important;\n background: #fff;\n overflow: hidden;\n z-index: 5;\n .react-datepicker-wrapper,\n .react-datepicker__input-container {\n display: block;\n width: 100%;\n }\n .react-datepicker__header,\n .react-datepicker__header:not(.react-datepicker__header--has-time-select) {\n padding: 0;\n border: none;\n background-color: #fff;\n }\n .react-datepicker__month {\n margin: 0px 8px 8px !important;\n border-radius: 12px;\n border: 1px solid ", ";\n width: 238px;\n height: 169px;\n display: flex;\n flex-direction: column;\n }\n .react-datepicker__month-text {\n margin: 4px !important;\n /*width: auto !important;*/\n width: calc(100% / 3) !important;\n position: relative;\n display: flex !important;\n justify-content: center;\n align-items: center;\n }\n\n .react-datepicker__month-wrapper {\n height: calc(100% / 4);\n display: flex;\n }\n\n .react-datepicker__month-text:after {\n content: \"\";\n display: block;\n height: calc(100% + 8px);\n width: 1px;\n position: absolute;\n top: -4px;\n right: -4px;\n background: ", ";\n }\n\n .react-datepicker__month-text:nth-child(3n):after {\n content: none;\n }\n\n .react-datepicker__month--selected,\n .react-datepicker__month-text--keyboard-selected {\n background-color: ", " !important;\n border-radius: 8px !important;\n color: white !important;\n }\n .react-datepicker__month-wrapper {\n border-bottom: 1px solid ", ";\n }\n\n .react-datepicker__month-wrapper:last-child {\n border-bottom: none;\n }\n\n @media (max-width: 600px) {\n .react-datepicker__month-container {\n width: 100%;\n height: 100%;\n }\n .react-datepicker__month {\n margin: 0px 16px 16px !important;\n height: calc(100% - 58px);\n text-align: center;\n width: auto;\n }\n .react-datepicker__month-text {\n margin: 8px !important;\n }\n .react-datepicker__month-text:after {\n height: calc(100% + 16px);\n top: -8px;\n right: -8px;\n }\n .react-datepicker__month-text:nth-child(3n):after {\n content: none;\n }\n }\n @media (max-width: 600px) {\n width: 100%;\n height: 262px;\n box-shadow: 0px 5px 16px rgba(0, 0, 0, 0.1);\n }\n"])), theme.palette.background.light1, theme.palette.grey.fifteenB, theme.palette.grey.fifteenB, theme.palette.brand.main, theme.palette.grey.fifteenB);
|
|
367
|
+
var templateObject_1$l;
|
|
391
368
|
|
|
392
369
|
var MonthPickerHeader = forwardRef(function (_a, ref) {
|
|
393
370
|
var decreaseYear = _a.decreaseYear, increaseYear = _a.increaseYear, nextYearButtonDisabled = _a.nextYearButtonDisabled, prevYearButtonDisabled = _a.prevYearButtonDisabled, date = _a.date;
|
|
394
371
|
return (jsxs$1(StyledHeader, __assign({ container: true, alignItems: "center", justify: "space-between", ref: ref }, { children: [jsx(Grid, __assign({ item: true }, { children: jsx(StyledIconButton, __assign({ disabled: prevYearButtonDisabled, onClick: decreaseYear }, { children: jsx(ArrowBackIcon, { width: 14, height: 12 }) })) })), jsx(Grid, __assign({ item: true }, { children: jsx(Caption, __assign({ size: "sm", weight: 600 }, { children: date.getFullYear() })) })), jsx(Grid, __assign({ item: true }, { children: jsx(StyledIconButton, __assign({ disabled: nextYearButtonDisabled, onClick: increaseYear }, { children: jsx(ArrowNextIcon, { width: 14, height: 12 }) })) }))] })));
|
|
395
372
|
});
|
|
396
|
-
var StyledIconButton = styled(IconButton)(templateObject_1$
|
|
397
|
-
var StyledHeader = styled(Grid)(templateObject_2$
|
|
398
|
-
var templateObject_1$
|
|
373
|
+
var StyledIconButton = styled(IconButton)(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n height: 36px;\n &:disabled {\n opacity: 0;\n }\n"], ["\n height: 36px;\n &:disabled {\n opacity: 0;\n }\n"])));
|
|
374
|
+
var StyledHeader = styled(Grid)(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n background: #fff;\n padding: 4px 16px;\n border-radius: 12px 12px 0 0;\n"], ["\n background: #fff;\n padding: 4px 16px;\n border-radius: 12px 12px 0 0;\n"])));
|
|
375
|
+
var templateObject_1$k, templateObject_2$b;
|
|
399
376
|
|
|
400
377
|
var DesktopInputWithMonthPicker = forwardRef(function (_a, ref) {
|
|
401
378
|
var name = _a.name, form = _a.form, disabled = _a.disabled, datePickerProps = _a.datePickerProps, otherProps = __rest(_a, ["name", "form", "disabled", "datePickerProps"]);
|
|
@@ -405,8 +382,8 @@ var DesktopInputWithMonthPicker = forwardRef(function (_a, ref) {
|
|
|
405
382
|
return (jsx(DatePicker, __assign({ selected: field.value, onChange: field.onChange, disabled: disabled, customInput: jsx(InputForDatepicker, __assign({ mask: "00.0000", name: name, disabled: disabled, message: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message }, otherProps)), showMonthYearPicker: true, dateFormat: "MM.yyyy", popperPlacement: "bottom-end", calendarContainer: MonthPickerContainer, renderCustomHeader: function (props) { return (jsx(MonthPickerHeader, __assign({}, props))); } }, datePickerProps)));
|
|
406
383
|
} }) })));
|
|
407
384
|
});
|
|
408
|
-
var Wrapper$4 = styled.div(templateObject_1$
|
|
409
|
-
var templateObject_1$
|
|
385
|
+
var Wrapper$4 = styled.div(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n @media (max-width: 600px) {\n display: none;\n }\n"], ["\n @media (max-width: 600px) {\n display: none;\n }\n"])));
|
|
386
|
+
var templateObject_1$j;
|
|
410
387
|
|
|
411
388
|
var MenuItem = forwardRef(function (_a, ref) {
|
|
412
389
|
var tab = _a.tab, active = _a.active, index = _a.index, handleClick = _a.handleClick, offset = _a.offset, isScrolling = _a.isScrolling, setIsScrolling = _a.setIsScrolling;
|
|
@@ -441,16 +418,16 @@ var MenuItem = forwardRef(function (_a, ref) {
|
|
|
441
418
|
}, []);
|
|
442
419
|
return (jsx$1(Link, __assign({ to: tab.label, spy: true, smooth: true, duration: 500, offset: offset, onSetActive: handleSelect }, { children: jsx$1(ButtonWrapper$1, __assign({ ref: ref }, { children: jsx$1(Button, __assign({ variant: Number(active) === index ? "orange" : "transparentWithBorder", size: "xs", css: Number(active) !== index && disabledStyles }, { children: tab.label })) })) })));
|
|
443
420
|
});
|
|
444
|
-
var ButtonWrapper$1 = styled.div(templateObject_1$
|
|
445
|
-
var disabledStyles = css(templateObject_2$
|
|
446
|
-
var templateObject_1$
|
|
421
|
+
var ButtonWrapper$1 = styled.div(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n margin-right: 8px;\n width: max-content;\n max-width: 150px;\n @media (max-width: 900px) {\n max-width: unset;\n }\n"], ["\n margin-right: 8px;\n width: max-content;\n max-width: 150px;\n @media (max-width: 900px) {\n max-width: unset;\n }\n"])));
|
|
422
|
+
var disabledStyles = css(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n p {\n color: ", ";\n font-weight: 400;\n },\n"], ["\n p {\n color: ", ";\n font-weight: 400;\n },\n"])), theme.palette.grey.seventy);
|
|
423
|
+
var templateObject_1$i, templateObject_2$a;
|
|
447
424
|
|
|
448
425
|
var DesktopMenuPanel = forwardRef(function (_a, ref) {
|
|
449
426
|
var tabs = _a.tabs, variant = _a.variant, other = __rest(_a, ["tabs", "variant"]);
|
|
450
427
|
return (jsx$1(Wrapper$3, __assign({ container: true, css: variant === "white" && { background: "white" }, ref: ref }, { children: tabs.map(function (tab, index) { return (jsx$1(Grid, __assign({ item: true }, { children: jsx$1(MenuItem, __assign({ tab: tab, index: index, offset: -121 }, other), tab.label) }), index)); }) })));
|
|
451
428
|
});
|
|
452
|
-
var Wrapper$3 = styled(Grid)(templateObject_1$
|
|
453
|
-
var templateObject_1$
|
|
429
|
+
var Wrapper$3 = styled(Grid)(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n position: sticky;\n top: 49px;\n left: 0;\n z-index: 11;\n background-color: ", ";\n padding: 16px 16px 24px;\n @media (max-width: 900px) {\n justify-content: space-between;\n }\n @media (max-width: 765px) {\n display: none;\n }\n"], ["\n position: sticky;\n top: 49px;\n left: 0;\n z-index: 11;\n background-color: ", ";\n padding: 16px 16px 24px;\n @media (max-width: 900px) {\n justify-content: space-between;\n }\n @media (max-width: 765px) {\n display: none;\n }\n"])), theme.palette.background.light1);
|
|
430
|
+
var templateObject_1$h;
|
|
454
431
|
|
|
455
432
|
var InputWithMask = forwardRef(function (_a, ref) {
|
|
456
433
|
var form = _a.form, name = _a.name, error = _a.error, inputProps = __rest(_a, ["form", "name", "error"]);
|
|
@@ -526,15 +503,26 @@ var PassportStrengthBar = forwardRef(function (_a, ref) {
|
|
|
526
503
|
: -1;
|
|
527
504
|
return (jsxs(Wrapper$2, __assign({ "data-testid": "strength_bar", className: String(!strength && "hidden"), ref: ref }, { children: [jsx$1(ReliabilityLevelWrapper, { children: Object.keys(strengthCoefficients).map(function (item, key) { return (jsx$1(ReliabilityLevel, { children: jsx$1(StyledLinearProgress, { "data-testid": "progress_item_".concat(item), value: strengthKey >= key ? 100 : 0, color: color }) }, item)); }) }), jsx$1(Caption, __assign({ "data-testid": "strength_bar_explanation", size: "s", css: { color: color } }, { children: strength && strengthTexts[strength] })), jsx$1(Description, __assign({ size: "s", color: "fiftyP" }, { children: "\u041F\u0430\u0440\u043E\u043B\u044C \u0434\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0441\u0442\u043E\u044F\u0442\u044C \u0438\u0437 10 \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432, \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0446\u0438\u0444\u0440\u044B, \u0431\u043E\u043B\u044C\u0448\u0438\u0435 \u0438 \u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0435 \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u0432\u044B" }))] })));
|
|
528
505
|
});
|
|
529
|
-
var Wrapper$2 = styled.div(templateObject_1$
|
|
530
|
-
var ReliabilityLevelWrapper = styled.div(templateObject_2$
|
|
531
|
-
var ReliabilityLevel = styled.div(templateObject_3$
|
|
532
|
-
var StyledLinearProgress = styled(LinearProgress)(templateObject_4$
|
|
506
|
+
var Wrapper$2 = styled.div(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n margin-top: 16px;\n min-height: 86px;\n @media (max-width: 900px) {\n min-height: unset;\n }\n &.hidden {\n opacity: 0;\n @media (max-width: 900px) {\n display: none;\n }\n }\n"], ["\n margin-top: 16px;\n min-height: 86px;\n @media (max-width: 900px) {\n min-height: unset;\n }\n &.hidden {\n opacity: 0;\n @media (max-width: 900px) {\n display: none;\n }\n }\n"])));
|
|
507
|
+
var ReliabilityLevelWrapper = styled.div(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n display: flex;\n margin-bottom: 8px;\n"], ["\n display: flex;\n margin-bottom: 8px;\n"])));
|
|
508
|
+
var ReliabilityLevel = styled.div(templateObject_3$4 || (templateObject_3$4 = __makeTemplateObject(["\n width: calc(100% / 4);\n margin-right: 16px;\n &:last-of-type {\n margin-right: 0;\n }\n"], ["\n width: calc(100% / 4);\n margin-right: 16px;\n &:last-of-type {\n margin-right: 0;\n }\n"])));
|
|
509
|
+
var StyledLinearProgress = styled(LinearProgress)(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["\n height: 8px;\n border-radius: 8px;\n background-color: ", ";\n & .KUI-LinearProgress_bar {\n background-color: ", ";\n width: 102%;\n }\n"], ["\n height: 8px;\n border-radius: 8px;\n background-color: ", ";\n & .KUI-LinearProgress_bar {\n background-color: ", ";\n width: 102%;\n }\n"])), theme.palette.grey.fifteenB, function (_a) {
|
|
533
510
|
var color = _a.color;
|
|
534
511
|
return color;
|
|
535
512
|
});
|
|
536
|
-
var Description = styled(Caption)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-top: 16px;\n @media (max-width: 900px) {\n margin-top: 8px;\n font-size: 12px;\n }\n"], ["\n margin-top: 16px;\n @media (max-width: 900px) {\n margin-top: 8px;\n font-size: 12px;\n }\n"])));
|
|
537
|
-
var templateObject_1$
|
|
513
|
+
var Description = styled(Caption)(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n margin-top: 16px;\n @media (max-width: 900px) {\n margin-top: 8px;\n font-size: 12px;\n }\n"], ["\n margin-top: 16px;\n @media (max-width: 900px) {\n margin-top: 8px;\n font-size: 12px;\n }\n"])));
|
|
514
|
+
var templateObject_1$g, templateObject_2$9, templateObject_3$4, templateObject_4$3, templateObject_5$1;
|
|
515
|
+
|
|
516
|
+
var getFormValue = function (name, form) {
|
|
517
|
+
var names = name === null || name === void 0 ? void 0 : name.split(".");
|
|
518
|
+
var fieldValue = form === null || form === void 0 ? void 0 : form.control._formValues;
|
|
519
|
+
names === null || names === void 0 ? void 0 : names.forEach(function (field) {
|
|
520
|
+
if (fieldValue) {
|
|
521
|
+
fieldValue = fieldValue[field];
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
return fieldValue;
|
|
525
|
+
};
|
|
538
526
|
|
|
539
527
|
var isValidWithMaskExp = /^[^_]+$/;
|
|
540
528
|
var simplePasswordRegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{10,}$/;
|
|
@@ -578,13 +566,13 @@ var InputPassword = forwardRef(function (props, ref) {
|
|
|
578
566
|
}, []);
|
|
579
567
|
return (jsxs$1(Fragment$1, { children: [jsx(InputWithController, __assign({ type: showPassword ? "text" : "password", autoComplete: "new_password", onChange: handleChange, "data-testid": "input_password", ref: ref, endIcon: jsx(EyeIconWrapper, __assign({ "data-testid": "show_value_btn", onClick: handleShowChange }, { children: showPassword ? jsx(ClosedEyeIcon, {}) : jsx(OpenEyeIcon, {}) })) }, props)), jsx(PassportStrengthBar, { strength: strength })] }));
|
|
580
568
|
});
|
|
581
|
-
var EyeIconWrapper = styled.div(templateObject_1$
|
|
582
|
-
var templateObject_1$
|
|
569
|
+
var EyeIconWrapper = styled.div(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n height: 18px;\n display: flex;\n align-items: center;\n cursor: pointer;\n"], ["\n height: 18px;\n display: flex;\n align-items: center;\n cursor: pointer;\n"])));
|
|
570
|
+
var templateObject_1$f;
|
|
583
571
|
|
|
584
572
|
var InputTextAreaMobile = forwardRef(function (props) { return (jsxs$1(Fragment$1, { children: [jsx(InputWrapper, { children: jsx(InputWithController, __assign({}, props)) }), jsx(TextAreaWrapper, { children: jsx(InputWithController, __assign({ isTextArea: true }, props)) })] })); });
|
|
585
|
-
var InputWrapper = styled.div(templateObject_1$
|
|
586
|
-
var TextAreaWrapper = styled.div(templateObject_2$
|
|
587
|
-
var templateObject_1$
|
|
573
|
+
var InputWrapper = styled.div(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n @media (max-width: 900px) {\n display: none;\n }\n"], ["\n @media (max-width: 900px) {\n display: none;\n }\n"])));
|
|
574
|
+
var TextAreaWrapper = styled.div(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n @media (min-width: 901px) {\n display: none;\n }\n"], ["\n @media (min-width: 901px) {\n display: none;\n }\n"])));
|
|
575
|
+
var templateObject_1$e, templateObject_2$8;
|
|
588
576
|
|
|
589
577
|
var useToggle = function (isModalOpen) {
|
|
590
578
|
if (isModalOpen === void 0) { isModalOpen = false; }
|
|
@@ -602,10 +590,10 @@ var ModalFooter = forwardRef(function (_a, ref) {
|
|
|
602
590
|
var label = _a.label, button = _a.button, otherProps = __rest(_a, ["label", "button"]);
|
|
603
591
|
return (jsxs$1(StyledFooter, __assign({ ref: ref }, { children: [jsx(Divider, {}), jsx(ButtonWrapper, { children: button || (jsx(ButtonStyled, __assign({ fullWidth: true, size: "s", endIcon: jsx(CheckIcon, {}) }, otherProps, { children: label }))) })] })));
|
|
604
592
|
});
|
|
605
|
-
var StyledFooter = styled.div(templateObject_1$
|
|
606
|
-
var ButtonWrapper = styled.div(templateObject_2$
|
|
607
|
-
var ButtonStyled = styled(Button)(templateObject_3$
|
|
608
|
-
var templateObject_1$
|
|
593
|
+
var StyledFooter = styled.div(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n background: ", ";\n border-radius: 0 0 12px 12px;\n z-index: 10;\n position: sticky;\n bottom: 0;\n left: 0;\n"], ["\n background: ", ";\n border-radius: 0 0 12px 12px;\n z-index: 10;\n position: sticky;\n bottom: 0;\n left: 0;\n"])), theme.palette.grey.zero);
|
|
594
|
+
var ButtonWrapper = styled.div(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n display: flex;\n justify-content: flex-end;\n padding: 24px 40px;\n @media (max-width: 600px) {\n padding: 24px 16px;\n }\n"], ["\n display: flex;\n justify-content: flex-end;\n padding: 24px 40px;\n @media (max-width: 600px) {\n padding: 24px 16px;\n }\n"])));
|
|
595
|
+
var ButtonStyled = styled(Button)(templateObject_3$3 || (templateObject_3$3 = __makeTemplateObject(["\n @media (max-width: 600px) {\n width: 100%;\n }\n"], ["\n @media (max-width: 600px) {\n width: 100%;\n }\n"])));
|
|
596
|
+
var templateObject_1$d, templateObject_2$7, templateObject_3$3;
|
|
609
597
|
|
|
610
598
|
function setRef(ref, value) {
|
|
611
599
|
if (typeof ref === "function") {
|
|
@@ -709,14 +697,14 @@ InputWithDatePicker.defaultProps = {
|
|
|
709
697
|
footerLabel: "Подтвердить",
|
|
710
698
|
alignTitle: "center",
|
|
711
699
|
};
|
|
712
|
-
var ContentWrapper$1 = styled.div(templateObject_1$
|
|
713
|
-
var StyledCalendarStandardContainer = styled(CalendarStandardContainer)(templateObject_2$
|
|
714
|
-
var DayContent = styled.span(templateObject_3$
|
|
715
|
-
var StyledModal = styled(Modal)(templateObject_4$
|
|
700
|
+
var ContentWrapper$1 = styled.div(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n padding: 0px 40px 24px;\n @media (max-width: 600px) {\n padding: 20px 0 0;\n }\n"], ["\n padding: 0px 40px 24px;\n @media (max-width: 600px) {\n padding: 20px 0 0;\n }\n"])));
|
|
701
|
+
var StyledCalendarStandardContainer = styled(CalendarStandardContainer)(templateObject_2$6 || (templateObject_2$6 = __makeTemplateObject(["\n height: 410px;\n .react-datepicker__header {\n padding: 0 !important;\n }\n .react-datepicker__day-names {\n padding: 35px 22px 0;\n background-color: ", ";\n border-radius: 16px 16px 0 0;\n @media (max-width: 900px) {\n padding: 24px 16px 0;\n }\n }\n .react-datepicker__month {\n justify-content: space-between;\n height: calc(100% - 124px);\n background-color: ", ";\n border-radius: 0 0 16px 16px;\n padding: 20px 22px 24px;\n margin: 0 !important;\n box-sizing: border-box;\n @media (max-width: 900px) {\n padding: 20px 16px 24px;\n }\n }\n @media (max-width: 600px) {\n height: auto;\n margin-bottom: -4px;\n }\n"], ["\n height: 410px;\n .react-datepicker__header {\n padding: 0 !important;\n }\n .react-datepicker__day-names {\n padding: 35px 22px 0;\n background-color: ", ";\n border-radius: 16px 16px 0 0;\n @media (max-width: 900px) {\n padding: 24px 16px 0;\n }\n }\n .react-datepicker__month {\n justify-content: space-between;\n height: calc(100% - 124px);\n background-color: ", ";\n border-radius: 0 0 16px 16px;\n padding: 20px 22px 24px;\n margin: 0 !important;\n box-sizing: border-box;\n @media (max-width: 900px) {\n padding: 20px 16px 24px;\n }\n }\n @media (max-width: 600px) {\n height: auto;\n margin-bottom: -4px;\n }\n"])), theme.palette.background.light1, theme.palette.background.light1);
|
|
702
|
+
var DayContent = styled.span(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n padding-top: 1px;\n font-family: Inter, sans-serif;\n @media (max-width: 600px) {\n font-weight: 400;\n }\n"], ["\n padding-top: 1px;\n font-family: Inter, sans-serif;\n @media (max-width: 600px) {\n font-weight: 400;\n }\n"])));
|
|
703
|
+
var StyledModal = styled(Modal)(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n .KUI-Modal_title {\n font-size: 24px;\n line-height: 32px;\n text-align: ", ";\n }\n .KUI-Modal_description {\n margin-bottom: 36px;\n }\n"], ["\n .KUI-Modal_title {\n font-size: 24px;\n line-height: 32px;\n text-align: ", ";\n }\n .KUI-Modal_description {\n margin-bottom: 36px;\n }\n"])), function (_a) {
|
|
716
704
|
var alignTitle = _a.alignTitle;
|
|
717
705
|
return alignTitle || "center";
|
|
718
706
|
});
|
|
719
|
-
var templateObject_1$
|
|
707
|
+
var templateObject_1$c, templateObject_2$6, templateObject_3$2, templateObject_4$2;
|
|
720
708
|
|
|
721
709
|
var shortMonths = [
|
|
722
710
|
"ЯНВ",
|
|
@@ -779,9 +767,9 @@ var MobileInputWithMonthPicker = forwardRef(function (_a, ref) {
|
|
|
779
767
|
};
|
|
780
768
|
return (jsxs$1(Wrapper$1, __assign({ ref: ref }, { children: [jsx(InputForDatepicker, __assign({ mask: "00.0000", name: name, handleCLick: handleModalOpen, value: value, onChange: handleChange, disabled: disabled, message: error, isLabelShrink: Boolean(field.value) }, props)), jsxs$1(Modal, __assign({ title: title, isOpen: isModalOpen, handleClose: handleModalClose }, { children: [jsx(ContentWrapper, { children: jsx(DatePicker, __assign({ inline: true, showMonthYearPicker: true, dateFormat: "MM.yyyy", selected: date, onChange: function (newDate) { return setDate(newDate); }, locale: ruCustom, calendarContainer: MonthPickerContainer, renderCustomHeader: function (headProps) { return (jsx(MonthPickerHeader, __assign({}, headProps))); } }, datePickerProps)) }), jsx(ModalFooter, { fullWidth: true, disabled: !date, onClick: acceptWithDateSelected, label: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C" })] }))] })));
|
|
781
769
|
});
|
|
782
|
-
var Wrapper$1 = styled.div(templateObject_1$
|
|
783
|
-
var ContentWrapper = styled.div(templateObject_2$
|
|
784
|
-
var templateObject_1$
|
|
770
|
+
var Wrapper$1 = styled.div(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n @media (min-width: 601px) {\n display: none;\n }\n"], ["\n @media (min-width: 601px) {\n display: none;\n }\n"])));
|
|
771
|
+
var ContentWrapper = styled.div(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n @media (max-width: 600px) {\n padding: 16px 16px 8px;\n }\n"], ["\n @media (max-width: 600px) {\n padding: 16px 16px 8px;\n }\n"])));
|
|
772
|
+
var templateObject_1$b, templateObject_2$5;
|
|
785
773
|
|
|
786
774
|
var InputWithMonthPicker = function (props) { return (jsxs$1(Fragment$1, { children: [jsx(DesktopInputWithMonthPicker, __assign({}, props)), jsx(MobileInputWithMonthPicker, __assign({}, props))] })); };
|
|
787
775
|
|
|
@@ -797,9 +785,9 @@ var MobileMenuPanel = forwardRef(function (_a, ref) {
|
|
|
797
785
|
};
|
|
798
786
|
return (jsx$1(Wrapper, __assign({ css: variant === "white" && { background: "white" }, ref: ref }, { children: jsx$1(Swiper, __assign({ spaceBetween: 8, slidesPerView: "auto", slideToClickedSlide: true, ref: swiperRef }, { children: tabs.map(function (tab, index) { return (jsx$1(SlideWrapper, { children: jsx$1(MenuItem, __assign({ tab: tab, index: index, handleClick: slideTo, offset: -121 }, other), tab.label) }, index)); }) })) })));
|
|
799
787
|
});
|
|
800
|
-
var Wrapper = styled.div(templateObject_1$
|
|
801
|
-
var SlideWrapper = styled.div(templateObject_2$
|
|
802
|
-
var templateObject_1$
|
|
788
|
+
var Wrapper = styled.div(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n position: sticky;\n top: 49px;\n left: 0;\n z-index: 11;\n background: ", ";\n padding: 16px 0 24px;\n @media (min-width: 766px) {\n display: none;\n }\n"], ["\n position: sticky;\n top: 49px;\n left: 0;\n z-index: 11;\n background: ", ";\n padding: 16px 0 24px;\n @media (min-width: 766px) {\n display: none;\n }\n"])), theme.palette.background.light1);
|
|
789
|
+
var SlideWrapper = styled.div(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n width: max-content !important;\n &:first-of-type {\n padding-left: 16px;\n }\n"], ["\n width: max-content !important;\n &:first-of-type {\n padding-left: 16px;\n }\n"])));
|
|
790
|
+
var templateObject_1$a, templateObject_2$4;
|
|
803
791
|
|
|
804
792
|
var useWindowWidth = function (time) {
|
|
805
793
|
if (time === void 0) { time = 10; }
|
|
@@ -849,8 +837,8 @@ var MenuPanel = forwardRef(function (_a, ref) {
|
|
|
849
837
|
MenuPanel.defaultProps = {
|
|
850
838
|
variant: "grey",
|
|
851
839
|
};
|
|
852
|
-
var fullHeightStyles = css(templateObject_1$
|
|
853
|
-
var templateObject_1$
|
|
840
|
+
var fullHeightStyles = css(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n height: calc(100vh - 121px);\n"], ["\n height: calc(100vh - 121px);\n"])));
|
|
841
|
+
var templateObject_1$9;
|
|
854
842
|
|
|
855
843
|
var Switch = forwardRef(function (_a, ref) {
|
|
856
844
|
var form = _a.form, name = _a.name, props = __rest(_a, ["form", "name"]);
|
|
@@ -903,14 +891,14 @@ InputPhoneWithForm.defaultProps = {
|
|
|
903
891
|
};
|
|
904
892
|
|
|
905
893
|
var Table = forwardRef(function (props, ref) { return jsx(StyledTable, __assign({ cellSpacing: "0", ref: ref }, props)); });
|
|
906
|
-
var StyledTable = styled.table(templateObject_1$
|
|
907
|
-
var templateObject_1$
|
|
894
|
+
var StyledTable = styled.table(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n width: 100%;\n border-spacing: 0;\n"], ["\n width: 100%;\n border-spacing: 0;\n"])));
|
|
895
|
+
var templateObject_1$8;
|
|
908
896
|
|
|
909
|
-
var TableHeadCell = styled.th(templateObject_1$
|
|
910
|
-
var templateObject_1$
|
|
897
|
+
var TableHeadCell = styled.th(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n padding: 0;\n text-align: left;\n"], ["\n padding: 0;\n text-align: left;\n"])));
|
|
898
|
+
var templateObject_1$7;
|
|
911
899
|
|
|
912
|
-
var TableCell = styled.td(templateObject_1$
|
|
913
|
-
var templateObject_1$
|
|
900
|
+
var TableCell = styled.td(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n padding: 0;\n"], ["\n padding: 0;\n"])));
|
|
901
|
+
var templateObject_1$6;
|
|
914
902
|
|
|
915
903
|
var TableRow = forwardRef(function (_a, ref) {
|
|
916
904
|
var children = _a.children, other = __rest(_a, ["children"]);
|
|
@@ -949,15 +937,15 @@ var PopperBase = forwardRef(function (props, ref) {
|
|
|
949
937
|
props.placement; var open = props.open, children = props.children, spacing = props.spacing, className = props.className, style = props.style, other = __rest(props, ["placement", "open", "children", "spacing", "className", "style"]);
|
|
950
938
|
return (jsx(StyledPopperWrapper, __assign({ ref: ref, className: classNames("KUI-Popper", className), spacing: spacing, style: style }, { children: jsx(StyledPopper, __assign({ open: !!open }, other, { children: children })) })));
|
|
951
939
|
});
|
|
952
|
-
var StyledPopperWrapper = styled.div(templateObject_1$
|
|
940
|
+
var StyledPopperWrapper = styled.div(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n position: absolute;\n max-width: 215px;\n width: max-content;\n padding: ", ";\n z-index: 10;\n @media (max-width: ", "px) {\n position: fixed;\n bottom: 24px;\n top: auto !important;\n left: 16px !important;\n width: calc(100vw - 32px);\n max-width: unset;\n }\n"], ["\n position: absolute;\n max-width: 215px;\n width: max-content;\n padding: ", ";\n z-index: 10;\n @media (max-width: ", "px) {\n position: fixed;\n bottom: 24px;\n top: auto !important;\n left: 16px !important;\n width: calc(100vw - 32px);\n max-width: unset;\n }\n"])), function (_a) {
|
|
953
941
|
var spacing = _a.spacing;
|
|
954
942
|
return spacing || 0;
|
|
955
943
|
}, theme.breakpoints.xxs);
|
|
956
|
-
var StyledPopper = styled.div(templateObject_2$
|
|
944
|
+
var StyledPopper = styled.div(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n padding: 16px;\n border-radius: 12px;\n background: white;\n box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);\n transition: opacity 0.3s ease-out;\n opacity: ", ";\n"], ["\n padding: 16px;\n border-radius: 12px;\n background: white;\n box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);\n transition: opacity 0.3s ease-out;\n opacity: ", ";\n"])), function (_a) {
|
|
957
945
|
var open = _a.open;
|
|
958
946
|
return (open ? 1 : 0);
|
|
959
947
|
});
|
|
960
|
-
var templateObject_1$
|
|
948
|
+
var templateObject_1$5, templateObject_2$3;
|
|
961
949
|
|
|
962
950
|
var PopperWithPortal = forwardRef(function (props, ref) {
|
|
963
951
|
var placement = props.placement, contentRef = props.contentRef, other = __rest(props, ["placement", "contentRef"]);
|
|
@@ -1001,9 +989,9 @@ var PopperWithPortal = forwardRef(function (props, ref) {
|
|
|
1001
989
|
// TODO подумать как реализовать правильное расположение подсказки под contentRef в зависимости от placement
|
|
1002
990
|
// Автоматом менять положение (верх-низ) в зависимости от того помещается или нет
|
|
1003
991
|
// Распожить стрелочку к контенту посередине контента
|
|
1004
|
-
return ReactDOM.createPortal(jsxs$1(Fragment$1, { children: [jsx(Global, { styles: css(templateObject_1$
|
|
992
|
+
return ReactDOM.createPortal(jsxs$1(Fragment$1, { children: [jsx(Global, { styles: css(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n body {\n position: relative;\n }\n "], ["\n body {\n position: relative;\n }\n "]))) }), jsx(PopperBase, __assign({ ref: forwardedRef, style: position }, other))] }), document.body);
|
|
1005
993
|
});
|
|
1006
|
-
var templateObject_1$
|
|
994
|
+
var templateObject_1$4;
|
|
1007
995
|
|
|
1008
996
|
var StaticPopper = forwardRef(function (props, ref) {
|
|
1009
997
|
var placement = props.placement, contentRef = props.contentRef, other = __rest(props, ["placement", "contentRef"]);
|
|
@@ -1085,24 +1073,193 @@ var Tooltip = forwardRef(function (props, ref) {
|
|
|
1085
1073
|
useEffect(function () {
|
|
1086
1074
|
setOpen(open);
|
|
1087
1075
|
}, [open]);
|
|
1088
|
-
return (jsxs$1(StyledWrapper, __assign({ onMouseLeave: handleClose, ref: ref }, { children: [jsx(StyledContentWrapper, __assign({ onMouseEnter: handleOpen, onTouchEnd: handleOpen, ref: elemRef, cursor: cursor }, { children: jsx(StyledContent, { children: children }) })), jsx(Popper, __assign({ open: isOpen }, popper, { contentRef: elemRef }, { children: content }))] })));
|
|
1076
|
+
return (jsxs$1(StyledWrapper$1, __assign({ onMouseLeave: handleClose, ref: ref }, { children: [jsx(StyledContentWrapper, __assign({ onMouseEnter: handleOpen, onTouchEnd: handleOpen, ref: elemRef, cursor: cursor }, { children: jsx(StyledContent, { children: children }) })), jsx(Popper, __assign({ open: isOpen }, popper, { contentRef: elemRef }, { children: content }))] })));
|
|
1089
1077
|
});
|
|
1090
|
-
var containerCSS = css(templateObject_1$
|
|
1091
|
-
var StyledWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", ";\n position: relative;\n"], ["\n ", ";\n position: relative;\n"])), containerCSS);
|
|
1092
|
-
var StyledContentWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n cursor: ", ";\n"], ["\n ", ";\n cursor: ", ";\n"])), containerCSS, function (_a) {
|
|
1078
|
+
var containerCSS = css(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n display: inline-flex;\n width: 100%;\n height: fit-content;\n"], ["\n display: inline-flex;\n width: 100%;\n height: fit-content;\n"])));
|
|
1079
|
+
var StyledWrapper$1 = styled.div(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["\n ", ";\n position: relative;\n"], ["\n ", ";\n position: relative;\n"])), containerCSS);
|
|
1080
|
+
var StyledContentWrapper = styled.div(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n ", ";\n cursor: ", ";\n"], ["\n ", ";\n cursor: ", ";\n"])), containerCSS, function (_a) {
|
|
1093
1081
|
var cursor = _a.cursor;
|
|
1094
1082
|
return cursor;
|
|
1095
1083
|
});
|
|
1096
|
-
var StyledContent = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n z-index: -1;\n"], ["\n ", ";\n z-index: -1;\n"])), containerCSS);
|
|
1097
|
-
var templateObject_1$
|
|
1084
|
+
var StyledContent = styled.div(templateObject_4$1 || (templateObject_4$1 = __makeTemplateObject(["\n ", ";\n z-index: -1;\n"], ["\n ", ";\n z-index: -1;\n"])), containerCSS);
|
|
1085
|
+
var templateObject_1$3, templateObject_2$2, templateObject_3$1, templateObject_4$1;
|
|
1098
1086
|
|
|
1099
1087
|
var ButtonSelect = forwardRef(function (props, ref) {
|
|
1100
1088
|
var _a;
|
|
1101
1089
|
var options = props.options, otherProps = __rest(props, ["options"]);
|
|
1102
1090
|
return (jsx(StyledInputSelect, __assign({ value: (_a = options === null || options === void 0 ? void 0 : options[0]) === null || _a === void 0 ? void 0 : _a.value, options: options, iconProps: { width: 9, height: 5 } }, otherProps, { ref: ref })));
|
|
1103
1091
|
});
|
|
1104
|
-
var StyledInputSelect = styled(InputSelect)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.KUI-Input_container {\n height: 40px;\n width: fit-content;\n input {\n height: 40px;\n border-radius: 66px;\n padding: 0 12px;\n transform: none;\n font-size: 12px;\n line-height: 14px;\n margin: 0 !important;\n width: auto !important;\n }\n\n @media (max-width: ", "px) {\n height: 32px;\n input {\n height: 32px;\n }\n }\n }\n & + div {\n top: 22px;\n padding-top: 22px;\n }\n"], ["\n &.KUI-Input_container {\n height: 40px;\n width: fit-content;\n input {\n height: 40px;\n border-radius: 66px;\n padding: 0 12px;\n transform: none;\n font-size: 12px;\n line-height: 14px;\n margin: 0 !important;\n width: auto !important;\n }\n\n @media (max-width: ", "px) {\n height: 32px;\n input {\n height: 32px;\n }\n }\n }\n & + div {\n top: 22px;\n padding-top: 22px;\n }\n"])), theme.breakpoints.xs);
|
|
1105
|
-
var templateObject_1;
|
|
1092
|
+
var StyledInputSelect = styled(InputSelect)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n &.KUI-Input_container {\n height: 40px;\n width: fit-content;\n input {\n height: 40px;\n border-radius: 66px;\n padding: 0 12px;\n transform: none;\n font-size: 12px;\n line-height: 14px;\n margin: 0 !important;\n width: auto !important;\n }\n\n @media (max-width: ", "px) {\n height: 32px;\n input {\n height: 32px;\n }\n }\n }\n & + div {\n top: 22px;\n padding-top: 22px;\n }\n"], ["\n &.KUI-Input_container {\n height: 40px;\n width: fit-content;\n input {\n height: 40px;\n border-radius: 66px;\n padding: 0 12px;\n transform: none;\n font-size: 12px;\n line-height: 14px;\n margin: 0 !important;\n width: auto !important;\n }\n\n @media (max-width: ", "px) {\n height: 32px;\n input {\n height: 32px;\n }\n }\n }\n & + div {\n top: 22px;\n padding-top: 22px;\n }\n"])), theme.breakpoints.xs);
|
|
1093
|
+
var templateObject_1$2;
|
|
1094
|
+
|
|
1095
|
+
function InputSelectWithController(_a) {
|
|
1096
|
+
var _b, _c;
|
|
1097
|
+
var options = _a.options, name = _a.name, handleChange = _a.handleChange, form = _a.form, valueProp = _a.value, inputProps = __rest(_a, ["options", "name", "handleChange", "form", "value"]);
|
|
1098
|
+
var control = useController({
|
|
1099
|
+
control: form.control,
|
|
1100
|
+
name: name,
|
|
1101
|
+
});
|
|
1102
|
+
var error = (_b = control.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
1103
|
+
var handleSelect = function (option) {
|
|
1104
|
+
var _a;
|
|
1105
|
+
if (handleChange) {
|
|
1106
|
+
handleChange(option.value);
|
|
1107
|
+
}
|
|
1108
|
+
if (form) {
|
|
1109
|
+
(_a = control.field) === null || _a === void 0 ? void 0 : _a.onChange({
|
|
1110
|
+
target: { value: option.value, name: name },
|
|
1111
|
+
type: "change",
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
return (jsx(InputSelect, __assign({ options: options, handleChange: handleSelect, error: error, name: name, value: valueProp || ((_c = control.field) === null || _c === void 0 ? void 0 : _c.value) }, inputProps)));
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
function InputMultiSelectOption(props) {
|
|
1119
|
+
var option = props.option, selectedValue = props.selectedValue;
|
|
1120
|
+
var selected = selectedValue.includes(option.value);
|
|
1121
|
+
return (jsx(StyledOption, __assign({ container: true, selected: selected }, { children: jsx(Checkbox, { checked: selected, label: jsx(StyledCaption, __assign({ selected: selected, size: "sm", weight: 500 }, { children: option.label })) }) })));
|
|
1122
|
+
}
|
|
1123
|
+
var StyledOption = styled(Grid)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n padding: 8px;\n transition: all ease-out 0.3s;\n border-radius: 4px;\n background-color: ", ";\n &:hover {\n background-color: ", ";\n p {\n color: ", " !important;\n }\n }\n"], ["\n padding: 8px;\n transition: all ease-out 0.3s;\n border-radius: 4px;\n background-color: ", ";\n &:hover {\n background-color: ", ";\n p {\n color: ", " !important;\n }\n }\n"])), function (_a) {
|
|
1124
|
+
var selected = _a.selected;
|
|
1125
|
+
return selected ? theme.palette.background.light1 : theme.palette.grey.zero;
|
|
1126
|
+
}, theme.palette.background.light1, theme.palette.grey.seventy);
|
|
1127
|
+
var StyledCaption = styled(Caption)(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n color: ", " !important;\n"], ["\n color: ", " !important;\n"])), function (_a) {
|
|
1128
|
+
var selected = _a.selected;
|
|
1129
|
+
return selected
|
|
1130
|
+
? theme.palette.grey.seventy
|
|
1131
|
+
: theme.palette.grey.fiftyP;
|
|
1132
|
+
});
|
|
1133
|
+
var templateObject_1$1, templateObject_2$1;
|
|
1134
|
+
|
|
1135
|
+
function InputMultiSelect(_a) {
|
|
1136
|
+
var _b, _c;
|
|
1137
|
+
var options = _a.options, name = _a.name, handleChange = _a.handleChange, form = _a.form, valueProp = _a.value, inputProps = __rest(_a, ["options", "name", "handleChange", "form", "value"]);
|
|
1138
|
+
var control = form
|
|
1139
|
+
? useController({
|
|
1140
|
+
control: form.control,
|
|
1141
|
+
name: name,
|
|
1142
|
+
})
|
|
1143
|
+
: null;
|
|
1144
|
+
var _d = useState(valueProp || ((_b = control === null || control === void 0 ? void 0 : control.field) === null || _b === void 0 ? void 0 : _b.value) || []), value = _d[0], setValue = _d[1];
|
|
1145
|
+
var selectedLabel = options
|
|
1146
|
+
.filter(function (option) { return value.includes(option.value); })
|
|
1147
|
+
.map(function (option) { return option.label; })
|
|
1148
|
+
.join(", ");
|
|
1149
|
+
var error = (_c = control === null || control === void 0 ? void 0 : control.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
1150
|
+
useEffect(function () {
|
|
1151
|
+
var _a;
|
|
1152
|
+
if (form) {
|
|
1153
|
+
(_a = control === null || control === void 0 ? void 0 : control.field) === null || _a === void 0 ? void 0 : _a.onChange({
|
|
1154
|
+
target: { value: value, name: name },
|
|
1155
|
+
type: "change",
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
}, [value]);
|
|
1159
|
+
var handleSelect = function (option) {
|
|
1160
|
+
if (value.includes(option.value)) {
|
|
1161
|
+
setValue(function (prev) { return prev.filter(function (elem) { return elem !== option.value; }); });
|
|
1162
|
+
}
|
|
1163
|
+
else {
|
|
1164
|
+
setValue(function (prev) { return __spreadArray(__spreadArray([], prev, true), [option.value], false); });
|
|
1165
|
+
}
|
|
1166
|
+
if (handleChange) {
|
|
1167
|
+
handleChange(option.value);
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
return (jsx(InputSelectBase, __assign({ options: options, handleChange: handleSelect, error: error, selectedLabel: selectedLabel, selectedValue: value, name: name, isLabelShrink: !!selectedLabel, renderOption: function (option, selectedValue) { return (jsx(InputMultiSelectOption, { option: option, selectedValue: selectedValue })); } }, inputProps)));
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
var RadioButtons = forwardRef(function (_a, ref) {
|
|
1174
|
+
var options = _a.options, disabled = _a.disabled, direction = _a.direction, defaultValue = _a.defaultValue, valueOfProps = _a.value, onChange = _a.onChange, isSquare = _a.isSquare, otherProps = __rest(_a, ["options", "disabled", "direction", "defaultValue", "value", "onChange", "isSquare"]);
|
|
1175
|
+
var _b = useState(defaultValue || valueOfProps || options[0].value), value = _b[0], setValue = _b[1];
|
|
1176
|
+
var handleChange = function (e) {
|
|
1177
|
+
var radioValue = e.target.value;
|
|
1178
|
+
setValue(radioValue);
|
|
1179
|
+
if (onChange) {
|
|
1180
|
+
onChange(e, radioValue);
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
var handleClick = function (e) {
|
|
1184
|
+
var radioValue = e.target.value;
|
|
1185
|
+
if (String(value) === String(radioValue)) {
|
|
1186
|
+
setValue(null);
|
|
1187
|
+
if (onChange) {
|
|
1188
|
+
onChange(e, null);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
useEffect(function () {
|
|
1193
|
+
if (valueOfProps) {
|
|
1194
|
+
setValue(valueOfProps);
|
|
1195
|
+
}
|
|
1196
|
+
}, [valueOfProps]);
|
|
1197
|
+
return (jsx(Grid, __assign({ container: true, direction: direction, ref: ref }, { children: options.map(function (option) { return (jsx(Radio, __assign({ value: option.value, label: option.label, disabled: Boolean(disabled), checked: String(value) === String(option.value), isSquare: isSquare, onClick: handleClick, onChange: handleChange }, otherProps), option.value)); }) })));
|
|
1198
|
+
});
|
|
1199
|
+
RadioButtons.defaultProps = {
|
|
1200
|
+
disabled: false,
|
|
1201
|
+
direction: "row",
|
|
1202
|
+
fullWidth: false,
|
|
1203
|
+
defaultValue: undefined,
|
|
1204
|
+
};
|
|
1205
|
+
RadioButtons.displayName = "RadioButtons";
|
|
1206
|
+
|
|
1207
|
+
function RadioButtonsWithController(_a) {
|
|
1208
|
+
var form = _a.form, name = _a.name, defaultValue = _a.defaultValue, otherProps = __rest(_a, ["form", "name", "defaultValue"]);
|
|
1209
|
+
var handleChange = function (e, value, field) {
|
|
1210
|
+
field.onChange({ target: { value: value, name: name }, type: "change" });
|
|
1211
|
+
if (otherProps.onChange) {
|
|
1212
|
+
otherProps.onChange(e, value);
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
useEffect(function () {
|
|
1216
|
+
if (!form.getValues(name) && !defaultValue) {
|
|
1217
|
+
form.setValue(name, otherProps.options[0].value);
|
|
1218
|
+
}
|
|
1219
|
+
}, []);
|
|
1220
|
+
return (jsx(Controller, { control: form.control, name: String(name), render: function (_a) {
|
|
1221
|
+
var field = _a.field;
|
|
1222
|
+
return (jsx(RadioButtons, __assign({}, otherProps, field, { defaultValue: defaultValue, onChange: function (e, value) {
|
|
1223
|
+
return handleChange(e, value, field);
|
|
1224
|
+
} })));
|
|
1225
|
+
} }));
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
function RadioGroupWithLabel(props) {
|
|
1229
|
+
var _a;
|
|
1230
|
+
var title = props.title, className = props.className, direction = props.direction, form = props.form, name = props.name, otherProps = __rest(props, ["title", "className", "direction", "form", "name"]);
|
|
1231
|
+
var fieldState = useController({
|
|
1232
|
+
control: form.control,
|
|
1233
|
+
name: name,
|
|
1234
|
+
}).fieldState;
|
|
1235
|
+
var errorMessage = (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
1236
|
+
return (jsxs$1(StyledContainer, { children: [jsxs$1(StyledWrapper, __assign({ container: true, alignItems: direction === "vertical" ? "flex-start" : "center", justify: "space-between", direction: direction === "vertical" ? "column" : "row", hasError: !!errorMessage, className: className, withTitle: !!title }, { children: [title && (jsx(StyledTitle, __assign({ direction: direction, size: "xs", weight: 600 }, { children: title.toUpperCase() }))), jsx(Grid, __assign({ item: true }, { children: jsx(RadioButtonsWithController, __assign({ form: form, name: name }, otherProps)) }))] })), errorMessage && jsx(InputMessage, { variant: "error", msg: errorMessage })] }));
|
|
1237
|
+
}
|
|
1238
|
+
var StyledContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
|
|
1239
|
+
var columnDirectionCSS = function (_a) {
|
|
1240
|
+
var hasError = _a.hasError;
|
|
1241
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 12px 15px 15px;\n border-radius: ", ";\n"], ["\n padding: 12px 15px 15px;\n border-radius: ", ";\n"])), hasError ? "8px 8px 0 0" : "8px");
|
|
1242
|
+
};
|
|
1243
|
+
var rowDirectionCSS = function (_a) {
|
|
1244
|
+
var hasError = _a.hasError, withTitle = _a.withTitle;
|
|
1245
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", ";\n border-radius: ", ";\n"], ["\n padding: ", ";\n border-radius: ", ";\n"])), withTitle ? "3px 4px 3px 16px" : "3px", hasError ? "66px 66px 0 0" : "66px");
|
|
1246
|
+
};
|
|
1247
|
+
var StyledWrapper = styled(Grid, {
|
|
1248
|
+
shouldForwardProp: function (prop) { return prop !== "hasError" && prop !== "withTitle"; },
|
|
1249
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border: 1px solid\n ", ";\n ", ";\n"], ["\n border: 1px solid\n ", ";\n ", ";\n"])), function (_a) {
|
|
1250
|
+
var hasError = _a.hasError;
|
|
1251
|
+
return hasError ? theme.palette.red.fiftyP : theme.palette.grey.fifteenB;
|
|
1252
|
+
}, function (_a) {
|
|
1253
|
+
var direction = _a.direction, hasError = _a.hasError, withTitle = _a.withTitle;
|
|
1254
|
+
return direction === "column"
|
|
1255
|
+
? columnDirectionCSS({ hasError: hasError })
|
|
1256
|
+
: rowDirectionCSS({ hasError: hasError, withTitle: withTitle });
|
|
1257
|
+
});
|
|
1258
|
+
var StyledTitle = styled(Caption)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-bottom: ", "px;\n"], ["\n margin-bottom: ", "px;\n"])), function (_a) {
|
|
1259
|
+
var direction = _a.direction;
|
|
1260
|
+
return (direction === "vertical" ? 8 : 0);
|
|
1261
|
+
});
|
|
1262
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
1106
1263
|
|
|
1107
|
-
export { Avatar, ButtonSelect, ButtonTab, ButtonsPanel, CalendarHeaderWithSelect, CalendarStandardContainer, CalendarStandardHeader, DesktopInputWithMonthPicker, DesktopMenuPanel, InputDropdown, InputForDatepicker, InputPassword, InputPhoneWithForm, InputSelect, InputSelectDropdown, InputTextAreaMobile, InputWithController, InputWithDatePicker, InputWithMask, InputWithMonthPicker, MenuItem, MenuPanel, MobileInputWithMonthPicker, MobileMenuPanel, MonthPickerContainer, MonthPickerHeader, PassportStrengthBar, SelectMonth, SelectYear, Switch, Table, TableCell, TableHeadCell, TableRow, Tooltip, UndefinedAvatar };
|
|
1264
|
+
export { Avatar, ButtonSelect, ButtonTab, ButtonsPanel, CalendarHeaderWithSelect, CalendarStandardContainer, CalendarStandardHeader, DesktopInputWithMonthPicker, DesktopMenuPanel, InputDropdown, InputForDatepicker, InputMultiSelect, InputPassword, InputPhoneWithForm, InputSelect, InputSelectDropdown, InputSelectWithController, InputTextAreaMobile, InputWithController, InputWithDatePicker, InputWithMask, InputWithMonthPicker, MenuItem, MenuPanel, MobileInputWithMonthPicker, MobileMenuPanel, MonthPickerContainer, MonthPickerHeader, PassportStrengthBar, RadioButtons, RadioButtonsWithController, RadioGroupWithLabel, SelectMonth, SelectYear, Switch, Table, TableCell, TableHeadCell, TableRow, Tooltip, UndefinedAvatar };
|
|
1108
1265
|
//# sourceMappingURL=index.js.map
|