@fangxinyan/lumina 0.6.13 → 0.6.15

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.
Files changed (239) hide show
  1. package/dist/Alert.cjs +3 -3
  2. package/dist/Alert.js +2 -2
  3. package/dist/AppShell.cjs +5 -5
  4. package/dist/AppShell.js +1 -1
  5. package/dist/AutoComplete.cjs +5 -5
  6. package/dist/AutoComplete.js +4 -4
  7. package/dist/Avatar.cjs +2 -2
  8. package/dist/Avatar.js +1 -1
  9. package/dist/Badge.cjs +2 -2
  10. package/dist/Badge.js +1 -1
  11. package/dist/Button.cjs +4 -4
  12. package/dist/Button.js +2 -2
  13. package/dist/{Calendar-RUTPKREW.css → Calendar-I6NHCXIB.css} +65 -0
  14. package/dist/Calendar.cjs +3 -3
  15. package/dist/Calendar.d.cts +2 -0
  16. package/dist/Calendar.d.ts +2 -0
  17. package/dist/Calendar.js +2 -2
  18. package/dist/Card.cjs +3 -3
  19. package/dist/Card.js +2 -2
  20. package/dist/Cascader.cjs +5 -5
  21. package/dist/Cascader.js +4 -4
  22. package/dist/Checkbox.cjs +3 -3
  23. package/dist/Checkbox.js +2 -2
  24. package/dist/Collapse.cjs +3 -3
  25. package/dist/Collapse.js +2 -2
  26. package/dist/ColorPicker.cjs +2 -2
  27. package/dist/ColorPicker.js +1 -1
  28. package/dist/CommandPalette.cjs +5 -5
  29. package/dist/CommandPalette.js +4 -4
  30. package/dist/ContextMenu.cjs +2 -2
  31. package/dist/ContextMenu.js +1 -1
  32. package/dist/DatePicker-VDVSIARF.css +60 -0
  33. package/dist/DatePicker.cjs +16 -0
  34. package/dist/DatePicker.d.cts +49 -0
  35. package/dist/DatePicker.d.ts +49 -0
  36. package/dist/DatePicker.js +7 -0
  37. package/dist/DateTimePicker-77ZLZIWO.css +224 -0
  38. package/dist/DateTimePicker.cjs +16 -0
  39. package/dist/DateTimePicker.d.cts +61 -0
  40. package/dist/DateTimePicker.d.ts +61 -0
  41. package/dist/DateTimePicker.js +7 -0
  42. package/dist/Divider.cjs +2 -2
  43. package/dist/Divider.js +1 -1
  44. package/dist/{Drawer-7N3URAJ6.css → Drawer-7KICRM4L.css} +1 -1
  45. package/dist/Drawer.cjs +3 -3
  46. package/dist/Drawer.d.cts +4 -0
  47. package/dist/Drawer.d.ts +4 -0
  48. package/dist/Drawer.js +2 -2
  49. package/dist/Empty.cjs +2 -2
  50. package/dist/Empty.js +1 -1
  51. package/dist/Form.cjs +4 -4
  52. package/dist/Form.js +1 -1
  53. package/dist/Icon.cjs +49 -49
  54. package/dist/Icon.js +1 -1
  55. package/dist/{Image-SGSRTHQX.css → Image-TDCXJISG.css} +1 -1
  56. package/dist/Image.cjs +6 -6
  57. package/dist/Image.d.cts +4 -0
  58. package/dist/Image.d.ts +4 -0
  59. package/dist/Image.js +2 -2
  60. package/dist/Input.cjs +5 -5
  61. package/dist/Input.js +3 -3
  62. package/dist/InputNumber.cjs +5 -5
  63. package/dist/InputNumber.js +4 -4
  64. package/dist/List.cjs +2 -2
  65. package/dist/List.js +1 -1
  66. package/dist/Message.cjs +6 -6
  67. package/dist/Message.js +2 -2
  68. package/dist/{Modal-MCFDYVUQ.css → Modal-ZFWNFEA5.css} +1 -1
  69. package/dist/Modal.cjs +4 -4
  70. package/dist/Modal.d.cts +4 -0
  71. package/dist/Modal.d.ts +4 -0
  72. package/dist/Modal.js +3 -3
  73. package/dist/Pagination.cjs +7 -7
  74. package/dist/Pagination.js +6 -6
  75. package/dist/Popover.cjs +2 -2
  76. package/dist/Popover.js +1 -1
  77. package/dist/Progress.cjs +2 -2
  78. package/dist/Progress.js +1 -1
  79. package/dist/Radio.cjs +3 -3
  80. package/dist/Radio.js +1 -1
  81. package/dist/Select.cjs +6 -6
  82. package/dist/Select.js +5 -5
  83. package/dist/Skeleton.cjs +2 -2
  84. package/dist/Skeleton.js +1 -1
  85. package/dist/Slider.cjs +2 -2
  86. package/dist/Slider.js +1 -1
  87. package/dist/Spin.cjs +2 -2
  88. package/dist/Spin.js +1 -1
  89. package/dist/Splitter.cjs +2 -2
  90. package/dist/Splitter.js +1 -1
  91. package/dist/StatusBar.cjs +3 -3
  92. package/dist/StatusBar.js +1 -1
  93. package/dist/Surface.cjs +4 -4
  94. package/dist/Surface.js +2 -2
  95. package/dist/Switch.cjs +2 -2
  96. package/dist/Switch.js +1 -1
  97. package/dist/Table.cjs +9 -9
  98. package/dist/Table.js +8 -8
  99. package/dist/TablePro.cjs +10 -10
  100. package/dist/TablePro.js +9 -9
  101. package/dist/Tabs.cjs +2 -2
  102. package/dist/Tabs.js +1 -1
  103. package/dist/Tag.cjs +3 -3
  104. package/dist/Tag.js +2 -2
  105. package/dist/Textarea.cjs +4 -4
  106. package/dist/Textarea.js +2 -2
  107. package/dist/Theme.cjs +11 -11
  108. package/dist/Theme.js +1 -1
  109. package/dist/ThemePanel.cjs +13 -13
  110. package/dist/ThemePanel.js +10 -10
  111. package/dist/TimePicker-6URACYEH.css +151 -0
  112. package/dist/TimePicker.cjs +15 -0
  113. package/dist/TimePicker.d.cts +63 -0
  114. package/dist/TimePicker.d.ts +63 -0
  115. package/dist/TimePicker.js +6 -0
  116. package/dist/Timeline.cjs +3 -3
  117. package/dist/Timeline.js +2 -2
  118. package/dist/Tooltip.cjs +2 -2
  119. package/dist/Tooltip.js +1 -1
  120. package/dist/Typography.cjs +7 -7
  121. package/dist/Typography.js +2 -2
  122. package/dist/{chunk-J7VYTDFN.cjs → chunk-262ED6WQ.cjs} +3 -3
  123. package/dist/chunk-26AJ7OY3.cjs +505 -0
  124. package/dist/{chunk-BX45WJRT.js → chunk-3VSHGM54.js} +9 -9
  125. package/dist/{chunk-KRVWQKTZ.js → chunk-3VXGZ3SJ.js} +3 -3
  126. package/dist/{chunk-VJVXXCNL.js → chunk-4HJBF4GY.js} +3 -3
  127. package/dist/chunk-4KDABJSY.cjs +241 -0
  128. package/dist/{chunk-ONHYDQFP.cjs → chunk-4TTRHEGM.cjs} +3 -3
  129. package/dist/{chunk-GVULVTWO.js → chunk-4YSGGZDB.js} +4 -4
  130. package/dist/{chunk-HNP7KEQP.cjs → chunk-5A6KSYWA.cjs} +1 -1
  131. package/dist/{chunk-RFFP6J6O.cjs → chunk-5ERD3W24.cjs} +4 -4
  132. package/dist/{chunk-TTXYZDQ3.js → chunk-5MOYKVB7.js} +2 -2
  133. package/dist/{chunk-X2NY3YQS.cjs → chunk-5QEI7GGA.cjs} +6 -6
  134. package/dist/{chunk-O7OPFKAM.js → chunk-6HF6UF73.js} +2 -2
  135. package/dist/{chunk-DCATZUT3.js → chunk-6K5YI4ZE.js} +2 -2
  136. package/dist/{chunk-EVKLGNVR.js → chunk-6LC4QROE.js} +3 -3
  137. package/dist/{chunk-6Z4PZWND.js → chunk-6LN4VVX7.js} +2 -2
  138. package/dist/{chunk-7RNT6KN4.js → chunk-6MEOLYNQ.js} +1 -1
  139. package/dist/{chunk-UMLRSKBE.js → chunk-6PHPRZTT.js} +4 -4
  140. package/dist/{chunk-4VPRY4EM.cjs → chunk-6Q76VLCE.cjs} +3 -3
  141. package/dist/{chunk-SWMQ2GKT.cjs → chunk-7IO3EOHN.cjs} +3 -3
  142. package/dist/{chunk-B55XILNY.cjs → chunk-7QXP6DXC.cjs} +4 -4
  143. package/dist/{chunk-56GNNOOT.cjs → chunk-7YJV45U6.cjs} +11 -11
  144. package/dist/{chunk-AJ44ZLJY.cjs → chunk-A4Z7PLHV.cjs} +59 -59
  145. package/dist/{chunk-RUE3QE6T.js → chunk-A6O25EP2.js} +2 -2
  146. package/dist/{chunk-ZNR6LWTQ.js → chunk-AAPZLBHQ.js} +1 -1
  147. package/dist/{chunk-Q4IAUKAW.js → chunk-ARUPS7JH.js} +2 -2
  148. package/dist/{chunk-VAOAAWGI.cjs → chunk-ATUPFAPZ.cjs} +3 -3
  149. package/dist/{chunk-GKBCXYDF.cjs → chunk-BNY2NVTL.cjs} +3 -3
  150. package/dist/{chunk-7J26GI3T.cjs → chunk-BT2RXFT4.cjs} +15 -13
  151. package/dist/{chunk-WY6AEPFW.js → chunk-BVQOJKRX.js} +8 -6
  152. package/dist/{chunk-QPZCDZWI.cjs → chunk-BW76ENTW.cjs} +1 -1
  153. package/dist/{chunk-EKNDL2XB.js → chunk-CFZVWY5N.js} +2 -2
  154. package/dist/chunk-CUBKHQ63.js +483 -0
  155. package/dist/chunk-CYBBUXUK.cjs +415 -0
  156. package/dist/{chunk-JST4HJ3I.js → chunk-D7GK6H6V.js} +1 -1
  157. package/dist/{chunk-T7RV2UMU.js → chunk-DSLYWX4O.js} +1 -1
  158. package/dist/{chunk-JKFGLYMM.js → chunk-EQ4FPOQQ.js} +14 -4
  159. package/dist/{chunk-ZZH4UIPN.cjs → chunk-ES7AWMNH.cjs} +1 -1
  160. package/dist/{chunk-ZLMJVSBO.cjs → chunk-FDUQPAQE.cjs} +1 -1
  161. package/dist/{chunk-HHBXCBZP.js → chunk-FDZG27IG.js} +1 -1
  162. package/dist/chunk-FKP5D5IS.js +271 -0
  163. package/dist/{chunk-EEHZRPPF.cjs → chunk-FQJY4D3T.cjs} +1 -1
  164. package/dist/{chunk-LA62SD2F.js → chunk-FYSXJXNW.js} +1 -1
  165. package/dist/{chunk-DEXYWDHF.js → chunk-GNV6W4BN.js} +1 -1
  166. package/dist/{chunk-NZBOHEQA.js → chunk-HBO7ZDEQ.js} +1 -1
  167. package/dist/{chunk-BAWP2QVY.js → chunk-I777JTTG.js} +1 -1
  168. package/dist/chunk-I7TOBKJO.js +219 -0
  169. package/dist/{chunk-IZGHMMX7.js → chunk-IOAOG5L7.js} +3 -3
  170. package/dist/{chunk-QQROR2RU.cjs → chunk-IOUAZYK2.cjs} +1 -1
  171. package/dist/{chunk-CQKQ7KS2.js → chunk-IPSNC5VZ.js} +2 -2
  172. package/dist/{chunk-7X7FXV5E.cjs → chunk-IVFVLRWJ.cjs} +14 -14
  173. package/dist/{chunk-LM5XXSGE.js → chunk-IZHH6CVY.js} +1 -1
  174. package/dist/{chunk-GGNBMIZ2.js → chunk-JFL2WMJZ.js} +2 -2
  175. package/dist/{chunk-XRIXQM3Z.cjs → chunk-JMFHL7GN.cjs} +1 -1
  176. package/dist/chunk-KHRYPNUV.cjs +293 -0
  177. package/dist/{chunk-LFPFFSN2.js → chunk-KMPFESEV.js} +1 -1
  178. package/dist/{chunk-TAHZH6DJ.js → chunk-KYV75JPQ.js} +1 -1
  179. package/dist/{chunk-2A2XM7D5.cjs → chunk-LEMMFFEY.cjs} +4 -4
  180. package/dist/{chunk-MZIZGYA4.cjs → chunk-M4NJTJKV.cjs} +1 -1
  181. package/dist/{chunk-HYXA7S43.js → chunk-MOZ52KN6.js} +1 -1
  182. package/dist/{chunk-E5MSFY5H.cjs → chunk-MPOO5VPW.cjs} +1 -1
  183. package/dist/{chunk-MPJLGYFV.cjs → chunk-MYW7LNB2.cjs} +1 -1
  184. package/dist/chunk-N7CHFKRS.js +393 -0
  185. package/dist/{chunk-VBTASJ3Y.cjs → chunk-N7OQNSII.cjs} +1 -1
  186. package/dist/{chunk-VGERRI4S.js → chunk-OTSDPQPV.js} +2 -2
  187. package/dist/{chunk-7NAN7OVX.cjs → chunk-P2OQTJZP.cjs} +1 -1
  188. package/dist/{chunk-HAA5C5YW.js → chunk-P64NPZBG.js} +2 -2
  189. package/dist/{chunk-QP6RNHGR.cjs → chunk-PBT4UKPL.cjs} +3 -3
  190. package/dist/{chunk-FUR5SDP7.cjs → chunk-PKNRTFNE.cjs} +1 -1
  191. package/dist/{chunk-FPXBY2MY.cjs → chunk-POU3W5J3.cjs} +1 -1
  192. package/dist/{chunk-SOY3LB7W.cjs → chunk-PSQ3HNZP.cjs} +1 -1
  193. package/dist/{chunk-BK4XKZUO.js → chunk-PU7VXDAS.js} +1 -1
  194. package/dist/{chunk-OCQC2ZSV.cjs → chunk-QMX67CVT.cjs} +1 -1
  195. package/dist/{chunk-R3JCW3ES.js → chunk-QNN3YV2P.js} +2 -2
  196. package/dist/{chunk-V5HMQGFD.js → chunk-R3DTXVP2.js} +1 -1
  197. package/dist/{chunk-EQGNKCBY.cjs → chunk-RFI5R42I.cjs} +4 -4
  198. package/dist/{chunk-FROWMHDP.cjs → chunk-RMFSX7DO.cjs} +18 -8
  199. package/dist/{chunk-TCWGIRAW.js → chunk-RR2BKV65.js} +1 -1
  200. package/dist/{chunk-YHFGMI7T.cjs → chunk-RSSOX4RQ.cjs} +8 -8
  201. package/dist/{chunk-3XV4LGQ7.cjs → chunk-RZEFKXL3.cjs} +3 -3
  202. package/dist/{chunk-GDWAQGOH.cjs → chunk-S2ZGXBUH.cjs} +1 -1
  203. package/dist/{chunk-M63HWVOS.js → chunk-S7IHWY24.js} +2 -2
  204. package/dist/{chunk-NLX2RB4L.cjs → chunk-SOQ56ZI2.cjs} +1 -1
  205. package/dist/{chunk-RV37BGW3.cjs → chunk-SW2HMNCA.cjs} +4 -4
  206. package/dist/{chunk-UVL5SIAQ.cjs → chunk-TBNPJPYG.cjs} +1 -1
  207. package/dist/{chunk-QVWCUKEY.js → chunk-TJECLLN4.js} +1 -1
  208. package/dist/{chunk-E2OC4CUE.js → chunk-TYLDISRK.js} +1 -1
  209. package/dist/{chunk-23HN42SP.cjs → chunk-ULUD3FED.cjs} +9 -6
  210. package/dist/{chunk-LINUXKS7.cjs → chunk-V5KUC5VH.cjs} +1 -1
  211. package/dist/{chunk-U2543OZS.cjs → chunk-VA2I7ZAL.cjs} +1 -1
  212. package/dist/{chunk-7TWL3SJ5.cjs → chunk-VS3I5OKA.cjs} +8 -8
  213. package/dist/{chunk-A7BI7YWZ.js → chunk-WMGMIE2D.js} +8 -5
  214. package/dist/{chunk-CCBEHIRU.cjs → chunk-X5MYHDEQ.cjs} +6 -6
  215. package/dist/{chunk-QSGH4FCS.cjs → chunk-X7XP6GEI.cjs} +1 -1
  216. package/dist/{chunk-UROQO2HR.js → chunk-XCXUGHDF.js} +1 -1
  217. package/dist/{chunk-2M5WJENK.js → chunk-YAFDVNXT.js} +1 -1
  218. package/dist/{chunk-PDYM26IC.cjs → chunk-ZBWUIR2J.cjs} +6 -6
  219. package/dist/{chunk-5GKALAMP.js → chunk-ZD3L4V3H.js} +2 -2
  220. package/dist/{chunk-XJTDCWKP.js → chunk-ZR4IMROK.js} +1 -1
  221. package/dist/{chunk-5MCFW2HC.js → chunk-ZTCRD2FL.js} +1 -1
  222. package/dist/index.cjs +214 -199
  223. package/dist/index.d.cts +4 -1
  224. package/dist/index.d.ts +4 -1
  225. package/dist/index.js +51 -48
  226. package/dist/styles.css +445 -3
  227. package/dist/{tokens-OJLK3XMZ.css → tokens-RYJ3DFTU.css} +3 -0
  228. package/dist/tokens.css +3 -0
  229. package/docs/llms/calendar.md +2 -1
  230. package/docs/llms/datepicker.md +69 -0
  231. package/docs/llms/datetimepicker.md +83 -0
  232. package/docs/llms/drawer.md +13 -0
  233. package/docs/llms/image.md +14 -0
  234. package/docs/llms/modal.md +13 -0
  235. package/docs/llms/timepicker.md +81 -0
  236. package/docs/llms.md +5 -2
  237. package/package.json +7 -3
  238. package/dist/chunk-56U4P7QA.cjs +0 -112
  239. package/dist/chunk-J3LUTXVO.js +0 -90
@@ -0,0 +1,505 @@
1
+ 'use strict';
2
+
3
+ var chunkYB3IWIOJ_cjs = require('./chunk-YB3IWIOJ.cjs');
4
+ var chunkVS3I5OKA_cjs = require('./chunk-VS3I5OKA.cjs');
5
+ var chunkSW2HMNCA_cjs = require('./chunk-SW2HMNCA.cjs');
6
+ var chunk4KDABJSY_cjs = require('./chunk-4KDABJSY.cjs');
7
+ require('./tokens-RYJ3DFTU.css');
8
+ require('./shared-NJHRNLRH.css');
9
+ require('./DateTimePicker-77ZLZIWO.css');
10
+ var React = require('react');
11
+ var reactDom = require('react-dom');
12
+ var jsxRuntime = require('react/jsx-runtime');
13
+
14
+ function _interopNamespace(e) {
15
+ if (e && e.__esModule) return e;
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n.default = e;
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
+
34
+ var pad = (value) => String(value).padStart(2, "0");
35
+ var clampStep = (value) => {
36
+ if (!Number.isFinite(value) || !value || value < 1) return 1;
37
+ return Math.floor(value);
38
+ };
39
+ var isValidDate = (date) => date instanceof Date && !Number.isNaN(date.getTime());
40
+ var startOfDay = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate());
41
+ var isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
42
+ var normalizeDateTime = (date, includeSecond) => {
43
+ const normalized = new Date(date);
44
+ if (!includeSecond) normalized.setSeconds(0);
45
+ normalized.setMilliseconds(0);
46
+ return normalized;
47
+ };
48
+ var getTimeParts = (date) => ({
49
+ hour: date.getHours(),
50
+ minute: date.getMinutes(),
51
+ second: date.getSeconds()
52
+ });
53
+ var composeDateTime = (date, time, includeSecond) => {
54
+ const next = new Date(date);
55
+ next.setHours(time.hour, time.minute, includeSecond ? time.second : 0, 0);
56
+ return next;
57
+ };
58
+ var composeTime = (base, key, value) => ({
59
+ hour: key === "hour" ? value : base.hour,
60
+ minute: key === "minute" ? value : base.minute,
61
+ second: key === "second" ? value : base.second
62
+ });
63
+ var byDistanceFrom = (preferred) => (a, b) => Math.abs(a - preferred) - Math.abs(b - preferred) || a - b;
64
+ var buildOptions = (max, step, selected) => {
65
+ const safeStep = clampStep(step);
66
+ const values = [];
67
+ for (let value = 0; value <= max; value += safeStep) {
68
+ values.push(value);
69
+ }
70
+ if (selected != null && !values.includes(selected)) {
71
+ values.push(selected);
72
+ values.sort((a, b) => a - b);
73
+ }
74
+ return values;
75
+ };
76
+ var formatDateTime = (date, format, includeSecond) => {
77
+ if (!isValidDate(date)) return "";
78
+ if (typeof format === "function") return format(date);
79
+ const year = String(date.getFullYear());
80
+ const month = pad(date.getMonth() + 1);
81
+ const day = pad(date.getDate());
82
+ const base = `${year}-${month}-${day} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
83
+ return includeSecond ? `${base}:${pad(date.getSeconds())}` : base;
84
+ };
85
+ var parseDateTimeInput = (input, includeSecond) => {
86
+ const text = input.trim();
87
+ if (!text) return null;
88
+ const match = text.match(
89
+ /^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?(?:\s+|T)(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/
90
+ );
91
+ if (!match) return null;
92
+ const year = Number(match[1]);
93
+ const month = Number(match[2]);
94
+ const day = Number(match[3]);
95
+ const hour = Number(match[4]);
96
+ const minute = Number(match[5]);
97
+ const second = match[6] == null || !includeSecond ? 0 : Number(match[6]);
98
+ if (hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59) {
99
+ return null;
100
+ }
101
+ const date = new Date(year, month - 1, day, hour, minute, second, 0);
102
+ if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
103
+ return null;
104
+ }
105
+ return date;
106
+ };
107
+ var getNow = (includeSecond) => normalizeDateTime(/* @__PURE__ */ new Date(), includeSecond);
108
+ var DateTimePicker = React__namespace.forwardRef(
109
+ ({
110
+ value,
111
+ defaultValue = null,
112
+ onChange,
113
+ format = "YYYY-MM-DD HH:mm",
114
+ showSecond,
115
+ placeholder = "\u8BF7\u9009\u62E9\u65E5\u671F\u65F6\u95F4",
116
+ disabled,
117
+ readOnly,
118
+ invalid,
119
+ size = "md",
120
+ allowClear,
121
+ hourStep = 1,
122
+ minuteStep = 1,
123
+ secondStep = 1,
124
+ min,
125
+ max,
126
+ disabledDate,
127
+ disabledTime,
128
+ placement = "bottom",
129
+ open: openProp,
130
+ defaultOpen = false,
131
+ onOpenChange,
132
+ popupClassName = "",
133
+ dropdownClassName = "",
134
+ className = "",
135
+ onKeyDown,
136
+ ...rest
137
+ }, ref) => {
138
+ const includeSecond = showSecond ?? format === "YYYY-MM-DD HH:mm:ss";
139
+ const controlled = value !== void 0;
140
+ const initial = isValidDate(defaultValue) ? normalizeDateTime(defaultValue, includeSecond) : null;
141
+ const [inner, setInner] = React__namespace.useState(initial);
142
+ const current = controlled ? isValidDate(value) ? normalizeDateTime(value, includeSecond) : null : inner;
143
+ const currentTime = current?.getTime() ?? null;
144
+ const formattedCurrent = React__namespace.useMemo(
145
+ () => currentTime == null ? "" : formatDateTime(new Date(currentTime), format, includeSecond),
146
+ [currentTime, format, includeSecond]
147
+ );
148
+ const scrollSignature = currentTime == null ? "" : String(currentTime);
149
+ const [draft, setDraft] = React__namespace.useState(formattedCurrent);
150
+ React__namespace.useEffect(() => {
151
+ setDraft(formattedCurrent);
152
+ }, [formattedCurrent]);
153
+ const openControlled = openProp !== void 0;
154
+ const [innerOpen, setInnerOpen] = React__namespace.useState(defaultOpen);
155
+ const open = openControlled ? !!openProp : innerOpen;
156
+ const [compactPanel, setCompactPanel] = React__namespace.useState(false);
157
+ const [calendarViewDate, setCalendarViewDate] = React__namespace.useState(null);
158
+ const wasOpenRef = React__namespace.useRef(false);
159
+ const scrollSignatureRef = React__namespace.useRef(null);
160
+ const scrollFramesRef = React__namespace.useRef(/* @__PURE__ */ new Map());
161
+ const setOpen = React__namespace.useCallback(
162
+ (next) => {
163
+ if (disabled || readOnly) return;
164
+ if (!openControlled) setInnerOpen(next);
165
+ onOpenChange?.(next);
166
+ },
167
+ [disabled, onOpenChange, openControlled, readOnly]
168
+ );
169
+ const rootRef = React__namespace.useRef(null);
170
+ const panelRef = React__namespace.useRef(null);
171
+ const { triggerRef, floatingStyle } = chunkYB3IWIOJ_cjs.useFloating({
172
+ open,
173
+ placement,
174
+ panelWidth: compactPanel ? 332 : 476,
175
+ panelHeight: compactPanel ? includeSecond ? 492 : 468 : 328
176
+ });
177
+ const setRootRef = React__namespace.useCallback(
178
+ (node) => {
179
+ rootRef.current = node;
180
+ triggerRef.current = node;
181
+ if (typeof ref === "function") ref(node);
182
+ else if (ref) ref.current = node;
183
+ },
184
+ [ref, triggerRef]
185
+ );
186
+ React__namespace.useEffect(() => {
187
+ if (typeof window === "undefined") return;
188
+ const media = window.matchMedia("(max-width: 640px)");
189
+ const update = () => setCompactPanel(media.matches);
190
+ update();
191
+ media.addEventListener?.("change", update);
192
+ return () => media.removeEventListener?.("change", update);
193
+ }, []);
194
+ const normalizedMin = React__namespace.useMemo(
195
+ () => isValidDate(min) ? normalizeDateTime(min, includeSecond) : void 0,
196
+ [includeSecond, min]
197
+ );
198
+ const normalizedMax = React__namespace.useMemo(
199
+ () => isValidDate(max) ? normalizeDateTime(max, includeSecond) : void 0,
200
+ [includeSecond, max]
201
+ );
202
+ const isDisabledDay = React__namespace.useCallback(
203
+ (date) => {
204
+ const day = startOfDay(date);
205
+ if (normalizedMin && day < startOfDay(normalizedMin)) return true;
206
+ if (normalizedMax && day > startOfDay(normalizedMax)) return true;
207
+ return disabledDate?.(day) ?? false;
208
+ },
209
+ [disabledDate, normalizedMax, normalizedMin]
210
+ );
211
+ const isDisabledDateTime = React__namespace.useCallback(
212
+ (date) => {
213
+ const normalized = normalizeDateTime(date, includeSecond);
214
+ if (isDisabledDay(normalized)) return true;
215
+ if (normalizedMin && normalized < normalizedMin) return true;
216
+ if (normalizedMax && normalized > normalizedMax) return true;
217
+ return disabledTime?.(getTimeParts(normalized), startOfDay(normalized)) ?? false;
218
+ },
219
+ [disabledTime, includeSecond, isDisabledDay, normalizedMax, normalizedMin]
220
+ );
221
+ const commit = React__namespace.useCallback(
222
+ (next, close = false) => {
223
+ if (!next) {
224
+ if (!controlled) setInner(null);
225
+ setDraft("");
226
+ onChange?.(null, "");
227
+ if (close) setOpen(false);
228
+ return;
229
+ }
230
+ const normalized = normalizeDateTime(next, includeSecond);
231
+ if (isDisabledDateTime(normalized)) return;
232
+ if (!controlled) setInner(normalized);
233
+ const nextString = formatDateTime(normalized, format, includeSecond);
234
+ setDraft(nextString);
235
+ onChange?.(normalized, nextString);
236
+ if (close) setOpen(false);
237
+ },
238
+ [controlled, format, includeSecond, isDisabledDateTime, onChange, setOpen]
239
+ );
240
+ React__namespace.useEffect(() => {
241
+ if (!open) return;
242
+ const onDown = (event) => {
243
+ const target = event.target;
244
+ if (rootRef.current?.contains(target)) return;
245
+ if (panelRef.current?.contains(target)) return;
246
+ setOpen(false);
247
+ };
248
+ const onDocKey = (event) => {
249
+ if (event.key === "Escape") setOpen(false);
250
+ };
251
+ document.addEventListener("mousedown", onDown);
252
+ document.addEventListener("keydown", onDocKey);
253
+ return () => {
254
+ document.removeEventListener("mousedown", onDown);
255
+ document.removeEventListener("keydown", onDocKey);
256
+ };
257
+ }, [open, setOpen]);
258
+ const scrollListTo = React__namespace.useCallback(
259
+ (list, top, animate) => {
260
+ const frame = scrollFramesRef.current.get(list);
261
+ if (frame != null) cancelAnimationFrame(frame);
262
+ if (!animate) {
263
+ list.scrollTop = top;
264
+ return;
265
+ }
266
+ const start = list.scrollTop;
267
+ const distance = top - start;
268
+ if (Math.abs(distance) < 1) {
269
+ list.scrollTop = top;
270
+ return;
271
+ }
272
+ const startedAt = performance.now();
273
+ const duration = 180;
274
+ const tick = (now) => {
275
+ const progress = Math.min((now - startedAt) / duration, 1);
276
+ const eased = 1 - Math.pow(1 - progress, 3);
277
+ list.scrollTop = start + distance * eased;
278
+ if (progress < 1) {
279
+ scrollFramesRef.current.set(list, requestAnimationFrame(tick));
280
+ return;
281
+ }
282
+ scrollFramesRef.current.delete(list);
283
+ list.scrollTop = top;
284
+ };
285
+ scrollFramesRef.current.set(list, requestAnimationFrame(tick));
286
+ },
287
+ []
288
+ );
289
+ React__namespace.useEffect(() => {
290
+ if (!open) return;
291
+ const shouldAnimate = wasOpenRef.current && scrollSignatureRef.current != null && scrollSignatureRef.current !== scrollSignature;
292
+ requestAnimationFrame(() => {
293
+ panelRef.current?.querySelectorAll(".date-time-picker-time-list").forEach((list) => {
294
+ const selected = list.querySelector(".date-time-picker-time-option.selected");
295
+ if (!selected) return;
296
+ const top = selected.offsetTop - list.offsetTop - list.clientHeight / 2 + selected.offsetHeight / 2;
297
+ scrollListTo(list, top, shouldAnimate);
298
+ });
299
+ });
300
+ wasOpenRef.current = open;
301
+ scrollSignatureRef.current = scrollSignature;
302
+ }, [open, scrollListTo, scrollSignature]);
303
+ React__namespace.useEffect(() => {
304
+ if (open) return;
305
+ wasOpenRef.current = false;
306
+ scrollSignatureRef.current = null;
307
+ setCalendarViewDate(null);
308
+ }, [open]);
309
+ React__namespace.useEffect(
310
+ () => () => {
311
+ scrollFramesRef.current.forEach((frame) => cancelAnimationFrame(frame));
312
+ scrollFramesRef.current.clear();
313
+ },
314
+ []
315
+ );
316
+ const panelBase = current ?? getNow(includeSecond);
317
+ const selectedDay = startOfDay(panelBase);
318
+ const timeParts = getTimeParts(panelBase);
319
+ const hourOptions = buildOptions(23, hourStep, timeParts.hour);
320
+ const minuteOptions = buildOptions(59, minuteStep, timeParts.minute);
321
+ const secondOptions = buildOptions(59, secondStep, timeParts.second);
322
+ const findAvailableTime = (key, value2) => {
323
+ const preferred = composeTime(timeParts, key, value2);
324
+ if (!isDisabledDateTime(composeDateTime(selectedDay, preferred, includeSecond))) {
325
+ return preferred;
326
+ }
327
+ const hours = key === "hour" ? [value2] : [...hourOptions].sort(byDistanceFrom(timeParts.hour));
328
+ const minutes = key === "minute" ? [value2] : [...minuteOptions].sort(byDistanceFrom(timeParts.minute));
329
+ const seconds = key === "second" ? [value2] : includeSecond ? [...secondOptions].sort(byDistanceFrom(timeParts.second)) : [0];
330
+ for (const hour of hours) {
331
+ for (const minute of minutes) {
332
+ for (const second of seconds) {
333
+ const candidate = { hour, minute, second };
334
+ if (!isDisabledDateTime(composeDateTime(selectedDay, candidate, includeSecond))) {
335
+ return candidate;
336
+ }
337
+ }
338
+ }
339
+ }
340
+ return null;
341
+ };
342
+ const handleDatePick = (date) => {
343
+ const next = composeDateTime(date, timeParts, includeSecond);
344
+ if (normalizedMin && isSameDay(next, normalizedMin) && next < normalizedMin) {
345
+ commit(normalizedMin);
346
+ return;
347
+ }
348
+ if (normalizedMax && isSameDay(next, normalizedMax) && next > normalizedMax) {
349
+ commit(normalizedMax);
350
+ return;
351
+ }
352
+ commit(next);
353
+ };
354
+ const pickTime = (key, nextValue) => {
355
+ const nextTime = findAvailableTime(key, nextValue);
356
+ if (nextTime) commit(composeDateTime(selectedDay, nextTime, includeSecond));
357
+ };
358
+ const handleInputChange = (next) => {
359
+ setDraft(next);
360
+ if (next.trim() === "") commit(null);
361
+ };
362
+ const handleInputBlur = () => {
363
+ if (!draft.trim()) {
364
+ setDraft(formatDateTime(current, format, includeSecond));
365
+ return;
366
+ }
367
+ if (typeof format === "function") {
368
+ setDraft(formatDateTime(current, format, includeSecond));
369
+ return;
370
+ }
371
+ const parsed = parseDateTimeInput(draft, includeSecond);
372
+ if (!parsed || isDisabledDateTime(parsed)) {
373
+ setDraft(formatDateTime(current, format, includeSecond));
374
+ return;
375
+ }
376
+ commit(parsed);
377
+ };
378
+ const handleRootKeyDown = (event) => {
379
+ onKeyDown?.(event);
380
+ if (event.defaultPrevented) return;
381
+ if ((event.key === "ArrowDown" || event.key === "Enter") && !open) {
382
+ event.preventDefault();
383
+ setOpen(true);
384
+ }
385
+ if (event.key === "Escape" && open) {
386
+ event.preventDefault();
387
+ setOpen(false);
388
+ }
389
+ };
390
+ const renderTimeColumn = (label, key, options) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "date-time-picker-time-column", children: [
391
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "date-time-picker-time-label", children: label }),
392
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "date-time-picker-time-list", role: "listbox", "aria-label": label, children: options.map((option) => {
393
+ const selected = timeParts[key] === option;
394
+ const optionDisabled = findAvailableTime(key, option) == null;
395
+ return /* @__PURE__ */ jsxRuntime.jsx(
396
+ "button",
397
+ {
398
+ type: "button",
399
+ role: "option",
400
+ "aria-selected": selected,
401
+ disabled: optionDisabled,
402
+ className: `date-time-picker-time-option ${selected ? "selected" : ""}`,
403
+ onClick: () => pickTime(key, option),
404
+ children: pad(option)
405
+ },
406
+ option
407
+ );
408
+ }) })
409
+ ] });
410
+ const today = getNow(includeSecond);
411
+ const mergedPanelClassName = [popupClassName, dropdownClassName].filter(Boolean).join(" ");
412
+ const rootClassName = [
413
+ "date-time-picker",
414
+ size,
415
+ open && "open",
416
+ disabled && "disabled",
417
+ readOnly && "readonly",
418
+ invalid && "invalid",
419
+ className
420
+ ].filter(Boolean).join(" ");
421
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: setRootRef, className: rootClassName, onKeyDown: handleRootKeyDown, ...rest, children: [
422
+ /* @__PURE__ */ jsxRuntime.jsx(
423
+ chunkVS3I5OKA_cjs.Input,
424
+ {
425
+ value: draft,
426
+ size,
427
+ placeholder,
428
+ disabled,
429
+ readOnly,
430
+ invalid,
431
+ allowClear,
432
+ leadingIcon: "calendar",
433
+ onFocus: () => setOpen(true),
434
+ onClick: () => setOpen(true),
435
+ onValueChange: handleInputChange,
436
+ onBlur: handleInputBlur,
437
+ inputMode: "numeric",
438
+ "aria-expanded": open,
439
+ "aria-haspopup": "dialog"
440
+ }
441
+ ),
442
+ open && !disabled && !readOnly && typeof document !== "undefined" && reactDom.createPortal(
443
+ /* @__PURE__ */ jsxRuntime.jsxs(
444
+ "div",
445
+ {
446
+ ref: panelRef,
447
+ className: `date-time-picker-panel ${includeSecond ? "with-second" : "without-second"} ${mergedPanelClassName}`,
448
+ role: "dialog",
449
+ style: floatingStyle,
450
+ children: [
451
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "date-time-picker-body", children: [
452
+ /* @__PURE__ */ jsxRuntime.jsx(
453
+ chunk4KDABJSY_cjs.Calendar,
454
+ {
455
+ value: selectedDay,
456
+ viewDate: calendarViewDate ?? void 0,
457
+ min: normalizedMin ? startOfDay(normalizedMin) : void 0,
458
+ max: normalizedMax ? startOfDay(normalizedMax) : void 0,
459
+ disabledDate: isDisabledDay,
460
+ onChange: handleDatePick
461
+ }
462
+ ),
463
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "date-time-picker-time", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "date-time-picker-time-columns", children: [
464
+ renderTimeColumn("\u65F6", "hour", hourOptions),
465
+ renderTimeColumn("\u5206", "minute", minuteOptions),
466
+ includeSecond && renderTimeColumn("\u79D2", "second", secondOptions)
467
+ ] }) })
468
+ ] }),
469
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "date-time-picker-footer", children: [
470
+ /* @__PURE__ */ jsxRuntime.jsx(
471
+ chunkSW2HMNCA_cjs.Button,
472
+ {
473
+ size: "sm",
474
+ variant: "ghost",
475
+ disabled: isDisabledDateTime(today),
476
+ onClick: () => {
477
+ setCalendarViewDate(today);
478
+ commit(today);
479
+ },
480
+ children: "\u73B0\u5728"
481
+ }
482
+ ),
483
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "date-time-picker-footer-spacer" }),
484
+ allowClear && /* @__PURE__ */ jsxRuntime.jsx(
485
+ chunkSW2HMNCA_cjs.Button,
486
+ {
487
+ size: "sm",
488
+ variant: "ghost",
489
+ onClick: () => commit(null, true),
490
+ children: "\u6E05\u7A7A"
491
+ }
492
+ ),
493
+ /* @__PURE__ */ jsxRuntime.jsx(chunkSW2HMNCA_cjs.Button, { size: "sm", variant: "primary", onClick: () => setOpen(false), children: "\u786E\u5B9A" })
494
+ ] })
495
+ ]
496
+ }
497
+ ),
498
+ document.body
499
+ )
500
+ ] });
501
+ }
502
+ );
503
+ DateTimePicker.displayName = "DateTimePicker";
504
+
505
+ exports.DateTimePicker = DateTimePicker;
@@ -1,13 +1,13 @@
1
- import { Slider } from './chunk-JST4HJ3I.js';
1
+ import { Slider } from './chunk-D7GK6H6V.js';
2
2
  import { pickLuminaThemePresets } from './chunk-6SPMHY54.js';
3
- import { useTheme, ACCENT_PRESETS, FONT_STACKS } from './chunk-DEXYWDHF.js';
4
- import { Switch } from './chunk-BK4XKZUO.js';
5
- import { RadioGroup } from './chunk-TAHZH6DJ.js';
6
- import { ColorPicker } from './chunk-QVWCUKEY.js';
7
- import { Input } from './chunk-IZGHMMX7.js';
8
- import { Button } from './chunk-CQKQ7KS2.js';
9
- import { Icon } from './chunk-HHBXCBZP.js';
10
- import './tokens-OJLK3XMZ.css';
3
+ import { useTheme, ACCENT_PRESETS, FONT_STACKS } from './chunk-GNV6W4BN.js';
4
+ import { Switch } from './chunk-PU7VXDAS.js';
5
+ import { RadioGroup } from './chunk-KYV75JPQ.js';
6
+ import { ColorPicker } from './chunk-TJECLLN4.js';
7
+ import { Input } from './chunk-IOAOG5L7.js';
8
+ import { Button } from './chunk-IPSNC5VZ.js';
9
+ import { Icon } from './chunk-FDZG27IG.js';
10
+ import './tokens-RYJ3DFTU.css';
11
11
  import './shared-NJHRNLRH.css';
12
12
  import './ThemePanel-TEHB2JCQ.css';
13
13
  import * as React from 'react';
@@ -1,6 +1,6 @@
1
- import { Input } from './chunk-IZGHMMX7.js';
2
- import { Icon } from './chunk-HHBXCBZP.js';
3
- import './tokens-OJLK3XMZ.css';
1
+ import { Input } from './chunk-IOAOG5L7.js';
2
+ import { Icon } from './chunk-FDZG27IG.js';
3
+ import './tokens-RYJ3DFTU.css';
4
4
  import './shared-NJHRNLRH.css';
5
5
  import './InputNumber-VXQIWLQC.css';
6
6
  import * as React from 'react';
@@ -1,7 +1,7 @@
1
1
  import { useFloating } from './chunk-DUFRASGO.js';
2
- import { Input } from './chunk-IZGHMMX7.js';
3
- import { Icon, renderIconSlot } from './chunk-HHBXCBZP.js';
4
- import './tokens-OJLK3XMZ.css';
2
+ import { Input } from './chunk-IOAOG5L7.js';
3
+ import { Icon, renderIconSlot } from './chunk-FDZG27IG.js';
4
+ import './tokens-RYJ3DFTU.css';
5
5
  import './shared-NJHRNLRH.css';
6
6
  import './Cascader-ANEQUPMI.css';
7
7
  import * as React from 'react';