kui-complex 0.0.54 → 0.0.55
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 +44 -22
- package/ButtonSelect/cjs/index.js.map +1 -1
- package/ButtonSelect/index.js +45 -23
- package/ButtonSelect/index.js.map +1 -1
- package/CalendarHeaderWithSelect/cjs/index.js +46 -24
- package/CalendarHeaderWithSelect/cjs/index.js.map +1 -1
- package/CalendarHeaderWithSelect/index.js +47 -25
- package/CalendarHeaderWithSelect/index.js.map +1 -1
- package/InputDropdown/cjs/index.js +38 -10
- package/InputDropdown/cjs/index.js.map +1 -1
- package/InputDropdown/index.d.ts +1 -1
- package/InputDropdown/index.js +35 -11
- package/InputDropdown/index.js.map +1 -1
- package/InputSelect/cjs/index.js +43 -20
- package/InputSelect/cjs/index.js.map +1 -1
- package/InputSelect/index.js +44 -21
- package/InputSelect/index.js.map +1 -1
- package/InputSelectDropdown/cjs/index.js +37 -14
- package/InputSelectDropdown/cjs/index.js.map +1 -1
- package/InputSelectDropdown/index.d.ts +7 -7
- package/InputSelectDropdown/index.js +38 -15
- package/InputSelectDropdown/index.js.map +1 -1
- package/InputWithDatePicker/cjs/index.js +39 -17
- package/InputWithDatePicker/cjs/index.js.map +1 -1
- package/InputWithDatePicker/index.js +39 -17
- package/InputWithDatePicker/index.js.map +1 -1
- package/SelectMonth/cjs/index.js +44 -22
- package/SelectMonth/cjs/index.js.map +1 -1
- package/SelectMonth/index.js +45 -23
- package/SelectMonth/index.js.map +1 -1
- package/SelectYear/cjs/index.js +44 -22
- package/SelectYear/cjs/index.js.map +1 -1
- package/SelectYear/index.js +45 -23
- package/SelectYear/index.js.map +1 -1
- package/TestForm/cjs/index.js +39 -17
- package/TestForm/cjs/index.js.map +1 -1
- package/TestForm/index.js +40 -18
- package/TestForm/index.js.map +1 -1
- package/cjs/index.js +46 -24
- package/cjs/index.js.map +1 -1
- package/index.d.ts +7 -7
- package/index.js +47 -25
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -140,13 +140,13 @@ declare const InputPassword: React.ForwardRefExoticComponent<InputWithController
|
|
|
140
140
|
|
|
141
141
|
declare const InputSelect: React.ForwardRefExoticComponent<Pick<InputSelectProps<any>, "label" | "size" | "color" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "form" | "pattern" | "height" | "width" | "list" | "step" | "alt" | "crossOrigin" | "src" | "type" | "endIcon" | "startIcon" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "options" | "inputRef" | "message" | "required" | "min" | "max" | "maxLength" | "minLength" | "cornerLabel" | "isTextArea" | "inputStyles" | "labelStyles" | "messageClassName" | "labelInlineStyles" | "messageVariant" | "inputValue" | "accept" | "autoComplete" | "capture" | "checked" | "enterKeyHint" | "multiple" | "readOnly" | "handleChange" | "isLoading" | "iconProps"> & React.RefAttributes<HTMLInputElement>>;
|
|
142
142
|
|
|
143
|
-
type InputSelectDropdownProps = {
|
|
144
|
-
options: OptionParams[]
|
|
145
|
-
inputRef: RefObject<HTMLInputElement | HTMLDivElement>
|
|
146
|
-
isOpenDropdown: boolean
|
|
147
|
-
handleCloseDropdown: () => void
|
|
148
|
-
handleSelect: (item: any) => void
|
|
149
|
-
selectedValue?: string | number | FieldValues
|
|
143
|
+
type InputSelectDropdownProps = {
|
|
144
|
+
options: OptionParams[]
|
|
145
|
+
inputRef: RefObject<HTMLInputElement | HTMLDivElement>
|
|
146
|
+
isOpenDropdown: boolean
|
|
147
|
+
handleCloseDropdown: () => void
|
|
148
|
+
handleSelect: (item: any) => void
|
|
149
|
+
selectedValue?: string | number | FieldValues
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
/** @jsxImportSource @emotion/react */
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx as jsx$1, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import { css, Global } from '@emotion/react';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import { forwardRef, useEffect,
|
|
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
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';
|
|
10
10
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -83,19 +83,19 @@ var Avatar = forwardRef(function (props, ref) {
|
|
|
83
83
|
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
84
|
});
|
|
85
85
|
var Wrapper$7 = styled.div(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\n border-radius: 50%;\n overflow: hidden;\n cursor: pointer;\n"], ["\n border-radius: 50%;\n overflow: hidden;\n cursor: pointer;\n"])));
|
|
86
|
-
var StyledImage = styled.img(templateObject_2$
|
|
86
|
+
var StyledImage = styled.img(templateObject_2$g || (templateObject_2$g = __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
87
|
var largeAvatarCSS = function (_a) {
|
|
88
88
|
var avatarSize = _a.avatarSize;
|
|
89
89
|
return avatarSize === "lg" && css(templateObject_3$6 || (templateObject_3$6 = __makeTemplateObject(["\n font-size: 32px;\n "], ["\n font-size: 32px;\n "])));
|
|
90
90
|
};
|
|
91
91
|
var StyledUndefinedAvatar = styled(UndefinedAvatar, {
|
|
92
92
|
shouldForwardProp: function (prop) { return prop !== "size"; },
|
|
93
|
-
})(templateObject_4$
|
|
93
|
+
})(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), largeAvatarCSS);
|
|
94
94
|
var sizeStyles = {
|
|
95
95
|
s: css(templateObject_5$1 || (templateObject_5$1 = __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
96
|
lg: css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: 80px;\n height: 80px;\n "], ["\n width: 80px;\n height: 80px;\n "]))),
|
|
97
97
|
};
|
|
98
|
-
var templateObject_1$t, templateObject_2$
|
|
98
|
+
var templateObject_1$t, templateObject_2$g, templateObject_3$6, templateObject_4$4, templateObject_5$1, templateObject_6;
|
|
99
99
|
|
|
100
100
|
var ButtonTab = forwardRef(function (_a, ref) {
|
|
101
101
|
var index = _a.index, onClick = _a.onClick, isActive = _a.isActive, label = _a.label;
|
|
@@ -105,8 +105,8 @@ var ButtonTab = forwardRef(function (_a, ref) {
|
|
|
105
105
|
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
106
|
});
|
|
107
107
|
var StyledButton = styled(Button)(templateObject_1$s || (templateObject_1$s = __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"])));
|
|
108
|
-
var inactiveStyles = css(templateObject_2$
|
|
109
|
-
var templateObject_1$s, templateObject_2$
|
|
108
|
+
var inactiveStyles = css(templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["\n p {\n color: ", ";\n }\n"], ["\n p {\n color: ", ";\n }\n"])), theme.palette.grey.seventy);
|
|
109
|
+
var templateObject_1$s, templateObject_2$f;
|
|
110
110
|
|
|
111
111
|
var ButtonsPanel = forwardRef(function (_a, ref) {
|
|
112
112
|
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"]);
|
|
@@ -130,15 +130,12 @@ ButtonsPanel.defaultProps = {
|
|
|
130
130
|
isSticky: false,
|
|
131
131
|
};
|
|
132
132
|
var Content = styled.div(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\n height: 100%;\n"], ["\n height: 100%;\n"])));
|
|
133
|
-
var StyledContainer$1 = styled.div(templateObject_2$
|
|
134
|
-
var templateObject_1$r, templateObject_2$
|
|
133
|
+
var StyledContainer$1 = styled.div(templateObject_2$e || (templateObject_2$e = __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);
|
|
134
|
+
var templateObject_1$r, templateObject_2$e;
|
|
135
135
|
|
|
136
|
-
var
|
|
137
|
-
var isOpen =
|
|
138
|
-
|
|
139
|
-
};
|
|
140
|
-
var InputDropdown = forwardRef(function (_a, ref) {
|
|
141
|
-
var isOpen = _a.isOpen, handleClose = _a.handleClose, buttonRef = _a.buttonRef, children = _a.children, otherProps = __rest(_a, ["isOpen", "handleClose", "buttonRef", "children"]);
|
|
136
|
+
var InputDropdown = forwardRef(function (props, ref) {
|
|
137
|
+
var isOpen = props.isOpen, handleClose = props.handleClose, buttonRef = props.buttonRef, children = props.children, otherProps = __rest(props, ["isOpen", "handleClose", "buttonRef", "children"]);
|
|
138
|
+
var _a = useState(false), isScrollable = _a[0], setIsScrollable = _a[1];
|
|
142
139
|
var dropdownRef = useRef(null);
|
|
143
140
|
var closePopUp = function (e) {
|
|
144
141
|
if (dropdownRef.current && buttonRef && buttonRef.current) {
|
|
@@ -154,6 +151,22 @@ var InputDropdown = forwardRef(function (_a, ref) {
|
|
|
154
151
|
document.removeEventListener("click", closePopUp);
|
|
155
152
|
};
|
|
156
153
|
});
|
|
154
|
+
useEffect(function () {
|
|
155
|
+
var _a;
|
|
156
|
+
if (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) {
|
|
157
|
+
if (isOpen) {
|
|
158
|
+
buttonRef.current.style.zIndex = "4";
|
|
159
|
+
var scrollContainer = (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.children[0];
|
|
160
|
+
if (scrollContainer) {
|
|
161
|
+
var hasScroll = scrollContainer.scrollHeight > scrollContainer.clientHeight;
|
|
162
|
+
setIsScrollable(hasScroll);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
buttonRef.current.style.zIndex = "1";
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, [isOpen]);
|
|
157
170
|
if (!isOpen) {
|
|
158
171
|
return null;
|
|
159
172
|
}
|
|
@@ -164,9 +177,20 @@ var InputDropdown = forwardRef(function (_a, ref) {
|
|
|
164
177
|
ref.current = elem;
|
|
165
178
|
dropdownRef.current = elem;
|
|
166
179
|
};
|
|
167
|
-
return (jsx$1
|
|
180
|
+
return (jsx(StyledDropdown$1, __assign({ "data-testid": "input_dropdown", container: true, ref: forwardedRef, isOpen: isOpen, isScrollable: isScrollable }, otherProps, { children: jsx(ScrollingContainer, __assign({ isScrollable: isScrollable, className: "KUI-InputDropdown_scroll" }, { children: children })) })));
|
|
181
|
+
});
|
|
182
|
+
var StyledDropdown$1 = styled(Grid)(templateObject_1$q || (templateObject_1$q = __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 padding: ", ";\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 padding: ", ";\n"])), function (_a) {
|
|
183
|
+
var isOpen = _a.isOpen;
|
|
184
|
+
return (isOpen ? "flex" : "none");
|
|
185
|
+
}, theme.palette.grey.zero, function (_a) {
|
|
186
|
+
var isScrollable = _a.isScrollable;
|
|
187
|
+
return isScrollable ? "14px 8px 8px 0" : "14px 0px 8px 0";
|
|
168
188
|
});
|
|
169
|
-
var
|
|
189
|
+
var ScrollingContainer = styled.div(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["\n width: 100%;\n max-height: 389px;\n z-index: 3;\n overflow: auto;\n -ms-overflow-style: none;\n overflow-y: scroll;\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 z-index: 3;\n overflow: auto;\n -ms-overflow-style: none;\n overflow-y: scroll;\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) {
|
|
190
|
+
var isScrollable = _a.isScrollable;
|
|
191
|
+
return (isScrollable ? "4px" : "0px");
|
|
192
|
+
}, theme.palette.grey.fifteenB, theme.palette.grey.thirty);
|
|
193
|
+
var templateObject_1$q, templateObject_2$d;
|
|
170
194
|
|
|
171
195
|
var InputSelectDropdown = forwardRef(function (_a, ref) {
|
|
172
196
|
var options = _a.options, inputRef = _a.inputRef, isOpenDropdown = _a.isOpenDropdown, handleCloseDropdown = _a.handleCloseDropdown, handleSelect = _a.handleSelect, selectedValue = _a.selectedValue;
|
|
@@ -194,15 +218,13 @@ var InputSelectDropdown = forwardRef(function (_a, ref) {
|
|
|
194
218
|
}
|
|
195
219
|
dropdownRef.current = elem;
|
|
196
220
|
};
|
|
197
|
-
return (jsx$1(
|
|
198
|
-
maxHeight: "142px",
|
|
199
|
-
padding: "4px",
|
|
200
|
-
} }, { children: options.map(function (option, key) { return (jsx$1(OptionWrapper, __assign({ onClick: function () { return handleSelect(option); }, "data-value": "autocomplete_option_".concat(option.value), "data-testid": "autocomplete_option_".concat(key) }, { children: jsx$1(StyledOption, __assign({ css: selectedValue === option.value && selectedStyles }, { children: jsx$1(Caption, __assign({ size: "sm", weight: 500 }, { children: option.label })) })) }), option.label)); }) })));
|
|
221
|
+
return (jsx$1(StyledDropdown, __assign({ ref: forwardedRef, buttonRef: inputRef, isOpen: isOpenDropdown, handleClose: handleCloseDropdown }, { children: options.map(function (option, key) { return (jsx$1(OptionWrapper, __assign({ onClick: function () { return handleSelect(option); }, "data-value": "autocomplete_option_".concat(option.value), "data-testid": "autocomplete_option_".concat(key) }, { children: jsx$1(StyledOption, __assign({ css: selectedValue === option.value && selectedStyles }, { children: jsx$1(Caption, __assign({ size: "sm", weight: 500 }, { children: option.label })) })) }), option.label)); }) })));
|
|
201
222
|
});
|
|
202
223
|
var OptionWrapper = styled.div(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n width: 100%;\n padding: 2px 0;\n cursor: pointer;\n"], ["\n width: 100%;\n padding: 2px 0;\n cursor: pointer;\n"])));
|
|
203
224
|
var StyledOption = styled.div(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["\n padding: 8px;\n transition: all ease-out 0.3s;\n border-radius: 4px;\n &:hover {\n background-color: ", ";\n }\n"], ["\n padding: 8px;\n transition: all ease-out 0.3s;\n border-radius: 4px;\n &:hover {\n background-color: ", ";\n }\n"])), theme.palette.background.light1);
|
|
204
225
|
var selectedStyles = css(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n background-color: ", ";\n"], ["\n background-color: ", ";\n"])), theme.palette.background.light1);
|
|
205
|
-
var
|
|
226
|
+
var StyledDropdown = styled(InputDropdown)(templateObject_4$3 || (templateObject_4$3 = __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"])));
|
|
227
|
+
var templateObject_1$p, templateObject_2$c, templateObject_3$5, templateObject_4$3;
|
|
206
228
|
|
|
207
229
|
var getFormValue = function (name, form) {
|
|
208
230
|
var names = name === null || name === void 0 ? void 0 : name.split(".");
|
|
@@ -227,10 +249,10 @@ var getFormError = function (name, form) {
|
|
|
227
249
|
};
|
|
228
250
|
|
|
229
251
|
var InputSelect = forwardRef(function (props, ref) {
|
|
230
|
-
var _a, _b
|
|
252
|
+
var _a, _b;
|
|
231
253
|
var options = props.options, name = props.name, handleChange = props.handleChange, form = props.form, iconProps = props.iconProps, defaultValue = props.value, other = __rest(props, ["options", "name", "handleChange", "form", "iconProps", "value"]);
|
|
232
|
-
var
|
|
233
|
-
var
|
|
254
|
+
var _c = useState(false), isOpenDropdown = _c[0], setIsOpenDropDown = _c[1];
|
|
255
|
+
var _d = useState(defaultValue || getFormValue(name, form)), value = _d[0], setValue = _d[1];
|
|
234
256
|
var error = getFormError(name, form);
|
|
235
257
|
var inputRef = useRef(null);
|
|
236
258
|
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;
|
|
@@ -272,7 +294,7 @@ var InputSelect = forwardRef(function (props, ref) {
|
|
|
272
294
|
{ transition: "all linear .2s" },
|
|
273
295
|
isOpenDropdown && { transform: "rotate(180deg)" },
|
|
274
296
|
] }, iconProps))) }, register, { ref: forwardedRef })), options && options.length > 0 && !props.disabled && (jsx$1(InputSelectDropdown, { options: options, inputRef: {
|
|
275
|
-
current: (
|
|
297
|
+
current: (_b = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _b === void 0 ? void 0 : _b.parentElement,
|
|
276
298
|
}, isOpenDropdown: isOpenDropdown, handleCloseDropdown: handleCloseDropdown, handleSelect: handleSelect, selectedValue: value }))] }));
|
|
277
299
|
});
|
|
278
300
|
var Wrapper$6 = styled.div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n position: relative;\n text-align: left;\n width: fit-content;\n"], ["\n position: relative;\n text-align: left;\n width: fit-content;\n"])));
|