Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-contribution-calendar

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-contribution-calendar - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

426

dist/index.js
import './styles/style.css';
import { jsx as u, jsxs as N } from "react/jsx-runtime";
import { useRef as le, useState as te, useEffect as ne } from "react";
function B({ children: e, textColor: l, style: n, colSpan: t, hide: a, ...s }) {
return /* @__PURE__ */ u("td", { className: "calendar-label", style: n, colSpan: t, ...s, children: a ? void 0 : /* @__PURE__ */ u("span", { className: "calendar-label-text", "aria-hidden": "true", style: { color: l }, children: e }) });
import { jsx as u, jsxs as $ } from "react/jsx-runtime";
import { useRef as se, useState as ce, useEffect as ie } from "react";
const de = "_calendarLabel_1itwh_1", fe = "_calendarLabelText_1itwh_7", z = {
calendarLabel: de,
calendarLabelText: fe
};
function q({ children: e, textColor: l, style: n, colSpan: t, hide: o, ...s }) {
return /* @__PURE__ */ u("td", { className: z.calendarLabel, style: n, colSpan: t, ...s, children: o ? void 0 : /* @__PURE__ */ u("span", { className: z.calendarLabelText, "aria-hidden": "true", style: { color: l }, children: e }) });
}
const re = {
const ve = {
// light themes

@@ -248,3 +252,3 @@ empty: {

}
}, oe = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ae = (e = /* @__PURE__ */ new Date()) => {
}, ue = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], he = (e = /* @__PURE__ */ new Date()) => {
const l = {

@@ -278,17 +282,17 @@ Sun: "Sunday",

};
}, Te = (e) => e.reduce((l, n) => l + n, 0), se = (e) => {
const l = ae(new Date(e));
}, Pe = (e) => e.reduce((l, n) => l + n, 0), ye = (e) => {
const l = he(new Date(e));
return `${l.date}, ${l.month} ${l.day}, ${l.year}`;
}, J = (e, l, n) => `${e}-${String(l + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`, ie = (e, l, n) => `${e}-${String(l).padStart(2, "0")}-${String(n).padStart(2, "0")}`, _ = (e) => ({ year: +e.slice(0, 4), month: +e.slice(5, 7), day: +e.slice(8, 10) }), M = (e) => +e.slice(0, 4), z = (e) => +e.slice(5, 7), Ee = (e) => +e.slice(8, 10), ce = (e = E()) => e % 4 === 0 && e % 100 !== 0 || e % 400 === 0, Y = (e = E()) => [31, ce(e) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], fe = (e) => new Date(e).getDay(), T = (e = E()) => new Date(e, 0, 1).getDay(), Ne = (e) => new Date(e).getDay(), E = () => (/* @__PURE__ */ new Date()).getFullYear(), ke = (e = E(), l, n) => {
const t = Y(e), a = T(e), s = [];
let i = a;
for (let o = 0; o < 12; o++) {
const r = t[o];
}, R = (e, l, n) => `${e}-${String(l + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`, pe = (e, l, n) => `${e}-${String(l).padStart(2, "0")}-${String(n).padStart(2, "0")}`, A = (e) => ({ year: +e.slice(0, 4), month: +e.slice(5, 7), day: +e.slice(8, 10) }), N = (e) => +e.slice(0, 4), V = (e) => +e.slice(5, 7), Xe = (e) => +e.slice(8, 10), be = (e = k()) => e % 4 === 0 && e % 100 !== 0 || e % 400 === 0, J = (e = k()) => [31, be(e) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], ge = (e) => new Date(e).getDay(), M = (e = k()) => new Date(e, 0, 1).getDay(), Ge = (e) => new Date(e).getDay(), k = () => (/* @__PURE__ */ new Date()).getFullYear(), Ke = (e = k(), l, n) => {
const t = J(e), o = M(e), s = [];
let c = o;
for (let a = 0; a < 12; a++) {
const r = t[a];
let v = 0;
for (let d = 0; d < r; d++)
i === 0 && v++, i = (i + 1) % 7;
o === 0 && a !== 0 && v++, s.push(v);
for (let f = 0; f < r; f++)
c === 0 && v++, c = (c + 1) % 7;
a === 0 && o !== 0 && v++, s.push(v);
}
return e !== l && a !== 0 && l !== n && (s[0] -= 1), s;
}, de = (e) => {
return e !== l && o !== 0 && l !== n && (s[0] -= 1), s;
}, me = (e) => {
const l = /* @__PURE__ */ new Map();

@@ -300,81 +304,85 @@ return e.forEach((n) => {

}), l;
}, L = (e) => typeof e == "string" ? re[e] : e, ve = (e, l) => {
}, X = (e) => typeof e == "string" ? ve[e] : e, De = (e, l) => {
let n = 0;
for (let t = e; t <= l; ++t)
n += V(e, t === e);
n += G(e, t === e);
return new Array(7).fill(0).map(() => new Array(n).fill(0));
}, ue = (e, l) => {
}, _e = (e, l) => {
let n = 0;
for (let t = e; t <= l; ++t)
n += V(e, t === e);
n += G(e, t === e);
return new Array(7).fill("").map(() => new Array(n).fill(""));
}, V = (e, l) => {
const n = T(e);
}, G = (e, l) => {
const n = M(e);
return l || n === 0 ? 53 : 52;
}, he = (e, l, n) => {
const t = M(e), a = M(l), s = ve(t, a);
let i = 0, o = 1;
for (let r = t; r <= a; ++r) {
const v = n ? T(r) : (T(r) + 6) % 7, d = Y(r);
let f = 0, y = 1, p = v;
for (; f < 12; ) {
for (let c = 0; c < d[f]; ++c)
s[p % 7][~~(p / 7) + i] = o, p++, y++, o++;
y > d[f] && (y = 1, f++);
}, Fe = (e, l, n) => {
const t = N(e), o = N(l), s = De(t, o);
let c = 0, a = 1;
for (let r = t; r <= o; ++r) {
const v = n ? M(r) : (M(r) + 6) % 7, f = J(r);
let d = 0, y = 1, p = v;
for (; d < 12; ) {
for (let i = 0; i < f[d]; ++i)
s[p % 7][~~(p / 7) + c] = a, p++, y++, a++;
y > f[d] && (y = 1, d++);
}
i += ~~(p / 7);
c += ~~(p / 7);
}
return s;
}, W = (e, l, n) => {
const t = M(e), a = M(l), s = ue(t, a);
let i = 0;
for (let o = t; o <= a; ++o) {
const r = n ? T(o) : (T(o) + 6) % 7, v = Y(o);
let d = 0, f = 1, y = r;
for (; d < 12; ) {
for (let p = 0; p < v[d]; ++p) {
const c = ie(o, d + 1, f);
s[y % 7][~~(y / 7) + i] = c, y++, f++;
}, K = (e, l, n) => {
const t = N(e), o = N(l), s = _e(t, o);
let c = 0;
for (let a = t; a <= o; ++a) {
const r = n ? M(a) : (M(a) + 6) % 7, v = J(a);
let f = 0, d = 1, y = r;
for (; f < 12; ) {
for (let p = 0; p < v[f]; ++p) {
const i = pe(a, f + 1, d);
s[y % 7][~~(y / 7) + c] = i, y++, d++;
}
f > v[d] && (f = 1, d++);
d > v[f] && (d = 1, f++);
}
i += ~~(y / 7);
c += ~~(y / 7);
}
return s;
}, A = (e, l, n) => {
const t = `${e}-01-01`, a = ye(t, l), s = he(t, l, n);
for (let i = 0; i < s.length; ++i)
for (let o = 0; o < s[i].length; ++o)
if (a === s[i][o])
return { row: i, col: o };
}, O = (e, l, n) => {
const t = `${e}-01-01`, o = we(t, l), s = Fe(t, l, n);
for (let c = 0; c < s.length; ++c)
for (let a = 0; a < s[c].length; ++a)
if (o === s[c][a])
return { row: c, col: a };
return { row: 0, col: 0 };
}, ye = (e, l) => Math.abs(new Date(e).getTime() - new Date(l).getTime()) / (1e3 * 60 * 60 * 24) + 1, H = (e, l, n, t) => {
const { row: a, col: s } = A(
M(e),
}, we = (e, l) => Math.abs(new Date(e).getTime() - new Date(l).getTime()) / (1e3 * 60 * 60 * 24) + 1, Q = (e, l, n, t) => {
const { row: o, col: s } = O(
N(e),
e,
t
), { col: i } = A(M(e), l, t), o = [], r = [];
let v = -1, d = 0;
for (let f = s; f <= i; ++f)
f === s ? d = z(n[a][f]) - 1 : d = z(n[0][f]) - 1, d !== v && (o.push(oe[d]), v = d, r.push(0)), r[r.length - 1]++;
return { months: o, colSpans: r };
), { col: c } = O(N(e), l, t), a = [], r = [];
let v = -1, f = 0;
for (let d = s; d <= c; ++d)
d === s ? f = V(n[o][d]) - 1 : f = V(n[0][d]) - 1, f !== v && (a.push(ue[f]), v = f, r.push(0)), r[r.length - 1]++;
return { months: a, colSpans: r };
}, Se = "_thead_1nv4q_1", Te = "_tr_1nv4q_9", Ne = "_dayOfTheWeek_1nv4q_15", Y = {
thead: Se,
tr: Te,
dayOfTheWeek: Ne
};
function pe({ start: e, end: l, textColor: n, startsOnSunday: t, cy: a }) {
const s = W(e, l, t), { day: i } = _(e), { year: o, month: r, day: v } = _(l), d = fe(`${o}-${r}-01`), { months: f, colSpans: y } = H(e, l, s, t);
return /* @__PURE__ */ u("thead", { children: /* @__PURE__ */ N("tr", { children: [
/* @__PURE__ */ u(B, { className: "day-of-the-week", textColor: n, style: { fontSize: a }, colSpan: 1, children: " " }),
f.map((p, c) => {
let h = y[c];
y.length === 1 && y[0] === 1 ? h++ : f.length > 1 && v < 14 && d !== 0 && c === f.length - 2 ? h-- : (f.length > 1 && v < 14 && d !== 0 && c === f.length - 1 || f.length > 1 && v < 14 && c === f.length - 1) && h++;
const g = c === 0 && f.length > 1 && h <= 1 && i >= 21;
function Me({ start: e, end: l, textColor: n, startsOnSunday: t, cy: o }) {
const s = K(e, l, t), { day: c } = A(e), { year: a, month: r, day: v } = A(l), f = ge(`${a}-${r}-01`), { months: d, colSpans: y } = Q(e, l, s, t);
return /* @__PURE__ */ u("thead", { className: Y.thead, children: /* @__PURE__ */ $("tr", { className: Y.tr, children: [
/* @__PURE__ */ u(q, { className: Y.dayOfTheWeek, textColor: n, style: { fontSize: o }, colSpan: 1, children: " " }),
d.map((p, i) => {
let h = y[i];
y.length === 1 && y[0] === 1 ? h++ : d.length > 1 && v < 14 && f !== 0 && i === d.length - 2 ? h-- : (d.length > 1 && v < 14 && f !== 0 && i === d.length - 1 || d.length > 1 && v < 14 && i === d.length - 1) && h++;
const b = i === 0 && d.length > 1 && h <= 1 && c >= 21;
return /* @__PURE__ */ u(
B,
q,
{
textColor: n,
style: { fontSize: a },
style: { fontSize: o },
colSpan: h,
hide: g,
hide: b,
children: p
},
c
i
);

@@ -384,3 +392,7 @@ })

}
function ge({
const ke = "_calendarCell_kpqwu_1", $e = "_top_kpqwu_11", H = {
calendarCell: ke,
top: $e
};
function Ee({
cx: e,

@@ -390,41 +402,41 @@ theme: l,

dataLevel: t,
style: a,
style: o,
dataTooltip: s,
tooltipSize: i,
...o
tooltipSize: c,
...a
}) {
const r = le(null), [v, d] = te(-10), f = (c) => {
if (!c)
const r = se(null), [v, f] = ce(-10), d = (i) => {
if (!i)
return 0;
let h = 0;
return c.childNodes.forEach((g) => {
g.nodeType === Node.ELEMENT_NODE && window.getComputedStyle(g).display !== "none" && h++;
return i.childNodes.forEach((b) => {
b.nodeType === Node.ELEMENT_NODE && window.getComputedStyle(b).display !== "none" && h++;
}), h;
}, y = (c) => {
if (!c || !c.parentNode)
}, y = (i) => {
if (!i || !i.parentNode)
return -1;
const h = Array.from(c.parentNode.childNodes);
let g = 0;
for (let S = 0; S < c.cellIndex; S++)
h[S].style.display !== "none" && g++;
return g;
const h = Array.from(i.parentNode.childNodes);
let b = 0;
for (let F = 0; F < i.cellIndex; F++)
h[F].style.display !== "none" && b++;
return b;
};
ne(() => {
const c = () => {
ie(() => {
const i = () => {
var h;
if (r.current) {
const g = f((h = r.current) == null ? void 0 : h.parentNode), S = y(r.current);
if (g) {
let m = -10;
S / g > 0.33 ? m = Math.max(~~(r.current.cellIndex * -9 * e) / g, -9 * e) : m = Math.max(~~r.current.cellIndex * -30 * e / g, -10), d(m);
const b = d((h = r.current) == null ? void 0 : h.parentNode), F = y(r.current);
if (b) {
let D = -10;
F / b > 0.33 ? D = Math.max(~~(r.current.cellIndex * -9 * e) / b, -9 * e) : D = Math.max(~~r.current.cellIndex * -30 * e / b, -10), f(D);
}
}
};
return r.current && r.current.addEventListener("mouseover", c), () => {
r.current && r.current.removeEventListener("mouseover", c);
return r.current && r.current.addEventListener("mouseover", i), () => {
r.current && r.current.removeEventListener("mouseover", i);
};
}, []);
const p = (c) => {
const h = typeof c == "string" ? !1 : c.isTextTheme || !1;
return c === "emoji_positive" || c === "emoji_negative" || h;
const p = (i) => {
const h = typeof i == "string" ? !1 : i.isTextTheme || !1;
return i === "emoji_positive" || i === "emoji_negative" || h;
};

@@ -435,13 +447,13 @@ return /* @__PURE__ */ u(

ref: r,
className: "calendar-cell top half-arrow",
className: `${H.calendarCell} ${H.top}`,
style: {
...a,
...o,
outline: p(l) ? "transparent" : "1px solid rgba(27, 31, 35, 0.06)",
backgroundColor: p(l) ? "transparent" : n[`level${t}`],
"--tooltip-offset": `${v}px`,
fontSize: i
fontSize: c
},
"data-tooltip": s,
"data-level": t,
...o,
...a,
children: p(l) ? n[`level${t}`] : void 0

@@ -451,3 +463,8 @@ }

}
function be({
const Ce = "_tbody_102pu_1", Ae = "_tr_102pu_6", Oe = "_td_102pu_12", T = {
tbody: Ce,
tr: Ae,
td: Oe
};
function Le({
data: e,

@@ -457,26 +474,27 @@ start: l,

daysOfTheWeek: t,
textColor: a,
textColor: o,
startsOnSunday: s,
includeBoundary: i,
cx: o,
includeBoundary: c,
cx: a,
cy: r,
cr: v,
theme: d,
onClick: f
theme: f,
onClick: d
}) {
const { year: y, day: p } = _(l), { day: c } = _(n), { row: h, col: g } = A(y, l, s), { row: S, col: m } = A(y, n, s), O = W(l, n, s), { colSpans: j } = H(l, n, O, s), x = L(d), P = de(e), q = (D, b) => b == m + 1 && j[j.length - 1] === 1, X = (D, b) => b < g || b > m, G = (D, b) => b === g && D < h || b === m && D > S, $ = () => g === m || c - p <= 7, K = s ? t : (() => {
const D = [...t];
return D.push(D.shift() || ""), D;
const { year: y, day: p } = A(l), { day: i } = A(n), { row: h, col: b } = O(y, l, s), { row: F, col: D } = O(y, n, s), I = K(l, n, s), { colSpans: x } = Q(l, n, I, s), W = X(f), U = me(e), Z = (m, g) => g == D + 1 && x[x.length - 1] === 1, ee = (m, g) => g < b || g > D, le = (m, g) => g === b && m < h || g === D && m > F, C = () => b === D || i - p <= 7, te = s ? t : (() => {
const m = [...t];
return m.push(m.shift() || ""), m;
})();
return /* @__PURE__ */ u("tbody", { children: K.map((D, b) => /* @__PURE__ */ N("tr", { children: [
/* @__PURE__ */ u(B, { tabIndex: 0, textColor: a, style: { textAlign: "left", fontSize: r, lineHeight: 0 }, children: D }),
O[b].map((I, F) => {
if (m === 0 && F === 1)
return /* @__PURE__ */ u("tbody", { className: T.tbody, children: te.map((m, g) => /* @__PURE__ */ $("tr", { className: T.tr, children: [
/* @__PURE__ */ u(q, { tabIndex: 0, textColor: o, style: { textAlign: "left", fontSize: r, lineHeight: 0 }, children: m }),
I[g].map((B, _) => {
if (D === 0 && _ === 1)
return /* @__PURE__ */ u(
"td",
{
className: T.td,
style: {
padding: 0,
width: $() ? o : 0,
height: $() ? r : 0,
width: C() ? a : 0,
height: C() ? r : 0,
outline: "none",

@@ -488,15 +506,16 @@ borderRadius: v,

},
F
_
);
if (q(b, F))
return /* @__PURE__ */ u("td", { style: { padding: "0", display: "block" } }, F);
if (G(b, F))
if (Z(g, _))
return /* @__PURE__ */ u("td", { className: T.td, style: { padding: "0", display: "block" } }, _);
if (le(g, _))
return /* @__PURE__ */ u(
"td",
{
className: T.td,
style: {
padding: 0,
width: $() ? o : 0,
height: $() ? r : 0,
outline: i ? `1px solid ${x.level0}` : "none",
width: C() ? a : 0,
height: C() ? r : 0,
outline: c ? `1px solid ${W.level0}` : "none",
borderRadius: v,

@@ -507,89 +526,98 @@ outlineOffset: "-1px",

},
F
_
);
if (X(b, F))
return /* @__PURE__ */ u("td", { style: { padding: "0", display: "none" } }, F);
const w = P.get(I), Q = se(I), U = (Z) => {
const ee = {
date: I,
if (ee(g, _))
return /* @__PURE__ */ u("td", { className: T.td, style: { padding: "0", display: "none" } }, _);
const w = U.get(B), ne = ye(B), re = (ae) => {
const oe = {
date: B,
data: w == null ? void 0 : w.data
};
f && f(Z, ee);
d && d(ae, oe);
};
return /* @__PURE__ */ u(
ge,
Ee,
{
cx: o,
cx: a,
tabIndex: -1,
style: { width: o, height: r, borderRadius: v },
style: { width: a, height: r, borderRadius: v },
dataLevel: w !== void 0 ? w.level : 0,
"data-content": JSON.stringify(w == null ? void 0 : w.data),
dataTooltip: Q,
dataTooltip: ne,
tooltipSize: r,
theme: d,
themeProps: x,
onClick: U
theme: f,
themeProps: W,
onClick: re
},
F
_
);
})
] }, `${D}-${b}`)) });
] }, `${m}-${g}`)) });
}
function De({ textColor: e, cx: l, cy: n, theme: t }) {
const a = L(t), s = `4px ${l + 72}px 0 0`, i = (r) => {
const Ie = "_description_1fqsg_1", Be = "_themes_1fqsg_7", Ye = "_cell_1fqsg_15", S = {
description: Ie,
themes: Be,
cell: Ye
};
function je({ textColor: e, cx: l, cy: n, theme: t }) {
const o = X(t), s = `4px ${l + 72}px 0 0`, c = (r) => {
const v = typeof r == "string" ? !1 : r.isTextTheme || !1;
return r === "emoji_positive" || r === "emoji_negative" || v;
}, o = (r, v) => i(r) ? { width: l, height: n, fontSize: l } : { width: l, height: n, backgroundColor: a[`level${v}`], outline: "1px solid #1b1f230f" };
return /* @__PURE__ */ u("div", { className: "description", style: { padding: s }, children: /* @__PURE__ */ N("div", { className: "themes", children: [
}, a = (r, v) => c(r) ? { width: l, height: n, fontSize: l } : { width: l, height: n, backgroundColor: o[`level${v}`], outline: "1px solid #1b1f230f" };
return /* @__PURE__ */ u("div", { className: S.description, style: { padding: s }, children: /* @__PURE__ */ $("div", { className: S.themes, children: [
/* @__PURE__ */ u("span", { style: { color: e, fontSize: l }, children: "Less" }),
/* @__PURE__ */ u("div", { className: "cell", style: { ...o(t, 0) }, children: i(t) ? a.level0 : void 0 }),
/* @__PURE__ */ u("div", { className: "cell", style: { ...o(t, 1) }, children: i(t) ? a.level1 : void 0 }),
/* @__PURE__ */ u("div", { className: "cell", style: { ...o(t, 2) }, children: i(t) ? a.level2 : void 0 }),
/* @__PURE__ */ u("div", { className: "cell", style: { ...o(t, 3) }, children: i(t) ? a.level3 : void 0 }),
/* @__PURE__ */ u("div", { className: "cell", style: { ...o(t, 4) }, children: i(t) ? a.level4 : void 0 }),
/* @__PURE__ */ u("div", { className: S.cell, style: { ...a(t, 0) }, children: c(t) ? o.level0 : void 0 }),
/* @__PURE__ */ u("div", { className: S.cell, style: { ...a(t, 1) }, children: c(t) ? o.level1 : void 0 }),
/* @__PURE__ */ u("div", { className: S.cell, style: { ...a(t, 2) }, children: c(t) ? o.level2 : void 0 }),
/* @__PURE__ */ u("div", { className: S.cell, style: { ...a(t, 3) }, children: c(t) ? o.level3 : void 0 }),
/* @__PURE__ */ u("div", { className: S.cell, style: { ...a(t, 4) }, children: c(t) ? o.level4 : void 0 }),
/* @__PURE__ */ u("span", { style: { color: e, fontSize: l }, children: "More" })
] }) });
}
const C = (e, l) => {
const qe = "_container_1dwvo_15", Je = "_calendar_1dwvo_19", xe = "_table_1dwvo_25", j = {
container: qe,
calendar: Je,
table: xe
}, L = (e, l) => {
const n = new Error(l);
return n.name = e, n;
};
var k = /* @__PURE__ */ ((e) => (e.Number = "Number Error", e.String = "String Error", e.Date = "Date Error", e))(k || {});
const R = (e) => {
var E = /* @__PURE__ */ ((e) => (e.Number = "Number Error", e.String = "String Error", e.Date = "Date Error", e))(E || {});
const P = (e) => {
if (!/^\d{4}-\d{2}-\d{2}$/.test(e))
throw C(k.Date, `Invalid date string ${e}. The date string should be 'YYYY-MM-DD' format.`);
throw L(E.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 C(k.Date, `Invalid date string ${e}. Please check the date.`);
throw L(E.Date, `Invalid date string ${e}. Please check the date.`);
}
}, me = (e, l) => {
}, We = (e, l) => {
if (e > l)
throw C(k.Date, "The starting date should be earlier than the ending date.");
}, Fe = (e) => {
throw L(E.Date, "The starting date should be earlier than the ending date.");
}, ze = (e) => {
if (e.length !== 7)
throw C(k.Number, "The length of the `daysOfTheWeek` should be exact 7.");
throw L(E.Number, "The length of the `daysOfTheWeek` should be exact 7.");
};
function $e({
function Qe({
data: e = [],
start: l = J(E(), 0, 1),
end: n = J(E(), 11, 31),
start: l = R(k(), 0, 1),
end: n = R(k(), 11, 31),
daysOfTheWeek: t = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
textColor: a = "#1f2328",
textColor: o = "#1f2328",
startsOnSunday: s = !0,
includeBoundary: i = !0,
cx: o = 10,
includeBoundary: c = !0,
cx: a = 10,
cy: r = 10,
cr: v = 2,
theme: d = "grass",
onCellClick: f = (c, h) => console.log(h),
theme: f = "grass",
onCellClick: d = (i, h) => console.log(h),
scroll: y = !1,
style: p
}) {
const c = `0 ${o + 70}px 0 ${o + 10}px`;
return R(l), R(n), me(l, n), Fe(t), /* @__PURE__ */ N("div", { className: "container", style: p, children: [
/* @__PURE__ */ u("div", { className: "calendar", style: { padding: c, overflowX: y ? "scroll" : "clip" }, children: /* @__PURE__ */ N("table", { children: [
/* @__PURE__ */ u(pe, { start: l, end: n, textColor: a, startsOnSunday: s, cy: r }),
const i = `0 ${a + 70}px 0 ${a + 10}px`;
return P(l), P(n), We(l, n), ze(t), /* @__PURE__ */ $("div", { className: j.container, style: p, children: [
/* @__PURE__ */ u("div", { className: j.calendar, style: { padding: i, overflowX: y ? "scroll" : "clip" }, children: /* @__PURE__ */ $("table", { className: j.table, children: [
/* @__PURE__ */ u(Me, { start: l, end: n, textColor: o, startsOnSunday: s, cy: r }),
/* @__PURE__ */ u(
be,
Le,
{

@@ -600,38 +628,38 @@ data: e,

daysOfTheWeek: t,
textColor: a,
textColor: o,
startsOnSunday: s,
includeBoundary: i,
cx: o,
includeBoundary: c,
cx: a,
cy: r,
cr: v,
theme: d,
onClick: f
theme: f,
onClick: d
}
)
] }) }),
/* @__PURE__ */ u(De, { textColor: a, cx: o, cy: r, theme: d })
/* @__PURE__ */ u(je, { textColor: o, cx: a, cy: r, theme: f })
] });
}
export {
$e as ContributionCalendar,
L as createTheme,
Te as getArraySum,
ke as getColumnSpansForYears,
E as getCurrentYear,
ae as getDateDetails,
J as getDateString,
se as getDateTooltip,
W as getDayArray,
fe as getDayIndexFromDateString,
Ne as getDayIndexOfMonth,
ye as getDaysBetween,
T as getFirstDayIndexOfYear,
H as getMonthsAndColSpans,
A as getRowAndColumnIndexFromDate,
ce as isLeapYear,
_ as parseDateFromDateString,
Ee as parseDayFromDateString,
de as parseInputData,
z as parseMonthFromDateString,
M as parseYearFromDateString
Qe as ContributionCalendar,
X as createTheme,
Pe as getArraySum,
Ke as getColumnSpansForYears,
k as getCurrentYear,
he as getDateDetails,
R as getDateString,
ye as getDateTooltip,
K as getDayArray,
ge as getDayIndexFromDateString,
Ge as getDayIndexOfMonth,
we as getDaysBetween,
M as getFirstDayIndexOfYear,
Q as getMonthsAndColSpans,
O as getRowAndColumnIndexFromDate,
be as isLeapYear,
A as parseDateFromDateString,
Xe as parseDayFromDateString,
me as parseInputData,
V as parseMonthFromDateString,
N as parseYearFromDateString
};

@@ -1,2 +0,2 @@

// Type definitions for react-contribution-calendar 1.4.0
// Type definitions for react-contribution-calendar 1.5.0
// Project: https://github.com/SeiwonPark/react-contribution-calendar

@@ -199,3 +199,3 @@ // Definitions by: Seiwon Park <https://github.com/SeiwonPark>

*
* @version 1.4.0
* @version 1.5.0
* @see {@link https://github.com/SeiwonPark/react-contribution-calendar#apis}

@@ -202,0 +202,0 @@ */

{
"name": "react-contribution-calendar",
"description": "A GitHub-like contribution calendar component for React",
"version": "1.4.0",
"version": "1.5.0",
"type": "module",

@@ -11,4 +11,3 @@ "main": "./dist/index.js",

"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
},

@@ -15,0 +14,0 @@ "files": [

@@ -22,3 +22,2 @@ # react-contribution-calendar

- [codepen](https://codepen.io/yaeheechoe/pen/wvRwJbP)
- [codesandbox](https://codesandbox.io/p/sandbox/react-contribution-calendar-sxn32g)

@@ -25,0 +24,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc