hi-tm 0.7.2 → 0.7.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.
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SelectOption, CreatableSelectProps } from '../../types/DropDown/CreatableDropDown';
|
|
3
|
-
|
|
4
|
-
export default _default;
|
|
3
|
+
export default function CreatableSelect<T = SelectOption>({ options, value, onChange, onClick, onValueChange, onCreateOption, placeholder, isLoading, isDisabled, isCreatable, isMultiSelect, noOptionsMessage, noResultsFound, loadingMessage, createOptionMessage, className, tailwindStyle, iconSrc, fetchOptions, label, onAddClick, getOptionLabel, getOptionValue, }: CreatableSelectProps<T>): React.JSX.Element;
|
|
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.default = CreatableSelect;
|
|
36
37
|
const react_1 = __importStar(require("react"));
|
|
37
38
|
// Default Tailwind styles
|
|
38
39
|
const defaultStyles = {
|
|
@@ -86,7 +87,7 @@ const renderNoResults = (noResults, className, searchIcon) => {
|
|
|
86
87
|
return noResults;
|
|
87
88
|
}
|
|
88
89
|
};
|
|
89
|
-
|
|
90
|
+
function CreatableSelect({ options = [], value, onChange, onClick, onValueChange, onCreateOption, placeholder = 'جستوجو', isLoading = false, isDisabled = false, isCreatable = true, isMultiSelect = false, noOptionsMessage = 'مقدار پیشفرضی وجود ندارد', noResultsFound, loadingMessage = 'در حال بارگذاری...', createOptionMessage = 'ایجاد ', className = '', tailwindStyle = {}, iconSrc = {}, fetchOptions, label, onAddClick, getOptionLabel, getOptionValue, }) {
|
|
90
91
|
// Default icons
|
|
91
92
|
const defaultIcons = {
|
|
92
93
|
dropdownOpen: '▼',
|
|
@@ -111,7 +112,6 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
111
112
|
const anyOption = option;
|
|
112
113
|
const label = anyOption.label ?? anyOption.content ?? anyOption.value;
|
|
113
114
|
const result = String(label ?? '');
|
|
114
|
-
console.log('deriveLabel for option:', option, 'returning:', result);
|
|
115
115
|
return result;
|
|
116
116
|
}, [getOptionLabel]);
|
|
117
117
|
const deriveValue = (0, react_1.useCallback)((option) => {
|
|
@@ -120,86 +120,31 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
120
120
|
const anyOption = option;
|
|
121
121
|
const base = anyOption.value ?? anyOption.label ?? anyOption.content;
|
|
122
122
|
const str = String(base ?? deriveLabel(option));
|
|
123
|
-
console.log('deriveValue for option:', option, 'returning:', str);
|
|
124
123
|
return str;
|
|
125
124
|
}, [getOptionValue, deriveLabel]);
|
|
126
125
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
127
126
|
const [inputValue, setInputValue] = (0, react_1.useState)('');
|
|
128
127
|
const [filteredOptions, setFilteredOptions] = (0, react_1.useState)(options ?? []);
|
|
129
|
-
const
|
|
128
|
+
const [highlightedIndex, setHighlightedIndex] = (0, react_1.useState)(0);
|
|
130
129
|
const [internalLoading, setInternalLoading] = (0, react_1.useState)(false);
|
|
131
130
|
const [hasSearched, setHasSearched] = (0, react_1.useState)(false);
|
|
132
131
|
const [selectedValues, setSelectedValues] = (0, react_1.useState)([]);
|
|
133
|
-
const [isUserInteracting, setIsUserInteracting] = (0, react_1.useState)(false);
|
|
134
|
-
const [forceUpdate, setForceUpdate] = (0, react_1.useState)(0);
|
|
135
132
|
const containerRef = (0, react_1.useRef)(null);
|
|
136
133
|
const inputRef = (0, react_1.useRef)(null);
|
|
137
|
-
const scrollContainerRef = (0, react_1.useRef)(null);
|
|
138
|
-
const isProcessingRef = (0, react_1.useRef)(false);
|
|
139
|
-
// Prevent scroll jumping by maintaining position during keyboard navigation
|
|
140
|
-
const handleKeyboardNavigation = (0, react_1.useCallback)((direction) => {
|
|
141
|
-
// Set user interaction flag to prevent external sync
|
|
142
|
-
setIsUserInteracting(true);
|
|
143
|
-
// Don't save scroll position - just update the highlighted index
|
|
144
|
-
if (direction === 'up') {
|
|
145
|
-
highlightedIndexRef.current = Math.max(0, highlightedIndexRef.current - 1);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
highlightedIndexRef.current = Math.min(filteredOptions.length - 1, highlightedIndexRef.current + 1);
|
|
149
|
-
}
|
|
150
|
-
// Force re-render of dropdown options only
|
|
151
|
-
setForceUpdate((prev) => prev + 1);
|
|
152
|
-
// Reset the flag after a delay
|
|
153
|
-
setTimeout(() => {
|
|
154
|
-
setIsUserInteracting(false);
|
|
155
|
-
}, 1000);
|
|
156
|
-
}, [filteredOptions.length]);
|
|
157
134
|
// Sync external value prop with internal selectedValues state
|
|
158
135
|
(0, react_1.useEffect)(() => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
console.log('external value:', value);
|
|
162
|
-
console.log('current selectedValues:', selectedValues);
|
|
163
|
-
console.log('isMultiSelect:', isMultiSelect);
|
|
164
|
-
// Don't sync if user is actively interacting with the component
|
|
165
|
-
if (isUserInteracting) {
|
|
166
|
-
console.log('Skipping sync - user is interacting');
|
|
136
|
+
if (value === undefined || value === null) {
|
|
137
|
+
setSelectedValues([]);
|
|
167
138
|
return;
|
|
168
139
|
}
|
|
169
|
-
|
|
170
|
-
// Only
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
console.log('Values are already the same, skipping sync');
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (externalValue === null || externalValue === undefined) {
|
|
179
|
-
if (currentValues.length > 0) {
|
|
180
|
-
console.log('Setting selectedValues to empty array');
|
|
181
|
-
setSelectedValues([]);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
else if (Array.isArray(externalValue)) {
|
|
185
|
-
if (isMultiSelect) {
|
|
186
|
-
const externalArray = externalValue;
|
|
187
|
-
console.log('Setting selectedValues to array:', externalArray);
|
|
188
|
-
setSelectedValues(externalArray);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
const firstItem = externalValue.length > 0 ? [externalValue[0]] : [];
|
|
192
|
-
console.log('Setting selectedValues to first item of array:', firstItem);
|
|
193
|
-
setSelectedValues(firstItem);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
const singleItem = [externalValue];
|
|
198
|
-
console.log('Setting selectedValues to single item:', singleItem);
|
|
199
|
-
setSelectedValues(singleItem);
|
|
140
|
+
const externalValues = Array.isArray(value) ? value : [value];
|
|
141
|
+
// Only update if values are actually different
|
|
142
|
+
const currentValuesString = JSON.stringify(selectedValues.map(deriveValue));
|
|
143
|
+
const externalValuesString = JSON.stringify(externalValues.map(deriveValue));
|
|
144
|
+
if (currentValuesString !== externalValuesString) {
|
|
145
|
+
setSelectedValues(externalValues);
|
|
200
146
|
}
|
|
201
|
-
|
|
202
|
-
}, [value, isMultiSelect, isUserInteracting]);
|
|
147
|
+
}, [value, deriveValue]);
|
|
203
148
|
// Sync options into filtered list when not searching
|
|
204
149
|
(0, react_1.useEffect)(() => {
|
|
205
150
|
if (!hasSearched) {
|
|
@@ -213,12 +158,6 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
213
158
|
setHasSearched(false);
|
|
214
159
|
}
|
|
215
160
|
}, [options, inputValue]);
|
|
216
|
-
// Debug: Log when selectedValues changes
|
|
217
|
-
(0, react_1.useEffect)(() => {
|
|
218
|
-
console.log('=== selectedValues changed ===');
|
|
219
|
-
console.log('New selectedValues:', selectedValues);
|
|
220
|
-
console.log('Stack trace:', new Error().stack);
|
|
221
|
-
}, [selectedValues]);
|
|
222
161
|
// Close on outside click
|
|
223
162
|
(0, react_1.useEffect)(() => {
|
|
224
163
|
const handler = (e) => {
|
|
@@ -235,7 +174,6 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
235
174
|
const next = e.target.value;
|
|
236
175
|
setInputValue(next);
|
|
237
176
|
setIsOpen(true);
|
|
238
|
-
setIsUserInteracting(true);
|
|
239
177
|
if (onChange)
|
|
240
178
|
onChange(e);
|
|
241
179
|
if (fetchOptions && next.trim() !== '') {
|
|
@@ -263,28 +201,14 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
263
201
|
}
|
|
264
202
|
}, [onChange, fetchOptions, options, deriveLabel]);
|
|
265
203
|
const handleKeyDown = (0, react_1.useCallback)((e) => {
|
|
266
|
-
console.log('=== handleKeyDown called ===');
|
|
267
|
-
console.log('key:', e.key);
|
|
268
|
-
console.log('isDisabled:', isDisabled);
|
|
269
|
-
console.log('current selectedValues:', selectedValues);
|
|
270
204
|
if (isDisabled)
|
|
271
205
|
return;
|
|
272
|
-
// Prevent double calls by checking if we're already processing
|
|
273
|
-
if (isProcessingRef.current) {
|
|
274
|
-
console.log('Already processing keyboard event, skipping...');
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
// Set user interaction flag for all keyboard events
|
|
278
|
-
console.log('Setting isUserInteracting to true');
|
|
279
|
-
setIsUserInteracting(true);
|
|
280
|
-
isProcessingRef.current = true;
|
|
281
206
|
switch (e.key) {
|
|
282
207
|
case 'Enter':
|
|
283
208
|
e.preventDefault();
|
|
284
209
|
if (isOpen) {
|
|
285
|
-
if (filteredOptions.length > 0 &&
|
|
286
|
-
|
|
287
|
-
selectOption(filteredOptions[highlightedIndexRef.current]);
|
|
210
|
+
if (filteredOptions.length > 0 && highlightedIndex < filteredOptions.length) {
|
|
211
|
+
selectOption(filteredOptions[highlightedIndex]);
|
|
288
212
|
}
|
|
289
213
|
else if (isCreatable &&
|
|
290
214
|
inputValue &&
|
|
@@ -303,7 +227,7 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
303
227
|
case 'ArrowUp':
|
|
304
228
|
e.preventDefault();
|
|
305
229
|
if (isOpen) {
|
|
306
|
-
|
|
230
|
+
setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : filteredOptions.length - 1));
|
|
307
231
|
}
|
|
308
232
|
else {
|
|
309
233
|
setIsOpen(true);
|
|
@@ -312,29 +236,14 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
312
236
|
case 'ArrowDown':
|
|
313
237
|
e.preventDefault();
|
|
314
238
|
if (isOpen) {
|
|
315
|
-
|
|
239
|
+
setHighlightedIndex((prev) => (prev < filteredOptions.length - 1 ? prev + 1 : 0));
|
|
316
240
|
}
|
|
317
241
|
else {
|
|
318
242
|
setIsOpen(true);
|
|
319
243
|
}
|
|
320
244
|
break;
|
|
321
245
|
}
|
|
322
|
-
|
|
323
|
-
setTimeout(() => {
|
|
324
|
-
console.log('Resetting isUserInteracting to false');
|
|
325
|
-
setIsUserInteracting(false);
|
|
326
|
-
isProcessingRef.current = false;
|
|
327
|
-
}, 2000); // Increased to 2 seconds
|
|
328
|
-
}, [
|
|
329
|
-
isDisabled,
|
|
330
|
-
isOpen,
|
|
331
|
-
filteredOptions,
|
|
332
|
-
inputValue,
|
|
333
|
-
deriveLabel,
|
|
334
|
-
handleKeyboardNavigation,
|
|
335
|
-
isCreatable,
|
|
336
|
-
selectedValues,
|
|
337
|
-
]);
|
|
246
|
+
}, [isDisabled, isOpen, filteredOptions, highlightedIndex, isCreatable, inputValue, deriveLabel]);
|
|
338
247
|
const emitSelection = (0, react_1.useCallback)((next) => {
|
|
339
248
|
// Backward-compatible callback
|
|
340
249
|
if (onClick) {
|
|
@@ -367,32 +276,15 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
367
276
|
setInternalLoading(false);
|
|
368
277
|
}
|
|
369
278
|
}, [inputValue, isCreatable, onCreateOption]);
|
|
370
|
-
const toggleDropdown = (0, react_1.useCallback)(() => {
|
|
371
|
-
|
|
372
|
-
console.log('isDisabled:', isDisabled);
|
|
373
|
-
console.log('current isOpen:', isOpen);
|
|
374
|
-
console.log('current selectedValues:', selectedValues);
|
|
279
|
+
const toggleDropdown = (0, react_1.useCallback)((e) => {
|
|
280
|
+
e.stopPropagation();
|
|
375
281
|
if (!isDisabled) {
|
|
376
|
-
// Prevent double calls by checking if we're already processing
|
|
377
|
-
if (isProcessingRef.current) {
|
|
378
|
-
console.log('Already processing, skipping...');
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
console.log('Setting isUserInteracting to true');
|
|
382
|
-
setIsUserInteracting(true);
|
|
383
|
-
isProcessingRef.current = true;
|
|
384
282
|
setIsOpen((prev) => !prev);
|
|
385
283
|
if (!isOpen && inputRef.current) {
|
|
386
284
|
inputRef.current.focus();
|
|
387
285
|
}
|
|
388
|
-
// Reset the flags after a longer delay to prevent conflicts
|
|
389
|
-
setTimeout(() => {
|
|
390
|
-
console.log('Resetting isUserInteracting to false');
|
|
391
|
-
setIsUserInteracting(false);
|
|
392
|
-
isProcessingRef.current = false;
|
|
393
|
-
}, 2000); // Increased to 2 seconds
|
|
394
286
|
}
|
|
395
|
-
}, [isDisabled, isOpen
|
|
287
|
+
}, [isDisabled, isOpen]);
|
|
396
288
|
const clearValue = (0, react_1.useCallback)((e, option) => {
|
|
397
289
|
e.stopPropagation();
|
|
398
290
|
const next = selectedValues.filter((val) => deriveValue(val) !== deriveValue(option));
|
|
@@ -400,8 +292,6 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
400
292
|
emitSelection(next);
|
|
401
293
|
}, [selectedValues, deriveValue, emitSelection]);
|
|
402
294
|
const selectOption = (0, react_1.useCallback)((option) => {
|
|
403
|
-
// Set user interaction flag to prevent external sync
|
|
404
|
-
setIsUserInteracting(true);
|
|
405
295
|
if (isMultiSelect) {
|
|
406
296
|
const next = [...selectedValues];
|
|
407
297
|
if (!next.some((val) => deriveValue(val) === deriveValue(option))) {
|
|
@@ -422,10 +312,6 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
422
312
|
setIsOpen(false);
|
|
423
313
|
setHasSearched(false);
|
|
424
314
|
}
|
|
425
|
-
// Reset the flag after a delay
|
|
426
|
-
setTimeout(() => {
|
|
427
|
-
setIsUserInteracting(false);
|
|
428
|
-
}, 1000);
|
|
429
315
|
}, [isMultiSelect, selectedValues, deriveValue, emitSelection]);
|
|
430
316
|
const showLoading = isLoading || internalLoading;
|
|
431
317
|
const handleAddIconClick = (0, react_1.useCallback)((e) => {
|
|
@@ -434,48 +320,34 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
434
320
|
onAddClick(true);
|
|
435
321
|
}
|
|
436
322
|
}, [onAddClick]);
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
selectedValues.length > 0 &&
|
|
446
|
-
selectedValues.map((val) => (react_1.default.createElement("div", { key: deriveValue(val), className: "flex-shrink-0 flex items-center bg-gray-200 rounded-md px-2 py-1" },
|
|
447
|
-
react_1.default.createElement("span", { className: "truncate" }, deriveLabel(val)),
|
|
448
|
-
react_1.default.createElement("button", { onClick: (e) => clearValue(e, val), className: styles.clearButton }, renderIcon(icons.clear, styles.icon))))),
|
|
449
|
-
react_1.default.createElement("input", { ref: inputRef, type: "text", className: `${styles.input} ${isDisabled ? 'bg-gray-100' : ''} min-w-[80px] flex-shrink-0`, placeholder: selectedValues.length > 0 ? '' : placeholder, value: inputValue, onChange: handleInputChange, disabled: isDisabled, onClick: (e) => e.stopPropagation() })))), [
|
|
450
|
-
selectedValues,
|
|
451
|
-
isDisabled,
|
|
452
|
-
inputValue,
|
|
453
|
-
inputRef,
|
|
454
|
-
clearValue,
|
|
455
|
-
deriveValue,
|
|
456
|
-
deriveLabel,
|
|
457
|
-
icons.clear,
|
|
458
|
-
styles.input,
|
|
459
|
-
styles.clearButton,
|
|
460
|
-
placeholder,
|
|
461
|
-
handleInputChange,
|
|
462
|
-
]);
|
|
323
|
+
const handleTriggerClick = (0, react_1.useCallback)(() => {
|
|
324
|
+
if (!isDisabled) {
|
|
325
|
+
setIsOpen((prev) => !prev);
|
|
326
|
+
if (!isOpen && inputRef.current) {
|
|
327
|
+
inputRef.current.focus();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}, [isDisabled, isOpen]);
|
|
463
331
|
return (react_1.default.createElement("div", { ref: containerRef, className: `relative w-full ${className} ${styles.container}`, onKeyDown: handleKeyDown },
|
|
464
332
|
label && react_1.default.createElement("label", { className: "block text-sm font-medium text-gray-700 mb-1" }, label),
|
|
465
|
-
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:
|
|
466
|
-
|
|
333
|
+
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: handleTriggerClick },
|
|
334
|
+
react_1.default.createElement("div", { className: "flex-grow flex items-center overflow-x-auto no-scrollbar" },
|
|
335
|
+
react_1.default.createElement("div", { className: "flex items-center gap-2 flex-nowrap" },
|
|
336
|
+
selectedValues.length > 0 &&
|
|
337
|
+
selectedValues.map((val) => (react_1.default.createElement("div", { key: deriveValue(val), className: "flex-shrink-0 flex items-center bg-gray-200 rounded-md px-2 py-1" },
|
|
338
|
+
react_1.default.createElement("span", { className: "truncate" }, deriveLabel(val)),
|
|
339
|
+
react_1.default.createElement("button", { onClick: (e) => clearValue(e, val), className: styles.clearButton }, renderIcon(icons.clear, styles.icon))))),
|
|
340
|
+
react_1.default.createElement("input", { ref: inputRef, type: "text", className: `${styles.input} ${isDisabled ? 'bg-gray-100' : ''} min-w-[80px] flex-shrink-0`, placeholder: selectedValues.length > 0 ? '' : placeholder, value: inputValue, onChange: handleInputChange, disabled: isDisabled, onClick: (e) => e.stopPropagation() }))),
|
|
467
341
|
react_1.default.createElement("div", { className: "flex-shrink-0 flex items-center gap-1 ml-2" },
|
|
468
342
|
iconSrc.hasAdd && (react_1.default.createElement("button", { onClick: handleAddIconClick, className: styles.clearButton }, renderIcon(iconSrc.hasAdd, styles.icon))),
|
|
469
343
|
styles.separator && react_1.default.createElement("div", { className: styles.separator }),
|
|
470
|
-
isOpen
|
|
344
|
+
react_1.default.createElement("button", { onClick: toggleDropdown }, isOpen
|
|
471
345
|
? renderIcon(iconSrc.dropdownOpen, `${styles.icon} ${styles.spinAnimation || ''}`)
|
|
472
|
-
: renderIcon(iconSrc.dropdownClosed, styles.icon))),
|
|
346
|
+
: renderIcon(iconSrc.dropdownClosed, styles.icon)))),
|
|
473
347
|
isOpen && (react_1.default.createElement("div", { className: styles.dropdown }, showLoading ? (react_1.default.createElement("div", { className: styles.loadingState },
|
|
474
348
|
renderIcon(iconSrc.loading, `animate-spin mr-2 ${styles.icon}`),
|
|
475
349
|
loadingMessage)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
476
|
-
filteredOptions.length > 0 && (react_1.default.createElement(react_1.default.Fragment, null, filteredOptions.map((option, index) => (react_1.default.createElement("div", { key:
|
|
477
|
-
? styles.highlightedOption
|
|
478
|
-
: 'hover:bg-gray-50'}`, onClick: () => selectOption(option), onMouseEnter: () => (highlightedIndexRef.current = index) },
|
|
350
|
+
filteredOptions.length > 0 && (react_1.default.createElement(react_1.default.Fragment, null, filteredOptions.map((option, index) => (react_1.default.createElement("div", { key: deriveValue(option), className: `${styles.option} ${index === highlightedIndex ? styles.highlightedOption : 'hover:bg-gray-50'}`, onClick: () => selectOption(option), onMouseEnter: () => setHighlightedIndex(index) },
|
|
479
351
|
selectedValues.some((val) => deriveValue(val) === deriveValue(option)) &&
|
|
480
352
|
renderIcon(iconSrc.checkmark, 'w-4 h-4 mr-2 text-blue-500'),
|
|
481
353
|
react_1.default.createElement("span", { className: selectedValues.some((val) => deriveValue(val) === deriveValue(option))
|
|
@@ -494,26 +366,4 @@ exports.default = react_1.default.memo(function CreatableSelect({ options = [],
|
|
|
494
366
|
createOptionMessage,
|
|
495
367
|
": ",
|
|
496
368
|
inputValue)))))))));
|
|
497
|
-
}
|
|
498
|
-
// Custom comparison function for React.memo
|
|
499
|
-
// Only re-render if the props that affect the component's output have changed.
|
|
500
|
-
// This prevents unnecessary re-renders when options, value, or other props are shallowly equal.
|
|
501
|
-
return (prevProps.options === nextProps.options &&
|
|
502
|
-
prevProps.value === nextProps.value &&
|
|
503
|
-
prevProps.isLoading === nextProps.isLoading &&
|
|
504
|
-
prevProps.isDisabled === nextProps.isDisabled &&
|
|
505
|
-
prevProps.isCreatable === nextProps.isCreatable &&
|
|
506
|
-
prevProps.isMultiSelect === nextProps.isMultiSelect &&
|
|
507
|
-
prevProps.noOptionsMessage === nextProps.noOptionsMessage &&
|
|
508
|
-
prevProps.noResultsFound === nextProps.noResultsFound &&
|
|
509
|
-
prevProps.loadingMessage === nextProps.loadingMessage &&
|
|
510
|
-
prevProps.createOptionMessage === nextProps.createOptionMessage &&
|
|
511
|
-
prevProps.className === nextProps.className &&
|
|
512
|
-
prevProps.tailwindStyle === nextProps.tailwindStyle &&
|
|
513
|
-
prevProps.iconSrc === nextProps.iconSrc &&
|
|
514
|
-
prevProps.fetchOptions === nextProps.fetchOptions &&
|
|
515
|
-
prevProps.label === nextProps.label &&
|
|
516
|
-
prevProps.onAddClick === nextProps.onAddClick &&
|
|
517
|
-
prevProps.getOptionLabel === nextProps.getOptionLabel &&
|
|
518
|
-
prevProps.getOptionValue === nextProps.getOptionValue);
|
|
519
|
-
});
|
|
369
|
+
}
|
package/dist/styles/globals.css
CHANGED
|
@@ -87,29 +87,6 @@ li.activeSidebar-subset::after {
|
|
|
87
87
|
.noDisplay-scrollbar::-webkit-scrollbar {
|
|
88
88
|
display: none; /* For Chrome, Safari, and Opera */
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
/* Custom scroll behavior for CreatableDropDown */
|
|
92
|
-
.creatable-dropdown-scroll {
|
|
93
|
-
scroll-behavior: auto !important;
|
|
94
|
-
scrollbar-width: none;
|
|
95
|
-
-ms-overflow-style: none;
|
|
96
|
-
will-change: auto;
|
|
97
|
-
transform: translateZ(0);
|
|
98
|
-
backface-visibility: hidden;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.creatable-dropdown-scroll::-webkit-scrollbar {
|
|
102
|
-
display: none;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.creatable-dropdown-scroll:focus-within {
|
|
106
|
-
scroll-behavior: auto !important;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/* Prevent scroll container from being affected by re-renders */
|
|
110
|
-
.creatable-dropdown-scroll * {
|
|
111
|
-
will-change: auto;
|
|
112
|
-
}
|
|
113
90
|
.danger {
|
|
114
91
|
background-color: #ffffff;
|
|
115
92
|
color: #f54180;
|