react-contribution-calendar
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -18,6 +18,6 @@ import './styles/style.css'; | ||
Ye = 1; | ||
var n = Ve, l = Symbol.for("react.element"), o = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, y = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
var n = Ve, l = Symbol.for("react.element"), o = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, b = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function s(u, c, _) { | ||
var v, f = {}, E = null, b = null; | ||
_ !== void 0 && (E = "" + _), c.key !== void 0 && (E = "" + c.key), c.ref !== void 0 && (b = c.ref); | ||
var v, f = {}, E = null, y = null; | ||
_ !== void 0 && (E = "" + _), c.key !== void 0 && (E = "" + c.key), c.ref !== void 0 && (y = c.ref); | ||
for (v in c) | ||
@@ -28,3 +28,3 @@ a.call(c, v) && !g.hasOwnProperty(v) && (f[v] = c[v]); | ||
f[v] === void 0 && (f[v] = c[v]); | ||
return { $$typeof: l, type: u, key: E, ref: b, props: f, _owner: y.current }; | ||
return { $$typeof: l, type: u, key: E, ref: y, props: f, _owner: b.current }; | ||
} | ||
@@ -46,3 +46,3 @@ return G.Fragment = o, G.jsx = s, G.jsxs = s, G; | ||
return We || (We = 1, process.env.NODE_ENV !== "production" && function() { | ||
var n = Ve, l = Symbol.for("react.element"), o = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), S = Symbol.iterator, F = "@@iterator"; | ||
var n = Ve, l = Symbol.for("react.element"), o = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), S = Symbol.iterator, F = "@@iterator"; | ||
function k(e) { | ||
@@ -75,3 +75,3 @@ if (e === null || typeof e != "object") | ||
function N(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === a || e === g || O || e === y || e === _ || e === v || P || e === b || ne || le || ae || typeof e == "object" && e !== null && (e.$$typeof === E || e.$$typeof === f || e.$$typeof === s || e.$$typeof === u || e.$$typeof === c || // This needs to include all possible module reference object | ||
return !!(typeof e == "string" || typeof e == "function" || e === a || e === g || O || e === b || e === _ || e === v || P || e === y || ne || le || ae || typeof e == "object" && e !== null && (e.$$typeof === E || e.$$typeof === f || e.$$typeof === s || e.$$typeof === u || e.$$typeof === c || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
@@ -106,3 +106,3 @@ // we don't know which Flight build this will end up being used | ||
return "Profiler"; | ||
case y: | ||
case b: | ||
return "StrictMode"; | ||
@@ -629,4 +629,4 @@ case _: | ||
} | ||
var yr = pr, br = dr; | ||
H.Fragment = a, H.jsx = yr, H.jsxs = br; | ||
var br = pr, yr = dr; | ||
H.Fragment = a, H.jsx = br, H.jsxs = yr; | ||
}()), H; | ||
@@ -636,7 +636,4 @@ } | ||
var T = pe.exports; | ||
function ye({ children: n, textColor: l, style: o, colSpan: a, ...y }) { | ||
return /* @__PURE__ */ T.jsxs("td", { className: "calendar-label", style: o, colSpan: a, ...y, children: [ | ||
/* @__PURE__ */ T.jsx("span", { className: "sr-only", children: n }), | ||
/* @__PURE__ */ T.jsx("span", { className: "calendar-label-text", "aria-hidden": "true", style: { color: l }, children: n }) | ||
] }); | ||
function be({ children: n, textColor: l, style: o, colSpan: a, ...b }) { | ||
return /* @__PURE__ */ T.jsx("td", { className: "calendar-label", style: o, colSpan: a, ...b, children: /* @__PURE__ */ T.jsx("span", { className: "calendar-label-text", "aria-hidden": "true", style: { color: l }, children: n }) }); | ||
} | ||
@@ -902,5 +899,5 @@ const Rr = { | ||
return `${l.date}, ${l.month} ${l.day}, ${l.year}`; | ||
}, Be = (n, l, o) => `${n}-${String(l + 1).padStart(2, "0")}-${String(o).padStart(2, "0")}`, Dr = (n, l, o) => `${n}-${String(l).padStart(2, "0")}-${String(o).padStart(2, "0")}`, W = (n) => +n.slice(0, 4), Le = (n) => +n.slice(5, 7), Yr = (n) => +n.slice(8, 10), wr = (n = U()) => n % 4 === 0 && n % 100 !== 0 || n % 400 === 0, be = (n = U()) => [31, wr(n) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], J = (n = U()) => new Date(n, 0, 1).getDay(), Wr = (n) => new Date(n).getDay(), U = () => (/* @__PURE__ */ new Date()).getFullYear(), Br = (n = U(), l, o) => { | ||
const a = be(n), y = J(n), g = []; | ||
let s = y; | ||
}, Be = (n, l, o) => `${n}-${String(l + 1).padStart(2, "0")}-${String(o).padStart(2, "0")}`, Dr = (n, l, o) => `${n}-${String(l).padStart(2, "0")}-${String(o).padStart(2, "0")}`, W = (n) => +n.slice(0, 4), Le = (n) => +n.slice(5, 7), Yr = (n) => +n.slice(8, 10), wr = (n = U()) => n % 4 === 0 && n % 100 !== 0 || n % 400 === 0, ye = (n = U()) => [31, wr(n) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], J = (n = U()) => new Date(n, 0, 1).getDay(), Wr = (n) => new Date(n).getDay(), U = () => (/* @__PURE__ */ new Date()).getFullYear(), Br = (n = U(), l, o) => { | ||
const a = ye(n), b = J(n), g = []; | ||
let s = b; | ||
for (let u = 0; u < 12; u++) { | ||
@@ -911,5 +908,5 @@ const c = a[u]; | ||
s === 0 && _++, s = (s + 1) % 7; | ||
u === 0 && y !== 0 && _++, g.push(_); | ||
u === 0 && b !== 0 && _++, g.push(_); | ||
} | ||
return n !== l && y !== 0 && l !== o && (g[0] -= 1), g; | ||
return n !== l && b !== 0 && l !== o && (g[0] -= 1), g; | ||
}, Fr = (n) => { | ||
@@ -936,23 +933,23 @@ const l = /* @__PURE__ */ new Map(); | ||
}, kr = (n, l, o) => { | ||
const a = W(n), y = W(l), g = Or(a, y); | ||
const a = W(n), b = W(l), g = Or(a, b); | ||
let s = 0, u = 1; | ||
for (let c = a; c <= y; ++c) { | ||
const _ = o ? J(c) : (J(c) + 6) % 7, v = be(c); | ||
let f = 0, E = 1, b = _; | ||
for (let c = a; c <= b; ++c) { | ||
const _ = o ? J(c) : (J(c) + 6) % 7, v = ye(c); | ||
let f = 0, E = 1, y = _; | ||
for (; f < 12; ) { | ||
for (let S = 0; S < v[f]; ++S) | ||
g[b % 7][~~(b / 7) + s] = u, b++, E++, u++; | ||
g[y % 7][~~(y / 7) + s] = u, y++, E++, u++; | ||
E > v[f] && (E = 1, f++); | ||
} | ||
s += ~~(b / 7); | ||
s += ~~(y / 7); | ||
} | ||
return g; | ||
}, Ue = (n, l, o) => { | ||
const a = W(n), y = W(l), g = jr(a, y); | ||
const a = W(n), b = W(l), g = jr(a, b); | ||
let s = 0; | ||
for (let u = a; u <= y; ++u) { | ||
const c = o ? J(u) : (J(u) + 6) % 7, _ = be(u); | ||
for (let u = a; u <= b; ++u) { | ||
const c = o ? J(u) : (J(u) + 6) % 7, _ = ye(u); | ||
let v = 0, f = 1, E = c; | ||
for (; v < 12; ) { | ||
for (let b = 0; b < _[v]; ++b) { | ||
for (let y = 0; y < _[v]; ++y) { | ||
const S = Dr(u, v + 1, f); | ||
@@ -967,6 +964,6 @@ g[E % 7][~~(E / 7) + s] = S, E++, f++; | ||
}, te = (n, l, o) => { | ||
const a = `${n}-01-01`, y = Pr(a, l), g = kr(a, l, o); | ||
const a = `${n}-01-01`, b = Pr(a, l), g = kr(a, l, o); | ||
for (let s = 0; s < g.length; ++s) | ||
for (let u = 0; u < g[s].length; ++u) | ||
if (y === g[s][u]) | ||
if (b === g[s][u]) | ||
return { row: s, col: u }; | ||
@@ -978,3 +975,3 @@ return { row: 0, col: 0 }; | ||
}, Ar = (n, l, o, a) => { | ||
const { row: y, col: g } = te( | ||
const { row: b, col: g } = te( | ||
W(n), | ||
@@ -986,13 +983,13 @@ n, | ||
for (let f = g; f <= s; ++f) | ||
f === g ? v = Le(o[y][f]) - 1 : v = Le(o[0][f]) - 1, v !== _ && (u.push(xr[v]), _ = v, c.push(0)), c[c.length - 1]++; | ||
f === g ? v = Le(o[b][f]) - 1 : v = Le(o[0][f]) - 1, v !== _ && (u.push(xr[v]), _ = v, c.push(0)), c[c.length - 1]++; | ||
return { months: u, colSpans: c }; | ||
}; | ||
function Mr({ start: n, end: l, textColor: o, startsOnSunday: a }) { | ||
const y = Ue(n, l, a), { months: g, colSpans: s } = Ar(n, l, y, a); | ||
const b = Ue(n, l, a), { months: g, colSpans: s } = Ar(n, l, b, a); | ||
return /* @__PURE__ */ T.jsx("thead", { children: /* @__PURE__ */ T.jsxs("tr", { children: [ | ||
/* @__PURE__ */ T.jsx(ye, { textColor: o, style: { width: "3.5em" }, colSpan: 1, children: " " }), | ||
g.map((u, c) => /* @__PURE__ */ T.jsx(ye, { textColor: o, colSpan: s[c], children: u }, c)) | ||
/* @__PURE__ */ T.jsx(be, { textColor: o, style: { width: "3.5em" }, colSpan: 1, children: " " }), | ||
g.map((u, c) => /* @__PURE__ */ T.jsx(be, { textColor: o, colSpan: s[c], children: u }, c)) | ||
] }) }); | ||
} | ||
function Ir({ themeProps: n, dataLevel: l, style: o, children: a, dataTooltip: y, ...g }) { | ||
function Ir({ themeProps: n, dataLevel: l, style: o, children: a, dataTooltip: b, ...g }) { | ||
const s = hr(null), [u, c] = gr(-10), _ = (f) => { | ||
@@ -1002,4 +999,4 @@ if (!f) | ||
let E = 0; | ||
return f.childNodes.forEach((b) => { | ||
b.nodeType === Node.ELEMENT_NODE && window.getComputedStyle(b).display !== "none" && E++; | ||
return f.childNodes.forEach((y) => { | ||
y.nodeType === Node.ELEMENT_NODE && window.getComputedStyle(y).display !== "none" && E++; | ||
}), E; | ||
@@ -1010,6 +1007,6 @@ }, v = (f) => { | ||
const E = Array.from(f.parentNode.childNodes); | ||
let b = 0; | ||
let y = 0; | ||
for (let S = 0; S < f.cellIndex; S++) | ||
E[S].style.display !== "none" && b++; | ||
return b; | ||
E[S].style.display !== "none" && y++; | ||
return y; | ||
}; | ||
@@ -1020,7 +1017,7 @@ return mr(() => { | ||
if (s.current) { | ||
const b = _((E = s.current) == null ? void 0 : E.parentNode), S = v(s.current); | ||
if (b) { | ||
const y = _((E = s.current) == null ? void 0 : E.parentNode), S = v(s.current); | ||
if (y) { | ||
let F = -10; | ||
const k = S / b; | ||
k > 0.9 ? F = Math.max(~~(s.current.cellIndex * -140) / b, -160) : k > 0.8 ? F = Math.max(~~(s.current.cellIndex * -130) / b, -130) : k > 0.66 ? F = Math.max(~~(s.current.cellIndex * -110) / b, -120) : k > 0.5 ? F = Math.max(~~(s.current.cellIndex * -90) / b, -110) : k > 0.33 ? F = Math.max(~~(s.current.cellIndex * -40) / b, -90) : k > 0.2 ? F = Math.min(~~(s.current.cellIndex * -15) / b, -40) : F = Math.min(~~(s.current.cellIndex * -7) / b, -10), c(F); | ||
const k = S / y; | ||
k > 0.9 ? F = Math.max(~~(s.current.cellIndex * -140) / y, -160) : k > 0.8 ? F = Math.max(~~(s.current.cellIndex * -130) / y, -130) : k > 0.66 ? F = Math.max(~~(s.current.cellIndex * -110) / y, -120) : k > 0.5 ? F = Math.max(~~(s.current.cellIndex * -90) / y, -110) : k > 0.33 ? F = Math.max(~~(s.current.cellIndex * -40) / y, -90) : k > 0.2 ? F = Math.min(~~(s.current.cellIndex * -15) / y, -40) : F = Math.min(~~(s.current.cellIndex * -7) / y, -10), c(F); | ||
} | ||
@@ -1042,6 +1039,5 @@ } | ||
}, | ||
"data-tooltip": y, | ||
"data-tooltip": b, | ||
"data-level": l, | ||
...g, | ||
children: /* @__PURE__ */ T.jsx("span", { className: "sr-only", children: a }) | ||
...g | ||
} | ||
@@ -1055,3 +1051,3 @@ ); | ||
textColor: a, | ||
startsOnSunday: y, | ||
startsOnSunday: b, | ||
includeBoundary: g, | ||
@@ -1064,5 +1060,5 @@ cx: s, | ||
}) { | ||
const f = W(l), { row: E, col: b } = te(f, l, y), { row: S, col: F } = te(f, o, y), k = y ? ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] : ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], $ = Ue(l, o, y), z = ((P) => Cr(P))(_), ne = Fr(n), le = (P, O) => O < b || O > F, ae = (P, O) => O === b && P < E || O === F && P > S; | ||
const f = W(l), { row: E, col: y } = te(f, l, b), { row: S, col: F } = te(f, o, b), k = b ? ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] : ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], $ = Ue(l, o, b), z = ((P) => Cr(P))(_), ne = Fr(n), le = (P, O) => O < y || O > F, ae = (P, O) => O === y && P < E || O === F && P > S; | ||
return /* @__PURE__ */ T.jsx("tbody", { children: k.map((P, O) => /* @__PURE__ */ T.jsxs("tr", { children: [ | ||
/* @__PURE__ */ T.jsx(ye, { tabIndex: 0, textColor: a, style: { textAlign: "inherit" }, children: P }), | ||
/* @__PURE__ */ T.jsx(be, { tabIndex: 0, textColor: a, style: { textAlign: "inherit" }, children: P }), | ||
$[O].map((B, N) => { | ||
@@ -1113,3 +1109,3 @@ if (le(O, N)) | ||
textColor: a = "#000", | ||
startsOnSunday: y = !0, | ||
startsOnSunday: b = !0, | ||
includeBoundary: g = !0, | ||
@@ -1125,3 +1121,3 @@ cx: s = 10, | ||
return /* @__PURE__ */ T.jsx("div", { className: "container", style: f, children: /* @__PURE__ */ T.jsxs("table", { children: [ | ||
/* @__PURE__ */ T.jsx(Mr, { start: l, end: o, textColor: a, startsOnSunday: y }), | ||
/* @__PURE__ */ T.jsx(Mr, { start: l, end: o, textColor: a, startsOnSunday: b }), | ||
/* @__PURE__ */ T.jsx( | ||
@@ -1134,3 +1130,3 @@ $r, | ||
textColor: a, | ||
startsOnSunday: y, | ||
startsOnSunday: b, | ||
includeBoundary: g, | ||
@@ -1137,0 +1133,0 @@ cx: s, |
@@ -1,2 +0,2 @@ | ||
// Type definitions for react-contribution-calendar 1.2.1 | ||
// Type definitions for react-contribution-calendar 1.2.2 | ||
// Project: https://github.com/seiwon-yaehee/react-contribution-calendar | ||
@@ -110,3 +110,3 @@ // Definitions by: Seiwon Park <https://github.com/SeiwonPark> | ||
* | ||
* @version 1.2.1 | ||
* @version 1.2.2 | ||
* @see {@link https://github.com/seiwon-yaehee/react-contribution-calendar#apis} | ||
@@ -113,0 +113,0 @@ */ |
{ | ||
"name": "react-contribution-calendar", | ||
"description": "A GitHub-like contribution calendar component for React", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
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
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
74274
1450