@itilite/lumina-ui 1.0.1-beta.4 → 1.0.2-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AdvancedDateRangePicker-ozItnkhp.d.mts +57 -0
- package/dist/AdvancedDateRangePicker-ozItnkhp.d.ts +57 -0
- package/dist/Table-BOq-_9Nr.d.mts +121 -0
- package/dist/Table-BOq-_9Nr.d.ts +121 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.d.mts +2 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.d.ts +2 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.js +791 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.mjs +11 -0
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.d.mts +17 -0
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.d.ts +17 -0
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.js +370 -0
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.mjs +8 -0
- package/dist/{Avatar.d.mts → atom/Avatar/Avatar.d.mts} +1 -9
- package/dist/{Avatar.d.ts → atom/Avatar/Avatar.d.ts} +1 -9
- package/dist/{Avatar.js → atom/Avatar/Avatar.js} +4 -2
- package/dist/{Avatar.mjs → atom/Avatar/Avatar.mjs} +2 -2
- package/dist/{Button.js → atom/Button/Button.js} +1 -1
- package/dist/{Button.mjs → atom/Button/Button.mjs} +2 -2
- package/dist/{Checkbox.mjs → atom/Checkbox/Checkbox.mjs} +2 -2
- package/dist/atom/LoadingSpinner/LoadingSpinner.d.mts +19 -0
- package/dist/atom/LoadingSpinner/LoadingSpinner.d.ts +19 -0
- package/dist/atom/LoadingSpinner/LoadingSpinner.js +90 -0
- package/dist/atom/LoadingSpinner/LoadingSpinner.mjs +9 -0
- package/dist/{Modal.d.mts → atom/Modal/Modal.d.mts} +1 -1
- package/dist/{Modal.d.ts → atom/Modal/Modal.d.ts} +1 -1
- package/dist/{Modal.js → atom/Modal/Modal.js} +1 -1
- package/dist/atom/Modal/Modal.mjs +10 -0
- package/dist/{Radio.mjs → atom/Radio/Radio.mjs} +2 -2
- package/dist/atom/RangePicker/Chevron.d.mts +13 -0
- package/dist/atom/RangePicker/Chevron.d.ts +13 -0
- package/dist/atom/RangePicker/Chevron.js +110 -0
- package/dist/atom/RangePicker/Chevron.mjs +7 -0
- package/dist/atom/RangePicker/RangePicker.d.mts +26 -0
- package/dist/atom/RangePicker/RangePicker.d.ts +26 -0
- package/dist/atom/RangePicker/RangePicker.js +1465 -0
- package/dist/atom/RangePicker/RangePicker.mjs +13 -0
- package/dist/atom/Select/Select.d.mts +40 -0
- package/dist/atom/Select/Select.d.ts +40 -0
- package/dist/atom/Select/Select.js +805 -0
- package/dist/atom/Select/Select.mjs +11 -0
- package/dist/atom/Slider/Slider.d.mts +34 -0
- package/dist/atom/Slider/Slider.d.ts +34 -0
- package/dist/atom/Slider/Slider.js +107 -0
- package/dist/atom/Slider/Slider.mjs +9 -0
- package/dist/{Switch.mjs → atom/Switch/Switch.mjs} +2 -2
- package/dist/atom/Table/Table.d.mts +3 -0
- package/dist/atom/Table/Table.d.ts +3 -0
- package/dist/atom/Table/Table.js +306 -0
- package/dist/atom/Table/Table.mjs +9 -0
- package/dist/atom/Tag/Tag.d.mts +6 -0
- package/dist/atom/Tag/Tag.d.ts +6 -0
- package/dist/atom/Tag/Tag.js +108 -0
- package/dist/atom/Tag/Tag.mjs +9 -0
- package/dist/{Tooltip.mjs → atom/Tooltip/Tooltip.mjs} +2 -2
- package/dist/chunk-4JX54OKI.mjs +627 -0
- package/dist/chunk-4VZB2KR2.mjs +51 -0
- package/dist/chunk-53O7JM5I.mjs +424 -0
- package/dist/{chunk-HISCHZ5H.mjs → chunk-AF2RKLH6.mjs} +1 -1
- package/dist/chunk-D3N7VFER.mjs +73 -0
- package/dist/chunk-GU5F7Z7I.mjs +681 -0
- package/dist/{chunk-X76GNSBB.mjs → chunk-IWO2Y5QX.mjs} +4 -2
- package/dist/chunk-J4YYP4IZ.mjs +0 -0
- package/dist/chunk-N2WTNCQU.mjs +66 -0
- package/dist/chunk-N4DPPZVJ.mjs +269 -0
- package/dist/chunk-PQ3B2FEB.mjs +249 -0
- package/dist/chunk-QKTMWS4J.mjs +43 -0
- package/dist/{chunk-N355RJGH.mjs → chunk-UQJ3BDM4.mjs} +1 -1
- package/dist/chunk-V3CHJHUX.mjs +424 -0
- package/dist/chunk-ZTRM4HZJ.mjs +53 -0
- package/dist/index.d.mts +18 -7
- package/dist/index.d.ts +18 -7
- package/dist/index.js +2461 -8
- package/dist/index.mjs +46 -12
- package/dist/molecules/UserProfile/UserProfile.d.mts +23 -0
- package/dist/molecules/UserProfile/UserProfile.d.ts +23 -0
- package/dist/molecules/UserProfile/UserProfile.js +243 -0
- package/dist/molecules/UserProfile/UserProfile.mjs +11 -0
- package/dist/styles.css +1795 -146
- package/dist/types-D4MD2w3_.d.mts +9 -0
- package/dist/types-D4MD2w3_.d.ts +9 -0
- package/dist/types-mhQmqhsR.d.mts +10 -0
- package/dist/types-mhQmqhsR.d.ts +10 -0
- package/package.json +8 -36
- package/dist/Modal.mjs +0 -10
- /package/dist/{Button.d.mts → atom/Button/Button.d.mts} +0 -0
- /package/dist/{Button.d.ts → atom/Button/Button.d.ts} +0 -0
- /package/dist/{Checkbox.d.mts → atom/Checkbox/Checkbox.d.mts} +0 -0
- /package/dist/{Checkbox.d.ts → atom/Checkbox/Checkbox.d.ts} +0 -0
- /package/dist/{Checkbox.js → atom/Checkbox/Checkbox.js} +0 -0
- /package/dist/{Radio.d.mts → atom/Radio/Radio.d.mts} +0 -0
- /package/dist/{Radio.d.ts → atom/Radio/Radio.d.ts} +0 -0
- /package/dist/{Radio.js → atom/Radio/Radio.js} +0 -0
- /package/dist/{Switch.d.mts → atom/Switch/Switch.d.mts} +0 -0
- /package/dist/{Switch.d.ts → atom/Switch/Switch.d.ts} +0 -0
- /package/dist/{Switch.js → atom/Switch/Switch.js} +0 -0
- /package/dist/{Tooltip.d.mts → atom/Tooltip/Tooltip.d.mts} +0 -0
- /package/dist/{Tooltip.d.ts → atom/Tooltip/Tooltip.d.ts} +0 -0
- /package/dist/{Tooltip.js → atom/Tooltip/Tooltip.js} +0 -0
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
+
|
|
59
|
+
// src/atom/Select/Select.tsx
|
|
60
|
+
var Select_exports = {};
|
|
61
|
+
__export(Select_exports, {
|
|
62
|
+
Select: () => Select,
|
|
63
|
+
default: () => Select_default
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(Select_exports);
|
|
66
|
+
var import_react2 = require("react");
|
|
67
|
+
var import_clsx = __toESM(require("clsx"));
|
|
68
|
+
|
|
69
|
+
// src/icons/Chevron.tsx
|
|
70
|
+
var React = __toESM(require("react"));
|
|
71
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
72
|
+
var Chevron = React.memo(
|
|
73
|
+
(_a) => {
|
|
74
|
+
var _b = _a, { size = 16, color = "#6b7280", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
+
"svg",
|
|
77
|
+
__spreadProps(__spreadValues({
|
|
78
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
79
|
+
width: size,
|
|
80
|
+
height: size,
|
|
81
|
+
fill: "none",
|
|
82
|
+
viewBox: "0 0 16 16",
|
|
83
|
+
className
|
|
84
|
+
}, rest), {
|
|
85
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
"path",
|
|
87
|
+
{
|
|
88
|
+
fill: color,
|
|
89
|
+
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"
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
Chevron.displayName = "Chevron";
|
|
97
|
+
|
|
98
|
+
// src/icons/CrossV2.tsx
|
|
99
|
+
var React2 = __toESM(require("react"));
|
|
100
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
101
|
+
var CrossV2 = React2.memo(
|
|
102
|
+
(_a) => {
|
|
103
|
+
var _b = _a, { size = 16, color = "#111827", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
|
|
104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
105
|
+
"svg",
|
|
106
|
+
__spreadProps(__spreadValues({
|
|
107
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
108
|
+
width: size,
|
|
109
|
+
height: size,
|
|
110
|
+
fill: "none",
|
|
111
|
+
viewBox: "0 0 20 20"
|
|
112
|
+
}, rest), {
|
|
113
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
114
|
+
"path",
|
|
115
|
+
{
|
|
116
|
+
fill: color,
|
|
117
|
+
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"
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
CrossV2.displayName = "CrossV2";
|
|
125
|
+
|
|
126
|
+
// src/icons/Lock.tsx
|
|
127
|
+
var import_react = __toESM(require("react"));
|
|
128
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
129
|
+
var Lock = import_react.default.memo((_a) => {
|
|
130
|
+
var _b = _a, { size = 16, color = "#000" } = _b, rest = __objRest(_b, ["size", "color"]);
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
132
|
+
"svg",
|
|
133
|
+
__spreadProps(__spreadValues({
|
|
134
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
135
|
+
width: size,
|
|
136
|
+
height: size,
|
|
137
|
+
fill: "none",
|
|
138
|
+
viewBox: "0 0 16 16"
|
|
139
|
+
}, rest), {
|
|
140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
141
|
+
"path",
|
|
142
|
+
{
|
|
143
|
+
fill: color,
|
|
144
|
+
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"
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
})
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// src/atom/Tooltip/Tooltip.tsx
|
|
152
|
+
var import_antd = require("antd");
|
|
153
|
+
|
|
154
|
+
// src/atom/Tooltip/Tooltip.module.scss
|
|
155
|
+
var Tooltip_module_default = { "light": "Tooltip-module__light___H5oCc" };
|
|
156
|
+
|
|
157
|
+
// src/atom/Tooltip/Tooltip.tsx
|
|
158
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
159
|
+
var Tooltip = (_a) => {
|
|
160
|
+
var _b = _a, {
|
|
161
|
+
children,
|
|
162
|
+
title = "",
|
|
163
|
+
placement = "top",
|
|
164
|
+
color = "#1F2937",
|
|
165
|
+
className,
|
|
166
|
+
mode = "dark"
|
|
167
|
+
} = _b, rest = __objRest(_b, [
|
|
168
|
+
"children",
|
|
169
|
+
"title",
|
|
170
|
+
"placement",
|
|
171
|
+
"color",
|
|
172
|
+
"className",
|
|
173
|
+
"mode"
|
|
174
|
+
]);
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
176
|
+
import_antd.Tooltip,
|
|
177
|
+
__spreadProps(__spreadValues({
|
|
178
|
+
className,
|
|
179
|
+
color,
|
|
180
|
+
title,
|
|
181
|
+
placement,
|
|
182
|
+
overlayClassName: mode === "light" ? Tooltip_module_default.light : ""
|
|
183
|
+
}, rest), {
|
|
184
|
+
children
|
|
185
|
+
})
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
Tooltip.displayName = "Tooltip";
|
|
189
|
+
var Tooltip_default = Tooltip;
|
|
190
|
+
|
|
191
|
+
// src/atom/LoadingSpinner/LoadingSpinner.tsx
|
|
192
|
+
var import_icons = require("@ant-design/icons");
|
|
193
|
+
var import_antd2 = require("antd");
|
|
194
|
+
|
|
195
|
+
// src/atom/LoadingSpinner/LoadingSpinner.module.scss
|
|
196
|
+
var LoadingSpinner_module_default = { "spinnerContainer": "LoadingSpinner-module__spinnerContainer___DiPLf" };
|
|
197
|
+
|
|
198
|
+
// src/atom/LoadingSpinner/LoadingSpinner.tsx
|
|
199
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
200
|
+
var sizeMapping = {
|
|
201
|
+
xs: 16,
|
|
202
|
+
small: 24,
|
|
203
|
+
medium: 36,
|
|
204
|
+
large: 48
|
|
205
|
+
};
|
|
206
|
+
var LoadingSpinner = (_a) => {
|
|
207
|
+
var _b = _a, { size = "small", color = "#ec5d25" } = _b, rest = __objRest(_b, ["size", "color"]);
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", __spreadProps(__spreadValues({ className: LoadingSpinner_module_default.spinnerContainer }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
209
|
+
import_antd2.Spin,
|
|
210
|
+
{
|
|
211
|
+
indicator: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
212
|
+
import_icons.LoadingOutlined,
|
|
213
|
+
{
|
|
214
|
+
style: { fontSize: sizeMapping[size], color },
|
|
215
|
+
spin: true
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
) }));
|
|
220
|
+
};
|
|
221
|
+
LoadingSpinner.displayName = "LoadingSpinner";
|
|
222
|
+
var LoadingSpinner_default = LoadingSpinner;
|
|
223
|
+
|
|
224
|
+
// src/atom/Select/Select.tsx
|
|
225
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
226
|
+
var InputWrapper = (0, import_react2.memo)(({ children, disabled, disabledTooltip }) => {
|
|
227
|
+
if (disabled && disabledTooltip)
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Tooltip_default, { title: disabledTooltip, children });
|
|
229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children });
|
|
230
|
+
});
|
|
231
|
+
var OptionItem = (0, import_react2.memo)(({
|
|
232
|
+
option,
|
|
233
|
+
index,
|
|
234
|
+
isSelected,
|
|
235
|
+
isHighlighted,
|
|
236
|
+
experience,
|
|
237
|
+
size,
|
|
238
|
+
optionClassName,
|
|
239
|
+
onSelectHandler,
|
|
240
|
+
onMouseEnterHandler
|
|
241
|
+
}) => {
|
|
242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
243
|
+
"div",
|
|
244
|
+
{
|
|
245
|
+
onClick: () => onSelectHandler(option),
|
|
246
|
+
onMouseEnter: () => onMouseEnterHandler(index),
|
|
247
|
+
className: (0, import_clsx.default)(
|
|
248
|
+
"tw-transition-all tw-duration-150",
|
|
249
|
+
{ "tw-typography-body2": size !== "small" },
|
|
250
|
+
{ "tw-typography-caption1": size === "small" },
|
|
251
|
+
optionClassName
|
|
252
|
+
),
|
|
253
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
className: (0, import_clsx.default)(
|
|
257
|
+
"tw-px-4 tw-cursor-pointer tw-py-2 tw-mx-0.5 tw-rounded-xl",
|
|
258
|
+
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]"
|
|
259
|
+
),
|
|
260
|
+
children: option.label
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
});
|
|
266
|
+
var Select = ({
|
|
267
|
+
label,
|
|
268
|
+
mandatory = false,
|
|
269
|
+
error = false,
|
|
270
|
+
options = [],
|
|
271
|
+
valueSelected = "",
|
|
272
|
+
// Keep for backward compatibility
|
|
273
|
+
value: _valueProp,
|
|
274
|
+
// Rename to avoid potential conflicts with native value attribute
|
|
275
|
+
onChange,
|
|
276
|
+
onSearch,
|
|
277
|
+
isLoading = false,
|
|
278
|
+
disabled = false,
|
|
279
|
+
disabledTooltip = "",
|
|
280
|
+
className = "",
|
|
281
|
+
dropdownClassName = "",
|
|
282
|
+
optionClassName = "",
|
|
283
|
+
style = {},
|
|
284
|
+
showDisplayValue = false,
|
|
285
|
+
// New prop to show displayValue instead of label
|
|
286
|
+
allowClear = true,
|
|
287
|
+
enableSearch = true,
|
|
288
|
+
doubleCharSearch = false,
|
|
289
|
+
id,
|
|
290
|
+
name,
|
|
291
|
+
tabIndex,
|
|
292
|
+
// Add tabIndex prop
|
|
293
|
+
// Additional styling props
|
|
294
|
+
size = "default",
|
|
295
|
+
// 'small', 'default', 'large'
|
|
296
|
+
variant = "default",
|
|
297
|
+
// 'default', 'filled', 'outlined'
|
|
298
|
+
wrapperClassName = "",
|
|
299
|
+
inputClassName = "",
|
|
300
|
+
// Custom class for input element specifically
|
|
301
|
+
labelClassName = "",
|
|
302
|
+
// Custom class for label element specifically
|
|
303
|
+
height = "tw-h-12",
|
|
304
|
+
// Custom height
|
|
305
|
+
experience = "business"
|
|
306
|
+
}) => {
|
|
307
|
+
const normalizeValue = (0, import_react2.useCallback)(
|
|
308
|
+
(val) => {
|
|
309
|
+
if (val === null || val === void 0) return "";
|
|
310
|
+
return String(val);
|
|
311
|
+
},
|
|
312
|
+
[]
|
|
313
|
+
);
|
|
314
|
+
const validatedOptions = (0, import_react2.useMemo)(() => {
|
|
315
|
+
if (!Array.isArray(options)) return [];
|
|
316
|
+
return options.filter(
|
|
317
|
+
(opt) => opt && typeof opt === "object" && opt.value !== void 0 && opt.value !== null && opt.label !== void 0
|
|
318
|
+
);
|
|
319
|
+
}, [options]);
|
|
320
|
+
const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
|
|
321
|
+
const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
|
|
322
|
+
const [searchTerm, setSearchTerm] = (0, import_react2.useState)("");
|
|
323
|
+
const [isHovering, setIsHovering] = (0, import_react2.useState)(false);
|
|
324
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react2.useState)(-1);
|
|
325
|
+
const [selectedValue, setSelectedValue] = (0, import_react2.useState)(() => {
|
|
326
|
+
const initialValue = valueSelected;
|
|
327
|
+
if (initialValue === null || initialValue === void 0) return "";
|
|
328
|
+
return String(initialValue);
|
|
329
|
+
});
|
|
330
|
+
const inputRef = (0, import_react2.useRef)(null);
|
|
331
|
+
const inputValueRef = (0, import_react2.useRef)("");
|
|
332
|
+
const dropdownRef = (0, import_react2.useRef)(null);
|
|
333
|
+
const optionRefs = (0, import_react2.useRef)([]);
|
|
334
|
+
const optionListRef = (0, import_react2.useRef)(null);
|
|
335
|
+
const blurTimeoutRef = (0, import_react2.useRef)(null);
|
|
336
|
+
const hoverTimeoutRef = (0, import_react2.useRef)(null);
|
|
337
|
+
const isActive = isFocused || Boolean(selectedValue) || Boolean(valueSelected) || Boolean(searchTerm);
|
|
338
|
+
const sizeClasses = (0, import_react2.useMemo)(() => {
|
|
339
|
+
switch (size) {
|
|
340
|
+
case "small":
|
|
341
|
+
return {
|
|
342
|
+
input: "tw-h-6 tw-typography-caption1Bold !tw-rounded-lg",
|
|
343
|
+
padding: "tw-px-2 tw-py-1",
|
|
344
|
+
labelActive: "tw-top-0.5 tw-typography-caption2",
|
|
345
|
+
labelInactive: "tw-top-1.5 tw-typography-caption3"
|
|
346
|
+
};
|
|
347
|
+
case "medium":
|
|
348
|
+
return {
|
|
349
|
+
input: "tw-h-10 tw-px-4 tw-typography-body2",
|
|
350
|
+
padding: label ? "tw-pt-4 tw-pb-1" : "tw-py-2",
|
|
351
|
+
labelActive: "tw-top-1 tw-typography-caption3",
|
|
352
|
+
labelInactive: "tw-top-2.5 tw-typography-body2"
|
|
353
|
+
};
|
|
354
|
+
case "large":
|
|
355
|
+
return {
|
|
356
|
+
input: "tw-h-16 tw-px-5 tw-typography-bodyLarge",
|
|
357
|
+
padding: label ? "tw-pt-8 tw-pb-4" : "tw-py-5",
|
|
358
|
+
labelActive: "tw-top-1 tw-typography-caption2",
|
|
359
|
+
labelInactive: "tw-top-5 tw-typography-body1"
|
|
360
|
+
};
|
|
361
|
+
default:
|
|
362
|
+
return {
|
|
363
|
+
input: height + " tw-px-4 tw-typography-bodyLarge",
|
|
364
|
+
padding: label ? "tw-pt-6 tw-pb-3" : "tw-py-3",
|
|
365
|
+
labelActive: "tw-top-1 tw-typography-caption3",
|
|
366
|
+
labelInactive: "tw-top-3.5 tw-typography-body2"
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
}, [size, label, height]);
|
|
370
|
+
const variantClasses = (0, import_react2.useMemo)(() => {
|
|
371
|
+
switch (variant) {
|
|
372
|
+
case "filled":
|
|
373
|
+
return "tw-bg-gray-50 tw-border-transparent";
|
|
374
|
+
case "outlined":
|
|
375
|
+
return "tw-bg-transparent tw-border-2";
|
|
376
|
+
default:
|
|
377
|
+
return " tw-border";
|
|
378
|
+
}
|
|
379
|
+
}, [variant]);
|
|
380
|
+
const handleBlur = (0, import_react2.useCallback)(() => {
|
|
381
|
+
blurTimeoutRef.current = setTimeout(() => {
|
|
382
|
+
setIsOpen(false);
|
|
383
|
+
setSearchTerm("");
|
|
384
|
+
setHighlightedIndex(-1);
|
|
385
|
+
blurTimeoutRef.current = null;
|
|
386
|
+
setIsFocused(false);
|
|
387
|
+
}, 150);
|
|
388
|
+
}, []);
|
|
389
|
+
const handleSearchChange = (0, import_react2.useCallback)(
|
|
390
|
+
(e) => {
|
|
391
|
+
var _a;
|
|
392
|
+
const searchValue = doubleCharSearch ? e.target.value.slice(0, 2) || "" : e.target.value;
|
|
393
|
+
if (doubleCharSearch) {
|
|
394
|
+
setSearchTerm(searchValue);
|
|
395
|
+
} else {
|
|
396
|
+
setSearchTerm(searchValue);
|
|
397
|
+
}
|
|
398
|
+
setIsOpen(true);
|
|
399
|
+
setHighlightedIndex(-1);
|
|
400
|
+
if (onSearch && typeof onSearch === "function") {
|
|
401
|
+
onSearch(searchValue);
|
|
402
|
+
}
|
|
403
|
+
(_a = optionListRef == null ? void 0 : optionListRef.current) == null ? void 0 : _a.scrollTo({
|
|
404
|
+
top: 0,
|
|
405
|
+
behavior: "smooth"
|
|
406
|
+
});
|
|
407
|
+
},
|
|
408
|
+
[doubleCharSearch, onSearch]
|
|
409
|
+
);
|
|
410
|
+
const handleOptionSelect = (0, import_react2.useCallback)(
|
|
411
|
+
(option) => {
|
|
412
|
+
var _a;
|
|
413
|
+
if (blurTimeoutRef.current) {
|
|
414
|
+
clearTimeout(blurTimeoutRef.current);
|
|
415
|
+
blurTimeoutRef.current = null;
|
|
416
|
+
}
|
|
417
|
+
inputValueRef.current = option.label;
|
|
418
|
+
const normalizedValue = normalizeValue(option.value);
|
|
419
|
+
setSelectedValue(normalizedValue);
|
|
420
|
+
setSearchTerm("");
|
|
421
|
+
setIsOpen(false);
|
|
422
|
+
if (enableSearch) {
|
|
423
|
+
setIsFocused(false);
|
|
424
|
+
}
|
|
425
|
+
setIsHovering(false);
|
|
426
|
+
if (onChange) onChange(option.value);
|
|
427
|
+
if (enableSearch) (_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
428
|
+
},
|
|
429
|
+
[normalizeValue, onChange, enableSearch]
|
|
430
|
+
);
|
|
431
|
+
const handleClear = (0, import_react2.useCallback)(
|
|
432
|
+
(e) => {
|
|
433
|
+
var _a;
|
|
434
|
+
inputValueRef.current = "";
|
|
435
|
+
e.stopPropagation();
|
|
436
|
+
e.preventDefault();
|
|
437
|
+
setSelectedValue("");
|
|
438
|
+
setSearchTerm("");
|
|
439
|
+
if (enableSearch) {
|
|
440
|
+
setIsOpen(true);
|
|
441
|
+
setIsFocused(true);
|
|
442
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
443
|
+
} else {
|
|
444
|
+
setIsOpen(false);
|
|
445
|
+
setIsFocused(false);
|
|
446
|
+
}
|
|
447
|
+
if (onChange) onChange(null);
|
|
448
|
+
},
|
|
449
|
+
[onChange, enableSearch]
|
|
450
|
+
);
|
|
451
|
+
(0, import_react2.useEffect)(() => {
|
|
452
|
+
if (!validatedOptions.length) {
|
|
453
|
+
setSelectedValue("");
|
|
454
|
+
setSearchTerm("");
|
|
455
|
+
inputValueRef.current = "";
|
|
456
|
+
}
|
|
457
|
+
}, [validatedOptions.length]);
|
|
458
|
+
(0, import_react2.useEffect)(() => {
|
|
459
|
+
const externalValue = _valueProp !== void 0 ? _valueProp : valueSelected;
|
|
460
|
+
const newValue = normalizeValue(externalValue);
|
|
461
|
+
setSelectedValue((prevValue) => {
|
|
462
|
+
const prevNormalized = normalizeValue(prevValue);
|
|
463
|
+
return prevNormalized !== newValue ? newValue : prevValue;
|
|
464
|
+
});
|
|
465
|
+
}, [valueSelected, _valueProp, normalizeValue]);
|
|
466
|
+
(0, import_react2.useEffect)(() => {
|
|
467
|
+
const handleClickOutside = (event) => {
|
|
468
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
469
|
+
if (blurTimeoutRef.current) {
|
|
470
|
+
clearTimeout(blurTimeoutRef.current);
|
|
471
|
+
blurTimeoutRef.current = null;
|
|
472
|
+
}
|
|
473
|
+
setIsOpen(false);
|
|
474
|
+
setIsFocused(false);
|
|
475
|
+
setSearchTerm("");
|
|
476
|
+
setHighlightedIndex(-1);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
480
|
+
return () => {
|
|
481
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
482
|
+
if (blurTimeoutRef.current) {
|
|
483
|
+
clearTimeout(blurTimeoutRef.current);
|
|
484
|
+
}
|
|
485
|
+
if (hoverTimeoutRef.current) {
|
|
486
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
}, []);
|
|
490
|
+
const getDisplayValue = (0, import_react2.useCallback)(() => {
|
|
491
|
+
if (selectedValue && (validatedOptions == null ? void 0 : validatedOptions.length) > 0) {
|
|
492
|
+
const selected = validatedOptions.find(
|
|
493
|
+
(opt) => normalizeValue(opt.value) === normalizeValue(selectedValue)
|
|
494
|
+
);
|
|
495
|
+
if (selected) {
|
|
496
|
+
return showDisplayValue && selected.displayValue ? selected.displayValue : selected.label;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
if (selectedValue && (!validatedOptions || validatedOptions.length === 0)) {
|
|
500
|
+
return selectedValue;
|
|
501
|
+
}
|
|
502
|
+
return "";
|
|
503
|
+
}, [selectedValue, validatedOptions, showDisplayValue, normalizeValue]);
|
|
504
|
+
const displayValue = (0, import_react2.useMemo)(() => getDisplayValue(), [getDisplayValue]);
|
|
505
|
+
const inputClasses = (0, import_react2.useMemo)(() => {
|
|
506
|
+
return (0, import_clsx.default)(
|
|
507
|
+
"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",
|
|
508
|
+
sizeClasses.input,
|
|
509
|
+
sizeClasses.padding,
|
|
510
|
+
variantClasses,
|
|
511
|
+
{
|
|
512
|
+
"tw-bg-white": valueSelected || displayValue || isFocused,
|
|
513
|
+
"tw-bg-color-gray-5": !valueSelected || !displayValue,
|
|
514
|
+
"!tw-bg-[#F8F7F6] tw-cursor-not-allowed tw-pointer-events-none": disabled
|
|
515
|
+
},
|
|
516
|
+
!label && "tw-flex tw-items-center",
|
|
517
|
+
{
|
|
518
|
+
"!tw-border-color-primary": isFocused && experience === "business"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"!tw-border-[#804D7B]": isFocused && experience === "personal"
|
|
522
|
+
},
|
|
523
|
+
error ? "!tw-border-color-text-critical " : "tw-border-[#EBE3DD] hover:tw-border-[#C5B7AC]",
|
|
524
|
+
"focus:tw-shadow-sm focus:tw-ring-offset-1",
|
|
525
|
+
className,
|
|
526
|
+
inputClassName
|
|
527
|
+
);
|
|
528
|
+
}, [sizeClasses, variantClasses, valueSelected, displayValue, isFocused, disabled, label, experience, error, className, inputClassName]);
|
|
529
|
+
const filteredOptions = (0, import_react2.useMemo)(() => {
|
|
530
|
+
var _a;
|
|
531
|
+
if (!enableSearch) {
|
|
532
|
+
return validatedOptions;
|
|
533
|
+
}
|
|
534
|
+
(_a = dropdownRef.current) == null ? void 0 : _a.scrollTo(0, 0);
|
|
535
|
+
const updatedFilteredOptions = validatedOptions.filter((option) => {
|
|
536
|
+
var _a2;
|
|
537
|
+
return (_a2 = option == null ? void 0 : option.label) == null ? void 0 : _a2.toLowerCase().includes(searchTerm == null ? void 0 : searchTerm.toLowerCase());
|
|
538
|
+
});
|
|
539
|
+
return updatedFilteredOptions;
|
|
540
|
+
}, [validatedOptions, searchTerm, enableSearch]);
|
|
541
|
+
const getSelectedOptionIndex = (0, import_react2.useCallback)(() => {
|
|
542
|
+
if (!selectedValue || !filteredOptions.length) {
|
|
543
|
+
return 0;
|
|
544
|
+
}
|
|
545
|
+
const index = filteredOptions.findIndex(
|
|
546
|
+
(option) => normalizeValue(option.value) === normalizeValue(selectedValue)
|
|
547
|
+
);
|
|
548
|
+
return index >= 0 ? index : 0;
|
|
549
|
+
}, [selectedValue, filteredOptions, normalizeValue]);
|
|
550
|
+
const handleInputInteraction = (0, import_react2.useCallback)(
|
|
551
|
+
(_e) => {
|
|
552
|
+
var _a;
|
|
553
|
+
if (blurTimeoutRef.current) {
|
|
554
|
+
clearTimeout(blurTimeoutRef.current);
|
|
555
|
+
blurTimeoutRef.current = null;
|
|
556
|
+
}
|
|
557
|
+
if (isOpen) {
|
|
558
|
+
setIsOpen(false);
|
|
559
|
+
setIsFocused(false);
|
|
560
|
+
setSearchTerm("");
|
|
561
|
+
setHighlightedIndex(-1);
|
|
562
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
setIsFocused(true);
|
|
566
|
+
setIsOpen(true);
|
|
567
|
+
setHighlightedIndex(getSelectedOptionIndex());
|
|
568
|
+
if (inputRef.current) {
|
|
569
|
+
inputRef.current.focus();
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
[isOpen, getSelectedOptionIndex]
|
|
573
|
+
);
|
|
574
|
+
const handleKeyDown = (0, import_react2.useCallback)(
|
|
575
|
+
(e) => {
|
|
576
|
+
var _a;
|
|
577
|
+
if (!isOpen) return;
|
|
578
|
+
switch (e.key) {
|
|
579
|
+
case "ArrowDown":
|
|
580
|
+
e.preventDefault();
|
|
581
|
+
setHighlightedIndex((prev) => {
|
|
582
|
+
const nextIndex = prev < filteredOptions.length - 1 ? prev + 1 : prev;
|
|
583
|
+
return nextIndex;
|
|
584
|
+
});
|
|
585
|
+
break;
|
|
586
|
+
case "ArrowUp":
|
|
587
|
+
e.preventDefault();
|
|
588
|
+
setHighlightedIndex((prev) => {
|
|
589
|
+
const nextIndex = prev > 0 ? prev - 1 : prev;
|
|
590
|
+
return nextIndex;
|
|
591
|
+
});
|
|
592
|
+
break;
|
|
593
|
+
case "Enter":
|
|
594
|
+
e.preventDefault();
|
|
595
|
+
if (highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {
|
|
596
|
+
handleOptionSelect(filteredOptions[highlightedIndex]);
|
|
597
|
+
}
|
|
598
|
+
break;
|
|
599
|
+
case "Escape":
|
|
600
|
+
e.preventDefault();
|
|
601
|
+
setIsOpen(false);
|
|
602
|
+
setIsFocused(false);
|
|
603
|
+
setSearchTerm("");
|
|
604
|
+
setHighlightedIndex(-1);
|
|
605
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
606
|
+
break;
|
|
607
|
+
default:
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
[isOpen, highlightedIndex, filteredOptions, handleOptionSelect]
|
|
612
|
+
);
|
|
613
|
+
(0, import_react2.useEffect)(() => {
|
|
614
|
+
if (highlightedIndex >= 0 && optionRefs.current[highlightedIndex]) {
|
|
615
|
+
optionRefs.current[highlightedIndex].scrollIntoView({
|
|
616
|
+
block: "nearest",
|
|
617
|
+
behavior: "smooth"
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
}, [highlightedIndex]);
|
|
621
|
+
(0, import_react2.useEffect)(() => {
|
|
622
|
+
optionRefs.current = [];
|
|
623
|
+
}, [filteredOptions.length]);
|
|
624
|
+
const handleMouseEnter = (0, import_react2.useCallback)(() => {
|
|
625
|
+
if (hoverTimeoutRef.current) {
|
|
626
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
627
|
+
}
|
|
628
|
+
if (!isHovering) {
|
|
629
|
+
setIsHovering(true);
|
|
630
|
+
}
|
|
631
|
+
}, [isHovering]);
|
|
632
|
+
const handleMouseLeave = (0, import_react2.useCallback)(() => {
|
|
633
|
+
hoverTimeoutRef.current = setTimeout(() => {
|
|
634
|
+
setIsHovering(false);
|
|
635
|
+
}, 50);
|
|
636
|
+
}, []);
|
|
637
|
+
const handleChevronClick = (0, import_react2.useCallback)(
|
|
638
|
+
(e) => {
|
|
639
|
+
var _a;
|
|
640
|
+
e.preventDefault();
|
|
641
|
+
if (blurTimeoutRef.current) {
|
|
642
|
+
clearTimeout(blurTimeoutRef.current);
|
|
643
|
+
blurTimeoutRef.current = null;
|
|
644
|
+
}
|
|
645
|
+
if (isOpen) {
|
|
646
|
+
setIsOpen(false);
|
|
647
|
+
setIsFocused(false);
|
|
648
|
+
setSearchTerm("");
|
|
649
|
+
setHighlightedIndex(-1);
|
|
650
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
651
|
+
} else {
|
|
652
|
+
if (inputRef.current) {
|
|
653
|
+
inputRef.current.focus();
|
|
654
|
+
}
|
|
655
|
+
handleInputInteraction();
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
[isOpen, handleInputInteraction]
|
|
659
|
+
);
|
|
660
|
+
const handleChevronMouseDown = (0, import_react2.useCallback)(
|
|
661
|
+
(e) => {
|
|
662
|
+
if (isHovering && selectedValue && allowClear) {
|
|
663
|
+
handleClear(e);
|
|
664
|
+
} else {
|
|
665
|
+
handleChevronClick(e);
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
[isHovering, selectedValue, allowClear, handleClear, handleChevronClick]
|
|
669
|
+
);
|
|
670
|
+
const handleOptionClick = (0, import_react2.useCallback)((option) => {
|
|
671
|
+
handleOptionSelect(option);
|
|
672
|
+
}, [handleOptionSelect]);
|
|
673
|
+
const handleOptionMouseEnter = (0, import_react2.useCallback)((index) => {
|
|
674
|
+
setHighlightedIndex(index);
|
|
675
|
+
}, []);
|
|
676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InputWrapper, { disabled, disabledTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
677
|
+
"div",
|
|
678
|
+
{
|
|
679
|
+
style,
|
|
680
|
+
className: (0, import_clsx.default)("tw-relative tw-w-full", wrapperClassName, {
|
|
681
|
+
"tw-cursor-not-allowed": disabled
|
|
682
|
+
}),
|
|
683
|
+
ref: dropdownRef,
|
|
684
|
+
onMouseEnter: handleMouseEnter,
|
|
685
|
+
onMouseLeave: handleMouseLeave,
|
|
686
|
+
children: [
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "tw-relative", children: [
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
689
|
+
"input",
|
|
690
|
+
{
|
|
691
|
+
ref: inputRef,
|
|
692
|
+
type: "text",
|
|
693
|
+
id,
|
|
694
|
+
name,
|
|
695
|
+
tabIndex,
|
|
696
|
+
autoComplete: "off",
|
|
697
|
+
autoCorrect: "off",
|
|
698
|
+
autoCapitalize: "off",
|
|
699
|
+
spellCheck: "false",
|
|
700
|
+
value: isFocused && enableSearch ? searchTerm : displayValue,
|
|
701
|
+
onChange: enableSearch ? handleSearchChange : void 0,
|
|
702
|
+
onClick: handleInputInteraction,
|
|
703
|
+
onKeyDown: handleKeyDown,
|
|
704
|
+
className: inputClasses,
|
|
705
|
+
readOnly: !isFocused || !enableSearch
|
|
706
|
+
}
|
|
707
|
+
),
|
|
708
|
+
label && size !== "small" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
709
|
+
"label",
|
|
710
|
+
{
|
|
711
|
+
htmlFor: id,
|
|
712
|
+
className: (0, import_clsx.default)(
|
|
713
|
+
"tw-absolute tw-left-[18px] tw-pointer-events-none tw-transition-all tw-duration-200 tw-ease-out tw-text-gray-500",
|
|
714
|
+
isActive ? sizeClasses.labelActive : sizeClasses.labelInactive,
|
|
715
|
+
error && "tw-text-color-text-critical",
|
|
716
|
+
labelClassName
|
|
717
|
+
),
|
|
718
|
+
children: [
|
|
719
|
+
label,
|
|
720
|
+
mandatory && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "tw-text-color-text-critical tw-ml-1", children: "*" })
|
|
721
|
+
]
|
|
722
|
+
}
|
|
723
|
+
),
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
725
|
+
"div",
|
|
726
|
+
{
|
|
727
|
+
className: (0, import_clsx.default)(
|
|
728
|
+
"tw-absolute tw-right-3 tw--translate-y-1/2 tw-flex tw-items-center",
|
|
729
|
+
{
|
|
730
|
+
"!tw-right-[5px]": doubleCharSearch && !(isHovering && selectedValue && allowClear),
|
|
731
|
+
"tw-top-3 !tw-right-2": size === "small",
|
|
732
|
+
"tw-top-1/2": size !== "small"
|
|
733
|
+
}
|
|
734
|
+
),
|
|
735
|
+
children: [
|
|
736
|
+
disabled && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "tw-absolute tw-right-0 -tw-top-2", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Lock, { size: 16 }) }),
|
|
737
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LoadingSpinner_default, { size: "xs" }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
738
|
+
"div",
|
|
739
|
+
{
|
|
740
|
+
className: (0, import_clsx.default)(
|
|
741
|
+
"tw-transition-all tw-duration-200 tw-cursor-pointer tw-flex tw-items-center",
|
|
742
|
+
// Only rotate chevron when open and not showing clear icon
|
|
743
|
+
isOpen && !(isHovering && selectedValue && allowClear) && "-tw-rotate-180"
|
|
744
|
+
),
|
|
745
|
+
onMouseDown: handleChevronMouseDown,
|
|
746
|
+
children: disabled ? null : isHovering && selectedValue && allowClear ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
747
|
+
CrossV2,
|
|
748
|
+
{
|
|
749
|
+
color: "#111827",
|
|
750
|
+
className: (0, import_clsx.default)({ "tw-mr-1": size !== "small" }),
|
|
751
|
+
size: size === "small" ? 12 : 16
|
|
752
|
+
}
|
|
753
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
754
|
+
Chevron,
|
|
755
|
+
{
|
|
756
|
+
className: (0, import_clsx.default)("tw-text-gray-400"),
|
|
757
|
+
color: "#6B7280"
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
}
|
|
761
|
+
)
|
|
762
|
+
]
|
|
763
|
+
}
|
|
764
|
+
)
|
|
765
|
+
] }),
|
|
766
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
767
|
+
"div",
|
|
768
|
+
{
|
|
769
|
+
className: (0, import_clsx.default)(
|
|
770
|
+
"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",
|
|
771
|
+
{ "tw-max-h-60": !doubleCharSearch },
|
|
772
|
+
{ "tw-max-h-44": doubleCharSearch },
|
|
773
|
+
dropdownClassName
|
|
774
|
+
),
|
|
775
|
+
ref: optionListRef,
|
|
776
|
+
children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => {
|
|
777
|
+
const isSelected = normalizeValue(selectedValue) === normalizeValue(option.value);
|
|
778
|
+
const isHighlighted = index === highlightedIndex;
|
|
779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref: (el) => optionRefs.current[index] = el, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
780
|
+
OptionItem,
|
|
781
|
+
{
|
|
782
|
+
option,
|
|
783
|
+
index,
|
|
784
|
+
isSelected,
|
|
785
|
+
isHighlighted,
|
|
786
|
+
experience,
|
|
787
|
+
size,
|
|
788
|
+
optionClassName,
|
|
789
|
+
onSelectHandler: handleOptionClick,
|
|
790
|
+
onMouseEnterHandler: handleOptionMouseEnter
|
|
791
|
+
}
|
|
792
|
+
) }, doubleCharSearch ? option.label : option.value);
|
|
793
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "tw-px-4 tw-py-3 tw-text-gray-500 tw-text-sm", children: "No options found" })
|
|
794
|
+
}
|
|
795
|
+
)
|
|
796
|
+
]
|
|
797
|
+
}
|
|
798
|
+
) });
|
|
799
|
+
};
|
|
800
|
+
Select.displayName = "Select";
|
|
801
|
+
var Select_default = Select;
|
|
802
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
803
|
+
0 && (module.exports = {
|
|
804
|
+
Select
|
|
805
|
+
});
|