kui-complex 0.0.25 → 0.0.27

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/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { RefObject, SVGProps, ReactNode } from 'react';
4
4
  import * as kui_basic from 'kui-basic';
5
- import { InputWithAdornmentsProps, GridProps, InputWithMaskProps as InputWithMaskProps$1, SwitchProps, CaptionProps, InputWithCountryDropdownProps } from 'kui-basic';
5
+ import { InputWithAdornmentsProps, InputWithMaskProps as InputWithMaskProps$1, SwitchProps, CaptionProps, InputWithCountryDropdownProps } from 'kui-basic';
6
6
  import { UseFormReturn, FieldValues } from 'react-hook-form';
7
7
  import * as react_datepicker from 'react-datepicker';
8
8
  import * as _emotion_styled from '@emotion/styled';
@@ -109,15 +109,13 @@ type DesktopMenuPanelProps = {
109
109
 
110
110
  declare const DesktopMenuPanel: ({ tabs, variant, ...other }: DesktopMenuPanelProps) => _emotion_react_jsx_runtime.JSX.Element;
111
111
 
112
- type InputDropdownProps = {
113
- isOpen?: boolean
114
- handleClose: () => void
115
- buttonRef?: RefObject<HTMLDivElement>
116
- className?: string
117
- children: ReactNode | ReactNode[]
118
- } & GridProps
119
-
120
- declare const InputDropdown: ({ isOpen, handleClose, buttonRef, children, ...otherProps }: InputDropdownProps) => _emotion_react_jsx_runtime.JSX.Element | null;
112
+ declare const InputDropdown: React.ForwardRefExoticComponent<Pick<{
113
+ isOpen?: boolean | undefined;
114
+ handleClose: () => void;
115
+ buttonRef?: React.RefObject<HTMLDivElement> | undefined;
116
+ className?: string | undefined;
117
+ children: React.ReactNode | React.ReactNode[];
118
+ } & kui_basic.GridProps, "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" | "alignContent" | "alignItems" | "direction" | "xs" | "sm" | "lg" | "isOpen" | "handleClose" | "buttonRef" | "spacing" | "item" | "container" | "justify" | "wrap" | "md" | "xl"> & React.RefAttributes<HTMLDivElement>>;
121
119
 
122
120
  interface InputWithMaskProps
123
121
  extends Omit<InputWithMaskProps$1, "form"> {
package/dist/index.es.js CHANGED
@@ -6,7 +6,7 @@ import { css, Global } from '@emotion/react';
6
6
  import { jsx, jsxs as jsxs$1, Fragment as Fragment$1 } from 'react/jsx-runtime';
7
7
  import { theme, Caption, Button, Container, Grid, InputWithAdornments, Heading, IconButton, InputWithMask as InputWithMask$1, LinearProgress, Divider, Modal, Switch as Switch$1, InputWithCountryDropdown } from 'kui-basic';
8
8
  import * as React from 'react';
9
- import { useEffect, useRef, forwardRef, useState } from 'react';
9
+ import { useEffect, forwardRef, useRef, useState } from 'react';
10
10
  import { useHistory } from 'react-router-dom';
11
11
  import { HalfArrowIcon, PrevArrowIcon, NextArrowIcon, CalendarIcon, ArrowBackIcon, ArrowNextIcon, ClosedEyeIcon, OpenEyeIcon, CheckIcon } from 'kui-icon';
12
12
  import _ from 'lodash';
@@ -136,7 +136,7 @@ var dropdownStyles = function (_a) {
136
136
  var isOpen = _a.isOpen;
137
137
  return css(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n width: 100%;\n max-height: 389px;\n display: ", ";\n position: absolute;\n background: ", ";\n z-index: 3;\n border: 1px solid ", ";\n top: 64px;\n box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n overflow-y: scroll;\n user-select: none;\n &::-webkit-scrollbar {\n width: 0px;\n },\n"], ["\n width: 100%;\n max-height: 389px;\n display: ", ";\n position: absolute;\n background: ", ";\n z-index: 3;\n border: 1px solid ", ";\n top: 64px;\n box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n overflow-y: scroll;\n user-select: none;\n &::-webkit-scrollbar {\n width: 0px;\n },\n"])), isOpen ? "flex" : "none", theme.palette.grey.zero, theme.palette.grey.fifteenB);
138
138
  };
139
- var InputDropdown = function (_a) {
139
+ var InputDropdown = forwardRef(function (_a, ref) {
140
140
  var isOpen = _a.isOpen, handleClose = _a.handleClose, buttonRef = _a.buttonRef, children = _a.children, otherProps = __rest(_a, ["isOpen", "handleClose", "buttonRef", "children"]);
141
141
  var dropdownRef = useRef(null);
142
142
  var closePopUp = function (e) {
@@ -156,20 +156,35 @@ var InputDropdown = function (_a) {
156
156
  if (!isOpen) {
157
157
  return null;
158
158
  }
159
- return (jsx$1(Grid, __assign({ "data-testid": "input_dropdown", container: true, ref: dropdownRef, css: dropdownStyles({ isOpen: isOpen }) }, otherProps, { children: children })));
160
- };
159
+ var forwardedRef = function (elem) {
160
+ if (typeof ref === "function")
161
+ ref(elem);
162
+ else if (ref)
163
+ ref.current = elem;
164
+ dropdownRef.current = elem;
165
+ };
166
+ return (jsx$1(Grid, __assign({ "data-testid": "input_dropdown", container: true, ref: forwardedRef, css: dropdownStyles({ isOpen: isOpen }) }, otherProps, { children: children })));
167
+ });
161
168
  var templateObject_1$p;
162
169
 
163
170
  var InputSelectDropdown = function (_a) {
164
171
  var options = _a.options, inputRef = _a.inputRef, isOpenDropdown = _a.isOpenDropdown, handleCloseDropdown = _a.handleCloseDropdown, handleSelect = _a.handleSelect, selectedValue = _a.selectedValue;
172
+ var dropdownRef = useRef(null);
165
173
  useEffect(function () {
166
174
  var _a;
167
175
  if (isOpenDropdown) {
168
- (_a = document
169
- .querySelector("[data-value=autocomplete_option_".concat(selectedValue, "]"))) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
176
+ var element = document.querySelector("[data-value=autocomplete_option_".concat(selectedValue, "]"));
177
+ var coordinates = element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
178
+ if (coordinates && inputRef.current && element) {
179
+ (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
180
+ top: coordinates.top -
181
+ inputRef.current.clientHeight -
182
+ element.clientHeight,
183
+ });
184
+ }
170
185
  }
171
186
  }, [isOpenDropdown]);
172
- return (jsx$1(InputDropdown, __assign({ buttonRef: inputRef, isOpen: isOpenDropdown, handleClose: handleCloseDropdown, css: {
187
+ return (jsx$1(InputDropdown, __assign({ ref: dropdownRef, buttonRef: inputRef, isOpen: isOpenDropdown, handleClose: handleCloseDropdown, css: {
173
188
  maxHeight: "142px",
174
189
  padding: "4px",
175
190
  } }, { 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)); }) })));
@@ -925,10 +940,11 @@ var StyledWrapper = styled.div(templateObject_1$1 || (templateObject_1$1 = __mak
925
940
  var templateObject_1$1;
926
941
 
927
942
  var ButtonSelect = forwardRef(function (props, ref) {
943
+ var _a;
928
944
  var options = props.options, otherProps = __rest(props, ["options"]);
929
- return (jsx(StyledInputSelect, __assign({ value: options === null || options === void 0 ? void 0 : options[0].value, options: options, iconProps: { width: 9, height: 5 } }, otherProps, { ref: ref })));
945
+ 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 })));
930
946
  });
931
- 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 & + div {\n top: 48px;\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 & + div {\n top: 48px;\n }\n"])));
947
+ 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: 48px;\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: 48px;\n }\n"])), theme.breakpoints.xs);
932
948
  var templateObject_1;
933
949
 
934
950
  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 };