kui-complex 0.0.112 → 0.0.114
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 +17 -31
- package/ButtonSelect/cjs/index.js.map +1 -1
- package/ButtonSelect/index.js +19 -33
- package/ButtonSelect/index.js.map +1 -1
- package/CalendarHeaderWithSelect/cjs/index.js +17 -31
- package/CalendarHeaderWithSelect/cjs/index.js.map +1 -1
- package/CalendarHeaderWithSelect/index.js +19 -33
- package/CalendarHeaderWithSelect/index.js.map +1 -1
- package/InputDropdown/cjs/index.js +10 -24
- package/InputDropdown/cjs/index.js.map +1 -1
- package/InputDropdown/index.d.ts +2 -1
- package/InputDropdown/index.js +12 -26
- package/InputDropdown/index.js.map +1 -1
- package/InputMultiSelect/cjs/index.js +17 -31
- package/InputMultiSelect/cjs/index.js.map +1 -1
- package/InputMultiSelect/index.js +19 -33
- package/InputMultiSelect/index.js.map +1 -1
- package/InputSelect/cjs/index.js +17 -31
- package/InputSelect/cjs/index.js.map +1 -1
- package/InputSelect/index.js +19 -33
- package/InputSelect/index.js.map +1 -1
- package/InputSelectBase/cjs/index.js +17 -31
- package/InputSelectBase/cjs/index.js.map +1 -1
- package/InputSelectBase/index.js +19 -33
- package/InputSelectBase/index.js.map +1 -1
- package/InputSelectDropdown/cjs/index.js +12 -26
- package/InputSelectDropdown/cjs/index.js.map +1 -1
- package/InputSelectDropdown/index.d.ts +2 -1
- package/InputSelectDropdown/index.js +14 -28
- package/InputSelectDropdown/index.js.map +1 -1
- package/InputSelectWithController/cjs/index.js +17 -31
- package/InputSelectWithController/cjs/index.js.map +1 -1
- package/InputSelectWithController/index.js +19 -33
- package/InputSelectWithController/index.js.map +1 -1
- package/InputWithAutocomplete/cjs/index.js +17 -29
- package/InputWithAutocomplete/cjs/index.js.map +1 -1
- package/InputWithAutocomplete/index.js +18 -30
- package/InputWithAutocomplete/index.js.map +1 -1
- package/InputWithDatePicker/cjs/index.js +17 -31
- package/InputWithDatePicker/cjs/index.js.map +1 -1
- package/InputWithDatePicker/index.js +18 -32
- package/InputWithDatePicker/index.js.map +1 -1
- package/SelectMonth/cjs/index.js +17 -31
- package/SelectMonth/cjs/index.js.map +1 -1
- package/SelectMonth/index.js +19 -33
- package/SelectMonth/index.js.map +1 -1
- package/SelectYear/cjs/index.js +17 -31
- package/SelectYear/cjs/index.js.map +1 -1
- package/SelectYear/index.js +19 -33
- package/SelectYear/index.js.map +1 -1
- package/TestForm/cjs/index.js +17 -31
- package/TestForm/cjs/index.js.map +1 -1
- package/TestForm/index.js +18 -32
- package/TestForm/index.js.map +1 -1
- package/cjs/index.js +26 -38
- package/cjs/index.js.map +1 -1
- package/index.d.ts +3 -1
- package/index.js +27 -39
- package/index.js.map +1 -1
- package/package.json +1 -1
package/TestForm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Controller, useController, useForm } from 'react-hook-form';
|
|
|
3
3
|
import * as yup from 'yup';
|
|
4
4
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
5
5
|
import { forwardRef, useState, useRef, useEffect } from 'react';
|
|
6
|
-
import { InputWithAdornments, Grid, theme, Caption, InputWithMask as InputWithMask$1, Divider, Button, Modal, IconButton, InputWithCountryDropdown, Switch as Switch$1, LinearProgress } from 'kui-basic';
|
|
6
|
+
import { InputWithAdornments, Tooltip, Grid, theme, Caption, InputWithMask as InputWithMask$1, Divider, Button, Modal, IconButton, InputWithCountryDropdown, Switch as Switch$1, LinearProgress } from 'kui-basic';
|
|
7
7
|
import { jsxs as jsxs$1, jsx as jsx$1, Fragment } from '@emotion/react/jsx-runtime';
|
|
8
8
|
import styled from '@emotion/styled';
|
|
9
9
|
import { HalfArrowIcon, CalendarIcon, CheckIcon, ArrowBackIcon, ArrowNextIcon, ClosedEyeIcon, OpenEyeIcon } from 'kui-icon';
|
|
@@ -81,23 +81,14 @@ var InputWithController = forwardRef(function (_a, ref) {
|
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
var InputDropdown = forwardRef(function (props, ref) {
|
|
84
|
-
var isOpen = props.isOpen, handleClose = props.handleClose, buttonRef = props.buttonRef, children = props.children, endComponent = props.endComponent, otherProps = __rest(props, ["isOpen", "handleClose", "buttonRef", "children", "endComponent"]);
|
|
84
|
+
var isOpen = props.isOpen, handleClose = props.handleClose, buttonRef = props.buttonRef, children = props.children, endComponent = props.endComponent, input = props.input, className = props.className, otherProps = __rest(props, ["isOpen", "handleClose", "buttonRef", "children", "endComponent", "input", "className"]);
|
|
85
85
|
var _a = useState(false), isScrollable = _a[0], setIsScrollable = _a[1];
|
|
86
86
|
var dropdownRef = useRef(null);
|
|
87
|
-
var
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
!buttonRef.current.contains(e.target)) {
|
|
91
|
-
handleClose();
|
|
92
|
-
}
|
|
87
|
+
var handleChange = function (open) {
|
|
88
|
+
if (!open) {
|
|
89
|
+
handleClose();
|
|
93
90
|
}
|
|
94
91
|
};
|
|
95
|
-
useEffect(function () {
|
|
96
|
-
document.addEventListener("click", closePopUp);
|
|
97
|
-
return function () {
|
|
98
|
-
document.removeEventListener("click", closePopUp);
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
92
|
useEffect(function () {
|
|
102
93
|
var _a;
|
|
103
94
|
if (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) {
|
|
@@ -114,9 +105,6 @@ var InputDropdown = forwardRef(function (props, ref) {
|
|
|
114
105
|
}
|
|
115
106
|
}
|
|
116
107
|
}, [isOpen]);
|
|
117
|
-
if (!isOpen) {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
108
|
var forwardedRef = function (elem) {
|
|
121
109
|
if (typeof ref === "function")
|
|
122
110
|
ref(elem);
|
|
@@ -124,30 +112,28 @@ var InputDropdown = forwardRef(function (props, ref) {
|
|
|
124
112
|
ref.current = elem;
|
|
125
113
|
dropdownRef.current = elem;
|
|
126
114
|
};
|
|
127
|
-
return (jsxs(StyledDropdown$1, __assign({ "data-testid": "input_dropdown", container: true, ref: forwardedRef
|
|
115
|
+
return (jsx(StyledTooltip, __assign({ fullWidth: true, open: isOpen, onChange: handleChange, toggleMethod: "controlled", strategy: "fixed", placement: "bottom", className: className, content: jsxs(StyledDropdown$1, __assign({ "data-testid": "input_dropdown", container: true, ref: forwardedRef }, otherProps, { children: [jsx(StyledWrapper, __assign({ isScrollable: isScrollable }, { children: jsx(ScrollingContainer, __assign({ isScrollable: isScrollable, className: "KUI-InputDropdown_scroll" }, { children: children })) })), endComponent] })) }, { children: input })));
|
|
128
116
|
});
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}, theme.palette.grey.zero);
|
|
133
|
-
var StyledWrapper = styled.div(templateObject_2$7 || (templateObject_2$7 = __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) {
|
|
117
|
+
var StyledTooltip = styled(Tooltip)(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n .KUI-Popper {\n max-width: unset;\n > div {\n user-select: none;\n padding: 0;\n border-radius: 0 0 8px 8px;\n box-shadow: 0px 26px 34px 0px #0000001a;\n }\n }\n"], ["\n .KUI-Popper {\n max-width: unset;\n > div {\n user-select: none;\n padding: 0;\n border-radius: 0 0 8px 8px;\n box-shadow: 0px 26px 34px 0px #0000001a;\n }\n }\n"])));
|
|
118
|
+
var StyledDropdown$1 = styled(Grid)(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n width: 100%;\n user-select: none;\n"], ["\n width: 100%;\n user-select: none;\n"])));
|
|
119
|
+
var StyledWrapper = styled.div(templateObject_3$3 || (templateObject_3$3 = __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) {
|
|
134
120
|
var isScrollable = _a.isScrollable;
|
|
135
121
|
return isScrollable ? "14px 8px 8px 0" : "14px 0px 8px 0";
|
|
136
122
|
});
|
|
137
|
-
var ScrollingContainer = styled.div(
|
|
123
|
+
var ScrollingContainer = styled.div(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n width: 100%;\n max-height: 389px;\n box-sizing: border-box;\n z-index: 3;\n overflow: auto;\n -ms-overflow-style: none;\n overflow-y: scroll;\n overflow-x: hidden;\n user-select: none;\n ::-webkit-scrollbar {\n width: ", ";\n position: absolute;\n right: 8px;\n }\n ::-webkit-scrollbar-track,\n ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n transition: all ease-out 0.3s;\n }\n\n ::-webkit-resizer,\n ::-webkit-scrollbar-button,\n ::-webkit-scrollbar-corner {\n display: none;\n }\n ::-webkit-scrollbar-track {\n background: ", ";\n }\n\n ::-webkit-scrollbar-thumb {\n background: ", ";\n }\n"], ["\n width: 100%;\n max-height: 389px;\n box-sizing: border-box;\n z-index: 3;\n overflow: auto;\n -ms-overflow-style: none;\n overflow-y: scroll;\n overflow-x: hidden;\n user-select: none;\n ::-webkit-scrollbar {\n width: ", ";\n position: absolute;\n right: 8px;\n }\n ::-webkit-scrollbar-track,\n ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n transition: all ease-out 0.3s;\n }\n\n ::-webkit-resizer,\n ::-webkit-scrollbar-button,\n ::-webkit-scrollbar-corner {\n display: none;\n }\n ::-webkit-scrollbar-track {\n background: ", ";\n }\n\n ::-webkit-scrollbar-thumb {\n background: ", ";\n }\n"])), function (_a) {
|
|
138
124
|
var isScrollable = _a.isScrollable;
|
|
139
125
|
return (isScrollable ? "4px" : "0px");
|
|
140
126
|
}, theme.palette.grey.fifteenB, theme.palette.grey.thirty);
|
|
141
|
-
var templateObject_1$e, templateObject_2$7, templateObject_3$3;
|
|
127
|
+
var templateObject_1$e, templateObject_2$7, templateObject_3$3, templateObject_4$2;
|
|
142
128
|
|
|
143
129
|
var InputSelectDropdown = forwardRef(function (_a, ref) {
|
|
144
|
-
var options = _a.options, inputRef = _a.inputRef, isOpenDropdown = _a.isOpenDropdown, handleCloseDropdown = _a.handleCloseDropdown, handleSelect = _a.handleSelect, selectedValue = _a.selectedValue, renderOption = _a.renderOption;
|
|
130
|
+
var input = _a.input, options = _a.options, inputRef = _a.inputRef, isOpenDropdown = _a.isOpenDropdown, handleCloseDropdown = _a.handleCloseDropdown, handleSelect = _a.handleSelect, selectedValue = _a.selectedValue, renderOption = _a.renderOption;
|
|
145
131
|
var handleClick = function (option) {
|
|
146
132
|
if (!option.disabled) {
|
|
147
133
|
handleSelect(option);
|
|
148
134
|
}
|
|
149
135
|
};
|
|
150
|
-
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)); }) })));
|
|
136
|
+
return (jsx(StyledDropdown, __assign({ input: input, 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)); }) })));
|
|
151
137
|
});
|
|
152
138
|
var OptionWrapper = styled.div(templateObject_1$d || (templateObject_1$d = __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) {
|
|
153
139
|
var disabled = _a.disabled;
|
|
@@ -180,12 +166,12 @@ var InputSelectBase = forwardRef(function (_a, ref) {
|
|
|
180
166
|
handleChange(option);
|
|
181
167
|
handleCloseDropdown();
|
|
182
168
|
};
|
|
183
|
-
return (jsxs$1(Wrapper$4, { children: [jsx$1("input", { name: name, autoComplete: "off", hidden: true }),
|
|
184
|
-
{ transition: "all linear .2s" },
|
|
185
|
-
isDropdownOpen && { transform: "rotate(180deg)" },
|
|
186
|
-
] }, iconProps))) })), options.length > 0 && !disabled && (jsx$1(InputSelectDropdown, { options: options, inputRef: {
|
|
169
|
+
return (jsxs$1(Wrapper$4, { children: [jsx$1("input", { name: name, autoComplete: "off", hidden: true }), options.length > 0 && !disabled && (jsx$1(InputSelectDropdown, { options: options, inputRef: {
|
|
187
170
|
current: (_b = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _b === void 0 ? void 0 : _b.parentElement,
|
|
188
|
-
}, isOpenDropdown: isDropdownOpen, handleCloseDropdown: handleCloseDropdown, handleSelect: handleSelect, selectedValue: selectedValue, renderOption: renderOption
|
|
171
|
+
}, isOpenDropdown: isDropdownOpen, handleCloseDropdown: handleCloseDropdown, handleSelect: handleSelect, selectedValue: selectedValue, renderOption: renderOption, input: jsx$1(StyledInput, __assign({ onClick: handleOpenDropdown, ref: forwardedRef, 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: [
|
|
172
|
+
{ transition: "all linear .2s" },
|
|
173
|
+
isDropdownOpen && { transform: "rotate(180deg)" },
|
|
174
|
+
] }, iconProps))) })) }))] }));
|
|
189
175
|
});
|
|
190
176
|
var Wrapper$4 = styled.div(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n position: relative;\n text-align: left;\n"], ["\n position: relative;\n text-align: left;\n"])));
|
|
191
177
|
var StyledInput = styled(InputWithAdornments)(templateObject_2$5 || (templateObject_2$5 = __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) {
|