@nori-ui/core 1.0.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2UXKXUX2.js +286 -0
- package/dist/chunk-2UXKXUX2.js.map +1 -0
- package/dist/{chunk-DDGMLLS3.js → chunk-46OT4PA6.js} +3 -3
- package/dist/{chunk-DDGMLLS3.js.map → chunk-46OT4PA6.js.map} +1 -1
- package/dist/{chunk-SFNDR6DI.js → chunk-5BM6H2CD.js} +3 -3
- package/dist/{chunk-SFNDR6DI.js.map → chunk-5BM6H2CD.js.map} +1 -1
- package/dist/{chunk-EWWQQ5DB.js → chunk-6JVUVBZH.js} +5 -5
- package/dist/{chunk-EWWQQ5DB.js.map → chunk-6JVUVBZH.js.map} +1 -1
- package/dist/{chunk-FT2XBBQJ.js → chunk-6PO2IWB3.js} +8 -5
- package/dist/chunk-6PO2IWB3.js.map +1 -0
- package/dist/{chunk-YNKKEO2A.js → chunk-7D2BHQ6M.js} +3 -3
- package/dist/{chunk-YNKKEO2A.js.map → chunk-7D2BHQ6M.js.map} +1 -1
- package/dist/{chunk-MRJWPRCX.js → chunk-AFQIK6JI.js} +3 -3
- package/dist/{chunk-MRJWPRCX.js.map → chunk-AFQIK6JI.js.map} +1 -1
- package/dist/{chunk-IKLA2CVQ.js → chunk-C6TRLHMW.js} +21 -5
- package/dist/chunk-C6TRLHMW.js.map +1 -0
- package/dist/{chunk-NRYWNOG5.js → chunk-CGQIVFCN.js} +3 -3
- package/dist/{chunk-NRYWNOG5.js.map → chunk-CGQIVFCN.js.map} +1 -1
- package/dist/chunk-EFK7726V.js +104 -0
- package/dist/chunk-EFK7726V.js.map +1 -0
- package/dist/{chunk-3BDDPFCI.js → chunk-FDBQOQMW.js} +3 -3
- package/dist/{chunk-3BDDPFCI.js.map → chunk-FDBQOQMW.js.map} +1 -1
- package/dist/{chunk-XALU6LOT.js → chunk-GELLSU64.js} +3 -3
- package/dist/{chunk-XALU6LOT.js.map → chunk-GELLSU64.js.map} +1 -1
- package/dist/{chunk-BZLT6R62.js → chunk-GRDVE3IR.js} +3 -3
- package/dist/{chunk-BZLT6R62.js.map → chunk-GRDVE3IR.js.map} +1 -1
- package/dist/{chunk-OMU4R4Y5.js → chunk-HTF6FDB6.js} +3 -3
- package/dist/{chunk-OMU4R4Y5.js.map → chunk-HTF6FDB6.js.map} +1 -1
- package/dist/{chunk-X7APG7G2.js → chunk-HZKXPN6B.js} +154 -34
- package/dist/chunk-HZKXPN6B.js.map +1 -0
- package/dist/{chunk-WGT345SV.js → chunk-IGLMPAWE.js} +3 -3
- package/dist/{chunk-WGT345SV.js.map → chunk-IGLMPAWE.js.map} +1 -1
- package/dist/{chunk-5XEGZFG5.js → chunk-LWQZ257T.js} +3 -3
- package/dist/{chunk-5XEGZFG5.js.map → chunk-LWQZ257T.js.map} +1 -1
- package/dist/{chunk-RFW5SRZA.js → chunk-MJ4AGXS7.js} +3 -3
- package/dist/{chunk-RFW5SRZA.js.map → chunk-MJ4AGXS7.js.map} +1 -1
- package/dist/{chunk-PNP7L4TA.js → chunk-RM5TSXVE.js} +3 -3
- package/dist/{chunk-PNP7L4TA.js.map → chunk-RM5TSXVE.js.map} +1 -1
- package/dist/{chunk-MKSDYRWQ.js → chunk-SINLREQV.js} +3 -3
- package/dist/{chunk-MKSDYRWQ.js.map → chunk-SINLREQV.js.map} +1 -1
- package/dist/{chunk-TLS54G6Y.js → chunk-UF5OENHV.js} +3 -3
- package/dist/{chunk-TLS54G6Y.js.map → chunk-UF5OENHV.js.map} +1 -1
- package/dist/{chunk-ZQMNGPLE.js → chunk-UJ5KFRDE.js} +18 -6
- package/dist/chunk-UJ5KFRDE.js.map +1 -0
- package/dist/{chunk-SWC5CNKE.js → chunk-UPVNZPFV.js} +3 -3
- package/dist/{chunk-SWC5CNKE.js.map → chunk-UPVNZPFV.js.map} +1 -1
- package/dist/{chunk-3F4TXKDY.js → chunk-UUXWRDWW.js} +3 -3
- package/dist/chunk-UUXWRDWW.js.map +1 -0
- package/dist/{chunk-7GPDNQSX.js → chunk-V2AWSDDZ.js} +5 -5
- package/dist/{chunk-7GPDNQSX.js.map → chunk-V2AWSDDZ.js.map} +1 -1
- package/dist/{chunk-JQQ3FBN7.js → chunk-VCJF75T2.js} +3 -3
- package/dist/{chunk-JQQ3FBN7.js.map → chunk-VCJF75T2.js.map} +1 -1
- package/dist/{chunk-ZBW3BA5R.js → chunk-VMAGFYHG.js} +39 -4
- package/dist/chunk-VMAGFYHG.js.map +1 -0
- package/dist/{chunk-JZ774T7U.js → chunk-W3HMOOON.js} +3 -3
- package/dist/{chunk-JZ774T7U.js.map → chunk-W3HMOOON.js.map} +1 -1
- package/dist/{chunk-6AD6KCVB.js → chunk-WAKKQROH.js} +3 -3
- package/dist/{chunk-6AD6KCVB.js.map → chunk-WAKKQROH.js.map} +1 -1
- package/dist/{chunk-LVWNMQGR.js → chunk-WDNDTSNX.js} +5 -5
- package/dist/{chunk-LVWNMQGR.js.map → chunk-WDNDTSNX.js.map} +1 -1
- package/dist/chunk-WOF67PKT.js +60 -0
- package/dist/chunk-WOF67PKT.js.map +1 -0
- package/dist/{chunk-QJNV7YQP.js → chunk-WTNDPO2V.js} +39 -4
- package/dist/chunk-WTNDPO2V.js.map +1 -0
- package/dist/{chunk-FEPTH5RV.js → chunk-XP55RZ3D.js} +3 -3
- package/dist/{chunk-FEPTH5RV.js.map → chunk-XP55RZ3D.js.map} +1 -1
- package/dist/{chunk-CCUXO2HN.js → chunk-Y4ZRSW35.js} +3 -3
- package/dist/{chunk-CCUXO2HN.js.map → chunk-Y4ZRSW35.js.map} +1 -1
- package/dist/client.cjs +619 -123
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +40 -38
- package/dist/client.js.map +1 -1
- package/dist/components/Accordion/index.js +2 -2
- package/dist/components/Alert/index.js +2 -2
- package/dist/components/AlertDialog/index.js +2 -2
- package/dist/components/Avatar/index.js +2 -2
- package/dist/components/Badge/index.js +2 -2
- package/dist/components/Box/index.js +4 -4
- package/dist/components/Breadcrumb/index.cjs +6 -3
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.js +5 -5
- package/dist/components/Button/index.js +2 -2
- package/dist/components/Calendar/index.cjs +170 -35
- package/dist/components/Calendar/index.cjs.map +1 -1
- package/dist/components/Calendar/index.js +5 -5
- package/dist/components/Card/index.js +2 -2
- package/dist/components/Checkbox/index.cjs +36 -1
- package/dist/components/Checkbox/index.cjs.map +1 -1
- package/dist/components/Checkbox/index.d.cts +17 -1
- package/dist/components/Checkbox/index.d.ts +17 -1
- package/dist/components/Checkbox/index.js +2 -2
- package/dist/components/Dialog/index.js +2 -2
- package/dist/components/Field/index.cjs +703 -0
- package/dist/components/Field/index.cjs.map +1 -0
- package/dist/components/Field/index.d.cts +51 -0
- package/dist/components/Field/index.d.ts +51 -0
- package/dist/components/Field/index.js +9 -0
- package/dist/components/Field/index.js.map +1 -0
- package/dist/components/FloatButton/index.cjs +6 -3
- package/dist/components/FloatButton/index.cjs.map +1 -1
- package/dist/components/FloatButton/index.js +5 -5
- package/dist/components/HStack/index.js +4 -4
- package/dist/components/InputGroup/index.cjs.map +1 -1
- package/dist/components/InputGroup/index.d.cts +8 -1
- package/dist/components/InputGroup/index.d.ts +8 -1
- package/dist/components/InputGroup/index.js +2 -2
- package/dist/components/Label/index.cjs +458 -0
- package/dist/components/Label/index.cjs.map +1 -0
- package/dist/components/Label/index.d.cts +14 -0
- package/dist/components/Label/index.d.ts +14 -0
- package/dist/components/Label/index.js +8 -0
- package/dist/components/Label/index.js.map +1 -0
- package/dist/components/Pagination/index.cjs +21 -6
- package/dist/components/Pagination/index.cjs.map +1 -1
- package/dist/components/Pagination/index.js +5 -5
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Progress/index.js +2 -2
- package/dist/components/Radio/index.cjs +18 -2
- package/dist/components/Radio/index.cjs.map +1 -1
- package/dist/components/Radio/index.d.cts +17 -1
- package/dist/components/Radio/index.d.ts +17 -1
- package/dist/components/Radio/index.js +2 -2
- package/dist/components/SegmentedControl/index.js +2 -2
- package/dist/components/Select/index.cjs +15 -3
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.d.cts +6 -0
- package/dist/components/Select/index.d.ts +6 -0
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Switch/index.cjs +36 -1
- package/dist/components/Switch/index.cjs.map +1 -1
- package/dist/components/Switch/index.d.cts +17 -1
- package/dist/components/Switch/index.d.ts +17 -1
- package/dist/components/Switch/index.js +2 -2
- package/dist/components/Tabs/index.js +2 -2
- package/dist/components/Text/index.js +2 -2
- package/dist/components/TextArea/index.cjs +35 -84
- package/dist/components/TextArea/index.cjs.map +1 -1
- package/dist/components/TextArea/index.js +3 -3
- package/dist/components/TextInput/index.cjs +35 -84
- package/dist/components/TextInput/index.cjs.map +1 -1
- package/dist/components/TextInput/index.d.cts +7 -8
- package/dist/components/TextInput/index.d.ts +7 -8
- package/dist/components/TextInput/index.js +2 -2
- package/dist/components/Toggle/index.js +2 -2
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/VStack/index.js +4 -4
- package/dist/i18n/index.cjs +6 -3
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.cjs +619 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +37 -35
- package/package.json +8 -1
- package/dist/chunk-3F4TXKDY.js.map +0 -1
- package/dist/chunk-FT2XBBQJ.js.map +0 -1
- package/dist/chunk-IKLA2CVQ.js.map +0 -1
- package/dist/chunk-QJNV7YQP.js.map +0 -1
- package/dist/chunk-X7APG7G2.js.map +0 -1
- package/dist/chunk-ZBW3BA5R.js.map +0 -1
- package/dist/chunk-ZQMNGPLE.js.map +0 -1
- package/dist/chunk-ZRD4FQBT.js +0 -153
- package/dist/chunk-ZRD4FQBT.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Select } from './chunk-
|
|
2
|
-
import { useTranslation } from './chunk-
|
|
1
|
+
import { Select } from './chunk-UJ5KFRDE.js';
|
|
2
|
+
import { useTranslation } from './chunk-MJ4AGXS7.js';
|
|
3
3
|
import { useThemeColors } from './chunk-R5JMDDCB.js';
|
|
4
4
|
import { __name } from './chunk-WCQVDF3K.js';
|
|
5
5
|
import { today, getLocalTimeZone, CalendarDate, startOfMonth } from '@internationalized/date';
|
|
6
|
-
import { createContext, useState, useCallback, useContext, useRef, useLayoutEffect, useMemo
|
|
6
|
+
import { createContext, useState, useCallback, useContext, useEffect, useRef, useLayoutEffect, useMemo } from 'react';
|
|
7
7
|
import { View, Text, Pressable } from 'react-native';
|
|
8
8
|
import { jsx, Fragment, jsxs } from 'nativewind/jsx-runtime';
|
|
9
9
|
|
|
@@ -26,6 +26,13 @@ var useLocale = /* @__PURE__ */ __name(() => {
|
|
|
26
26
|
return ctx ?? detectLocale();
|
|
27
27
|
}, "useLocale");
|
|
28
28
|
|
|
29
|
+
// src/components/Calendar/scroll/ScrollBody.tsx
|
|
30
|
+
var ScrollBody = /* @__PURE__ */ __name((_props) => {
|
|
31
|
+
throw new Error(
|
|
32
|
+
"[Calendar] ScrollBody: no platform implementation resolved. Ensure your bundler honors *.web.tsx / *.native.tsx extensions."
|
|
33
|
+
);
|
|
34
|
+
}, "ScrollBody");
|
|
35
|
+
|
|
29
36
|
// src/components/Calendar/state/locale-utils.ts
|
|
30
37
|
var getFirstDayOfWeek = /* @__PURE__ */ __name((locale) => {
|
|
31
38
|
try {
|
|
@@ -541,7 +548,7 @@ var Caption = /* @__PURE__ */ __name(({
|
|
|
541
548
|
alignSelf: "center"
|
|
542
549
|
},
|
|
543
550
|
children: [
|
|
544
|
-
/* @__PURE__ */ jsx(NavButton, { label: t("calendar.header.previous", { defaultValue: "Previous" }), onPress: onPrev, children: "\u2039" }),
|
|
551
|
+
/* @__PURE__ */ jsx(NavButton, { label: t("calendar.header.previous", { defaultValue: "Previous month" }), onPress: onPrev, children: "\u2039" }),
|
|
545
552
|
/* @__PURE__ */ jsx(View, { style: { flexDirection: "row", gap: monthGap, width: titleRowWidth }, children: showMultiTitles ? months.map((m, i) => /* @__PURE__ */ jsx(View, { style: { width: gridWidth, alignItems: "center" }, children: caption === "dropdown" && view === "day" ? /* @__PURE__ */ jsx(
|
|
546
553
|
DropdownPair,
|
|
547
554
|
{
|
|
@@ -587,7 +594,7 @@ var Caption = /* @__PURE__ */ __name(({
|
|
|
587
594
|
drilldown: true
|
|
588
595
|
}
|
|
589
596
|
) }) }),
|
|
590
|
-
/* @__PURE__ */ jsx(NavButton, { label: t("calendar.header.next", { defaultValue: "Next" }), onPress: onNext, children: "\u203A" })
|
|
597
|
+
/* @__PURE__ */ jsx(NavButton, { label: t("calendar.header.next", { defaultValue: "Next month" }), onPress: onNext, children: "\u203A" })
|
|
591
598
|
]
|
|
592
599
|
}
|
|
593
600
|
);
|
|
@@ -630,8 +637,53 @@ var DropdownPair = /* @__PURE__ */ __name(({ month, year, monthOptions, yearOpti
|
|
|
630
637
|
] });
|
|
631
638
|
}, "DropdownPair");
|
|
632
639
|
var CELL_SIZE = 40;
|
|
633
|
-
var
|
|
640
|
+
var formatterCache = /* @__PURE__ */ new Map();
|
|
641
|
+
var RUNTIME_DEFAULT_LOCALE_KEY = "__default__";
|
|
642
|
+
var getDayFormatter = /* @__PURE__ */ __name((locale) => {
|
|
643
|
+
const key = locale ?? RUNTIME_DEFAULT_LOCALE_KEY;
|
|
644
|
+
const cached = formatterCache.get(key);
|
|
645
|
+
if (cached) {
|
|
646
|
+
return cached;
|
|
647
|
+
}
|
|
648
|
+
try {
|
|
649
|
+
const fmt = new Intl.DateTimeFormat(locale, {
|
|
650
|
+
weekday: "long",
|
|
651
|
+
month: "long",
|
|
652
|
+
day: "numeric",
|
|
653
|
+
year: "numeric",
|
|
654
|
+
timeZone: "UTC"
|
|
655
|
+
});
|
|
656
|
+
formatterCache.set(key, fmt);
|
|
657
|
+
return fmt;
|
|
658
|
+
} catch {
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
661
|
+
}, "getDayFormatter");
|
|
662
|
+
var formatDayLabel = /* @__PURE__ */ __name((ctx, locale) => {
|
|
663
|
+
const jsDate = new Date(Date.UTC(ctx.date.year, ctx.date.month - 1, ctx.date.day));
|
|
664
|
+
const fmt = getDayFormatter(locale);
|
|
665
|
+
const base = fmt ? fmt.format(jsDate) : (
|
|
666
|
+
// Fallback if the runtime rejects the locale tag.
|
|
667
|
+
`${ctx.date.month}/${ctx.date.day}/${ctx.date.year}`
|
|
668
|
+
);
|
|
669
|
+
const suffixes = [];
|
|
670
|
+
if (ctx.isToday) {
|
|
671
|
+
suffixes.push("today");
|
|
672
|
+
}
|
|
673
|
+
if (ctx.isSelected || ctx.isRangeStart || ctx.isRangeEnd) {
|
|
674
|
+
suffixes.push("selected");
|
|
675
|
+
}
|
|
676
|
+
if (ctx.isInRange && !ctx.isRangeStart && !ctx.isRangeEnd) {
|
|
677
|
+
suffixes.push("in range");
|
|
678
|
+
}
|
|
679
|
+
if (ctx.isUnavailable) {
|
|
680
|
+
suffixes.push("unavailable");
|
|
681
|
+
}
|
|
682
|
+
return suffixes.length > 0 ? `${base}, ${suffixes.join(", ")}` : base;
|
|
683
|
+
}, "formatDayLabel");
|
|
684
|
+
var DayCell = /* @__PURE__ */ __name(({ ctx, onPress, onHoverIn, onHoverOut, renderDay, locale }) => {
|
|
634
685
|
const colors = useThemeColors();
|
|
686
|
+
const accessibilityLabel = formatDayLabel(ctx, locale);
|
|
635
687
|
const isSelectedLike = ctx.isSelected || ctx.isRangeStart || ctx.isRangeEnd;
|
|
636
688
|
const isInsideRange = ctx.isInRange || ctx.isInPreviewRange;
|
|
637
689
|
const isRangeMiddle = isInsideRange && !isSelectedLike;
|
|
@@ -640,7 +692,8 @@ var DayCell = /* @__PURE__ */ __name(({ ctx, onPress, onHoverIn, onHoverOut, ren
|
|
|
640
692
|
Pressable,
|
|
641
693
|
{
|
|
642
694
|
accessibilityRole: "button",
|
|
643
|
-
|
|
695
|
+
accessibilityLabel,
|
|
696
|
+
accessibilityState: { disabled: ctx.isUnavailable, selected: isSelectedLike },
|
|
644
697
|
disabled: ctx.isUnavailable,
|
|
645
698
|
onPress,
|
|
646
699
|
...onHoverIn ? { onHoverIn } : {},
|
|
@@ -898,6 +951,7 @@ var DayGrid = /* @__PURE__ */ __name((props) => {
|
|
|
898
951
|
DayCell,
|
|
899
952
|
{
|
|
900
953
|
ctx,
|
|
954
|
+
locale,
|
|
901
955
|
onPress: () => onDayPress(date),
|
|
902
956
|
...onDayHover ? {
|
|
903
957
|
onHoverIn: /* @__PURE__ */ __name(() => onDayHover(date), "onHoverIn"),
|
|
@@ -1060,6 +1114,9 @@ var focusDayCell = /* @__PURE__ */ __name((root, date, force) => {
|
|
|
1060
1114
|
if (!root) {
|
|
1061
1115
|
return;
|
|
1062
1116
|
}
|
|
1117
|
+
if (typeof document === "undefined" || typeof root.contains !== "function") {
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1063
1120
|
if (!force && !root.contains(document.activeElement)) {
|
|
1064
1121
|
return;
|
|
1065
1122
|
}
|
|
@@ -1164,8 +1221,13 @@ var SingleOrMultiCalendar = /* @__PURE__ */ __name((props) => {
|
|
|
1164
1221
|
const colors = useThemeColors();
|
|
1165
1222
|
const firstDayOfWeek = props.firstDayOfWeek ?? getFirstDayOfWeek(locale);
|
|
1166
1223
|
const weekendDays = props.weekendDays ?? getWeekendDays(locale);
|
|
1167
|
-
const visibleMonths = pickVisibleMonths(props.visibleMonths, containerWidth);
|
|
1224
|
+
const visibleMonths = props.behavior === "scroll" ? 1 : pickVisibleMonths(props.visibleMonths, containerWidth);
|
|
1168
1225
|
const { innerWidth, gridsRowWidth } = surfaceMetrics(visibleMonths);
|
|
1226
|
+
useEffect(() => {
|
|
1227
|
+
if (process.env.NODE_ENV !== "production" && props.behavior === "scroll" && typeof props.visibleMonths === "number" && props.visibleMonths > 1) {
|
|
1228
|
+
console.warn('[Calendar] visibleMonths is ignored when behavior="scroll"; falling back to single column.');
|
|
1229
|
+
}
|
|
1230
|
+
}, [props.behavior, props.visibleMonths]);
|
|
1169
1231
|
const containerRef = useRef(null);
|
|
1170
1232
|
const state = useCalendarState({
|
|
1171
1233
|
...props.mode !== void 0 ? { mode: props.mode } : {},
|
|
@@ -1228,6 +1290,8 @@ var SingleOrMultiCalendar = /* @__PURE__ */ __name((props) => {
|
|
|
1228
1290
|
setAnchor((a) => a.add({ years: -10 }));
|
|
1229
1291
|
} else if (state.view === "month") {
|
|
1230
1292
|
setAnchor((a) => a.add({ years: -1 }));
|
|
1293
|
+
} else if (props.behavior === "scroll") {
|
|
1294
|
+
state.moveFocus({ months: -1 });
|
|
1231
1295
|
} else {
|
|
1232
1296
|
setAnchor((a) => a.add({ months: -1 }));
|
|
1233
1297
|
}
|
|
@@ -1237,6 +1301,8 @@ var SingleOrMultiCalendar = /* @__PURE__ */ __name((props) => {
|
|
|
1237
1301
|
setAnchor((a) => a.add({ years: 10 }));
|
|
1238
1302
|
} else if (state.view === "month") {
|
|
1239
1303
|
setAnchor((a) => a.add({ years: 1 }));
|
|
1304
|
+
} else if (props.behavior === "scroll") {
|
|
1305
|
+
state.moveFocus({ months: 1 });
|
|
1240
1306
|
} else {
|
|
1241
1307
|
setAnchor((a) => a.add({ months: 1 }));
|
|
1242
1308
|
}
|
|
@@ -1299,22 +1365,44 @@ var SingleOrMultiCalendar = /* @__PURE__ */ __name((props) => {
|
|
|
1299
1365
|
}
|
|
1300
1366
|
),
|
|
1301
1367
|
/* @__PURE__ */ jsxs(FadeIn, { children: [
|
|
1302
|
-
state.view === "day" &&
|
|
1303
|
-
|
|
1368
|
+
state.view === "day" && (props.behavior === "scroll" ? /* @__PURE__ */ jsx(
|
|
1369
|
+
ScrollBody,
|
|
1304
1370
|
{
|
|
1305
|
-
visibleMonth: m,
|
|
1306
|
-
locale,
|
|
1307
1371
|
mode: props.mode ?? "single",
|
|
1308
|
-
|
|
1372
|
+
locale,
|
|
1309
1373
|
focusedDate: state.focusedDate,
|
|
1310
|
-
|
|
1311
|
-
|
|
1374
|
+
onFocusedMonthChange: (next) => setAnchor(next),
|
|
1375
|
+
value: state.value,
|
|
1376
|
+
onSelectDate: (date) => state.selectDate(date, "click"),
|
|
1312
1377
|
firstDayOfWeek,
|
|
1313
|
-
|
|
1378
|
+
weekendDays,
|
|
1379
|
+
...props.minValue !== void 0 ? { minValue: props.minValue } : {},
|
|
1380
|
+
...props.maxValue !== void 0 ? { maxValue: props.maxValue } : {},
|
|
1381
|
+
...props.isDateUnavailable !== void 0 ? { isDateUnavailable: props.isDateUnavailable } : {},
|
|
1314
1382
|
...renderDay ? { renderDay } : {}
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1383
|
+
}
|
|
1384
|
+
) : /* @__PURE__ */ jsx(
|
|
1385
|
+
View,
|
|
1386
|
+
{
|
|
1387
|
+
style: { flexDirection: "row", gap: MONTH_GAP, alignSelf: "center", width: gridsRowWidth },
|
|
1388
|
+
children: months.map((m) => /* @__PURE__ */ jsx(
|
|
1389
|
+
DayGrid,
|
|
1390
|
+
{
|
|
1391
|
+
visibleMonth: m,
|
|
1392
|
+
locale,
|
|
1393
|
+
mode: props.mode ?? "single",
|
|
1394
|
+
value: state.value,
|
|
1395
|
+
focusedDate: state.focusedDate,
|
|
1396
|
+
isUnavailable: state.isUnavailable,
|
|
1397
|
+
weekendDays,
|
|
1398
|
+
firstDayOfWeek,
|
|
1399
|
+
onDayPress: (date) => state.selectDate(date, "click"),
|
|
1400
|
+
...renderDay ? { renderDay } : {}
|
|
1401
|
+
},
|
|
1402
|
+
`${m.year}-${m.month}`
|
|
1403
|
+
))
|
|
1404
|
+
}
|
|
1405
|
+
)),
|
|
1318
1406
|
state.view === "month" && /* @__PURE__ */ jsx(View, { style: { alignItems: "center" }, children: /* @__PURE__ */ jsx(
|
|
1319
1407
|
MonthGrid,
|
|
1320
1408
|
{
|
|
@@ -1349,8 +1437,13 @@ var RangeCalendar = /* @__PURE__ */ __name((props) => {
|
|
|
1349
1437
|
const colors = useThemeColors();
|
|
1350
1438
|
const firstDayOfWeek = props.firstDayOfWeek ?? getFirstDayOfWeek(locale);
|
|
1351
1439
|
const weekendDays = props.weekendDays ?? getWeekendDays(locale);
|
|
1352
|
-
const visibleMonths = pickVisibleMonths(props.visibleMonths, containerWidth);
|
|
1440
|
+
const visibleMonths = props.behavior === "scroll" ? 1 : pickVisibleMonths(props.visibleMonths, containerWidth);
|
|
1353
1441
|
const { innerWidth, gridsRowWidth } = surfaceMetrics(visibleMonths);
|
|
1442
|
+
useEffect(() => {
|
|
1443
|
+
if (process.env.NODE_ENV !== "production" && props.behavior === "scroll" && typeof props.visibleMonths === "number" && props.visibleMonths > 1) {
|
|
1444
|
+
console.warn('[Calendar] visibleMonths is ignored when behavior="scroll"; falling back to single column.');
|
|
1445
|
+
}
|
|
1446
|
+
}, [props.behavior, props.visibleMonths]);
|
|
1354
1447
|
const containerRef = useRef(null);
|
|
1355
1448
|
const range = useRangeState({
|
|
1356
1449
|
...props.value !== void 0 ? { value: props.value } : {},
|
|
@@ -1428,6 +1521,8 @@ var RangeCalendar = /* @__PURE__ */ __name((props) => {
|
|
|
1428
1521
|
setAnchor((a) => a.add({ years: -10 }));
|
|
1429
1522
|
} else if (view === "month") {
|
|
1430
1523
|
setAnchor((a) => a.add({ years: -1 }));
|
|
1524
|
+
} else if (props.behavior === "scroll") {
|
|
1525
|
+
setFocusedDate((f) => f.add({ months: -1 }));
|
|
1431
1526
|
} else {
|
|
1432
1527
|
setAnchor((a) => a.add({ months: -1 }));
|
|
1433
1528
|
}
|
|
@@ -1437,6 +1532,8 @@ var RangeCalendar = /* @__PURE__ */ __name((props) => {
|
|
|
1437
1532
|
setAnchor((a) => a.add({ years: 10 }));
|
|
1438
1533
|
} else if (view === "month") {
|
|
1439
1534
|
setAnchor((a) => a.add({ years: 1 }));
|
|
1535
|
+
} else if (props.behavior === "scroll") {
|
|
1536
|
+
setFocusedDate((f) => f.add({ months: 1 }));
|
|
1440
1537
|
} else {
|
|
1441
1538
|
setAnchor((a) => a.add({ months: 1 }));
|
|
1442
1539
|
}
|
|
@@ -1507,24 +1604,47 @@ var RangeCalendar = /* @__PURE__ */ __name((props) => {
|
|
|
1507
1604
|
}
|
|
1508
1605
|
),
|
|
1509
1606
|
/* @__PURE__ */ jsxs(FadeIn, { children: [
|
|
1510
|
-
view === "day" &&
|
|
1511
|
-
|
|
1607
|
+
view === "day" && (props.behavior === "scroll" ? /* @__PURE__ */ jsx(
|
|
1608
|
+
ScrollBody,
|
|
1512
1609
|
{
|
|
1513
|
-
visibleMonth: m,
|
|
1514
|
-
locale,
|
|
1515
1610
|
mode: "range",
|
|
1611
|
+
locale,
|
|
1612
|
+
focusedDate,
|
|
1613
|
+
onFocusedMonthChange: (next) => setAnchor(next),
|
|
1516
1614
|
value: range.value,
|
|
1517
1615
|
previewRange: range.previewRange,
|
|
1518
|
-
|
|
1519
|
-
isUnavailable: range.isUnavailable,
|
|
1520
|
-
weekendDays,
|
|
1616
|
+
onSelectDate: (date) => range.selectDate(date),
|
|
1521
1617
|
firstDayOfWeek,
|
|
1522
|
-
|
|
1523
|
-
|
|
1618
|
+
weekendDays,
|
|
1619
|
+
...props.minValue !== void 0 ? { minValue: props.minValue } : {},
|
|
1620
|
+
...props.maxValue !== void 0 ? { maxValue: props.maxValue } : {},
|
|
1621
|
+
...props.isDateUnavailable !== void 0 ? { isDateUnavailable: props.isDateUnavailable } : {},
|
|
1524
1622
|
...renderDay ? { renderDay } : {}
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1623
|
+
}
|
|
1624
|
+
) : /* @__PURE__ */ jsx(
|
|
1625
|
+
View,
|
|
1626
|
+
{
|
|
1627
|
+
style: { flexDirection: "row", gap: MONTH_GAP, alignSelf: "center", width: gridsRowWidth },
|
|
1628
|
+
children: months.map((m) => /* @__PURE__ */ jsx(
|
|
1629
|
+
DayGrid,
|
|
1630
|
+
{
|
|
1631
|
+
visibleMonth: m,
|
|
1632
|
+
locale,
|
|
1633
|
+
mode: "range",
|
|
1634
|
+
value: range.value,
|
|
1635
|
+
previewRange: range.previewRange,
|
|
1636
|
+
focusedDate,
|
|
1637
|
+
isUnavailable: range.isUnavailable,
|
|
1638
|
+
weekendDays,
|
|
1639
|
+
firstDayOfWeek,
|
|
1640
|
+
onDayPress: (date) => range.selectDate(date),
|
|
1641
|
+
onDayHover: (date) => range.setHoveredDate(date),
|
|
1642
|
+
...renderDay ? { renderDay } : {}
|
|
1643
|
+
},
|
|
1644
|
+
`${m.year}-${m.month}`
|
|
1645
|
+
))
|
|
1646
|
+
}
|
|
1647
|
+
)),
|
|
1528
1648
|
view === "month" && /* @__PURE__ */ jsx(View, { style: { alignItems: "center" }, children: /* @__PURE__ */ jsx(
|
|
1529
1649
|
MonthGrid,
|
|
1530
1650
|
{
|
|
@@ -1562,5 +1682,5 @@ var Calendar = CalendarRoot;
|
|
|
1562
1682
|
Calendar.Caption = CalendarCaption;
|
|
1563
1683
|
|
|
1564
1684
|
export { Calendar, LocaleProvider, detectLocale, useCalendarCaption, useLocale };
|
|
1565
|
-
//# sourceMappingURL=chunk-
|
|
1566
|
-
//# sourceMappingURL=chunk-
|
|
1685
|
+
//# sourceMappingURL=chunk-HZKXPN6B.js.map
|
|
1686
|
+
//# sourceMappingURL=chunk-HZKXPN6B.js.map
|