@helsenorge/datepicker
Advanced tools
Comparing version 8.5.0 to 8.6.0-beta.1
@@ -1,3 +0,4 @@ | ||
import M, { createContext as J, forwardRef as Vt, useContext as Q, useState as T, useEffect as q, useLayoutEffect as Kt, useRef as re } from "react"; | ||
import { isSameDay as P, subDays as Ne, addDays as L, differenceInCalendarDays as j, startOfMonth as R, endOfMonth as Te, startOfDay as tt, addMonths as A, differenceInCalendarMonths as de, isSameMonth as Fe, isBefore as Ae, isAfter as ye, getUnixTime as Ut, getWeeksInMonth as Xt, addWeeks as Se, isSameYear as Zt, setMonth as Ce, setYear as nt, startOfYear as Gt, max as $t, min as qt, endOfISOWeek as vt, endOfWeek as mt, startOfISOWeek as Ye, startOfWeek as He, getISOWeek as Jt, getWeek as Qt, format as S, isDate as ht, addYears as zt, isValid as ue, parse as se, isWithinInterval as en } from "date-fns"; | ||
import { jsx as d, jsxs as R, Fragment as F } from "react/jsx-runtime"; | ||
import U, { createContext as J, forwardRef as Vt, useContext as Q, useState as T, useEffect as q, useLayoutEffect as Kt, useRef as re } from "react"; | ||
import { isSameDay as C, subDays as Ne, addDays as L, differenceInCalendarDays as j, startOfMonth as E, endOfMonth as Te, startOfDay as tt, addMonths as Y, differenceInCalendarMonths as de, isSameMonth as Fe, isBefore as Ae, isAfter as ye, getUnixTime as Ut, getWeeksInMonth as Xt, addWeeks as Le, isSameYear as Zt, setMonth as Ce, setYear as nt, startOfYear as Gt, max as $t, min as qt, endOfISOWeek as vt, endOfWeek as ht, startOfISOWeek as Ye, startOfWeek as He, getISOWeek as Jt, getWeek as Qt, format as S, isDate as mt, addYears as zt, isValid as ue, parse as se, isWithinInterval as en } from "date-fns"; | ||
import { enUS as tn, nb as nn } from "date-fns/locale"; | ||
@@ -7,3 +8,3 @@ import rn from "@helsenorge/designsystem-react/components/Button"; | ||
import on from "@helsenorge/designsystem-react/components/Icons/Calendar"; | ||
import Le from "@helsenorge/designsystem-react/components/Input"; | ||
import Ee from "@helsenorge/designsystem-react/components/Input"; | ||
import { ZIndex as ln, KeyboardEventKey as rt } from "@helsenorge/designsystem-react/constants"; | ||
@@ -16,3 +17,2 @@ import { useKeyboardEvent as at } from "@helsenorge/designsystem-react/hooks/useKeyboardEvent"; | ||
import Re from "classnames"; | ||
import { jsx as u, jsxs as Y, Fragment as K } from "react/jsx-runtime"; | ||
import un from "react-day-picker/dist/style.module.css"; | ||
@@ -23,6 +23,6 @@ import { PopOverVariant as V } from "@helsenorge/designsystem-react/components/PopOver"; | ||
import { useIsVisible as vn } from "@helsenorge/designsystem-react/hooks/useIsVisible"; | ||
import { useLayoutEvent as mn } from "@helsenorge/designsystem-react/hooks/useLayoutEvent"; | ||
import { useSize as hn } from "@helsenorge/designsystem-react/hooks/useSize"; | ||
import { useLayoutEvent as hn } from "@helsenorge/designsystem-react/hooks/useLayoutEvent"; | ||
import { useSize as mn } from "@helsenorge/designsystem-react/hooks/useSize"; | ||
import { getSpacer as pn } from "@helsenorge/designsystem-react/theme/currys/spacing"; | ||
import O from "./styles.module.scss"; | ||
import I from "./styles.module.scss"; | ||
import yn from "@helsenorge/designsystem-react/components/ErrorWrapper"; | ||
@@ -139,7 +139,7 @@ import { useUuid as bn } from "@helsenorge/designsystem-react/hooks/useUuid"; | ||
return "Go to previous month"; | ||
}, En = function(e, n) { | ||
}, Sn = function(e, n) { | ||
return S(e, "cccc", n); | ||
}, Sn = function(e) { | ||
}, Ln = function(e) { | ||
return "Week n. ".concat(e); | ||
}, Ln = function() { | ||
}, En = function() { | ||
return "Year: "; | ||
@@ -152,5 +152,5 @@ }, Rn = /* @__PURE__ */ Object.freeze({ | ||
labelPrevious: Wn, | ||
labelWeekNumber: Sn, | ||
labelWeekday: En, | ||
labelYearDropdown: Ln | ||
labelWeekNumber: Ln, | ||
labelWeekday: Sn, | ||
labelYearDropdown: En | ||
}); | ||
@@ -175,3 +175,3 @@ function Bn() { | ||
var n = e.fromYear, t = e.toYear, r = e.fromMonth, a = e.toMonth, o = e.fromDate, i = e.toDate; | ||
return r ? o = R(r) : n && (o = new Date(n, 0, 1)), a ? i = Te(a) : t && (i = new Date(t, 11, 31)), { | ||
return r ? o = E(r) : n && (o = new Date(n, 0, 1)), a ? i = Te(a) : t && (i = new Date(t, 11, 31)), { | ||
fromDate: o ? tt(o) : void 0, | ||
@@ -188,5 +188,5 @@ toDate: i ? tt(i) : void 0 | ||
var c = g(g(g({}, r), t), { captionLayout: l, classNames: g(g({}, r.classNames), t.classNames), components: g({}, t.components), formatters: g(g({}, r.formatters), t.formatters), fromDate: o, labels: g(g({}, r.labels), t.labels), mode: t.mode || r.mode, modifiers: g(g({}, r.modifiers), t.modifiers), modifiersClassNames: g(g({}, r.modifiersClassNames), t.modifiersClassNames), onSelect: s, styles: g(g({}, r.styles), t.styles), toDate: i }); | ||
return u(_t.Provider, { value: c, children: e.children }); | ||
return d(_t.Provider, { value: c, children: e.children }); | ||
} | ||
function N() { | ||
function k() { | ||
var e = Q(_t); | ||
@@ -198,47 +198,47 @@ if (!e) | ||
function wt(e) { | ||
var n = N(), t = n.locale, r = n.classNames, a = n.styles, o = n.formatters.formatCaption; | ||
return u("div", { className: r.caption_label, style: a.caption_label, "aria-live": "polite", role: "presentation", id: e.id, children: o(e.displayMonth, { locale: t }) }); | ||
var n = k(), t = n.locale, r = n.classNames, a = n.styles, o = n.formatters.formatCaption; | ||
return d("div", { className: r.caption_label, style: a.caption_label, "aria-live": "polite", role: "presentation", id: e.id, children: o(e.displayMonth, { locale: t }) }); | ||
} | ||
function An(e) { | ||
return u("svg", g({ width: "8px", height: "8px", viewBox: "0 0 120 120", "data-testid": "iconDropdown" }, e, { children: u("path", { d: "M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z", fill: "currentColor", fillRule: "nonzero" }) })); | ||
return d("svg", g({ width: "8px", height: "8px", viewBox: "0 0 120 120", "data-testid": "iconDropdown" }, e, { children: d("path", { d: "M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z", fill: "currentColor", fillRule: "nonzero" }) })); | ||
} | ||
function Dt(e) { | ||
var n, t, r = e.onChange, a = e.value, o = e.children, i = e.caption, l = e.className, s = e.style, c = N(), d = (t = (n = c.components) === null || n === void 0 ? void 0 : n.IconDropdown) !== null && t !== void 0 ? t : An; | ||
return Y("div", { className: l, style: s, children: [u("span", { className: c.classNames.vhidden, children: e["aria-label"] }), u("select", { name: e.name, "aria-label": e["aria-label"], className: c.classNames.dropdown, style: c.styles.dropdown, value: a, onChange: r, children: o }), Y("div", { className: c.classNames.caption_label, style: c.styles.caption_label, "aria-hidden": "true", children: [i, u(d, { className: c.classNames.dropdown_icon, style: c.styles.dropdown_icon })] })] }); | ||
var n, t, r = e.onChange, a = e.value, o = e.children, i = e.caption, l = e.className, s = e.style, c = k(), u = (t = (n = c.components) === null || n === void 0 ? void 0 : n.IconDropdown) !== null && t !== void 0 ? t : An; | ||
return R("div", { className: l, style: s, children: [d("span", { className: c.classNames.vhidden, children: e["aria-label"] }), d("select", { name: e.name, "aria-label": e["aria-label"], className: c.classNames.dropdown, style: c.styles.dropdown, value: a, onChange: r, children: o }), R("div", { className: c.classNames.caption_label, style: c.styles.caption_label, "aria-hidden": "true", children: [i, d(u, { className: c.classNames.dropdown_icon, style: c.styles.dropdown_icon })] })] }); | ||
} | ||
function Yn(e) { | ||
var n, t = N(), r = t.fromDate, a = t.toDate, o = t.styles, i = t.locale, l = t.formatters.formatMonthCaption, s = t.classNames, c = t.components, d = t.labels.labelMonthDropdown; | ||
var n, t = k(), r = t.fromDate, a = t.toDate, o = t.styles, i = t.locale, l = t.formatters.formatMonthCaption, s = t.classNames, c = t.components, u = t.labels.labelMonthDropdown; | ||
if (!r) | ||
return u(K, {}); | ||
return d(F, {}); | ||
if (!a) | ||
return u(K, {}); | ||
return d(F, {}); | ||
var f = []; | ||
if (Zt(r, a)) | ||
for (var m = R(r), h = r.getMonth(); h <= a.getMonth(); h++) | ||
f.push(Ce(m, h)); | ||
for (var h = E(r), m = r.getMonth(); m <= a.getMonth(); m++) | ||
f.push(Ce(h, m)); | ||
else | ||
for (var m = R(/* @__PURE__ */ new Date()), h = 0; h <= 11; h++) | ||
f.push(Ce(m, h)); | ||
for (var h = E(/* @__PURE__ */ new Date()), m = 0; m <= 11; m++) | ||
f.push(Ce(h, m)); | ||
var p = function(b) { | ||
var k = Number(b.target.value), D = Ce(R(e.displayMonth), k); | ||
var M = Number(b.target.value), D = Ce(E(e.displayMonth), M); | ||
e.onChange(D); | ||
}, _ = (n = c == null ? void 0 : c.Dropdown) !== null && n !== void 0 ? n : Dt; | ||
return u(_, { name: "months", "aria-label": d(), className: s.dropdown_month, style: o.dropdown_month, onChange: p, value: e.displayMonth.getMonth(), caption: l(e.displayMonth, { locale: i }), children: f.map(function(b) { | ||
return u("option", { value: b.getMonth(), children: l(b, { locale: i }) }, b.getMonth()); | ||
return d(_, { name: "months", "aria-label": u(), className: s.dropdown_month, style: o.dropdown_month, onChange: p, value: e.displayMonth.getMonth(), caption: l(e.displayMonth, { locale: i }), children: f.map(function(b) { | ||
return d("option", { value: b.getMonth(), children: l(b, { locale: i }) }, b.getMonth()); | ||
}) }); | ||
} | ||
function Hn(e) { | ||
var n, t = e.displayMonth, r = N(), a = r.fromDate, o = r.toDate, i = r.locale, l = r.styles, s = r.classNames, c = r.components, d = r.formatters.formatYearCaption, f = r.labels.labelYearDropdown, m = []; | ||
var n, t = e.displayMonth, r = k(), a = r.fromDate, o = r.toDate, i = r.locale, l = r.styles, s = r.classNames, c = r.components, u = r.formatters.formatYearCaption, f = r.labels.labelYearDropdown, h = []; | ||
if (!a) | ||
return u(K, {}); | ||
return d(F, {}); | ||
if (!o) | ||
return u(K, {}); | ||
for (var h = a.getFullYear(), p = o.getFullYear(), _ = h; _ <= p; _++) | ||
m.push(nt(Gt(/* @__PURE__ */ new Date()), _)); | ||
return d(F, {}); | ||
for (var m = a.getFullYear(), p = o.getFullYear(), _ = m; _ <= p; _++) | ||
h.push(nt(Gt(/* @__PURE__ */ new Date()), _)); | ||
var b = function(D) { | ||
var W = nt(R(t), Number(D.target.value)); | ||
e.onChange(W); | ||
}, k = (n = c == null ? void 0 : c.Dropdown) !== null && n !== void 0 ? n : Dt; | ||
return u(k, { name: "years", "aria-label": f(), className: s.dropdown_year, style: l.dropdown_year, onChange: b, value: t.getFullYear(), caption: d(t, { locale: i }), children: m.map(function(D) { | ||
return u("option", { value: D.getFullYear(), children: d(D, { locale: i }) }, D.getFullYear()); | ||
var O = nt(E(t), Number(D.target.value)); | ||
e.onChange(O); | ||
}, M = (n = c == null ? void 0 : c.Dropdown) !== null && n !== void 0 ? n : Dt; | ||
return d(M, { name: "years", "aria-label": f(), className: s.dropdown_year, style: l.dropdown_year, onChange: b, value: t.getFullYear(), caption: u(t, { locale: i }), children: h.map(function(D) { | ||
return d("option", { value: D.getFullYear(), children: u(D, { locale: i }) }, D.getFullYear()); | ||
}) }); | ||
@@ -254,11 +254,11 @@ } | ||
var c = -1 * (s - 1); | ||
a = A(o, c); | ||
a = Y(o, c); | ||
} | ||
return i && de(a, i) < 0 && (a = i), R(a); | ||
return i && de(a, i) < 0 && (a = i), E(a); | ||
} | ||
function Kn() { | ||
var e = N(), n = Vn(e), t = jn(n, e.month), r = t[0], a = t[1], o = function(i) { | ||
var e = k(), n = Vn(e), t = jn(n, e.month), r = t[0], a = t[1], o = function(i) { | ||
var l; | ||
if (!e.disableNavigation) { | ||
var s = R(i); | ||
var s = E(i); | ||
a(s), (l = e.onMonthChange) === null || l === void 0 || l.call(e, s); | ||
@@ -270,4 +270,4 @@ } | ||
function Un(e, n) { | ||
for (var t = n.reverseMonths, r = n.numberOfMonths, a = R(e), o = R(A(a, r)), i = de(o, a), l = [], s = 0; s < i; s++) { | ||
var c = A(a, s); | ||
for (var t = n.reverseMonths, r = n.numberOfMonths, a = E(e), o = E(Y(a, r)), i = de(o, a), l = [], s = 0; s < i; s++) { | ||
var c = Y(a, s); | ||
l.push(c); | ||
@@ -279,8 +279,8 @@ } | ||
if (!n.disableNavigation) { | ||
var t = n.toDate, r = n.pagedNavigation, a = n.numberOfMonths, o = a === void 0 ? 1 : a, i = r ? o : 1, l = R(e); | ||
var t = n.toDate, r = n.pagedNavigation, a = n.numberOfMonths, o = a === void 0 ? 1 : a, i = r ? o : 1, l = E(e); | ||
if (!t) | ||
return A(l, i); | ||
return Y(l, i); | ||
var s = de(t, e); | ||
if (!(s < o)) | ||
return A(l, i); | ||
return Y(l, i); | ||
} | ||
@@ -290,8 +290,8 @@ } | ||
if (!n.disableNavigation) { | ||
var t = n.fromDate, r = n.pagedNavigation, a = n.numberOfMonths, o = a === void 0 ? 1 : a, i = r ? o : 1, l = R(e); | ||
var t = n.fromDate, r = n.pagedNavigation, a = n.numberOfMonths, o = a === void 0 ? 1 : a, i = r ? o : 1, l = E(e); | ||
if (!t) | ||
return A(l, -i); | ||
return Y(l, -i); | ||
var s = de(l, t); | ||
if (!(s <= 0)) | ||
return A(l, -i); | ||
return Y(l, -i); | ||
} | ||
@@ -301,9 +301,9 @@ } | ||
function Gn(e) { | ||
var n = N(), t = Kn(), r = t[0], a = t[1], o = Un(r, n), i = Xn(r, n), l = Zn(r, n), s = function(f) { | ||
return o.some(function(m) { | ||
return Fe(f, m); | ||
var n = k(), t = Kn(), r = t[0], a = t[1], o = Un(r, n), i = Xn(r, n), l = Zn(r, n), s = function(f) { | ||
return o.some(function(h) { | ||
return Fe(f, h); | ||
}); | ||
}, c = function(f, m) { | ||
s(f) || (m && Ae(f, m) ? a(A(f, 1 + n.numberOfMonths * -1)) : a(f)); | ||
}, d = { | ||
}, c = function(f, h) { | ||
s(f) || (h && Ae(f, h) ? a(Y(f, 1 + n.numberOfMonths * -1)) : a(f)); | ||
}, u = { | ||
currentMonth: r, | ||
@@ -317,3 +317,3 @@ displayMonths: o, | ||
}; | ||
return u(Mt.Provider, { value: d, children: e.children }); | ||
return d(Mt.Provider, { value: u, children: e.children }); | ||
} | ||
@@ -327,49 +327,49 @@ function ve() { | ||
function it(e) { | ||
var n, t = N(), r = t.classNames, a = t.styles, o = t.components, i = ve().goToMonth, l = function(d) { | ||
i(A(d, e.displayIndex ? -e.displayIndex : 0)); | ||
}, s = (n = o == null ? void 0 : o.CaptionLabel) !== null && n !== void 0 ? n : wt, c = u(s, { id: e.id, displayMonth: e.displayMonth }); | ||
return Y("div", { className: r.caption_dropdowns, style: a.caption_dropdowns, children: [u("div", { className: r.vhidden, children: c }), u(Yn, { onChange: l, displayMonth: e.displayMonth }), u(Hn, { onChange: l, displayMonth: e.displayMonth })] }); | ||
var n, t = k(), r = t.classNames, a = t.styles, o = t.components, i = ve().goToMonth, l = function(u) { | ||
i(Y(u, e.displayIndex ? -e.displayIndex : 0)); | ||
}, s = (n = o == null ? void 0 : o.CaptionLabel) !== null && n !== void 0 ? n : wt, c = d(s, { id: e.id, displayMonth: e.displayMonth }); | ||
return R("div", { className: r.caption_dropdowns, style: a.caption_dropdowns, children: [d("div", { className: r.vhidden, children: c }), d(Yn, { onChange: l, displayMonth: e.displayMonth }), d(Hn, { onChange: l, displayMonth: e.displayMonth })] }); | ||
} | ||
function $n(e) { | ||
return u("svg", g({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, e, { children: u("path", { d: "M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z", fill: "currentColor", fillRule: "nonzero" }) })); | ||
return d("svg", g({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, e, { children: d("path", { d: "M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z", fill: "currentColor", fillRule: "nonzero" }) })); | ||
} | ||
function qn(e) { | ||
return u("svg", g({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, e, { children: u("path", { d: "M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z", fill: "currentColor" }) })); | ||
return d("svg", g({ width: "16px", height: "16px", viewBox: "0 0 120 120" }, e, { children: d("path", { d: "M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z", fill: "currentColor" }) })); | ||
} | ||
var be = Vt(function(e, n) { | ||
var t = N(), r = t.classNames, a = t.styles, o = [r.button_reset, r.button]; | ||
var t = k(), r = t.classNames, a = t.styles, o = [r.button_reset, r.button]; | ||
e.className && o.push(e.className); | ||
var i = o.join(" "), l = g(g({}, a.button_reset), a.button); | ||
return e.style && Object.assign(l, e.style), u("button", g({}, e, { ref: n, type: "button", className: i, style: l })); | ||
return e.style && Object.assign(l, e.style), d("button", g({}, e, { ref: n, type: "button", className: i, style: l })); | ||
}); | ||
function Jn(e) { | ||
var n, t, r = N(), a = r.dir, o = r.locale, i = r.classNames, l = r.styles, s = r.labels, c = s.labelPrevious, d = s.labelNext, f = r.components; | ||
var n, t, r = k(), a = r.dir, o = r.locale, i = r.classNames, l = r.styles, s = r.labels, c = s.labelPrevious, u = s.labelNext, f = r.components; | ||
if (!e.nextMonth && !e.previousMonth) | ||
return u(K, {}); | ||
var m = c(e.previousMonth, { locale: o }), h = [ | ||
return d(F, {}); | ||
var h = c(e.previousMonth, { locale: o }), m = [ | ||
i.nav_button, | ||
i.nav_button_previous | ||
].join(" "), p = d(e.nextMonth, { locale: o }), _ = [ | ||
].join(" "), p = u(e.nextMonth, { locale: o }), _ = [ | ||
i.nav_button, | ||
i.nav_button_next | ||
].join(" "), b = (n = f == null ? void 0 : f.IconRight) !== null && n !== void 0 ? n : qn, k = (t = f == null ? void 0 : f.IconLeft) !== null && t !== void 0 ? t : $n; | ||
return Y("div", { className: i.nav, style: l.nav, children: [!e.hidePrevious && u(be, { name: "previous-month", "aria-label": m, className: h, style: l.nav_button_previous, disabled: !e.previousMonth, onClick: e.onPreviousClick, children: a === "rtl" ? u(b, { className: i.nav_icon, style: l.nav_icon }) : u(k, { className: i.nav_icon, style: l.nav_icon }) }), !e.hideNext && u(be, { name: "next-month", "aria-label": p, className: _, style: l.nav_button_next, disabled: !e.nextMonth, onClick: e.onNextClick, children: a === "rtl" ? u(k, { className: i.nav_icon, style: l.nav_icon }) : u(b, { className: i.nav_icon, style: l.nav_icon }) })] }); | ||
].join(" "), b = (n = f == null ? void 0 : f.IconRight) !== null && n !== void 0 ? n : qn, M = (t = f == null ? void 0 : f.IconLeft) !== null && t !== void 0 ? t : $n; | ||
return R("div", { className: i.nav, style: l.nav, children: [!e.hidePrevious && d(be, { name: "previous-month", "aria-label": h, className: m, style: l.nav_button_previous, disabled: !e.previousMonth, onClick: e.onPreviousClick, children: a === "rtl" ? d(b, { className: i.nav_icon, style: l.nav_icon }) : d(M, { className: i.nav_icon, style: l.nav_icon }) }), !e.hideNext && d(be, { name: "next-month", "aria-label": p, className: _, style: l.nav_button_next, disabled: !e.nextMonth, onClick: e.onNextClick, children: a === "rtl" ? d(M, { className: i.nav_icon, style: l.nav_icon }) : d(b, { className: i.nav_icon, style: l.nav_icon }) })] }); | ||
} | ||
function lt(e) { | ||
var n = N().numberOfMonths, t = ve(), r = t.previousMonth, a = t.nextMonth, o = t.goToMonth, i = t.displayMonths, l = i.findIndex(function(p) { | ||
var n = k().numberOfMonths, t = ve(), r = t.previousMonth, a = t.nextMonth, o = t.goToMonth, i = t.displayMonths, l = i.findIndex(function(p) { | ||
return Fe(e.displayMonth, p); | ||
}), s = l === 0, c = l === i.length - 1, d = n > 1 && (s || !c), f = n > 1 && (c || !s), m = function() { | ||
}), s = l === 0, c = l === i.length - 1, u = n > 1 && (s || !c), f = n > 1 && (c || !s), h = function() { | ||
r && o(r); | ||
}, h = function() { | ||
}, m = function() { | ||
a && o(a); | ||
}; | ||
return u(Jn, { displayMonth: e.displayMonth, hideNext: d, hidePrevious: f, nextMonth: a, previousMonth: r, onPreviousClick: m, onNextClick: h }); | ||
return d(Jn, { displayMonth: e.displayMonth, hideNext: u, hidePrevious: f, nextMonth: a, previousMonth: r, onPreviousClick: h, onNextClick: m }); | ||
} | ||
function Qn(e) { | ||
var n, t = N(), r = t.classNames, a = t.disableNavigation, o = t.styles, i = t.captionLayout, l = t.components, s = (n = l == null ? void 0 : l.CaptionLabel) !== null && n !== void 0 ? n : wt, c; | ||
return a ? c = u(s, { id: e.id, displayMonth: e.displayMonth }) : i === "dropdown" ? c = u(it, { displayMonth: e.displayMonth, id: e.id }) : i === "dropdown-buttons" ? c = Y(K, { children: [u(it, { displayMonth: e.displayMonth, displayIndex: e.displayIndex, id: e.id }), u(lt, { displayMonth: e.displayMonth, displayIndex: e.displayIndex, id: e.id })] }) : c = Y(K, { children: [u(s, { id: e.id, displayMonth: e.displayMonth, displayIndex: e.displayIndex }), u(lt, { displayMonth: e.displayMonth, id: e.id })] }), u("div", { className: r.caption, style: o.caption, children: c }); | ||
var n, t = k(), r = t.classNames, a = t.disableNavigation, o = t.styles, i = t.captionLayout, l = t.components, s = (n = l == null ? void 0 : l.CaptionLabel) !== null && n !== void 0 ? n : wt, c; | ||
return a ? c = d(s, { id: e.id, displayMonth: e.displayMonth }) : i === "dropdown" ? c = d(it, { displayMonth: e.displayMonth, id: e.id }) : i === "dropdown-buttons" ? c = R(F, { children: [d(it, { displayMonth: e.displayMonth, displayIndex: e.displayIndex, id: e.id }), d(lt, { displayMonth: e.displayMonth, displayIndex: e.displayIndex, id: e.id })] }) : c = R(F, { children: [d(s, { id: e.id, displayMonth: e.displayMonth, displayIndex: e.displayIndex }), d(lt, { displayMonth: e.displayMonth, id: e.id })] }), d("div", { className: r.caption, style: o.caption, children: c }); | ||
} | ||
function zn(e) { | ||
var n = N(), t = n.footer, r = n.styles, a = n.classNames.tfoot; | ||
return t ? u("tfoot", { className: a, style: r.tfoot, children: u("tr", { children: u("td", { colSpan: 8, children: t }) }) }) : u(K, {}); | ||
var n = k(), t = n.footer, r = n.styles, a = n.classNames.tfoot; | ||
return t ? d("tfoot", { className: a, style: r.tfoot, children: d("tr", { children: d("td", { colSpan: 8, children: t }) }) }) : d(F, {}); | ||
} | ||
@@ -384,14 +384,14 @@ function er(e, n, t) { | ||
function tr() { | ||
var e = N(), n = e.classNames, t = e.styles, r = e.showWeekNumber, a = e.locale, o = e.weekStartsOn, i = e.ISOWeek, l = e.formatters.formatWeekdayName, s = e.labels.labelWeekday, c = er(a, o, i); | ||
return Y("tr", { style: t.head_row, className: n.head_row, children: [r && u("td", { style: t.head_cell, className: n.head_cell }), c.map(function(d, f) { | ||
return u("th", { scope: "col", className: n.head_cell, style: t.head_cell, "aria-label": s(d, { locale: a }), children: l(d, { locale: a }) }, f); | ||
var e = k(), n = e.classNames, t = e.styles, r = e.showWeekNumber, a = e.locale, o = e.weekStartsOn, i = e.ISOWeek, l = e.formatters.formatWeekdayName, s = e.labels.labelWeekday, c = er(a, o, i); | ||
return R("tr", { style: t.head_row, className: n.head_row, children: [r && d("td", { style: t.head_cell, className: n.head_cell }), c.map(function(u, f) { | ||
return d("th", { scope: "col", className: n.head_cell, style: t.head_cell, "aria-label": s(u, { locale: a }), children: l(u, { locale: a }) }, f); | ||
})] }); | ||
} | ||
function nr() { | ||
var e, n = N(), t = n.classNames, r = n.styles, a = n.components, o = (e = a == null ? void 0 : a.HeadRow) !== null && e !== void 0 ? e : tr; | ||
return u("thead", { style: r.head, className: t.head, children: u(o, {}) }); | ||
var e, n = k(), t = n.classNames, r = n.styles, a = n.components, o = (e = a == null ? void 0 : a.HeadRow) !== null && e !== void 0 ? e : tr; | ||
return d("thead", { style: r.head, className: t.head, children: d(o, {}) }); | ||
} | ||
function rr(e) { | ||
var n = N(), t = n.locale, r = n.formatters.formatDay; | ||
return u(K, { children: r(e.date, { locale: t }) }); | ||
var n = k(), t = n.locale, r = n.formatters.formatDay; | ||
return d(F, { children: r(e.date, { locale: t }) }); | ||
} | ||
@@ -407,23 +407,23 @@ var je = J(void 0); | ||
}; | ||
return u(je.Provider, { value: n, children: e.children }); | ||
return d(je.Provider, { value: n, children: e.children }); | ||
} | ||
return u(or, { initialProps: e.initialProps, children: e.children }); | ||
return d(or, { initialProps: e.initialProps, children: e.children }); | ||
} | ||
function or(e) { | ||
var n = e.initialProps, t = e.children, r = n.selected, a = n.min, o = n.max, i = function(c, d, f) { | ||
var m, h; | ||
(m = n.onDayClick) === null || m === void 0 || m.call(n, c, d, f); | ||
var p = !!(d.selected && a && (r == null ? void 0 : r.length) === a); | ||
var n = e.initialProps, t = e.children, r = n.selected, a = n.min, o = n.max, i = function(c, u, f) { | ||
var h, m; | ||
(h = n.onDayClick) === null || h === void 0 || h.call(n, c, u, f); | ||
var p = !!(u.selected && a && (r == null ? void 0 : r.length) === a); | ||
if (!p) { | ||
var _ = !!(!d.selected && o && (r == null ? void 0 : r.length) === o); | ||
var _ = !!(!u.selected && o && (r == null ? void 0 : r.length) === o); | ||
if (!_) { | ||
var b = r ? gt([], r) : []; | ||
if (d.selected) { | ||
var k = b.findIndex(function(D) { | ||
return P(c, D); | ||
if (u.selected) { | ||
var M = b.findIndex(function(D) { | ||
return C(c, D); | ||
}); | ||
b.splice(k, 1); | ||
b.splice(M, 1); | ||
} else | ||
b.push(c); | ||
(h = n.onSelect) === null || h === void 0 || h.call(n, b, c, d, f); | ||
(m = n.onSelect) === null || m === void 0 || m.call(n, b, c, u, f); | ||
} | ||
@@ -435,6 +435,6 @@ } | ||
r && l.disabled.push(function(c) { | ||
var d = o && r.length > o - 1, f = r.some(function(m) { | ||
return P(m, c); | ||
var u = o && r.length > o - 1, f = r.some(function(h) { | ||
return C(h, c); | ||
}); | ||
return !!(d && !f); | ||
return !!(u && !f); | ||
}); | ||
@@ -446,3 +446,3 @@ var s = { | ||
}; | ||
return u(je.Provider, { value: s, children: t }); | ||
return d(je.Provider, { value: s, children: t }); | ||
} | ||
@@ -457,3 +457,3 @@ function Ve() { | ||
var t = n || {}, r = t.from, a = t.to; | ||
return r && a ? P(a, e) && P(r, e) ? void 0 : P(a, e) ? { from: a, to: void 0 } : P(r, e) ? void 0 : ye(r, e) ? { from: e, to: a } : { from: r, to: e } : a ? ye(e, a) ? { from: a, to: e } : { from: e, to: a } : r ? Ae(e, r) ? { from: e, to: r } : { from: r, to: e } : { from: e, to: void 0 }; | ||
return r && a ? C(a, e) && C(r, e) ? void 0 : C(a, e) ? { from: a, to: void 0 } : C(r, e) ? void 0 : ye(r, e) ? { from: e, to: a } : { from: r, to: e } : a ? ye(e, a) ? { from: a, to: e } : { from: e, to: a } : r ? Ae(e, r) ? { from: e, to: r } : { from: r, to: e } : { from: e, to: void 0 }; | ||
} | ||
@@ -472,13 +472,13 @@ var Ke = J(void 0); | ||
}; | ||
return u(Ke.Provider, { value: n, children: e.children }); | ||
return d(Ke.Provider, { value: n, children: e.children }); | ||
} | ||
return u(sr, { initialProps: e.initialProps, children: e.children }); | ||
return d(sr, { initialProps: e.initialProps, children: e.children }); | ||
} | ||
function sr(e) { | ||
var n = e.initialProps, t = e.children, r = n.selected, a = r || {}, o = a.from, i = a.to, l = n.min, s = n.max, c = function(h, p, _) { | ||
var b, k; | ||
(b = n.onDayClick) === null || b === void 0 || b.call(n, h, p, _); | ||
var D = ir(h, r); | ||
(k = n.onSelect) === null || k === void 0 || k.call(n, D, h, p, _); | ||
}, d = { | ||
var n = e.initialProps, t = e.children, r = n.selected, a = r || {}, o = a.from, i = a.to, l = n.min, s = n.max, c = function(m, p, _) { | ||
var b, M; | ||
(b = n.onDayClick) === null || b === void 0 || b.call(n, m, p, _); | ||
var D = ir(m, r); | ||
(M = n.onSelect) === null || M === void 0 || M.call(n, D, m, p, _); | ||
}, u = { | ||
range_start: [], | ||
@@ -489,3 +489,3 @@ range_end: [], | ||
}; | ||
if (o ? (d.range_start = [o], i ? (d.range_end = [i], P(o, i) || (d.range_middle = [ | ||
if (o ? (u.range_start = [o], i ? (u.range_end = [i], C(o, i) || (u.range_middle = [ | ||
{ | ||
@@ -495,31 +495,31 @@ after: o, | ||
} | ||
])) : d.range_end = [o]) : i && (d.range_start = [i], d.range_end = [i]), l && (o && !i && d.disabled.push({ | ||
])) : u.range_end = [o]) : i && (u.range_start = [i], u.range_end = [i]), l && (o && !i && u.disabled.push({ | ||
after: Ne(o, l - 1), | ||
before: L(o, l - 1) | ||
}), o && i && d.disabled.push({ | ||
}), o && i && u.disabled.push({ | ||
after: o, | ||
before: L(o, l - 1) | ||
}), !o && i && d.disabled.push({ | ||
}), !o && i && u.disabled.push({ | ||
after: Ne(i, l - 1), | ||
before: L(i, l - 1) | ||
})), s) { | ||
if (o && !i && (d.disabled.push({ | ||
if (o && !i && (u.disabled.push({ | ||
before: L(o, -s + 1) | ||
}), d.disabled.push({ | ||
}), u.disabled.push({ | ||
after: L(o, s - 1) | ||
})), o && i) { | ||
var f = j(i, o) + 1, m = s - f; | ||
d.disabled.push({ | ||
before: Ne(o, m) | ||
}), d.disabled.push({ | ||
after: L(i, m) | ||
var f = j(i, o) + 1, h = s - f; | ||
u.disabled.push({ | ||
before: Ne(o, h) | ||
}), u.disabled.push({ | ||
after: L(i, h) | ||
}); | ||
} | ||
!o && i && (d.disabled.push({ | ||
!o && i && (u.disabled.push({ | ||
before: L(i, -s + 1) | ||
}), d.disabled.push({ | ||
}), u.disabled.push({ | ||
after: L(i, s - 1) | ||
})); | ||
} | ||
return u(Ke.Provider, { value: { selected: r, onDayClick: c, modifiers: d }, children: t }); | ||
return d(Ke.Provider, { value: { selected: r, onDayClick: c, modifiers: u }, children: t }); | ||
} | ||
@@ -542,8 +542,8 @@ function Ue() { | ||
} | ||
var F; | ||
var A; | ||
(function(e) { | ||
e.Outside = "outside", e.Disabled = "disabled", e.Selected = "selected", e.Hidden = "hidden", e.Today = "today", e.RangeStart = "range_start", e.RangeEnd = "range_end", e.RangeMiddle = "range_middle"; | ||
})(F || (F = {})); | ||
var ur = F.Selected, H = F.Disabled, cr = F.Hidden, fr = F.Today, Pe = F.RangeEnd, xe = F.RangeMiddle, Ie = F.RangeStart, vr = F.Outside; | ||
function mr(e, n, t) { | ||
})(A || (A = {})); | ||
var ur = A.Selected, H = A.Disabled, cr = A.Hidden, fr = A.Today, Pe = A.RangeEnd, xe = A.RangeMiddle, Ie = A.RangeStart, vr = A.Outside; | ||
function hr(e, n, t) { | ||
var r, a = (r = {}, r[ur] = pe(e.selected), r[H] = pe(e.disabled), r[cr] = pe(e.hidden), r[fr] = [e.today], r[Pe] = [], r[xe] = [], r[Ie] = [], r[vr] = [], r); | ||
@@ -553,5 +553,5 @@ return e.fromDate && a[H].push({ before: e.fromDate }), e.toDate && a[H].push({ after: e.toDate }), ce(e) ? a[H] = a[H].concat(n.modifiers[H]) : fe(e) && (a[H] = a[H].concat(t.modifiers[H]), a[Ie] = t.modifiers[Ie], a[xe] = t.modifiers[xe], a[Pe] = t.modifiers[Pe]), a; | ||
var kt = J(void 0); | ||
function hr(e) { | ||
var n = N(), t = Ve(), r = Ue(), a = mr(n, t, r), o = dr(n.modifiers), i = g(g({}, a), o); | ||
return u(kt.Provider, { value: i, children: e.children }); | ||
function mr(e) { | ||
var n = k(), t = Ve(), r = Ue(), a = hr(n, t, r), o = dr(n.modifiers), i = g(g({}, a), o); | ||
return d(kt.Provider, { value: i, children: e.children }); | ||
} | ||
@@ -587,9 +587,9 @@ function Nt() { | ||
} | ||
return a ? P(a, e) : r ? P(r, e) : !1; | ||
return a ? C(a, e) : r ? C(r, e) : !1; | ||
} | ||
function Dr(e) { | ||
return ht(e); | ||
return mt(e); | ||
} | ||
function Mr(e) { | ||
return Array.isArray(e) && e.every(ht); | ||
return Array.isArray(e) && e.every(mt); | ||
} | ||
@@ -601,3 +601,3 @@ function kr(e, n) { | ||
if (Dr(t)) | ||
return P(e, t); | ||
return C(e, t); | ||
if (Mr(t)) | ||
@@ -626,3 +626,3 @@ return t.includes(e); | ||
function Nr(e, n) { | ||
for (var t = R(e[0]), r = Te(e[e.length - 1]), a, o, i = t; i <= r; ) { | ||
for (var t = E(e[0]), r = Te(e[e.length - 1]), a, o, i = t; i <= r; ) { | ||
var l = Xe(i, n), s = !l.disabled && !l.hidden; | ||
@@ -641,6 +641,6 @@ if (!s) { | ||
function Ct(e, n) { | ||
var t = n.moveBy, r = n.direction, a = n.context, o = n.modifiers, i = n.retry, l = i === void 0 ? { count: 0, lastFocused: e } : i, s = a.weekStartsOn, c = a.fromDate, d = a.toDate, f = a.locale, m = { | ||
var t = n.moveBy, r = n.direction, a = n.context, o = n.modifiers, i = n.retry, l = i === void 0 ? { count: 0, lastFocused: e } : i, s = a.weekStartsOn, c = a.fromDate, u = a.toDate, f = a.locale, h = { | ||
day: L, | ||
week: Se, | ||
month: A, | ||
week: Le, | ||
month: Y, | ||
year: zt, | ||
@@ -651,12 +651,12 @@ startOfWeek: function(b) { | ||
endOfWeek: function(b) { | ||
return a.ISOWeek ? vt(b) : mt(b, { locale: f, weekStartsOn: s }); | ||
return a.ISOWeek ? vt(b) : ht(b, { locale: f, weekStartsOn: s }); | ||
} | ||
}, h = m[t](e, r === "after" ? 1 : -1); | ||
r === "before" && c ? h = $t([c, h]) : r === "after" && d && (h = qt([d, h])); | ||
}, m = h[t](e, r === "after" ? 1 : -1); | ||
r === "before" && c ? m = $t([c, m]) : r === "after" && u && (m = qt([u, m])); | ||
var p = !0; | ||
if (o) { | ||
var _ = Xe(h, o); | ||
var _ = Xe(m, o); | ||
p = !_.disabled && !_.hidden; | ||
} | ||
return p ? h : l.count > Cr ? l.lastFocused : Ct(h, { | ||
return p ? m : l.count > Cr ? l.lastFocused : Ct(m, { | ||
moveBy: t, | ||
@@ -671,21 +671,21 @@ direction: r, | ||
function Pr(e) { | ||
var n = ve(), t = Nt(), r = T(), a = r[0], o = r[1], i = T(), l = i[0], s = i[1], c = Nr(n.displayMonths, t), d = a ?? (l && n.isDateDisplayed(l)) ? l : c, f = function() { | ||
var n = ve(), t = Nt(), r = T(), a = r[0], o = r[1], i = T(), l = i[0], s = i[1], c = Nr(n.displayMonths, t), u = a ?? (l && n.isDateDisplayed(l)) ? l : c, f = function() { | ||
s(a), o(void 0); | ||
}, m = function(b) { | ||
}, h = function(b) { | ||
o(b); | ||
}, h = N(), p = function(b, k) { | ||
}, m = k(), p = function(b, M) { | ||
if (a) { | ||
var D = Ct(a, { | ||
moveBy: b, | ||
direction: k, | ||
context: h, | ||
direction: M, | ||
context: m, | ||
modifiers: t | ||
}); | ||
P(a, D) || (n.goToDate(D, a), m(D)); | ||
C(a, D) || (n.goToDate(D, a), h(D)); | ||
} | ||
}, _ = { | ||
focusedDay: a, | ||
focusTarget: d, | ||
focusTarget: u, | ||
blur: f, | ||
focus: m, | ||
focus: h, | ||
focusDayAfter: function() { | ||
@@ -722,3 +722,3 @@ return p("day", "after"); | ||
}; | ||
return u(Pt.Provider, { value: _, children: e.children }); | ||
return d(Pt.Provider, { value: _, children: e.children }); | ||
} | ||
@@ -741,9 +741,9 @@ function Ze() { | ||
}; | ||
return u(Ge.Provider, { value: n, children: e.children }); | ||
return d(Ge.Provider, { value: n, children: e.children }); | ||
} | ||
return u(Or, { initialProps: e.initialProps, children: e.children }); | ||
return d(Or, { initialProps: e.initialProps, children: e.children }); | ||
} | ||
function Or(e) { | ||
var n = e.initialProps, t = e.children, r = function(o, i, l) { | ||
var s, c, d; | ||
var s, c, u; | ||
if ((s = n.onDayClick) === null || s === void 0 || s.call(n, o, i, l), i.selected && !n.required) { | ||
@@ -753,3 +753,3 @@ (c = n.onSelect) === null || c === void 0 || c.call(n, void 0, o, i, l); | ||
} | ||
(d = n.onSelect) === null || d === void 0 || d.call(n, o, o, i, l); | ||
(u = n.onSelect) === null || u === void 0 || u.call(n, o, o, i, l); | ||
}, a = { | ||
@@ -759,3 +759,3 @@ selected: n.selected, | ||
}; | ||
return u(Ge.Provider, { value: a, children: t }); | ||
return d(Ge.Provider, { value: a, children: t }); | ||
} | ||
@@ -769,12 +769,12 @@ function xt() { | ||
function Wr(e, n) { | ||
var t = N(), r = xt(), a = Ve(), o = Ue(), i = Ze(), l = i.focusDayAfter, s = i.focusDayBefore, c = i.focusWeekAfter, d = i.focusWeekBefore, f = i.blur, m = i.focus, h = i.focusMonthBefore, p = i.focusMonthAfter, _ = i.focusYearBefore, b = i.focusYearAfter, k = i.focusStartOfWeek, D = i.focusEndOfWeek, W = function(y) { | ||
var t = k(), r = xt(), a = Ve(), o = Ue(), i = Ze(), l = i.focusDayAfter, s = i.focusDayBefore, c = i.focusWeekAfter, u = i.focusWeekBefore, f = i.blur, h = i.focus, m = i.focusMonthBefore, p = i.focusMonthAfter, _ = i.focusYearBefore, b = i.focusYearAfter, M = i.focusStartOfWeek, D = i.focusEndOfWeek, O = function(y) { | ||
var v, $, ne, oe; | ||
ge(t) ? (v = r.onDayClick) === null || v === void 0 || v.call(r, e, n, y) : ce(t) ? ($ = a.onDayClick) === null || $ === void 0 || $.call(a, e, n, y) : fe(t) ? (ne = o.onDayClick) === null || ne === void 0 || ne.call(o, e, n, y) : (oe = t.onDayClick) === null || oe === void 0 || oe.call(t, e, n, y); | ||
}, U = function(y) { | ||
}, Z = function(y) { | ||
var v; | ||
m(e), (v = t.onDayFocus) === null || v === void 0 || v.call(t, e, n, y); | ||
}, C = function(y) { | ||
h(e), (v = t.onDayFocus) === null || v === void 0 || v.call(t, e, n, y); | ||
}, N = function(y) { | ||
var v; | ||
f(), (v = t.onDayBlur) === null || v === void 0 || v.call(t, e, n, y); | ||
}, x = function(y) { | ||
}, P = function(y) { | ||
var v; | ||
@@ -791,6 +791,6 @@ (v = t.onDayMouseEnter) === null || v === void 0 || v.call(t, e, n, y); | ||
(v = t.onDayPointerLeave) === null || v === void 0 || v.call(t, e, n, y); | ||
}, me = function(y) { | ||
}, he = function(y) { | ||
var v; | ||
(v = t.onDayTouchCancel) === null || v === void 0 || v.call(t, e, n, y); | ||
}, X = function(y) { | ||
}, K = function(y) { | ||
var v; | ||
@@ -820,6 +820,6 @@ (v = t.onDayTouchEnd) === null || v === void 0 || v.call(t, e, n, y); | ||
case "ArrowUp": | ||
y.preventDefault(), y.stopPropagation(), d(); | ||
y.preventDefault(), y.stopPropagation(), u(); | ||
break; | ||
case "PageUp": | ||
y.preventDefault(), y.stopPropagation(), y.shiftKey ? _() : h(); | ||
y.preventDefault(), y.stopPropagation(), y.shiftKey ? _() : m(); | ||
break; | ||
@@ -830,3 +830,3 @@ case "PageDown": | ||
case "Home": | ||
y.preventDefault(), y.stopPropagation(), k(); | ||
y.preventDefault(), y.stopPropagation(), M(); | ||
break; | ||
@@ -839,13 +839,13 @@ case "End": | ||
}, te = { | ||
onClick: W, | ||
onFocus: U, | ||
onBlur: C, | ||
onClick: O, | ||
onFocus: Z, | ||
onBlur: N, | ||
onKeyDown: Me, | ||
onKeyUp: ee, | ||
onMouseEnter: x, | ||
onMouseEnter: P, | ||
onMouseLeave: ae, | ||
onPointerEnter: z, | ||
onPointerLeave: we, | ||
onTouchCancel: me, | ||
onTouchEnd: X, | ||
onTouchCancel: he, | ||
onTouchEnd: K, | ||
onTouchMove: G, | ||
@@ -856,10 +856,10 @@ onTouchStart: De | ||
} | ||
function Er() { | ||
var e = N(), n = xt(), t = Ve(), r = Ue(), a = ge(e) ? n.selected : ce(e) ? t.selected : fe(e) ? r.selected : void 0; | ||
function Sr() { | ||
var e = k(), n = xt(), t = Ve(), r = Ue(), a = ge(e) ? n.selected : ce(e) ? t.selected : fe(e) ? r.selected : void 0; | ||
return a; | ||
} | ||
function Sr(e) { | ||
return Object.values(F).includes(e); | ||
function Lr(e) { | ||
return Object.values(A).includes(e); | ||
} | ||
function Lr(e, n) { | ||
function Er(e, n) { | ||
var t = [e.classNames.day]; | ||
@@ -870,3 +870,3 @@ return Object.keys(n).forEach(function(r) { | ||
t.push(a); | ||
else if (Sr(r)) { | ||
else if (Lr(r)) { | ||
var o = e.classNames["day_".concat(r)]; | ||
@@ -885,6 +885,6 @@ o && t.push(o); | ||
function Br(e, n, t) { | ||
var r, a, o, i = N(), l = Ze(), s = xr(e, n), c = Wr(e, s), d = Er(), f = !!(i.onDayClick || i.mode !== "default"); | ||
var r, a, o, i = k(), l = Ze(), s = xr(e, n), c = Wr(e, s), u = Sr(), f = !!(i.onDayClick || i.mode !== "default"); | ||
q(function() { | ||
var x; | ||
s.outside || l.focusedDay && f && P(l.focusedDay, e) && ((x = t.current) === null || x === void 0 || x.focus()); | ||
var P; | ||
s.outside || l.focusedDay && f && C(l.focusedDay, e) && ((P = t.current) === null || P === void 0 || P.focus()); | ||
}, [ | ||
@@ -897,46 +897,46 @@ l.focusedDay, | ||
]); | ||
var m = Lr(i, s).join(" "), h = Rr(i, s), p = !!(s.outside && !i.showOutsideDays || s.hidden), _ = (o = (a = i.components) === null || a === void 0 ? void 0 : a.DayContent) !== null && o !== void 0 ? o : rr, b = u(_, { date: e, displayMonth: n, activeModifiers: s }), k = { | ||
style: h, | ||
className: m, | ||
var h = Er(i, s).join(" "), m = Rr(i, s), p = !!(s.outside && !i.showOutsideDays || s.hidden), _ = (o = (a = i.components) === null || a === void 0 ? void 0 : a.DayContent) !== null && o !== void 0 ? o : rr, b = d(_, { date: e, displayMonth: n, activeModifiers: s }), M = { | ||
style: m, | ||
className: h, | ||
children: b, | ||
role: "gridcell" | ||
}, D = l.focusTarget && P(l.focusTarget, e) && !s.outside, W = l.focusedDay && P(l.focusedDay, e), U = g(g(g({}, k), (r = { disabled: s.disabled, role: "gridcell" }, r["aria-selected"] = s.selected, r.tabIndex = W || D ? 0 : -1, r)), c), C = { | ||
}, D = l.focusTarget && C(l.focusTarget, e) && !s.outside, O = l.focusedDay && C(l.focusedDay, e), Z = g(g(g({}, M), (r = { disabled: s.disabled, role: "gridcell" }, r["aria-selected"] = s.selected, r.tabIndex = O || D ? 0 : -1, r)), c), N = { | ||
isButton: f, | ||
isHidden: p, | ||
activeModifiers: s, | ||
selectedDays: d, | ||
buttonProps: U, | ||
divProps: k | ||
selectedDays: u, | ||
buttonProps: Z, | ||
divProps: M | ||
}; | ||
return C; | ||
return N; | ||
} | ||
function Tr(e) { | ||
var n = re(null), t = Br(e.date, e.displayMonth, n); | ||
return t.isHidden ? u("div", { role: "gridcell" }) : t.isButton ? u(be, g({ name: "day", ref: n }, t.buttonProps)) : u("div", g({}, t.divProps)); | ||
return t.isHidden ? d("div", { role: "gridcell" }) : t.isButton ? d(be, g({ name: "day", ref: n }, t.buttonProps)) : d("div", g({}, t.divProps)); | ||
} | ||
function Fr(e) { | ||
var n = e.number, t = e.dates, r = N(), a = r.onWeekNumberClick, o = r.styles, i = r.classNames, l = r.locale, s = r.labels.labelWeekNumber, c = r.formatters.formatWeekNumber, d = c(Number(n), { locale: l }); | ||
var n = e.number, t = e.dates, r = k(), a = r.onWeekNumberClick, o = r.styles, i = r.classNames, l = r.locale, s = r.labels.labelWeekNumber, c = r.formatters.formatWeekNumber, u = c(Number(n), { locale: l }); | ||
if (!a) | ||
return u("span", { className: i.weeknumber, style: o.weeknumber, children: d }); | ||
var f = s(Number(n), { locale: l }), m = function(h) { | ||
a(n, t, h); | ||
return d("span", { className: i.weeknumber, style: o.weeknumber, children: u }); | ||
var f = s(Number(n), { locale: l }), h = function(m) { | ||
a(n, t, m); | ||
}; | ||
return u(be, { name: "week-number", "aria-label": f, className: i.weeknumber, style: o.weeknumber, onClick: m, children: d }); | ||
return d(be, { name: "week-number", "aria-label": f, className: i.weeknumber, style: o.weeknumber, onClick: h, children: u }); | ||
} | ||
function Ar(e) { | ||
var n, t, r = N(), a = r.styles, o = r.classNames, i = r.showWeekNumber, l = r.components, s = (n = l == null ? void 0 : l.Day) !== null && n !== void 0 ? n : Tr, c = (t = l == null ? void 0 : l.WeekNumber) !== null && t !== void 0 ? t : Fr, d; | ||
return i && (d = u("td", { className: o.cell, style: a.cell, children: u(c, { number: e.weekNumber, dates: e.dates }) })), Y("tr", { className: o.row, style: a.row, children: [d, e.dates.map(function(f) { | ||
return u("td", { className: o.cell, style: a.cell, role: "presentation", children: u(s, { displayMonth: e.displayMonth, date: f }) }, Ut(f)); | ||
var n, t, r = k(), a = r.styles, o = r.classNames, i = r.showWeekNumber, l = r.components, s = (n = l == null ? void 0 : l.Day) !== null && n !== void 0 ? n : Tr, c = (t = l == null ? void 0 : l.WeekNumber) !== null && t !== void 0 ? t : Fr, u; | ||
return i && (u = d("td", { className: o.cell, style: a.cell, children: d(c, { number: e.weekNumber, dates: e.dates }) })), R("tr", { className: o.row, style: a.row, children: [u, e.dates.map(function(f) { | ||
return d("td", { className: o.cell, style: a.cell, role: "presentation", children: d(s, { displayMonth: e.displayMonth, date: f }) }, Ut(f)); | ||
})] }); | ||
} | ||
function st(e, n, t) { | ||
for (var r = t != null && t.ISOWeek ? vt(n) : mt(n, t), a = t != null && t.ISOWeek ? Ye(e) : He(e, t), o = j(r, a), i = [], l = 0; l <= o; l++) | ||
for (var r = t != null && t.ISOWeek ? vt(n) : ht(n, t), a = t != null && t.ISOWeek ? Ye(e) : He(e, t), o = j(r, a), i = [], l = 0; l <= o; l++) | ||
i.push(L(a, l)); | ||
var s = i.reduce(function(c, d) { | ||
var f = t != null && t.ISOWeek ? Jt(d) : Qt(d, t), m = c.find(function(h) { | ||
return h.weekNumber === f; | ||
var s = i.reduce(function(c, u) { | ||
var f = t != null && t.ISOWeek ? Jt(u) : Qt(u, t), h = c.find(function(m) { | ||
return m.weekNumber === f; | ||
}); | ||
return m ? (m.dates.push(d), c) : (c.push({ | ||
return h ? (h.dates.push(u), c) : (c.push({ | ||
weekNumber: f, | ||
dates: [d] | ||
dates: [u] | ||
}), c); | ||
@@ -947,7 +947,7 @@ }, []); | ||
function Yr(e, n) { | ||
var t = st(R(e), Te(e), n); | ||
var t = st(E(e), Te(e), n); | ||
if (n != null && n.useFixedWeeks) { | ||
var r = Xt(e, n); | ||
if (r < 6) { | ||
var a = t[t.length - 1], o = a.dates[a.dates.length - 1], i = Se(o, 6 - r), l = st(Se(o, 1), i, n); | ||
var a = t[t.length - 1], o = a.dates[a.dates.length - 1], i = Le(o, 6 - r), l = st(Le(o, 1), i, n); | ||
t.push.apply(t, l); | ||
@@ -959,12 +959,12 @@ } | ||
function Hr(e) { | ||
var n, t, r, a = N(), o = a.locale, i = a.classNames, l = a.styles, s = a.hideHead, c = a.fixedWeeks, d = a.components, f = a.weekStartsOn, m = a.firstWeekContainsDate, h = a.ISOWeek, p = Yr(e.displayMonth, { | ||
var n, t, r, a = k(), o = a.locale, i = a.classNames, l = a.styles, s = a.hideHead, c = a.fixedWeeks, u = a.components, f = a.weekStartsOn, h = a.firstWeekContainsDate, m = a.ISOWeek, p = Yr(e.displayMonth, { | ||
useFixedWeeks: !!c, | ||
ISOWeek: h, | ||
ISOWeek: m, | ||
locale: o, | ||
weekStartsOn: f, | ||
firstWeekContainsDate: m | ||
}), _ = (n = d == null ? void 0 : d.Head) !== null && n !== void 0 ? n : nr, b = (t = d == null ? void 0 : d.Row) !== null && t !== void 0 ? t : Ar, k = (r = d == null ? void 0 : d.Footer) !== null && r !== void 0 ? r : zn; | ||
return Y("table", { id: e.id, className: i.table, style: l.table, role: "grid", "aria-labelledby": e["aria-labelledby"], children: [!s && u(_, {}), u("tbody", { className: i.tbody, style: l.tbody, children: p.map(function(D) { | ||
return u(b, { displayMonth: e.displayMonth, dates: D.dates, weekNumber: D.weekNumber }, D.weekNumber); | ||
}) }), u(k, { displayMonth: e.displayMonth })] }); | ||
firstWeekContainsDate: h | ||
}), _ = (n = u == null ? void 0 : u.Head) !== null && n !== void 0 ? n : nr, b = (t = u == null ? void 0 : u.Row) !== null && t !== void 0 ? t : Ar, M = (r = u == null ? void 0 : u.Footer) !== null && r !== void 0 ? r : zn; | ||
return R("table", { id: e.id, className: i.table, style: l.table, role: "grid", "aria-labelledby": e["aria-labelledby"], children: [!s && d(_, {}), d("tbody", { className: i.tbody, style: l.tbody, children: p.map(function(D) { | ||
return d(b, { displayMonth: e.displayMonth, dates: D.dates, weekNumber: D.weekNumber }, D.weekNumber); | ||
}) }), d(M, { displayMonth: e.displayMonth })] }); | ||
} | ||
@@ -987,13 +987,13 @@ function jr() { | ||
function Xr(e) { | ||
var n, t, r = N(), a = r.dir, o = r.classNames, i = r.styles, l = r.components, s = ve().displayMonths, c = Ur(r.id ? "".concat(r.id, "-").concat(e.displayIndex) : void 0), d = r.id ? "".concat(r.id, "-grid-").concat(e.displayIndex) : void 0, f = [o.month], m = i.month, h = e.displayIndex === 0, p = e.displayIndex === s.length - 1, _ = !h && !p; | ||
a === "rtl" && (n = [h, p], p = n[0], h = n[1]), h && (f.push(o.caption_start), m = g(g({}, m), i.caption_start)), p && (f.push(o.caption_end), m = g(g({}, m), i.caption_end)), _ && (f.push(o.caption_between), m = g(g({}, m), i.caption_between)); | ||
var n, t, r = k(), a = r.dir, o = r.classNames, i = r.styles, l = r.components, s = ve().displayMonths, c = Ur(r.id ? "".concat(r.id, "-").concat(e.displayIndex) : void 0), u = r.id ? "".concat(r.id, "-grid-").concat(e.displayIndex) : void 0, f = [o.month], h = i.month, m = e.displayIndex === 0, p = e.displayIndex === s.length - 1, _ = !m && !p; | ||
a === "rtl" && (n = [m, p], p = n[0], m = n[1]), m && (f.push(o.caption_start), h = g(g({}, h), i.caption_start)), p && (f.push(o.caption_end), h = g(g({}, h), i.caption_end)), _ && (f.push(o.caption_between), h = g(g({}, h), i.caption_between)); | ||
var b = (t = l == null ? void 0 : l.Caption) !== null && t !== void 0 ? t : Qn; | ||
return Y("div", { className: f.join(" "), style: m, children: [u(b, { id: c, displayMonth: e.displayMonth, displayIndex: e.displayIndex }), u(Hr, { id: d, "aria-labelledby": c, displayMonth: e.displayMonth })] }, e.displayIndex); | ||
return R("div", { className: f.join(" "), style: h, children: [d(b, { id: c, displayMonth: e.displayMonth, displayIndex: e.displayIndex }), d(Hr, { id: u, "aria-labelledby": c, displayMonth: e.displayMonth })] }, e.displayIndex); | ||
} | ||
function Zr(e) { | ||
var n = N(), t = n.classNames, r = n.styles; | ||
return u("div", { className: t.months, style: r.months, children: e.children }); | ||
var n = k(), t = n.classNames, r = n.styles; | ||
return d("div", { className: t.months, style: r.months, children: e.children }); | ||
} | ||
function Gr(e) { | ||
var n, t, r = e.initialProps, a = N(), o = Ze(), i = ve(), l = T(!1), s = l[0], c = l[1]; | ||
var n, t, r = e.initialProps, a = k(), o = Ze(), i = ve(), l = T(!1), s = l[0], c = l[1]; | ||
q(function() { | ||
@@ -1008,5 +1008,5 @@ a.initialFocus && o.focusTarget && (s || (o.focus(o.focusTarget), c(!0))); | ||
]); | ||
var d = [a.classNames.root, a.className]; | ||
a.numberOfMonths > 1 && d.push(a.classNames.multiple_months), a.showWeekNumber && d.push(a.classNames.with_weeknumber); | ||
var f = g(g({}, a.styles.root), a.style), m = Object.keys(r).filter(function(p) { | ||
var u = [a.classNames.root, a.className]; | ||
a.numberOfMonths > 1 && u.push(a.classNames.multiple_months), a.showWeekNumber && u.push(a.classNames.with_weeknumber); | ||
var f = g(g({}, a.styles.root), a.style), h = Object.keys(r).filter(function(p) { | ||
return p.startsWith("data-"); | ||
@@ -1016,5 +1016,5 @@ }).reduce(function(p, _) { | ||
return g(g({}, p), (b = {}, b[_] = r[_], b)); | ||
}, {}), h = (t = (n = r.components) === null || n === void 0 ? void 0 : n.Months) !== null && t !== void 0 ? t : Zr; | ||
return u("div", g({ className: d.join(" "), style: f, dir: a.dir, id: a.id, nonce: r.nonce, title: r.title, lang: r.lang }, m, { children: u(h, { children: i.displayMonths.map(function(p, _) { | ||
return u(Xr, { displayIndex: _, displayMonth: p }, _); | ||
}, {}), m = (t = (n = r.components) === null || n === void 0 ? void 0 : n.Months) !== null && t !== void 0 ? t : Zr; | ||
return d("div", g({ className: u.join(" "), style: f, dir: a.dir, id: a.id, nonce: r.nonce, title: r.title, lang: r.lang }, h, { children: d(m, { children: i.displayMonths.map(function(p, _) { | ||
return d(Xr, { displayIndex: _, displayMonth: p }, _); | ||
}) }) })); | ||
@@ -1024,8 +1024,8 @@ } | ||
var n = e.children, t = gn(e, ["children"]); | ||
return u(Fn, { initialProps: t, children: u(Gn, { children: u(Ir, { initialProps: t, children: u(ar, { initialProps: t, children: u(lr, { initialProps: t, children: u(hr, { children: u(Pr, { children: n }) }) }) }) }) }) }); | ||
return d(Fn, { initialProps: t, children: d(Gn, { children: d(Ir, { initialProps: t, children: d(ar, { initialProps: t, children: d(lr, { initialProps: t, children: d(mr, { children: d(Pr, { children: n }) }) }) }) }) }) }); | ||
} | ||
function qr(e) { | ||
return u($r, g({}, e, { children: u(Gr, { initialProps: e }) })); | ||
return d($r, g({}, e, { children: d(Gr, { initialProps: e }) })); | ||
} | ||
const Jr = 329, Z = 12, _e = 26, It = 20, Be = 9, ut = 12, Ot = (e, n) => e.top > n.height + _e ? V.positionabove : V.positionbelow, Qr = (e) => e.left + e.width / 4, zr = (e) => document.documentElement.clientWidth - e.right + e.width / 4, ea = (e, n) => e.left + n.width, ta = (e) => e.left > Z, na = (e, n) => ea(e, n) < document.documentElement.clientWidth - Z, ra = (e, n) => na(e, n) ? ta(e) ? "floating" : "left" : "right", We = (e, n) => e.top - _e - n.height, Ee = (e) => e.bottom + _e, aa = () => document.documentElement.clientWidth - Z * 2, oa = () => document.documentElement.clientWidth > Jr + Z * 2, ct = (e) => e.top - _e - Be + 5, ia = (e) => Qr(e) - It / 2, la = (e) => zr(e) - It / 2, sa = (e, n) => { | ||
const Jr = 329, X = 12, _e = 26, It = 20, Be = 9, ut = 12, Ot = (e, n) => e.top > n.height + _e ? V.positionabove : V.positionbelow, Qr = (e) => e.left + e.width / 4, zr = (e) => document.documentElement.clientWidth - e.right + e.width / 4, ea = (e, n) => e.left + n.width, ta = (e) => e.left > X, na = (e, n) => ea(e, n) < document.documentElement.clientWidth - X, ra = (e, n) => na(e, n) ? ta(e) ? "floating" : "left" : "right", We = (e, n) => e.top - _e - n.height, Se = (e) => e.bottom + _e, aa = () => document.documentElement.clientWidth - X * 2, oa = () => document.documentElement.clientWidth > Jr + X * 2, ct = (e) => e.top - _e - Be + 5, ia = (e) => Qr(e) - It / 2, la = (e) => zr(e) - It / 2, sa = (e, n) => { | ||
const t = ra(e, n), r = Ot(e, n); | ||
@@ -1036,6 +1036,6 @@ return t === "left" ? r === V.positionabove ? "leftabove" : "leftbelow" : t === "right" ? r === V.positionabove ? "rightabove" : "rightbelow" : r === V.positionabove ? "floatingabove" : "floatingbelow"; | ||
return t === "leftabove" ? { | ||
left: Z, | ||
left: X, | ||
top: We(e, n), | ||
width: r | ||
} : t === "leftbelow" ? { left: Z, top: Ee(e), width: r } : t === "rightabove" ? { right: Z, top: We(e, n), width: r } : t === "rightbelow" ? { right: Z, top: Ee(e), width: r } : t === "floatingbelow" ? { left: e.left, top: Ee(e), width: r } : { left: e.left, top: We(e, n), width: r }; | ||
} : t === "leftbelow" ? { left: X, top: Se(e), width: r } : t === "rightabove" ? { right: X, top: We(e, n), width: r } : t === "rightbelow" ? { right: X, top: Se(e), width: r } : t === "floatingbelow" ? { left: e.left, top: Se(e), width: r } : { left: e.left, top: We(e, n), width: r }; | ||
}, ua = (e, n, t) => { | ||
@@ -1057,35 +1057,38 @@ const r = ia(n), a = la(n), o = e.left + ut, i = e.right + ut; | ||
}, ca = (e) => { | ||
const { datepickerWrapperRef: n, footer: t, inputRef: r, testId: a, zIndex: o, ...i } = e, l = re(null), [s, c] = T(), d = hn(n), f = vn(r, 0); | ||
const { datepickerWrapperRef: n, footer: t, inputRef: r, testId: a, zIndex: o, ...i } = e, l = re(null), [s, c] = T(), u = mn(n), f = vn(r, 0); | ||
cn(n, !0); | ||
const m = () => { | ||
var W; | ||
c((W = r.current) == null ? void 0 : W.getBoundingClientRect()); | ||
const h = () => { | ||
var O; | ||
c((O = r.current) == null ? void 0 : O.getBoundingClientRect()); | ||
}; | ||
M.useEffect(() => { | ||
m(); | ||
}, []), fn(m, 500), mn(m, ["scroll", "resize"], 10); | ||
const h = Re(O["datepicker-popup-container"], { | ||
[O["datepicker-popup-container--visible"]]: f | ||
}), p = s && d && Ot(s, d), _ = Re(O["datepicker-popup-arrow"], { | ||
[O["datepicker-popup-arrow--visible"]]: f, | ||
[O["datepicker-popup-arrow--over"]]: p === V.positionbelow, | ||
[O["datepicker-popup-arrow--under"]]: p === V.positionabove | ||
}), b = s && d && da(s, d), k = b && s && p && ua(b, s, p), D = { | ||
U.useEffect(() => { | ||
h(); | ||
}, []), fn(h, 500), hn(h, ["scroll", "resize"], 10); | ||
const m = Re(I["datepicker-popup-container"], { | ||
[I["datepicker-popup-container--visible"]]: f | ||
}), p = s && u && Ot(s, u), _ = Re(I["datepicker-popup-arrow"], { | ||
[I["datepicker-popup-arrow--visible"]]: f, | ||
[I["datepicker-popup-arrow--over"]]: p === V.positionbelow, | ||
[I["datepicker-popup-arrow--under"]]: p === V.positionabove | ||
}), b = s && u && da(s, u), M = b && s && p && ua(b, s, p), D = { | ||
...un, | ||
...O | ||
...I | ||
}; | ||
return /* @__PURE__ */ M.createElement(M.Fragment, null, /* @__PURE__ */ M.createElement("div", { className: h, "data-testid": a, ref: n, style: { ...b, zIndex: o } }, /* @__PURE__ */ M.createElement( | ||
qr, | ||
{ | ||
captionLayout: "dropdown-buttons", | ||
classNames: D, | ||
mode: "single", | ||
style: { "--rdp-cell-size": pn("l") }, | ||
modifiersClassNames: { today: O["day--today"], selected: O.day_selected, disabled: O["day--disabled"] }, | ||
footer: /* @__PURE__ */ M.createElement("span", { className: O["footer-wrapper"] }, t), | ||
fixedWeeks: !0, | ||
...i | ||
} | ||
)), /* @__PURE__ */ M.createElement("div", { ref: l, className: _, style: { ...k, zIndex: o } })); | ||
}, Wt = M.forwardRef((e, n) => { | ||
return /* @__PURE__ */ R(F, { children: [ | ||
/* @__PURE__ */ d("div", { className: m, "data-testid": a, ref: n, style: { ...b, zIndex: o }, children: /* @__PURE__ */ d( | ||
qr, | ||
{ | ||
captionLayout: "dropdown-buttons", | ||
classNames: D, | ||
mode: "single", | ||
style: { "--rdp-cell-size": pn("l") }, | ||
modifiersClassNames: { today: I["day--today"], selected: I.day_selected, disabled: I["day--disabled"] }, | ||
footer: /* @__PURE__ */ d("span", { className: I["footer-wrapper"], children: t }), | ||
fixedWeeks: !0, | ||
...i | ||
} | ||
) }), | ||
/* @__PURE__ */ d("div", { ref: l, className: _, style: { ...M, zIndex: o } }) | ||
] }); | ||
}, Wt = U.forwardRef((e, n) => { | ||
const { | ||
@@ -1100,26 +1103,26 @@ className: t, | ||
disableDays: c = [], | ||
disableWeekends: d, | ||
disableWeekends: u, | ||
error: f, | ||
errorText: m, | ||
errorTextId: h, | ||
errorText: h, | ||
errorTextId: m, | ||
footerContent: p, | ||
label: _, | ||
inputId: b, | ||
locale: k = nn, | ||
locale: M = nn, | ||
maxDate: D, | ||
minDate: W, | ||
onBlur: U, | ||
onChange: C, | ||
onDatePopupClosed: x, | ||
minDate: O, | ||
onBlur: Z, | ||
onChange: N, | ||
onDatePopupClosed: P, | ||
testId: ae, | ||
autoComplete: z = "off", | ||
zIndex: we = ln.PopOver, | ||
...me | ||
} = e, [X, G] = T(o), [De, ee] = T(X ? S(X, a) : ""), [Me, te] = T(i), [y, v] = T(!1), [$, ne] = T(!1), oe = { | ||
...he | ||
} = e, [K, G] = T(o), [De, ee] = T(K ? S(K, a) : ""), [Me, te] = T(i), [y, v] = T(!1), [$, ne] = T(!1), oe = { | ||
dayOfWeek: [0, 6] | ||
}, Lt = d ? [...c, oe] : c, $e = re(null), ke = re(null), ie = re(null), { refObject: B } = pt(yt(n) ? n : null), qe = bt([n, B]), he = re(!1); | ||
}, Et = u ? [...c, oe] : c, $e = re(null), ke = re(null), ie = re(null), { refObject: B } = pt(yt(n) ? n : null), qe = bt([n, B]), me = re(!1); | ||
sn(ke, (w) => { | ||
var E, le; | ||
const I = w.target; | ||
!((E = ke.current) != null && E.contains(I)) && !((le = ie.current) != null && le.contains(I)) && v(!1); | ||
var W, le; | ||
const x = w.target; | ||
!((W = ke.current) != null && W.contains(x)) && !((le = ie.current) != null && le.contains(x)) && v(!1); | ||
}), q(() => { | ||
@@ -1134,9 +1137,9 @@ ue(o) ? (ee(o ? S(o, a) : ""), G(o), te(o)) : (ee(""), G(void 0), te(void 0)); | ||
at(ie, Je, [rt.Escape]), at($e, Je, [rt.Escape]); | ||
const Qe = (w, I) => { | ||
const Qe = (w, x) => { | ||
ee(w.currentTarget.value); | ||
const E = se(w.currentTarget.value, I, /* @__PURE__ */ new Date()); | ||
ue(E) ? (G(E), te(E)) : G(void 0), C && C(w, w.currentTarget.value); | ||
const W = se(w.currentTarget.value, x, /* @__PURE__ */ new Date()); | ||
ue(W) ? (G(W), te(W)) : G(void 0), N && N(w, w.currentTarget.value); | ||
}, Rt = () => { | ||
$ ? ne(!1) : v(!0); | ||
}, Bt = (w, I, E, le) => { | ||
}, Bt = (w, x, W, le) => { | ||
if (ne(!0), !w) { | ||
@@ -1146,16 +1149,16 @@ v(!1); | ||
} | ||
G(w), B.current && (ee(S(w, a)), v(!1)), C && C(le, w), Tt(B, S(w, a), w), x && x(w); | ||
}, Tt = (w, I, E, le) => { | ||
G(w), B.current && (ee(S(w, a)), v(!1)), N && N(le, w), Tt(B, S(w, a), w), P && P(w); | ||
}, Tt = (w, x, W, le) => { | ||
if (w.current) { | ||
w.current.value = I; | ||
w.current.value = x; | ||
const et = new Event("change", { bubbles: !0 }); | ||
w.current.dispatchEvent(et), C && C(et, E); | ||
w.current.dispatchEvent(et), N && N(et, W); | ||
} | ||
}, Ft = (w) => { | ||
var I; | ||
(I = ie.current) != null && I.contains(w.relatedTarget) || v(!1), ze(w); | ||
var x; | ||
(x = ie.current) != null && x.contains(w.relatedTarget) || v(!1), ze(w); | ||
}, ze = (w) => { | ||
var E; | ||
const I = (E = ie.current) == null ? void 0 : E.contains(w.relatedTarget); | ||
I || v(!1), !I && (typeof x > "u" || he.current) && U && U(w), he.current = !1; | ||
var W; | ||
const x = (W = ie.current) == null ? void 0 : W.contains(w.relatedTarget); | ||
x || v(!1), !x && (typeof P > "u" || me.current) && Z && Z(w), me.current = !1; | ||
}, At = (w) => { | ||
@@ -1165,27 +1168,27 @@ w == null || w.stopPropagation(), v(!y); | ||
q(() => { | ||
const w = (E) => { | ||
["Escape", "Enter", "Tab"].includes(E.key) || (he.current = !0, v(!1)); | ||
}, I = B.current; | ||
return I && I.addEventListener("keydown", w), () => { | ||
I && I.removeEventListener("keydown", w); | ||
const w = (W) => { | ||
["Escape", "Enter", "Tab"].includes(W.key) || (me.current = !0, v(!1)); | ||
}, x = B.current; | ||
return x && x.addEventListener("keydown", w), () => { | ||
x && x.removeEventListener("keydown", w); | ||
}; | ||
}, [B]); | ||
const Yt = (w) => { | ||
Qe(w, "yyyy-MM-dd"), he.current || x && x(X); | ||
}, Ht = /* @__PURE__ */ M.createElement( | ||
Le, | ||
Qe(w, "yyyy-MM-dd"), me.current || P && P(K); | ||
}, Ht = /* @__PURE__ */ d( | ||
Ee, | ||
{ | ||
disabled: s, | ||
error: f, | ||
errorText: m, | ||
errorTextId: h, | ||
errorText: h, | ||
errorTextId: m, | ||
inputId: b, | ||
label: _, | ||
max: D ? S(D, "yyyy-MM-dd") : "", | ||
min: W ? S(W, "yyyy-MM-dd") : "", | ||
min: O ? S(O, "yyyy-MM-dd") : "", | ||
type: "date", | ||
ref: qe, | ||
value: X ? S(X, "yyyy-MM-dd") : "", | ||
value: K ? S(K, "yyyy-MM-dd") : "", | ||
width: 14, | ||
...me, | ||
...he, | ||
onBlur: ze, | ||
@@ -1195,55 +1198,58 @@ onChange: Yt, | ||
} | ||
), jt = /* @__PURE__ */ M.createElement(M.Fragment, null, /* @__PURE__ */ M.createElement("div", null, /* @__PURE__ */ M.createElement( | ||
Le, | ||
{ | ||
disabled: s, | ||
error: f, | ||
errorText: m, | ||
errorTextId: h, | ||
inputId: b, | ||
inputContainerRef: ke, | ||
inputWrapperRef: $e, | ||
label: _, | ||
onFocus: Rt, | ||
type: "text", | ||
ref: qe, | ||
value: De, | ||
width: 12, | ||
...me, | ||
onBlur: Ft, | ||
onChange: (w) => Qe(w, "yyyy-MM-dd"), | ||
rightOfInput: /* @__PURE__ */ M.createElement( | ||
rn, | ||
{ | ||
disabled: s, | ||
ariaLabel: r ?? "Velg dato", | ||
onClick: At, | ||
tabIndex: y ? -1 : 0, | ||
variant: "borderless", | ||
wrapperClassName: O["date-button"], | ||
className: O["date-button__inner"] | ||
}, | ||
/* @__PURE__ */ M.createElement(an, { color: "black", svgIcon: on }) | ||
), | ||
autoComplete: z || void 0 | ||
} | ||
)), y && !s && /* @__PURE__ */ M.createElement( | ||
ca, | ||
{ | ||
dir: l, | ||
disabled: Lt, | ||
datepickerWrapperRef: ie, | ||
footer: p, | ||
fromDate: W, | ||
toDate: D, | ||
inputRef: B, | ||
locale: k, | ||
month: Me, | ||
selected: X, | ||
onSelect: Bt, | ||
onMonthChange: te, | ||
zIndex: we | ||
} | ||
)); | ||
return /* @__PURE__ */ M.createElement("div", { className: t, "data-testid": ae }, dn() ? Ht : jt); | ||
), jt = /* @__PURE__ */ R(F, { children: [ | ||
/* @__PURE__ */ d("div", { children: /* @__PURE__ */ d( | ||
Ee, | ||
{ | ||
disabled: s, | ||
error: f, | ||
errorText: h, | ||
errorTextId: m, | ||
inputId: b, | ||
inputContainerRef: ke, | ||
inputWrapperRef: $e, | ||
label: _, | ||
onFocus: Rt, | ||
type: "text", | ||
ref: qe, | ||
value: De, | ||
width: 12, | ||
...he, | ||
onBlur: Ft, | ||
onChange: (w) => Qe(w, "yyyy-MM-dd"), | ||
rightOfInput: /* @__PURE__ */ d( | ||
rn, | ||
{ | ||
disabled: s, | ||
ariaLabel: r ?? "Velg dato", | ||
onClick: At, | ||
tabIndex: y ? -1 : 0, | ||
variant: "borderless", | ||
wrapperClassName: I["date-button"], | ||
className: I["date-button__inner"], | ||
children: /* @__PURE__ */ d(an, { color: "black", svgIcon: on }) | ||
} | ||
), | ||
autoComplete: z || void 0 | ||
} | ||
) }), | ||
y && !s && /* @__PURE__ */ d( | ||
ca, | ||
{ | ||
dir: l, | ||
disabled: Et, | ||
datepickerWrapperRef: ie, | ||
footer: p, | ||
fromDate: O, | ||
toDate: D, | ||
inputRef: B, | ||
locale: M, | ||
month: Me, | ||
selected: K, | ||
onSelect: Bt, | ||
onMonthChange: te, | ||
zIndex: we | ||
} | ||
) | ||
] }); | ||
return /* @__PURE__ */ d("div", { className: t, "data-testid": ae, children: dn() ? Ht : jt }); | ||
}); | ||
@@ -1254,19 +1260,19 @@ Wt.displayName = "DatePicker"; | ||
return n.length === 1 ? "0" + n : n; | ||
}, fa = (e) => !e || /^\d+$/.test(e) && e.length <= 2, Et = M.forwardRef((e, n) => { | ||
const { defaultValue: t, error: r, errorText: a, errorTextId: o, label: i, onChange: l, timeUnit: s, testId: c, inputId: d, autoComplete: f = "off", ...m } = e, [h, p] = T( | ||
}, fa = (e) => !e || /^\d+$/.test(e) && e.length <= 2, St = U.forwardRef((e, n) => { | ||
const { defaultValue: t, error: r, errorText: a, errorTextId: o, label: i, onChange: l, timeUnit: s, testId: c, inputId: u, autoComplete: f = "off", ...h } = e, [m, p] = T( | ||
typeof t < "u" ? ft(t) : "" | ||
), { refObject: _ } = pt(yt(n) ? n : null), b = bt([n, _]), k = (C) => { | ||
const x = C.target.value; | ||
fa(x) && (p(x), l && l(C)); | ||
}, D = (C) => { | ||
const x = ft(C.target.value); | ||
p(x), l && l(C); | ||
}, W = (C) => { | ||
const x = /[0-9]/, ae = ["Backspace", " ", "Enter", "Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]; | ||
!x.test(C.key) && !ae.includes(C.key) && C.preventDefault(); | ||
}, U = () => s === "hours" && /* @__PURE__ */ M.createElement("span", { className: O["time-separator"] }, ":"); | ||
return /* @__PURE__ */ M.createElement("div", { "data-testid": c }, /* @__PURE__ */ M.createElement( | ||
Le, | ||
), { refObject: _ } = pt(yt(n) ? n : null), b = bt([n, _]), M = (N) => { | ||
const P = N.target.value; | ||
fa(P) && (p(P), l && l(N)); | ||
}, D = (N) => { | ||
const P = ft(N.target.value); | ||
p(P), l && l(N); | ||
}, O = (N) => { | ||
const P = /[0-9]/, ae = ["Backspace", " ", "Enter", "Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]; | ||
!P.test(N.key) && !ae.includes(N.key) && N.preventDefault(); | ||
}; | ||
return /* @__PURE__ */ d("div", { "data-testid": c, children: /* @__PURE__ */ d( | ||
Ee, | ||
{ | ||
inputId: d, | ||
inputId: u, | ||
error: r, | ||
@@ -1280,27 +1286,30 @@ errorText: a, | ||
ref: b, | ||
value: h, | ||
value: m, | ||
width: 5, | ||
...m, | ||
onChange: k, | ||
...h, | ||
onChange: M, | ||
onBlur: D, | ||
rightOfInput: U(), | ||
onKeyDown: W, | ||
rightOfInput: s === "hours" && /* @__PURE__ */ d("span", { className: I["time-separator"], children: ":" }), | ||
onKeyDown: O, | ||
autoComplete: f || void 0 | ||
} | ||
)); | ||
) }); | ||
}); | ||
Et.displayName = "DateTime"; | ||
const va = M.forwardRef((e, n) => { | ||
const { children: t, errorText: r, legend: a, testId: o } = e, i = bn(), l = (s) => ot(s, Wt) ? M.cloneElement(s, { | ||
className: Re(O["date-time-picker-wrapper__date-picker"]), | ||
St.displayName = "DateTime"; | ||
const va = U.forwardRef((e, n) => { | ||
const { children: t, errorText: r, legend: a, testId: o } = e, i = bn(), l = (s) => ot(s, Wt) ? U.cloneElement(s, { | ||
className: Re(I["date-time-picker-wrapper__date-picker"]), | ||
error: !!r, | ||
errorTextId: i | ||
}) : ot(s, Et) ? M.cloneElement(s, { | ||
}) : ot(s, St) ? U.cloneElement(s, { | ||
error: !!r, | ||
errorTextId: i | ||
}) : s; | ||
return /* @__PURE__ */ M.createElement("div", { ref: n, tabIndex: -1 }, /* @__PURE__ */ M.createElement(yn, { errorText: r, errorTextId: i }, e.legend ? /* @__PURE__ */ M.createElement("fieldset", { className: O["date-time-picker-wrapper"], "data-testid": o }, e.legend && /* @__PURE__ */ M.createElement("legend", { className: O["date-time-picker-wrapper__legend"] }, a), M.Children.map(t, l)) : /* @__PURE__ */ M.createElement("div", { className: O["date-time-picker-wrapper"] }, M.Children.map(t, l)))); | ||
return /* @__PURE__ */ d("div", { ref: n, tabIndex: -1, children: /* @__PURE__ */ d(yn, { errorText: r, errorTextId: i, children: e.legend ? /* @__PURE__ */ R("fieldset", { className: I["date-time-picker-wrapper"], "data-testid": o, children: [ | ||
e.legend && /* @__PURE__ */ d("legend", { className: I["date-time-picker-wrapper__legend"], children: a }), | ||
U.Children.map(t, l) | ||
] }) : /* @__PURE__ */ d("div", { className: I["date-time-picker-wrapper"], children: U.Children.map(t, l) }) }) }); | ||
}); | ||
va.displayName = "DateTimePickerWrapper"; | ||
const St = (e) => { | ||
const Lt = (e) => { | ||
const n = ["yyyy-MM-dd", "dd.MM.yyyy"]; | ||
@@ -1317,7 +1326,7 @@ for (const t of n) { | ||
}, ja = (e, n, t, r) => { | ||
const a = St(e), o = typeof t < "u", i = typeof r < "u"; | ||
return !a || o && !ue(t) || i && !ue(r) ? "Invalid date format" : o && !i && (P(a, t) || ye(a, t)) || i && !o && (P(a, r) || Ae(a, r)) || o && i && (P(a, t) || P(a, r) || en(a, { start: t, end: r })) ? !0 : n; | ||
const a = Lt(e), o = typeof t < "u", i = typeof r < "u"; | ||
return !a || o && !ue(t) || i && !ue(r) ? "Invalid date format" : o && !i && (C(a, t) || ye(a, t)) || i && !o && (C(a, r) || Ae(a, r)) || o && i && (C(a, t) || C(a, r) || en(a, { start: t, end: r })) ? !0 : n; | ||
}, Va = (e, n, t) => { | ||
const r = St(e); | ||
return r ? n.some((a) => P(a, r)) ? t : !0 : "Invalid date format"; | ||
const r = Lt(e); | ||
return r ? n.some((a) => C(a, r)) ? t : !0 : "Invalid date format"; | ||
}, Ka = (e, n, t, r) => { | ||
@@ -1329,7 +1338,7 @@ const a = se((e.hour + ":" + e.minute).toString(), "HH:mm", /* @__PURE__ */ new Date()), o = se(((t == null ? void 0 : t.hour) + ":" + (t == null ? void 0 : t.minute)).toString(), "HH:mm", /* @__PURE__ */ new Date()), i = se(((r == null ? void 0 : r.hour) + ":" + (r == null ? void 0 : r.minute)).toString(), "HH:mm", /* @__PURE__ */ new Date()); | ||
Wt as DatePicker, | ||
Et as DateTime, | ||
St as DateTime, | ||
va as DateTimePickerWrapper, | ||
Wt as default, | ||
Ha as isValidDate, | ||
St as parseInputDate, | ||
Lt as parseInputDate, | ||
Va as validateDisabledDates, | ||
@@ -1336,0 +1345,0 @@ ja as validateMinMaxDate, |
@@ -10,3 +10,3 @@ { | ||
"homepage": "https://helsenorge.design", | ||
"version": "8.5.0", | ||
"version": "8.6.0-beta.1", | ||
"author": "Helsenorge", | ||
@@ -13,0 +13,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
389475
1483
2