hi-tm 0.3.9 → 0.4.1

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.
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
- import type { SelectOption, CreatableSelectProps } from '../../types/DropDown/CreatableDropDown';
3
- export default function CreatableSelect<T = SelectOption>({ options, value, onChange, onClick, onCreateOption, placeholder, isLoading, isDisabled, isCreatable, isMultiSelect, noOptionsMessage, noResultsFound, loadingMessage, createOptionMessage, className, tailwindStyle, iconSrc, fetchOptions, fetchRawOptions, mapCreateOption, toOption, onValueChange, label, onAddClick, }: CreatableSelectProps<T>): React.JSX.Element;
2
+ import type { CreatableSelectProps } from '../../types/DropDown/CreatableDropDown';
3
+ export default function CreatableSelect({ options, value, onChange, onClick, // New prop for handling selection
4
+ onCreateOption, placeholder, isLoading, isDisabled, isClearable, isCreatable, isMultiSelect, noOptionsMessage, noResultsFound, loadingMessage, createOptionMessage, className, tailwindStyle, iconSrc, fetchOptions, label, onAddClick, }: CreatableSelectProps): React.JSX.Element;
@@ -85,56 +85,39 @@ const renderNoResults = (noResults, className, searchIcon) => {
85
85
  return noResults;
86
86
  }
87
87
  };
88
- // Generic component so consumers can pass any T and receive T back
89
- function CreatableSelect({ options = [], value, onChange, onClick, onCreateOption, placeholder = 'Select...', isLoading = false, isDisabled = false,
90
- // isClearable is currently unused; keep behavior but omit local param to avoid lint error
91
- isCreatable = true, isMultiSelect = false, noOptionsMessage = 'No options available', noResultsFound, loadingMessage = 'Loading...', createOptionMessage = 'Create option', className = '', tailwindStyle = {}, iconSrc, fetchOptions, fetchRawOptions, mapCreateOption, toOption, onValueChange, label, onAddClick, }) {
88
+ function CreatableSelect({ options = [], value, onChange, onClick, // New prop for handling selection
89
+ onCreateOption, placeholder = 'Select...', isLoading = false, isDisabled = false, isClearable = true, isCreatable = true, isMultiSelect = false, noOptionsMessage = 'No options available', noResultsFound, loadingMessage = 'Loading...', createOptionMessage = 'Create option', className = '', tailwindStyle = {}, iconSrc, fetchOptions, label, onAddClick, }) {
92
90
  const styles = {
93
91
  ...defaultStyles,
94
92
  ...tailwindStyle,
95
93
  };
96
- // Ensure we always have a mapper from T -> SelectOption
97
- const toSelectOption = (0, react_1.useMemo)(() => {
98
- if (toOption)
99
- return toOption;
100
- // Best-effort default: if item already looks like SelectOption use it; otherwise toString
101
- return (item) => {
102
- if (item && typeof item === 'object' && 'value' in item && 'label' in item) {
103
- return item;
104
- }
105
- const text = String(item ?? '');
106
- return { label: text, value: text, content: text };
107
- };
108
- }, [toOption]);
109
94
  const [isOpen, setIsOpen] = (0, react_1.useState)(false);
110
95
  const [inputValue, setInputValue] = (0, react_1.useState)('');
111
- const [filteredOptions, setFilteredOptions] = (0, react_1.useState)((options ?? []).map(toSelectOption));
96
+ const [filteredOptions, setFilteredOptions] = (0, react_1.useState)(options ?? []);
112
97
  const [highlightedIndex, setHighlightedIndex] = (0, react_1.useState)(0);
113
98
  const [internalLoading, setInternalLoading] = (0, react_1.useState)(false);
114
99
  const [hasSearched, setHasSearched] = (0, react_1.useState)(false);
115
- // Store selected values in raw T form, but display via mapper
116
- const initialSelected = (0, react_1.useMemo)(() => {
117
- if (!value)
118
- return [];
119
- return Array.isArray(value) ? value : [value];
120
- }, [value]);
121
- const [selectedRawValues, setSelectedRawValues] = (0, react_1.useState)(initialSelected);
122
- const selectedValues = (0, react_1.useMemo)(() => selectedRawValues.map(toSelectOption), [selectedRawValues, toSelectOption]);
100
+ const [selectedValues, setSelectedValues] = (0, react_1.useState)(Array.isArray(value) && isMultiSelect
101
+ ? value
102
+ : value
103
+ ? [value]
104
+ : []);
123
105
  const containerRef = (0, react_1.useRef)(null);
124
106
  const inputRef = (0, react_1.useRef)(null);
125
- // Keep filtered options in sync with external changes when not actively searching
126
107
  (0, react_1.useEffect)(() => {
108
+ console.log('Options prop changed:', options); // Debugging log
109
+ // Only update filteredOptions when options change if we're not in the middle of a search
127
110
  if (!hasSearched) {
128
- setFilteredOptions((options ?? []).map(toSelectOption));
111
+ setFilteredOptions(options ?? []);
129
112
  }
130
- }, [options, hasSearched, toSelectOption]);
131
- // Reset search list when input cleared
113
+ }, [options, hasSearched]);
132
114
  (0, react_1.useEffect)(() => {
133
115
  if (inputValue === '') {
134
- setFilteredOptions((options ?? []).map(toSelectOption));
116
+ console.log('Input value is empty, resetting filtered options'); // Debugging log
117
+ setFilteredOptions(options ?? []);
135
118
  setHasSearched(false);
136
119
  }
137
- }, [options, inputValue, toSelectOption]);
120
+ }, [options, inputValue]);
138
121
  (0, react_1.useEffect)(() => {
139
122
  const handler = (e) => {
140
123
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -146,34 +129,20 @@ isCreatable = true, isMultiSelect = false, noOptionsMessage = 'No options availa
146
129
  document.removeEventListener('click', handler);
147
130
  };
148
131
  }, []);
149
- // Debounce input to limit fetch/filter work
150
- const [debouncedQuery, setDebouncedQuery] = (0, react_1.useState)('');
151
- (0, react_1.useEffect)(() => {
152
- const id = setTimeout(() => setDebouncedQuery(inputValue), 200);
153
- return () => clearTimeout(id);
154
- }, [inputValue]);
155
- const runSearch = (0, react_1.useCallback)(async (query) => {
156
- if (fetchRawOptions && query.trim() !== '') {
157
- setInternalLoading(true);
158
- setHasSearched(true);
159
- try {
160
- const rawItems = await fetchRawOptions(query);
161
- setFilteredOptions((rawItems ?? []).map(toSelectOption));
162
- }
163
- catch (error) {
164
- console.error('Error fetching raw options:', error);
165
- }
166
- finally {
167
- setInternalLoading(false);
168
- }
169
- return;
132
+ const handleInputChange = async (e) => {
133
+ const value = e.target.value;
134
+ setInputValue(value);
135
+ setIsOpen(true);
136
+ // Pass the input event to onChange
137
+ if (onChange) {
138
+ onChange(e);
170
139
  }
171
- if (fetchOptions && query.trim() !== '') {
140
+ if (fetchOptions && value.trim() !== '') {
172
141
  setInternalLoading(true);
173
142
  setHasSearched(true);
174
143
  try {
175
- const newOptions = await fetchOptions(query);
176
- setFilteredOptions(newOptions ?? []);
144
+ const newOptions = await fetchOptions(value);
145
+ setFilteredOptions(newOptions);
177
146
  }
178
147
  catch (error) {
179
148
  console.error('Error fetching options:', error);
@@ -181,100 +150,83 @@ isCreatable = true, isMultiSelect = false, noOptionsMessage = 'No options availa
181
150
  finally {
182
151
  setInternalLoading(false);
183
152
  }
184
- return;
185
153
  }
186
- if (query.trim() === '') {
187
- setFilteredOptions((options ?? []).map(toSelectOption));
154
+ else if (value.trim() === '') {
155
+ setFilteredOptions(options ?? []);
188
156
  setHasSearched(false);
189
- return;
190
- }
191
- const searchText = String(query).trim().toLowerCase();
192
- const baseOptions = (options ?? []).map(toSelectOption);
193
- const filtered = baseOptions.filter((option) => {
194
- const optionLabel = String(option.label || option.content || option.value || '');
195
- return optionLabel.toLowerCase().includes(searchText);
196
- });
197
- setFilteredOptions(filtered);
198
- setHasSearched(true);
199
- }, [fetchRawOptions, fetchOptions, options, toSelectOption]);
200
- (0, react_1.useEffect)(() => {
201
- runSearch(debouncedQuery);
202
- }, [debouncedQuery, runSearch]);
203
- const handleInputChange = (e) => {
204
- const next = e.target.value;
205
- setInputValue(next);
206
- setIsOpen(true);
207
- if (onChange)
208
- onChange(e);
209
- };
210
- const notifySelection = (0, react_1.useCallback)((newRawValues) => {
211
- // Legacy emit with mapped options
212
- if (onClick) {
213
- const mapped = newRawValues.map(toSelectOption);
214
- onClick(isMultiSelect ? mapped : mapped[0] || null);
215
157
  }
216
- // New typed emit with T
217
- if (onValueChange) {
218
- onValueChange(isMultiSelect ? newRawValues : newRawValues[0] ?? null);
158
+ else {
159
+ // Filter options to only show items that match the search text
160
+ const searchText = String(value).trim();
161
+ const filtered = (options ?? []).filter((option) => {
162
+ // Check for label, content, or value properties
163
+ const optionLabel = String(option.label || option.content || '');
164
+ return optionLabel.toLowerCase().includes(searchText.toLowerCase());
165
+ });
166
+ console.log('Search text:', searchText);
167
+ console.log('Filtered options:', filtered);
168
+ setFilteredOptions(filtered);
169
+ setHasSearched(true);
219
170
  }
220
- }, [isMultiSelect, onClick, onValueChange, toSelectOption]);
221
- const clearValue = (e, option) => {
222
- e.stopPropagation();
223
- const newRawValues = selectedRawValues.filter((val) => toSelectOption(val).value !== option.value);
224
- setSelectedRawValues(newRawValues);
225
- notifySelection(newRawValues);
226
171
  };
227
- const selectOption = (option) => {
228
- if (isMultiSelect) {
229
- const newRawValues = [...selectedRawValues];
230
- const already = newRawValues.some((val) => toSelectOption(val).value === option.value);
231
- if (!already) {
232
- // Try to find original raw item by value match; if not found, fallback to option payload
233
- const raw = (options ?? []).find((item) => toSelectOption(item).value === option.value);
234
- newRawValues.push(raw ?? option);
235
- }
236
- setSelectedRawValues(newRawValues);
237
- notifySelection(newRawValues);
238
- }
239
- else {
240
- // Try to map back to raw by value
241
- const raw = (options ?? []).find((item) => toSelectOption(item).value === option.value);
242
- const nextRaw = raw ?? option;
243
- setSelectedRawValues([nextRaw]);
244
- notifySelection([nextRaw]);
172
+ const handleKeyDown = (e) => {
173
+ if (isDisabled)
174
+ return;
175
+ switch (e.key) {
176
+ case 'Enter':
177
+ e.preventDefault();
178
+ if (isOpen) {
179
+ if (filteredOptions.length > 0 && highlightedIndex < filteredOptions.length) {
180
+ selectOption(filteredOptions[highlightedIndex]);
181
+ }
182
+ else if (isCreatable &&
183
+ inputValue &&
184
+ !filteredOptions.some((o) => o.label === inputValue)) {
185
+ handleCreateOption();
186
+ }
187
+ setIsOpen(false);
188
+ }
189
+ else {
190
+ setIsOpen(true);
191
+ }
192
+ break;
193
+ case 'Escape':
194
+ setIsOpen(false);
195
+ break;
196
+ case 'ArrowUp':
197
+ e.preventDefault();
198
+ if (isOpen) {
199
+ setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : filteredOptions.length - 1));
200
+ }
201
+ else {
202
+ setIsOpen(true);
203
+ }
204
+ break;
205
+ case 'ArrowDown':
206
+ e.preventDefault();
207
+ if (isOpen) {
208
+ setHighlightedIndex((prev) => (prev < filteredOptions.length - 1 ? prev + 1 : 0));
209
+ }
210
+ else {
211
+ setIsOpen(true);
212
+ }
213
+ break;
245
214
  }
246
- setInputValue('');
247
- setIsOpen(false);
248
- setHasSearched(false);
249
215
  };
250
216
  const handleCreateOption = async () => {
251
- if (!inputValue.trim() || !isCreatable)
217
+ if (!inputValue.trim() || !isCreatable || !onCreateOption)
252
218
  return;
253
219
  setInternalLoading(true);
254
220
  try {
255
- // Prefer typed creator
256
- let createdRaw;
257
- if (mapCreateOption) {
258
- createdRaw = await Promise.resolve(mapCreateOption(inputValue));
259
- }
260
- if (!createdRaw) {
261
- if (onCreateOption) {
262
- await onCreateOption(inputValue);
263
- }
264
- // Fallback: fabricate SelectOption consistent with prior behavior
265
- const text = String(inputValue);
266
- const newOption = {
267
- label: text,
268
- content: text,
269
- value: text.replace(/\s+/g, '-'),
270
- };
271
- selectOption(newOption);
272
- }
273
- else {
274
- const nextValues = isMultiSelect ? [...selectedRawValues, createdRaw] : [createdRaw];
275
- setSelectedRawValues(nextValues);
276
- notifySelection(nextValues);
277
- }
221
+ await onCreateOption(inputValue);
222
+ // Create value without toLowerCase
223
+ const safeInputValue = String(inputValue);
224
+ const newOption = {
225
+ label: safeInputValue,
226
+ content: safeInputValue, // Add content property for compatibility
227
+ value: safeInputValue.replace(/\s+/g, '-'),
228
+ };
229
+ selectOption(newOption);
278
230
  setInputValue('');
279
231
  setHasSearched(false);
280
232
  }
@@ -293,56 +245,47 @@ isCreatable = true, isMultiSelect = false, noOptionsMessage = 'No options availa
293
245
  }
294
246
  }
295
247
  };
248
+ const clearValue = (e, option) => {
249
+ e.stopPropagation();
250
+ const newValues = selectedValues.filter((val) => val.value !== option.value);
251
+ setSelectedValues(newValues);
252
+ // Use onClick instead of onChange for selection updates
253
+ if (onClick) {
254
+ onClick(isMultiSelect ? newValues : newValues[0] || null);
255
+ }
256
+ };
257
+ const selectOption = (option) => {
258
+ if (isMultiSelect) {
259
+ const newValues = [...selectedValues];
260
+ if (!newValues.some((val) => val.value === option.value)) {
261
+ newValues.push(option);
262
+ }
263
+ setSelectedValues(newValues);
264
+ // Use onClick instead of onChange for selection updates
265
+ if (onClick) {
266
+ onClick(newValues);
267
+ }
268
+ }
269
+ else {
270
+ setSelectedValues([option]);
271
+ // Use onClick instead of onChange for selection updates
272
+ if (onClick) {
273
+ onClick(option);
274
+ }
275
+ }
276
+ setInputValue('');
277
+ setIsOpen(false);
278
+ setHasSearched(false);
279
+ };
296
280
  const showLoading = isLoading || internalLoading;
297
281
  const handleAddIconClick = (e) => {
298
282
  e.stopPropagation();
299
- if (onAddClick)
283
+ if (onAddClick) {
284
+ // Pass the required argument to onAddClick
300
285
  onAddClick(true);
286
+ }
301
287
  };
302
- return (react_1.default.createElement("div", { ref: containerRef, className: `relative w-full ${className} ${styles.container}`, onKeyDown: (e) => {
303
- if (isDisabled)
304
- return;
305
- switch (e.key) {
306
- case 'Enter':
307
- e.preventDefault();
308
- if (isOpen) {
309
- if (filteredOptions.length > 0 && highlightedIndex < filteredOptions.length) {
310
- selectOption(filteredOptions[highlightedIndex]);
311
- }
312
- else if (isCreatable &&
313
- inputValue &&
314
- !filteredOptions.some((o) => o.label === inputValue)) {
315
- handleCreateOption();
316
- }
317
- setIsOpen(false);
318
- }
319
- else {
320
- setIsOpen(true);
321
- }
322
- break;
323
- case 'Escape':
324
- setIsOpen(false);
325
- break;
326
- case 'ArrowUp':
327
- e.preventDefault();
328
- if (isOpen) {
329
- setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : filteredOptions.length - 1));
330
- }
331
- else {
332
- setIsOpen(true);
333
- }
334
- break;
335
- case 'ArrowDown':
336
- e.preventDefault();
337
- if (isOpen) {
338
- setHighlightedIndex((prev) => (prev < filteredOptions.length - 1 ? prev + 1 : 0));
339
- }
340
- else {
341
- setIsOpen(true);
342
- }
343
- break;
344
- }
345
- } },
288
+ return (react_1.default.createElement("div", { ref: containerRef, className: `relative w-full ${className} ${styles.container}`, onKeyDown: handleKeyDown },
346
289
  label && react_1.default.createElement("label", { className: "block text-sm font-medium text-gray-700 mb-1" }, label),
347
290
  react_1.default.createElement("div", { className: `${styles.trigger} ${isDisabled ? 'bg-gray-100 cursor-not-allowed' : ''} ${isOpen ? 'border-blue-500 ring-2 ring-blue-100' : 'border-gray-300'}`, onClick: toggleDropdown },
348
291
  react_1.default.createElement("div", { className: "flex-grow flex items-center overflow-x-auto no-scrollbar" },
@@ -372,12 +315,10 @@ isCreatable = true, isMultiSelect = false, noOptionsMessage = 'No options availa
372
315
  filteredOptions.length === 0 &&
373
316
  inputValue &&
374
317
  hasSearched &&
375
- renderNoResults(noResultsFound, styles?.noResults ?? '', iconSrc.create),
318
+ renderNoResults(noResultsFound, styles?.noResults, iconSrc.create),
376
319
  isCreatable &&
377
320
  inputValue &&
378
- !(options ?? [])
379
- .map(toSelectOption)
380
- .some((o) => (o.label || o.content) === inputValue) && (react_1.default.createElement("div", { className: styles.createOption, onClick: handleCreateOption },
321
+ !options?.some((o) => (o.label || o.content) === inputValue) && (react_1.default.createElement("div", { className: styles.createOption, onClick: handleCreateOption },
381
322
  renderIcon(iconSrc.create, styles.icon),
382
323
  react_1.default.createElement("span", null,
383
324
  createOptionMessage,
@@ -1,4 +1,20 @@
1
1
  import React from 'react';
2
2
  import { InputMultiselectProps } from '../../types/Inputs/InputMultiselectType';
3
- declare const InputMultiselect: ({ label, required, textError, placeholder, onChangeHandler, autoComplete, value, autoFocus, onFocusHandler, onKeyUpHandler, handleKeyDown: propHandleKeyDown, onBlurHandler, closeIconSRC, inputRef, style, }: InputMultiselectProps) => React.JSX.Element;
3
+ /**
4
+ * @param {string} label - The label for the input field.
5
+ * @param {boolean} required - Indicates whether the input is required.
6
+ * @param {string | undefined} textError - The error message to display if validation fails.
7
+ * @param {string} placeholder - The placeholder text for the input field.
8
+ * @param {Function} onChangeHandler - Callback function triggered when the list of items changes.
9
+ * @param {boolean} autoComplete - Specifies whether autocomplete is enabled for the input field.
10
+ * @param {string[]} value - The initial list of selected items. => string[]
11
+ * @param {boolean} autoFocus - Determines whether the input should autofocus on render.
12
+ * @param {Function | undefined} onFocusHandler - Callback function triggered when the input gains focus.
13
+ * @param {Function | undefined} onKeyUpHandler - Callback function triggered when a key is released while the input is focused.
14
+ * @param {Function | undefined} handleKeyDown - Callback function triggered when a key is pressed while the input is focused.
15
+ * @param {Function | undefined} onBlurHandler - Callback function triggered when the input loses focus.
16
+ * @param {string} closeIconSRC - The source URL for the close icon image.
17
+ * @param {string} [width=w-full] - The width of the input container, with a default value of 'w-full'.
18
+ */
19
+ declare const InputMultiselect: ({ label, required, textError, placeholder, onChangeHandler, autoComplete, value, autoFocus, onFocusHandler, onKeyUpHandler, handleKeyDown: propHandleKeyDown, onBlurHandler, closeIconSRC, style, }: InputMultiselectProps) => React.JSX.Element;
4
20
  export default InputMultiselect;
@@ -39,48 +39,52 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  const react_1 = __importStar(require("react"));
41
41
  const image_1 = __importDefault(require("next/image"));
42
- const InputMultiselect = ({ label, required, textError, placeholder, onChangeHandler, autoComplete, value, autoFocus, onFocusHandler, onKeyUpHandler, handleKeyDown: propHandleKeyDown, onBlurHandler, closeIconSRC, inputRef, style = {
42
+ /**
43
+ * @param {string} label - The label for the input field.
44
+ * @param {boolean} required - Indicates whether the input is required.
45
+ * @param {string | undefined} textError - The error message to display if validation fails.
46
+ * @param {string} placeholder - The placeholder text for the input field.
47
+ * @param {Function} onChangeHandler - Callback function triggered when the list of items changes.
48
+ * @param {boolean} autoComplete - Specifies whether autocomplete is enabled for the input field.
49
+ * @param {string[]} value - The initial list of selected items. => string[]
50
+ * @param {boolean} autoFocus - Determines whether the input should autofocus on render.
51
+ * @param {Function | undefined} onFocusHandler - Callback function triggered when the input gains focus.
52
+ * @param {Function | undefined} onKeyUpHandler - Callback function triggered when a key is released while the input is focused.
53
+ * @param {Function | undefined} handleKeyDown - Callback function triggered when a key is pressed while the input is focused.
54
+ * @param {Function | undefined} onBlurHandler - Callback function triggered when the input loses focus.
55
+ * @param {string} closeIconSRC - The source URL for the close icon image.
56
+ * @param {string} [width=w-full] - The width of the input container, with a default value of 'w-full'.
57
+ */
58
+ const InputMultiselect = ({ label, required, textError, placeholder, onChangeHandler, autoComplete, value, autoFocus, onFocusHandler, onKeyUpHandler, handleKeyDown: propHandleKeyDown, onBlurHandler, closeIconSRC, style = {
43
59
  margin: 'mt-[-6px]',
44
60
  width: 'w-full',
45
61
  }, }) => {
46
62
  const [items, setItems] = (0, react_1.useState)([]);
47
63
  const [currentValue, setCurrentValue] = (0, react_1.useState)('');
48
64
  const [showError, setShowError] = (0, react_1.useState)(false);
65
+ const inputRef = (0, react_1.useRef)(null);
49
66
  const isErrorVisible = () => {
50
- // Show error if there's a textError OR if there's unconfirmed input
51
- return (textError && textError.trim() !== '') || showError;
67
+ return !(textError && textError.trim() !== '');
52
68
  };
53
- const getErrorMessage = () => {
54
- if (textError && textError.trim() !== '') {
55
- return textError.trim();
56
- }
57
- if (showError && currentValue.trim() !== '') {
58
- return 'برای ثبت بارکد کلید Enter را فشار دهید';
69
+ (0, react_1.useEffect)(() => {
70
+ if (inputRef.current) {
71
+ inputRef.current.value = currentValue;
59
72
  }
60
- return '';
61
- };
62
- // Initialize items from value prop only once
73
+ }, [currentValue]);
63
74
  (0, react_1.useEffect)(() => {
64
- if (value && value.length > 0 && items.length === 0) {
75
+ if (value && value.length > 0) {
65
76
  setItems(value);
66
77
  }
67
- }, [value, items.length]);
78
+ }, [value]);
68
79
  const handleChange = (e) => {
69
80
  setCurrentValue(e.target.value);
70
- // Hide error when user starts typing
71
- if (showError) {
72
- setShowError(false);
73
- }
74
81
  };
75
82
  const handleKeyDown = (e) => {
76
83
  if (e.key === 'Enter' && currentValue.trim() !== '') {
77
84
  e.preventDefault();
78
- const newItems = [...items, currentValue.trim()];
79
- setItems(newItems);
85
+ setItems((prevItems) => [...prevItems, currentValue.trim()]);
80
86
  setCurrentValue('');
81
87
  setShowError(false); // Reset error on Enter
82
- // Call onChangeHandler directly here instead of in useEffect
83
- onChangeHandler(newItems);
84
88
  }
85
89
  propHandleKeyDown?.(e);
86
90
  };
@@ -90,29 +94,23 @@ const InputMultiselect = ({ label, required, textError, placeholder, onChangeHan
90
94
  }
91
95
  onBlurHandler?.(e);
92
96
  };
93
- // Remove the problematic useEffect that was causing the loop
94
- // useEffect((): void => {
95
- // onChangeHandler(items);
96
- // }, [items]);
97
- const handleRemoveItem = (0, react_1.useCallback)((index) => {
98
- setItems((prevItems) => {
99
- const newItems = prevItems.filter((_, i) => i !== index);
100
- // Call onChangeHandler directly here
101
- onChangeHandler(newItems);
102
- return newItems;
103
- });
104
- }, [onChangeHandler]);
97
+ (0, react_1.useEffect)(() => {
98
+ onChangeHandler(items);
99
+ }, [items]);
100
+ const handleRemoveItem = (index) => {
101
+ setItems((prevItems) => prevItems.filter((_, i) => i !== index));
102
+ };
105
103
  return (react_1.default.createElement("div", { className: `${style.width} ${style.margin} relative ` },
106
104
  react_1.default.createElement("label", { htmlFor: label, className: "flex items-center gap-2 mx-3" },
107
105
  react_1.default.createElement("p", { className: "text-sm text-text-color-primary font-medium cursor-pointer" }, label),
108
106
  react_1.default.createElement("span", { className: `text-red-primary font-bold ${required ? 'block' : 'hidden'}` }, "*")),
109
107
  react_1.default.createElement("div", { className: `w-full h-10 flex gap-1 items-center justify-between bg-inherit outline-none border rounded-lg text-sm px-2 ${isErrorVisible()
110
- ? 'border-red-primary'
111
- : 'border-gray-tertiary focus:border-gray-quaternary'}` },
108
+ ? 'border-gray-tertiary focus:border-gray-quaternary'
109
+ : 'border-red-primary'}` },
112
110
  items.map((item, index) => (react_1.default.createElement("span", { key: index, className: "bg-gray-secondary text-text-color-primary px-2 py-1 rounded flex items-center justify-center gap-1" },
113
111
  item,
114
112
  react_1.default.createElement(image_1.default, { src: closeIconSRC, alt: "close", width: 22, height: 22, onClick: () => handleRemoveItem(index), className: "inline-block cursor-pointer" })))),
115
- react_1.default.createElement("input", { ref: inputRef, type: "text", value: currentValue, id: label, placeholder: items.length === 0 ? placeholder : '', onChange: handleChange, autoComplete: autoComplete ? 'on' : 'off', autoFocus: autoFocus, className: "outline-none bg-inherit flex-grow", required: required, onFocus: onFocusHandler, onKeyUp: onKeyUpHandler, onKeyDown: handleKeyDown, onBlur: handleBlur })),
116
- isErrorVisible() && react_1.default.createElement("p", { className: "text-sm mt-1 text-red-primary" }, getErrorMessage())));
113
+ react_1.default.createElement("input", { ref: inputRef, type: "text", id: label, placeholder: items.length === 0 ? placeholder : '', onChange: handleChange, autoComplete: autoComplete ? 'on' : 'off', autoFocus: autoFocus, className: "outline-none bg-inherit flex-grow", required: required, onFocus: onFocusHandler, onKeyUp: onKeyUpHandler, onKeyDown: handleKeyDown, onBlur: handleBlur })),
114
+ !isErrorVisible() && react_1.default.createElement("p", { className: "text-sm mt-1 text-red-primary" }, textError?.trim())));
117
115
  };
118
116
  exports.default = InputMultiselect;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { HeaderLayoutProps } from '../../../types/Layout/Headers/HeaderLayout';
1
+ import React from "react";
2
+ import { HeaderLayoutProps } from "../../../types/Layout/Headers/HeaderLayout";
3
3
  /**
4
4
  * The component accepts the following props:
5
5
  * @param branchName - User's branch name to use in the logo URL.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- 'use client';
2
+ "use client";
3
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k;
5
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -123,17 +123,17 @@ const ModalSearchContentInHeader_1 = __importDefault(require("../../sections/com
123
123
  * ```
124
124
  * @param refreshPageHandler - Function to refresh the page when the refresh icon is clicked.
125
125
  */
126
- const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, userLastName, logOutText, logOutHandler, modalData, modalItemOnClickHandler, iconsSRC, cdnURL, userBranchesData, selectBranchHandler, sidebarData, searchIconSRC, searchItemHandler, refreshPageHandler, brandNameText, languages, changeLanguageHandler, onLogoClickHandler }) => {
126
+ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, userLastName, logOutText, logOutHandler, modalData, modalItemOnClickHandler, iconsSRC, cdnURL, userBranchesData, selectBranchHandler, sidebarData, searchIconSRC, searchItemHandler, refreshPageHandler, brandNameText, languages, changeLanguageHandler, onLogoClickHandler, }) => {
127
127
  const [isShowModalSearch, setIsShowModalSearch] = (0, react_1.useState)(false);
128
128
  const [isOpenModal, setIsOpenModal] = (0, react_1.useState)(false);
129
129
  const [isOpenModalBranches, setIsOpenModalBranches] = (0, react_1.useState)(false);
130
130
  const [isOpenLanguageModal, setIsOpenLanguageModal] = (0, react_1.useState)(false);
131
131
  const [branchNameSelected, setBranchNameSelected] = (0, react_1.useState)({
132
132
  id: 0,
133
- name: '',
134
- urlName: '',
135
- imageName: '',
136
- logoName: '',
133
+ name: "",
134
+ urlName: "",
135
+ imageName: "",
136
+ logoName: "",
137
137
  });
138
138
  const modalCloseRefPC = (0, react_1.useRef)(null);
139
139
  const modalCloseRefMobile = (0, react_1.useRef)(null);
@@ -177,9 +177,9 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
177
177
  setIsOpenModal(false);
178
178
  }
179
179
  };
180
- document.addEventListener('click', handleClickOutside);
180
+ document.addEventListener("click", handleClickOutside);
181
181
  return () => {
182
- document.removeEventListener('click', handleClickOutside);
182
+ document.removeEventListener("click", handleClickOutside);
183
183
  };
184
184
  }, []);
185
185
  (0, react_1.useEffect)(() => {
@@ -191,9 +191,9 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
191
191
  setIsOpenModalBranches(false);
192
192
  }
193
193
  };
194
- document.addEventListener('click', handleClickOutsideBranches);
194
+ document.addEventListener("click", handleClickOutsideBranches);
195
195
  return () => {
196
- document.removeEventListener('click', handleClickOutsideBranches);
196
+ document.removeEventListener("click", handleClickOutsideBranches);
197
197
  };
198
198
  }, []);
199
199
  (0, react_1.useEffect)(() => {
@@ -205,9 +205,9 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
205
205
  setIsOpenLanguageModal(false);
206
206
  }
207
207
  };
208
- document.addEventListener('click', handleClickOutsideLanguage);
208
+ document.addEventListener("click", handleClickOutsideLanguage);
209
209
  return () => {
210
- document.removeEventListener('click', handleClickOutsideLanguage);
210
+ document.removeEventListener("click", handleClickOutsideLanguage);
211
211
  };
212
212
  }, []);
213
213
  const baseUrlCDN = cdnURL !== undefined ? cdnURL : process.env.NEXT_PUBLIC_IMAGE_BASE_URL;
@@ -224,23 +224,29 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
224
224
  react_1.default.createElement(image_1.default, { src: iconsSRC.logoSRC, alt: "logo", width: 40, height: 40, className: "select-none-custom h-10 w-10", onClick: () => {
225
225
  onLogoClickHandler();
226
226
  } }))),
227
- react_1.default.createElement("div", { ref: modalCloseRefuserBranchesPC, className: `relative bg-inherit ${branchNameSelected?.id === 0 ? 'hidden' : 'flex'}` },
227
+ react_1.default.createElement("div", { ref: modalCloseRefuserBranchesPC, className: `relative bg-inherit ${branchNameSelected?.id === 0 ? "hidden" : "flex"}` },
228
228
  react_1.default.createElement("div", { onClick: handleModalShowBranches, className: "select-none-custom flex flex-row items-center justify-center gap-3" },
229
229
  react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 24, height: 24, className: `rounded-md ${userBranchesData !== undefined && userBranchesData.length === 1
230
- ? 'cursor-default'
231
- : 'cursor-pointer'}` }),
230
+ ? "cursor-default"
231
+ : "cursor-pointer"}` }),
232
232
  react_1.default.createElement("p", { className: `${userBranchesData !== undefined && userBranchesData.length === 1
233
- ? 'cursor-default'
234
- : 'cursor-pointer'}` }, branchNameSelected.name),
233
+ ? "cursor-default"
234
+ : "cursor-pointer"}` }, branchNameSelected.name),
235
235
  react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `customTransition ${userBranchesData !== undefined && userBranchesData.length === 1
236
- ? 'hidden'
236
+ ? "hidden"
237
237
  : isOpenModalBranches
238
- ? 'flex rotate-180 cursor-pointer'
239
- : 'flex rotate-0 cursor-pointer'}` })),
240
- react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-0 top-[30px] z-60 w-auto rounded-lg bg-white-color p-tiny ${isOpenModalBranches ? 'scale-y-100 opacity-100' : 'scale-y-0 opacity-0'} origin-top` },
238
+ ? "flex rotate-180 cursor-pointer"
239
+ : "flex rotate-0 cursor-pointer"}` })),
240
+ react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-0 top-[30px] z-60 w-auto rounded-lg bg-white-color p-tiny ${isOpenModalBranches
241
+ ? "scale-y-100 opacity-100"
242
+ : "scale-y-0 opacity-0"} origin-top` },
241
243
  react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 bg-inherit p-3" }, userBranchesData &&
242
244
  userBranchesData.map((item) => (react_1.default.createElement("li", { onClick: () => selectItemBranchHandler(item), key: item?.id, className: "customTransition flex w-full flex-row items-center justify-end gap-2 rounded-tiny px-5 py-2 text-text-color-primary hover:bg-gray-primary" },
243
- react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 16, height: 16, className: "rounded-xl" }),
245
+ react_1.default.createElement(image_1.default, { src: branchNameSelected.logoName === " " ||
246
+ branchNameSelected.logoName === null ||
247
+ branchNameSelected.logoName === undefined
248
+ ? "/defaultImage.jpg"
249
+ : `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 16, height: 16, className: "rounded-xl" }),
244
250
  react_1.default.createElement("p", { className: "select-none-custom cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, item.name))))))),
245
251
  react_1.default.createElement("div", { ref: modalCloseRefPC, className: "flex h-full flex-row-reverse items-center justify-center gap-4" },
246
252
  react_1.default.createElement("div", { onClick: handleModalShow, className: "border-primaryBorderColor relative flex cursor-pointer flex-row items-center justify-center gap-1 rounded-lg border border-solid p-tiny" },
@@ -249,8 +255,8 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
249
255
  react_1.default.createElement("div", { className: "flex flex-row items-center justify-center gap-1" },
250
256
  react_1.default.createElement("p", { className: "select-none-custom" }, userFirstName),
251
257
  react_1.default.createElement("p", { className: "select-none-custom" }, userLastName)),
252
- react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow-down.svg", width: 10, height: 10, className: `select-none-custom customTransition ${isOpenModal ? 'rotate-180' : 'rotate-0'}` })),
253
- react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-2 top-[40px] z-60 w-[216px] rounded-lg bg-white-color p-tiny ${isOpenModal ? 'scale-y-100 opacity-100' : 'scale-y-0 opacity-0'} origin-top` },
258
+ react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow-down.svg", width: 10, height: 10, className: `select-none-custom customTransition ${isOpenModal ? "rotate-180" : "rotate-0"}` })),
259
+ react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-2 top-[40px] z-60 w-[216px] rounded-lg bg-white-color p-tiny ${isOpenModal ? "scale-y-100 opacity-100" : "scale-y-0 opacity-0"} origin-top` },
254
260
  react_1.default.createElement("ul", { className: "flex h-full w-full flex-col items-start justify-center gap-3 p-3" },
255
261
  modalData &&
256
262
  modalData.map((item) => (react_1.default.createElement("li", { onClick: () => {
@@ -275,25 +281,29 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
275
281
  react_1.default.createElement("div", { ref: modalCloseRefLanguagePC, className: "relative" },
276
282
  react_1.default.createElement("div", { className: "cursor-pointer", onClick: handleLanguageModalShow },
277
283
  react_1.default.createElement(image_1.default, { src: iconsSRC.languageIconSRC, alt: "language.svg", width: 20, height: 20, className: "customTransition h-5 w-5 hover:scale-125" })),
278
- react_1.default.createElement("div", { className: `customShadowBox customTransition absolute -right-[38px] top-[35px] z-[80000] w-fit rounded-lg bg-white-color p-tiny ${isOpenLanguageModal ? 'scale-y-100 opacity-100' : 'scale-y-0 opacity-0'} origin-top` },
284
+ react_1.default.createElement("div", { className: `customShadowBox customTransition absolute -right-[38px] top-[35px] z-[80000] w-fit rounded-lg bg-white-color p-tiny ${isOpenLanguageModal
285
+ ? "scale-y-100 opacity-100"
286
+ : "scale-y-0 opacity-0"} origin-top` },
279
287
  react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-end gap-3 p-3" }, languages.map((language) => (react_1.default.createElement("li", { key: language?.id, onClick: () => selectLanguageHandler(language), className: "customTransition flex w-full flex-row items-center justify-between gap-2 rounded-tiny px-5 py-2 text-text-color-primary hover:bg-gray-primary" },
280
288
  react_1.default.createElement(image_1.default, { src: language.flagIcon, alt: `${language.showName}-flag`, width: 16, height: 16, className: "rounded-sm" }),
281
289
  react_1.default.createElement("p", { className: "select-none-custom w-full cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, language.showName)))))))))),
282
290
  react_1.default.createElement("header", { style: { zIndex: 100 }, className: "flex h-11 w-full flex-row items-center justify-between bg-back-ground-color-primary px-5 xl:hidden fixed top-0 z-layout" },
283
291
  react_1.default.createElement("div", { onClick: sidebarHandler, className: "border-primaryBorderColor flex h-8 w-9 cursor-pointer flex-row items-center justify-center rounded-lg border border-solid p-1" },
284
292
  react_1.default.createElement(image_1.default, { src: iconsSRC.menuIconSRC, alt: "menu.svg", width: 20, height: 20, className: "h-full w-full" })),
285
- react_1.default.createElement("div", { ref: modalCloseRefuserBranchesMobile, className: `relative bg-inherit ${branchNameSelected?.id === 0 ? 'hidden' : 'flex'}` },
293
+ react_1.default.createElement("div", { ref: modalCloseRefuserBranchesMobile, className: `relative bg-inherit ${branchNameSelected?.id === 0 ? "hidden" : "flex"}` },
286
294
  react_1.default.createElement("div", { onClick: handleModalShowBranches, className: "select-none-custom flex flex-row items-center justify-center gap-3" },
287
295
  react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${branchNameSelected.logoName}`, alt: "logo.svg", width: 24, height: 24, className: `rounded-md ${userBranchesData !== undefined && userBranchesData.length === 1
288
- ? 'cursor-default'
289
- : 'cursor-pointer'}` }),
296
+ ? "cursor-default"
297
+ : "cursor-pointer"}` }),
290
298
  react_1.default.createElement("p", { className: `${userBranchesData !== undefined && userBranchesData.length === 1
291
- ? 'cursor-default'
292
- : 'cursor-pointer'}` }, branchNameSelected.name),
299
+ ? "cursor-default"
300
+ : "cursor-pointer"}` }, branchNameSelected.name),
293
301
  react_1.default.createElement(image_1.default, { src: iconsSRC.arrowSRC, alt: "arrow.svg", width: 16, height: 16, className: `${userBranchesData !== undefined && userBranchesData.length === 1
294
- ? 'hidden'
295
- : 'flex cursor-pointer'}` })),
296
- react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-0 top-[40px] z-60 w-auto rounded-lg bg-white-color p-tiny ${isOpenModalBranches ? 'scale-y-100 opacity-100' : 'scale-y-0 opacity-0'} origin-top` },
302
+ ? "hidden"
303
+ : "flex cursor-pointer"}` })),
304
+ react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-0 top-[40px] z-60 w-auto rounded-lg bg-white-color p-tiny ${isOpenModalBranches
305
+ ? "scale-y-100 opacity-100"
306
+ : "scale-y-0 opacity-0"} origin-top` },
297
307
  react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 bg-inherit p-3" }, userBranchesData &&
298
308
  userBranchesData.map((item) => (react_1.default.createElement("li", { onClick: () => selectItemBranchHandler(item), key: item?.id, className: "customTransition flex w-full flex-row items-center justify-end gap-2 rounded-tiny px-5 py-2 text-text-color-primary hover:bg-gray-primary" },
299
309
  react_1.default.createElement(image_1.default, { src: `${baseUrlCDN}/${branchName}/${item.logoName}`, alt: "logo.svg", width: 16, height: 16, className: "rounded-xl" }),
@@ -307,13 +317,15 @@ const HeaderLayout = ({ appVersion, branchName, userFirstName, sidebarHandler, u
307
317
  react_1.default.createElement("div", { ref: modalCloseRefLanguageMobile, className: "relative" },
308
318
  react_1.default.createElement("div", { className: "customTransition mr-2 cursor-pointer hover:scale-125", onClick: handleLanguageModalShow },
309
319
  react_1.default.createElement(image_1.default, { src: iconsSRC.languageIconSRC, alt: "language.svg", width: 28, height: 28, className: "h-8 w-8" })),
310
- react_1.default.createElement("div", { className: `customShadowBox customTransition absolute -right-[29px] top-[40px] z-[80000] w-fit rounded-lg bg-white-color p-tiny ${isOpenLanguageModal ? 'scale-y-100 opacity-100' : 'scale-y-0 opacity-0'} origin-top` },
320
+ react_1.default.createElement("div", { className: `customShadowBox customTransition absolute -right-[29px] top-[40px] z-[80000] w-fit rounded-lg bg-white-color p-tiny ${isOpenLanguageModal
321
+ ? "scale-y-100 opacity-100"
322
+ : "scale-y-0 opacity-0"} origin-top` },
311
323
  react_1.default.createElement("ul", { className: "flex h-auto w-full flex-col items-start justify-center gap-3 p-3" }, languages.map((language) => (react_1.default.createElement("li", { key: language?.id, onClick: () => selectLanguageHandler(language), className: "customTransition flex w-full flex-row items-center justify-between gap-2 rounded-tiny px-5 py-2 text-text-color-primary hover:bg-gray-primary" },
312
324
  react_1.default.createElement(image_1.default, { src: language.flagIcon, alt: `${language.showName}-flag`, width: 16, height: 16, className: "rounded-sm" }),
313
325
  react_1.default.createElement("p", { className: "select-none-custom w-full cursor-pointer text-nowrap text-sm font-normal text-text-color-primary" }, language.showName))))))),
314
326
  react_1.default.createElement("div", { onClick: handleModalShow, className: "mr-2 flex h-8 w-10 cursor-pointer flex-row items-center justify-center rounded-lg border border-solid border-border-color-primary bg-inherit" },
315
327
  react_1.default.createElement(image_1.default, { src: iconsSRC.iconProfileUserSRC, alt: "profile.svg", width: 18, height: 18 })),
316
- react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-4 top-10 z-60 w-[182px] rounded-lg bg-white-color p-tiny ${isOpenModal ? 'scale-y-100 opacity-100' : 'scale-y-0 opacity-0'} origin-top` },
328
+ react_1.default.createElement("div", { className: `customShadowBox customTransition absolute left-4 top-10 z-60 w-[182px] rounded-lg bg-white-color p-tiny ${isOpenModal ? "scale-y-100 opacity-100" : "scale-y-0 opacity-0"} origin-top` },
317
329
  react_1.default.createElement("ul", { className: "flex h-full w-full flex-col items-start justify-center gap-3 p-3" },
318
330
  modalData.length > 0 &&
319
331
  modalData.map((item) => (react_1.default.createElement("li", { onClick: () => {
@@ -39,18 +39,11 @@ export type NoResultsType = ReactNode | string | {
39
39
  icon?: IconType;
40
40
  text: string;
41
41
  };
42
- export type ToOptionMapper<T> = (item: T) => SelectOption;
43
- export type CreateOptionMapper<T> = (inputValue: string) => Promise<T> | T;
44
- export type CreatableSelectProps<T = SelectOption> = {
45
- options: T[] | null;
46
- value: T | T[] | null;
42
+ export type CreatableSelectProps = {
43
+ options: SelectOption[] | null;
44
+ value: SelectOption | SelectOption[] | null;
47
45
  onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
48
46
  onClick?: (value: SelectOption | SelectOption[] | null) => void;
49
- onValueChange?: (value: T | T[] | null) => void;
50
- toOption?: ToOptionMapper<T>;
51
- fetchRawOptions?: (inputValue: string) => Promise<T[]>;
52
- fetchOptions?: (inputValue: string) => Promise<SelectOption[]>;
53
- mapCreateOption?: CreateOptionMapper<T>;
54
47
  onCreateOption?: (inputValue: string) => Promise<void> | void;
55
48
  placeholder?: string;
56
49
  isLoading?: boolean;
@@ -65,6 +58,7 @@ export type CreatableSelectProps<T = SelectOption> = {
65
58
  tailwindStyle?: TailwindStyleProps;
66
59
  label?: string;
67
60
  iconSrc: IconSourceProps;
61
+ fetchOptions?: (inputValue: string) => Promise<SelectOption[]>;
68
62
  onAddClick: (e: boolean) => void;
69
63
  isMultiSelect?: boolean;
70
64
  };
@@ -6,13 +6,12 @@ export interface InputMultiselectProps {
6
6
  autoComplete: boolean;
7
7
  autoFocus: boolean;
8
8
  value: string[] | null;
9
- onChangeHandler: (value: string[]) => void;
9
+ onChangeHandler: any;
10
10
  onFocusHandler?: (event: React.FocusEvent) => void;
11
11
  onKeyUpHandler?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
12
12
  handleKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
13
13
  onBlurHandler?: (event: React.FocusEvent) => void;
14
14
  closeIconSRC: string;
15
- inputRef?: React.RefObject<HTMLInputElement>;
16
15
  style?: {
17
16
  width?: string;
18
17
  margin?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hi-tm",
3
- "version": "0.3.9",
3
+ "version": "0.4.1",
4
4
  "styles": "dist/styles/globals.css",
5
5
  "main": "dist/index.js",
6
6
  "exports": {