@itilite/lumina-ui 1.1.5 → 1.1.7
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/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/atom/RangePicker/RangePicker.js +266 -136
- package/dist/atom/RangePicker/RangePicker.mjs +4 -2
- package/dist/atom/Select/Select.d.mts +6 -3
- package/dist/atom/Select/Select.d.ts +6 -3
- package/dist/atom/Select/Select.js +214 -91
- package/dist/atom/Select/Select.mjs +3 -1
- 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/chunk-22VF7AVT.mjs +618 -0
- package/dist/chunk-2BNAAOBU.mjs +670 -0
- package/dist/chunk-2IMRLK6M.mjs +44 -0
- package/dist/chunk-2JIINZEK.mjs +618 -0
- package/dist/chunk-2LBFKQDZ.mjs +660 -0
- package/dist/chunk-2ZJBF5C4.mjs +618 -0
- package/dist/chunk-3IMCN4K3.mjs +670 -0
- package/dist/chunk-3KBQQCET.mjs +674 -0
- package/dist/chunk-3KUHXNFH.mjs +678 -0
- package/dist/chunk-3PPNOIXN.mjs +618 -0
- package/dist/chunk-3XFY3TXJ.mjs +611 -0
- package/dist/chunk-3XW7HS5W.mjs +618 -0
- package/dist/chunk-447HZYZ4.mjs +612 -0
- package/dist/chunk-46F3B4U6.mjs +618 -0
- package/dist/chunk-4K5RZHL4.mjs +618 -0
- package/dist/chunk-4QHFP4YD.mjs +666 -0
- package/dist/chunk-4TFX4DHY.mjs +702 -0
- package/dist/chunk-4TWO6JES.mjs +666 -0
- package/dist/chunk-4UQVJ3ZU.mjs +666 -0
- package/dist/chunk-5247J65D.mjs +670 -0
- package/dist/chunk-66H5WSEJ.mjs +618 -0
- package/dist/chunk-6OC6URNL.mjs +73 -0
- package/dist/chunk-6OGEXG5U.mjs +618 -0
- package/dist/chunk-6ROQXYVN.mjs +672 -0
- package/dist/chunk-6WNI6X5Q.mjs +618 -0
- package/dist/chunk-72PPCN6D.mjs +675 -0
- package/dist/chunk-74EGXFNN.mjs +618 -0
- package/dist/chunk-77NCDGJA.mjs +707 -0
- package/dist/chunk-7L3WTWF3.mjs +677 -0
- package/dist/chunk-7NGBIPZT.mjs +618 -0
- package/dist/chunk-7NM4FNMQ.mjs +666 -0
- package/dist/chunk-7YBBSVUA.mjs +672 -0
- package/dist/chunk-7Z52UP7P.mjs +618 -0
- package/dist/chunk-B3LDL3KD.mjs +670 -0
- package/dist/chunk-B63IXC6M.mjs +618 -0
- package/dist/chunk-B65LGQ47.mjs +666 -0
- package/dist/chunk-B6MTRO54.mjs +618 -0
- package/dist/chunk-BJBP5XYB.mjs +618 -0
- package/dist/chunk-BLLSWPCC.mjs +618 -0
- package/dist/chunk-BOYB7REJ.mjs +670 -0
- package/dist/chunk-BP2D64XI.mjs +618 -0
- package/dist/chunk-BRT5IPGQ.mjs +618 -0
- package/dist/chunk-C2J3VBFZ.mjs +670 -0
- package/dist/chunk-CDOR7GQP.mjs +618 -0
- package/dist/chunk-CI2RMA4V.mjs +612 -0
- package/dist/chunk-CNUIZOQJ.mjs +669 -0
- package/dist/chunk-CPBXPEST.mjs +672 -0
- package/dist/chunk-CVOLXLMU.mjs +618 -0
- package/dist/chunk-CWUCNC36.mjs +666 -0
- package/dist/chunk-CZBGN6GS.mjs +612 -0
- package/dist/chunk-D3APB62N.mjs +618 -0
- package/dist/chunk-D3N7VFER.mjs +73 -0
- package/dist/chunk-D7TWXVL2.mjs +674 -0
- package/dist/chunk-DAZ53AD7.mjs +671 -0
- package/dist/chunk-DBY5U6IU.mjs +618 -0
- package/dist/chunk-DXTVU4M5.mjs +618 -0
- package/dist/chunk-DZBTD6QK.mjs +666 -0
- package/dist/chunk-EAK2IMM4.mjs +37 -0
- package/dist/chunk-EQT2Q2LW.mjs +610 -0
- package/dist/chunk-EWMCELQV.mjs +670 -0
- package/dist/chunk-EYKWBEHX.mjs +612 -0
- package/dist/chunk-FHLCFUP6.mjs +666 -0
- package/dist/chunk-FMPFLQZV.mjs +670 -0
- package/dist/chunk-G25YXZ74.mjs +618 -0
- package/dist/chunk-GSG6ZC3R.mjs +37 -0
- package/dist/chunk-H3MQUFTJ.mjs +618 -0
- package/dist/chunk-HKZRLVBX.mjs +618 -0
- package/dist/chunk-HQALJGVT.mjs +618 -0
- package/dist/chunk-I5GBZ3UX.mjs +676 -0
- package/dist/chunk-IQHBVGA4.mjs +677 -0
- package/dist/chunk-IV4V55OA.mjs +672 -0
- package/dist/chunk-J2RAFKAD.mjs +618 -0
- package/dist/chunk-JL34UFI7.mjs +670 -0
- package/dist/chunk-JTKSGGQM.mjs +611 -0
- package/dist/chunk-JZC2RRDH.mjs +618 -0
- package/dist/chunk-K3Y7VKT6.mjs +670 -0
- package/dist/chunk-KEVXNUFG.mjs +672 -0
- package/dist/chunk-KRYAP7NG.mjs +670 -0
- package/dist/chunk-KU655POK.mjs +657 -0
- package/dist/chunk-L55SLVNX.mjs +618 -0
- package/dist/chunk-LCRYOZEV.mjs +618 -0
- package/dist/chunk-LH7PP6V2.mjs +618 -0
- package/dist/chunk-LJMMYKE2.mjs +618 -0
- package/dist/chunk-LK5TROLL.mjs +666 -0
- package/dist/chunk-MDR7DAKM.mjs +618 -0
- package/dist/chunk-MJZLCWZ5.mjs +666 -0
- package/dist/chunk-MKZTEJLS.mjs +612 -0
- package/dist/chunk-MOD7MLCD.mjs +64 -0
- package/dist/chunk-MQCOQHHP.mjs +618 -0
- package/dist/chunk-MSM4KUBM.mjs +618 -0
- package/dist/chunk-MTIUER63.mjs +676 -0
- package/dist/chunk-NBLV3UX5.mjs +618 -0
- package/dist/chunk-NLADSOJS.mjs +618 -0
- package/dist/chunk-NPMTWR3Y.mjs +618 -0
- package/dist/chunk-NQ6GKEO7.mjs +670 -0
- package/dist/chunk-NZSFYNUK.mjs +618 -0
- package/dist/chunk-OANBDTKG.mjs +73 -0
- package/dist/chunk-OCNF4O5U.mjs +612 -0
- package/dist/chunk-OCW5QSWA.mjs +618 -0
- package/dist/chunk-OQF7JZFS.mjs +670 -0
- package/dist/chunk-OT675HGC.mjs +670 -0
- package/dist/chunk-P47TCYKN.mjs +618 -0
- package/dist/chunk-P7TOGXPI.mjs +672 -0
- package/dist/chunk-PCAXXEEQ.mjs +618 -0
- package/dist/chunk-PDHMG7OZ.mjs +672 -0
- package/dist/chunk-PFGVOZGM.mjs +618 -0
- package/dist/chunk-PQSSDK3E.mjs +618 -0
- package/dist/chunk-PST7W3NG.mjs +618 -0
- package/dist/chunk-QGPBZ2YV.mjs +664 -0
- package/dist/chunk-QKTMWS4J.mjs +43 -0
- package/dist/chunk-QOPCJITC.mjs +618 -0
- package/dist/chunk-QSE52CRC.mjs +618 -0
- package/dist/chunk-QTP2QMPL.mjs +669 -0
- package/dist/chunk-R47XX6IW.mjs +611 -0
- package/dist/chunk-RL6AEU6E.mjs +612 -0
- package/dist/chunk-T7T4HCHH.mjs +618 -0
- package/dist/chunk-TED2WCDG.mjs +618 -0
- package/dist/chunk-TJLIMMMB.mjs +612 -0
- package/dist/chunk-TNOJDLON.mjs +611 -0
- package/dist/chunk-TOR67IHH.mjs +672 -0
- package/dist/chunk-TOV7NVKM.mjs +618 -0
- package/dist/chunk-TSYMIRRN.mjs +618 -0
- package/dist/chunk-TTSRI4V7.mjs +708 -0
- package/dist/chunk-UBS3DTE5.mjs +672 -0
- package/dist/chunk-UBW6RYVF.mjs +670 -0
- package/dist/chunk-UJNUFKR5.mjs +43 -0
- package/dist/chunk-VAZZJOSJ.mjs +618 -0
- package/dist/chunk-VCWXOX2B.mjs +618 -0
- package/dist/chunk-VHCLEOHZ.mjs +618 -0
- package/dist/chunk-VTZSCGME.mjs +666 -0
- package/dist/chunk-W33KZ2XR.mjs +618 -0
- package/dist/chunk-WOVMTYDV.mjs +612 -0
- package/dist/chunk-WR3USBWK.mjs +672 -0
- package/dist/chunk-WXYQARQ6.mjs +618 -0
- package/dist/chunk-XSDANHCE.mjs +618 -0
- package/dist/chunk-Y6XKW4NG.mjs +618 -0
- package/dist/chunk-YQSNJFZE.mjs +618 -0
- package/dist/chunk-Z6VG6AG7.mjs +678 -0
- package/dist/chunk-ZAPKQ4C3.mjs +678 -0
- package/dist/chunk-ZCWDQNHL.mjs +618 -0
- package/dist/chunk-ZF5JBNCI.mjs +618 -0
- package/dist/chunk-ZN7BHWOF.mjs +672 -0
- package/dist/chunk-ZUQJKA5J.mjs +666 -0
- package/dist/chunk-ZWHWIGYQ.mjs +618 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +299 -136
- package/dist/index.mjs +21 -13
- package/dist/styles.css +288 -181
- package/package.json +3 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomRangePicker,
|
|
3
3
|
RangePicker_default
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-B63IXC6M.mjs";
|
|
5
|
+
import "../../chunk-IQHBVGA4.mjs";
|
|
6
|
+
import "../../chunk-MLCMZRUC.mjs";
|
|
7
|
+
import "../../chunk-QKTMWS4J.mjs";
|
|
6
8
|
import "../../chunk-ZTRM4HZJ.mjs";
|
|
7
9
|
import "../../chunk-FWCSY2DS.mjs";
|
|
8
10
|
export {
|
|
@@ -13,6 +13,9 @@ interface SelectProps {
|
|
|
13
13
|
valueSelected?: string | number | null;
|
|
14
14
|
value?: string | number | null;
|
|
15
15
|
onChange?: (value: string | number | null) => void;
|
|
16
|
+
onSearch?: (searchTerm: string) => void;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
disabledTooltip?: string;
|
|
16
19
|
className?: string;
|
|
17
20
|
dropdownClassName?: string;
|
|
18
21
|
optionClassName?: string;
|
|
@@ -24,13 +27,13 @@ interface SelectProps {
|
|
|
24
27
|
id?: string;
|
|
25
28
|
name?: string;
|
|
26
29
|
tabIndex?: number;
|
|
27
|
-
size?:
|
|
28
|
-
variant?:
|
|
30
|
+
size?: "small" | "default" | "medium" | "large";
|
|
31
|
+
variant?: "default" | "filled" | "outlined";
|
|
29
32
|
wrapperClassName?: string;
|
|
30
33
|
inputClassName?: string;
|
|
31
34
|
labelClassName?: string;
|
|
32
35
|
height?: string;
|
|
33
|
-
experience?:
|
|
36
|
+
experience?: "business" | "personal";
|
|
34
37
|
disabled?: boolean;
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -13,6 +13,9 @@ interface SelectProps {
|
|
|
13
13
|
valueSelected?: string | number | null;
|
|
14
14
|
value?: string | number | null;
|
|
15
15
|
onChange?: (value: string | number | null) => void;
|
|
16
|
+
onSearch?: (searchTerm: string) => void;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
disabledTooltip?: string;
|
|
16
19
|
className?: string;
|
|
17
20
|
dropdownClassName?: string;
|
|
18
21
|
optionClassName?: string;
|
|
@@ -24,13 +27,13 @@ interface SelectProps {
|
|
|
24
27
|
id?: string;
|
|
25
28
|
name?: string;
|
|
26
29
|
tabIndex?: number;
|
|
27
|
-
size?:
|
|
28
|
-
variant?:
|
|
30
|
+
size?: "small" | "default" | "medium" | "large";
|
|
31
|
+
variant?: "default" | "filled" | "outlined";
|
|
29
32
|
wrapperClassName?: string;
|
|
30
33
|
inputClassName?: string;
|
|
31
34
|
labelClassName?: string;
|
|
32
35
|
height?: string;
|
|
33
|
-
experience?:
|
|
36
|
+
experience?: "business" | "personal";
|
|
34
37
|
disabled?: boolean;
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -63,7 +63,7 @@ __export(Select_exports, {
|
|
|
63
63
|
default: () => Select_default
|
|
64
64
|
});
|
|
65
65
|
module.exports = __toCommonJS(Select_exports);
|
|
66
|
-
var
|
|
66
|
+
var import_react2 = require("react");
|
|
67
67
|
var import_clsx = __toESM(require("clsx"));
|
|
68
68
|
|
|
69
69
|
// src/icons/Chevron.tsx
|
|
@@ -108,16 +108,13 @@ var CrossV2 = React2.memo(
|
|
|
108
108
|
width: size,
|
|
109
109
|
height: size,
|
|
110
110
|
fill: "none",
|
|
111
|
-
viewBox: "0 0
|
|
112
|
-
className
|
|
111
|
+
viewBox: "0 0 20 20"
|
|
113
112
|
}, rest), {
|
|
114
113
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
115
114
|
"path",
|
|
116
115
|
{
|
|
117
116
|
fill: color,
|
|
118
|
-
|
|
119
|
-
d: "M4.293 4.293a1 1 0 011.414 0L8 6.586l2.293-2.293a1 1 0 111.414 1.414L9.414 8l2.293 2.293a1 1 0 01-1.414 1.414L8 9.414l-2.293 2.293a1 1 0 01-1.414-1.414L6.586 8 4.293 5.707a1 1 0 010-1.414z",
|
|
120
|
-
clipRule: "evenodd"
|
|
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"
|
|
121
118
|
}
|
|
122
119
|
)
|
|
123
120
|
})
|
|
@@ -126,8 +123,106 @@ var CrossV2 = React2.memo(
|
|
|
126
123
|
);
|
|
127
124
|
CrossV2.displayName = "CrossV2";
|
|
128
125
|
|
|
129
|
-
// src/
|
|
126
|
+
// src/icons/Lock.tsx
|
|
127
|
+
var import_react = __toESM(require("react"));
|
|
130
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");
|
|
131
226
|
var Select = ({
|
|
132
227
|
label,
|
|
133
228
|
mandatory = false,
|
|
@@ -138,6 +233,10 @@ var Select = ({
|
|
|
138
233
|
value: _valueProp,
|
|
139
234
|
// Rename to avoid potential conflicts with native value attribute
|
|
140
235
|
onChange,
|
|
236
|
+
onSearch,
|
|
237
|
+
isLoading = false,
|
|
238
|
+
disabled = false,
|
|
239
|
+
disabledTooltip = "",
|
|
141
240
|
className = "",
|
|
142
241
|
dropdownClassName = "",
|
|
143
242
|
optionClassName = "",
|
|
@@ -146,7 +245,6 @@ var Select = ({
|
|
|
146
245
|
// New prop to show displayValue instead of label
|
|
147
246
|
allowClear = true,
|
|
148
247
|
enableSearch = true,
|
|
149
|
-
// New prop to control search functionality, default true
|
|
150
248
|
doubleCharSearch = false,
|
|
151
249
|
id,
|
|
152
250
|
name,
|
|
@@ -166,45 +264,45 @@ var Select = ({
|
|
|
166
264
|
// Custom height
|
|
167
265
|
experience = "business"
|
|
168
266
|
}) => {
|
|
169
|
-
const normalizeValue = (0,
|
|
267
|
+
const normalizeValue = (0, import_react2.useCallback)(
|
|
170
268
|
(val) => {
|
|
171
269
|
if (val === null || val === void 0) return "";
|
|
172
270
|
return String(val);
|
|
173
271
|
},
|
|
174
272
|
[]
|
|
175
273
|
);
|
|
176
|
-
const validatedOptions = (0,
|
|
274
|
+
const validatedOptions = (0, import_react2.useMemo)(() => {
|
|
177
275
|
if (!Array.isArray(options)) return [];
|
|
178
276
|
return options.filter(
|
|
179
277
|
(opt) => opt && typeof opt === "object" && opt.value !== void 0 && opt.value !== null && opt.label !== void 0
|
|
180
278
|
);
|
|
181
279
|
}, [options]);
|
|
182
|
-
const [isOpen, setIsOpen] = (0,
|
|
183
|
-
const [isFocused, setIsFocused] = (0,
|
|
184
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
185
|
-
const [isHovering, setIsHovering] = (0,
|
|
186
|
-
const [highlightedIndex, setHighlightedIndex] = (0,
|
|
187
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
280
|
+
const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
|
|
281
|
+
const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
|
|
282
|
+
const [searchTerm, setSearchTerm] = (0, import_react2.useState)("");
|
|
283
|
+
const [isHovering, setIsHovering] = (0, import_react2.useState)(false);
|
|
284
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react2.useState)(-1);
|
|
285
|
+
const [selectedValue, setSelectedValue] = (0, import_react2.useState)(() => {
|
|
188
286
|
const initialValue = valueSelected;
|
|
189
287
|
if (initialValue === null || initialValue === void 0) return "";
|
|
190
288
|
return String(initialValue);
|
|
191
289
|
});
|
|
192
|
-
const inputRef = (0,
|
|
193
|
-
const inputValueRef = (0,
|
|
194
|
-
const dropdownRef = (0,
|
|
195
|
-
const optionRefs = (0,
|
|
196
|
-
const optionListRef = (0,
|
|
197
|
-
const blurTimeoutRef = (0,
|
|
198
|
-
const hoverTimeoutRef = (0,
|
|
290
|
+
const inputRef = (0, import_react2.useRef)(null);
|
|
291
|
+
const inputValueRef = (0, import_react2.useRef)("");
|
|
292
|
+
const dropdownRef = (0, import_react2.useRef)(null);
|
|
293
|
+
const optionRefs = (0, import_react2.useRef)([]);
|
|
294
|
+
const optionListRef = (0, import_react2.useRef)(null);
|
|
295
|
+
const blurTimeoutRef = (0, import_react2.useRef)(null);
|
|
296
|
+
const hoverTimeoutRef = (0, import_react2.useRef)(null);
|
|
199
297
|
const isActive = isFocused || Boolean(selectedValue) || Boolean(valueSelected) || Boolean(searchTerm);
|
|
200
|
-
const sizeClasses = (0,
|
|
298
|
+
const sizeClasses = (0, import_react2.useMemo)(() => {
|
|
201
299
|
switch (size) {
|
|
202
300
|
case "small":
|
|
203
301
|
return {
|
|
204
|
-
input: "tw-h-
|
|
205
|
-
padding:
|
|
206
|
-
labelActive: "tw-top-0 tw-typography-
|
|
207
|
-
labelInactive: "tw-top-
|
|
302
|
+
input: "tw-h-6 tw-px-3 tw-typography-caption1Bold !tw-rounded-lg",
|
|
303
|
+
padding: "tw-px-2 tw-py-1",
|
|
304
|
+
labelActive: "tw-top-0.5 tw-typography-caption2",
|
|
305
|
+
labelInactive: "tw-top-1.5 tw-typography-caption3"
|
|
208
306
|
};
|
|
209
307
|
case "medium":
|
|
210
308
|
return {
|
|
@@ -229,7 +327,7 @@ var Select = ({
|
|
|
229
327
|
};
|
|
230
328
|
}
|
|
231
329
|
}, [size, label, height]);
|
|
232
|
-
const variantClasses = (0,
|
|
330
|
+
const variantClasses = (0, import_react2.useMemo)(() => {
|
|
233
331
|
switch (variant) {
|
|
234
332
|
case "filled":
|
|
235
333
|
return "tw-bg-gray-50 tw-border-transparent";
|
|
@@ -239,7 +337,7 @@ var Select = ({
|
|
|
239
337
|
return " tw-border";
|
|
240
338
|
}
|
|
241
339
|
}, [variant]);
|
|
242
|
-
const handleBlur = (0,
|
|
340
|
+
const handleBlur = (0, import_react2.useCallback)(() => {
|
|
243
341
|
blurTimeoutRef.current = setTimeout(() => {
|
|
244
342
|
setIsOpen(false);
|
|
245
343
|
setSearchTerm("");
|
|
@@ -248,24 +346,28 @@ var Select = ({
|
|
|
248
346
|
setIsFocused(false);
|
|
249
347
|
}, 150);
|
|
250
348
|
}, []);
|
|
251
|
-
const handleSearchChange = (0,
|
|
349
|
+
const handleSearchChange = (0, import_react2.useCallback)(
|
|
252
350
|
(e) => {
|
|
253
351
|
var _a;
|
|
352
|
+
const searchValue = doubleCharSearch ? e.target.value.slice(0, 2) || "" : e.target.value;
|
|
254
353
|
if (doubleCharSearch) {
|
|
255
|
-
setSearchTerm(
|
|
354
|
+
setSearchTerm(searchValue);
|
|
256
355
|
} else {
|
|
257
|
-
setSearchTerm(
|
|
356
|
+
setSearchTerm(searchValue);
|
|
258
357
|
}
|
|
259
358
|
setIsOpen(true);
|
|
260
359
|
setHighlightedIndex(-1);
|
|
360
|
+
if (onSearch && typeof onSearch === "function") {
|
|
361
|
+
onSearch(searchValue);
|
|
362
|
+
}
|
|
261
363
|
(_a = optionListRef == null ? void 0 : optionListRef.current) == null ? void 0 : _a.scrollTo({
|
|
262
364
|
top: 0,
|
|
263
365
|
behavior: "smooth"
|
|
264
366
|
});
|
|
265
367
|
},
|
|
266
|
-
[doubleCharSearch]
|
|
368
|
+
[doubleCharSearch, onSearch]
|
|
267
369
|
);
|
|
268
|
-
const handleOptionSelect = (0,
|
|
370
|
+
const handleOptionSelect = (0, import_react2.useCallback)(
|
|
269
371
|
(option) => {
|
|
270
372
|
var _a;
|
|
271
373
|
if (blurTimeoutRef.current) {
|
|
@@ -286,7 +388,7 @@ var Select = ({
|
|
|
286
388
|
},
|
|
287
389
|
[normalizeValue, onChange, enableSearch]
|
|
288
390
|
);
|
|
289
|
-
const handleClear = (0,
|
|
391
|
+
const handleClear = (0, import_react2.useCallback)(
|
|
290
392
|
(e) => {
|
|
291
393
|
var _a;
|
|
292
394
|
inputValueRef.current = "";
|
|
@@ -306,21 +408,22 @@ var Select = ({
|
|
|
306
408
|
},
|
|
307
409
|
[onChange, enableSearch]
|
|
308
410
|
);
|
|
309
|
-
(0,
|
|
411
|
+
(0, import_react2.useEffect)(() => {
|
|
310
412
|
if (!validatedOptions.length) {
|
|
311
413
|
setSelectedValue("");
|
|
312
414
|
setSearchTerm("");
|
|
313
415
|
inputValueRef.current = "";
|
|
314
416
|
}
|
|
315
417
|
}, [validatedOptions.length]);
|
|
316
|
-
(0,
|
|
317
|
-
const
|
|
418
|
+
(0, import_react2.useEffect)(() => {
|
|
419
|
+
const externalValue = _valueProp !== void 0 ? _valueProp : valueSelected;
|
|
420
|
+
const newValue = normalizeValue(externalValue);
|
|
318
421
|
setSelectedValue((prevValue) => {
|
|
319
422
|
const prevNormalized = normalizeValue(prevValue);
|
|
320
423
|
return prevNormalized !== newValue ? newValue : prevValue;
|
|
321
424
|
});
|
|
322
|
-
}, [valueSelected, normalizeValue]);
|
|
323
|
-
(0,
|
|
425
|
+
}, [valueSelected, _valueProp, normalizeValue]);
|
|
426
|
+
(0, import_react2.useEffect)(() => {
|
|
324
427
|
const handleClickOutside = (event) => {
|
|
325
428
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
326
429
|
if (blurTimeoutRef.current) {
|
|
@@ -344,7 +447,7 @@ var Select = ({
|
|
|
344
447
|
}
|
|
345
448
|
};
|
|
346
449
|
}, []);
|
|
347
|
-
const getDisplayValue = (0,
|
|
450
|
+
const getDisplayValue = (0, import_react2.useCallback)(() => {
|
|
348
451
|
if (selectedValue && (validatedOptions == null ? void 0 : validatedOptions.length) > 0) {
|
|
349
452
|
const selected = validatedOptions.find(
|
|
350
453
|
(opt) => normalizeValue(opt.value) === normalizeValue(selectedValue)
|
|
@@ -358,7 +461,7 @@ var Select = ({
|
|
|
358
461
|
}
|
|
359
462
|
return "";
|
|
360
463
|
}, [selectedValue, validatedOptions, showDisplayValue, normalizeValue]);
|
|
361
|
-
const filteredOptions = (0,
|
|
464
|
+
const filteredOptions = (0, import_react2.useMemo)(() => {
|
|
362
465
|
var _a;
|
|
363
466
|
if (!enableSearch) {
|
|
364
467
|
return validatedOptions;
|
|
@@ -370,7 +473,7 @@ var Select = ({
|
|
|
370
473
|
});
|
|
371
474
|
return updatedFilteredOptions;
|
|
372
475
|
}, [validatedOptions, searchTerm, enableSearch]);
|
|
373
|
-
const getSelectedOptionIndex = (0,
|
|
476
|
+
const getSelectedOptionIndex = (0, import_react2.useCallback)(() => {
|
|
374
477
|
if (!selectedValue || !filteredOptions.length) {
|
|
375
478
|
return 0;
|
|
376
479
|
}
|
|
@@ -379,7 +482,7 @@ var Select = ({
|
|
|
379
482
|
);
|
|
380
483
|
return index >= 0 ? index : 0;
|
|
381
484
|
}, [selectedValue, filteredOptions, normalizeValue]);
|
|
382
|
-
const handleInputInteraction = (0,
|
|
485
|
+
const handleInputInteraction = (0, import_react2.useCallback)(
|
|
383
486
|
(_e) => {
|
|
384
487
|
var _a;
|
|
385
488
|
if (blurTimeoutRef.current) {
|
|
@@ -403,7 +506,7 @@ var Select = ({
|
|
|
403
506
|
},
|
|
404
507
|
[isOpen, getSelectedOptionIndex]
|
|
405
508
|
);
|
|
406
|
-
const handleKeyDown = (0,
|
|
509
|
+
const handleKeyDown = (0, import_react2.useCallback)(
|
|
407
510
|
(e) => {
|
|
408
511
|
var _a;
|
|
409
512
|
if (!isOpen) return;
|
|
@@ -442,7 +545,7 @@ var Select = ({
|
|
|
442
545
|
},
|
|
443
546
|
[isOpen, highlightedIndex, filteredOptions, handleOptionSelect]
|
|
444
547
|
);
|
|
445
|
-
(0,
|
|
548
|
+
(0, import_react2.useEffect)(() => {
|
|
446
549
|
if (highlightedIndex >= 0 && optionRefs.current[highlightedIndex]) {
|
|
447
550
|
optionRefs.current[highlightedIndex].scrollIntoView({
|
|
448
551
|
block: "nearest",
|
|
@@ -450,10 +553,10 @@ var Select = ({
|
|
|
450
553
|
});
|
|
451
554
|
}
|
|
452
555
|
}, [highlightedIndex]);
|
|
453
|
-
(0,
|
|
556
|
+
(0, import_react2.useEffect)(() => {
|
|
454
557
|
optionRefs.current = [];
|
|
455
558
|
}, [filteredOptions]);
|
|
456
|
-
const handleMouseEnter = (0,
|
|
559
|
+
const handleMouseEnter = (0, import_react2.useCallback)(() => {
|
|
457
560
|
if (hoverTimeoutRef.current) {
|
|
458
561
|
clearTimeout(hoverTimeoutRef.current);
|
|
459
562
|
}
|
|
@@ -461,12 +564,12 @@ var Select = ({
|
|
|
461
564
|
setIsHovering(true);
|
|
462
565
|
}
|
|
463
566
|
}, [isHovering]);
|
|
464
|
-
const handleMouseLeave = (0,
|
|
567
|
+
const handleMouseLeave = (0, import_react2.useCallback)(() => {
|
|
465
568
|
hoverTimeoutRef.current = setTimeout(() => {
|
|
466
569
|
setIsHovering(false);
|
|
467
570
|
}, 50);
|
|
468
571
|
}, []);
|
|
469
|
-
const handleChevronClick = (0,
|
|
572
|
+
const handleChevronClick = (0, import_react2.useCallback)(
|
|
470
573
|
(e) => {
|
|
471
574
|
var _a;
|
|
472
575
|
e.preventDefault();
|
|
@@ -489,17 +592,24 @@ var Select = ({
|
|
|
489
592
|
},
|
|
490
593
|
[isOpen, handleInputInteraction]
|
|
491
594
|
);
|
|
492
|
-
|
|
595
|
+
const InputWrapper = ({ children }) => {
|
|
596
|
+
if (disabled && disabledTooltip)
|
|
597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Tooltip_default, { title: disabledTooltip, children });
|
|
598
|
+
return children;
|
|
599
|
+
};
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InputWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
493
601
|
"div",
|
|
494
602
|
{
|
|
495
603
|
style,
|
|
496
|
-
className: (0, import_clsx.default)("tw-relative tw-w-full", wrapperClassName
|
|
604
|
+
className: (0, import_clsx.default)("tw-relative tw-w-full", wrapperClassName, {
|
|
605
|
+
"tw-cursor-not-allowed": disabled
|
|
606
|
+
}),
|
|
497
607
|
ref: dropdownRef,
|
|
498
608
|
onMouseEnter: handleMouseEnter,
|
|
499
609
|
onMouseLeave: handleMouseLeave,
|
|
500
610
|
children: [
|
|
501
|
-
/* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "tw-relative", children: [
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
503
613
|
"input",
|
|
504
614
|
{
|
|
505
615
|
ref: inputRef,
|
|
@@ -522,7 +632,8 @@ var Select = ({
|
|
|
522
632
|
variantClasses,
|
|
523
633
|
{
|
|
524
634
|
"tw-bg-white": valueSelected || getDisplayValue() || isFocused,
|
|
525
|
-
"tw-bg-color-gray-5": !valueSelected || !getDisplayValue()
|
|
635
|
+
"tw-bg-color-gray-5": !valueSelected || !getDisplayValue(),
|
|
636
|
+
"!tw-bg-[#F8F7F6] tw-cursor-not-allowed tw-pointer-events-none": disabled
|
|
526
637
|
},
|
|
527
638
|
// Conditional padding based on label presence
|
|
528
639
|
!label && "tw-flex tw-items-center",
|
|
@@ -542,7 +653,7 @@ var Select = ({
|
|
|
542
653
|
readOnly: !isFocused || !enableSearch
|
|
543
654
|
}
|
|
544
655
|
),
|
|
545
|
-
label && /* @__PURE__ */ (0,
|
|
656
|
+
label && size !== "small" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
546
657
|
"label",
|
|
547
658
|
{
|
|
548
659
|
htmlFor: id,
|
|
@@ -554,47 +665,59 @@ var Select = ({
|
|
|
554
665
|
),
|
|
555
666
|
children: [
|
|
556
667
|
label,
|
|
557
|
-
mandatory && /* @__PURE__ */ (0,
|
|
668
|
+
mandatory && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "tw-text-color-text-critical tw-ml-1", children: "*" })
|
|
558
669
|
]
|
|
559
670
|
}
|
|
560
671
|
),
|
|
561
|
-
/* @__PURE__ */ (0,
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
562
673
|
"div",
|
|
563
674
|
{
|
|
564
675
|
className: (0, import_clsx.default)(
|
|
565
|
-
"tw-absolute tw-right-3 tw
|
|
676
|
+
"tw-absolute tw-right-3 tw--translate-y-1/2 tw-flex tw-items-center",
|
|
566
677
|
{
|
|
567
|
-
"!tw-right-[5px]": doubleCharSearch && !(isHovering && selectedValue && allowClear)
|
|
678
|
+
"!tw-right-[5px]": doubleCharSearch && !(isHovering && selectedValue && allowClear),
|
|
679
|
+
"tw-top-3.5 !tw-right-2": size === "small",
|
|
680
|
+
"tw-top-1/2": size !== "small"
|
|
568
681
|
}
|
|
569
682
|
),
|
|
570
|
-
children:
|
|
571
|
-
"div",
|
|
572
|
-
{
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
683
|
+
children: [
|
|
684
|
+
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 }) }),
|
|
685
|
+
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)(
|
|
686
|
+
"div",
|
|
687
|
+
{
|
|
688
|
+
className: (0, import_clsx.default)(
|
|
689
|
+
"tw-transition-all tw-duration-200 tw-cursor-pointer tw-flex tw-items-center",
|
|
690
|
+
// Only rotate chevron when open and not showing clear icon
|
|
691
|
+
isOpen && !(isHovering && selectedValue && allowClear) && "-tw-rotate-180"
|
|
692
|
+
),
|
|
693
|
+
onMouseDown: (e) => {
|
|
694
|
+
if (isHovering && selectedValue && allowClear) {
|
|
695
|
+
handleClear(e);
|
|
696
|
+
} else {
|
|
697
|
+
handleChevronClick(e);
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
children: disabled ? null : isHovering && selectedValue && allowClear ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
701
|
+
CrossV2,
|
|
702
|
+
{
|
|
703
|
+
color: "#111827",
|
|
704
|
+
className: (0, import_clsx.default)({ "tw-mr-1": size !== "small" }),
|
|
705
|
+
size: size === "small" ? 12 : 16
|
|
706
|
+
}
|
|
707
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
708
|
+
Chevron,
|
|
709
|
+
{
|
|
710
|
+
className: (0, import_clsx.default)("tw-text-gray-400"),
|
|
711
|
+
color: "#6B7280"
|
|
712
|
+
}
|
|
713
|
+
)
|
|
714
|
+
}
|
|
715
|
+
)
|
|
716
|
+
]
|
|
594
717
|
}
|
|
595
718
|
)
|
|
596
719
|
] }),
|
|
597
|
-
isOpen && /* @__PURE__ */ (0,
|
|
720
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
598
721
|
"div",
|
|
599
722
|
{
|
|
600
723
|
className: (0, import_clsx.default)(
|
|
@@ -604,7 +727,7 @@ var Select = ({
|
|
|
604
727
|
dropdownClassName
|
|
605
728
|
),
|
|
606
729
|
ref: optionListRef,
|
|
607
|
-
children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => /* @__PURE__ */ (0,
|
|
730
|
+
children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
608
731
|
"div",
|
|
609
732
|
{
|
|
610
733
|
ref: (el) => optionRefs.current[index] = el,
|
|
@@ -615,7 +738,7 @@ var Select = ({
|
|
|
615
738
|
// Selected option styling
|
|
616
739
|
optionClassName
|
|
617
740
|
),
|
|
618
|
-
children: /* @__PURE__ */ (0,
|
|
741
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
619
742
|
"div",
|
|
620
743
|
{
|
|
621
744
|
className: (0, import_clsx.default)(
|
|
@@ -633,12 +756,12 @@ var Select = ({
|
|
|
633
756
|
)
|
|
634
757
|
},
|
|
635
758
|
doubleCharSearch ? option.label : option.value
|
|
636
|
-
)) : /* @__PURE__ */ (0,
|
|
759
|
+
)) : /* @__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" })
|
|
637
760
|
}
|
|
638
761
|
)
|
|
639
762
|
]
|
|
640
763
|
}
|
|
641
|
-
);
|
|
764
|
+
) });
|
|
642
765
|
};
|
|
643
766
|
var arePropsEqual = (prevProps, nextProps) => {
|
|
644
767
|
var _a, _b;
|
|
@@ -671,7 +794,7 @@ var arePropsEqual = (prevProps, nextProps) => {
|
|
|
671
794
|
return true;
|
|
672
795
|
};
|
|
673
796
|
Select.displayName = "Select";
|
|
674
|
-
var Select_default = (0,
|
|
797
|
+
var Select_default = (0, import_react2.memo)(Select, arePropsEqual);
|
|
675
798
|
// Annotate the CommonJS export names for ESM import in node:
|
|
676
799
|
0 && (module.exports = {
|
|
677
800
|
Select
|