forstok-ui-lib 8.5.2 → 8.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forstok-ui-lib",
3
- "version": "8.5.2",
3
+ "version": "8.5.4",
4
4
  "description": "Forstok UI Components Library",
5
5
  "path": "dist",
6
6
  "main": "dist/index.js",
@@ -1,46 +1,57 @@
1
- import { useCallback, useEffect, useRef, useState } from 'react'
2
- import { AsyncPaginate } from 'react-select-async-paginate'
3
- import type { LoadOptions } from 'react-select-async-paginate'
4
- import { ActionMeta, ControlProps, CSSObjectWithLabel, GroupBase, OnChangeValue, OptionProps, StylesConfig } from 'react-select'
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { AsyncPaginate } from "react-select-async-paginate";
3
+ import type { LoadOptions } from "react-select-async-paginate";
4
+ import {
5
+ ActionMeta,
6
+ ControlProps,
7
+ CSSObjectWithLabel,
8
+ GroupBase,
9
+ OnChangeValue,
10
+ OptionProps,
11
+ StylesConfig,
12
+ } from "react-select";
5
13
 
6
- import type { CSSObject } from '@emotion/serialize'
7
- import type { TState } from '../../typeds/base.typed'
8
- import type { TLoadOption, TOption } from './typed'
14
+ import type { CSSObject } from "@emotion/serialize";
15
+ import type { TState } from "../../typeds/base.typed";
16
+ import type { TLoadOption, TOption } from "./typed";
9
17
 
10
18
  type TSelect = {
11
- type?: string
12
- mode?: string
13
- isError?: boolean
14
- customOption?: (arg0: OptionProps) => void
15
- MenuList?: any
16
- reset?: boolean
17
- setReset?: TState<boolean>
18
- evChange?: (newValue: OnChangeValue<TOption, boolean>, actionMeta?: ActionMeta<TOption>) => void
19
- defaultValue?: OnChangeValue<TOption, boolean>
20
- loadOptions: LoadOptions<unknown, GroupBase<unknown>, unknown> | TLoadOption
21
- loadOptionsOnMenuOpen?: boolean
22
- noOptionsMessage?: ((obj: {
23
- inputValue: string
24
- }) => React.ReactNode)
25
- isSearchable?: boolean
26
- isClearable?: boolean
27
- placeholder?: string
28
- isMenuOpen?: boolean
29
- setMenuIsOpen?: TState<boolean | undefined>
30
- isForceUpdate?: boolean
31
- setForceUpdate?: TState<boolean>
32
- isMulti?: boolean
33
- iconLeft?: boolean | string
34
- loadedOptions?: TOption[]
35
- 'data-qa-id'?: string
36
- evChangeOnMenuClose?: (value: OnChangeValue<TOption, boolean> | undefined) => void
37
- id?: string
38
- isDisabled?: boolean
39
- }
19
+ type?: string;
20
+ mode?: string;
21
+ isError?: boolean;
22
+ customOption?: (arg0: OptionProps) => void;
23
+ MenuList?: any;
24
+ reset?: boolean;
25
+ setReset?: TState<boolean>;
26
+ evChange?: (
27
+ newValue: OnChangeValue<TOption, boolean>,
28
+ actionMeta?: ActionMeta<TOption>,
29
+ ) => void;
30
+ defaultValue?: OnChangeValue<TOption, boolean>;
31
+ loadOptions: LoadOptions<unknown, GroupBase<unknown>, unknown> | TLoadOption;
32
+ loadOptionsOnMenuOpen?: boolean;
33
+ noOptionsMessage?: (obj: { inputValue: string }) => React.ReactNode;
34
+ isSearchable?: boolean;
35
+ isClearable?: boolean;
36
+ placeholder?: string;
37
+ isMenuOpen?: boolean;
38
+ setMenuIsOpen?: TState<boolean | undefined>;
39
+ isForceUpdate?: boolean;
40
+ setForceUpdate?: TState<boolean>;
41
+ isMulti?: boolean;
42
+ iconLeft?: boolean | string;
43
+ loadedOptions?: TOption[];
44
+ "data-qa-id"?: string;
45
+ evChangeOnMenuClose?: (
46
+ value: OnChangeValue<TOption, boolean> | undefined,
47
+ ) => void;
48
+ id?: string;
49
+ isDisabled?: boolean;
50
+ };
40
51
 
41
52
  const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
42
53
  const {
43
- isError=false,
54
+ isError = false,
44
55
  mode,
45
56
  type,
46
57
  customOption,
@@ -62,237 +73,309 @@ const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
62
73
  setMenuIsOpen,
63
74
  id,
64
75
  evChangeOnMenuClose,
65
- ...rest
66
- } = props
76
+ ...rest
77
+ } = props;
67
78
 
68
- const [valueSelect, setValueSelect] = useState<typeof defaultValue>(defaultValue || null)
69
- const [inputValue, setInputValue] = useState<string>("")
70
- const [_time, setTime] = useState<Date>(new Date())
79
+ const [valueSelect, setValueSelect] = useState<typeof defaultValue>(
80
+ defaultValue || null,
81
+ );
82
+ const [inputValue, setInputValue] = useState<string>("");
83
+ const [_time, setTime] = useState<Date>(new Date());
71
84
 
72
- const selectRef = useRef<HTMLElement | null>(null)
85
+ const selectRef = useRef<HTMLElement | null>(null);
73
86
 
74
87
  useEffect(() => {
75
88
  if (isForceUpdate) {
76
- setValueSelect(defaultValue || null)
77
- setForceUpdate && setForceUpdate(false)
89
+ setValueSelect(defaultValue || null);
90
+ setForceUpdate && setForceUpdate(false);
91
+ }
92
+ }, [defaultValue, isForceUpdate, setForceUpdate, setValueSelect]);
93
+
94
+ const handleChange = (
95
+ value: OnChangeValue<TOption, boolean>,
96
+ actionMeta?: ActionMeta<TOption>,
97
+ ) => {
98
+ const newValue = value as OnChangeValue<TOption, false>;
99
+
100
+ if (mode !== "multi-select" && actionMeta?.action === "select-option") {
101
+ setInputValue("");
78
102
  }
79
- }, [defaultValue, isForceUpdate, setForceUpdate, setValueSelect])
80
103
 
81
- const handleChange = (value: OnChangeValue<TOption, boolean>, actionMeta?: ActionMeta<TOption>) => {
82
- const newValue = value as OnChangeValue<TOption, false>
83
104
  if (actionMeta) {
84
- const { action, option } = actionMeta
85
- if (action === "select-option" && option?.value === '*') {
86
- const newValueSelect = valueSelect as OnChangeValue<TOption, true>
87
- if(newValueSelect?.length) {
88
- let _newValue = loadedOptions ? [...newValueSelect, ...loadedOptions] : [...newValueSelect]
89
- _newValue = _newValue.filter((_value, idx, self) => idx === self.findIndex((t) => (t.sku === _value.sku)))
90
- setValueSelect(_newValue)
91
- evChange && evChange(_newValue, actionMeta)
105
+ const { action, option } = actionMeta;
106
+
107
+ if (action === "select-option" && option?.value === "*") {
108
+ const newValueSelect = valueSelect as OnChangeValue<TOption, true>;
109
+
110
+ if (newValueSelect?.length) {
111
+ let _newValue = loadedOptions
112
+ ? [...newValueSelect, ...loadedOptions]
113
+ : [...newValueSelect];
114
+
115
+ _newValue = _newValue.filter(
116
+ (_value, idx, self) =>
117
+ idx === self.findIndex((t) => t.sku === _value.sku),
118
+ );
119
+
120
+ setValueSelect(_newValue);
121
+ evChange && evChange(_newValue, actionMeta);
92
122
  } else if (loadedOptions) {
93
- setValueSelect(loadedOptions)
94
- evChange && evChange(loadedOptions, actionMeta)
123
+ setValueSelect(loadedOptions);
124
+ evChange && evChange(loadedOptions, actionMeta);
95
125
  }
96
- selectRef.current?.blur()
97
- return false
126
+
127
+ selectRef.current?.blur();
128
+ return false;
98
129
  }
99
130
  }
100
- setValueSelect(newValue)
101
- evChange && evChange(newValue, actionMeta)
102
- }
131
+
132
+ setValueSelect(newValue);
133
+ evChange && evChange(newValue, actionMeta);
134
+ };
103
135
 
104
136
  const customStyles: StylesConfig<TOption, boolean> = {
105
- container: (provided: CSSObject) => ({
106
- ...provided,
107
- display: 'inline-block',
108
- width: '100%',
109
- minHeight: '1px',
110
- textAlign: 'left',
111
- border: 'none',
112
- } as CSSObjectWithLabel),
113
- control: (provided: CSSObject, state: ControlProps<TOption, boolean>) => ({
114
- ...provided,
115
- width: '100%',
116
- borderRadius: '.5rem',
117
- minHeight: '1px',
118
- height: isMulti ? 'auto' : mode === 'small' ? '30px' : '32px',
119
- cursor: 'pointer',
120
- borderWidth: isError ? '1px' : '0',
121
- boxShadow: (state.isFocused) ? '-.0625rem 0rem .0625rem 0rem rgba(26, 26, 26, .122) inset, .0625rem 0rem .0625rem 0rem rgba(26, 26, 26, .122) inset, 0rem .125rem .0625rem 0rem rgba(26, 26, 26, .2) inset' : '0rem -.0625rem 0rem 0rem #b5b5b5 inset,0rem 0rem 0rem .0625rem rgba(0, 0, 0, .1) inset,0rem .03125rem 0rem .09375rem #FFF inset',
122
- borderColor: ((state.isFocused && mode !== 'filter') && !isError) ? 'var(--pri-clr-ln__fc)' : (isError ? 'var(--err-clr-ln)' : (mode ==='filter' ? '#ffffff' : ' var(--ck-clr-ln)' )),
123
- background: state.isFocused ? 'rgba(247, 247, 247, 1)' : '#ffffff',
124
- overflow: mode === 'picklist' ? 'hidden': 'initial',
125
- '&:hover': {
126
- borderColor: ((state.isFocused && mode !== 'filter') && !isError) ? 'var(--pri-clr-ln__fc)' : (isError ? 'var(--err-clr-ln)' : (mode ==='filter' ? '#ffffff' : ' var(--ck-clr-ln)' )),
127
- background: 'rgba(250, 250, 250, 1)',
128
- color: 'rgba(48, 48, 48, 1)'
129
- }
130
- } as CSSObjectWithLabel),
131
- placeholder: (provided: CSSObject) => ({
132
- ...provided,
133
- fontStyle: 'italic'
134
- } as CSSObjectWithLabel),
135
- input: (provided: CSSObject) => ({
136
- ...provided,
137
- minHeight: '1px',
138
- margin: '0 2px',
139
- padding: '0',
140
- 'input': {
141
- boxShadow: 'none !important'
142
- }
143
- } as CSSObjectWithLabel),
144
- singleValue: (provided: CSSObject) => ({
145
- ...provided,
146
- minHeight: '1px',
147
- paddingBottom: '2px',
148
- color: 'initial',
149
- } as CSSObjectWithLabel),
150
- dropdownIndicator: (provided: CSSObject) => ({
151
- ...provided,
152
- minHeight: '1px',
153
- paddingTop: '0',
154
- paddingBottom: '0',
155
- paddingLeft: '2px',
156
- paddingRight: '2px',
157
- color: '#757575',
158
- } as CSSObjectWithLabel),
159
- indicatorSeparator: (provided: CSSObject) => ({
160
- ...provided,
161
- minHeight: '1px',
162
- height: '24px',
163
- display: (type=== 'tag') ? 'block' : 'none'
164
- } as CSSObjectWithLabel),
165
- clearIndicator: (provided: CSSObject) => ({
166
- ...provided,
167
- minHeight: '1px',
168
- marginRight: '-6px',
169
- padding: '0'
170
- } as CSSObjectWithLabel),
171
- valueContainer: (provided: CSSObject) => ({
172
- ...provided,
173
- minHeight: '1px',
174
- height: mode === 'multi-select' ? '70px' : mode === 'small' ? '30px' : '32px',
175
- paddingTop: isMulti ? '4px' : '0',
176
- paddingBottom: isMulti ? '4px' : '0',
177
- paddingLeft: iconLeft ? '28px' : '8px',
178
- paddingRight: '2px',
179
- maxHeight: isMulti ? '60px' : 'unset',
180
- overflow: isMulti ? 'auto' : 'initial',
181
- alignContent: isMulti ? 'flex-start' : 'initial'
182
- } as CSSObjectWithLabel),
183
- option: (provided: CSSObject, state: OptionProps<TOption, boolean>) => ({
184
- ...provided,
185
- width: '100%',
186
- margin: '0 0 4px',
187
- borderRadius: 'var(--nav-rd)',
188
- cursor: 'pointer',
189
- overflowWrap: 'break-word',
190
- wordBreak: 'break-all',
191
- position: 'relative',
192
- backgroundColor: state.isSelected || state.isFocused ? 'var(--nav-clr-bg__hvr)' : 'transparent',
193
- '&:last-child': {
194
- marginBottom: 0,
195
- },
196
- ...(!state.isDisabled && {
197
- color: 'var(--pri-clr)',
198
- fontWeight: state.isSelected ? 500 : 'normal',
199
- '&:hover': {
200
- backgroundColor: 'var(--nav-clr-bg__hvr)',
137
+ container: (provided: CSSObject) =>
138
+ ({
139
+ ...provided,
140
+ display: "inline-block",
141
+ width: "100%",
142
+ minHeight: "1px",
143
+ textAlign: "left",
144
+ border: "none",
145
+ }) as CSSObjectWithLabel,
146
+ control: (provided: CSSObject, state: ControlProps<TOption, boolean>) =>
147
+ ({
148
+ ...provided,
149
+ width: "100%",
150
+ borderRadius: ".5rem",
151
+ minHeight: "1px",
152
+ height: isMulti ? "auto" : mode === "small" ? "30px" : "32px",
153
+ cursor: "pointer",
154
+ borderWidth: isError ? "1px" : "0",
155
+ boxShadow: state.isFocused
156
+ ? "-.0625rem 0rem .0625rem 0rem rgba(26, 26, 26, .122) inset, .0625rem 0rem .0625rem 0rem rgba(26, 26, 26, .122) inset, 0rem .125rem .0625rem 0rem rgba(26, 26, 26, .2) inset"
157
+ : "0rem -.0625rem 0rem 0rem #b5b5b5 inset,0rem 0rem 0rem .0625rem rgba(0, 0, 0, .1) inset,0rem .03125rem 0rem .09375rem #FFF inset",
158
+ borderColor:
159
+ state.isFocused && mode !== "filter" && !isError
160
+ ? "var(--pri-clr-ln__fc)"
161
+ : isError
162
+ ? "var(--err-clr-ln)"
163
+ : mode === "filter"
164
+ ? "#ffffff"
165
+ : " var(--ck-clr-ln)",
166
+ background: state.isFocused ? "rgba(247, 247, 247, 1)" : "#ffffff",
167
+ overflow: mode === "picklist" ? "hidden" : "initial",
168
+ "&:hover": {
169
+ borderColor:
170
+ state.isFocused && mode !== "filter" && !isError
171
+ ? "var(--pri-clr-ln__fc)"
172
+ : isError
173
+ ? "var(--err-clr-ln)"
174
+ : mode === "filter"
175
+ ? "#ffffff"
176
+ : " var(--ck-clr-ln)",
177
+ background: "rgba(250, 250, 250, 1)",
178
+ color: "rgba(48, 48, 48, 1)",
201
179
  },
202
- }),
203
- ...(state.isSelected && {
204
- paddingRight: '1.75em',
205
- '&:after': {
206
- content: '""',
207
- position: 'absolute',
208
- top: '50%',
209
- transform: 'translateY(-50%)',
210
- right: '7px',
211
- bottom: '0',
212
- width: '12px',
213
- height: '20px'
214
- }
215
- })
216
- } as CSSObjectWithLabel),
217
- menu: (provided: CSSObject) => ({
218
- ...provided,
219
- padding: '8px',
220
- borderRadius: '.75rem',
221
- boxShadow: '0rem .5rem 1.5rem -.5rem rgba(0, 0, 0, .05), 0rem .5rem 1rem -.25rem rgba(0, 0, 0, .05), 0rem .1875rem .375rem 0rem rgba(0, 0, 0, .05), 0rem .125rem .25rem 0rem rgba(0, 0, 0, .05), 0rem .0625rem .125rem 0rem rgba(0, 0, 0, .05), 0rem 0rem 0rem .0625rem rgba(0, 0, 0, .06)',
222
- border: 'none'
223
- } as CSSObjectWithLabel),
224
- menuPortal: (provided: CSSObject) => ({
225
- ...provided,
226
- zIndex: 9999,
227
- letterSpacing: 'normal',
228
- lineHeight: 'normal',
229
- } as CSSObjectWithLabel)
230
- }
180
+ }) as CSSObjectWithLabel,
181
+ placeholder: (provided: CSSObject) =>
182
+ ({
183
+ ...provided,
184
+ fontStyle: "italic",
185
+ }) as CSSObjectWithLabel,
186
+ input: (provided: CSSObject) =>
187
+ ({
188
+ ...provided,
189
+ minHeight: "1px",
190
+ margin: "0 2px",
191
+ padding: "0",
192
+ input: {
193
+ boxShadow: "none !important",
194
+ },
195
+ }) as CSSObjectWithLabel,
196
+ singleValue: (provided: CSSObject) =>
197
+ ({
198
+ ...provided,
199
+ minHeight: "1px",
200
+ paddingBottom: "2px",
201
+ color: "initial",
202
+ }) as CSSObjectWithLabel,
203
+ dropdownIndicator: (provided: CSSObject) =>
204
+ ({
205
+ ...provided,
206
+ minHeight: "1px",
207
+ paddingTop: "0",
208
+ paddingBottom: "0",
209
+ paddingLeft: "2px",
210
+ paddingRight: "2px",
211
+ color: "#757575",
212
+ }) as CSSObjectWithLabel,
213
+ indicatorSeparator: (provided: CSSObject) =>
214
+ ({
215
+ ...provided,
216
+ minHeight: "1px",
217
+ height: "24px",
218
+ display: type === "tag" ? "block" : "none",
219
+ }) as CSSObjectWithLabel,
220
+ clearIndicator: (provided: CSSObject) =>
221
+ ({
222
+ ...provided,
223
+ minHeight: "1px",
224
+ marginRight: "-6px",
225
+ padding: "0",
226
+ }) as CSSObjectWithLabel,
227
+ valueContainer: (provided: CSSObject) =>
228
+ ({
229
+ ...provided,
230
+ minHeight: "1px",
231
+ height:
232
+ mode === "multi-select" ? "70px" : mode === "small" ? "30px" : "32px",
233
+ paddingTop: isMulti ? "4px" : "0",
234
+ paddingBottom: isMulti ? "4px" : "0",
235
+ paddingLeft: iconLeft ? "28px" : "8px",
236
+ paddingRight: "2px",
237
+ maxHeight: isMulti ? "60px" : "unset",
238
+ overflow: isMulti ? "auto" : "initial",
239
+ alignContent: isMulti ? "flex-start" : "initial",
240
+ }) as CSSObjectWithLabel,
241
+ option: (provided: CSSObject, state: OptionProps<TOption, boolean>) =>
242
+ ({
243
+ ...provided,
244
+ width: "100%",
245
+ margin: "0 0 4px",
246
+ borderRadius: "var(--nav-rd)",
247
+ cursor: "pointer",
248
+ overflowWrap: "break-word",
249
+ wordBreak: "break-all",
250
+ position: "relative",
251
+ backgroundColor:
252
+ state.isSelected || state.isFocused
253
+ ? "var(--nav-clr-bg__hvr)"
254
+ : "transparent",
255
+ "&:last-child": {
256
+ marginBottom: 0,
257
+ },
258
+ ...(!state.isDisabled && {
259
+ color: "var(--pri-clr)",
260
+ fontWeight: state.isSelected ? 500 : "normal",
261
+ "&:hover": {
262
+ backgroundColor: "var(--nav-clr-bg__hvr)",
263
+ },
264
+ }),
265
+ ...(state.isSelected && {
266
+ paddingRight: "1.75em",
267
+ "&:after": {
268
+ content: '"✔"',
269
+ position: "absolute",
270
+ top: "50%",
271
+ transform: "translateY(-50%)",
272
+ right: "7px",
273
+ bottom: "0",
274
+ width: "12px",
275
+ height: "20px",
276
+ },
277
+ }),
278
+ }) as CSSObjectWithLabel,
279
+ menu: (provided: CSSObject) =>
280
+ ({
281
+ ...provided,
282
+ padding: "8px",
283
+ borderRadius: ".75rem",
284
+ boxShadow:
285
+ "0rem .5rem 1.5rem -.5rem rgba(0, 0, 0, .05), 0rem .5rem 1rem -.25rem rgba(0, 0, 0, .05), 0rem .1875rem .375rem 0rem rgba(0, 0, 0, .05), 0rem .125rem .25rem 0rem rgba(0, 0, 0, .05), 0rem .0625rem .125rem 0rem rgba(0, 0, 0, .05), 0rem 0rem 0rem .0625rem rgba(0, 0, 0, .06)",
286
+ border: "none",
287
+ }) as CSSObjectWithLabel,
288
+ menuPortal: (provided: CSSObject) =>
289
+ ({
290
+ ...provided,
291
+ zIndex: 9999,
292
+ letterSpacing: "normal",
293
+ lineHeight: "normal",
294
+ }) as CSSObjectWithLabel,
295
+ };
231
296
 
232
297
  const onMenuOpen = useCallback(() => {
233
- setMenuIsOpen && setMenuIsOpen(true)
234
- }, [setMenuIsOpen])
298
+ setMenuIsOpen && setMenuIsOpen(true);
299
+ }, [setMenuIsOpen]);
235
300
 
236
301
  const onMenuClose = useCallback(() => {
237
- setMenuIsOpen && setMenuIsOpen(false)
238
- }, [setMenuIsOpen])
302
+ setMenuIsOpen && setMenuIsOpen(false);
303
+ }, [setMenuIsOpen]);
239
304
 
240
305
  const evToogleSelect = () => {
241
- const containerRef = document.getElementsByClassName('_refSelectContainer is-shown') as HTMLCollectionOf<HTMLElement>;
306
+ const containerRef = document.getElementsByClassName(
307
+ "_refSelectContainer is-shown",
308
+ ) as HTMLCollectionOf<HTMLElement>;
242
309
  if (containerRef.length) {
243
310
  for (let i = 0; i < containerRef.length; i++) {
244
- containerRef[i].classList.remove('is-shown');
311
+ containerRef[i].classList.remove("is-shown");
245
312
  }
246
- }
247
- }
313
+ }
314
+ };
248
315
 
249
316
  const evReToogleSelect = () => {
250
- setTime(new Date())
251
- evToogleSelect()
252
- }
317
+ setTime(new Date());
318
+ evToogleSelect();
319
+ };
320
+
321
+ return (
322
+ <div className="_refContainer">
323
+ <AsyncPaginate
324
+ isSearchable={isSearchable}
325
+ placeholder={placeholder}
326
+ debounceTimeout={500}
327
+ styles={customStyles}
328
+ loadOptions={loadOptions}
329
+ menuPortalTarget={document.body}
330
+ menuPosition="fixed"
331
+ menuPlacement="auto"
332
+ value={valueSelect}
333
+ onChange={handleChange}
334
+ loadOptionsOnMenuOpen={loadOptionsOnMenuOpen}
335
+ noOptionsMessage={noOptionsMessage}
336
+ menuIsOpen={isMenuOpen}
337
+ {...(id && { id: id })}
338
+ {...(mode === "multi-select" && {
339
+ closeMenuOnSelect: false,
340
+ inputValue: inputValue,
341
+ onInputChange: (value, action) => {
342
+ if (action.action === "input-change") {
343
+ setInputValue(value);
344
+ setTime(new Date());
345
+ return value;
346
+ }
347
+
348
+ if (action.action === "set-value") {
349
+ setInputValue("");
350
+ return "";
351
+ }
352
+
353
+ if (action.action === "menu-close") {
354
+ setInputValue("");
355
+ return "";
356
+ }
253
357
 
254
- return <div className='_refContainer'>
255
- <AsyncPaginate
256
- isSearchable={isSearchable}
257
- placeholder={placeholder}
258
- debounceTimeout={500}
259
- styles={customStyles}
260
- loadOptions={loadOptions}
261
- menuPortalTarget={document.body}
262
- menuPosition='fixed'
263
- menuPlacement='auto'
264
- value={valueSelect}
265
- onChange={handleChange}
266
- loadOptionsOnMenuOpen={loadOptionsOnMenuOpen}
267
- noOptionsMessage={noOptionsMessage}
268
- menuIsOpen={isMenuOpen}
269
- {...id && {id: id}}
270
- {...mode === 'multi-select' && {
271
- closeMenuOnSelect: false,
272
- inputValue: inputValue,
273
- onInputChange: (value, action) => {
274
- if (action.action === "input-change") {
275
- setInputValue(value)
276
- setTime(new Date())
277
- }
278
- },
279
- onMenuClose: () => {
280
- setInputValue('');
281
- evChangeOnMenuClose?.(valueSelect);
282
- },
283
- onMenuOpen: () => evReToogleSelect(),
284
- cacheUniqs: [_time],
285
- selectRef: selectRef
286
- }}
287
- {...mode !== 'multi-select' && {
288
- onMenuOpen: onMenuOpen,
289
- onMenuClose: onMenuClose
290
- }}
291
- {...customOption && { components: { Option: customOption } }}
292
- {...MenuList && { components: { MenuList } }}
293
- {...isMulti && { isMulti: true }}
294
- {...rest} />
295
- </div>
296
- }
358
+ return value;
359
+ },
360
+ onMenuClose: () => {
361
+ setInputValue("");
362
+ evChangeOnMenuClose?.(valueSelect);
363
+ },
364
+ onMenuOpen: () => evReToogleSelect(),
365
+ cacheUniqs: [_time],
366
+ selectRef: selectRef,
367
+ })}
368
+ {...(mode !== "multi-select" && {
369
+ onMenuOpen: onMenuOpen,
370
+ onMenuClose: onMenuClose,
371
+ })}
372
+ {...(customOption && { components: { Option: customOption } })}
373
+ {...(MenuList && { components: { MenuList } })}
374
+ {...(isMulti && { isMulti: true })}
375
+ {...rest}
376
+ />
377
+ </div>
378
+ );
379
+ };
297
380
 
298
- export default SelectAsyncPaginateComponent
381
+ export default SelectAsyncPaginateComponent;