@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
|
@@ -1,582 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
3
|
+
var _chunkKUJH72U6cjs = require('../../chunk-KUJH72U6.cjs');
|
|
4
|
+
require('../../chunk-QCD7UEZ3.cjs');
|
|
5
|
+
require('../../chunk-EFU7IAF5.cjs');
|
|
6
|
+
require('../../chunk-4KYHHJ6Z.cjs');
|
|
7
|
+
require('../../chunk-HGA47QVV.cjs');
|
|
8
|
+
require('../../chunk-XZ7C5CGB.cjs');
|
|
9
|
+
require('../../chunk-PFGSJJRY.cjs');
|
|
36
10
|
|
|
37
|
-
// src/components/TimePicker/TimePicker.tsx
|
|
38
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
39
11
|
|
|
40
|
-
|
|
41
|
-
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
42
|
-
var Portal = ({ children, container }) => {
|
|
43
|
-
if (typeof document === "undefined") return null;
|
|
44
|
-
return import_react_dom.default.createPortal(children, container ?? document.body);
|
|
45
|
-
};
|
|
46
|
-
Portal.displayName = "Portal";
|
|
47
|
-
var Portal_default = Portal;
|
|
48
|
-
|
|
49
|
-
// src/tokens/hooks/useAutoPosition.ts
|
|
50
|
-
var import_react = __toESM(require("react"), 1);
|
|
51
|
-
var findScrollParent = (el) => {
|
|
52
|
-
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
53
|
-
if (p.dataset.xplatOverlayEscape !== void 0) continue;
|
|
54
|
-
const { overflowY } = getComputedStyle(p);
|
|
55
|
-
if (!/(auto|scroll)/.test(overflowY)) continue;
|
|
56
|
-
if (p.scrollHeight > p.clientHeight) return p;
|
|
57
|
-
}
|
|
58
|
-
return null;
|
|
59
|
-
};
|
|
60
|
-
var TRIGGER_GAP = 8;
|
|
61
|
-
var computePlacement = (triggerRect, popW, popH, clip) => {
|
|
62
|
-
const roomBelow = clip.bottom - triggerRect.bottom - TRIGGER_GAP;
|
|
63
|
-
const roomAbove = triggerRect.top - clip.top - TRIGGER_GAP;
|
|
64
|
-
let direction;
|
|
65
|
-
let top;
|
|
66
|
-
let maxHeight = null;
|
|
67
|
-
if (popH <= roomBelow) {
|
|
68
|
-
direction = "bottom";
|
|
69
|
-
top = triggerRect.bottom + TRIGGER_GAP;
|
|
70
|
-
} else if (popH <= roomAbove) {
|
|
71
|
-
direction = "top";
|
|
72
|
-
top = triggerRect.top - TRIGGER_GAP - popH;
|
|
73
|
-
} else {
|
|
74
|
-
const room = Math.max(roomBelow, roomAbove, 0);
|
|
75
|
-
if (roomBelow >= roomAbove) {
|
|
76
|
-
direction = "bottom";
|
|
77
|
-
top = triggerRect.bottom + TRIGGER_GAP;
|
|
78
|
-
} else {
|
|
79
|
-
direction = "top";
|
|
80
|
-
top = triggerRect.top - TRIGGER_GAP - room;
|
|
81
|
-
}
|
|
82
|
-
maxHeight = room;
|
|
83
|
-
}
|
|
84
|
-
let left = triggerRect.left;
|
|
85
|
-
if (left + popW > clip.right - 8) {
|
|
86
|
-
left = triggerRect.right - popW;
|
|
87
|
-
}
|
|
88
|
-
if (left < clip.left + 8) left = clip.left + 8;
|
|
89
|
-
return {
|
|
90
|
-
direction,
|
|
91
|
-
top,
|
|
92
|
-
left,
|
|
93
|
-
maxHeight
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
97
|
-
const directionRef = import_react.default.useRef("bottom");
|
|
98
|
-
const sizeRef = import_react.default.useRef(null);
|
|
99
|
-
const scrollParentRef = import_react.default.useRef(null);
|
|
100
|
-
const placedRef = import_react.default.useRef(false);
|
|
101
|
-
const frozenMaxRef = import_react.default.useRef(void 0);
|
|
102
|
-
const cssCapRef = import_react.default.useRef(void 0);
|
|
103
|
-
const calculatePosition = import_react.default.useCallback((remeasure = false) => {
|
|
104
|
-
const pop = popRef.current;
|
|
105
|
-
if (!triggerRef.current || !pop) return;
|
|
106
|
-
if (remeasure) frozenMaxRef.current = void 0;
|
|
107
|
-
if (cssCapRef.current === void 0) {
|
|
108
|
-
pop.style.maxHeight = "";
|
|
109
|
-
const raw = getComputedStyle(pop).maxHeight;
|
|
110
|
-
cssCapRef.current = raw === "none" ? null : Number.parseFloat(raw) || null;
|
|
111
|
-
}
|
|
112
|
-
if (remeasure || !sizeRef.current) {
|
|
113
|
-
sizeRef.current = {
|
|
114
|
-
w: pop.offsetWidth,
|
|
115
|
-
h: Math.max(pop.offsetHeight, pop.scrollHeight)
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
const { w: popW, h: popH } = sizeRef.current;
|
|
119
|
-
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
120
|
-
if (popH === 0 || popW === 0) {
|
|
121
|
-
sizeRef.current = null;
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const parentRect = scrollParentRef.current?.getBoundingClientRect();
|
|
125
|
-
const clip = {
|
|
126
|
-
top: Math.max(parentRect?.top ?? 0, 0),
|
|
127
|
-
bottom: Math.min(parentRect?.bottom ?? window.innerHeight, window.innerHeight),
|
|
128
|
-
left: Math.max(parentRect?.left ?? 0, 0),
|
|
129
|
-
right: Math.min(parentRect?.right ?? window.innerWidth, window.innerWidth)
|
|
130
|
-
};
|
|
131
|
-
const first = !placedRef.current;
|
|
132
|
-
if (first) pop.style.transition = "none";
|
|
133
|
-
const cap = cssCapRef.current;
|
|
134
|
-
const desiredH = cap == null ? popH : Math.min(popH, cap);
|
|
135
|
-
const frozen = frozenMaxRef.current;
|
|
136
|
-
const effectiveH = frozen == null ? desiredH : Math.min(desiredH, frozen);
|
|
137
|
-
const { direction: next, top, left, maxHeight: suggested } = computePlacement(
|
|
138
|
-
triggerRect,
|
|
139
|
-
popW,
|
|
140
|
-
effectiveH,
|
|
141
|
-
clip
|
|
142
|
-
);
|
|
143
|
-
if (frozenMaxRef.current === void 0) frozenMaxRef.current = suggested;
|
|
144
|
-
const maxHeight = frozenMaxRef.current;
|
|
145
|
-
const hostRect = (pop.offsetParent ?? pop.parentElement)?.getBoundingClientRect();
|
|
146
|
-
pop.style.top = `${top - (hostRect?.top ?? 0)}px`;
|
|
147
|
-
pop.style.left = `${left - (hostRect?.left ?? 0)}px`;
|
|
148
|
-
pop.style.maxHeight = maxHeight === null ? "" : `${maxHeight}px`;
|
|
149
|
-
directionRef.current = next;
|
|
150
|
-
pop.classList.toggle("top", next === "top");
|
|
151
|
-
pop.classList.toggle("bottom", next === "bottom");
|
|
152
|
-
if (first) {
|
|
153
|
-
void pop.offsetHeight;
|
|
154
|
-
pop.style.transition = "";
|
|
155
|
-
placedRef.current = true;
|
|
156
|
-
}
|
|
157
|
-
}, [triggerRef, popRef]);
|
|
158
|
-
import_react.default.useLayoutEffect(() => {
|
|
159
|
-
if (!enabled) {
|
|
160
|
-
sizeRef.current = null;
|
|
161
|
-
scrollParentRef.current = null;
|
|
162
|
-
placedRef.current = false;
|
|
163
|
-
frozenMaxRef.current = void 0;
|
|
164
|
-
cssCapRef.current = void 0;
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (triggerRef.current) {
|
|
168
|
-
scrollParentRef.current = findScrollParent(triggerRef.current);
|
|
169
|
-
}
|
|
170
|
-
calculatePosition(true);
|
|
171
|
-
const raf = requestAnimationFrame(() => calculatePosition(true));
|
|
172
|
-
return () => cancelAnimationFrame(raf);
|
|
173
|
-
}, [calculatePosition, enabled, triggerRef]);
|
|
174
|
-
import_react.default.useEffect(() => {
|
|
175
|
-
if (!enabled || !popRef.current) return;
|
|
176
|
-
const observer = new ResizeObserver(() => {
|
|
177
|
-
calculatePosition(true);
|
|
178
|
-
});
|
|
179
|
-
observer.observe(popRef.current);
|
|
180
|
-
return () => observer.disconnect();
|
|
181
|
-
}, [calculatePosition, enabled, popRef]);
|
|
182
|
-
import_react.default.useEffect(() => {
|
|
183
|
-
if (!enabled) return;
|
|
184
|
-
const onScroll = () => calculatePosition();
|
|
185
|
-
const onResize = () => calculatePosition(true);
|
|
186
|
-
window.addEventListener("resize", onResize, { passive: true });
|
|
187
|
-
window.addEventListener("scroll", onScroll, { passive: true, capture: true });
|
|
188
|
-
return () => {
|
|
189
|
-
window.removeEventListener("resize", onResize);
|
|
190
|
-
window.removeEventListener("scroll", onScroll, true);
|
|
191
|
-
};
|
|
192
|
-
}, [calculatePosition, enabled]);
|
|
193
|
-
};
|
|
194
|
-
var useAutoPosition_default = useAutoPosition;
|
|
195
|
-
|
|
196
|
-
// src/tokens/hooks/useClickOutside.ts
|
|
197
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
198
|
-
var useClickOutside = (refs, handler, enabled = true) => {
|
|
199
|
-
import_react2.default.useEffect(() => {
|
|
200
|
-
if (!enabled) return;
|
|
201
|
-
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
202
|
-
const listener = (event) => {
|
|
203
|
-
const target = event.target;
|
|
204
|
-
const isInside = refArray.some(
|
|
205
|
-
(ref) => ref.current && ref.current.contains(target)
|
|
206
|
-
);
|
|
207
|
-
if (!isInside) {
|
|
208
|
-
handler();
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
document.addEventListener("mousedown", listener);
|
|
212
|
-
document.addEventListener("touchstart", listener);
|
|
213
|
-
return () => {
|
|
214
|
-
document.removeEventListener("mousedown", listener);
|
|
215
|
-
document.removeEventListener("touchstart", listener);
|
|
216
|
-
};
|
|
217
|
-
}, [refs, handler, enabled]);
|
|
218
|
-
};
|
|
219
|
-
var useClickOutside_default = useClickOutside;
|
|
220
|
-
|
|
221
|
-
// src/tokens/hooks/useOverlayHost.ts
|
|
222
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
223
|
-
var useOverlayHost = (triggerRef, enabled) => {
|
|
224
|
-
const [host, setHost] = import_react3.default.useState(null);
|
|
225
|
-
import_react3.default.useLayoutEffect(() => {
|
|
226
|
-
if (!enabled || !triggerRef.current) {
|
|
227
|
-
setHost(null);
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
const el = document.createElement("div");
|
|
231
|
-
el.dataset.xplatOverlayHost = "";
|
|
232
|
-
el.style.position = "relative";
|
|
233
|
-
el.style.width = "0";
|
|
234
|
-
el.style.height = "0";
|
|
235
|
-
const parent = findScrollParent(triggerRef.current) ?? document.body;
|
|
236
|
-
parent.appendChild(el);
|
|
237
|
-
setHost(el);
|
|
238
|
-
return () => {
|
|
239
|
-
el.remove();
|
|
240
|
-
setHost(null);
|
|
241
|
-
};
|
|
242
|
-
}, [enabled, triggerRef]);
|
|
243
|
-
return host;
|
|
244
|
-
};
|
|
245
|
-
var useOverlayHost_default = useOverlayHost;
|
|
246
|
-
|
|
247
|
-
// src/tokens/hooks/useOverlayKeyboard.ts
|
|
248
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
249
|
-
var FOCUSABLE = [
|
|
250
|
-
"a[href]",
|
|
251
|
-
"button:not([disabled])",
|
|
252
|
-
"input:not([disabled]):not([type='hidden'])",
|
|
253
|
-
"select:not([disabled])",
|
|
254
|
-
"textarea:not([disabled])",
|
|
255
|
-
"[tabindex]:not([tabindex='-1'])"
|
|
256
|
-
].join(",");
|
|
257
|
-
var useEscapeKey = (enabled, onEscape) => {
|
|
258
|
-
import_react4.default.useEffect(() => {
|
|
259
|
-
if (!enabled) return;
|
|
260
|
-
const onKey = (e) => {
|
|
261
|
-
if (e.key !== "Escape") return;
|
|
262
|
-
if (e.defaultPrevented) return;
|
|
263
|
-
e.preventDefault();
|
|
264
|
-
onEscape();
|
|
265
|
-
};
|
|
266
|
-
document.addEventListener("keydown", onKey);
|
|
267
|
-
return () => document.removeEventListener("keydown", onKey);
|
|
268
|
-
}, [enabled, onEscape]);
|
|
269
|
-
};
|
|
270
|
-
var useCloseWhenFocusHidden = (enabled, triggerRef, popRef, onClose) => {
|
|
271
|
-
const onCloseRef = import_react4.default.useRef(onClose);
|
|
272
|
-
onCloseRef.current = onClose;
|
|
273
|
-
import_react4.default.useEffect(() => {
|
|
274
|
-
const trigger = triggerRef.current;
|
|
275
|
-
if (!enabled || !trigger) return;
|
|
276
|
-
const observer = new IntersectionObserver(
|
|
277
|
-
([entry]) => {
|
|
278
|
-
if (entry.isIntersecting) return;
|
|
279
|
-
if (!popRef.current?.contains(document.activeElement)) return;
|
|
280
|
-
onCloseRef.current();
|
|
281
|
-
trigger.focus({ preventScroll: true });
|
|
282
|
-
},
|
|
283
|
-
// 그릇이 없으면 root: null → 뷰포트 기준
|
|
284
|
-
{ root: findScrollParent(trigger), threshold: 0 }
|
|
285
|
-
);
|
|
286
|
-
observer.observe(trigger);
|
|
287
|
-
return () => observer.disconnect();
|
|
288
|
-
}, [enabled, triggerRef, popRef]);
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
// ../../node_modules/clsx/dist/clsx.mjs
|
|
292
|
-
function r(e) {
|
|
293
|
-
var t, f, n = "";
|
|
294
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
295
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
296
|
-
var o = e.length;
|
|
297
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
298
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
299
|
-
return n;
|
|
300
|
-
}
|
|
301
|
-
function clsx() {
|
|
302
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
303
|
-
return n;
|
|
304
|
-
}
|
|
305
|
-
var clsx_default = clsx;
|
|
306
|
-
|
|
307
|
-
// src/tokens/svg/status/ErrorIcon.tsx
|
|
308
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
309
|
-
var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
310
|
-
"svg",
|
|
311
|
-
{
|
|
312
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
313
|
-
width: "1em",
|
|
314
|
-
height: "1em",
|
|
315
|
-
viewBox: "0 0 16 16",
|
|
316
|
-
fill: "none",
|
|
317
|
-
children: [
|
|
318
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { clipPath: "url(#clip0_1196_9603)", children: [
|
|
319
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
320
|
-
"path",
|
|
321
|
-
{
|
|
322
|
-
d: "M9.57588 5.57559C9.81019 5.34127 10.19 5.34127 10.4243 5.57559C10.6586 5.8099 10.6586 6.18971 10.4243 6.42402L8.84854 7.9998L10.4243 9.57559C10.6586 9.8099 10.6586 10.1897 10.4243 10.424C10.19 10.6583 9.81019 10.6583 9.57588 10.424L8.0001 8.84824L6.42432 10.424C6.19 10.6583 5.81019 10.6583 5.57588 10.424C5.34156 10.1897 5.34156 9.8099 5.57588 9.57559L7.15166 7.9998L5.57588 6.42402C5.34156 6.18971 5.34156 5.8099 5.57588 5.57559C5.81019 5.34127 6.19 5.34127 6.42432 5.57559L8.0001 7.15137L9.57588 5.57559Z",
|
|
323
|
-
fill: "currentColor"
|
|
324
|
-
}
|
|
325
|
-
),
|
|
326
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
327
|
-
"path",
|
|
328
|
-
{
|
|
329
|
-
fillRule: "evenodd",
|
|
330
|
-
clipRule: "evenodd",
|
|
331
|
-
d: "M8.0001 0.733398C12.0131 0.73361 15.2671 3.98679 15.2673 7.9998C15.2672 12.0129 12.0131 15.2668 8.0001 15.267C3.98701 15.2669 0.733016 12.0129 0.73291 7.9998C0.733051 3.98674 3.98704 0.733539 8.0001 0.733398ZM8.0001 1.9334C4.64978 1.93354 1.93383 4.64948 1.93369 7.9998C1.9338 11.3502 4.64975 14.0669 8.0001 14.067C11.3504 14.0668 14.0672 11.3501 14.0673 7.9998C14.0671 4.64953 11.3504 1.93361 8.0001 1.9334Z",
|
|
332
|
-
fill: "currentColor"
|
|
333
|
-
}
|
|
334
|
-
)
|
|
335
|
-
] }),
|
|
336
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", { id: "clip0_1196_9603", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
337
|
-
]
|
|
338
|
-
}
|
|
339
|
-
);
|
|
340
|
-
var ErrorIcon_default = ErrorIcon;
|
|
341
|
-
|
|
342
|
-
// src/tokens/svg/status/InfoIcon.tsx
|
|
343
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
344
|
-
var InfoIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
345
|
-
"svg",
|
|
346
|
-
{
|
|
347
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
348
|
-
width: "1em",
|
|
349
|
-
height: "1em",
|
|
350
|
-
viewBox: "0 0 16 16",
|
|
351
|
-
fill: "none",
|
|
352
|
-
children: [
|
|
353
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { clipPath: "url(#clip0_1188_11261)", children: [
|
|
354
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
355
|
-
"path",
|
|
356
|
-
{
|
|
357
|
-
d: "M8.00156 7.39999C8.33293 7.39999 8.60156 7.66862 8.60156 7.99999V10.6664C8.60156 10.9978 8.33293 11.2664 8.00156 11.2664C7.67019 11.2664 7.40156 10.9978 7.40156 10.6664V7.99999C7.40156 7.66862 7.67019 7.39999 8.00156 7.39999Z",
|
|
358
|
-
fill: "currentColor"
|
|
359
|
-
}
|
|
360
|
-
),
|
|
361
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
362
|
-
"path",
|
|
363
|
-
{
|
|
364
|
-
d: "M8.00859 4.73358C8.3398 4.73378 8.60859 5.00233 8.60859 5.33358C8.60849 5.66474 8.33973 5.93338 8.00859 5.93358H8.00156C7.67026 5.93358 7.40167 5.66486 7.40156 5.33358C7.40156 5.00221 7.67019 4.73358 8.00156 4.73358H8.00859Z",
|
|
365
|
-
fill: "currentColor"
|
|
366
|
-
}
|
|
367
|
-
),
|
|
368
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
369
|
-
"path",
|
|
370
|
-
{
|
|
371
|
-
fillRule: "evenodd",
|
|
372
|
-
clipRule: "evenodd",
|
|
373
|
-
d: "M8.00156 0.733582C12.0146 0.733793 15.2686 3.98697 15.2688 7.99999C15.2686 12.013 12.0146 15.267 8.00156 15.2672C3.98848 15.267 0.734481 12.0131 0.734375 7.99999C0.734516 3.98693 3.9885 0.733722 8.00156 0.733582ZM8.00156 1.93358C4.65124 1.93372 1.9353 4.64967 1.93516 7.99999C1.93526 11.3503 4.65122 14.067 8.00156 14.0672C11.3518 14.067 14.0686 11.3503 14.0688 7.99999C14.0686 4.64971 11.3518 1.93379 8.00156 1.93358Z",
|
|
374
|
-
fill: "currentColor"
|
|
375
|
-
}
|
|
376
|
-
)
|
|
377
|
-
] }),
|
|
378
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("clipPath", { id: "clip0_1188_11261", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
379
|
-
]
|
|
380
|
-
}
|
|
381
|
-
);
|
|
382
|
-
var InfoIcon_default = InfoIcon;
|
|
383
|
-
|
|
384
|
-
// src/tokens/svg/status/SuccessIcon.tsx
|
|
385
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
386
|
-
var SuccessIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
387
|
-
"svg",
|
|
388
|
-
{
|
|
389
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
390
|
-
width: "1em",
|
|
391
|
-
height: "1em",
|
|
392
|
-
viewBox: "0 0 16 16",
|
|
393
|
-
fill: "none",
|
|
394
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
395
|
-
"path",
|
|
396
|
-
{
|
|
397
|
-
d: "M12.9084 3.57597C13.1426 3.34172 13.5225 3.34185 13.7568 3.57597C13.9911 3.81028 13.9911 4.19009 13.7568 4.4244L6.424 11.758C6.31157 11.8703 6.15869 11.9337 5.99978 11.9338C5.8409 11.9337 5.68798 11.8703 5.57556 11.758L2.24197 8.4244C2.00782 8.19018 2.00795 7.81028 2.24197 7.57597C2.47626 7.34167 2.85609 7.34172 3.09041 7.57597L5.999 10.4846L12.9084 3.57597Z",
|
|
398
|
-
fill: "currentColor"
|
|
399
|
-
}
|
|
400
|
-
)
|
|
401
|
-
}
|
|
402
|
-
);
|
|
403
|
-
var SuccessIcon_default = SuccessIcon;
|
|
404
|
-
|
|
405
|
-
// src/components/FieldMessage/FieldMessage.tsx
|
|
406
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
407
|
-
var ICON = {
|
|
408
|
-
default: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
|
|
409
|
-
success: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SuccessIcon_default, {}),
|
|
410
|
-
warning: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
|
|
411
|
-
error: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorIcon_default, {})
|
|
412
|
-
};
|
|
413
|
-
var FieldMessage = (props) => {
|
|
414
|
-
const { validations } = props;
|
|
415
|
-
if (!validations || validations.length === 0) return null;
|
|
416
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
417
|
-
"div",
|
|
418
|
-
{
|
|
419
|
-
className: clsx_default("lib-xplat-field-message", v.status),
|
|
420
|
-
children: [
|
|
421
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "icon", children: ICON[v.status] }),
|
|
422
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: v.message })
|
|
423
|
-
]
|
|
424
|
-
},
|
|
425
|
-
`${v.message}_${idx}`
|
|
426
|
-
)) });
|
|
427
|
-
};
|
|
428
|
-
FieldMessage.displayName = "FieldMessage";
|
|
429
|
-
var Field = (props) => {
|
|
430
|
-
const { label, required = false, htmlFor, labelId, validations, children } = props;
|
|
431
|
-
const hasMessages = !!validations && validations.length > 0;
|
|
432
|
-
if (!label && !hasMessages) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
|
|
433
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
434
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "lib-xplat-field-label", id: labelId, htmlFor, children: [
|
|
435
|
-
label,
|
|
436
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "required", "aria-hidden": "true", children: "*" })
|
|
437
|
-
] }),
|
|
438
|
-
children,
|
|
439
|
-
hasMessages && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
|
|
440
|
-
] });
|
|
441
|
-
};
|
|
442
|
-
Field.displayName = "Field";
|
|
443
|
-
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
444
|
-
|
|
445
|
-
// src/components/TimePicker/TimePicker.tsx
|
|
446
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
447
|
-
var ANIMATION_DURATION_MS = 200;
|
|
448
|
-
var toMinutes = (hhmm) => {
|
|
449
|
-
if (!hhmm) return null;
|
|
450
|
-
const m = /^(\d{1,2}):(\d{2})$/.exec(hhmm.trim());
|
|
451
|
-
if (!m) return null;
|
|
452
|
-
const h = Number(m[1]);
|
|
453
|
-
const min = Number(m[2]);
|
|
454
|
-
if (h > 23 || min > 59) return null;
|
|
455
|
-
return h * 60 + min;
|
|
456
|
-
};
|
|
457
|
-
var toHHmm = (minutes) => `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}`;
|
|
458
|
-
var display = (hhmm, use12Hours) => {
|
|
459
|
-
if (!use12Hours) return hhmm;
|
|
460
|
-
const total = toMinutes(hhmm);
|
|
461
|
-
if (total === null) return hhmm;
|
|
462
|
-
const h24 = Math.floor(total / 60);
|
|
463
|
-
const mm = String(total % 60).padStart(2, "0");
|
|
464
|
-
const period = h24 < 12 ? "\uC624\uC804" : "\uC624\uD6C4";
|
|
465
|
-
const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
|
|
466
|
-
return `${period} ${h12}:${mm}`;
|
|
467
|
-
};
|
|
468
|
-
var TimePicker = (props) => {
|
|
469
|
-
const {
|
|
470
|
-
value,
|
|
471
|
-
onChange,
|
|
472
|
-
step = 30,
|
|
473
|
-
min,
|
|
474
|
-
max,
|
|
475
|
-
use12Hours = false,
|
|
476
|
-
placeholder = "\uC2DC\uAC01 \uC120\uD0DD",
|
|
477
|
-
disabled = false,
|
|
478
|
-
size = "md",
|
|
479
|
-
label,
|
|
480
|
-
required,
|
|
481
|
-
validations
|
|
482
|
-
} = props;
|
|
483
|
-
const fieldId = import_react5.default.useId();
|
|
484
|
-
const triggerRef = import_react5.default.useRef(null);
|
|
485
|
-
const contentRef = import_react5.default.useRef(null);
|
|
486
|
-
const [isOpen, setOpen] = import_react5.default.useState(false);
|
|
487
|
-
const [mounted, setMounted] = import_react5.default.useState(false);
|
|
488
|
-
const [visible, setVisible] = import_react5.default.useState(false);
|
|
489
|
-
const options = import_react5.default.useMemo(() => {
|
|
490
|
-
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
491
|
-
const lo = toMinutes(min) ?? 0;
|
|
492
|
-
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
493
|
-
const out = [];
|
|
494
|
-
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
495
|
-
return out;
|
|
496
|
-
}, [step, min, max]);
|
|
497
|
-
const close = import_react5.default.useCallback(() => setOpen(false), []);
|
|
498
|
-
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
499
|
-
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
500
|
-
useEscapeKey(isOpen, () => {
|
|
501
|
-
close();
|
|
502
|
-
triggerRef.current?.focus({ preventScroll: true });
|
|
503
|
-
});
|
|
504
|
-
const host = useOverlayHost_default(triggerRef, mounted);
|
|
505
|
-
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
506
|
-
import_react5.default.useEffect(() => {
|
|
507
|
-
if (disabled && isOpen) setOpen(false);
|
|
508
|
-
}, [disabled, isOpen]);
|
|
509
|
-
import_react5.default.useEffect(() => {
|
|
510
|
-
if (isOpen) {
|
|
511
|
-
setMounted(true);
|
|
512
|
-
const t2 = setTimeout(() => setVisible(true), 1);
|
|
513
|
-
return () => clearTimeout(t2);
|
|
514
|
-
}
|
|
515
|
-
setVisible(false);
|
|
516
|
-
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS);
|
|
517
|
-
return () => clearTimeout(t);
|
|
518
|
-
}, [isOpen]);
|
|
519
|
-
const pick = (hhmm) => {
|
|
520
|
-
onChange?.(hhmm);
|
|
521
|
-
close();
|
|
522
|
-
triggerRef.current?.focus({ preventScroll: true });
|
|
523
|
-
};
|
|
524
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: clsx_default("lib-xplat-time-picker", size, disabled && "disabled"), children: [
|
|
525
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
526
|
-
"div",
|
|
527
|
-
{
|
|
528
|
-
id: fieldId,
|
|
529
|
-
ref: triggerRef,
|
|
530
|
-
className: clsx_default("time-picker-trigger", hasError(validations) && "error"),
|
|
531
|
-
role: "combobox",
|
|
532
|
-
"aria-expanded": isOpen,
|
|
533
|
-
"aria-haspopup": "listbox",
|
|
534
|
-
"aria-invalid": hasError(validations) || void 0,
|
|
535
|
-
tabIndex: disabled ? void 0 : 0,
|
|
536
|
-
onClick: () => !disabled && setOpen((p) => !p),
|
|
537
|
-
onKeyDown: (e) => {
|
|
538
|
-
if (disabled) return;
|
|
539
|
-
if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
|
|
540
|
-
e.preventDefault();
|
|
541
|
-
setOpen(true);
|
|
542
|
-
}
|
|
543
|
-
},
|
|
544
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: clsx_default("time-picker-value", !value && "placeholder"), children: value ? display(value, use12Hours) : placeholder })
|
|
545
|
-
}
|
|
546
|
-
),
|
|
547
|
-
mounted && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Portal_default, { container: host, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
548
|
-
"div",
|
|
549
|
-
{
|
|
550
|
-
ref: contentRef,
|
|
551
|
-
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
552
|
-
style: { width: triggerRef.current?.offsetWidth },
|
|
553
|
-
role: "listbox",
|
|
554
|
-
children: options.map((t) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
555
|
-
"div",
|
|
556
|
-
{
|
|
557
|
-
className: clsx_default("time-picker-item", t === value && "is-selected"),
|
|
558
|
-
role: "option",
|
|
559
|
-
"aria-selected": t === value,
|
|
560
|
-
tabIndex: 0,
|
|
561
|
-
onClick: () => pick(t),
|
|
562
|
-
onKeyDown: (e) => {
|
|
563
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
564
|
-
e.preventDefault();
|
|
565
|
-
pick(t);
|
|
566
|
-
}
|
|
567
|
-
},
|
|
568
|
-
children: display(t, use12Hours)
|
|
569
|
-
},
|
|
570
|
-
t
|
|
571
|
-
))
|
|
572
|
-
}
|
|
573
|
-
) })
|
|
574
|
-
] });
|
|
575
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Field, { validations, label, required, htmlFor: fieldId, children: control });
|
|
576
|
-
};
|
|
577
|
-
TimePicker.displayName = "TimePicker";
|
|
578
|
-
var TimePicker_default = TimePicker;
|
|
579
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
580
|
-
0 && (module.exports = {
|
|
581
|
-
TimePicker
|
|
582
|
-
});
|
|
12
|
+
exports.TimePicker = _chunkKUJH72U6cjs.TimePicker_default;
|