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.
Files changed (60) hide show
  1. package/ButtonSelect/cjs/index.js +17 -31
  2. package/ButtonSelect/cjs/index.js.map +1 -1
  3. package/ButtonSelect/index.js +19 -33
  4. package/ButtonSelect/index.js.map +1 -1
  5. package/CalendarHeaderWithSelect/cjs/index.js +17 -31
  6. package/CalendarHeaderWithSelect/cjs/index.js.map +1 -1
  7. package/CalendarHeaderWithSelect/index.js +19 -33
  8. package/CalendarHeaderWithSelect/index.js.map +1 -1
  9. package/InputDropdown/cjs/index.js +10 -24
  10. package/InputDropdown/cjs/index.js.map +1 -1
  11. package/InputDropdown/index.d.ts +2 -1
  12. package/InputDropdown/index.js +12 -26
  13. package/InputDropdown/index.js.map +1 -1
  14. package/InputMultiSelect/cjs/index.js +17 -31
  15. package/InputMultiSelect/cjs/index.js.map +1 -1
  16. package/InputMultiSelect/index.js +19 -33
  17. package/InputMultiSelect/index.js.map +1 -1
  18. package/InputSelect/cjs/index.js +17 -31
  19. package/InputSelect/cjs/index.js.map +1 -1
  20. package/InputSelect/index.js +19 -33
  21. package/InputSelect/index.js.map +1 -1
  22. package/InputSelectBase/cjs/index.js +17 -31
  23. package/InputSelectBase/cjs/index.js.map +1 -1
  24. package/InputSelectBase/index.js +19 -33
  25. package/InputSelectBase/index.js.map +1 -1
  26. package/InputSelectDropdown/cjs/index.js +12 -26
  27. package/InputSelectDropdown/cjs/index.js.map +1 -1
  28. package/InputSelectDropdown/index.d.ts +2 -1
  29. package/InputSelectDropdown/index.js +14 -28
  30. package/InputSelectDropdown/index.js.map +1 -1
  31. package/InputSelectWithController/cjs/index.js +17 -31
  32. package/InputSelectWithController/cjs/index.js.map +1 -1
  33. package/InputSelectWithController/index.js +19 -33
  34. package/InputSelectWithController/index.js.map +1 -1
  35. package/InputWithAutocomplete/cjs/index.js +17 -29
  36. package/InputWithAutocomplete/cjs/index.js.map +1 -1
  37. package/InputWithAutocomplete/index.js +18 -30
  38. package/InputWithAutocomplete/index.js.map +1 -1
  39. package/InputWithDatePicker/cjs/index.js +17 -31
  40. package/InputWithDatePicker/cjs/index.js.map +1 -1
  41. package/InputWithDatePicker/index.js +18 -32
  42. package/InputWithDatePicker/index.js.map +1 -1
  43. package/SelectMonth/cjs/index.js +17 -31
  44. package/SelectMonth/cjs/index.js.map +1 -1
  45. package/SelectMonth/index.js +19 -33
  46. package/SelectMonth/index.js.map +1 -1
  47. package/SelectYear/cjs/index.js +17 -31
  48. package/SelectYear/cjs/index.js.map +1 -1
  49. package/SelectYear/index.js +19 -33
  50. package/SelectYear/index.js.map +1 -1
  51. package/TestForm/cjs/index.js +17 -31
  52. package/TestForm/cjs/index.js.map +1 -1
  53. package/TestForm/index.js +18 -32
  54. package/TestForm/index.js.map +1 -1
  55. package/cjs/index.js +26 -38
  56. package/cjs/index.js.map +1 -1
  57. package/index.d.ts +3 -1
  58. package/index.js +27 -39
  59. package/index.js.map +1 -1
  60. 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 closePopUp = function (e) {
88
- if (dropdownRef.current && buttonRef && buttonRef.current) {
89
- if (!dropdownRef.current.contains(e.target) &&
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, isOpen: isOpen }, otherProps, { children: [jsx(StyledWrapper, __assign({ isScrollable: isScrollable }, { children: jsx(ScrollingContainer, __assign({ isScrollable: isScrollable, className: "KUI-InputDropdown_scroll" }, { children: children })) })), endComponent] })));
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 StyledDropdown$1 = styled(Grid)(templateObject_1$e || (templateObject_1$e = __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) {
130
- var isOpen = _a.isOpen;
131
- return (isOpen ? "flex" : "none");
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(templateObject_3$3 || (templateObject_3$3 = __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) {
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 }), 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: [
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) {