hrm_ui_lib 1.6.12 → 1.6.14

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.
@@ -63,7 +63,8 @@ var Menu = function Menu(props) {
63
63
  position = _props$position === void 0 ? 'bottom-right' : _props$position,
64
64
  _props$className = props.className,
65
65
  className = _props$className === void 0 ? '' : _props$className,
66
- children = props.children;
66
+ _props$children = props.children,
67
+ children = _props$children === void 0 ? null : _props$children;
67
68
  var _useState = useState(null),
68
69
  _useState2 = _slicedToArray(_useState, 2),
69
70
  menuRef = _useState2[0],
@@ -122,7 +123,7 @@ var Menu = function Menu(props) {
122
123
  className: classNames('select', 'select--menu', className),
123
124
  style: menuStyles,
124
125
  ref: setMenuRef
125
- }, /*#__PURE__*/React.createElement(React.Fragment, null, children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, menuItems.map(function (_ref) {
126
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/React.createElement(React.Fragment, null, menuItems === null || menuItems === void 0 ? void 0 : menuItems.map(function (_ref) {
126
127
  var label = _ref.label,
127
128
  meta = _ref.meta,
128
129
  value = _ref.value,
@@ -10,8 +10,8 @@ import { Input } from '../../Input/Input.js';
10
10
  import { noop } from '../../../utils/helpers.js';
11
11
  import { SELECTED_VISIBLE_MIN_COUNT } from '../constants.js';
12
12
  import { SelectMobile } from './SelectMobile/index.js';
13
- import { IconCaretUpFilled } from '../../SVGIcons/IconCaretUpFilled.js';
14
- import { IconCaretDownFilled } from '../../SVGIcons/IconCaretDownFilled.js';
13
+ import { IconChevronUp } from '../../SVGIcons/IconChevronUp.js';
14
+ import { IconChevronDown } from '../../SVGIcons/IconChevronDown.js';
15
15
  import { SELECT_TRANSLATIONS } from '../localization.js';
16
16
  import '../../../typeof-2c59c5c4.js';
17
17
  import '../../../consts/index.js';
@@ -68,7 +68,6 @@ import '../../Collapse/CollapseGroup/CollapseGroup.js';
68
68
  import '../../Collapse/CollapseItem/CollapseItem.js';
69
69
  import '../../SVGIcons/IconChevronRight.js';
70
70
  import '../../Divider/Divider.js';
71
- import '../../SVGIcons/IconChevronDown.js';
72
71
  import '../SharedComponents/ContentTop.js';
73
72
  import '../SharedComponents/Actions.js';
74
73
  import '../../Menu/Menu.js';
@@ -102,16 +101,17 @@ var Select = function Select(props) {
102
101
  placeHolder = props.placeHolder,
103
102
  _props$selectRightIco = props.selectRightIconProps,
104
103
  selectRightIconProps = _props$selectRightIco === void 0 ? {
105
- Component: IconCaretDownFilled,
104
+ Component: IconChevronDown,
106
105
  size: 'xsmall'
107
106
  } : _props$selectRightIco,
108
107
  _props$selectRightIco2 = props.selectRightIconOpenedProps,
109
108
  selectRightIconOpenedProps = _props$selectRightIco2 === void 0 ? {
110
- Component: IconCaretUpFilled,
109
+ Component: IconChevronUp,
111
110
  size: 'xsmall'
112
111
  } : _props$selectRightIco2,
113
112
  options = props.options,
114
- withSearch = props.withSearch,
113
+ _props$withSearch = props.withSearch,
114
+ withSearch = _props$withSearch === void 0 ? false : _props$withSearch,
115
115
  setSelectedItem = props.setSelectedItem,
116
116
  setFieldValue = props.setFieldValue,
117
117
  name = props.name,
@@ -214,7 +214,9 @@ var Select = function Select(props) {
214
214
  isRequiredField: isRequiredField,
215
215
  onItemDeselect: onItemDeselect,
216
216
  onItemSelect: onItemSelect,
217
- translations: localizations
217
+ translations: localizations,
218
+ setSelectedOption: setSelectedOption,
219
+ withSearch: withSearch
218
220
  })) : /*#__PURE__*/React.createElement(SelectDesktop, _extends({}, rest, {
219
221
  onItemDeselect: onItemDeselect,
220
222
  onItemSelect: onItemSelect,
@@ -3,6 +3,7 @@ type TProps = {
3
3
  searchValue: string;
4
4
  setSearchValue: (value: string) => void;
5
5
  onBack: () => void;
6
+ withSearch: boolean;
6
7
  };
7
- export declare const MobileTopContent: ({ onBack, setSearchValue, searchValue }: TProps) => ReactElement;
8
+ export declare const MobileTopContent: ({ onBack, setSearchValue, searchValue, withSearch }: TProps) => ReactElement;
8
9
  export {};
@@ -49,7 +49,8 @@ import '../../../SVGIcons/IconCheckmarkCircleFilled.js';
49
49
  var MobileTopContent = function MobileTopContent(_ref) {
50
50
  var onBack = _ref.onBack,
51
51
  setSearchValue = _ref.setSearchValue,
52
- searchValue = _ref.searchValue;
52
+ searchValue = _ref.searchValue,
53
+ withSearch = _ref.withSearch;
53
54
  var onSearch = function onSearch(e) {
54
55
  setSearchValue(e.target.value);
55
56
  };
@@ -61,7 +62,7 @@ var MobileTopContent = function MobileTopContent(_ref) {
61
62
  }, /*#__PURE__*/React.createElement(IconChevronLeft, {
62
63
  onClick: onBack,
63
64
  size: "large"
64
- }), /*#__PURE__*/React.createElement(Input, {
65
+ }), withSearch && /*#__PURE__*/React.createElement(Input, {
65
66
  currentValue: searchValue,
66
67
  handleChange: onSearch,
67
68
  className: "ml-8",
@@ -1,5 +1,5 @@
1
1
  import { _ as _slicedToArray } from '../../../../slicedToArray-7fbc5104.js';
2
- import React, { useState, useMemo } from 'react';
2
+ import React, { useState, useMemo, useCallback, useEffect } from 'react';
3
3
  import { Text } from '../../../Text/Text.js';
4
4
  import 'dayjs';
5
5
  import 'classnames';
@@ -92,7 +92,9 @@ var SelectMobile = function SelectMobile(props) {
92
92
  tooltipAddons = props.tooltipAddons,
93
93
  labelLeftIconProps = props.labelLeftIconProps,
94
94
  optionRightIconComponent = props.optionRightIconComponent,
95
- labelRightIconComponent = props.labelRightIconComponent;
95
+ labelRightIconComponent = props.labelRightIconComponent,
96
+ setSelectedOption = props.setSelectedOption,
97
+ withSearch = props.withSearch;
96
98
  var _useState = useState(''),
97
99
  _useState2 = _slicedToArray(_useState, 2),
98
100
  searchValue = _useState2[0],
@@ -100,6 +102,15 @@ var SelectMobile = function SelectMobile(props) {
100
102
  var filteredData = useMemo(function () {
101
103
  return filterOptions(options, searchValue);
102
104
  }, [searchValue, options]);
105
+ var setCurrentSelectedLabel = useCallback(function () {
106
+ var selectedItem = options.find(function (item) {
107
+ return item.value === currentSelection;
108
+ });
109
+ setSelectedOption(selectedItem);
110
+ }, [currentSelection, options]);
111
+ useEffect(function () {
112
+ setCurrentSelectedLabel();
113
+ }, [setCurrentSelectedLabel]);
103
114
  var clickHandler = function clickHandler(isSelected) {
104
115
  return function (_ref) {
105
116
  var value = _ref.value;
@@ -126,7 +137,8 @@ var SelectMobile = function SelectMobile(props) {
126
137
  }, /*#__PURE__*/React.createElement(MobileTopContent, {
127
138
  searchValue: searchValue,
128
139
  setSearchValue: setSearchValue,
129
- onBack: closeModal
140
+ onBack: closeModal,
141
+ withSearch: withSearch
130
142
  }), /*#__PURE__*/React.createElement("div", {
131
143
  className: "mobile_options_content"
132
144
  }, innerHelperText ? /*#__PURE__*/React.createElement(Text, {
@@ -85,11 +85,12 @@ import './constants.js';
85
85
  import './Select/helpers.js';
86
86
  import './Select/SelectMobile/index.js';
87
87
  import './Select/SelectMobile/MobileTopContent.js';
88
- import '../SVGIcons/IconCaretUpFilled.js';
89
- import '../SVGIcons/IconCaretDownFilled.js';
88
+ import '../SVGIcons/IconChevronUp.js';
90
89
  import './localization.js';
91
90
  import './MultiSelect/OptionsWrapper.js';
92
91
  import './MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js';
92
+ import '../SVGIcons/IconCaretDownFilled.js';
93
+ import '../SVGIcons/IconCaretUpFilled.js';
93
94
  import './MultiSelect/MultiBase/MultiBase.js';
94
95
  import './MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js';
95
96
  import '../Tab/Tab.js';
@@ -147,8 +147,11 @@ export interface ISingleSelectResponsiveProps {
147
147
  isRequiredField?: boolean;
148
148
  translations?: TSelectTranslations;
149
149
  language?: string;
150
+ setSelectedOption: (item: TSelectOption | null) => void;
151
+ }
152
+ export interface ISingleSelectMobileProps extends ISingleSelectResponsiveProps {
153
+ withSearch: boolean;
150
154
  }
151
- export type ISingleSelectMobileProps = ISingleSelectResponsiveProps;
152
155
  export interface ISingleSelectDesktopProps extends ISingleSelectResponsiveProps {
153
156
  searchValue: string;
154
157
  setSearchValue: (value: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "1.6.12",
3
+ "version": "1.6.14",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",