@sia.soul/sia-react-ui 0.1.160 → 0.1.162

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 (41) hide show
  1. package/dist/{Select-DIdEbGwf.d.cts → Select-Dxevc0f6.d.cts} +1 -1
  2. package/dist/{Select-BCVUoK0I.d.ts → Select-tsENCXQI.d.ts} +1 -1
  3. package/dist/chart.cjs +9 -9
  4. package/dist/chart.js +5 -5
  5. package/dist/{chunk-H6UTSSZM.js → chunk-33WX54AU.js} +5 -5
  6. package/dist/{chunk-PU2V3VB5.js → chunk-4B7ATL6J.js} +1 -1
  7. package/dist/{chunk-XXFYFLZA.js → chunk-5WZR2RHA.js} +2 -2
  8. package/dist/{chunk-YO5OJQEH.js → chunk-CRA7VNOA.js} +1 -1
  9. package/dist/{chunk-ZIH5VLPT.js → chunk-KA3M4TE4.js} +2 -2
  10. package/dist/{chunk-6SSZVJO4.js → chunk-M4IASLGB.js} +3 -3
  11. package/dist/{chunk-REAWVQH2.js → chunk-MXK6TKMO.js} +5 -5
  12. package/dist/{chunk-KDIJYXKW.js → chunk-Q3LEK2TL.js} +599 -270
  13. package/dist/{chunk-NRLIOMXY.js → chunk-UL54A2YN.js} +2 -2
  14. package/dist/{chunk-P5ZCOIKQ.js → chunk-UPXL2QLJ.js} +6 -6
  15. package/dist/{chunk-SRWUDTCS.js → chunk-WMZYYPIW.js} +9 -9
  16. package/dist/{chunk-EMBCJFJM.js → chunk-ZNPNZD6O.js} +4 -4
  17. package/dist/{core--AEiGVOU.d.ts → core-XtqUDbbD.d.ts} +3 -3
  18. package/dist/{core-DolUEUCo.d.cts → core-r-smfiNN.d.cts} +3 -3
  19. package/dist/core.cjs +9 -9
  20. package/dist/core.css +164 -22
  21. package/dist/core.d.cts +2 -2
  22. package/dist/core.d.ts +2 -2
  23. package/dist/core.js +8 -8
  24. package/dist/game.cjs +9 -9
  25. package/dist/game.js +3 -3
  26. package/dist/index.cjs +646 -316
  27. package/dist/index.css +164 -22
  28. package/dist/index.d.cts +13 -8
  29. package/dist/index.d.ts +13 -8
  30. package/dist/index.js +60 -59
  31. package/dist/markdown-editor.cjs +9 -9
  32. package/dist/markdown-editor.js +3 -3
  33. package/dist/rich-text-editor.cjs +9 -9
  34. package/dist/rich-text-editor.js +7 -7
  35. package/dist/{select-date-range-DYrA87Tl.d.ts → select-date-range-CIXBuoef.d.ts} +8 -9
  36. package/dist/{select-date-range-CIwE5nFu.d.cts → select-date-range-Cbh37zmU.d.cts} +8 -9
  37. package/dist/select-date-range.cjs +598 -269
  38. package/dist/select-date-range.d.cts +2 -2
  39. package/dist/select-date-range.d.ts +2 -2
  40. package/dist/select-date-range.js +8 -8
  41. package/package.json +1 -1
@@ -532,8 +532,8 @@ var import_react3 = require("react");
532
532
  // src/components/popupFluidMotion.ts
533
533
  var popupEnterDuration = 260;
534
534
  var popupExitDuration = 140;
535
- var popupInitialScale = 0.88;
536
- var popupTravelOffset = 6;
535
+ var popupInitialScale = 0.93;
536
+ var popupTravelOffset = 4;
537
537
  function popupFluidFrames(placement, open = true) {
538
538
  const side = placement.split("-")[0];
539
539
  const axis = side === "left" || side === "right" ? "X" : "Y";
@@ -542,8 +542,8 @@ function popupFluidFrames(placement, open = true) {
542
542
  const visible = { opacity: 1, transform: "none" };
543
543
  return open ? [
544
544
  { ...hidden, offset: 0 },
545
- { opacity: 1, transform: "scale(1.11, 1.085)", offset: 0.68 },
546
- { opacity: 1, transform: "scale(.945, .965)", offset: 0.86 },
545
+ { opacity: 1, transform: "scale(1.05, 1.04)", offset: 0.68 },
546
+ { opacity: 1, transform: "scale(.977, .985)", offset: 0.86 },
547
547
  { ...visible, offset: 1 }
548
548
  ] : [{ ...visible, offset: 0 }, { ...hidden, offset: 1 }];
549
549
  }
@@ -563,16 +563,16 @@ function motionFrames(kind, placement) {
563
563
  const outside = `translate${axis}(${sign * 100}%)`;
564
564
  return [
565
565
  { transform: outside, offset: 0 },
566
- { transform: `translate${axis}(0) scale${axis}(1.065)`, offset: 0.68 },
567
- { transform: `translate${axis}(0) scale${axis}(.975)`, offset: 0.86 },
566
+ { transform: `translate${axis}(0) scale${axis}(1.03)`, offset: 0.68 },
567
+ { transform: `translate${axis}(0) scale${axis}(.988)`, offset: 0.86 },
568
568
  { transform: "none", offset: 1 }
569
569
  ];
570
570
  }
571
571
  const modal = kind === "modal";
572
572
  return [
573
- { opacity: 0, transform: `translateY(${modal ? 18 : -6}px) scale(${modal ? 0.9 : 0.88})`, offset: 0 },
574
- { opacity: 1, transform: modal ? "scale(1.075, 1.05)" : "scale(1.11, 1.085)", offset: 0.68 },
575
- { opacity: 1, transform: modal ? "scale(.965, .98)" : "scale(.945, .965)", offset: 0.86 },
573
+ { opacity: 0, transform: `translateY(${modal ? 14 : -4}px) scale(${modal ? 0.95 : 0.93})`, offset: 0 },
574
+ { opacity: 1, transform: modal ? "scale(1.035, 1.02)" : "scale(1.05, 1.04)", offset: 0.68 },
575
+ { opacity: 1, transform: modal ? "scale(.984, .992)" : "scale(.977, .985)", offset: 0.86 },
576
576
  { opacity: 1, transform: "none", offset: 1 }
577
577
  ];
578
578
  }
@@ -2287,8 +2287,51 @@ function CalendarMonth({
2287
2287
  previewEnd,
2288
2288
  disabledDate,
2289
2289
  onSelect,
2290
- onHover
2290
+ onHover,
2291
+ onSwipeMonth
2291
2292
  }) {
2293
+ const monthRef = (0, import_react8.useRef)(null);
2294
+ const swipe = (0, import_react8.useRef)({ startX: 0, startY: 0, pointerId: -1, dragging: false, lastTime: 0, lastX: 0, velocity: 0 });
2295
+ function onMonthPointerDown(event) {
2296
+ if (!onSwipeMonth || event.button !== 0) return;
2297
+ swipe.current = { startX: event.clientX, startY: event.clientY, pointerId: event.pointerId, dragging: false, lastTime: event.timeStamp, lastX: event.clientX, velocity: 0 };
2298
+ }
2299
+ function onMonthPointerMove(event) {
2300
+ const state = swipe.current;
2301
+ if (!onSwipeMonth || state.pointerId !== event.pointerId || !monthRef.current) return;
2302
+ const dx = event.clientX - state.startX;
2303
+ const dy = event.clientY - state.startY;
2304
+ if (!state.dragging && Math.abs(dx) > 6 && Math.abs(dx) > Math.abs(dy)) {
2305
+ state.dragging = true;
2306
+ try {
2307
+ monthRef.current?.setPointerCapture(event.pointerId);
2308
+ } catch {
2309
+ }
2310
+ }
2311
+ if (!state.dragging) return;
2312
+ monthRef.current.style.transition = "none";
2313
+ monthRef.current.style.transform = `translateX(${dx}px)`;
2314
+ const dt = event.timeStamp - state.lastTime;
2315
+ if (dt > 0) state.velocity = (event.clientX - state.lastX) / dt;
2316
+ state.lastTime = event.timeStamp;
2317
+ state.lastX = event.clientX;
2318
+ }
2319
+ function onMonthPointerUp(event) {
2320
+ const state = swipe.current;
2321
+ const node = monthRef.current;
2322
+ if (state.pointerId !== event.pointerId || !node) return;
2323
+ state.pointerId = -1;
2324
+ try {
2325
+ node.releasePointerCapture?.(event.pointerId);
2326
+ } catch {
2327
+ }
2328
+ if (!state.dragging) return;
2329
+ const dx = event.clientX - state.startX;
2330
+ const shouldSwitch = Math.abs(dx) >= 56 || Math.abs(state.velocity) > 0.5;
2331
+ if (shouldSwitch && onSwipeMonth) onSwipeMonth(dx < 0 ? 1 : -1);
2332
+ node.style.transition = "transform 220ms cubic-bezier(.2, .7, .2, 1)";
2333
+ node.style.transform = "translateX(0)";
2334
+ }
2292
2335
  const first = startOfMonth(month);
2293
2336
  const mondayIndex = (first.getDay() + 6) % 7;
2294
2337
  const gridStart = addDays(first, -mondayIndex);
@@ -2297,43 +2340,61 @@ function CalendarMonth({
2297
2340
  const end = range[1] || previewEnd || "";
2298
2341
  const low = start && end ? start <= end ? start : end : "";
2299
2342
  const high = start && end ? start <= end ? end : start : "";
2300
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "sia-date-panel__month", children: [
2301
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "sia-date-panel__weekdays", "aria-hidden": "true", children: WEEKDAYS.map((day) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: day }, day)) }),
2302
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "sia-date-panel__days", children: Array.from({ length: 42 }, (_, index) => {
2303
- const date = addDays(gridStart, index);
2304
- const key = dateKey(date);
2305
- const outside = date.getMonth() !== month.getMonth();
2306
- const disabled = disabledDate?.(key) ?? false;
2307
- const selected = selectedDates.includes(key);
2308
- const rangeStart = Boolean(start && key === start);
2309
- const rangeEnd = Boolean(range[1] && key === range[1]);
2310
- const inRange = Boolean(low && high && key >= low && key <= high);
2311
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2312
- "span",
2313
- {
2314
- className: `sia-date-panel__cell${outside ? " is-outside" : ""}${selected ? " is-selected" : ""}${rangeStart ? " is-range-start" : ""}${rangeEnd ? " is-range-end" : ""}${inRange ? " is-in-range" : ""}${key === today ? " is-today" : ""}`,
2315
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2316
- "button",
2343
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2344
+ "div",
2345
+ {
2346
+ className: "sia-date-panel__month",
2347
+ ref: monthRef,
2348
+ onPointerDown: onMonthPointerDown,
2349
+ onPointerMove: onMonthPointerMove,
2350
+ onPointerUp: onMonthPointerUp,
2351
+ onPointerCancel: onMonthPointerUp,
2352
+ onClickCapture: (event) => {
2353
+ if (!swipe.current.dragging) return;
2354
+ event.preventDefault();
2355
+ event.stopPropagation();
2356
+ swipe.current.dragging = false;
2357
+ },
2358
+ children: [
2359
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "sia-date-panel__weekdays", "aria-hidden": "true", children: WEEKDAYS.map((day) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: day }, day)) }),
2360
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "sia-date-panel__days", children: Array.from({ length: 42 }, (_, index) => {
2361
+ const date = addDays(gridStart, index);
2362
+ const key = dateKey(date);
2363
+ const outside = date.getMonth() !== month.getMonth();
2364
+ const disabled = disabledDate?.(key) ?? false;
2365
+ const selected = selectedDates.includes(key);
2366
+ const rangeStart = Boolean(start && key === start);
2367
+ const rangeEnd = Boolean(range[1] && key === range[1]);
2368
+ const inRange = Boolean(low && high && key >= low && key <= high);
2369
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2370
+ "span",
2317
2371
  {
2318
- type: "button",
2319
- "aria-label": key,
2320
- "aria-pressed": selected || rangeStart || rangeEnd || void 0,
2321
- disabled,
2322
- onClick: () => onSelect(key),
2323
- onMouseEnter: () => onHover?.(key),
2324
- children: date.getDate()
2325
- }
2326
- )
2327
- },
2328
- key
2329
- );
2330
- }) })
2331
- ] });
2372
+ className: `sia-date-panel__cell${outside ? " is-outside" : ""}${selected ? " is-selected" : ""}${rangeStart ? " is-range-start" : ""}${rangeEnd ? " is-range-end" : ""}${inRange ? " is-in-range" : ""}${key === today ? " is-today" : ""}`,
2373
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2374
+ "button",
2375
+ {
2376
+ type: "button",
2377
+ "aria-label": key,
2378
+ "aria-pressed": selected || rangeStart || rangeEnd || void 0,
2379
+ disabled,
2380
+ onClick: () => onSelect(key),
2381
+ onMouseEnter: () => onHover?.(key),
2382
+ children: date.getDate()
2383
+ }
2384
+ )
2385
+ },
2386
+ key
2387
+ );
2388
+ }) })
2389
+ ]
2390
+ }
2391
+ );
2332
2392
  }
2333
2393
  function CalendarHeader({
2334
2394
  month,
2335
2395
  label,
2336
2396
  range = false,
2397
+ onTitleClick,
2337
2398
  onPreviousYear,
2338
2399
  onPreviousMonth,
2339
2400
  onNextMonth,
@@ -2347,7 +2408,15 @@ function CalendarHeader({
2347
2408
  ] }) : null,
2348
2409
  onPreviousMonth ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": "\u4E0A\u4E2A\u6708", onClick: onPreviousMonth, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "chevron-left", size: 15 }) }) : null
2349
2410
  ] }),
2350
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { children: [
2411
+ onTitleClick ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "sia-date-panel__title", "aria-label": "\u9009\u62E9\u5E74\u4EFD", onClick: onTitleClick, children: [
2412
+ label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: label }) : null,
2413
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
2414
+ month.getFullYear(),
2415
+ "\u5E74\xA0 ",
2416
+ month.getMonth() + 1,
2417
+ "\u6708"
2418
+ ] })
2419
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { children: [
2351
2420
  label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { children: label }) : null,
2352
2421
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
2353
2422
  month.getFullYear(),
@@ -2366,36 +2435,146 @@ function CalendarHeader({
2366
2435
  range ? null : null
2367
2436
  ] });
2368
2437
  }
2438
+ var TIME_OPTION_HEIGHT = 32;
2439
+ var TIME_COLUMN_PADDING = 4;
2440
+ function TimeColumn({
2441
+ ariaLabel,
2442
+ columnIndex,
2443
+ count,
2444
+ value,
2445
+ siblings,
2446
+ use12Hours = false,
2447
+ unit = "",
2448
+ unitLabels = false,
2449
+ disabledTime,
2450
+ onSelect
2451
+ }) {
2452
+ const listRef = (0, import_react8.useRef)(null);
2453
+ const drag = (0, import_react8.useRef)({ startY: 0, startScroll: 0, pointerId: -1, dragging: false, samples: [], velocity: 0, frame: 0 });
2454
+ (0, import_react8.useLayoutEffect)(() => {
2455
+ const column = listRef.current;
2456
+ const selected = column?.querySelector('[aria-selected="true"]');
2457
+ const first = column?.firstElementChild;
2458
+ if (!column || !selected || !first) return;
2459
+ const top = selected.offsetTop - first.offsetTop + parseFloat(getComputedStyle(column).paddingTop || "0");
2460
+ const bottom = top + selected.offsetHeight;
2461
+ if (top < column.scrollTop || bottom > column.scrollTop + column.clientHeight) {
2462
+ column.scrollTop = Math.max(0, top - (column.clientHeight - selected.offsetHeight) / 2);
2463
+ }
2464
+ }, [value, count]);
2465
+ (0, import_react8.useEffect)(() => () => cancelAnimationFrame(drag.current.frame), []);
2466
+ function stopWithSnap() {
2467
+ const column = listRef.current;
2468
+ if (!column) return;
2469
+ const snapped = Math.round((column.scrollTop - TIME_COLUMN_PADDING) / TIME_OPTION_HEIGHT) * TIME_OPTION_HEIGHT + TIME_COLUMN_PADDING;
2470
+ const max = column.scrollHeight - column.clientHeight;
2471
+ column.scrollTo({ top: Math.max(0, Math.min(max, snapped)), behavior: "smooth" });
2472
+ }
2473
+ function onPointerDown(event) {
2474
+ if (event.button !== 0) return;
2475
+ const column = listRef.current;
2476
+ if (!column) return;
2477
+ drag.current = { startY: event.clientY, startScroll: column.scrollTop, pointerId: event.pointerId, dragging: false, samples: [event.timeStamp, event.clientY], velocity: 0, frame: 0 };
2478
+ }
2479
+ function onPointerMove(event) {
2480
+ const state = drag.current;
2481
+ const column = listRef.current;
2482
+ if (state.pointerId !== event.pointerId || !column) return;
2483
+ const dy = event.clientY - state.startY;
2484
+ if (!state.dragging && Math.abs(dy) > 4) {
2485
+ state.dragging = true;
2486
+ try {
2487
+ column.setPointerCapture(event.pointerId);
2488
+ } catch {
2489
+ }
2490
+ }
2491
+ if (!state.dragging) return;
2492
+ column.scrollTop = state.startScroll - dy;
2493
+ state.samples.push(event.timeStamp, event.clientY);
2494
+ while (state.samples.length > 4 && event.timeStamp - state.samples[0] > 100) state.samples.splice(0, 2);
2495
+ }
2496
+ function onPointerUp(event) {
2497
+ const state = drag.current;
2498
+ const column = listRef.current;
2499
+ if (state.pointerId !== event.pointerId || !column) return;
2500
+ state.pointerId = -1;
2501
+ try {
2502
+ column.releasePointerCapture?.(event.pointerId);
2503
+ } catch {
2504
+ }
2505
+ if (!state.dragging) return;
2506
+ const samples = state.samples;
2507
+ const dt = samples[samples.length - 2] - samples[0];
2508
+ const dy = samples[samples.length - 1] - samples[1];
2509
+ let velocity = dt > 4 ? dy / dt : 0;
2510
+ velocity = Math.max(-2.5, Math.min(2.5, velocity));
2511
+ cancelAnimationFrame(state.frame);
2512
+ let last = performance.now();
2513
+ const step = (now) => {
2514
+ const elapsed = Math.min(32, now - last);
2515
+ last = now;
2516
+ column.scrollTop -= velocity * elapsed;
2517
+ velocity *= Math.pow(0.94, elapsed / 16.7);
2518
+ if (Math.abs(velocity) > 0.04) state.frame = requestAnimationFrame(step);
2519
+ else stopWithSnap();
2520
+ };
2521
+ state.frame = requestAnimationFrame(step);
2522
+ }
2523
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2524
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2525
+ "div",
2526
+ {
2527
+ ref: listRef,
2528
+ role: "listbox",
2529
+ "aria-label": ariaLabel,
2530
+ onPointerDown,
2531
+ onPointerMove,
2532
+ onPointerUp,
2533
+ onPointerCancel: onPointerUp,
2534
+ onClickCapture: (event) => {
2535
+ if (!drag.current.dragging) return;
2536
+ event.preventDefault();
2537
+ event.stopPropagation();
2538
+ drag.current.dragging = false;
2539
+ },
2540
+ children: Array.from({ length: count }, (_, index) => {
2541
+ const next = pad(index);
2542
+ const candidate = [...siblings];
2543
+ candidate[columnIndex] = next;
2544
+ const selected = next === value;
2545
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", role: "option", disabled: disabledTime?.(candidate.join(":")), "aria-selected": selected, className: selected ? "is-selected" : "", onKeyDown: (event) => {
2546
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;
2547
+ event.preventDefault();
2548
+ const buttons = Array.from(event.currentTarget.parentElement.querySelectorAll("button:not(:disabled)"));
2549
+ const position = buttons.indexOf(event.currentTarget);
2550
+ const target = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : Math.max(0, Math.min(buttons.length - 1, position + (event.key === "ArrowDown" ? 1 : -1)));
2551
+ buttons[target]?.focus();
2552
+ }, onClick: () => onSelect(next), children: [
2553
+ use12Hours && columnIndex === 0 ? `${pad(index % 12 || 12)} ${index < 12 ? "AM" : "PM"}` : next,
2554
+ unitLabels && selected ? unit : ""
2555
+ ] }, next);
2556
+ })
2557
+ }
2558
+ ),
2559
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FloatingScrollbarProvider, { targetRef: listRef })
2560
+ ] });
2561
+ }
2369
2562
  function TimePanel({
2370
2563
  value,
2371
2564
  showSecond = false,
2372
2565
  ariaLabel = "\u65F6\u95F4",
2373
2566
  disabledTime,
2374
2567
  use12Hours = false,
2568
+ title,
2569
+ unitLabels = false,
2375
2570
  onChange
2376
2571
  }) {
2377
2572
  const [hour = "00", minute = "00", second = "00"] = value.split(":");
2378
- const columnsRef = (0, import_react8.useRef)(null);
2379
- const hourRef = (0, import_react8.useRef)(null);
2380
- const minuteRef = (0, import_react8.useRef)(null);
2381
- const secondRef = (0, import_react8.useRef)(null);
2382
- const columnRefs = [hourRef, minuteRef, secondRef];
2383
- (0, import_react8.useLayoutEffect)(() => {
2384
- for (const column of columnsRef.current?.children ?? []) {
2385
- const selected = column.querySelector('[aria-selected="true"]');
2386
- const first = column.firstElementChild;
2387
- if (!selected || !first) continue;
2388
- const top = selected.offsetTop - first.offsetTop + parseFloat(getComputedStyle(column).paddingTop || "0");
2389
- const bottom = top + selected.offsetHeight;
2390
- if (top < column.scrollTop || bottom > column.scrollTop + column.clientHeight) {
2391
- column.scrollTop = Math.max(0, top - (column.clientHeight - selected.offsetHeight) / 2);
2392
- }
2393
- }
2394
- }, [hour, minute, second, showSecond, ariaLabel]);
2573
+ const siblings = [hour, minute, second];
2395
2574
  const columns = [
2396
- { label: "\u5C0F\u65F6", value: hour, count: 24, index: 0 },
2397
- { label: "\u5206\u949F", value: minute, count: 60, index: 1 },
2398
- ...showSecond ? [{ label: "\u79D2", value: second, count: 60, index: 2 }] : []
2575
+ { label: "\u5C0F\u65F6", unit: "\u65F6", value: hour, count: 24, index: 0 },
2576
+ { label: "\u5206\u949F", unit: "\u5206", value: minute, count: 60, index: 1 },
2577
+ ...showSecond ? [{ label: "\u79D2", unit: "\u79D2", value: second, count: 60, index: 2 }] : []
2399
2578
  ];
2400
2579
  function update(index, next) {
2401
2580
  const values = [hour, minute, second];
@@ -2403,27 +2582,29 @@ function TimePanel({
2403
2582
  onChange(values.join(":"));
2404
2583
  }
2405
2584
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("aside", { className: "sia-date-panel__time", "aria-label": ariaLabel, children: [
2406
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { children: [
2585
+ title != null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { className: "sia-date-panel__time-title", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { children: [
2407
2586
  use12Hours ? pad(Number(hour) % 12 || 12) : hour,
2408
2587
  ":",
2409
2588
  minute,
2410
2589
  showSecond ? `:${second}` : "",
2411
2590
  use12Hours ? Number(hour) < 12 ? " AM" : " PM" : ""
2412
2591
  ] }),
2413
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: columnsRef, className: "sia-date-panel__time-columns", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: columnRefs[column.index], role: "listbox", "aria-label": `${ariaLabel}${column.label}`, children: Array.from({ length: column.count }, (_, index) => {
2414
- const next = pad(index);
2415
- const candidate = [hour, minute, second];
2416
- candidate[column.index] = next;
2417
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", role: "option", disabled: disabledTime?.(candidate.join(":")), "aria-selected": next === column.value, className: next === column.value ? "is-selected" : "", onKeyDown: (event) => {
2418
- if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;
2419
- event.preventDefault();
2420
- const buttons = Array.from(event.currentTarget.parentElement.querySelectorAll("button:not(:disabled)"));
2421
- const position = buttons.indexOf(event.currentTarget);
2422
- const target = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : Math.max(0, Math.min(buttons.length - 1, position + (event.key === "ArrowDown" ? 1 : -1)));
2423
- buttons[target]?.focus();
2424
- }, onClick: () => update(column.index, next), children: use12Hours && column.index === 0 ? `${pad(index % 12 || 12)} ${index < 12 ? "AM" : "PM"}` : next }, next);
2425
- }) }, column.label)) }),
2426
- columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FloatingScrollbarProvider, { targetRef: columnRefs[column.index] }, column.index))
2592
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "sia-date-panel__time-columns", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2593
+ TimeColumn,
2594
+ {
2595
+ ariaLabel: `${ariaLabel}${column.label}`,
2596
+ columnIndex: column.index,
2597
+ count: column.count,
2598
+ value: column.value,
2599
+ siblings,
2600
+ use12Hours,
2601
+ unit: column.unit,
2602
+ unitLabels,
2603
+ disabledTime,
2604
+ onSelect: (next) => update(column.index, next)
2605
+ },
2606
+ column.label
2607
+ )) })
2427
2608
  ] });
2428
2609
  }
2429
2610
  function DatePanelFooter({
@@ -2443,6 +2624,50 @@ function DatePanelFooter({
2443
2624
  needConfirm ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "sia-date-panel__confirm", disabled: disabledConfirm, onClick: onConfirm, children: confirmText }) : null
2444
2625
  ] });
2445
2626
  }
2627
+ function DateTimePanelFooter({
2628
+ date,
2629
+ time,
2630
+ view,
2631
+ disabled = false,
2632
+ extra,
2633
+ onSwitchDate,
2634
+ onSwitchTime,
2635
+ onClearTime
2636
+ }) {
2637
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("footer", { className: "sia-date-panel__footer sia-date-panel__footer--datetime", children: [
2638
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
2639
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "sia-date-panel__chip", "aria-pressed": view === "date" || void 0, disabled, onClick: onSwitchDate, children: [
2640
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "calendar", size: 14, "aria-hidden": "true" }),
2641
+ date
2642
+ ] }),
2643
+ extra
2644
+ ] }),
2645
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: `sia-date-panel__chip sia-date-panel__chip--time${onClearTime ? " is-clearable" : ""}`, "aria-pressed": view === "time" || void 0, disabled, onClick: onSwitchTime, children: [
2646
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "clock", size: 14, "aria-hidden": "true" }),
2647
+ time,
2648
+ onClearTime && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2649
+ "span",
2650
+ {
2651
+ role: "button",
2652
+ tabIndex: 0,
2653
+ "aria-label": "\u6E05\u7A7A\u65F6\u95F4",
2654
+ className: "sia-date-panel__chip-clear",
2655
+ onClick: (event) => {
2656
+ event.stopPropagation();
2657
+ onClearTime();
2658
+ },
2659
+ onKeyDown: (event) => {
2660
+ if (event.key !== "Enter" && event.key !== " ") return;
2661
+ event.preventDefault();
2662
+ event.stopPropagation();
2663
+ onClearTime();
2664
+ },
2665
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "circle-close", variant: "filled", size: 13, "aria-hidden": "true" })
2666
+ }
2667
+ ) : null
2668
+ ] })
2669
+ ] });
2670
+ }
2446
2671
 
2447
2672
  // src/components/DatePicker.tsx
2448
2673
  var import_jsx_runtime8 = require("react/jsx-runtime");
@@ -2492,6 +2717,12 @@ function resolvePreset(value) {
2492
2717
  function resolveRangePreset(value) {
2493
2718
  return typeof value === "function" ? value() : value;
2494
2719
  }
2720
+ function hasExplicitTime(value) {
2721
+ return /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(String(value ?? ""));
2722
+ }
2723
+ function isZeroTime(time, showSecond) {
2724
+ return showSecond ? time === "00:00:00" : time.slice(0, 5) === "00:00";
2725
+ }
2495
2726
  function DatePicker({
2496
2727
  value,
2497
2728
  defaultValue,
@@ -2531,7 +2762,11 @@ function DatePicker({
2531
2762
  const firstCurrent = Array.isArray(currentValue) ? currentValue[0] : currentValue;
2532
2763
  const [viewMonth, setViewMonth] = (0, import_react9.useState)(() => startOfMonth(parseDate(dayFromValue(firstCurrent)) ?? /* @__PURE__ */ new Date()));
2533
2764
  const [draftTime, setDraftTime] = (0, import_react9.useState)(() => timePart(firstCurrent, defaultTimeFrom(showTime)));
2534
- const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
2765
+ const showTimeDefaultProvided = typeof showTime === "object" && showTime.defaultValue !== void 0;
2766
+ const [timeExplicit, setTimeExplicit] = (0, import_react9.useState)(() => showTimeDefaultProvided || hasExplicitTime(typeof initialValue === "string" ? initialValue : void 0));
2767
+ const [dateTimeView, setDateTimeView] = (0, import_react9.useState)("date");
2768
+ const [yearDrill, setYearDrill] = (0, import_react9.useState)(false);
2769
+ const resolvedNeedConfirm = showTime ? false : Boolean(needConfirm);
2535
2770
  const showSecond = showSecondFrom(showTime);
2536
2771
  const selectedDates = (0, import_react9.useMemo)(() => {
2537
2772
  const values = Array.isArray(draftValue) ? draftValue : draftValue ? [draftValue] : [];
@@ -2552,6 +2787,9 @@ function DatePicker({
2552
2787
  const current = Array.isArray(currentValue) ? currentValue[0] : currentValue;
2553
2788
  setViewMonth(startOfMonth(parseDate(dayFromValue(current)) ?? /* @__PURE__ */ new Date()));
2554
2789
  setDraftTime(timePart(current, defaultTimeFrom(showTime)));
2790
+ setTimeExplicit(showTimeDefaultProvided || hasExplicitTime(typeof current === "string" ? current : void 0));
2791
+ setDateTimeView("date");
2792
+ setYearDrill(false);
2555
2793
  }
2556
2794
  setVisible(next);
2557
2795
  }
@@ -2563,9 +2801,11 @@ function DatePicker({
2563
2801
  if (maximum && day.slice(0, length) > String(maximum).slice(0, length)) return true;
2564
2802
  return disabledDate?.(day, { type: "date" }) ?? false;
2565
2803
  }
2566
- function buildValue(day, time = draftTime) {
2804
+ function buildValue(day, time = draftTime, explicit = timeExplicit) {
2567
2805
  const picked = formatPickerValue(day, picker);
2568
- return showTime && picker === "date" ? withTime(picked, time, showSecond) : picked;
2806
+ if (!(showTime && picker === "date")) return picked;
2807
+ if (!explicit && isZeroTime(time, showSecond)) return picked;
2808
+ return withTime(picked, time, showSecond);
2569
2809
  }
2570
2810
  function selectDate(day, time = draftTime, ensureSelected = false) {
2571
2811
  if (isDisabled(day)) return;
@@ -2581,7 +2821,7 @@ function DatePicker({
2581
2821
  setDraftValue(nextValue);
2582
2822
  if (!resolvedNeedConfirm) {
2583
2823
  setCurrentValue(nextValue);
2584
- changeOpen(false);
2824
+ if (!showTime) changeOpen(false);
2585
2825
  }
2586
2826
  }
2587
2827
  function commitDraft() {
@@ -2590,6 +2830,72 @@ function DatePicker({
2590
2830
  setCurrentValue(draftValue);
2591
2831
  changeOpen(false);
2592
2832
  }
2833
+ function applyDraftTime(next) {
2834
+ setDraftTime(next);
2835
+ setTimeExplicit(true);
2836
+ const day = typeof draftValue === "string" ? dayFromValue(draftValue) : "";
2837
+ if (!day) return;
2838
+ const nextValue = withTime(day, next, showSecond);
2839
+ setDraftValue(nextValue);
2840
+ setCurrentValue(nextValue);
2841
+ }
2842
+ function clearDraftTime() {
2843
+ setDraftTime("00:00:00");
2844
+ setTimeExplicit(false);
2845
+ const day = typeof draftValue === "string" ? dayFromValue(draftValue) : "";
2846
+ if (!day) return;
2847
+ setDraftValue(day);
2848
+ setCurrentValue(day);
2849
+ }
2850
+ function renderCalendarSection() {
2851
+ return picker === "year" || yearDrill ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
2852
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__header", children: [
2853
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": "\u4E0A\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, -120)), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "chevron-left", size: 15 }) }) }),
2854
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("strong", { children: [
2855
+ Math.floor(viewMonth.getFullYear() / 10) * 10,
2856
+ "\u5E74 \u2014 ",
2857
+ Math.floor(viewMonth.getFullYear() / 10) * 10 + 9,
2858
+ "\u5E74"
2859
+ ] }),
2860
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": "\u4E0B\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, 120)), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "chevron-right", size: 15 }) }) })
2861
+ ] }),
2862
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sia-date-panel__years", children: Array.from({ length: 10 }, (_, index) => {
2863
+ const year = String(Math.floor(viewMonth.getFullYear() / 10) * 10 + index);
2864
+ const day = `${year}-01-01`;
2865
+ const selected = selectedDates.some((value2) => value2.slice(0, 4) === year);
2866
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `sia-date-panel__cell${selected ? " is-selected" : ""}${year === String((/* @__PURE__ */ new Date()).getFullYear()) ? " is-today" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": `${year}\u5E74`, "aria-pressed": selected, disabled: isDisabled(day), onClick: () => {
2867
+ if (yearDrill) {
2868
+ setViewMonth(new Date(Number(year), viewMonth.getMonth(), 1));
2869
+ setYearDrill(false);
2870
+ } else {
2871
+ selectDate(day);
2872
+ }
2873
+ }, children: year }) }, year);
2874
+ }) })
2875
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
2876
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2877
+ CalendarHeader,
2878
+ {
2879
+ month: viewMonth,
2880
+ onTitleClick: picker === "date" ? () => setYearDrill(true) : void 0,
2881
+ onPreviousYear: () => setViewMonth(addMonths(viewMonth, -12)),
2882
+ onPreviousMonth: () => setViewMonth(addMonths(viewMonth, -1)),
2883
+ onNextMonth: () => setViewMonth(addMonths(viewMonth, 1)),
2884
+ onNextYear: () => setViewMonth(addMonths(viewMonth, 12))
2885
+ }
2886
+ ),
2887
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2888
+ CalendarMonth,
2889
+ {
2890
+ month: viewMonth,
2891
+ selectedDates,
2892
+ disabledDate: isDisabled,
2893
+ onSelect: selectDate,
2894
+ onSwipeMonth: picker === "date" ? (direction) => setViewMonth(addMonths(viewMonth, direction)) : void 0
2895
+ }
2896
+ )
2897
+ ] });
2898
+ }
2593
2899
  function clearValue(event) {
2594
2900
  event.stopPropagation();
2595
2901
  const empty = multiple ? [] : "";
@@ -2629,72 +2935,82 @@ function DatePicker({
2629
2935
  ),
2630
2936
  floating.label,
2631
2937
  allowClear && display && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
2632
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: visible, className: `sia-date-panel${showTime ? " sia-date-panel--with-time" : ""}${presets?.length ? " sia-date-panel--with-presets" : ""}`, role: "dialog", "aria-label": "\u65E5\u671F\u9009\u62E9\u9762\u677F", children: [
2633
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__body", children: [
2634
- presets?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("aside", { className: "sia-date-panel__presets", children: presets.map((preset2, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", onClick: () => {
2635
- const next = resolvePreset(preset2.value);
2636
- if (!next || isDisabled(dayFromValue(next))) return;
2637
- setDraftValue(next);
2638
- if (!resolvedNeedConfirm) {
2639
- setCurrentValue(next);
2938
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2939
+ PopupPortal,
2940
+ {
2941
+ ref: popupRef,
2942
+ anchorRef: rootRef,
2943
+ open: visible,
2944
+ className: `sia-date-panel${showTime ? " sia-date-panel--datetime" : ""}${presets?.length ? " sia-date-panel--with-presets" : ""}`,
2945
+ role: "dialog",
2946
+ "aria-label": "\u65E5\u671F\u9009\u62E9\u9762\u677F",
2947
+ onKeyDown: (event) => {
2948
+ if (event.key === "Escape") {
2949
+ event.stopPropagation();
2640
2950
  changeOpen(false);
2641
2951
  }
2642
- }, children: preset2.label }, index)) }) : null,
2643
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("section", { className: "sia-date-panel__calendar", children: picker === "year" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
2644
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__header", children: [
2645
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": "\u4E0A\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, -120)), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "chevron-left", size: 15 }) }) }),
2646
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("strong", { children: [
2647
- Math.floor(viewMonth.getFullYear() / 10) * 10,
2648
- "\u5E74 \u2014 ",
2649
- Math.floor(viewMonth.getFullYear() / 10) * 10 + 9,
2650
- "\u5E74"
2651
- ] }),
2652
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": "\u4E0B\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, 120)), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "chevron-right", size: 15 }) }) })
2952
+ },
2953
+ children: [
2954
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__body", children: [
2955
+ presets?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("aside", { className: "sia-date-panel__presets", children: presets.map((preset2, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", onClick: () => {
2956
+ const next = resolvePreset(preset2.value);
2957
+ if (!next || isDisabled(dayFromValue(next))) return;
2958
+ setDraftValue(next);
2959
+ setDraftTime(timePart(next, defaultTimeFrom(showTime)));
2960
+ setTimeExplicit(hasExplicitTime(next));
2961
+ if (!resolvedNeedConfirm) {
2962
+ setCurrentValue(next);
2963
+ changeOpen(false);
2964
+ }
2965
+ }, children: preset2.label }, index)) }) : null,
2966
+ showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__views", children: [
2967
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("section", { className: `sia-date-panel__view sia-date-panel__view--date${dateTimeView === "date" ? " is-active" : ""}`, "aria-hidden": dateTimeView !== "date", children: renderCalendarSection() }),
2968
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `sia-date-panel__view sia-date-panel__view--time${dateTimeView === "time" ? " is-active" : ""}`, "aria-hidden": dateTimeView !== "time", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2969
+ TimePanel,
2970
+ {
2971
+ value: draftTime,
2972
+ showSecond,
2973
+ title: "\u9009\u62E9\u65F6\u95F4",
2974
+ unitLabels: true,
2975
+ ariaLabel: "\u9009\u62E9\u65F6\u95F4",
2976
+ onChange: applyDraftTime
2977
+ }
2978
+ ) })
2979
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("section", { className: "sia-date-panel__calendar", children: renderCalendarSection() })
2653
2980
  ] }),
2654
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sia-date-panel__years", children: Array.from({ length: 10 }, (_, index) => {
2655
- const year = String(Math.floor(viewMonth.getFullYear() / 10) * 10 + index);
2656
- const day = `${year}-01-01`;
2657
- const selected = selectedDates.some((value2) => value2.slice(0, 4) === year);
2658
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `sia-date-panel__cell${selected ? " is-selected" : ""}${year === String((/* @__PURE__ */ new Date()).getFullYear()) ? " is-today" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": `${year}\u5E74`, "aria-pressed": selected, disabled: isDisabled(day), onClick: () => selectDate(day), children: year }) }, year);
2659
- }) })
2660
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
2661
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2662
- CalendarHeader,
2981
+ showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2982
+ DateTimePanelFooter,
2663
2983
  {
2664
- month: viewMonth,
2665
- onPreviousYear: () => setViewMonth(addMonths(viewMonth, -12)),
2666
- onPreviousMonth: () => setViewMonth(addMonths(viewMonth, -1)),
2667
- onNextMonth: () => setViewMonth(addMonths(viewMonth, 1)),
2668
- onNextYear: () => setViewMonth(addMonths(viewMonth, 12))
2984
+ date: (typeof draftValue === "string" ? dayFromValue(draftValue) : "") || dateKey(/* @__PURE__ */ new Date()),
2985
+ time: showSecond ? draftTime : draftTime.slice(0, 5),
2986
+ view: dateTimeView,
2987
+ extra: renderExtraFooter?.(),
2988
+ onSwitchDate: () => setDateTimeView("date"),
2989
+ onSwitchTime: () => setDateTimeView("time"),
2990
+ onClearTime: clearDraftTime
2669
2991
  }
2670
- ),
2671
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CalendarMonth, { month: viewMonth, selectedDates, disabledDate: isDisabled, onSelect: selectDate })
2672
- ] }) }),
2673
- showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TimePanel, { value: draftTime, showSecond, onChange: (next) => {
2674
- setDraftTime(next);
2675
- if (typeof draftValue === "string" && draftValue) setDraftValue(withTime(dayFromValue(draftValue), next, showSecond));
2676
- } }) : null
2677
- ] }),
2678
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2679
- DatePanelFooter,
2680
- {
2681
- extra: renderExtraFooter?.(),
2682
- showToday,
2683
- needConfirm: resolvedNeedConfirm,
2684
- disabledConfirm: Array.isArray(draftValue) ? draftValue.length === 0 : !draftValue,
2685
- onToday: () => {
2686
- const now = /* @__PURE__ */ new Date();
2687
- const day = dateKey(now);
2688
- if (isDisabled(day)) return;
2689
- const time = [now.getHours(), now.getMinutes(), now.getSeconds()].map(pad).join(":");
2690
- if (showTime) setDraftTime(time);
2691
- setViewMonth(startOfMonth(now));
2692
- selectDate(day, time, true);
2693
- },
2694
- onConfirm: commitDraft
2695
- }
2696
- )
2697
- ] })
2992
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2993
+ DatePanelFooter,
2994
+ {
2995
+ extra: renderExtraFooter?.(),
2996
+ showToday,
2997
+ needConfirm: resolvedNeedConfirm,
2998
+ disabledConfirm: Array.isArray(draftValue) ? draftValue.length === 0 : !draftValue,
2999
+ onToday: () => {
3000
+ const now = /* @__PURE__ */ new Date();
3001
+ const day = dateKey(now);
3002
+ if (isDisabled(day)) return;
3003
+ const time = [now.getHours(), now.getMinutes(), now.getSeconds()].map(pad).join(":");
3004
+ if (showTime) setDraftTime(time);
3005
+ setViewMonth(startOfMonth(now));
3006
+ selectDate(day, time, true);
3007
+ },
3008
+ onConfirm: commitDraft
3009
+ }
3010
+ )
3011
+ ]
3012
+ }
3013
+ )
2698
3014
  ] });
2699
3015
  }
2700
3016
  function DateRangePicker({
@@ -2754,8 +3070,7 @@ function DateRangePicker({
2754
3070
  }
2755
3071
  return () => observer.disconnect();
2756
3072
  });
2757
- const [confirmedIndex, setConfirmedIndex] = (0, import_react9.useState)(null);
2758
- const [presetSelected, setPresetSelected] = (0, import_react9.useState)(false);
3073
+ const [dateTimeView, setDateTimeView] = (0, import_react9.useState)("date");
2759
3074
  const [hoverDate, setHoverDate] = (0, import_react9.useState)("");
2760
3075
  const [viewMonth, setViewMonth] = (0, import_react9.useState)(() => startOfMonth(parseDate(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date()));
2761
3076
  const [endViewMonth, setEndViewMonth] = (0, import_react9.useState)(() => startOfMonth(parseDate(dayFromValue(currentValue[1])) ?? addMonths(parseDate(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1)));
@@ -2766,7 +3081,7 @@ function DateRangePicker({
2766
3081
  timePart(currentValue[0], defaultTime),
2767
3082
  timePart(currentValue[1], defaultEndTime)
2768
3083
  ]);
2769
- const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
3084
+ const resolvedNeedConfirm = showTime ? false : Boolean(needConfirm);
2770
3085
  const rangeDates = [dayFromValue(draftValue[0]), dayFromValue(draftValue[1])];
2771
3086
  const invalidDateTimeRange = Boolean(showTime && draftValue[0] && draftValue[1] && draftValue[0] > draftValue[1]);
2772
3087
  (0, import_react9.useEffect)(() => {
@@ -2783,11 +3098,10 @@ function DateRangePicker({
2783
3098
  }
2784
3099
  function changeOpen(next, endpoint) {
2785
3100
  if (next && !visible) {
2786
- setConfirmedIndex(null);
2787
- setPresetSelected(false);
2788
3101
  setDraftValue(currentValue);
2789
3102
  setTimes([timePart(currentValue[0], defaultTime), timePart(currentValue[1], defaultEndTime)]);
2790
3103
  setActiveIndex(endpointDisabled[0] ? 1 : endpointDisabled[1] ? 0 : endpoint ?? (currentValue[0] && !currentValue[1] ? 1 : 0));
3104
+ setDateTimeView("date");
2791
3105
  const nextStartMonth = startOfMonth(parseDate(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date());
2792
3106
  setViewMonth(nextStartMonth);
2793
3107
  setEndViewMonth(startOfMonth(parseDate(dayFromValue(currentValue[1])) ?? addMonths(nextStartMonth, 1)));
@@ -2803,9 +3117,9 @@ function DateRangePicker({
2803
3117
  if (maximum && day > String(maximum).slice(0, 10)) return true;
2804
3118
  const from = index === 1 ? rangeDates[0] : void 0;
2805
3119
  if (dateTimeStep) {
2806
- const otherIndex2 = index === 0 ? 1 : 0;
2807
- const otherEndpoint = rangeDates[otherIndex2];
2808
- if (otherEndpoint && (endpointDisabled[otherIndex2] || confirmedIndex === otherIndex2)) {
3120
+ const otherIndex = index === 0 ? 1 : 0;
3121
+ const otherEndpoint = rangeDates[otherIndex];
3122
+ if (otherEndpoint) {
2809
3123
  if (index === 0 && day > otherEndpoint || index === 1 && day < otherEndpoint) return true;
2810
3124
  if (maxRangeDays && Math.abs(daysBetween(otherEndpoint, day)) >= maxRangeDays) return true;
2811
3125
  }
@@ -2816,10 +3130,9 @@ function DateRangePicker({
2816
3130
  return showTime ? withTime(day, times[index], showSecond) : day;
2817
3131
  }
2818
3132
  function updateDraft(next) {
2819
- setPresetSelected(false);
2820
3133
  setDraftValue(next);
2821
3134
  onCalendarChange?.(next);
2822
- if (!showTime && isValidRange(next) && (next[0] !== currentValue[0] || next[1] !== currentValue[1])) {
3135
+ if (isValidRange(next) && (next[0] !== currentValue[0] || next[1] !== currentValue[1])) {
2823
3136
  setCurrentValue(next);
2824
3137
  }
2825
3138
  }
@@ -2860,6 +3173,13 @@ function DateRangePicker({
2860
3173
  nextValue[index] = withTime(day, time, showSecond);
2861
3174
  updateDraft(nextValue);
2862
3175
  setHoverDate("");
3176
+ const otherIndex = index === 0 ? 1 : 0;
3177
+ if (!nextValue[otherIndex]) {
3178
+ setActiveIndex(otherIndex);
3179
+ const month = startOfMonth(parseDate(day) ?? /* @__PURE__ */ new Date());
3180
+ (otherIndex === 0 ? setViewMonth : setEndViewMonth)(month);
3181
+ return;
3182
+ }
2863
3183
  setActiveIndex(index);
2864
3184
  }
2865
3185
  function changeTime(index, nextTime) {
@@ -2896,19 +3216,7 @@ function DateRangePicker({
2896
3216
  }
2897
3217
  return true;
2898
3218
  }
2899
- const otherIndex = activeIndex === 0 ? 1 : 0;
2900
- const needsOtherConfirmation = Boolean(showTime && !presetSelected && !endpointDisabled[otherIndex] && confirmedIndex !== otherIndex);
2901
3219
  function confirm() {
2902
- if (needsOtherConfirmation) {
2903
- if (!draftValue[activeIndex] && !allowEmpty[activeIndex]) return;
2904
- setConfirmedIndex(activeIndex);
2905
- setActiveIndex(otherIndex);
2906
- const month = startOfMonth(parseDate(dayFromValue(draftValue[activeIndex])) ?? /* @__PURE__ */ new Date());
2907
- if (otherIndex === 0) setViewMonth(month);
2908
- else setEndViewMonth(month);
2909
- setHoverDate("");
2910
- return;
2911
- }
2912
3220
  if (!isValidRange(draftValue)) return;
2913
3221
  setCurrentValue(draftValue);
2914
3222
  changeOpen(false);
@@ -2921,13 +3229,11 @@ function DateRangePicker({
2921
3229
  ];
2922
3230
  if (!isValidRange(next)) return;
2923
3231
  updateDraft(next);
2924
- setConfirmedIndex(null);
2925
- setPresetSelected(true);
2926
3232
  setTimes([timePart(next[0], defaultTime), timePart(next[1], defaultEndTime)]);
2927
3233
  const nextStartMonth = startOfMonth(parseDate(dayFromValue(next[0] || next[1])) ?? /* @__PURE__ */ new Date());
2928
3234
  setViewMonth(nextStartMonth);
2929
3235
  setEndViewMonth(startOfMonth(parseDate(dayFromValue(next[1])) ?? addMonths(nextStartMonth, 1)));
2930
- if (!showTime && !resolvedNeedConfirm) {
3236
+ if (!resolvedNeedConfirm) {
2931
3237
  changeOpen(false);
2932
3238
  }
2933
3239
  }
@@ -2942,49 +3248,29 @@ function DateRangePicker({
2942
3248
  const month = index === 0 ? viewMonth : endViewMonth;
2943
3249
  const setMonth = index === 0 ? setViewMonth : setEndViewMonth;
2944
3250
  const endpointLabel = index === 0 ? "\u5F00\u59CB" : "\u7ED3\u675F";
2945
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2946
- "div",
2947
- {
2948
- className: `sia-date-panel__range-date-time-group${activeIndex === index ? " is-active" : ""}`,
2949
- "aria-label": `${endpointLabel}\u65E5\u671F\u65F6\u95F4`,
2950
- children: [
2951
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "sia-date-panel__calendar", children: [
2952
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2953
- CalendarHeader,
2954
- {
2955
- month,
2956
- label: endpointLabel,
2957
- range: true,
2958
- onPreviousYear: () => setMonth(addMonths(month, -12)),
2959
- onPreviousMonth: () => setMonth(addMonths(month, -1)),
2960
- onNextMonth: () => setMonth(addMonths(month, 1)),
2961
- onNextYear: () => setMonth(addMonths(month, 12))
2962
- }
2963
- ),
2964
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2965
- CalendarMonth,
2966
- {
2967
- month,
2968
- range: rangeDates,
2969
- disabledDate: (day) => isDisabled(day, index, true),
2970
- onSelect: (day) => selectDateTime(day, index)
2971
- }
2972
- )
2973
- ] }),
2974
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2975
- TimePanel,
2976
- {
2977
- value: times[index],
2978
- showSecond,
2979
- ariaLabel: `${endpointLabel}\u65F6\u95F4`,
2980
- disabledTime: endpointDisabled[index] ? () => true : void 0,
2981
- onChange: (nextTime) => changeTime(index, nextTime)
2982
- }
2983
- )
2984
- ]
2985
- },
2986
- endpointLabel
2987
- );
3251
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3252
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3253
+ CalendarHeader,
3254
+ {
3255
+ month,
3256
+ label: endpointLabel,
3257
+ range: true,
3258
+ onPreviousYear: () => setMonth(addMonths(month, -12)),
3259
+ onPreviousMonth: () => setMonth(addMonths(month, -1)),
3260
+ onNextMonth: () => setMonth(addMonths(month, 1)),
3261
+ onNextYear: () => setMonth(addMonths(month, 12))
3262
+ }
3263
+ ),
3264
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3265
+ CalendarMonth,
3266
+ {
3267
+ month,
3268
+ range: rangeDates,
3269
+ disabledDate: (day) => isDisabled(day, index, true),
3270
+ onSelect: (day) => selectDateTime(day, index)
3271
+ }
3272
+ )
3273
+ ] });
2988
3274
  }
2989
3275
  const displayValue = visible && allowEmpty.some(Boolean) ? draftValue : currentValue;
2990
3276
  const startFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[0], filled: Boolean(displayValue[0]), active: visible });
@@ -3029,67 +3315,110 @@ function DateRangePicker({
3029
3315
  }
3030
3316
  ),
3031
3317
  allowClear && (displayValue[0] || displayValue[1]) && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F\u8303\u56F4", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
3032
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: visible, className: `sia-date-panel sia-date-panel--range${showTime ? " sia-date-panel--with-time sia-date-panel--range-time-compact" : ""}${presets?.length ? " sia-date-panel--with-presets" : ""}`, role: "dialog", "aria-label": "\u65E5\u671F\u8303\u56F4\u9009\u62E9\u9762\u677F", children: [
3033
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__body", children: [
3034
- presets?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("aside", { className: "sia-date-panel__presets", "aria-label": "\u5FEB\u6377\u65E5\u671F\u8303\u56F4", children: presets.map((preset2, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", onClick: () => applyPreset(preset2), children: preset2.label }, index)) }) : null,
3035
- showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sia-date-panel__range-date-time", children: renderDateTimeGroup(activeIndex) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__range-calendars", children: [
3036
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "sia-date-panel__calendar", children: [
3037
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3038
- CalendarHeader,
3039
- {
3040
- month: viewMonth,
3041
- range: true,
3042
- onPreviousYear: () => setViewMonth(addMonths(viewMonth, -12)),
3043
- onPreviousMonth: () => setViewMonth(addMonths(viewMonth, -1))
3044
- }
3045
- ),
3046
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CalendarMonth, { month: viewMonth, range: rangeDates, previewEnd: activeIndex === 1 ? hoverDate : "", disabledDate: isDisabled, onSelect: selectDate, onHover: activeIndex === 1 ? setHoverDate : void 0 })
3047
- ] }),
3048
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "sia-date-panel__calendar", children: [
3049
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3050
- CalendarHeader,
3051
- {
3052
- month: addMonths(viewMonth, 1),
3053
- range: true,
3054
- onNextMonth: () => setViewMonth(addMonths(viewMonth, 1)),
3055
- onNextYear: () => setViewMonth(addMonths(viewMonth, 12))
3056
- }
3057
- ),
3058
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CalendarMonth, { month: addMonths(viewMonth, 1), range: rangeDates, previewEnd: activeIndex === 1 ? hoverDate : "", disabledDate: isDisabled, onSelect: selectDate, onHover: activeIndex === 1 ? setHoverDate : void 0 })
3059
- ] })
3060
- ] })
3061
- ] }),
3062
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3063
- DatePanelFooter,
3064
- {
3065
- showToday: showToday && !presets?.length,
3066
- needConfirm: Boolean(showTime) || resolvedNeedConfirm || allowEmpty.some(Boolean),
3067
- disabledConfirm: needsOtherConfirmation ? !draftValue[activeIndex] && !allowEmpty[activeIndex] : !isValidRange(draftValue),
3068
- extra: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3069
- renderExtraFooter?.(),
3070
- invalidDateTimeRange ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("small", { className: "sia-date-panel__range-error", children: "\u7ED3\u675F\u65F6\u95F4\u4E0D\u80FD\u65E9\u4E8E\u5F00\u59CB\u65F6\u95F4" }) : maxRangeDays ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("small", { children: [
3071
- "\u6700\u591A\u9009\u62E9 ",
3072
- maxRangeDays,
3073
- " \u5929"
3074
- ] }) : null
3318
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3319
+ PopupPortal,
3320
+ {
3321
+ ref: popupRef,
3322
+ anchorRef: rootRef,
3323
+ open: visible,
3324
+ className: `sia-date-panel${showTime ? " sia-date-panel--datetime" : " sia-date-panel--range"}${presets?.length ? " sia-date-panel--with-presets" : ""}`,
3325
+ role: "dialog",
3326
+ "aria-label": "\u65E5\u671F\u8303\u56F4\u9009\u62E9\u9762\u677F",
3327
+ onKeyDown: (event) => {
3328
+ if (event.key === "Escape") {
3329
+ event.stopPropagation();
3330
+ dismissPanel();
3331
+ }
3332
+ },
3333
+ children: [
3334
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__body", children: [
3335
+ presets?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("aside", { className: "sia-date-panel__presets", "aria-label": "\u5FEB\u6377\u65E5\u671F\u8303\u56F4", children: presets.map((preset2, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", onClick: () => applyPreset(preset2), children: preset2.label }, index)) }) : null,
3336
+ showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__views", children: [
3337
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("section", { className: `sia-date-panel__view sia-date-panel__view--date${dateTimeView === "date" ? " is-active" : ""}`, "aria-hidden": dateTimeView !== "date", "aria-label": `${activeIndex === 0 ? "\u5F00\u59CB" : "\u7ED3\u675F"}\u65E5\u671F`, children: renderDateTimeGroup(activeIndex) }, activeIndex === 0 ? "\u5F00\u59CB" : "\u7ED3\u675F"),
3338
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `sia-date-panel__view sia-date-panel__view--time${dateTimeView === "time" ? " is-active" : ""}`, "aria-hidden": dateTimeView !== "time", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3339
+ TimePanel,
3340
+ {
3341
+ value: times[activeIndex],
3342
+ showSecond,
3343
+ title: `\u9009\u62E9${activeIndex === 0 ? "\u5F00\u59CB" : "\u7ED3\u675F"}\u65F6\u95F4`,
3344
+ unitLabels: true,
3345
+ ariaLabel: `\u9009\u62E9${activeIndex === 0 ? "\u5F00\u59CB" : "\u7ED3\u675F"}\u65F6\u95F4`,
3346
+ disabledTime: endpointDisabled[activeIndex] ? () => true : void 0,
3347
+ onChange: (nextTime) => changeTime(activeIndex, nextTime)
3348
+ }
3349
+ ) })
3350
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__range-calendars", children: [
3351
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "sia-date-panel__calendar", children: [
3352
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3353
+ CalendarHeader,
3354
+ {
3355
+ month: viewMonth,
3356
+ range: true,
3357
+ onPreviousYear: () => setViewMonth(addMonths(viewMonth, -12)),
3358
+ onPreviousMonth: () => setViewMonth(addMonths(viewMonth, -1))
3359
+ }
3360
+ ),
3361
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CalendarMonth, { month: viewMonth, range: rangeDates, previewEnd: activeIndex === 1 ? hoverDate : "", disabledDate: isDisabled, onSelect: selectDate, onHover: activeIndex === 1 ? setHoverDate : void 0 })
3362
+ ] }),
3363
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "sia-date-panel__calendar", children: [
3364
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3365
+ CalendarHeader,
3366
+ {
3367
+ month: addMonths(viewMonth, 1),
3368
+ range: true,
3369
+ onNextMonth: () => setViewMonth(addMonths(viewMonth, 1)),
3370
+ onNextYear: () => setViewMonth(addMonths(viewMonth, 12))
3371
+ }
3372
+ ),
3373
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CalendarMonth, { month: addMonths(viewMonth, 1), range: rangeDates, previewEnd: activeIndex === 1 ? hoverDate : "", disabledDate: isDisabled, onSelect: selectDate, onHover: activeIndex === 1 ? setHoverDate : void 0 })
3374
+ ] })
3375
+ ] })
3075
3376
  ] }),
3076
- onToday: () => {
3077
- const now = /* @__PURE__ */ new Date();
3078
- const day = dateKey(now);
3079
- if (isDisabled(day, activeIndex, Boolean(showTime))) return;
3080
- if (showTime) {
3081
- const time = [now.getHours(), now.getMinutes(), now.getSeconds()].map(pad).join(":");
3082
- (activeIndex === 0 ? setViewMonth : setEndViewMonth)(startOfMonth(now));
3083
- selectDateTime(day, activeIndex, time);
3084
- } else {
3085
- setViewMonth(startOfMonth(now));
3086
- selectDate(day);
3377
+ showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3378
+ DateTimePanelFooter,
3379
+ {
3380
+ date: rangeDates[activeIndex] || dateKey(/* @__PURE__ */ new Date()),
3381
+ time: showSecond ? times[activeIndex] : times[activeIndex].slice(0, 5),
3382
+ view: dateTimeView,
3383
+ disabled: endpointDisabled[activeIndex],
3384
+ extra: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3385
+ renderExtraFooter?.(),
3386
+ invalidDateTimeRange ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("small", { className: "sia-date-panel__range-error", children: "\u7ED3\u675F\u65F6\u95F4\u4E0D\u80FD\u65E9\u4E8E\u5F00\u59CB\u65F6\u95F4" }) : maxRangeDays ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("small", { children: [
3387
+ "\u6700\u591A\u9009\u62E9 ",
3388
+ maxRangeDays,
3389
+ " \u5929"
3390
+ ] }) : null
3391
+ ] }),
3392
+ onSwitchDate: () => setDateTimeView("date"),
3393
+ onSwitchTime: () => setDateTimeView("time")
3087
3394
  }
3088
- },
3089
- onConfirm: confirm
3090
- }
3091
- )
3092
- ] })
3395
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3396
+ DatePanelFooter,
3397
+ {
3398
+ showToday: showToday && !presets?.length,
3399
+ needConfirm: resolvedNeedConfirm || allowEmpty.some(Boolean),
3400
+ disabledConfirm: !isValidRange(draftValue),
3401
+ extra: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3402
+ renderExtraFooter?.(),
3403
+ invalidDateTimeRange ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("small", { className: "sia-date-panel__range-error", children: "\u7ED3\u675F\u65F6\u95F4\u4E0D\u80FD\u65E9\u4E8E\u5F00\u59CB\u65F6\u95F4" }) : maxRangeDays ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("small", { children: [
3404
+ "\u6700\u591A\u9009\u62E9 ",
3405
+ maxRangeDays,
3406
+ " \u5929"
3407
+ ] }) : null
3408
+ ] }),
3409
+ onToday: () => {
3410
+ const now = /* @__PURE__ */ new Date();
3411
+ const day = dateKey(now);
3412
+ if (isDisabled(day, activeIndex, Boolean(showTime))) return;
3413
+ setViewMonth(startOfMonth(now));
3414
+ selectDate(day);
3415
+ },
3416
+ onConfirm: confirm
3417
+ }
3418
+ )
3419
+ ]
3420
+ }
3421
+ )
3093
3422
  ] });
3094
3423
  }
3095
3424
  ((DatePicker2) => {