laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
48 lines (47 loc) • 1.92 kB
JavaScript
"use client";
import H, { copy as I } from "./continuous.js";
import { initRange as T } from "./init.js";
import x from "./nice.js";
import { timeFormat as A } from "../../d3-time-format/src/defaultLocale.js";
import { second as B } from "../../d3-time/src/second.js";
import { timeMinute as L } from "../../d3-time/src/minute.js";
import { timeHour as R } from "../../d3-time/src/hour.js";
import { timeDay as W } from "../../d3-time/src/day.js";
import { timeSunday as j } from "../../d3-time/src/week.js";
import { timeMonth as q } from "../../d3-time/src/month.js";
import { timeYear as v } from "../../d3-time/src/year.js";
import { timeTickInterval as z, timeTicks as C } from "../../d3-time/src/ticks.js";
function E(i) {
return new Date(i);
}
function G(i) {
return i instanceof Date ? +i : +/* @__PURE__ */ new Date(+i);
}
function D(i, u, e, f, c, p, a, l, s, t) {
var r = H(), g = r.invert, m = r.domain, y = t(".%L"), M = t(":%S"), w = t("%I:%M"), h = t("%I %p"), k = t("%a %d"), F = t("%b %d"), S = t("%B"), Y = t("%Y");
function b(n) {
return (s(n) < n ? y : l(n) < n ? M : a(n) < n ? w : p(n) < n ? h : f(n) < n ? c(n) < n ? k : F : e(n) < n ? S : Y)(n);
}
return r.invert = function(n) {
return new Date(g(n));
}, r.domain = function(n) {
return arguments.length ? m(Array.from(n, G)) : m().map(E);
}, r.ticks = function(n) {
var o = m();
return i(o[0], o[o.length - 1], n ?? 10);
}, r.tickFormat = function(n, o) {
return o == null ? b : t(o);
}, r.nice = function(n) {
var o = m();
return (!n || typeof n.range != "function") && (n = u(o[0], o[o.length - 1], n ?? 10)), n ? m(x(o, n)) : r;
}, r.copy = function() {
return I(r, D(i, u, e, f, c, p, a, l, s, t));
}, r;
}
function d() {
return T.apply(D(C, z, v, q, j, W, R, L, B, A).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments);
}
export {
D as calendar,
d as default
};