laif-ds 0.2.25 → 0.2.27
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/_virtual/index2.js +2 -5
- package/dist/_virtual/index3.js +5 -2
- package/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +4 -4
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/ui/file-previewer.js +49 -37
- package/dist/index.d.ts +2 -0
- package/dist/node_modules/@shikijs/langs/dist/luau.js +1 -1
- package/dist/node_modules/@shikijs/langs/dist/move.js +1 -1
- package/dist/node_modules/@shikijs/langs/dist/nushell.js +1 -1
- package/dist/node_modules/@shikijs/langs/dist/swift.js +1 -1
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +76 -74
- package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +93 -46
- package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +5 -5
- package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +4 -4
- package/dist/node_modules/react-hook-form/dist/index.esm.js +96 -96
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
|
|
|
3
3
|
import { ok as u } from "../../devlop/lib/default.js";
|
|
4
4
|
import { svg as m, html as C } from "../../property-information/index.js";
|
|
5
5
|
import { stringify as N } from "../../space-separated-tokens/index.js";
|
|
6
|
-
import S from "../../../_virtual/
|
|
6
|
+
import S from "../../../_virtual/index3.js";
|
|
7
7
|
import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
|
|
8
8
|
import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
|
|
9
9
|
import { VFileMessage as h } from "../../vfile-message/lib/index.js";
|
|
@@ -14,7 +14,7 @@ import { getStyleForModifiers as je } from "./helpers/getStyleForModifiers.js";
|
|
|
14
14
|
import { getWeekdays as Ve } from "./helpers/getWeekdays.js";
|
|
15
15
|
import { getYearOptions as $e } from "./helpers/getYearOptions.js";
|
|
16
16
|
import * as qe from "./labels/index.js";
|
|
17
|
-
import { UI as
|
|
17
|
+
import { UI as o, DayFlag as ze, SelectionState as w } from "./UI.js";
|
|
18
18
|
import { useAnimation as Je } from "./useAnimation.js";
|
|
19
19
|
import { useCalendar as Qe } from "./useCalendar.js";
|
|
20
20
|
import { dayPickerContext as Xe } from "./useDayPicker.js";
|
|
@@ -31,7 +31,7 @@ function Bt(A) {
|
|
|
31
31
|
from: e.selected.from ? new b(e.selected.from, e.timeZone) : void 0,
|
|
32
32
|
to: e.selected.to ? new b(e.selected.to, e.timeZone) : void 0
|
|
33
33
|
}));
|
|
34
|
-
const { components: l, formatters:
|
|
34
|
+
const { components: l, formatters: N, labels: T, dateLib: t, locale: oe, classNames: r } = Z(() => {
|
|
35
35
|
const n = { ...nt, ...e.locale };
|
|
36
36
|
return {
|
|
37
37
|
dateLib: new Te({
|
|
@@ -63,62 +63,62 @@ function Bt(A) {
|
|
|
63
63
|
e.formatters,
|
|
64
64
|
e.labels,
|
|
65
65
|
e.classNames
|
|
66
|
-
]), { captionLayout:
|
|
66
|
+
]), { captionLayout: k, mode: g, navLayout: M, numberOfMonths: K = 1, onDayBlur: R, onDayClick: C, onDayFocus: G, onDayKeyDown: H, onDayMouseEnter: _, onDayMouseLeave: I, onNextClick: U, onPrevClick: j, showWeekNumber: V, styles: c } = e, { formatCaption: $, formatDay: q, formatMonthDropdown: ne, formatWeekNumber: se, formatWeekNumberHeader: re, formatWeekdayName: ie, formatYearDropdown: le } = N, z = Qe(e, t), { days: de, months: W, navStart: E, navEnd: B, previousMonth: f, nextMonth: p, goToMonth: h } = z, x = Ke(de, e, E, B, t), { isSelected: S, select: Y, selected: D } = tt(e, t) ?? {}, { blur: J, focused: Q, isFocusTarget: me, moveFocus: X, setFocused: v } = et(e, z, x, S ?? (() => !1), t), { labelDayButton: ce, labelGridcell: ue, labelGrid: fe, labelMonthDropdown: pe, labelNav: ee, labelPrevious: ye, labelNext: he, labelWeekday: be, labelWeekNumber: ke, labelWeekNumberHeader: Ne, labelYearDropdown: Me } = T, De = Z(() => Ve(t, e.ISOWeek), [t, e.ISOWeek]), te = g !== void 0 || C !== void 0, O = y(() => {
|
|
67
67
|
f && (h(f), j?.(f));
|
|
68
|
-
}, [f, h, j]),
|
|
68
|
+
}, [f, h, j]), L = y(() => {
|
|
69
69
|
p && (h(p), U?.(p));
|
|
70
|
-
}, [h, p, U]), ve = y((n,
|
|
71
|
-
|
|
72
|
-
}, [Y, C, v]), we = y((n,
|
|
73
|
-
v(n), G?.(n.date,
|
|
74
|
-
}, [G, v]), ge = y((n,
|
|
75
|
-
J(), R?.(n.date,
|
|
76
|
-
}, [J, R]), Ce = y((n,
|
|
77
|
-
const
|
|
70
|
+
}, [h, p, U]), ve = y((n, m) => (a) => {
|
|
71
|
+
a.preventDefault(), a.stopPropagation(), v(n), Y?.(n.date, m, a), C?.(n.date, m, a);
|
|
72
|
+
}, [Y, C, v]), we = y((n, m) => (a) => {
|
|
73
|
+
v(n), G?.(n.date, m, a);
|
|
74
|
+
}, [G, v]), ge = y((n, m) => (a) => {
|
|
75
|
+
J(), R?.(n.date, m, a);
|
|
76
|
+
}, [J, R]), Ce = y((n, m) => (a) => {
|
|
77
|
+
const d = {
|
|
78
78
|
ArrowLeft: [
|
|
79
|
-
|
|
79
|
+
a.shiftKey ? "month" : "day",
|
|
80
80
|
e.dir === "rtl" ? "after" : "before"
|
|
81
81
|
],
|
|
82
82
|
ArrowRight: [
|
|
83
|
-
|
|
83
|
+
a.shiftKey ? "month" : "day",
|
|
84
84
|
e.dir === "rtl" ? "before" : "after"
|
|
85
85
|
],
|
|
86
|
-
ArrowDown: [
|
|
87
|
-
ArrowUp: [
|
|
88
|
-
PageUp: [
|
|
89
|
-
PageDown: [
|
|
86
|
+
ArrowDown: [a.shiftKey ? "year" : "week", "after"],
|
|
87
|
+
ArrowUp: [a.shiftKey ? "year" : "week", "before"],
|
|
88
|
+
PageUp: [a.shiftKey ? "year" : "month", "before"],
|
|
89
|
+
PageDown: [a.shiftKey ? "year" : "month", "after"],
|
|
90
90
|
Home: ["startOfWeek", "before"],
|
|
91
91
|
End: ["endOfWeek", "after"]
|
|
92
92
|
};
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
const [u, s] =
|
|
93
|
+
if (d[a.key]) {
|
|
94
|
+
a.preventDefault(), a.stopPropagation();
|
|
95
|
+
const [u, s] = d[a.key];
|
|
96
96
|
X(u, s);
|
|
97
97
|
}
|
|
98
|
-
H?.(n.date,
|
|
99
|
-
}, [X, H, e.dir]), We = y((n,
|
|
100
|
-
_?.(n.date,
|
|
101
|
-
}, [_]), Ee = y((n,
|
|
102
|
-
I?.(n.date,
|
|
103
|
-
}, [I]), Be = y((n) => (
|
|
104
|
-
const
|
|
105
|
-
h(
|
|
106
|
-
}, [t, h]), xe = y((n) => (
|
|
107
|
-
const
|
|
108
|
-
h(
|
|
98
|
+
H?.(n.date, m, a);
|
|
99
|
+
}, [X, H, e.dir]), We = y((n, m) => (a) => {
|
|
100
|
+
_?.(n.date, m, a);
|
|
101
|
+
}, [_]), Ee = y((n, m) => (a) => {
|
|
102
|
+
I?.(n.date, m, a);
|
|
103
|
+
}, [I]), Be = y((n) => (m) => {
|
|
104
|
+
const a = Number(m.target.value), d = t.setMonth(t.startOfMonth(n), a);
|
|
105
|
+
h(d);
|
|
106
|
+
}, [t, h]), xe = y((n) => (m) => {
|
|
107
|
+
const a = Number(m.target.value), d = t.setYear(t.startOfMonth(n), a);
|
|
108
|
+
h(d);
|
|
109
109
|
}, [t, h]), { className: Se, style: Ye } = Z(() => ({
|
|
110
|
-
className: [r[
|
|
111
|
-
style: { ...c?.[
|
|
112
|
-
}), [r, e.className, e.style, c]),
|
|
110
|
+
className: [r[o.Root], e.className].filter(Boolean).join(" "),
|
|
111
|
+
style: { ...c?.[o.Root], ...e.style }
|
|
112
|
+
}), [r, e.className, e.style, c]), Oe = He(e), ae = Ae(null);
|
|
113
113
|
Je(ae, !!e.animate, {
|
|
114
114
|
classNames: r,
|
|
115
115
|
months: W,
|
|
116
116
|
focused: Q,
|
|
117
117
|
dateLib: t
|
|
118
118
|
});
|
|
119
|
-
const
|
|
119
|
+
const Le = {
|
|
120
120
|
dayPickerProps: e,
|
|
121
|
-
selected:
|
|
121
|
+
selected: D,
|
|
122
122
|
select: Y,
|
|
123
123
|
isSelected: S,
|
|
124
124
|
months: W,
|
|
@@ -130,39 +130,41 @@ function Bt(A) {
|
|
|
130
130
|
classNames: r,
|
|
131
131
|
styles: c,
|
|
132
132
|
labels: T,
|
|
133
|
-
formatters:
|
|
133
|
+
formatters: N
|
|
134
134
|
};
|
|
135
135
|
return i.createElement(
|
|
136
136
|
Xe.Provider,
|
|
137
|
-
{ value:
|
|
137
|
+
{ value: Le },
|
|
138
138
|
i.createElement(
|
|
139
139
|
l.Root,
|
|
140
|
-
{ rootRef: e.animate ? ae : void 0, className: Se, style: Ye, dir: e.dir, id: e.id, lang: e.lang, nonce: e.nonce, title: e.title, role: e.role, "aria-label": e["aria-label"], ...
|
|
140
|
+
{ rootRef: e.animate ? ae : void 0, className: Se, style: Ye, dir: e.dir, id: e.id, lang: e.lang, nonce: e.nonce, title: e.title, role: e.role, "aria-label": e["aria-label"], "aria-labelledby": e["aria-labelledby"], ...Oe },
|
|
141
141
|
i.createElement(
|
|
142
142
|
l.Months,
|
|
143
|
-
{ className: r[
|
|
144
|
-
!e.hideNavigation && !
|
|
145
|
-
W.map((n,
|
|
143
|
+
{ className: r[o.Months], style: c?.[o.Months] },
|
|
144
|
+
!e.hideNavigation && !M && i.createElement(l.Nav, { "data-animated-nav": e.animate ? "true" : void 0, className: r[o.Nav], style: c?.[o.Nav], "aria-label": ee(), onPreviousClick: O, onNextClick: L, previousMonth: f, nextMonth: p }),
|
|
145
|
+
W.map((n, m) => i.createElement(
|
|
146
146
|
l.Month,
|
|
147
147
|
{
|
|
148
148
|
"data-animated-month": e.animate ? "true" : void 0,
|
|
149
|
-
className: r[
|
|
150
|
-
style: c?.[
|
|
149
|
+
className: r[o.Month],
|
|
150
|
+
style: c?.[o.Month],
|
|
151
151
|
// biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
|
|
152
|
-
key:
|
|
153
|
-
displayIndex:
|
|
152
|
+
key: m,
|
|
153
|
+
displayIndex: m,
|
|
154
154
|
calendarMonth: n
|
|
155
155
|
},
|
|
156
|
-
|
|
156
|
+
M === "around" && !e.hideNavigation && m === 0 && i.createElement(
|
|
157
157
|
l.PreviousMonthButton,
|
|
158
|
-
{ type: "button", className: r[
|
|
159
|
-
i.createElement(l.Chevron, { disabled: f ? void 0 : !0, className: r[
|
|
158
|
+
{ type: "button", className: r[o.PreviousMonthButton], tabIndex: f ? void 0 : -1, "aria-disabled": f ? void 0 : !0, "aria-label": ye(f), onClick: O, "data-animated-button": e.animate ? "true" : void 0 },
|
|
159
|
+
i.createElement(l.Chevron, { disabled: f ? void 0 : !0, className: r[o.Chevron], orientation: e.dir === "rtl" ? "right" : "left" })
|
|
160
160
|
),
|
|
161
|
-
i.createElement(l.MonthCaption, { "data-animated-caption": e.animate ? "true" : void 0, className: r[
|
|
161
|
+
i.createElement(l.MonthCaption, { "data-animated-caption": e.animate ? "true" : void 0, className: r[o.MonthCaption], style: c?.[o.MonthCaption], calendarMonth: n, displayIndex: m }, k?.startsWith("dropdown") ? i.createElement(
|
|
162
162
|
l.DropdownNav,
|
|
163
|
-
{ className: r[
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
{ className: r[o.Dropdowns], style: c?.[o.Dropdowns] },
|
|
164
|
+
(() => {
|
|
165
|
+
const a = k === "dropdown" || k === "dropdown-months" ? i.createElement(l.MonthsDropdown, { key: "month", className: r[o.MonthsDropdown], "aria-label": pe(), classNames: r, components: l, disabled: !!e.disableNavigation, onChange: Be(n.date), options: Ue(n.date, E, B, N, t), style: c?.[o.Dropdown], value: t.getMonth(n.date) }) : i.createElement("span", { key: "month" }, ne(n.date, t)), d = k === "dropdown" || k === "dropdown-years" ? i.createElement(l.YearsDropdown, { key: "year", className: r[o.YearsDropdown], "aria-label": Me(t.options), classNames: r, components: l, disabled: !!e.disableNavigation, onChange: xe(n.date), options: $e(E, B, N, t, !!e.reverseYears), style: c?.[o.Dropdown], value: t.getYear(n.date) }) : i.createElement("span", { key: "year" }, le(n.date, t));
|
|
166
|
+
return t.getMonthYearOrder() === "year-first" ? [d, a] : [a, d];
|
|
167
|
+
})(),
|
|
166
168
|
i.createElement("span", { role: "status", "aria-live": "polite", style: {
|
|
167
169
|
border: 0,
|
|
168
170
|
clip: "rect(0 0 0 0)",
|
|
@@ -177,40 +179,40 @@ function Bt(A) {
|
|
|
177
179
|
} }, $(n.date, t.options, t))
|
|
178
180
|
) : (
|
|
179
181
|
// biome-ignore lint/a11y/useSemanticElements: breaking change
|
|
180
|
-
i.createElement(l.CaptionLabel, { className: r[
|
|
182
|
+
i.createElement(l.CaptionLabel, { className: r[o.CaptionLabel], role: "status", "aria-live": "polite" }, $(n.date, t.options, t))
|
|
181
183
|
)),
|
|
182
|
-
|
|
184
|
+
M === "around" && !e.hideNavigation && m === K - 1 && i.createElement(
|
|
183
185
|
l.NextMonthButton,
|
|
184
|
-
{ type: "button", className: r[
|
|
185
|
-
i.createElement(l.Chevron, { disabled: p ? void 0 : !0, className: r[
|
|
186
|
+
{ type: "button", className: r[o.NextMonthButton], tabIndex: p ? void 0 : -1, "aria-disabled": p ? void 0 : !0, "aria-label": he(p), onClick: L, "data-animated-button": e.animate ? "true" : void 0 },
|
|
187
|
+
i.createElement(l.Chevron, { disabled: p ? void 0 : !0, className: r[o.Chevron], orientation: e.dir === "rtl" ? "left" : "right" })
|
|
186
188
|
),
|
|
187
|
-
|
|
189
|
+
m === K - 1 && M === "after" && !e.hideNavigation && i.createElement(l.Nav, { "data-animated-nav": e.animate ? "true" : void 0, className: r[o.Nav], style: c?.[o.Nav], "aria-label": ee(), onPreviousClick: O, onNextClick: L, previousMonth: f, nextMonth: p }),
|
|
188
190
|
i.createElement(
|
|
189
191
|
l.MonthGrid,
|
|
190
|
-
{ role: "grid", "aria-multiselectable": g === "multiple" || g === "range", "aria-label": fe(n.date, t.options, t) || void 0, className: r[
|
|
192
|
+
{ role: "grid", "aria-multiselectable": g === "multiple" || g === "range", "aria-label": fe(n.date, t.options, t) || void 0, className: r[o.MonthGrid], style: c?.[o.MonthGrid] },
|
|
191
193
|
!e.hideWeekdays && i.createElement(
|
|
192
194
|
l.Weekdays,
|
|
193
|
-
{ "data-animated-weekdays": e.animate ? "true" : void 0, className: r[
|
|
194
|
-
V && i.createElement(l.WeekNumberHeader, { "aria-label":
|
|
195
|
-
|
|
195
|
+
{ "data-animated-weekdays": e.animate ? "true" : void 0, className: r[o.Weekdays], style: c?.[o.Weekdays] },
|
|
196
|
+
V && i.createElement(l.WeekNumberHeader, { "aria-label": Ne(t.options), className: r[o.WeekNumberHeader], style: c?.[o.WeekNumberHeader], scope: "col" }, re()),
|
|
197
|
+
De.map((a) => i.createElement(l.Weekday, { "aria-label": be(a, t.options, t), className: r[o.Weekday], key: String(a), style: c?.[o.Weekday], scope: "col" }, ie(a, t.options, t)))
|
|
196
198
|
),
|
|
197
|
-
i.createElement(l.Weeks, { "data-animated-weeks": e.animate ? "true" : void 0, className: r[
|
|
199
|
+
i.createElement(l.Weeks, { "data-animated-weeks": e.animate ? "true" : void 0, className: r[o.Weeks], style: c?.[o.Weeks] }, n.weeks.map((a) => i.createElement(
|
|
198
200
|
l.Week,
|
|
199
|
-
{ className: r[
|
|
201
|
+
{ className: r[o.Week], key: a.weekNumber, style: c?.[o.Week], week: a },
|
|
200
202
|
V && // biome-ignore lint/a11y/useSemanticElements: react component
|
|
201
|
-
i.createElement(l.WeekNumber, { week:
|
|
203
|
+
i.createElement(l.WeekNumber, { week: a, style: c?.[o.WeekNumber], "aria-label": ke(a.weekNumber, {
|
|
202
204
|
locale: oe
|
|
203
|
-
}), className: r[
|
|
204
|
-
|
|
205
|
-
const { date: u } =
|
|
206
|
-
if (s[ze.focused] = !s.hidden && !!Q?.isEqualTo(
|
|
207
|
-
const { from: P, to: F } =
|
|
208
|
-
s[w.range_start] = !!(P && F && t.isSameDay(u, P)), s[w.range_end] = !!(P && F && t.isSameDay(u, F)), s[w.range_middle] = at(
|
|
205
|
+
}), className: r[o.WeekNumber], scope: "row", role: "rowheader" }, se(a.weekNumber, t)),
|
|
206
|
+
a.days.map((d) => {
|
|
207
|
+
const { date: u } = d, s = x(d);
|
|
208
|
+
if (s[ze.focused] = !s.hidden && !!Q?.isEqualTo(d), s[w.selected] = S?.(u) || s.selected, ot(D)) {
|
|
209
|
+
const { from: P, to: F } = D;
|
|
210
|
+
s[w.range_start] = !!(P && F && t.isSameDay(u, P)), s[w.range_end] = !!(P && F && t.isSameDay(u, F)), s[w.range_middle] = at(D, u, !0, t);
|
|
209
211
|
}
|
|
210
212
|
const Pe = je(s, c, e.modifiersStyles), Fe = Re(s, r, e.modifiersClassNames), Ze = !te && !s.hidden ? ue(u, s, t.options, t) : void 0;
|
|
211
213
|
return (
|
|
212
214
|
// biome-ignore lint/a11y/useSemanticElements: react component
|
|
213
|
-
i.createElement(l.Day, { key: `${t.format(u, "yyyy-MM-dd")}_${t.format(
|
|
215
|
+
i.createElement(l.Day, { key: `${t.format(u, "yyyy-MM-dd")}_${t.format(d.displayMonth, "yyyy-MM")}`, day: d, modifiers: s, className: Fe.join(" "), style: Pe, role: "gridcell", "aria-selected": s.selected || void 0, "aria-label": Ze, "data-day": t.format(u, "yyyy-MM-dd"), "data-month": d.outside ? t.format(u, "yyyy-MM") : void 0, "data-selected": s.selected || void 0, "data-disabled": s.disabled || void 0, "data-hidden": s.hidden || void 0, "data-outside": d.outside || void 0, "data-focused": s.focused || void 0, "data-today": s.today || void 0 }, !s.hidden && te ? i.createElement(l.DayButton, { className: r[o.DayButton], style: c?.[o.DayButton], type: "button", day: d, modifiers: s, disabled: s.disabled || void 0, tabIndex: me(d) ? 0 : -1, "aria-label": ce(u, s, t.options, t), onClick: ve(d, s), onBlur: ge(d, s), onFocus: we(d, s), onKeyDown: Ce(d, s), onMouseEnter: We(d, s), onMouseLeave: Ee(d, s) }, q(u, t.options, t)) : !s.hidden && q(d.date, t.options, t))
|
|
214
216
|
);
|
|
215
217
|
})
|
|
216
218
|
)))
|
|
@@ -218,7 +220,7 @@ function Bt(A) {
|
|
|
218
220
|
))
|
|
219
221
|
),
|
|
220
222
|
e.footer && // biome-ignore lint/a11y/useSemanticElements: react component
|
|
221
|
-
i.createElement(l.Footer, { className: r[
|
|
223
|
+
i.createElement(l.Footer, { className: r[o.Footer], style: c?.[o.Footer], role: "status", "aria-live": "polite" }, e.footer)
|
|
222
224
|
)
|
|
223
225
|
);
|
|
224
226
|
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { TZDate as
|
|
2
|
+
import { TZDate as h } from "../../../../@date-fns/tz/date/index.js";
|
|
3
3
|
import "../../../../@date-fns/tz/date/mini.js";
|
|
4
|
-
import { enUS as
|
|
5
|
-
import { endOfBroadcastWeek as
|
|
6
|
-
import { startOfBroadcastWeek as
|
|
7
|
-
import { addDays as
|
|
8
|
-
import { addMonths as
|
|
9
|
-
import { addWeeks as
|
|
10
|
-
import { addYears as
|
|
11
|
-
import { differenceInCalendarDays as
|
|
12
|
-
import { differenceInCalendarMonths as
|
|
13
|
-
import { eachMonthOfInterval as
|
|
14
|
-
import { endOfISOWeek as
|
|
15
|
-
import { endOfMonth as
|
|
16
|
-
import { endOfWeek as
|
|
17
|
-
import { endOfYear as
|
|
18
|
-
import { formatDate as
|
|
19
|
-
import { getISOWeek as
|
|
20
|
-
import { getMonth as
|
|
21
|
-
import { getYear as
|
|
4
|
+
import { enUS as a } from "../../../../date-fns/locale/en-US.js";
|
|
5
|
+
import { endOfBroadcastWeek as f } from "../helpers/endOfBroadcastWeek.js";
|
|
6
|
+
import { startOfBroadcastWeek as d } from "../helpers/startOfBroadcastWeek.js";
|
|
7
|
+
import { addDays as m } from "../../../../date-fns/addDays.js";
|
|
8
|
+
import { addMonths as v } from "../../../../date-fns/addMonths.js";
|
|
9
|
+
import { addWeeks as p } from "../../../../date-fns/addWeeks.js";
|
|
10
|
+
import { addYears as O } from "../../../../date-fns/addYears.js";
|
|
11
|
+
import { differenceInCalendarDays as u } from "../../../../date-fns/differenceInCalendarDays.js";
|
|
12
|
+
import { differenceInCalendarMonths as c } from "../../../../date-fns/differenceInCalendarMonths.js";
|
|
13
|
+
import { eachMonthOfInterval as l } from "../../../../date-fns/eachMonthOfInterval.js";
|
|
14
|
+
import { endOfISOWeek as M } from "../../../../date-fns/endOfISOWeek.js";
|
|
15
|
+
import { endOfMonth as k } from "../../../../date-fns/endOfMonth.js";
|
|
16
|
+
import { endOfWeek as W } from "../../../../date-fns/endOfWeek.js";
|
|
17
|
+
import { endOfYear as D } from "../../../../date-fns/endOfYear.js";
|
|
18
|
+
import { formatDate as S } from "../../../../date-fns/format.js";
|
|
19
|
+
import { getISOWeek as g } from "../../../../date-fns/getISOWeek.js";
|
|
20
|
+
import { getMonth as y } from "../../../../date-fns/getMonth.js";
|
|
21
|
+
import { getYear as Y } from "../../../../date-fns/getYear.js";
|
|
22
22
|
import { getWeek as I } from "../../../../date-fns/getWeek.js";
|
|
23
|
-
import { isAfter as
|
|
24
|
-
import { isBefore as
|
|
25
|
-
import { isDate as
|
|
26
|
-
import { isSameDay as
|
|
27
|
-
import { isSameMonth as
|
|
28
|
-
import { isSameYear as
|
|
29
|
-
import { max as
|
|
30
|
-
import { min as
|
|
31
|
-
import { setMonth as
|
|
23
|
+
import { isAfter as B } from "../../../../date-fns/isAfter.js";
|
|
24
|
+
import { isBefore as w } from "../../../../date-fns/isBefore.js";
|
|
25
|
+
import { isDate as L } from "../../../../date-fns/isDate.js";
|
|
26
|
+
import { isSameDay as C } from "../../../../date-fns/isSameDay.js";
|
|
27
|
+
import { isSameMonth as Z } from "../../../../date-fns/isSameMonth.js";
|
|
28
|
+
import { isSameYear as b } from "../../../../date-fns/isSameYear.js";
|
|
29
|
+
import { max as z } from "../../../../date-fns/max.js";
|
|
30
|
+
import { min as F } from "../../../../date-fns/min.js";
|
|
31
|
+
import { setMonth as A } from "../../../../date-fns/setMonth.js";
|
|
32
32
|
import { setYear as N } from "../../../../date-fns/setYear.js";
|
|
33
|
-
import { startOfDay as
|
|
34
|
-
import { startOfISOWeek as
|
|
35
|
-
import { startOfMonth as
|
|
36
|
-
import { startOfWeek as
|
|
37
|
-
import { startOfYear as
|
|
38
|
-
class
|
|
33
|
+
import { startOfDay as _ } from "../../../../date-fns/startOfDay.js";
|
|
34
|
+
import { startOfISOWeek as j } from "../../../../date-fns/startOfISOWeek.js";
|
|
35
|
+
import { startOfMonth as x } from "../../../../date-fns/startOfMonth.js";
|
|
36
|
+
import { startOfWeek as H } from "../../../../date-fns/startOfWeek.js";
|
|
37
|
+
import { startOfYear as K } from "../../../../date-fns/startOfYear.js";
|
|
38
|
+
class o {
|
|
39
39
|
/**
|
|
40
40
|
* Creates an instance of `DateLib`.
|
|
41
41
|
*
|
|
42
42
|
* @param options Configuration options for the date library.
|
|
43
43
|
* @param overrides Custom overrides for the date library functions.
|
|
44
44
|
*/
|
|
45
|
-
constructor(t,
|
|
46
|
-
this.Date = Date, this.today = () => this.overrides?.today ? this.overrides.today() : this.options.timeZone ?
|
|
47
|
-
const
|
|
48
|
-
return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(
|
|
49
|
-
}, this.getISOWeek = (r) => this.overrides?.getISOWeek ? this.overrides.getISOWeek(r) :
|
|
45
|
+
constructor(t, i) {
|
|
46
|
+
this.Date = Date, this.today = () => this.overrides?.today ? this.overrides.today() : this.options.timeZone ? h.tz(this.options.timeZone) : new this.Date(), this.newDate = (r, e, s) => this.overrides?.newDate ? this.overrides.newDate(r, e, s) : this.options.timeZone ? new h(r, e, s, this.options.timeZone) : new Date(r, e, s), this.addDays = (r, e) => this.overrides?.addDays ? this.overrides.addDays(r, e) : m(r, e), this.addMonths = (r, e) => this.overrides?.addMonths ? this.overrides.addMonths(r, e) : v(r, e), this.addWeeks = (r, e) => this.overrides?.addWeeks ? this.overrides.addWeeks(r, e) : p(r, e), this.addYears = (r, e) => this.overrides?.addYears ? this.overrides.addYears(r, e) : O(r, e), this.differenceInCalendarDays = (r, e) => this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(r, e) : u(r, e), this.differenceInCalendarMonths = (r, e) => this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(r, e) : c(r, e), this.eachMonthOfInterval = (r) => this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(r) : l(r), this.endOfBroadcastWeek = (r) => this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(r) : f(r, this), this.endOfISOWeek = (r) => this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(r) : M(r), this.endOfMonth = (r) => this.overrides?.endOfMonth ? this.overrides.endOfMonth(r) : k(r), this.endOfWeek = (r, e) => this.overrides?.endOfWeek ? this.overrides.endOfWeek(r, e) : W(r, this.options), this.endOfYear = (r) => this.overrides?.endOfYear ? this.overrides.endOfYear(r) : D(r), this.format = (r, e, s) => {
|
|
47
|
+
const n = this.overrides?.format ? this.overrides.format(r, e, this.options) : S(r, e, this.options);
|
|
48
|
+
return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(n) : n;
|
|
49
|
+
}, this.getISOWeek = (r) => this.overrides?.getISOWeek ? this.overrides.getISOWeek(r) : g(r), this.getMonth = (r, e) => this.overrides?.getMonth ? this.overrides.getMonth(r, this.options) : y(r, this.options), this.getYear = (r, e) => this.overrides?.getYear ? this.overrides.getYear(r, this.options) : Y(r, this.options), this.getWeek = (r, e) => this.overrides?.getWeek ? this.overrides.getWeek(r, this.options) : I(r, this.options), this.isAfter = (r, e) => this.overrides?.isAfter ? this.overrides.isAfter(r, e) : B(r, e), this.isBefore = (r, e) => this.overrides?.isBefore ? this.overrides.isBefore(r, e) : w(r, e), this.isDate = (r) => this.overrides?.isDate ? this.overrides.isDate(r) : L(r), this.isSameDay = (r, e) => this.overrides?.isSameDay ? this.overrides.isSameDay(r, e) : C(r, e), this.isSameMonth = (r, e) => this.overrides?.isSameMonth ? this.overrides.isSameMonth(r, e) : Z(r, e), this.isSameYear = (r, e) => this.overrides?.isSameYear ? this.overrides.isSameYear(r, e) : b(r, e), this.max = (r) => this.overrides?.max ? this.overrides.max(r) : z(r), this.min = (r) => this.overrides?.min ? this.overrides.min(r) : F(r), this.setMonth = (r, e) => this.overrides?.setMonth ? this.overrides.setMonth(r, e) : A(r, e), this.setYear = (r, e) => this.overrides?.setYear ? this.overrides.setYear(r, e) : N(r, e), this.startOfBroadcastWeek = (r, e) => this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(r, this) : d(r, this), this.startOfDay = (r) => this.overrides?.startOfDay ? this.overrides.startOfDay(r) : _(r), this.startOfISOWeek = (r) => this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(r) : j(r), this.startOfMonth = (r) => this.overrides?.startOfMonth ? this.overrides.startOfMonth(r) : x(r), this.startOfWeek = (r, e) => this.overrides?.startOfWeek ? this.overrides.startOfWeek(r, this.options) : H(r, this.options), this.startOfYear = (r) => this.overrides?.startOfYear ? this.overrides.startOfYear(r) : K(r), this.options = { locale: a, ...t }, this.overrides = i;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Generates a mapping of Arabic digits (0-9) to the target numbering system
|
|
@@ -56,11 +56,11 @@ class E {
|
|
|
56
56
|
* @returns A record mapping Arabic digits to the target numerals.
|
|
57
57
|
*/
|
|
58
58
|
getDigitMap() {
|
|
59
|
-
const { numerals: t = "latn" } = this.options,
|
|
59
|
+
const { numerals: t = "latn" } = this.options, i = new Intl.NumberFormat("en-US", {
|
|
60
60
|
numberingSystem: t
|
|
61
61
|
}), r = {};
|
|
62
62
|
for (let e = 0; e < 10; e++)
|
|
63
|
-
r[e.toString()] =
|
|
63
|
+
r[e.toString()] = i.format(e);
|
|
64
64
|
return r;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -71,8 +71,8 @@ class E {
|
|
|
71
71
|
* @returns The string with digits replaced.
|
|
72
72
|
*/
|
|
73
73
|
replaceDigits(t) {
|
|
74
|
-
const
|
|
75
|
-
return t.replace(/\d/g, (r) =>
|
|
74
|
+
const i = this.getDigitMap();
|
|
75
|
+
return t.replace(/\d/g, (r) => i[r] || r);
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Formats a number using the configured numbering system.
|
|
@@ -84,10 +84,57 @@ class E {
|
|
|
84
84
|
formatNumber(t) {
|
|
85
85
|
return this.replaceDigits(t.toString());
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns the preferred ordering for month and year labels for the current
|
|
89
|
+
* locale.
|
|
90
|
+
*/
|
|
91
|
+
getMonthYearOrder() {
|
|
92
|
+
const t = this.options.locale?.code;
|
|
93
|
+
return t && o.yearFirstLocales.has(t) ? "year-first" : "month-first";
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Formats the month/year pair respecting locale conventions.
|
|
97
|
+
*
|
|
98
|
+
* @since 9.11.0
|
|
99
|
+
*/
|
|
100
|
+
formatMonthYear(t) {
|
|
101
|
+
const { locale: i, timeZone: r, numerals: e } = this.options, s = i?.code;
|
|
102
|
+
if (s && o.yearFirstLocales.has(s))
|
|
103
|
+
try {
|
|
104
|
+
return new Intl.DateTimeFormat(s, {
|
|
105
|
+
month: "long",
|
|
106
|
+
year: "numeric",
|
|
107
|
+
timeZone: r,
|
|
108
|
+
numberingSystem: e
|
|
109
|
+
}).format(t);
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
const n = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
|
|
113
|
+
return this.format(t, n);
|
|
114
|
+
}
|
|
87
115
|
}
|
|
88
|
-
|
|
116
|
+
o.yearFirstLocales = /* @__PURE__ */ new Set([
|
|
117
|
+
"eu",
|
|
118
|
+
"hu",
|
|
119
|
+
"ja",
|
|
120
|
+
"ja-Hira",
|
|
121
|
+
"ja-JP",
|
|
122
|
+
"ko",
|
|
123
|
+
"ko-KR",
|
|
124
|
+
"lt",
|
|
125
|
+
"lt-LT",
|
|
126
|
+
"lv",
|
|
127
|
+
"lv-LV",
|
|
128
|
+
"mn",
|
|
129
|
+
"mn-MN",
|
|
130
|
+
"zh",
|
|
131
|
+
"zh-CN",
|
|
132
|
+
"zh-HK",
|
|
133
|
+
"zh-TW"
|
|
134
|
+
]);
|
|
135
|
+
const Ir = new o();
|
|
89
136
|
export {
|
|
90
|
-
|
|
137
|
+
o as DateLib,
|
|
91
138
|
Ir as defaultDateLib,
|
|
92
|
-
|
|
139
|
+
a as defaultLocale
|
|
93
140
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DateLib as r } from "../classes/DateLib.js";
|
|
3
|
-
function
|
|
4
|
-
return (n ?? new r(o)).
|
|
3
|
+
function i(t, o, n) {
|
|
4
|
+
return (n ?? new r(o)).formatMonthYear(t);
|
|
5
5
|
}
|
|
6
|
-
const
|
|
6
|
+
const f = i;
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
i as formatCaption,
|
|
9
|
+
f as formatMonthCaption
|
|
10
10
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DateLib as o } from "../classes/DateLib.js";
|
|
3
|
-
function
|
|
4
|
-
return (n ?? new o(e)).
|
|
3
|
+
function i(t, e, n) {
|
|
4
|
+
return (n ?? new o(e)).formatMonthYear(t);
|
|
5
5
|
}
|
|
6
|
-
const a =
|
|
6
|
+
const a = i;
|
|
7
7
|
export {
|
|
8
8
|
a as labelCaption,
|
|
9
|
-
|
|
9
|
+
i as labelGrid
|
|
10
10
|
};
|