@x-plat/design-system 0.20.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 -337
- package/dist/components/Table/index.js +8 -300
- 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 -8342
- package/dist/components/index.js +190 -8288
- package/dist/index.cjs +903 -13318
- package/dist/index.js +524 -12526
- 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/setup.md +7 -0
- package/package.json +6 -3
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconButton_default
|
|
3
|
+
} from "./chunk-55EPYLXN.js";
|
|
4
|
+
import {
|
|
5
|
+
MessageSquareIcon_default
|
|
6
|
+
} from "./chunk-QYMRGYTN.js";
|
|
7
|
+
import {
|
|
8
|
+
AutoResizeTextArea_default
|
|
9
|
+
} from "./chunk-6P2B3ZGP.js";
|
|
10
|
+
import {
|
|
11
|
+
Field,
|
|
12
|
+
hasError
|
|
13
|
+
} from "./chunk-7YOI5XOW.js";
|
|
14
|
+
import {
|
|
15
|
+
clsx_default
|
|
16
|
+
} from "./chunk-KZOJN57Q.js";
|
|
17
|
+
|
|
18
|
+
// src/components/ChatInput/ChatInput.tsx
|
|
19
|
+
import React from "react";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
var ChatInput = React.forwardRef(
|
|
22
|
+
(props, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
placeholder,
|
|
25
|
+
value: valueProp,
|
|
26
|
+
disabled = false,
|
|
27
|
+
buttonType = "primary",
|
|
28
|
+
onSubmit,
|
|
29
|
+
onChange,
|
|
30
|
+
validations,
|
|
31
|
+
label,
|
|
32
|
+
required
|
|
33
|
+
} = props;
|
|
34
|
+
const fieldId = React.useId();
|
|
35
|
+
const isControlled = valueProp !== void 0;
|
|
36
|
+
const [internalValue, setInternalValue] = React.useState("");
|
|
37
|
+
const value = isControlled ? valueProp : internalValue;
|
|
38
|
+
const hasText = value.trim().length > 0;
|
|
39
|
+
const handleChange = (e) => {
|
|
40
|
+
const val = e.target.value;
|
|
41
|
+
if (!isControlled) setInternalValue(val);
|
|
42
|
+
onChange?.(val);
|
|
43
|
+
};
|
|
44
|
+
const handleSubmit = () => {
|
|
45
|
+
if (!hasText || disabled) return;
|
|
46
|
+
onSubmit?.(value);
|
|
47
|
+
if (!isControlled) setInternalValue("");
|
|
48
|
+
};
|
|
49
|
+
const handleKeyDown = (e) => {
|
|
50
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
handleSubmit();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const control = /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-chat-input", disabled && "disabled"), children: [
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
AutoResizeTextArea_default,
|
|
58
|
+
{
|
|
59
|
+
id: fieldId,
|
|
60
|
+
ref,
|
|
61
|
+
bare: true,
|
|
62
|
+
className: "chat-input-textarea",
|
|
63
|
+
placeholder,
|
|
64
|
+
value,
|
|
65
|
+
disabled,
|
|
66
|
+
rows: 1,
|
|
67
|
+
onChange: handleChange,
|
|
68
|
+
"aria-invalid": hasError(validations) || void 0,
|
|
69
|
+
onKeyDown: handleKeyDown
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
IconButton_default,
|
|
74
|
+
{
|
|
75
|
+
icon: /* @__PURE__ */ jsx(MessageSquareIcon_default, {}),
|
|
76
|
+
type: buttonType,
|
|
77
|
+
size: "sm",
|
|
78
|
+
disabled: !hasText || disabled,
|
|
79
|
+
onClick: handleSubmit,
|
|
80
|
+
"aria-label": "\uC804\uC1A1"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] });
|
|
84
|
+
return /* @__PURE__ */ jsx(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
ChatInput.displayName = "ChatInput";
|
|
88
|
+
var ChatInput_default = ChatInput;
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
ChatInput_default
|
|
92
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clsx_default
|
|
3
|
+
} from "./chunk-KZOJN57Q.js";
|
|
4
|
+
|
|
5
|
+
// src/components/Link/Link.tsx
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var Link = (props) => {
|
|
8
|
+
const { children, href, underline = "always", target, rel, ...rest } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"a",
|
|
11
|
+
{
|
|
12
|
+
className: clsx_default("lib-xplat-link", `underline-${underline}`),
|
|
13
|
+
href,
|
|
14
|
+
target,
|
|
15
|
+
rel: target === "_blank" ? rel ?? "noopener noreferrer" : rel,
|
|
16
|
+
...rest,
|
|
17
|
+
children
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
Link.displayName = "Link";
|
|
22
|
+
var Link_default = Link;
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
Link_default
|
|
26
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Portal_default
|
|
3
|
+
} from "./chunk-VSA62N2O.js";
|
|
4
|
+
import {
|
|
5
|
+
clsx_default
|
|
6
|
+
} from "./chunk-KZOJN57Q.js";
|
|
7
|
+
|
|
8
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var OFFSET = 12;
|
|
12
|
+
var GAP = 8;
|
|
13
|
+
var SHOW_DELAY = 300;
|
|
14
|
+
var Tooltip = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
children,
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
variant,
|
|
20
|
+
type,
|
|
21
|
+
follow = false,
|
|
22
|
+
disabled = false
|
|
23
|
+
} = props;
|
|
24
|
+
const shape = variant ?? type ?? "dark";
|
|
25
|
+
const triggerRef = React.useRef(null);
|
|
26
|
+
const tooltipRef = React.useRef(null);
|
|
27
|
+
const [visible, setVisible] = React.useState(false);
|
|
28
|
+
const [pos, setPos] = React.useState({ left: 0, top: 0 });
|
|
29
|
+
const delayTimer = React.useRef(0);
|
|
30
|
+
const rafRef = React.useRef(0);
|
|
31
|
+
const cursor = React.useRef(null);
|
|
32
|
+
const clamp = React.useCallback((left, top, w, h) => {
|
|
33
|
+
const vw = window.innerWidth;
|
|
34
|
+
const vh = window.innerHeight;
|
|
35
|
+
return {
|
|
36
|
+
left: Math.min(Math.max(GAP, left), Math.max(GAP, vw - w - GAP)),
|
|
37
|
+
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
const placeAtCursor = React.useCallback((x, y) => {
|
|
41
|
+
const el = tooltipRef.current;
|
|
42
|
+
if (!el) return;
|
|
43
|
+
const w = el.offsetWidth;
|
|
44
|
+
const h = el.offsetHeight;
|
|
45
|
+
let left = x + OFFSET;
|
|
46
|
+
let top = y - h - OFFSET;
|
|
47
|
+
if (left + w > window.innerWidth - GAP) left = x - w - OFFSET;
|
|
48
|
+
if (top < GAP) top = y + OFFSET;
|
|
49
|
+
setPos(clamp(left, top, w, h));
|
|
50
|
+
}, [clamp]);
|
|
51
|
+
const placeAtTrigger = React.useCallback(() => {
|
|
52
|
+
const el = tooltipRef.current;
|
|
53
|
+
const trigger = triggerRef.current;
|
|
54
|
+
if (!el || !trigger) return;
|
|
55
|
+
const w = el.offsetWidth;
|
|
56
|
+
const h = el.offsetHeight;
|
|
57
|
+
const rect = trigger.getBoundingClientRect();
|
|
58
|
+
let top = rect.top - h - GAP;
|
|
59
|
+
if (top < GAP) top = rect.bottom + GAP;
|
|
60
|
+
const left = rect.left + rect.width / 2 - w / 2;
|
|
61
|
+
setPos(clamp(left, top, w, h));
|
|
62
|
+
}, [clamp]);
|
|
63
|
+
const reposition = React.useCallback(() => {
|
|
64
|
+
if (follow && cursor.current) {
|
|
65
|
+
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
66
|
+
} else {
|
|
67
|
+
placeAtTrigger();
|
|
68
|
+
}
|
|
69
|
+
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
70
|
+
const handleMouseEnter = React.useCallback((e) => {
|
|
71
|
+
if (disabled) return;
|
|
72
|
+
cursor.current = { x: e.clientX, y: e.clientY };
|
|
73
|
+
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
74
|
+
}, [disabled]);
|
|
75
|
+
const handleMouseMove = React.useCallback((e) => {
|
|
76
|
+
cursor.current = { x: e.clientX, y: e.clientY };
|
|
77
|
+
if (!visible || !follow) return;
|
|
78
|
+
cancelAnimationFrame(rafRef.current);
|
|
79
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
80
|
+
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
81
|
+
});
|
|
82
|
+
}, [visible, follow, placeAtCursor]);
|
|
83
|
+
const close = React.useCallback(() => {
|
|
84
|
+
window.clearTimeout(delayTimer.current);
|
|
85
|
+
cancelAnimationFrame(rafRef.current);
|
|
86
|
+
setVisible(false);
|
|
87
|
+
}, []);
|
|
88
|
+
const handleMouseLeave = React.useCallback(() => {
|
|
89
|
+
cursor.current = null;
|
|
90
|
+
close();
|
|
91
|
+
}, [close]);
|
|
92
|
+
const handleFocus = React.useCallback(() => {
|
|
93
|
+
if (disabled) return;
|
|
94
|
+
cursor.current = null;
|
|
95
|
+
setVisible(true);
|
|
96
|
+
}, [disabled]);
|
|
97
|
+
React.useLayoutEffect(() => {
|
|
98
|
+
if (!visible) return;
|
|
99
|
+
reposition();
|
|
100
|
+
}, [visible, reposition]);
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
if (!visible || follow) return;
|
|
103
|
+
const onChange = () => placeAtTrigger();
|
|
104
|
+
window.addEventListener("scroll", onChange, true);
|
|
105
|
+
window.addEventListener("resize", onChange);
|
|
106
|
+
return () => {
|
|
107
|
+
window.removeEventListener("scroll", onChange, true);
|
|
108
|
+
window.removeEventListener("resize", onChange);
|
|
109
|
+
};
|
|
110
|
+
}, [visible, follow, placeAtTrigger]);
|
|
111
|
+
React.useEffect(() => () => {
|
|
112
|
+
window.clearTimeout(delayTimer.current);
|
|
113
|
+
cancelAnimationFrame(rafRef.current);
|
|
114
|
+
}, []);
|
|
115
|
+
if (!title && !description) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
116
|
+
return /* @__PURE__ */ jsxs(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
ref: triggerRef,
|
|
120
|
+
className: "lib-xplat-tooltip-trigger",
|
|
121
|
+
onMouseEnter: handleMouseEnter,
|
|
122
|
+
onMouseMove: handleMouseMove,
|
|
123
|
+
onMouseLeave: handleMouseLeave,
|
|
124
|
+
onClick: close,
|
|
125
|
+
onFocus: handleFocus,
|
|
126
|
+
onBlur: close,
|
|
127
|
+
children: [
|
|
128
|
+
children,
|
|
129
|
+
visible && /* @__PURE__ */ jsx(Portal_default, { children: /* @__PURE__ */ jsxs(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
ref: tooltipRef,
|
|
133
|
+
role: "tooltip",
|
|
134
|
+
className: clsx_default("lib-xplat-tooltip", shape),
|
|
135
|
+
style: { position: "fixed", left: pos.left, top: pos.top },
|
|
136
|
+
children: [
|
|
137
|
+
title && /* @__PURE__ */ jsx("div", { className: "tooltip-title", children: title }),
|
|
138
|
+
description && /* @__PURE__ */ jsx("div", { className: "tooltip-desc", children: description })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
) })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
Tooltip.displayName = "Tooltip";
|
|
147
|
+
var Tooltip_default = Tooltip;
|
|
148
|
+
|
|
149
|
+
export {
|
|
150
|
+
Tooltip_default
|
|
151
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UploadIcon_default
|
|
3
|
+
} from "./chunk-NCBB3WUJ.js";
|
|
4
|
+
import {
|
|
5
|
+
Field,
|
|
6
|
+
hasError
|
|
7
|
+
} from "./chunk-7YOI5XOW.js";
|
|
8
|
+
import {
|
|
9
|
+
clsx_default
|
|
10
|
+
} from "./chunk-KZOJN57Q.js";
|
|
11
|
+
|
|
12
|
+
// src/components/FileUpload/FileUpload.tsx
|
|
13
|
+
import React from "react";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var FileUpload = (props) => {
|
|
16
|
+
const {
|
|
17
|
+
accept,
|
|
18
|
+
multiple = false,
|
|
19
|
+
maxSize,
|
|
20
|
+
onChange,
|
|
21
|
+
placeholder = "\uD30C\uC77C\uC744 \uB4DC\uB798\uADF8\uD558\uAC70\uB098 \uD074\uB9AD\uD558\uC5EC \uC5C5\uB85C\uB4DC",
|
|
22
|
+
description,
|
|
23
|
+
validations,
|
|
24
|
+
label,
|
|
25
|
+
required
|
|
26
|
+
} = props;
|
|
27
|
+
const fieldId = React.useId();
|
|
28
|
+
const [isDragOver, setIsDragOver] = React.useState(false);
|
|
29
|
+
const inputRef = React.useRef(null);
|
|
30
|
+
const handleFiles = (fileList) => {
|
|
31
|
+
let files = Array.from(fileList);
|
|
32
|
+
if (maxSize) {
|
|
33
|
+
files = files.filter((f) => f.size <= maxSize);
|
|
34
|
+
}
|
|
35
|
+
if (!multiple && files.length > 1) {
|
|
36
|
+
files = [files[0]];
|
|
37
|
+
}
|
|
38
|
+
onChange?.(files);
|
|
39
|
+
};
|
|
40
|
+
const handleDrop = (e) => {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
setIsDragOver(false);
|
|
43
|
+
if (e.dataTransfer.files.length > 0) {
|
|
44
|
+
handleFiles(e.dataTransfer.files);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const handleDragOver = (e) => {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
setIsDragOver(true);
|
|
50
|
+
};
|
|
51
|
+
const handleDragLeave = () => {
|
|
52
|
+
setIsDragOver(false);
|
|
53
|
+
};
|
|
54
|
+
const handleChange = (e) => {
|
|
55
|
+
if (e.target.files && e.target.files.length > 0) {
|
|
56
|
+
handleFiles(e.target.files);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const control = /* @__PURE__ */ jsxs(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: clsx_default("lib-xplat-file-upload", { "drag-over": isDragOver }),
|
|
63
|
+
onDrop: handleDrop,
|
|
64
|
+
onDragOver: handleDragOver,
|
|
65
|
+
onDragLeave: handleDragLeave,
|
|
66
|
+
onClick: () => inputRef.current?.click(),
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
"input",
|
|
70
|
+
{
|
|
71
|
+
ref: inputRef,
|
|
72
|
+
id: fieldId,
|
|
73
|
+
type: "file",
|
|
74
|
+
accept,
|
|
75
|
+
multiple,
|
|
76
|
+
onChange: handleChange,
|
|
77
|
+
"aria-invalid": hasError(validations) || void 0
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx("div", { className: "upload-icon", children: /* @__PURE__ */ jsx(UploadIcon_default, {}) }),
|
|
81
|
+
/* @__PURE__ */ jsx("p", { className: "upload-label", children: placeholder }),
|
|
82
|
+
description && /* @__PURE__ */ jsx("p", { className: "upload-description", children: description })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
return /* @__PURE__ */ jsx(Field, { label, required, htmlFor: fieldId, validations, children: control });
|
|
87
|
+
};
|
|
88
|
+
FileUpload.displayName = "FileUpload";
|
|
89
|
+
var FileUpload_default = FileUpload;
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
FileUpload_default
|
|
93
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkWRLCCK3Mcjs = require('./chunk-WRLCCK3M.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk5FMTMXSPcjs = require('./chunk-5FMTMXSP.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkF3M2H5EXcjs = require('./chunk-F3M2H5EX.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkHGA47QVVcjs = require('./chunk-HGA47QVV.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkPFGSJJRYcjs = require('./chunk-PFGSJJRY.cjs');
|
|
17
|
+
|
|
18
|
+
// src/components/ChatInput/ChatInput.tsx
|
|
19
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
20
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
21
|
+
var ChatInput = _react2.default.forwardRef(
|
|
22
|
+
(props, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
placeholder,
|
|
25
|
+
value: valueProp,
|
|
26
|
+
disabled = false,
|
|
27
|
+
buttonType = "primary",
|
|
28
|
+
onSubmit,
|
|
29
|
+
onChange,
|
|
30
|
+
validations,
|
|
31
|
+
label,
|
|
32
|
+
required
|
|
33
|
+
} = props;
|
|
34
|
+
const fieldId = _react2.default.useId();
|
|
35
|
+
const isControlled = valueProp !== void 0;
|
|
36
|
+
const [internalValue, setInternalValue] = _react2.default.useState("");
|
|
37
|
+
const value = isControlled ? valueProp : internalValue;
|
|
38
|
+
const hasText = value.trim().length > 0;
|
|
39
|
+
const handleChange = (e) => {
|
|
40
|
+
const val = e.target.value;
|
|
41
|
+
if (!isControlled) setInternalValue(val);
|
|
42
|
+
_optionalChain([onChange, 'optionalCall', _ => _(val)]);
|
|
43
|
+
};
|
|
44
|
+
const handleSubmit = () => {
|
|
45
|
+
if (!hasText || disabled) return;
|
|
46
|
+
_optionalChain([onSubmit, 'optionalCall', _2 => _2(value)]);
|
|
47
|
+
if (!isControlled) setInternalValue("");
|
|
48
|
+
};
|
|
49
|
+
const handleKeyDown = (e) => {
|
|
50
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
handleSubmit();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const control = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "lib-xplat-chat-input", disabled && "disabled"), children: [
|
|
56
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
57
|
+
_chunkF3M2H5EXcjs.AutoResizeTextArea_default,
|
|
58
|
+
{
|
|
59
|
+
id: fieldId,
|
|
60
|
+
ref,
|
|
61
|
+
bare: true,
|
|
62
|
+
className: "chat-input-textarea",
|
|
63
|
+
placeholder,
|
|
64
|
+
value,
|
|
65
|
+
disabled,
|
|
66
|
+
rows: 1,
|
|
67
|
+
onChange: handleChange,
|
|
68
|
+
"aria-invalid": _chunkHGA47QVVcjs.hasError.call(void 0, validations) || void 0,
|
|
69
|
+
onKeyDown: handleKeyDown
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
73
|
+
_chunkWRLCCK3Mcjs.IconButton_default,
|
|
74
|
+
{
|
|
75
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5FMTMXSPcjs.MessageSquareIcon_default, {}),
|
|
76
|
+
type: buttonType,
|
|
77
|
+
size: "sm",
|
|
78
|
+
disabled: !hasText || disabled,
|
|
79
|
+
onClick: handleSubmit,
|
|
80
|
+
"aria-label": "\uC804\uC1A1"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] });
|
|
84
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHGA47QVVcjs.Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
ChatInput.displayName = "ChatInput";
|
|
88
|
+
var ChatInput_default = ChatInput;
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
exports.ChatInput_default = ChatInput_default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clsx_default
|
|
3
|
+
} from "./chunk-KZOJN57Q.js";
|
|
4
|
+
|
|
5
|
+
// src/components/ToggleChip/ToggleChip.tsx
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var ToggleChip = (props) => {
|
|
8
|
+
const { children, selected = false, onClick, disabled = false, size = "md" } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"button",
|
|
11
|
+
{
|
|
12
|
+
type: "button",
|
|
13
|
+
className: clsx_default(
|
|
14
|
+
"lib-xplat-chip",
|
|
15
|
+
"lib-xplat-toggle-chip",
|
|
16
|
+
size,
|
|
17
|
+
selected ? "selected" : "unselected"
|
|
18
|
+
),
|
|
19
|
+
"aria-pressed": selected,
|
|
20
|
+
disabled,
|
|
21
|
+
onClick,
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
ToggleChip.displayName = "ToggleChip";
|
|
27
|
+
var ToggleChip_default = ToggleChip;
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
ToggleChip_default
|
|
31
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
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(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkQCD7UEZ3cjs = require('./chunk-QCD7UEZ3.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkEFU7IAF5cjs = require('./chunk-EFU7IAF5.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk4KYHHJ6Zcjs = require('./chunk-4KYHHJ6Z.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkHGA47QVVcjs = require('./chunk-HGA47QVV.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkPFGSJJRYcjs = require('./chunk-PFGSJJRY.cjs');
|
|
20
|
+
|
|
21
|
+
// src/components/TimePicker/TimePicker.tsx
|
|
22
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
23
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
24
|
+
var ANIMATION_DURATION_MS = 200;
|
|
25
|
+
var toMinutes = (hhmm) => {
|
|
26
|
+
if (!hhmm) return null;
|
|
27
|
+
const m = /^(\d{1,2}):(\d{2})$/.exec(hhmm.trim());
|
|
28
|
+
if (!m) return null;
|
|
29
|
+
const h = Number(m[1]);
|
|
30
|
+
const min = Number(m[2]);
|
|
31
|
+
if (h > 23 || min > 59) return null;
|
|
32
|
+
return h * 60 + min;
|
|
33
|
+
};
|
|
34
|
+
var toHHmm = (minutes) => `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}`;
|
|
35
|
+
var display = (hhmm, use12Hours) => {
|
|
36
|
+
if (!use12Hours) return hhmm;
|
|
37
|
+
const total = toMinutes(hhmm);
|
|
38
|
+
if (total === null) return hhmm;
|
|
39
|
+
const h24 = Math.floor(total / 60);
|
|
40
|
+
const mm = String(total % 60).padStart(2, "0");
|
|
41
|
+
const period = h24 < 12 ? "\uC624\uC804" : "\uC624\uD6C4";
|
|
42
|
+
const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
|
|
43
|
+
return `${period} ${h12}:${mm}`;
|
|
44
|
+
};
|
|
45
|
+
var TimePicker = (props) => {
|
|
46
|
+
const {
|
|
47
|
+
value,
|
|
48
|
+
onChange,
|
|
49
|
+
step = 30,
|
|
50
|
+
min,
|
|
51
|
+
max,
|
|
52
|
+
use12Hours = false,
|
|
53
|
+
placeholder = "\uC2DC\uAC01 \uC120\uD0DD",
|
|
54
|
+
disabled = false,
|
|
55
|
+
size = "md",
|
|
56
|
+
label,
|
|
57
|
+
required,
|
|
58
|
+
validations
|
|
59
|
+
} = props;
|
|
60
|
+
const fieldId = _react2.default.useId();
|
|
61
|
+
const triggerRef = _react2.default.useRef(null);
|
|
62
|
+
const contentRef = _react2.default.useRef(null);
|
|
63
|
+
const [isOpen, setOpen] = _react2.default.useState(false);
|
|
64
|
+
const [mounted, setMounted] = _react2.default.useState(false);
|
|
65
|
+
const [visible, setVisible] = _react2.default.useState(false);
|
|
66
|
+
const options = _react2.default.useMemo(() => {
|
|
67
|
+
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
68
|
+
const lo = _nullishCoalesce(toMinutes(min), () => ( 0));
|
|
69
|
+
const hi = _nullishCoalesce(toMinutes(max), () => ( 24 * 60 - 1));
|
|
70
|
+
const out = [];
|
|
71
|
+
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
72
|
+
return out;
|
|
73
|
+
}, [step, min, max]);
|
|
74
|
+
const close = _react2.default.useCallback(() => setOpen(false), []);
|
|
75
|
+
_chunkQCD7UEZ3cjs.useClickOutside_default.call(void 0, [triggerRef, contentRef], close, isOpen);
|
|
76
|
+
_chunk4KYHHJ6Zcjs.useCloseWhenFocusHidden.call(void 0, isOpen, triggerRef, contentRef, close);
|
|
77
|
+
_chunk4KYHHJ6Zcjs.useEscapeKey.call(void 0, isOpen, () => {
|
|
78
|
+
close();
|
|
79
|
+
_optionalChain([triggerRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.focus, 'call', _3 => _3({ preventScroll: true })]);
|
|
80
|
+
});
|
|
81
|
+
const host = _chunkQCD7UEZ3cjs.useOverlayHost_default.call(void 0, triggerRef, mounted);
|
|
82
|
+
_chunk4KYHHJ6Zcjs.useAutoPosition_default.call(void 0, triggerRef, contentRef, mounted);
|
|
83
|
+
_react2.default.useEffect(() => {
|
|
84
|
+
if (disabled && isOpen) setOpen(false);
|
|
85
|
+
}, [disabled, isOpen]);
|
|
86
|
+
_react2.default.useEffect(() => {
|
|
87
|
+
if (isOpen) {
|
|
88
|
+
setMounted(true);
|
|
89
|
+
const t2 = setTimeout(() => setVisible(true), 1);
|
|
90
|
+
return () => clearTimeout(t2);
|
|
91
|
+
}
|
|
92
|
+
setVisible(false);
|
|
93
|
+
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS);
|
|
94
|
+
return () => clearTimeout(t);
|
|
95
|
+
}, [isOpen]);
|
|
96
|
+
const pick = (hhmm) => {
|
|
97
|
+
_optionalChain([onChange, 'optionalCall', _4 => _4(hhmm)]);
|
|
98
|
+
close();
|
|
99
|
+
_optionalChain([triggerRef, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.focus, 'call', _7 => _7({ preventScroll: true })]);
|
|
100
|
+
};
|
|
101
|
+
const control = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "lib-xplat-time-picker", size, disabled && "disabled"), children: [
|
|
102
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
id: fieldId,
|
|
106
|
+
ref: triggerRef,
|
|
107
|
+
className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "time-picker-trigger", _chunkHGA47QVVcjs.hasError.call(void 0, validations) && "error"),
|
|
108
|
+
role: "combobox",
|
|
109
|
+
"aria-expanded": isOpen,
|
|
110
|
+
"aria-haspopup": "listbox",
|
|
111
|
+
"aria-invalid": _chunkHGA47QVVcjs.hasError.call(void 0, validations) || void 0,
|
|
112
|
+
tabIndex: disabled ? void 0 : 0,
|
|
113
|
+
onClick: () => !disabled && setOpen((p) => !p),
|
|
114
|
+
onKeyDown: (e) => {
|
|
115
|
+
if (disabled) return;
|
|
116
|
+
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
setOpen(true);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
mounted && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEFU7IAF5cjs.Portal_default, { container: host, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
ref: contentRef,
|
|
128
|
+
className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
129
|
+
style: { width: _optionalChain([triggerRef, 'access', _8 => _8.current, 'optionalAccess', _9 => _9.offsetWidth]) },
|
|
130
|
+
role: "listbox",
|
|
131
|
+
children: options.map((t) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
className: _chunkPFGSJJRYcjs.clsx_default.call(void 0, "time-picker-item", t === value && "is-selected"),
|
|
135
|
+
role: "option",
|
|
136
|
+
"aria-selected": t === value,
|
|
137
|
+
tabIndex: 0,
|
|
138
|
+
onClick: () => pick(t),
|
|
139
|
+
onKeyDown: (e) => {
|
|
140
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
pick(t);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
children: display(t, use12Hours)
|
|
146
|
+
},
|
|
147
|
+
t
|
|
148
|
+
))
|
|
149
|
+
}
|
|
150
|
+
) })
|
|
151
|
+
] });
|
|
152
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHGA47QVVcjs.Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
153
|
+
};
|
|
154
|
+
TimePicker.displayName = "TimePicker";
|
|
155
|
+
var TimePicker_default = TimePicker;
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
exports.TimePicker_default = TimePicker_default;
|