@itilite/lumina-ui 1.1.11 → 1.1.12

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.
Files changed (43) hide show
  1. package/dist/atom/RangePicker/RangePicker.js +105 -102
  2. package/dist/atom/RangePicker/RangePicker.mjs +2 -2
  3. package/dist/atom/Select/Select.d.mts +1 -4
  4. package/dist/atom/Select/Select.d.ts +1 -4
  5. package/dist/atom/Select/Select.js +105 -102
  6. package/dist/atom/Select/Select.mjs +1 -1
  7. package/dist/chunk-3AWYHB3A.mjs +618 -0
  8. package/dist/chunk-3WWAOBS6.mjs +633 -0
  9. package/dist/chunk-57YKBWEI.mjs +673 -0
  10. package/dist/chunk-5BBLW4MR.mjs +670 -0
  11. package/dist/chunk-6XGVIU52.mjs +679 -0
  12. package/dist/chunk-BKPTZNXK.mjs +618 -0
  13. package/dist/chunk-CNN74G3M.mjs +666 -0
  14. package/dist/chunk-CPOZJCLV.mjs +681 -0
  15. package/dist/chunk-DRNY4L7J.mjs +618 -0
  16. package/dist/chunk-G7I4NT42.mjs +720 -0
  17. package/dist/chunk-GU5F7Z7I.mjs +681 -0
  18. package/dist/chunk-HPDJYQXM.mjs +663 -0
  19. package/dist/chunk-HTYOI6JT.mjs +618 -0
  20. package/dist/chunk-IIJUGDEJ.mjs +618 -0
  21. package/dist/chunk-J327EMX2.mjs +663 -0
  22. package/dist/chunk-J3ZBXBJ2.mjs +689 -0
  23. package/dist/chunk-JEAZCSST.mjs +676 -0
  24. package/dist/chunk-KDR6M52K.mjs +723 -0
  25. package/dist/chunk-LEPDKBT2.mjs +709 -0
  26. package/dist/chunk-LH55S6HJ.mjs +618 -0
  27. package/dist/chunk-MO7JTKPH.mjs +618 -0
  28. package/dist/chunk-MWC57EU6.mjs +666 -0
  29. package/dist/chunk-OMXQ6VML.mjs +618 -0
  30. package/dist/chunk-PSESRID3.mjs +681 -0
  31. package/dist/chunk-RAWVG2MM.mjs +618 -0
  32. package/dist/chunk-T2Y6AXM5.mjs +618 -0
  33. package/dist/chunk-THT4ALWQ.mjs +618 -0
  34. package/dist/chunk-TWV2Z27S.mjs +618 -0
  35. package/dist/chunk-UPUD2FQL.mjs +618 -0
  36. package/dist/chunk-UUTSL2NM.mjs +618 -0
  37. package/dist/chunk-WCYB5OTY.mjs +618 -0
  38. package/dist/chunk-YCAOWGDP.mjs +618 -0
  39. package/dist/chunk-ZUUAXTPM.mjs +618 -0
  40. package/dist/index.js +105 -102
  41. package/dist/index.mjs +11 -11
  42. package/dist/styles.css +254 -254
  43. package/package.json +1 -1
@@ -0,0 +1,709 @@
1
+ import {
2
+ Tooltip_default
3
+ } from "./chunk-MLCMZRUC.mjs";
4
+ import {
5
+ LoadingSpinner_default
6
+ } from "./chunk-QKTMWS4J.mjs";
7
+ import {
8
+ __objRest,
9
+ __spreadProps,
10
+ __spreadValues
11
+ } from "./chunk-FWCSY2DS.mjs";
12
+
13
+ // src/atom/Select/Select.tsx
14
+ import { memo as memo3, useCallback, useEffect, useMemo, useRef, useState } from "react";
15
+ import clsx from "clsx";
16
+
17
+ // src/icons/Chevron.tsx
18
+ import * as React from "react";
19
+ import { jsx } from "react/jsx-runtime";
20
+ var Chevron = React.memo(
21
+ (_a) => {
22
+ var _b = _a, { size = 16, color = "#6b7280", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
23
+ return /* @__PURE__ */ jsx(
24
+ "svg",
25
+ __spreadProps(__spreadValues({
26
+ xmlns: "http://www.w3.org/2000/svg",
27
+ width: size,
28
+ height: size,
29
+ fill: "none",
30
+ viewBox: "0 0 16 16",
31
+ className
32
+ }, rest), {
33
+ children: /* @__PURE__ */ jsx(
34
+ "path",
35
+ {
36
+ fill: color,
37
+ d: "M11.78 6.22a.75.75 0 00-1.06 0L8 8.94 5.28 6.22a.75.75 0 00-1.06 1.06l3.25 3.25a.75.75 0 001.06 0l3.25-3.25a.75.75 0 000-1.06z"
38
+ }
39
+ )
40
+ })
41
+ );
42
+ }
43
+ );
44
+ Chevron.displayName = "Chevron";
45
+
46
+ // src/icons/CrossV2.tsx
47
+ import * as React2 from "react";
48
+ import { jsx as jsx2 } from "react/jsx-runtime";
49
+ var CrossV2 = React2.memo(
50
+ (_a) => {
51
+ var _b = _a, { size = 16, color = "#111827", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
52
+ return /* @__PURE__ */ jsx2(
53
+ "svg",
54
+ __spreadProps(__spreadValues({
55
+ xmlns: "http://www.w3.org/2000/svg",
56
+ width: size,
57
+ height: size,
58
+ fill: "none",
59
+ viewBox: "0 0 20 20"
60
+ }, rest), {
61
+ children: /* @__PURE__ */ jsx2(
62
+ "path",
63
+ {
64
+ fill: color,
65
+ d: "M4.411 4.41a.833.833 0 0 1 1.179 0L10 8.822l4.411-4.41a.833.833 0 1 1 1.179 1.178L11.179 10l4.41 4.41a.833.833 0 0 1-1.178 1.18l-4.41-4.411-4.411 4.41a.833.833 0 1 1-1.179-1.178L8.821 10l-4.41-4.41a.833.833 0 0 1 0-1.18"
66
+ }
67
+ )
68
+ })
69
+ );
70
+ }
71
+ );
72
+ CrossV2.displayName = "CrossV2";
73
+
74
+ // src/icons/Lock.tsx
75
+ import React3 from "react";
76
+ import { jsx as jsx3 } from "react/jsx-runtime";
77
+ var Lock = React3.memo((_a) => {
78
+ var _b = _a, { size = 16, color = "#000" } = _b, rest = __objRest(_b, ["size", "color"]);
79
+ return /* @__PURE__ */ jsx3(
80
+ "svg",
81
+ __spreadProps(__spreadValues({
82
+ xmlns: "http://www.w3.org/2000/svg",
83
+ width: size,
84
+ height: size,
85
+ fill: "none",
86
+ viewBox: "0 0 16 16"
87
+ }, rest), {
88
+ children: /* @__PURE__ */ jsx3(
89
+ "path",
90
+ {
91
+ fill: color,
92
+ d: "M9 9a1 1 0 11-2 0 1 1 0 012 0zM5 4h-.5A2.5 2.5 0 002 6.5v5A2.5 2.5 0 004.5 14h7a2.5 2.5 0 002.5-2.5v-5A2.5 2.5 0 0011.5 4H11v-.5a3 3 0 00-6 0V4zm1-.5a2 2 0 114 0V4H6v-.5zM11.5 5A1.5 1.5 0 0113 6.5v5a1.5 1.5 0 01-1.5 1.5h-7A1.5 1.5 0 013 11.5v-5A1.5 1.5 0 014.5 5h7z"
93
+ }
94
+ )
95
+ })
96
+ );
97
+ });
98
+
99
+ // src/atom/Select/Select.tsx
100
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
101
+ var SelectOptionItem = memo3(
102
+ ({
103
+ option,
104
+ index,
105
+ isSelected,
106
+ isHighlighted,
107
+ size,
108
+ experience,
109
+ optionClassName,
110
+ onSelect,
111
+ onMouseEnter,
112
+ setRef
113
+ }) => {
114
+ return /* @__PURE__ */ jsx4(
115
+ "div",
116
+ {
117
+ ref: (el) => setRef(el, index),
118
+ onClick: () => onSelect(option),
119
+ onMouseEnter: () => onMouseEnter(index),
120
+ className: clsx(
121
+ "tw-transition-all tw-duration-150",
122
+ { "tw-typography-body2": size !== "small" },
123
+ { "tw-typography-caption1": size === "small" },
124
+ optionClassName
125
+ ),
126
+ children: /* @__PURE__ */ jsx4(
127
+ "div",
128
+ {
129
+ className: clsx(
130
+ "tw-px-4 tw-cursor-pointer tw-py-2 tw-mx-0.5 tw-rounded-xl",
131
+ isSelected ? experience === "personal" ? "tw-bg-[#f1e8fa]" : "tw-bg-[#fff1e1]" : isHighlighted ? "tw-bg-[#f3f4f6] tw-text-gray-900" : "tw-text-gray-900 hover:tw-bg-[#1118270a]"
132
+ ),
133
+ children: option.label
134
+ }
135
+ )
136
+ }
137
+ );
138
+ }
139
+ );
140
+ var Select = ({
141
+ label,
142
+ mandatory = false,
143
+ error = false,
144
+ options = [],
145
+ valueSelected = "",
146
+ // Keep for backward compatibility
147
+ value: _valueProp,
148
+ // Rename to avoid potential conflicts with native value attribute
149
+ onChange,
150
+ onSearch,
151
+ isLoading = false,
152
+ disabled = false,
153
+ disabledTooltip = "",
154
+ className = "",
155
+ dropdownClassName = "",
156
+ optionClassName = "",
157
+ style = {},
158
+ showDisplayValue = false,
159
+ // New prop to show displayValue instead of label
160
+ allowClear = true,
161
+ enableSearch = true,
162
+ doubleCharSearch = false,
163
+ id,
164
+ name,
165
+ tabIndex,
166
+ // Add tabIndex prop
167
+ // Additional styling props
168
+ size = "default",
169
+ // 'small', 'default', 'large'
170
+ variant = "default",
171
+ // 'default', 'filled', 'outlined'
172
+ wrapperClassName = "",
173
+ inputClassName = "",
174
+ // Custom class for input element specifically
175
+ labelClassName = "",
176
+ // Custom class for label element specifically
177
+ height = "tw-h-12",
178
+ // Custom height
179
+ experience = "business"
180
+ }) => {
181
+ const normalizeValue = useCallback(
182
+ (val) => {
183
+ if (val === null || val === void 0) return "";
184
+ return String(val);
185
+ },
186
+ []
187
+ );
188
+ const validatedOptions = useMemo(() => {
189
+ if (!Array.isArray(options)) return [];
190
+ return options.filter(
191
+ (opt) => opt && typeof opt === "object" && opt.value !== void 0 && opt.value !== null && opt.label !== void 0
192
+ );
193
+ }, [options]);
194
+ const [isOpen, setIsOpen] = useState(false);
195
+ const [isFocused, setIsFocused] = useState(false);
196
+ const [searchTerm, setSearchTerm] = useState("");
197
+ const [isHovering, setIsHovering] = useState(false);
198
+ const [highlightedIndex, setHighlightedIndex] = useState(-1);
199
+ const [selectedValue, setSelectedValue] = useState(() => {
200
+ const initialValue = valueSelected;
201
+ if (initialValue === null || initialValue === void 0) return "";
202
+ return String(initialValue);
203
+ });
204
+ const inputRef = useRef(null);
205
+ const inputValueRef = useRef("");
206
+ const dropdownRef = useRef(null);
207
+ const optionRefs = useRef([]);
208
+ const optionListRef = useRef(null);
209
+ const blurTimeoutRef = useRef(null);
210
+ const hoverTimeoutRef = useRef(null);
211
+ const isActive = isFocused || Boolean(selectedValue) || Boolean(valueSelected) || Boolean(searchTerm);
212
+ const sizeClasses = useMemo(() => {
213
+ switch (size) {
214
+ case "small":
215
+ return {
216
+ input: "tw-h-6 tw-typography-caption1Bold !tw-rounded-lg",
217
+ padding: "tw-px-2 tw-py-1",
218
+ labelActive: "tw-top-0.5 tw-typography-caption2",
219
+ labelInactive: "tw-top-1.5 tw-typography-caption3"
220
+ };
221
+ case "medium":
222
+ return {
223
+ input: "tw-h-10 tw-px-4 tw-typography-body2",
224
+ padding: label ? "tw-pt-4 tw-pb-1" : "tw-py-2",
225
+ labelActive: "tw-top-1 tw-typography-caption3",
226
+ labelInactive: "tw-top-2.5 tw-typography-body2"
227
+ };
228
+ case "large":
229
+ return {
230
+ input: "tw-h-16 tw-px-5 tw-typography-bodyLarge",
231
+ padding: label ? "tw-pt-8 tw-pb-4" : "tw-py-5",
232
+ labelActive: "tw-top-1 tw-typography-caption2",
233
+ labelInactive: "tw-top-5 tw-typography-body1"
234
+ };
235
+ default:
236
+ return {
237
+ input: height + " tw-px-4 tw-typography-bodyLarge",
238
+ padding: label ? "tw-pt-6 tw-pb-3" : "tw-py-3",
239
+ labelActive: "tw-top-1 tw-typography-caption3",
240
+ labelInactive: "tw-top-3.5 tw-typography-body2"
241
+ };
242
+ }
243
+ }, [size, label, height]);
244
+ const variantClasses = useMemo(() => {
245
+ switch (variant) {
246
+ case "filled":
247
+ return "tw-bg-gray-50 tw-border-transparent";
248
+ case "outlined":
249
+ return "tw-bg-transparent tw-border-2";
250
+ default:
251
+ return " tw-border";
252
+ }
253
+ }, [variant]);
254
+ const handleBlur = useCallback(() => {
255
+ blurTimeoutRef.current = setTimeout(() => {
256
+ setIsOpen(false);
257
+ setSearchTerm("");
258
+ setHighlightedIndex(-1);
259
+ blurTimeoutRef.current = null;
260
+ setIsFocused(false);
261
+ }, 150);
262
+ }, []);
263
+ const handleSearchChange = useCallback(
264
+ (e) => {
265
+ var _a;
266
+ const searchValue = doubleCharSearch ? e.target.value.slice(0, 2) || "" : e.target.value;
267
+ if (doubleCharSearch) {
268
+ setSearchTerm(searchValue);
269
+ } else {
270
+ setSearchTerm(searchValue);
271
+ }
272
+ setIsOpen(true);
273
+ setHighlightedIndex(-1);
274
+ if (onSearch && typeof onSearch === "function") {
275
+ onSearch(searchValue);
276
+ }
277
+ (_a = optionListRef == null ? void 0 : optionListRef.current) == null ? void 0 : _a.scrollTo({
278
+ top: 0,
279
+ behavior: "smooth"
280
+ });
281
+ },
282
+ [doubleCharSearch, onSearch]
283
+ );
284
+ const handleOptionSelect = useCallback(
285
+ (option) => {
286
+ var _a;
287
+ if (blurTimeoutRef.current) {
288
+ clearTimeout(blurTimeoutRef.current);
289
+ blurTimeoutRef.current = null;
290
+ }
291
+ inputValueRef.current = option.label;
292
+ const normalizedValue = normalizeValue(option.value);
293
+ setSelectedValue(normalizedValue);
294
+ setSearchTerm("");
295
+ setIsOpen(false);
296
+ if (enableSearch) {
297
+ setIsFocused(false);
298
+ }
299
+ setIsHovering(false);
300
+ if (onChange) onChange(option.value);
301
+ if (enableSearch) (_a = inputRef.current) == null ? void 0 : _a.blur();
302
+ },
303
+ [normalizeValue, onChange, enableSearch]
304
+ );
305
+ const handleClear = useCallback(
306
+ (e) => {
307
+ var _a;
308
+ inputValueRef.current = "";
309
+ e.stopPropagation();
310
+ e.preventDefault();
311
+ setSelectedValue("");
312
+ setSearchTerm("");
313
+ if (enableSearch) {
314
+ setIsOpen(true);
315
+ setIsFocused(true);
316
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
317
+ } else {
318
+ setIsOpen(false);
319
+ setIsFocused(false);
320
+ }
321
+ if (onChange) onChange(null);
322
+ },
323
+ [onChange, enableSearch]
324
+ );
325
+ useEffect(() => {
326
+ if (!validatedOptions.length) {
327
+ setSelectedValue("");
328
+ setSearchTerm("");
329
+ inputValueRef.current = "";
330
+ }
331
+ }, [validatedOptions.length]);
332
+ useEffect(() => {
333
+ const externalValue = _valueProp !== void 0 ? _valueProp : valueSelected;
334
+ const newValue = normalizeValue(externalValue);
335
+ setSelectedValue((prevValue) => {
336
+ const prevNormalized = normalizeValue(prevValue);
337
+ return prevNormalized !== newValue ? newValue : prevValue;
338
+ });
339
+ }, [valueSelected, _valueProp, normalizeValue]);
340
+ useEffect(() => {
341
+ const handleClickOutside = (event) => {
342
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
343
+ if (blurTimeoutRef.current) {
344
+ clearTimeout(blurTimeoutRef.current);
345
+ blurTimeoutRef.current = null;
346
+ }
347
+ setIsOpen(false);
348
+ setIsFocused(false);
349
+ setSearchTerm("");
350
+ setHighlightedIndex(-1);
351
+ }
352
+ };
353
+ document.addEventListener("mousedown", handleClickOutside);
354
+ return () => {
355
+ document.removeEventListener("mousedown", handleClickOutside);
356
+ if (blurTimeoutRef.current) {
357
+ clearTimeout(blurTimeoutRef.current);
358
+ }
359
+ if (hoverTimeoutRef.current) {
360
+ clearTimeout(hoverTimeoutRef.current);
361
+ }
362
+ };
363
+ }, []);
364
+ const getDisplayValue = useCallback(() => {
365
+ if (selectedValue && (validatedOptions == null ? void 0 : validatedOptions.length) > 0) {
366
+ const selected = validatedOptions.find(
367
+ (opt) => normalizeValue(opt.value) === normalizeValue(selectedValue)
368
+ );
369
+ if (selected) {
370
+ return showDisplayValue && selected.displayValue ? selected.displayValue : selected.label;
371
+ }
372
+ }
373
+ if (selectedValue && (!validatedOptions || validatedOptions.length === 0)) {
374
+ return selectedValue;
375
+ }
376
+ return "";
377
+ }, [selectedValue, validatedOptions, showDisplayValue, normalizeValue]);
378
+ const filteredOptions = useMemo(() => {
379
+ var _a;
380
+ if (!enableSearch) {
381
+ return validatedOptions;
382
+ }
383
+ (_a = dropdownRef.current) == null ? void 0 : _a.scrollTo(0, 0);
384
+ const updatedFilteredOptions = validatedOptions.filter((option) => {
385
+ var _a2;
386
+ return (_a2 = option == null ? void 0 : option.label) == null ? void 0 : _a2.toLowerCase().includes(searchTerm == null ? void 0 : searchTerm.toLowerCase());
387
+ });
388
+ return updatedFilteredOptions;
389
+ }, [validatedOptions, searchTerm, enableSearch]);
390
+ const getSelectedOptionIndex = useCallback(() => {
391
+ if (!selectedValue || !filteredOptions.length) {
392
+ return 0;
393
+ }
394
+ const index = filteredOptions.findIndex(
395
+ (option) => normalizeValue(option.value) === normalizeValue(selectedValue)
396
+ );
397
+ return index >= 0 ? index : 0;
398
+ }, [selectedValue, filteredOptions, normalizeValue]);
399
+ const handleInputInteraction = useCallback(
400
+ (_e) => {
401
+ var _a;
402
+ if (blurTimeoutRef.current) {
403
+ clearTimeout(blurTimeoutRef.current);
404
+ blurTimeoutRef.current = null;
405
+ }
406
+ if (isOpen) {
407
+ setIsOpen(false);
408
+ setIsFocused(false);
409
+ setSearchTerm("");
410
+ setHighlightedIndex(-1);
411
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
412
+ return;
413
+ }
414
+ setIsFocused(true);
415
+ setIsOpen(true);
416
+ setHighlightedIndex(getSelectedOptionIndex());
417
+ if (inputRef.current) {
418
+ inputRef.current.focus();
419
+ }
420
+ },
421
+ [isOpen, getSelectedOptionIndex]
422
+ );
423
+ const handleKeyDown = useCallback(
424
+ (e) => {
425
+ var _a;
426
+ if (!isOpen) return;
427
+ switch (e.key) {
428
+ case "ArrowDown":
429
+ e.preventDefault();
430
+ setHighlightedIndex((prev) => {
431
+ const nextIndex = prev < filteredOptions.length - 1 ? prev + 1 : prev;
432
+ return nextIndex;
433
+ });
434
+ break;
435
+ case "ArrowUp":
436
+ e.preventDefault();
437
+ setHighlightedIndex((prev) => {
438
+ const nextIndex = prev > 0 ? prev - 1 : prev;
439
+ return nextIndex;
440
+ });
441
+ break;
442
+ case "Enter":
443
+ e.preventDefault();
444
+ if (highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {
445
+ handleOptionSelect(filteredOptions[highlightedIndex]);
446
+ }
447
+ break;
448
+ case "Escape":
449
+ e.preventDefault();
450
+ setIsOpen(false);
451
+ setIsFocused(false);
452
+ setSearchTerm("");
453
+ setHighlightedIndex(-1);
454
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
455
+ break;
456
+ default:
457
+ break;
458
+ }
459
+ },
460
+ [isOpen, highlightedIndex, filteredOptions, handleOptionSelect]
461
+ );
462
+ useEffect(() => {
463
+ if (highlightedIndex >= 0 && optionRefs.current[highlightedIndex]) {
464
+ optionRefs.current[highlightedIndex].scrollIntoView({
465
+ block: "nearest",
466
+ behavior: "smooth"
467
+ });
468
+ }
469
+ }, [highlightedIndex]);
470
+ useEffect(() => {
471
+ optionRefs.current = [];
472
+ }, [filteredOptions]);
473
+ const handleMouseEnter = useCallback(() => {
474
+ if (hoverTimeoutRef.current) {
475
+ clearTimeout(hoverTimeoutRef.current);
476
+ }
477
+ if (!isHovering) {
478
+ setIsHovering(true);
479
+ }
480
+ }, [isHovering]);
481
+ const handleMouseLeave = useCallback(() => {
482
+ hoverTimeoutRef.current = setTimeout(() => {
483
+ setIsHovering(false);
484
+ }, 50);
485
+ }, []);
486
+ const handleChevronClick = useCallback(
487
+ (e) => {
488
+ var _a;
489
+ e.preventDefault();
490
+ if (blurTimeoutRef.current) {
491
+ clearTimeout(blurTimeoutRef.current);
492
+ blurTimeoutRef.current = null;
493
+ }
494
+ if (isOpen) {
495
+ setIsOpen(false);
496
+ setIsFocused(false);
497
+ setSearchTerm("");
498
+ setHighlightedIndex(-1);
499
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
500
+ } else {
501
+ if (inputRef.current) {
502
+ inputRef.current.focus();
503
+ }
504
+ handleInputInteraction();
505
+ }
506
+ },
507
+ [isOpen, handleInputInteraction]
508
+ );
509
+ const handleOptionMouseEnter = useCallback((index) => {
510
+ setHighlightedIndex((prev) => prev === index ? prev : index);
511
+ }, []);
512
+ const setOptionRef = useCallback((el, index) => {
513
+ optionRefs.current[index] = el;
514
+ }, []);
515
+ const InputWrapper = ({ children }) => {
516
+ if (disabled && disabledTooltip)
517
+ return /* @__PURE__ */ jsx4(Tooltip_default, { title: disabledTooltip, children });
518
+ return children;
519
+ };
520
+ return /* @__PURE__ */ jsx4(InputWrapper, { children: /* @__PURE__ */ jsxs(
521
+ "div",
522
+ {
523
+ style,
524
+ className: clsx("tw-relative tw-w-full", wrapperClassName, {
525
+ "tw-cursor-not-allowed": disabled
526
+ }),
527
+ ref: dropdownRef,
528
+ onMouseEnter: handleMouseEnter,
529
+ onMouseLeave: handleMouseLeave,
530
+ children: [
531
+ /* @__PURE__ */ jsxs("div", { className: "tw-relative", children: [
532
+ /* @__PURE__ */ jsx4(
533
+ "input",
534
+ {
535
+ ref: inputRef,
536
+ type: "text",
537
+ id,
538
+ name,
539
+ tabIndex,
540
+ autoComplete: "off",
541
+ autoCorrect: "off",
542
+ autoCapitalize: "off",
543
+ spellCheck: "false",
544
+ value: isFocused && enableSearch ? searchTerm : getDisplayValue(),
545
+ onChange: enableSearch ? handleSearchChange : void 0,
546
+ onClick: handleInputInteraction,
547
+ onKeyDown: handleKeyDown,
548
+ className: clsx(
549
+ "tw-w-full tw-rounded-xl tw-outline-none tw-transition-all tw-duration-200 tw-cursor-pointer tw-border-solid tw-text-color-text-default",
550
+ sizeClasses.input,
551
+ sizeClasses.padding,
552
+ variantClasses,
553
+ {
554
+ "tw-bg-white": valueSelected || getDisplayValue() || isFocused,
555
+ "tw-bg-color-gray-5": !valueSelected || !getDisplayValue(),
556
+ "!tw-bg-[#F8F7F6] tw-cursor-not-allowed tw-pointer-events-none": disabled
557
+ },
558
+ // Conditional padding based on label presence
559
+ !label && "tw-flex tw-items-center",
560
+ {
561
+ "!tw-border-color-primary": isFocused && experience === "business"
562
+ },
563
+ {
564
+ "!tw-border-[#804D7B]": isFocused && experience === "personal"
565
+ },
566
+ error ? "!tw-border-color-text-critical " : "tw-border-[#EBE3DD] hover:tw-border-[#C5B7AC]",
567
+ // Add focus state styling
568
+ "focus:tw-shadow-sm focus:tw-ring-offset-1",
569
+ className,
570
+ inputClassName
571
+ // Put inputClassName last so it can override default classes
572
+ ),
573
+ readOnly: !isFocused || !enableSearch
574
+ }
575
+ ),
576
+ label && size !== "small" && /* @__PURE__ */ jsxs(
577
+ "label",
578
+ {
579
+ htmlFor: id,
580
+ className: clsx(
581
+ "tw-absolute tw-left-[18px] tw-pointer-events-none tw-transition-all tw-duration-200 tw-ease-out tw-text-gray-500",
582
+ isActive ? sizeClasses.labelActive : sizeClasses.labelInactive,
583
+ error && "tw-text-color-text-critical",
584
+ labelClassName
585
+ ),
586
+ children: [
587
+ label,
588
+ mandatory && /* @__PURE__ */ jsx4("span", { className: "tw-text-color-text-critical tw-ml-1", children: "*" })
589
+ ]
590
+ }
591
+ ),
592
+ /* @__PURE__ */ jsxs(
593
+ "div",
594
+ {
595
+ className: clsx(
596
+ "tw-absolute tw-right-3 tw--translate-y-1/2 tw-flex tw-items-center",
597
+ {
598
+ "!tw-right-[5px]": doubleCharSearch && !(isHovering && selectedValue && allowClear),
599
+ "tw-top-3 !tw-right-2": size === "small",
600
+ "tw-top-1/2": size !== "small"
601
+ }
602
+ ),
603
+ children: [
604
+ disabled && /* @__PURE__ */ jsx4("div", { className: "tw-absolute tw-right-0 -tw-top-2", children: /* @__PURE__ */ jsx4(Lock, { size: 16 }) }),
605
+ isLoading ? /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(LoadingSpinner_default, { size: "xs" }) }) : /* @__PURE__ */ jsx4(
606
+ "div",
607
+ {
608
+ className: clsx(
609
+ "tw-transition-all tw-duration-200 tw-cursor-pointer tw-flex tw-items-center",
610
+ // Only rotate chevron when open and not showing clear icon
611
+ isOpen && !(isHovering && selectedValue && allowClear) && "-tw-rotate-180"
612
+ ),
613
+ onMouseDown: (e) => {
614
+ if (isHovering && selectedValue && allowClear) {
615
+ handleClear(e);
616
+ } else {
617
+ handleChevronClick(e);
618
+ }
619
+ },
620
+ children: disabled ? null : isHovering && selectedValue && allowClear ? /* @__PURE__ */ jsx4(
621
+ CrossV2,
622
+ {
623
+ color: "#111827",
624
+ className: clsx({ "tw-mr-1": size !== "small" }),
625
+ size: size === "small" ? 12 : 16
626
+ }
627
+ ) : /* @__PURE__ */ jsx4(
628
+ Chevron,
629
+ {
630
+ className: clsx("tw-text-gray-400"),
631
+ color: "#6B7280"
632
+ }
633
+ )
634
+ }
635
+ )
636
+ ]
637
+ }
638
+ )
639
+ ] }),
640
+ isOpen && /* @__PURE__ */ jsx4(
641
+ "div",
642
+ {
643
+ className: clsx(
644
+ "tw-absolute tw-z-[100] tw-w-full tw-mt-0 tw-bg-white tw-border tw-border-[#ebe3dd] tw-border-solid tw-rounded-xl tw-shadow-lg tw-overflow-y-auto tw-py-1",
645
+ { "tw-max-h-60": !doubleCharSearch },
646
+ { "tw-max-h-44": doubleCharSearch },
647
+ dropdownClassName
648
+ ),
649
+ ref: optionListRef,
650
+ children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => /* @__PURE__ */ jsx4(
651
+ SelectOptionItem,
652
+ {
653
+ option,
654
+ index,
655
+ isSelected: normalizeValue(selectedValue) === normalizeValue(option.value),
656
+ isHighlighted: index === highlightedIndex,
657
+ size,
658
+ experience,
659
+ optionClassName,
660
+ doubleCharSearch,
661
+ onSelect: handleOptionSelect,
662
+ onMouseEnter: handleOptionMouseEnter,
663
+ setRef: setOptionRef
664
+ },
665
+ doubleCharSearch ? option.label : option.value
666
+ )) : /* @__PURE__ */ jsx4("div", { className: "tw-px-4 tw-py-3 tw-text-gray-500 tw-text-sm", children: "No options found" })
667
+ }
668
+ )
669
+ ]
670
+ }
671
+ ) });
672
+ };
673
+ var arePropsEqual = (prevProps, nextProps) => {
674
+ var _a, _b;
675
+ const criticalProps = [
676
+ "value",
677
+ "valueSelected",
678
+ "options",
679
+ "error",
680
+ "disabled",
681
+ "label",
682
+ "mandatory"
683
+ ];
684
+ for (const prop of criticalProps) {
685
+ if (prevProps[prop] !== nextProps[prop]) {
686
+ return false;
687
+ }
688
+ }
689
+ if (((_a = prevProps.options) == null ? void 0 : _a.length) !== ((_b = nextProps.options) == null ? void 0 : _b.length)) {
690
+ return false;
691
+ }
692
+ if (prevProps.options && nextProps.options) {
693
+ for (let i = 0; i < prevProps.options.length; i++) {
694
+ const prevOpt = prevProps.options[i];
695
+ const nextOpt = nextProps.options[i];
696
+ if ((prevOpt == null ? void 0 : prevOpt.value) !== (nextOpt == null ? void 0 : nextOpt.value) || (prevOpt == null ? void 0 : prevOpt.label) !== (nextOpt == null ? void 0 : nextOpt.label)) {
697
+ return false;
698
+ }
699
+ }
700
+ }
701
+ return true;
702
+ };
703
+ Select.displayName = "Select";
704
+ var Select_default = memo3(Select, arePropsEqual);
705
+
706
+ export {
707
+ Select,
708
+ Select_default
709
+ };