hrm_ui_lib 3.1.88 → 3.1.90

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.
@@ -117,11 +117,6 @@ export const Select = forwardRef((props, _ref) => {
117
117
  useEffect(() => {
118
118
  setCurrentSelectedLabel();
119
119
  }, [setCurrentSelectedLabel]);
120
- useEffect(() => {
121
- if (withSearch && inputRef && inputRef.current && isMobile) {
122
- inputRef.current.focus();
123
- }
124
- }, [isMobile, inputRef.current, withSearch]);
125
120
  return (_jsxs("div", { "data-id": `${dataId}-content`, className: classNames(`select select--${size}`, className, {
126
121
  'select--opened': isOpen
127
122
  }), ref: containerRef, children: [!isButtonSelect && (_jsx(Input, { onClick: disabled ? noop : onOpenOptions, size: size, dataId: dataId, hasError: hasError, className: "select__input", label: label, onChange: onSearch, required: isRequiredField, leftIconProps: leftIconProps, rightIconProps: isOpen ? selectRightIconOpenedProps : selectRightIconProps, placeholder: placeHolder, currentValue: searchValue || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label.toString()) || '', isValid: isValid, disabled: disabled, helperText: isOpen ? '' : outerHelperText, ref: inputRef, labelAddons: labelAddons, autoComplete: "false", readOnly: (isMobile && isMobileFullScreen) || !isWithSearch, onKeyDown: handleKeyDown })), isButtonSelect && (_jsx(Button, { size: size, type: "secondary", dataId: dataId, iconProps: selectRightIconProps, buttonText: placeHolder || '', onClick: disabled ? noop : openDropdown, className: "select_button" })), isMobile && isMobileFullScreen ? (_jsx(SelectMobile, Object.assign({}, rest, { isOpen: isOpen, filteredData: filteredData, closeDropdown: closeDropdown, currentSelection: currentSelection, isRequiredField: isRequiredField, onItemDeselect: onItemDeselect, onItemSelect: onItemSelect, translations: localizations, withSearch: withSearch, searchValue: searchValue, setSearchValue: setSearchValue }))) : (_jsx(SelectDesktop, Object.assign({}, rest, { onItemDeselect: onItemDeselect, onItemSelect: onItemSelect, currentSelection: currentSelection, isRequiredField: isRequiredField, filteredData: filteredData, inputRef: inputRef.current, containerRef: containerRef.current, isOpen: isOpen, closeDropdown: closeDropdown, setCurrentSelectedLabel: setCurrentSelectedLabel, searchValue: searchValue, setSearchValue: setSearchValue, translations: localizations, activeIndex: activeIndex, setActiveIndex: setActiveIndex })))] }));
@@ -4,6 +4,7 @@ type TProps = {
4
4
  setSearchValue: (value: string) => void;
5
5
  onBack: () => void;
6
6
  withSearch: boolean;
7
+ isOpen: boolean;
7
8
  };
8
- export declare const MobileTopContent: ({ onBack, setSearchValue, searchValue, withSearch }: TProps) => ReactElement;
9
+ export declare const MobileTopContent: ({ onBack, setSearchValue, searchValue, withSearch, isOpen }: TProps) => ReactElement;
9
10
  export {};
@@ -1,16 +1,23 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
2
3
  import IconChevronLeft from '../../../SVGIcons/IconChevronLeft';
3
4
  import { Input } from '../../../Input';
4
5
  import IconDismissFilled from '../../../SVGIcons/IconDismissFilled';
5
6
  import IconSearchFilled from '../../../SVGIcons/IconSearchFilled';
6
- export const MobileTopContent = ({ onBack, setSearchValue, searchValue, withSearch }) => {
7
+ export const MobileTopContent = ({ onBack, setSearchValue, searchValue, withSearch, isOpen }) => {
8
+ const inputRef = useRef(null);
7
9
  const onSearch = (e) => {
8
10
  setSearchValue(e.target.value);
9
11
  };
10
12
  const removeFilter = () => {
11
13
  setSearchValue('');
12
14
  };
13
- return (_jsxs("div", { className: "flexbox mobile_top_content", children: [_jsx(IconChevronLeft, { onClick: onBack, size: "large" }), withSearch && (_jsx(Input, { currentValue: searchValue, handleChange: onSearch, className: "ml-8", size: "small", rightIconProps: {
15
+ useEffect(() => {
16
+ if (isOpen && inputRef && inputRef.current) {
17
+ inputRef.current.focus();
18
+ }
19
+ }, [inputRef.current, isOpen]);
20
+ return (_jsxs("div", { className: "flexbox mobile_top_content", children: [_jsx(IconChevronLeft, { onClick: onBack, size: "large" }), withSearch && (_jsx(Input, { currentValue: searchValue, handleChange: onSearch, className: "ml-8", size: "small", ref: inputRef, rightIconProps: {
14
21
  Component: searchValue ? IconDismissFilled : IconSearchFilled,
15
22
  size: searchValue ? 'xsmall' : 'small',
16
23
  onClick: removeFilter
@@ -25,7 +25,7 @@ export const SelectMobile = (props) => {
25
25
  };
26
26
  const windowHeight = window.innerHeight;
27
27
  const windowWidth = window.innerWidth;
28
- return (_jsxs(Modal, { isOpen: isOpen, onClose: closeDropdown, isMobileFullScreen: true, children: [_jsx(MobileTopContent, { searchValue: searchValue, setSearchValue: setSearchValue, onBack: closeModal, withSearch: withSearch }), _jsxs("div", { className: "mobile_options_content", children: [innerHelperText ? (_jsx(Text, { size: "xsmall", type: "secondary", className: "mobile_options_content__label", children: innerHelperText })) : null, isLoading ? (_jsx(Loading, {})) : (_jsxs("div", { "data-id": `${dataId}-options-content`, children: [filteredData.length > 0 && (_jsx(List, { height: windowHeight - 30 - 32 - 24, itemCount: filteredData.length, itemSize: ITEM_SIZE_MOBILE, width: windowWidth, style: {
28
+ return (_jsxs(Modal, { isOpen: isOpen, onClose: closeDropdown, isMobileFullScreen: true, children: [_jsx(MobileTopContent, { searchValue: searchValue, setSearchValue: setSearchValue, onBack: closeModal, withSearch: withSearch, isOpen: isOpen }), _jsxs("div", { className: "mobile_options_content", children: [innerHelperText ? (_jsx(Text, { size: "xsmall", type: "secondary", className: "mobile_options_content__label", children: innerHelperText })) : null, isLoading ? (_jsx(Loading, {})) : (_jsxs("div", { "data-id": `${dataId}-options-content`, children: [filteredData.length > 0 && (_jsx(List, { height: windowHeight - 30 - 32 - 24, itemCount: filteredData.length, itemSize: ITEM_SIZE_MOBILE, width: windowWidth, style: {
29
29
  width: '100%',
30
30
  overflowX: 'hidden',
31
31
  overflowY: 'auto',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "3.1.88",
3
+ "version": "3.1.90",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",