@x-plat/design-system 0.19.0 → 0.21.0
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/chunk-2EGVOUGV.cjs +93 -0
- package/dist/chunk-2T3BVV7R.js +0 -0
- package/dist/chunk-3FYYFDKQ.js +159 -0
- package/dist/chunk-3M3GFSHJ.js +67 -0
- package/dist/chunk-3WBHUFOA.cjs +48 -0
- package/dist/chunk-3XYYZQR5.cjs +22 -0
- package/dist/chunk-4EF7NVAL.js +67 -0
- package/dist/chunk-4ISERXK2.cjs +1 -0
- package/dist/chunk-4KYHHJ6Z.cjs +250 -0
- package/dist/chunk-4NSRDRXC.cjs +70 -0
- package/dist/chunk-4OXMRSVE.cjs +99 -0
- package/dist/chunk-55EPYLXN.js +30 -0
- package/dist/chunk-5CE3ADO5.js +254 -0
- package/dist/chunk-5F6Y2JD6.cjs +1 -0
- package/dist/chunk-5FMTMXSP.cjs +127 -0
- package/dist/chunk-5POCKDDY.js +36 -0
- package/dist/chunk-5VDI56BV.js +33 -0
- package/dist/chunk-5WLBUPSK.js +77 -0
- package/dist/chunk-5WNNWQHD.cjs +272 -0
- package/dist/chunk-66STZB6I.cjs +404 -0
- package/dist/chunk-6AIKCZN7.js +1455 -0
- package/dist/chunk-6IUJJUVP.js +18 -0
- package/dist/chunk-6P2B3ZGP.js +79 -0
- package/dist/chunk-764ILIDG.cjs +22 -0
- package/dist/chunk-7B44DWC4.js +0 -0
- package/dist/chunk-7BE6ETFY.js +18 -0
- package/dist/chunk-7BSUS5A4.js +97 -0
- package/dist/chunk-7RPWCDEW.cjs +20 -0
- package/dist/chunk-7ULXHGLO.cjs +77 -0
- package/dist/chunk-7YOI5XOW.js +55 -0
- package/dist/chunk-AFVTM5CP.js +0 -0
- package/dist/chunk-AN2WSL3B.cjs +1 -0
- package/dist/chunk-AT5Y5GLS.cjs +118 -0
- package/dist/chunk-AWPO2FI7.js +404 -0
- package/dist/chunk-BGXHIDUR.js +103 -0
- package/dist/chunk-BPZXL5TP.js +99 -0
- package/dist/chunk-BRTS5GWV.js +275 -0
- package/dist/chunk-BS3MLZCK.cjs +97 -0
- package/dist/chunk-BSPYYE2U.js +36 -0
- package/dist/chunk-BWJAEB42.js +48 -0
- package/dist/chunk-C4RMTISI.cjs +18 -0
- package/dist/chunk-C6M4XVR7.cjs +36 -0
- package/dist/chunk-CGC4D5MP.cjs +89 -0
- package/dist/chunk-CIRQYSQW.js +70 -0
- package/dist/chunk-CLOTWJNP.cjs +310 -0
- package/dist/chunk-CS7ZY35M.cjs +49 -0
- package/dist/chunk-CUV4RLDE.js +89 -0
- package/dist/chunk-CZAMLFSE.cjs +275 -0
- package/dist/chunk-D7QZLJ3Z.cjs +18 -0
- package/dist/chunk-DMSAAZ3M.cjs +92 -0
- package/dist/chunk-DUIZC7VJ.cjs +36 -0
- package/dist/chunk-DVBF4BDH.js +43 -0
- package/dist/chunk-EETYMP6K.cjs +584 -0
- package/dist/chunk-EFQL7JPX.js +0 -0
- package/dist/chunk-EFU7IAF5.cjs +12 -0
- package/dist/chunk-F3M2H5EX.cjs +79 -0
- package/dist/chunk-F436V2SX.cjs +254 -0
- package/dist/chunk-F664X2OY.js +250 -0
- package/dist/chunk-FF7ELUQW.cjs +1 -0
- package/dist/chunk-G3HE4S3Q.cjs +296 -0
- package/dist/chunk-GOPD5KUK.js +23 -0
- package/dist/chunk-GYTB24V6.cjs +107 -0
- package/dist/chunk-GZ657SGO.js +310 -0
- package/dist/chunk-H2QN65L6.cjs +1 -0
- package/dist/chunk-H6WUT7CK.js +22 -0
- package/dist/chunk-H76OQ75T.js +49 -0
- package/dist/chunk-HA3XONYI.js +18 -0
- package/dist/chunk-HF3UFXEU.js +296 -0
- package/dist/chunk-HGA47QVV.cjs +55 -0
- package/dist/chunk-HHPPAMXF.cjs +674 -0
- package/dist/chunk-HLV2XIE2.cjs +385 -0
- package/dist/chunk-HNQGIL45.cjs +96 -0
- package/dist/chunk-HQ37R7T3.js +53 -0
- package/dist/chunk-HXUGW4RR.js +187 -0
- package/dist/chunk-HYPRLWD3.js +272 -0
- package/dist/chunk-I7TLJUTP.cjs +6 -0
- package/dist/chunk-ICTWDTKC.cjs +1 -0
- package/dist/chunk-IPYKHDP4.cjs +187 -0
- package/dist/chunk-IRKREQ2X.cjs +18 -0
- package/dist/chunk-IVJJBMRY.js +92 -0
- package/dist/chunk-JPVIVOFG.js +26 -0
- package/dist/chunk-JYNBNSNF.js +151 -0
- package/dist/chunk-JZC3BXAC.js +93 -0
- package/dist/chunk-K5XPQWXN.cjs +92 -0
- package/dist/chunk-KQ3GOMHL.js +31 -0
- package/dist/chunk-KUJH72U6.cjs +159 -0
- package/dist/chunk-KVUXLC6M.cjs +479 -0
- package/dist/chunk-KZOJN57Q.js +19 -0
- package/dist/chunk-L3XPL4NP.cjs +53 -0
- package/dist/chunk-LOEMSXYB.js +0 -0
- package/dist/chunk-LU4KBPNG.cjs +23 -0
- package/dist/chunk-MWWWPQDB.js +26 -0
- package/dist/chunk-NCBB3WUJ.js +562 -0
- package/dist/chunk-NGCZTZST.cjs +562 -0
- package/dist/chunk-NSDKALIS.cjs +67 -0
- package/dist/chunk-NZHCRLNB.cjs +26 -0
- package/dist/chunk-OL4NANHB.js +0 -0
- package/dist/chunk-OTJRNKLR.js +96 -0
- package/dist/chunk-OWWFKTSK.js +0 -0
- package/dist/chunk-P2E3PB62.cjs +99 -0
- package/dist/chunk-P2QVFR7S.js +20 -0
- package/dist/chunk-P6ZGIYY7.cjs +18 -0
- package/dist/chunk-PFGSJJRY.cjs +19 -0
- package/dist/chunk-PNIUW7AJ.cjs +32 -0
- package/dist/chunk-Q2M2ONGO.js +70 -0
- package/dist/chunk-Q4PGP5KE.cjs +562 -0
- package/dist/chunk-QAI2YQPY.cjs +51 -0
- package/dist/chunk-QCD7UEZ3.cjs +59 -0
- package/dist/chunk-QEZ4R3SK.js +6 -0
- package/dist/chunk-QKDCPM2D.cjs +23 -0
- package/dist/chunk-QRGG3V7W.cjs +59 -0
- package/dist/chunk-QURIHUEC.js +107 -0
- package/dist/chunk-QY742LWN.js +30 -0
- package/dist/chunk-QYMRGYTN.js +127 -0
- package/dist/chunk-RLKJ2RZG.js +23 -0
- package/dist/chunk-RRR5BUOM.cjs +30 -0
- package/dist/chunk-RU3FCVXM.cjs +1 -0
- package/dist/chunk-RYTDVTV2.js +32 -0
- package/dist/chunk-RYYGUYDE.js +92 -0
- package/dist/chunk-SGLP4U3Y.cjs +67 -0
- package/dist/chunk-SJC543ZK.js +71 -0
- package/dist/chunk-SLYQK4SC.js +20 -0
- package/dist/chunk-SMLCOMLS.js +2888 -0
- package/dist/chunk-SNMOPLMH.cjs +372 -0
- package/dist/chunk-TRJUJYW7.cjs +151 -0
- package/dist/chunk-TTY5PE3P.js +30 -0
- package/dist/chunk-TXARYG3J.js +22 -0
- package/dist/chunk-TYXJU4EF.js +18 -0
- package/dist/chunk-U3PC7FYZ.cjs +26 -0
- package/dist/chunk-U67JM2WL.cjs +34 -0
- package/dist/chunk-UARGO5UG.js +59 -0
- package/dist/chunk-UCYE3H3F.cjs +43 -0
- package/dist/chunk-UGEGN35F.js +118 -0
- package/dist/chunk-UHUA3GQC.cjs +30 -0
- package/dist/chunk-UJQN477L.js +59 -0
- package/dist/chunk-UMX7DTFZ.cjs +70 -0
- package/dist/chunk-UT42P54P.js +372 -0
- package/dist/chunk-V76ZRGHQ.cjs +1 -0
- package/dist/chunk-VCIK366Y.cjs +1455 -0
- package/dist/chunk-VMA74ABT.cjs +137 -0
- package/dist/chunk-VSA62N2O.js +12 -0
- package/dist/chunk-WDAFLVQK.js +479 -0
- package/dist/chunk-WHMLMAMO.js +674 -0
- package/dist/chunk-WNBLKKLM.js +0 -0
- package/dist/chunk-WQ2GY7F3.js +46 -0
- package/dist/chunk-WRLCCK3M.cjs +30 -0
- package/dist/chunk-WVCZIOLY.js +562 -0
- package/dist/chunk-WZLGJQLW.js +385 -0
- package/dist/chunk-XB6FEBK6.js +34 -0
- package/dist/chunk-XMERDSRE.js +75 -0
- package/dist/chunk-XMLFKZYY.js +137 -0
- package/dist/chunk-XMM52J3T.js +584 -0
- package/dist/chunk-XZ7C5CGB.cjs +103 -0
- package/dist/chunk-YGFBAOKX.js +51 -0
- package/dist/chunk-YIN552MF.cjs +20 -0
- package/dist/chunk-YLC42E65.cjs +31 -0
- package/dist/chunk-YOTXRYJL.cjs +46 -0
- package/dist/chunk-ZAUGJZK7.js +99 -0
- package/dist/chunk-ZIZOQTDG.cjs +75 -0
- package/dist/chunk-ZMSV5VZI.cjs +2888 -0
- package/dist/chunk-ZN6MLZAE.cjs +71 -0
- package/dist/chunk-ZNCT6HXA.cjs +33 -0
- package/dist/components/Accordion/index.cjs +5 -1036
- package/dist/components/Accordion/index.js +5 -999
- package/dist/components/Alert/index.cjs +4 -69
- package/dist/components/Alert/index.js +4 -42
- package/dist/components/AutoResizeTextArea/index.cjs +6 -260
- package/dist/components/AutoResizeTextArea/index.js +6 -223
- package/dist/components/Avatar/index.cjs +4 -65
- package/dist/components/Avatar/index.js +4 -38
- package/dist/components/Badge/index.cjs +6 -69
- package/dist/components/Badge/index.js +5 -40
- package/dist/components/Box/index.cjs +4 -58
- package/dist/components/Box/index.js +4 -31
- package/dist/components/Breadcrumb/index.cjs +4 -42
- package/dist/components/Breadcrumb/index.js +3 -14
- package/dist/components/Button/index.cjs +5 -65
- package/dist/components/Button/index.js +5 -38
- package/dist/components/Calendar/index.cjs +6 -1317
- package/dist/components/Calendar/index.js +10 -1281
- package/dist/components/CardTab/index.cjs +4 -120
- package/dist/components/CardTab/index.js +4 -83
- package/dist/components/Chart/index.cjs +5 -708
- package/dist/components/Chart/index.js +4 -670
- package/dist/components/ChatInput/index.cjs +9 -390
- package/dist/components/ChatInput/index.js +9 -353
- package/dist/components/CheckBox/index.cjs +20 -1125
- package/dist/components/CheckBox/index.js +17 -1095
- package/dist/components/Chip/index.cjs +5 -55
- package/dist/components/Chip/index.js +5 -28
- package/dist/components/DatePicker/index.cjs +16 -2136
- package/dist/components/DatePicker/index.js +19 -2099
- package/dist/components/Divider/index.cjs +4 -58
- package/dist/components/Divider/index.js +4 -31
- package/dist/components/Drawer/index.cjs +5 -190
- package/dist/components/Drawer/index.js +5 -153
- package/dist/components/Dropdown/index.cjs +7 -375
- package/dist/components/Dropdown/index.js +7 -338
- package/dist/components/Editor/index.cjs +6 -1486
- package/dist/components/Editor/index.css +53 -0
- package/dist/components/Editor/index.d.cts +13 -0
- package/dist/components/Editor/index.d.ts +13 -0
- package/dist/components/Editor/index.js +6 -1453
- package/dist/components/EmptyState/index.cjs +4 -42
- package/dist/components/EmptyState/index.js +3 -14
- package/dist/components/FieldMessage/index.cjs +7 -182
- package/dist/components/FieldMessage/index.js +8 -154
- package/dist/components/FileUpload/index.cjs +7 -1171
- package/dist/components/FileUpload/index.js +7 -1134
- package/dist/components/HtmlTypeWriter/index.cjs +3 -171
- package/dist/components/HtmlTypeWriter/index.js +3 -133
- package/dist/components/IconButton/index.cjs +4 -65
- package/dist/components/IconButton/index.js +4 -38
- package/dist/components/ImageSelector/index.cjs +8 -1214
- package/dist/components/ImageSelector/index.js +8 -1177
- package/dist/components/Input/index.cjs +7 -429
- package/dist/components/Input/index.js +8 -392
- package/dist/components/Link/index.cjs +4 -61
- package/dist/components/Link/index.js +4 -34
- package/dist/components/LinkButton/index.cjs +5 -61
- package/dist/components/LinkButton/index.js +5 -34
- package/dist/components/Modal/index.cjs +5 -190
- package/dist/components/Modal/index.js +5 -153
- package/dist/components/NotificationBadge/index.cjs +5 -68
- package/dist/components/NotificationBadge/index.js +5 -40
- package/dist/components/Pagination/index.cjs +6 -1034
- package/dist/components/Pagination/index.js +6 -1007
- package/dist/components/PopOver/index.cjs +7 -363
- package/dist/components/PopOver/index.js +7 -326
- package/dist/components/Progress/index.cjs +5 -84
- package/dist/components/Progress/index.js +5 -57
- package/dist/components/Radio/index.cjs +7 -274
- package/dist/components/Radio/index.js +8 -237
- package/dist/components/Select/index.cjs +10 -1577
- package/dist/components/Select/index.js +11 -1540
- package/dist/components/Skeleton/index.cjs +4 -71
- package/dist/components/Skeleton/index.js +4 -44
- package/dist/components/Spinner/index.cjs +5 -88
- package/dist/components/Spinner/index.js +5 -61
- package/dist/components/Stat/index.cjs +5 -81
- package/dist/components/Stat/index.js +5 -54
- package/dist/components/Steps/index.cjs +7 -968
- package/dist/components/Steps/index.js +7 -941
- package/dist/components/Swiper/index.cjs +4 -357
- package/dist/components/Swiper/index.js +4 -320
- package/dist/components/Switch/index.cjs +7 -252
- package/dist/components/Switch/index.js +7 -215
- package/dist/components/Tab/index.cjs +4 -144
- package/dist/components/Tab/index.js +4 -107
- package/dist/components/Table/index.cjs +4 -310
- package/dist/components/Table/index.css +31 -5
- package/dist/components/Table/index.js +8 -273
- package/dist/components/Tag/index.cjs +6 -969
- package/dist/components/Tag/index.js +6 -942
- package/dist/components/TextArea/index.cjs +6 -229
- package/dist/components/TextArea/index.js +6 -192
- package/dist/components/TimePicker/index.cjs +9 -579
- package/dist/components/TimePicker/index.js +9 -542
- package/dist/components/Toast/index.cjs +5 -146
- package/dist/components/Toast/index.js +5 -108
- package/dist/components/ToggleChip/index.cjs +5 -66
- package/dist/components/ToggleChip/index.js +5 -39
- package/dist/components/Tooltip/index.cjs +6 -204
- package/dist/components/Tooltip/index.js +6 -167
- package/dist/components/Tour/index.cjs +6 -414
- package/dist/components/Tour/index.js +6 -377
- package/dist/components/Video/index.cjs +7 -796
- package/dist/components/Video/index.js +7 -759
- package/dist/components/index.cjs +140 -8315
- package/dist/components/index.css +31 -5
- package/dist/components/index.js +190 -8261
- package/dist/index.cjs +903 -13291
- package/dist/index.css +31 -5
- package/dist/index.js +524 -12499
- package/dist/layout/Grid/FullGrid/index.cjs +4 -46
- package/dist/layout/Grid/FullGrid/index.js +3 -18
- package/dist/layout/Grid/FullScreen/index.cjs +4 -46
- package/dist/layout/Grid/FullScreen/index.js +3 -18
- package/dist/layout/Grid/Item/index.cjs +5 -68
- package/dist/layout/Grid/Item/index.js +5 -41
- package/dist/layout/Grid/index.cjs +14 -109
- package/dist/layout/Grid/index.js +14 -79
- package/dist/layout/Header/index.cjs +4 -44
- package/dist/layout/Header/index.js +3 -16
- package/dist/layout/Layout/index.cjs +4 -42
- package/dist/layout/Layout/index.js +3 -14
- package/dist/layout/SideBar/index.cjs +6 -96
- package/dist/layout/SideBar/index.js +6 -57
- package/dist/layout/index.cjs +38 -209
- package/dist/layout/index.js +27 -153
- package/dist/tokens/index.cjs +627 -6119
- package/dist/tokens/index.js +324 -5489
- package/guidelines/components/editor.md +3 -0
- package/guidelines/components/table.md +23 -0
- package/guidelines/setup.md +7 -0
- package/package.json +6 -3
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloseEyeIcon_default,
|
|
3
|
+
OpenEyeIcon_default
|
|
4
|
+
} from "./chunk-CIRQYSQW.js";
|
|
5
|
+
import {
|
|
6
|
+
Field,
|
|
7
|
+
FieldMessage_default,
|
|
8
|
+
hasError
|
|
9
|
+
} from "./chunk-7YOI5XOW.js";
|
|
10
|
+
import {
|
|
11
|
+
clsx_default
|
|
12
|
+
} from "./chunk-KZOJN57Q.js";
|
|
13
|
+
|
|
14
|
+
// src/components/Input/Input.tsx
|
|
15
|
+
import React from "react";
|
|
16
|
+
|
|
17
|
+
// src/components/Input/reg.ts
|
|
18
|
+
var numberAndCommaReg = /^[0-9,]+$/;
|
|
19
|
+
var phoneNumberMaxLengthReg = /^.{0,13}$/;
|
|
20
|
+
var creditCardNumberReg = /^(\d{4}-){3}\d{4}$/;
|
|
21
|
+
var anyReg = /^.*$/;
|
|
22
|
+
var inputTypeReg = {
|
|
23
|
+
number: numberAndCommaReg,
|
|
24
|
+
tel: phoneNumberMaxLengthReg,
|
|
25
|
+
creditCard: creditCardNumberReg,
|
|
26
|
+
email: anyReg,
|
|
27
|
+
password: anyReg,
|
|
28
|
+
text: anyReg
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/components/Input/utils/tel.ts
|
|
32
|
+
var handleTelBackspace = (prevValue, currValue) => {
|
|
33
|
+
if (!prevValue || !currValue) return currValue;
|
|
34
|
+
if (prevValue.length <= currValue.length) return currValue;
|
|
35
|
+
const prevArr = [...prevValue];
|
|
36
|
+
const currArr = [...currValue];
|
|
37
|
+
const diffIndex = prevArr.findIndex((char, idx) => char !== currArr[idx]);
|
|
38
|
+
if (diffIndex >= 0 && prevArr[diffIndex] === "-") {
|
|
39
|
+
const chars = prevValue.split("");
|
|
40
|
+
for (let i = diffIndex - 1; i >= 0; i--) {
|
|
41
|
+
if (/\d/.test(chars[i])) {
|
|
42
|
+
chars.splice(i, 1);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return chars.join("");
|
|
47
|
+
}
|
|
48
|
+
return currValue;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/components/Input/Input.tsx
|
|
52
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
53
|
+
var formatValue = (type, value) => {
|
|
54
|
+
if (value === null || value === void 0) return "";
|
|
55
|
+
const strValue = Array.isArray(value) ? String(value[0] ?? "") : String(value);
|
|
56
|
+
switch (type) {
|
|
57
|
+
case "number": {
|
|
58
|
+
if (!strValue) return "";
|
|
59
|
+
const n = typeof value === "number" ? value : Number(strValue.replace(/,/g, ""));
|
|
60
|
+
return isNaN(n) ? "" : n.toLocaleString("en-US");
|
|
61
|
+
}
|
|
62
|
+
case "tel": {
|
|
63
|
+
const digits = strValue.replace(/\D/g, "");
|
|
64
|
+
if (!digits) return "";
|
|
65
|
+
if (digits.startsWith("02")) {
|
|
66
|
+
if (digits.length <= 2) return digits;
|
|
67
|
+
if (digits.length <= 6) return digits.replace(/^(02)(\d+)/, "$1-$2");
|
|
68
|
+
return digits.replace(/^(02)(\d{3,4})(\d{0,4})$/, "$1-$2-$3");
|
|
69
|
+
}
|
|
70
|
+
if (/^01[016789]/.test(digits)) {
|
|
71
|
+
if (digits.length <= 3) return digits;
|
|
72
|
+
if (digits.length <= 6)
|
|
73
|
+
return digits.replace(/^(01[016789])(\d+)/, "$1-$2");
|
|
74
|
+
if (digits.length === 10) {
|
|
75
|
+
return digits.replace(/^(01[016789])(\d{3})(\d{0,4})$/, "$1-$2-$3");
|
|
76
|
+
}
|
|
77
|
+
return digits.replace(/^(01[016789])(\d{4})(\d{0,4})$/, "$1-$2-$3");
|
|
78
|
+
}
|
|
79
|
+
if (digits.length <= 3) return digits;
|
|
80
|
+
if (digits.length <= 6) return digits.replace(/^(\d{3})(\d+)/, "$1-$2");
|
|
81
|
+
return digits.replace(/^(\d{3})(\d{3,4})(\d{0,4})$/, "$1-$2-$3");
|
|
82
|
+
}
|
|
83
|
+
default:
|
|
84
|
+
return strValue;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var parseValue = (type, value) => {
|
|
88
|
+
switch (type) {
|
|
89
|
+
case "number": {
|
|
90
|
+
if (value === "") return "";
|
|
91
|
+
const n = Number(value.replace(/,/g, ""));
|
|
92
|
+
return isNaN(n) ? 0 : n;
|
|
93
|
+
}
|
|
94
|
+
case "tel":
|
|
95
|
+
return value.replace(/\D/g, "");
|
|
96
|
+
default:
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var Input = React.forwardRef((props, ref) => {
|
|
101
|
+
const {
|
|
102
|
+
value,
|
|
103
|
+
className,
|
|
104
|
+
onChange,
|
|
105
|
+
type = "text",
|
|
106
|
+
size = "md",
|
|
107
|
+
suffix,
|
|
108
|
+
disabled,
|
|
109
|
+
validations,
|
|
110
|
+
label,
|
|
111
|
+
required,
|
|
112
|
+
...inputProps
|
|
113
|
+
} = props;
|
|
114
|
+
const autoId = React.useId();
|
|
115
|
+
const fieldId = inputProps.id ?? autoId;
|
|
116
|
+
const localValue = formatValue(type, value);
|
|
117
|
+
const handleChange = (e) => {
|
|
118
|
+
let val = e.target.value;
|
|
119
|
+
if (val !== "" && !inputTypeReg[type].test(val)) return;
|
|
120
|
+
if (type === "tel" && localValue) {
|
|
121
|
+
val = handleTelBackspace(localValue, val);
|
|
122
|
+
}
|
|
123
|
+
if (onChange) {
|
|
124
|
+
const event = {
|
|
125
|
+
...e,
|
|
126
|
+
target: { value: parseValue(type, val) }
|
|
127
|
+
};
|
|
128
|
+
onChange(event);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return /* @__PURE__ */ jsx(Field, { label, required, htmlFor: fieldId, children: /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-input-wrap", className), children: [
|
|
132
|
+
/* @__PURE__ */ jsxs(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
className: clsx_default("lib-xplat-input", size, disabled ? "disabled" : void 0),
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsx(
|
|
138
|
+
"input",
|
|
139
|
+
{
|
|
140
|
+
...inputProps,
|
|
141
|
+
ref,
|
|
142
|
+
id: fieldId,
|
|
143
|
+
disabled,
|
|
144
|
+
type: type === "number" ? "text" : type,
|
|
145
|
+
value: localValue,
|
|
146
|
+
onChange: handleChange,
|
|
147
|
+
"aria-invalid": hasError(validations) || void 0
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
suffix && /* @__PURE__ */ jsx("div", { className: "suffix", children: suffix })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsx(FieldMessage_default, { validations })
|
|
155
|
+
] }) });
|
|
156
|
+
});
|
|
157
|
+
Input.displayName = "Input";
|
|
158
|
+
var Input_default = Input;
|
|
159
|
+
|
|
160
|
+
// src/components/Input/PasswordInput/PasswordInput.tsx
|
|
161
|
+
import React2 from "react";
|
|
162
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
163
|
+
var PasswordInput = React2.forwardRef(
|
|
164
|
+
(props, ref) => {
|
|
165
|
+
const { reg: _reg, ...inputProps } = props;
|
|
166
|
+
const [isView, setIsView] = React2.useState(false);
|
|
167
|
+
const handleChangeView = () => {
|
|
168
|
+
setIsView((prev) => !prev);
|
|
169
|
+
};
|
|
170
|
+
return /* @__PURE__ */ jsx2(
|
|
171
|
+
Input_default,
|
|
172
|
+
{
|
|
173
|
+
...inputProps,
|
|
174
|
+
suffix: /* @__PURE__ */ jsx2("div", { className: "wrapper pointer", onClick: handleChangeView, children: isView ? /* @__PURE__ */ jsx2(OpenEyeIcon_default, {}) : /* @__PURE__ */ jsx2(CloseEyeIcon_default, {}) }),
|
|
175
|
+
type: isView ? "text" : "password",
|
|
176
|
+
ref
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
PasswordInput.displayName = "PasswordInput";
|
|
182
|
+
var PasswordInput_default = PasswordInput;
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
Input_default,
|
|
186
|
+
PasswordInput_default
|
|
187
|
+
};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useClickOutside_default,
|
|
3
|
+
useOverlayHost_default
|
|
4
|
+
} from "./chunk-UARGO5UG.js";
|
|
5
|
+
import {
|
|
6
|
+
Portal_default
|
|
7
|
+
} from "./chunk-VSA62N2O.js";
|
|
8
|
+
import {
|
|
9
|
+
useAutoPosition_default,
|
|
10
|
+
useCloseWhenFocusHidden,
|
|
11
|
+
useEscapeKey
|
|
12
|
+
} from "./chunk-F664X2OY.js";
|
|
13
|
+
import {
|
|
14
|
+
ChevronDownIcon_default
|
|
15
|
+
} from "./chunk-XMM52J3T.js";
|
|
16
|
+
import {
|
|
17
|
+
Field,
|
|
18
|
+
hasError
|
|
19
|
+
} from "./chunk-7YOI5XOW.js";
|
|
20
|
+
import {
|
|
21
|
+
clsx_default
|
|
22
|
+
} from "./chunk-KZOJN57Q.js";
|
|
23
|
+
|
|
24
|
+
// src/components/Select/Select.tsx
|
|
25
|
+
import React3 from "react";
|
|
26
|
+
|
|
27
|
+
// src/components/Select/context.ts
|
|
28
|
+
import React from "react";
|
|
29
|
+
var SelectContext = React.createContext(null);
|
|
30
|
+
var context_default = SelectContext;
|
|
31
|
+
|
|
32
|
+
// src/components/Select/SelectItem.tsx
|
|
33
|
+
import React2 from "react";
|
|
34
|
+
import { jsx } from "react/jsx-runtime";
|
|
35
|
+
var SelectItem = (props) => {
|
|
36
|
+
const { children, value, onClick, disabled = false } = props;
|
|
37
|
+
const ctx = React2.useContext(context_default);
|
|
38
|
+
const handleClick = (e) => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
e.stopPropagation();
|
|
41
|
+
if (disabled) return;
|
|
42
|
+
ctx?.setSelected(children, value);
|
|
43
|
+
ctx?.close();
|
|
44
|
+
onClick?.();
|
|
45
|
+
};
|
|
46
|
+
const isSelected = value !== void 0 ? ctx?.selectedValue === value : ctx?.selectedLabel === children;
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: clsx_default("select-item", disabled && "disabled", isSelected && "is-selected"),
|
|
51
|
+
onClick: handleClick,
|
|
52
|
+
role: "option",
|
|
53
|
+
"aria-selected": isSelected,
|
|
54
|
+
"aria-disabled": disabled || void 0,
|
|
55
|
+
tabIndex: disabled ? void 0 : 0,
|
|
56
|
+
onKeyDown: (e) => {
|
|
57
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
handleClick(e);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
children
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
SelectItem.displayName = "Select.Item";
|
|
67
|
+
var SelectItem_default = SelectItem;
|
|
68
|
+
|
|
69
|
+
// src/components/Select/Select.tsx
|
|
70
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
71
|
+
var ANIMATION_DURATION_MS = 200;
|
|
72
|
+
var SelectRoot = (props) => {
|
|
73
|
+
const {
|
|
74
|
+
placeholder = "\uC120\uD0DD\uD558\uC138\uC694",
|
|
75
|
+
value: valueProp,
|
|
76
|
+
onChange,
|
|
77
|
+
children,
|
|
78
|
+
disabled = false,
|
|
79
|
+
searchable = false,
|
|
80
|
+
searchPlaceholder = "\uAC80\uC0C9",
|
|
81
|
+
error = false,
|
|
82
|
+
validations,
|
|
83
|
+
label,
|
|
84
|
+
required,
|
|
85
|
+
size = "md"
|
|
86
|
+
} = props;
|
|
87
|
+
const fieldId = React3.useId();
|
|
88
|
+
const itemChildren = React3.Children.toArray(children).filter(
|
|
89
|
+
(child) => React3.isValidElement(child) && child.type === SelectItem_default
|
|
90
|
+
);
|
|
91
|
+
const isControlled = valueProp !== void 0;
|
|
92
|
+
const [isOpen, setOpen] = React3.useState(false);
|
|
93
|
+
const [uncontrolledLabel, setUncontrolledLabel] = React3.useState(null);
|
|
94
|
+
const [uncontrolledValue, setUncontrolledValue] = React3.useState(void 0);
|
|
95
|
+
const controlledLabel = React3.useMemo(() => {
|
|
96
|
+
if (!isControlled) return null;
|
|
97
|
+
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
98
|
+
return match ? match.props.children : null;
|
|
99
|
+
}, [isControlled, valueProp, itemChildren]);
|
|
100
|
+
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
101
|
+
const selectedValue = isControlled ? valueProp : uncontrolledValue;
|
|
102
|
+
const triggerRef = React3.useRef(null);
|
|
103
|
+
const contentRef = React3.useRef(null);
|
|
104
|
+
const [mounted, setMounted] = React3.useState(false);
|
|
105
|
+
const [visible, setVisible] = React3.useState(false);
|
|
106
|
+
React3.useEffect(() => {
|
|
107
|
+
if (disabled && isOpen) setOpen(false);
|
|
108
|
+
}, [disabled, isOpen]);
|
|
109
|
+
React3.useEffect(() => {
|
|
110
|
+
if (isOpen) {
|
|
111
|
+
setMounted(true);
|
|
112
|
+
const t2 = setTimeout(() => setVisible(true), 1);
|
|
113
|
+
return () => clearTimeout(t2);
|
|
114
|
+
}
|
|
115
|
+
setVisible(false);
|
|
116
|
+
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS);
|
|
117
|
+
return () => clearTimeout(t);
|
|
118
|
+
}, [isOpen]);
|
|
119
|
+
const [query, setQuery] = React3.useState("");
|
|
120
|
+
const textOf = (node) => {
|
|
121
|
+
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
122
|
+
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
123
|
+
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
124
|
+
if (React3.isValidElement(node)) return textOf(node.props.children);
|
|
125
|
+
return "";
|
|
126
|
+
};
|
|
127
|
+
const visibleItems = React3.useMemo(() => {
|
|
128
|
+
if (!searchable || !query.trim()) return itemChildren;
|
|
129
|
+
const q = query.trim().toLowerCase();
|
|
130
|
+
return itemChildren.filter((c) => textOf(c.props.children).toLowerCase().includes(q));
|
|
131
|
+
}, [searchable, query, itemChildren]);
|
|
132
|
+
const open = React3.useCallback(() => setOpen(true), []);
|
|
133
|
+
const close = React3.useCallback(() => {
|
|
134
|
+
setOpen(false);
|
|
135
|
+
setQuery("");
|
|
136
|
+
}, []);
|
|
137
|
+
const toggle = React3.useCallback(() => setOpen((prev) => !prev), []);
|
|
138
|
+
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
139
|
+
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
140
|
+
useEscapeKey(isOpen, () => {
|
|
141
|
+
close();
|
|
142
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
143
|
+
});
|
|
144
|
+
const host = useOverlayHost_default(triggerRef, mounted);
|
|
145
|
+
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
146
|
+
const setSelected = React3.useCallback(
|
|
147
|
+
(label2, itemValue) => {
|
|
148
|
+
if (!isControlled) {
|
|
149
|
+
setUncontrolledLabel(label2);
|
|
150
|
+
setUncontrolledValue(itemValue);
|
|
151
|
+
}
|
|
152
|
+
onChange?.(itemValue, label2);
|
|
153
|
+
},
|
|
154
|
+
[isControlled, onChange]
|
|
155
|
+
);
|
|
156
|
+
const ctxValue = React3.useMemo(
|
|
157
|
+
() => ({
|
|
158
|
+
isOpen,
|
|
159
|
+
mounted,
|
|
160
|
+
visible,
|
|
161
|
+
triggerRef,
|
|
162
|
+
selectedLabel,
|
|
163
|
+
selectedValue,
|
|
164
|
+
setSelected,
|
|
165
|
+
open,
|
|
166
|
+
close,
|
|
167
|
+
toggle
|
|
168
|
+
}),
|
|
169
|
+
[isOpen, mounted, visible, selectedLabel, selectedValue, setSelected, open, close, toggle]
|
|
170
|
+
);
|
|
171
|
+
const stateClass = visible ? "visible" : "exit";
|
|
172
|
+
const handleTriggerClick = (e) => {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
e.stopPropagation();
|
|
175
|
+
if (disabled) return;
|
|
176
|
+
toggle();
|
|
177
|
+
};
|
|
178
|
+
const control = /* @__PURE__ */ jsx2(context_default.Provider, { value: ctxValue, children: /* @__PURE__ */ jsxs(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
className: clsx_default(
|
|
182
|
+
"lib-xplat-select",
|
|
183
|
+
size,
|
|
184
|
+
disabled && "disabled",
|
|
185
|
+
(error || hasError(validations)) && "error",
|
|
186
|
+
mounted && "is-open"
|
|
187
|
+
),
|
|
188
|
+
children: [
|
|
189
|
+
/* @__PURE__ */ jsxs(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
id: fieldId,
|
|
193
|
+
ref: triggerRef,
|
|
194
|
+
className: clsx_default(
|
|
195
|
+
"select-trigger",
|
|
196
|
+
disabled && "disabled",
|
|
197
|
+
(error || hasError(validations)) && "error"
|
|
198
|
+
),
|
|
199
|
+
onClick: handleTriggerClick,
|
|
200
|
+
role: "combobox",
|
|
201
|
+
"aria-expanded": isOpen,
|
|
202
|
+
"aria-haspopup": "listbox",
|
|
203
|
+
"aria-disabled": disabled,
|
|
204
|
+
"aria-invalid": error || hasError(validations) || void 0,
|
|
205
|
+
tabIndex: disabled ? -1 : 0,
|
|
206
|
+
onKeyDown: (e) => {
|
|
207
|
+
if (disabled) return;
|
|
208
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
toggle();
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ jsx2(
|
|
215
|
+
"span",
|
|
216
|
+
{
|
|
217
|
+
className: clsx_default(
|
|
218
|
+
"select-trigger-value",
|
|
219
|
+
selectedLabel == null && "placeholder"
|
|
220
|
+
),
|
|
221
|
+
children: selectedLabel ?? placeholder
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
/* @__PURE__ */ jsx2(
|
|
225
|
+
"span",
|
|
226
|
+
{
|
|
227
|
+
className: clsx_default("select-trigger-icon", isOpen && "open"),
|
|
228
|
+
"aria-hidden": true,
|
|
229
|
+
children: /* @__PURE__ */ jsx2(ChevronDownIcon_default, {})
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
mounted && /* @__PURE__ */ jsx2(Portal_default, { container: host, children: /* @__PURE__ */ jsxs(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
className: clsx_default("lib-xplat-select-content", size, stateClass),
|
|
239
|
+
ref: contentRef,
|
|
240
|
+
style: { width: triggerRef.current?.offsetWidth },
|
|
241
|
+
role: "listbox",
|
|
242
|
+
children: [
|
|
243
|
+
searchable && /* @__PURE__ */ jsx2("div", { className: "select-search", children: /* @__PURE__ */ jsx2(
|
|
244
|
+
"input",
|
|
245
|
+
{
|
|
246
|
+
type: "text",
|
|
247
|
+
value: query,
|
|
248
|
+
placeholder: searchPlaceholder,
|
|
249
|
+
onChange: (e) => setQuery(e.target.value),
|
|
250
|
+
autoFocus: true,
|
|
251
|
+
"aria-label": searchPlaceholder
|
|
252
|
+
}
|
|
253
|
+
) }),
|
|
254
|
+
/* @__PURE__ */ jsx2(context_default.Provider, { value: ctxValue, children: visibleItems.length > 0 ? visibleItems : /* @__PURE__ */ jsx2("div", { className: "select-empty", children: "\uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
) })
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
) });
|
|
261
|
+
return /* @__PURE__ */ jsx2(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
262
|
+
};
|
|
263
|
+
SelectRoot.displayName = "Select";
|
|
264
|
+
var Select = Object.assign(SelectRoot, {
|
|
265
|
+
Item: SelectItem_default
|
|
266
|
+
});
|
|
267
|
+
var Select_default = Select;
|
|
268
|
+
|
|
269
|
+
export {
|
|
270
|
+
SelectItem_default,
|
|
271
|
+
Select_default
|
|
272
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkUMX7DTFZcjs = require('./chunk-UMX7DTFZ.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkHGA47QVVcjs = require('./chunk-HGA47QVV.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkPFGSJJRYcjs = require('./chunk-PFGSJJRY.cjs');
|
|
13
|
+
|
|
14
|
+
// src/components/Input/Input.tsx
|
|
15
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
16
|
+
|
|
17
|
+
// src/components/Input/reg.ts
|
|
18
|
+
var numberAndCommaReg = /^[0-9,]+$/;
|
|
19
|
+
var phoneNumberMaxLengthReg = /^.{0,13}$/;
|
|
20
|
+
var creditCardNumberReg = /^(\d{4}-){3}\d{4}$/;
|
|
21
|
+
var anyReg = /^.*$/;
|
|
22
|
+
var inputTypeReg = {
|
|
23
|
+
number: numberAndCommaReg,
|
|
24
|
+
tel: phoneNumberMaxLengthReg,
|
|
25
|
+
creditCard: creditCardNumberReg,
|
|
26
|
+
email: anyReg,
|
|
27
|
+
password: anyReg,
|
|
28
|
+
text: anyReg
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/components/Input/utils/tel.ts
|
|
32
|
+
var handleTelBackspace = (prevValue, currValue) => {
|
|
33
|
+
if (!prevValue || !currValue) return currValue;
|
|
34
|
+
if (prevValue.length <= currValue.length) return currValue;
|
|
35
|
+
const prevArr = [...prevValue];
|
|
36
|
+
const currArr = [...currValue];
|
|
37
|
+
const diffIndex = prevArr.findIndex((char, idx) => char !== currArr[idx]);
|
|
38
|
+
if (diffIndex >= 0 && prevArr[diffIndex] === "-") {
|
|
39
|
+
const chars = prevValue.split("");
|
|
40
|
+
for (let i = diffIndex - 1; i >= 0; i--) {
|
|
41
|
+
if (/\d/.test(chars[i])) {
|
|
42
|
+
chars.splice(i, 1);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return chars.join("");
|
|
47
|
+
}
|
|
48
|
+
return currValue;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/components/Input/Input.tsx
|
|
52
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
53
|
+
var formatValue = (type, value) => {
|
|
54
|
+
if (value === null || value === void 0) return "";
|
|
55
|
+
const strValue = Array.isArray(value) ? String(_nullishCoalesce(value[0], () => ( ""))) : String(value);
|
|
56
|
+
switch (type) {
|
|
57
|
+
case "number": {
|
|
58
|
+
if (!strValue) return "";
|
|
59
|
+
const n = typeof value === "number" ? value : Number(strValue.replace(/,/g, ""));
|
|
60
|
+
return isNaN(n) ? "" : n.toLocaleString("en-US");
|
|
61
|
+
}
|
|
62
|
+
case "tel": {
|
|
63
|
+
const digits = strValue.replace(/\D/g, "");
|
|
64
|
+
if (!digits) return "";
|
|
65
|
+
if (digits.startsWith("02")) {
|
|
66
|
+
if (digits.length <= 2) return digits;
|
|
67
|
+
if (digits.length <= 6) return digits.replace(/^(02)(\d+)/, "$1-$2");
|
|
68
|
+
return digits.replace(/^(02)(\d{3,4})(\d{0,4})$/, "$1-$2-$3");
|
|
69
|
+
}
|
|
70
|
+
if (/^01[016789]/.test(digits)) {
|
|
71
|
+
if (digits.length <= 3) return digits;
|
|
72
|
+
if (digits.length <= 6)
|
|
73
|
+
return digits.replace(/^(01[016789])(\d+)/, "$1-$2");
|
|
74
|
+
if (digits.length === 10) {
|
|
75
|
+
return digits.replace(/^(01[016789])(\d{3})(\d{0,4})$/, "$1-$2-$3");
|
|
76
|
+
}
|
|
77
|
+
return digits.replace(/^(01[016789])(\d{4})(\d{0,4})$/, "$1-$2-$3");
|
|
78
|
+
}
|
|
79
|
+
if (digits.length <= 3) return digits;
|
|
80
|
+
if (digits.length <= 6) return digits.replace(/^(\d{3})(\d+)/, "$1-$2");
|
|
81
|
+
return digits.replace(/^(\d{3})(\d{3,4})(\d{0,4})$/, "$1-$2-$3");
|
|
82
|
+
}
|
|
83
|
+
default:
|
|
84
|
+
return strValue;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var parseValue = (type, value) => {
|
|
88
|
+
switch (type) {
|
|
89
|
+
case "number": {
|
|
90
|
+
if (value === "") return "";
|
|
91
|
+
const n = Number(value.replace(/,/g, ""));
|
|
92
|
+
return isNaN(n) ? 0 : n;
|
|
93
|
+
}
|
|
94
|
+
case "tel":
|
|
95
|
+
return value.replace(/\D/g, "");
|
|
96
|
+
default:
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var Input = _react2.default.forwardRef((props, ref) => {
|
|
101
|
+
const {
|
|
102
|
+
value,
|
|
103
|
+
className,
|
|
104
|
+
onChange,
|
|
105
|
+
type = "text",
|
|
106
|
+
size = "md",
|
|
107
|
+
suffix,
|
|
108
|
+
disabled,
|
|
109
|
+
validations,
|
|
110
|
+
label,
|
|
111
|
+
required,
|
|
112
|
+
...inputProps
|
|
113
|
+
} = props;
|
|
114
|
+
const autoId = _react2.default.useId();
|
|
115
|
+
const fieldId = _nullishCoalesce(inputProps.id, () => ( autoId));
|
|
116
|
+
const localValue = formatValue(type, value);
|
|
117
|
+
const handleChange = (e) => {
|
|
118
|
+
let val = e.target.value;
|
|
119
|
+
if (val !== "" && !inputTypeReg[type].test(val)) return;
|
|
120
|
+
if (type === "tel" && localValue) {
|
|
121
|
+
val = handleTelBackspace(localValue, val);
|
|
122
|
+
}
|
|
123
|
+
if (onChange) {
|
|
124
|
+
const event = {
|
|
125
|
+
...e,
|
|
126
|
+
target: { value: parseValue(type, val) }
|
|
127
|
+
};
|
|
128
|
+
onChange(event);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHGA47QVVcjs.Field, { label, required, htmlFor: fieldId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "lib-xplat-input-wrap", className), children: [
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "lib-xplat-input", size, disabled ? "disabled" : void 0),
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
138
|
+
"input",
|
|
139
|
+
{
|
|
140
|
+
...inputProps,
|
|
141
|
+
ref,
|
|
142
|
+
id: fieldId,
|
|
143
|
+
disabled,
|
|
144
|
+
type: type === "number" ? "text" : type,
|
|
145
|
+
value: localValue,
|
|
146
|
+
onChange: handleChange,
|
|
147
|
+
"aria-invalid": _chunkHGA47QVVcjs.hasError.call(void 0, validations) || void 0
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
suffix && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "suffix", children: suffix })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHGA47QVVcjs.FieldMessage_default, { validations })
|
|
155
|
+
] }) });
|
|
156
|
+
});
|
|
157
|
+
Input.displayName = "Input";
|
|
158
|
+
var Input_default = Input;
|
|
159
|
+
|
|
160
|
+
// src/components/Input/PasswordInput/PasswordInput.tsx
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
var PasswordInput = _react2.default.forwardRef(
|
|
164
|
+
(props, ref) => {
|
|
165
|
+
const { reg: _reg, ...inputProps } = props;
|
|
166
|
+
const [isView, setIsView] = _react2.default.useState(false);
|
|
167
|
+
const handleChangeView = () => {
|
|
168
|
+
setIsView((prev) => !prev);
|
|
169
|
+
};
|
|
170
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
171
|
+
Input_default,
|
|
172
|
+
{
|
|
173
|
+
...inputProps,
|
|
174
|
+
suffix: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "wrapper pointer", onClick: handleChangeView, children: isView ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUMX7DTFZcjs.OpenEyeIcon_default, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUMX7DTFZcjs.CloseEyeIcon_default, {}) }),
|
|
175
|
+
type: isView ? "text" : "password",
|
|
176
|
+
ref
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
PasswordInput.displayName = "PasswordInput";
|
|
182
|
+
var PasswordInput_default = PasswordInput;
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
exports.Input_default = Input_default; exports.PasswordInput_default = PasswordInput_default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/components/Breadcrumb/Breadcrumb.tsx
|
|
2
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
3
|
+
var Breadcrumb = (props) => {
|
|
4
|
+
const { items, separator = "/" } = props;
|
|
5
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "nav", { className: "lib-xplat-breadcrumb", "aria-label": "\uACBD\uB85C", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { children: items.map((item, index) => {
|
|
6
|
+
const isLast = index === items.length - 1;
|
|
7
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { children: [
|
|
8
|
+
isLast ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "current", "aria-current": "page", children: item.label }) : item.href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: item.href, className: "link", children: item.label }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "link", onClick: item.onClick, children: item.label }),
|
|
9
|
+
!isLast && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "separator", children: separator })
|
|
10
|
+
] }, index);
|
|
11
|
+
}) }) });
|
|
12
|
+
};
|
|
13
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
14
|
+
var Breadcrumb_default = Breadcrumb;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.Breadcrumb_default = Breadcrumb_default;
|