@sia.soul/sia-react-ui 0.1.162 → 0.1.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chart.cjs +1 -1
- package/dist/chart.js +5 -5
- package/dist/{chunk-ZNPNZD6O.js → chunk-23FQ5ARA.js} +4 -4
- package/dist/{chunk-33WX54AU.js → chunk-2EC653G5.js} +5 -5
- package/dist/{chunk-WMZYYPIW.js → chunk-CUAXJCSH.js} +1 -1
- package/dist/{chunk-Q3LEK2TL.js → chunk-DKQ5UCN6.js} +58 -42
- package/dist/{chunk-KA3M4TE4.js → chunk-G5EJJFUI.js} +2 -2
- package/dist/{chunk-UL54A2YN.js → chunk-J6BPKBEL.js} +2 -2
- package/dist/{chunk-M4IASLGB.js → chunk-NHGCGOF2.js} +3 -3
- package/dist/{chunk-CRA7VNOA.js → chunk-OHAESA5R.js} +1 -1
- package/dist/{chunk-4B7ATL6J.js → chunk-PAWEP65C.js} +1 -1
- package/dist/{chunk-MXK6TKMO.js → chunk-SX4LLT3H.js} +5 -5
- package/dist/{chunk-5WZR2RHA.js → chunk-V4I32DPL.js} +2 -2
- package/dist/{chunk-UPXL2QLJ.js → chunk-WR5YBY2A.js} +6 -6
- package/dist/core.cjs +1 -1
- package/dist/core.css +81 -7
- package/dist/core.js +8 -8
- package/dist/game.cjs +1 -1
- package/dist/game.js +3 -3
- package/dist/index.cjs +55 -39
- package/dist/index.css +81 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -12
- package/dist/markdown-editor.cjs +1 -1
- package/dist/markdown-editor.js +3 -3
- package/dist/rich-text-editor.cjs +1 -1
- package/dist/rich-text-editor.js +7 -7
- package/dist/{select-date-range-Cbh37zmU.d.cts → select-date-range-C9lTBQFX.d.cts} +4 -4
- package/dist/{select-date-range-CIXBuoef.d.ts → select-date-range-CQCGGkkt.d.ts} +4 -4
- package/dist/select-date-range.cjs +55 -39
- package/dist/select-date-range.d.cts +1 -1
- package/dist/select-date-range.d.ts +1 -1
- package/dist/select-date-range.js +8 -8
- package/package.json +1 -1
|
@@ -790,7 +790,7 @@ var PopupPortal = (0, import_react4.forwardRef)(function PopupPortal2({
|
|
|
790
790
|
cancelAnimationFrame(frame);
|
|
791
791
|
observer.disconnect();
|
|
792
792
|
};
|
|
793
|
-
}, [anchorRef, offset, motion.present, placement, viewportPadding]);
|
|
793
|
+
}, [anchorRef, offset, motion.present, placement, viewportPadding, position?.availableHeight, position?.placement]);
|
|
794
794
|
if (!motion.present || typeof document === "undefined") return null;
|
|
795
795
|
return (0, import_react_dom.createPortal)(
|
|
796
796
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -2366,10 +2366,12 @@ function CalendarMonth({
|
|
|
2366
2366
|
const rangeStart = Boolean(start && key === start);
|
|
2367
2367
|
const rangeEnd = Boolean(range[1] && key === range[1]);
|
|
2368
2368
|
const inRange = Boolean(low && high && key >= low && key <= high);
|
|
2369
|
+
const segmentStart = inRange && (index % 7 === 0 || key === low);
|
|
2370
|
+
const segmentEnd = inRange && (index % 7 === 6 || key === high);
|
|
2369
2371
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2370
2372
|
"span",
|
|
2371
2373
|
{
|
|
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" : ""}`,
|
|
2374
|
+
className: `sia-date-panel__cell${outside ? " is-outside" : ""}${selected ? " is-selected" : ""}${rangeStart ? " is-range-start" : ""}${rangeEnd ? " is-range-end" : ""}${inRange ? " is-in-range" : ""}${segmentStart ? " is-range-segment-start" : ""}${segmentEnd ? " is-range-segment-end" : ""}${key === today ? " is-today" : ""}`,
|
|
2373
2375
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2374
2376
|
"button",
|
|
2375
2377
|
{
|
|
@@ -3070,10 +3072,10 @@ function DateRangePicker({
|
|
|
3070
3072
|
}
|
|
3071
3073
|
return () => observer.disconnect();
|
|
3072
3074
|
});
|
|
3073
|
-
const [
|
|
3075
|
+
const [dateTimeViews, setDateTimeViews] = (0, import_react9.useState)(["date", "date"]);
|
|
3074
3076
|
const [hoverDate, setHoverDate] = (0, import_react9.useState)("");
|
|
3075
3077
|
const [viewMonth, setViewMonth] = (0, import_react9.useState)(() => startOfMonth(parseDate(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date()));
|
|
3076
|
-
const [endViewMonth, setEndViewMonth] = (0, import_react9.useState)(() => startOfMonth(parseDate(dayFromValue(currentValue[1])) ?? addMonths(parseDate(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1)));
|
|
3078
|
+
const [endViewMonth, setEndViewMonth] = (0, import_react9.useState)(() => startOfMonth(parseDate(dayFromValue(currentValue[1])) ?? (showTime ? parseDate(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date() : addMonths(parseDate(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1))));
|
|
3077
3079
|
const showSecond = showSecondFrom(showTime);
|
|
3078
3080
|
const defaultTime = defaultTimeFrom(showTime);
|
|
3079
3081
|
const defaultEndTime = defaultTimeFrom(showTime, 1);
|
|
@@ -3101,10 +3103,10 @@ function DateRangePicker({
|
|
|
3101
3103
|
setDraftValue(currentValue);
|
|
3102
3104
|
setTimes([timePart(currentValue[0], defaultTime), timePart(currentValue[1], defaultEndTime)]);
|
|
3103
3105
|
setActiveIndex(endpointDisabled[0] ? 1 : endpointDisabled[1] ? 0 : endpoint ?? (currentValue[0] && !currentValue[1] ? 1 : 0));
|
|
3104
|
-
|
|
3106
|
+
setDateTimeViews(["date", "date"]);
|
|
3105
3107
|
const nextStartMonth = startOfMonth(parseDate(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date());
|
|
3106
3108
|
setViewMonth(nextStartMonth);
|
|
3107
|
-
setEndViewMonth(startOfMonth(parseDate(dayFromValue(currentValue[1])) ?? addMonths(nextStartMonth, 1)));
|
|
3109
|
+
setEndViewMonth(startOfMonth(parseDate(dayFromValue(currentValue[1])) ?? (showTime ? nextStartMonth : addMonths(nextStartMonth, 1))));
|
|
3108
3110
|
}
|
|
3109
3111
|
if (next && endpoint !== void 0 && !endpointDisabled[endpoint]) setActiveIndex(endpoint);
|
|
3110
3112
|
setVisible(next);
|
|
@@ -3173,13 +3175,6 @@ function DateRangePicker({
|
|
|
3173
3175
|
nextValue[index] = withTime(day, time, showSecond);
|
|
3174
3176
|
updateDraft(nextValue);
|
|
3175
3177
|
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
|
-
}
|
|
3183
3178
|
setActiveIndex(index);
|
|
3184
3179
|
}
|
|
3185
3180
|
function changeTime(index, nextTime) {
|
|
@@ -3232,7 +3227,7 @@ function DateRangePicker({
|
|
|
3232
3227
|
setTimes([timePart(next[0], defaultTime), timePart(next[1], defaultEndTime)]);
|
|
3233
3228
|
const nextStartMonth = startOfMonth(parseDate(dayFromValue(next[0] || next[1])) ?? /* @__PURE__ */ new Date());
|
|
3234
3229
|
setViewMonth(nextStartMonth);
|
|
3235
|
-
setEndViewMonth(startOfMonth(parseDate(dayFromValue(next[1])) ?? addMonths(nextStartMonth, 1)));
|
|
3230
|
+
setEndViewMonth(startOfMonth(parseDate(dayFromValue(next[1])) ?? (showTime ? nextStartMonth : addMonths(nextStartMonth, 1))));
|
|
3236
3231
|
if (!resolvedNeedConfirm) {
|
|
3237
3232
|
changeOpen(false);
|
|
3238
3233
|
}
|
|
@@ -3272,6 +3267,43 @@ function DateRangePicker({
|
|
|
3272
3267
|
)
|
|
3273
3268
|
] });
|
|
3274
3269
|
}
|
|
3270
|
+
function switchDateTimeView(index, view) {
|
|
3271
|
+
if (endpointDisabled[index]) return;
|
|
3272
|
+
setActiveIndex(index);
|
|
3273
|
+
setDateTimeViews((previous) => index === 0 ? [view, previous[1]] : [previous[0], view]);
|
|
3274
|
+
}
|
|
3275
|
+
function renderDateTimeEndpoint(index) {
|
|
3276
|
+
const label = index === 0 ? "\u5F00\u59CB" : "\u7ED3\u675F";
|
|
3277
|
+
const view = dateTimeViews[index];
|
|
3278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "sia-date-panel__endpoint", "aria-label": `${label}\u65E5\u671F\u65F6\u95F4`, children: [
|
|
3279
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__views", children: [
|
|
3280
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("section", { className: `sia-date-panel__view sia-date-panel__view--date${view === "date" ? " is-active" : ""}`, "aria-hidden": view !== "date", ...view !== "date" ? { inert: "" } : {}, "aria-label": `${label}\u65E5\u671F`, children: renderDateTimeGroup(index) }),
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `sia-date-panel__view sia-date-panel__view--time${view === "time" ? " is-active" : ""}`, "aria-hidden": view !== "time", ...view !== "time" ? { inert: "" } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3282
|
+
TimePanel,
|
|
3283
|
+
{
|
|
3284
|
+
value: times[index],
|
|
3285
|
+
showSecond,
|
|
3286
|
+
title: `\u9009\u62E9${label}\u65F6\u95F4`,
|
|
3287
|
+
unitLabels: true,
|
|
3288
|
+
ariaLabel: `\u9009\u62E9${label}\u65F6\u95F4`,
|
|
3289
|
+
disabledTime: endpointDisabled[index] ? () => true : void 0,
|
|
3290
|
+
onChange: (nextTime) => changeTime(index, nextTime)
|
|
3291
|
+
}
|
|
3292
|
+
) })
|
|
3293
|
+
] }),
|
|
3294
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3295
|
+
DateTimePanelFooter,
|
|
3296
|
+
{
|
|
3297
|
+
date: rangeDates[index] || dateKey(/* @__PURE__ */ new Date()),
|
|
3298
|
+
time: showSecond ? times[index] : times[index].slice(0, 5),
|
|
3299
|
+
view,
|
|
3300
|
+
disabled: endpointDisabled[index],
|
|
3301
|
+
onSwitchDate: () => switchDateTimeView(index, "date"),
|
|
3302
|
+
onSwitchTime: () => switchDateTimeView(index, "time")
|
|
3303
|
+
}
|
|
3304
|
+
)
|
|
3305
|
+
] }, index);
|
|
3306
|
+
}
|
|
3275
3307
|
const displayValue = visible && allowEmpty.some(Boolean) ? draftValue : currentValue;
|
|
3276
3308
|
const startFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[0], filled: Boolean(displayValue[0]), active: visible });
|
|
3277
3309
|
const endFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[1], filled: Boolean(displayValue[1]), active: visible });
|
|
@@ -3321,7 +3353,7 @@ function DateRangePicker({
|
|
|
3321
3353
|
ref: popupRef,
|
|
3322
3354
|
anchorRef: rootRef,
|
|
3323
3355
|
open: visible,
|
|
3324
|
-
className: `sia-date-panel${showTime ? " sia-date-panel--datetime" : " sia-date-panel--range"}${presets?.length ? " sia-date-panel--with-presets" : ""}`,
|
|
3356
|
+
className: `sia-date-panel${showTime ? " sia-date-panel--datetime-range" : " sia-date-panel--range"}${presets?.length ? " sia-date-panel--with-presets" : ""}`,
|
|
3325
3357
|
role: "dialog",
|
|
3326
3358
|
"aria-label": "\u65E5\u671F\u8303\u56F4\u9009\u62E9\u9762\u677F",
|
|
3327
3359
|
onKeyDown: (event) => {
|
|
@@ -3333,20 +3365,9 @@ function DateRangePicker({
|
|
|
3333
3365
|
children: [
|
|
3334
3366
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__body", children: [
|
|
3335
3367
|
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-
|
|
3337
|
-
|
|
3338
|
-
|
|
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
|
-
) })
|
|
3368
|
+
showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__datetime-endpoints", children: [
|
|
3369
|
+
renderDateTimeEndpoint(0),
|
|
3370
|
+
renderDateTimeEndpoint(1)
|
|
3350
3371
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__range-calendars", children: [
|
|
3351
3372
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "sia-date-panel__calendar", children: [
|
|
3352
3373
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -3374,13 +3395,10 @@ function DateRangePicker({
|
|
|
3374
3395
|
] })
|
|
3375
3396
|
] })
|
|
3376
3397
|
] }),
|
|
3377
|
-
showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3378
|
-
|
|
3398
|
+
showTime ? renderExtraFooter || invalidDateTimeRange || maxRangeDays ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3399
|
+
DatePanelFooter,
|
|
3379
3400
|
{
|
|
3380
|
-
|
|
3381
|
-
time: showSecond ? times[activeIndex] : times[activeIndex].slice(0, 5),
|
|
3382
|
-
view: dateTimeView,
|
|
3383
|
-
disabled: endpointDisabled[activeIndex],
|
|
3401
|
+
showToday: false,
|
|
3384
3402
|
extra: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3385
3403
|
renderExtraFooter?.(),
|
|
3386
3404
|
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: [
|
|
@@ -3388,11 +3406,9 @@ function DateRangePicker({
|
|
|
3388
3406
|
maxRangeDays,
|
|
3389
3407
|
" \u5929"
|
|
3390
3408
|
] }) : null
|
|
3391
|
-
] })
|
|
3392
|
-
onSwitchDate: () => setDateTimeView("date"),
|
|
3393
|
-
onSwitchTime: () => setDateTimeView("time")
|
|
3409
|
+
] })
|
|
3394
3410
|
}
|
|
3395
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3411
|
+
) : null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3396
3412
|
DatePanelFooter,
|
|
3397
3413
|
{
|
|
3398
3414
|
showToday: showToday && !presets?.length,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-
|
|
1
|
+
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-C9lTBQFX.cjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './shared-Bx4B28Wh.cjs';
|
|
4
4
|
import './Select-Dxevc0f6.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-
|
|
1
|
+
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-CQCGGkkt.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './shared-Bx4B28Wh.js';
|
|
4
4
|
import './Select-tsENCXQI.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectDateRange
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-DKQ5UCN6.js";
|
|
4
|
+
import "./chunk-SX4LLT3H.js";
|
|
5
|
+
import "./chunk-23FQ5ARA.js";
|
|
6
|
+
import "./chunk-J6BPKBEL.js";
|
|
7
|
+
import "./chunk-G5EJJFUI.js";
|
|
8
|
+
import "./chunk-PAWEP65C.js";
|
|
9
|
+
import "./chunk-OHAESA5R.js";
|
|
10
10
|
import {
|
|
11
11
|
initializeDefaultScrollbars
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CUAXJCSH.js";
|
|
13
13
|
|
|
14
14
|
// src/select-date-range.ts
|
|
15
15
|
initializeDefaultScrollbars();
|