react-contribution-calendar
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -285,3 +285,3 @@ import './styles/index.css'; | ||
return `${l.date}, ${l.month} ${l.day}, ${l.year}`; | ||
}, K = (e, l, r) => `${e}-${String(l + 1).padStart(2, "0")}-${String(r).padStart(2, "0")}`, _e = (e, l, r) => `${e}-${String(l).padStart(2, "0")}-${String(r).padStart(2, "0")}`, z = (e) => ({ year: +e.slice(0, 4), month: +e.slice(5, 7), day: +e.slice(8, 10) }), $ = (e) => +e.slice(0, 4), Q = (e) => +e.slice(5, 7), ll = (e) => +e.slice(8, 10), ye = (e = A()) => e % 4 === 0 && e % 100 !== 0 || e % 400 === 0, U = (e = A()) => [31, ye(e) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Fe = (e) => new Date(e).getDay(), x = (e = A()) => new Date(e, 0, 1).getDay(), rl = (e) => new Date(e).getDay(), A = () => (/* @__PURE__ */ new Date()).getFullYear(), tl = (e = A(), l, r) => { | ||
}, K = (e, l, r) => `${e}-${String(l + 1).padStart(2, "0")}-${String(r).padStart(2, "0")}`, _e = (e, l, r) => `${e}-${String(l).padStart(2, "0")}-${String(r).padStart(2, "0")}`, Y = (e) => ({ year: +e.slice(0, 4), month: +e.slice(5, 7), day: +e.slice(8, 10) }), $ = (e) => +e.slice(0, 4), Q = (e) => +e.slice(5, 7), ll = (e) => +e.slice(8, 10), ye = (e = A()) => e % 4 === 0 && e % 100 !== 0 || e % 400 === 0, U = (e = A()) => [31, ye(e) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Fe = (e) => new Date(e).getDay(), x = (e = A()) => new Date(e, 0, 1).getDay(), rl = (e) => new Date(e).getDay(), A = () => (/* @__PURE__ */ new Date()).getFullYear(), tl = (e = A(), l, r) => { | ||
const t = U(e), d = x(e), c = []; | ||
@@ -347,3 +347,3 @@ let o = d; | ||
return c; | ||
}, Y = (e, l, r) => { | ||
}, R = (e, l, r) => { | ||
const t = `${e}-01-01`, d = ke(t, l), c = Me(t, l, r); | ||
@@ -356,7 +356,7 @@ for (let o = 0; o < c.length; ++o) | ||
}, ke = (e, l) => Math.abs(new Date(e).getTime() - new Date(l).getTime()) / (1e3 * 60 * 60 * 24) + 1, ne = (e, l, r, t) => { | ||
const { row: d, col: c } = Y( | ||
const { row: d, col: c } = R( | ||
$(e), | ||
e, | ||
t | ||
), { col: o } = Y($(e), l, t), a = [], n = []; | ||
), { col: o } = R($(e), l, t), a = [], n = []; | ||
let f = -1, v = 0; | ||
@@ -372,3 +372,3 @@ for (let s = c; s <= o; ++s) | ||
function $e({ start: e, end: l, textColor: r, startsOnSunday: t, cy: d }) { | ||
const c = te(e, l, t), { day: o } = z(e), { year: a, month: n, day: f } = z(l), v = Fe(`${a}-${n}-01`), { months: s, colSpans: h } = ne(e, l, c, t); | ||
const c = te(e, l, t), { day: o } = Y(e), { year: a, month: n, day: f } = Y(l), v = Fe(`${a}-${n}-01`), { months: s, colSpans: h } = ne(e, l, c, t); | ||
return /* @__PURE__ */ u("thead", { className: V.thead, children: /* @__PURE__ */ C("tr", { className: V.tr, children: [ | ||
@@ -413,3 +413,3 @@ /* @__PURE__ */ u(q, { className: V.dayOfTheWeek, textColor: r, style: { fontSize: d }, colSpan: 1, children: " " }), | ||
left: `${r.left + l}px`, | ||
top: `${r.top - 40}px` | ||
top: `${r.top - 16 - t - ~~(t / 10)}px` | ||
}, c = { | ||
@@ -425,3 +425,3 @@ position: "fixed", | ||
left: `${r.left + r.width / 2 - 6}px`, | ||
top: `${r.top - 18}px` | ||
top: `${r.top - 8}px` | ||
}; | ||
@@ -507,3 +507,3 @@ return ue( | ||
}; | ||
function ze({ | ||
function Ye({ | ||
data: e, | ||
@@ -523,3 +523,3 @@ start: l, | ||
}) { | ||
const { year: b, day: i } = z(l), { day: D } = z(r), { row: M, col: T } = Y(b, l, c), { row: m, col: g } = Y(b, r, c), F = te(l, r, c), { colSpans: y } = ne(l, r, F, c), B = le(v), p = Se(e), X = (S, _) => _ == g + 1 && y[y.length - 1] === 1, ae = (S, _) => _ < T || _ > g, ce = (S, _) => _ === T && S < M || _ === g && S > m, I = () => T === g || D - i <= 7, oe = c ? t : (() => { | ||
const { year: b, day: i } = Y(l), { day: D } = Y(r), { row: M, col: T } = R(b, l, c), { row: m, col: g } = R(b, r, c), F = te(l, r, c), { colSpans: y } = ne(l, r, F, c), B = le(v), p = Se(e), X = (S, _) => _ == g + 1 && y[y.length - 1] === 1, ae = (S, _) => _ < T || _ > g, ce = (S, _) => _ === T && S < M || _ === g && S > m, I = () => T === g || D - i <= 7, oe = c ? t : (() => { | ||
const S = [...t]; | ||
@@ -595,5 +595,5 @@ return S.push(S.shift() || ""), S; | ||
} | ||
const Ye = "_description_lo6s8_1", Re = "_themes_lo6s8_8", Je = "_cell_lo6s8_16", H = { | ||
description: Ye, | ||
themes: Re, | ||
const Re = "_description_lo6s8_1", ze = "_themes_lo6s8_8", Je = "_cell_lo6s8_16", H = { | ||
description: Re, | ||
themes: ze, | ||
cell: Je | ||
@@ -623,3 +623,3 @@ }; | ||
table: Ue | ||
}, R = (e, l) => { | ||
}, z = (e, l) => { | ||
const r = new Error(l); | ||
@@ -631,14 +631,14 @@ return r.name = e, r; | ||
if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) | ||
throw R(L.Date, `Invalid date string ${e}. The date string should be 'YYYY-MM-DD' format.`); | ||
throw z(L.Date, `Invalid date string ${e}. The date string should be 'YYYY-MM-DD' format.`); | ||
try { | ||
return new Date(e).toISOString().slice(0, 10) === e; | ||
} catch { | ||
throw R(L.Date, `Invalid date string ${e}. Please check the date.`); | ||
throw z(L.Date, `Invalid date string ${e}. Please check the date.`); | ||
} | ||
}, Xe = (e, l) => { | ||
if (e > l) | ||
throw R(L.Date, "The starting date should be earlier than the ending date."); | ||
throw z(L.Date, "The starting date should be earlier than the ending date."); | ||
}, Ge = (e) => { | ||
if (e.length !== 7) | ||
throw R(L.Number, "The length of the `daysOfTheWeek` should be exact 7."); | ||
throw z(L.Number, "The length of the `daysOfTheWeek` should be exact 7."); | ||
}; | ||
@@ -684,3 +684,3 @@ function nl({ | ||
/* @__PURE__ */ u( | ||
ze, | ||
Ye, | ||
{ | ||
@@ -730,5 +730,5 @@ data: e || [], | ||
ne as getMonthsAndColSpans, | ||
Y as getRowAndColumnIndexFromDate, | ||
R as getRowAndColumnIndexFromDate, | ||
ye as isLeapYear, | ||
z as parseDateFromDateString, | ||
Y as parseDateFromDateString, | ||
ll as parseDayFromDateString, | ||
@@ -735,0 +735,0 @@ Se as parseInputData, |
{ | ||
"name": "react-contribution-calendar", | ||
"description": "A GitHub-like contribution calendar component for React", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
60578