@marcoschwartz/lite-ui 0.26.2 → 0.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +22 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6354,47 +6354,38 @@ function formatPercent(value, options = {}) {
|
|
|
6354
6354
|
const percent = multiply ? value * 100 : value;
|
|
6355
6355
|
return `${percent.toFixed(precision)}%`;
|
|
6356
6356
|
}
|
|
6357
|
+
var MONTHS4 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
6358
|
+
function formatTimeUTC(date, showSeconds = false) {
|
|
6359
|
+
const hours = date.getUTCHours();
|
|
6360
|
+
const minutes = date.getUTCMinutes().toString().padStart(2, "0");
|
|
6361
|
+
const seconds = date.getUTCSeconds().toString().padStart(2, "0");
|
|
6362
|
+
const ampm = hours >= 12 ? "PM" : "AM";
|
|
6363
|
+
const hour12 = hours % 12 || 12;
|
|
6364
|
+
const hourStr = hour12.toString().padStart(2, "0");
|
|
6365
|
+
return showSeconds ? `${hourStr}:${minutes}:${seconds} ${ampm}` : `${hourStr}:${minutes} ${ampm}`;
|
|
6366
|
+
}
|
|
6357
6367
|
function formatDate(date, rangeMs) {
|
|
6358
6368
|
const minute = 60 * 1e3;
|
|
6359
6369
|
const hour = 60 * minute;
|
|
6360
6370
|
const day = 24 * hour;
|
|
6361
6371
|
const month = 30 * day;
|
|
6362
6372
|
const year = 365 * day;
|
|
6373
|
+
const monthName = MONTHS4[date.getUTCMonth()];
|
|
6374
|
+
const dayNum = date.getUTCDate();
|
|
6375
|
+
const yearNum = date.getUTCFullYear();
|
|
6363
6376
|
if (!rangeMs) {
|
|
6364
|
-
return
|
|
6365
|
-
month: "short",
|
|
6366
|
-
day: "numeric",
|
|
6367
|
-
year: "numeric"
|
|
6368
|
-
});
|
|
6377
|
+
return `${monthName} ${dayNum}, ${yearNum}`;
|
|
6369
6378
|
}
|
|
6370
6379
|
if (rangeMs < hour) {
|
|
6371
|
-
return date
|
|
6372
|
-
hour: "2-digit",
|
|
6373
|
-
minute: "2-digit",
|
|
6374
|
-
second: "2-digit"
|
|
6375
|
-
});
|
|
6380
|
+
return formatTimeUTC(date, true);
|
|
6376
6381
|
} else if (rangeMs < day) {
|
|
6377
|
-
return date
|
|
6378
|
-
hour: "2-digit",
|
|
6379
|
-
minute: "2-digit"
|
|
6380
|
-
});
|
|
6382
|
+
return formatTimeUTC(date, false);
|
|
6381
6383
|
} else if (rangeMs < month) {
|
|
6382
|
-
return date
|
|
6383
|
-
month: "short",
|
|
6384
|
-
day: "numeric",
|
|
6385
|
-
hour: "2-digit",
|
|
6386
|
-
minute: "2-digit"
|
|
6387
|
-
});
|
|
6384
|
+
return `${monthName} ${dayNum}, ${formatTimeUTC(date, false)}`;
|
|
6388
6385
|
} else if (rangeMs < year) {
|
|
6389
|
-
return
|
|
6390
|
-
month: "short",
|
|
6391
|
-
day: "numeric"
|
|
6392
|
-
});
|
|
6386
|
+
return `${monthName} ${dayNum}`;
|
|
6393
6387
|
} else {
|
|
6394
|
-
return
|
|
6395
|
-
month: "short",
|
|
6396
|
-
year: "numeric"
|
|
6397
|
-
});
|
|
6388
|
+
return `${monthName} ${yearNum}`;
|
|
6398
6389
|
}
|
|
6399
6390
|
}
|
|
6400
6391
|
function createTickFormatter(domain) {
|
|
@@ -7975,6 +7966,7 @@ var AreaChart = ({
|
|
|
7975
7966
|
ariaLabel
|
|
7976
7967
|
}) => {
|
|
7977
7968
|
const containerRef = (0, import_react33.useRef)(null);
|
|
7969
|
+
const chartId = (0, import_react33.useId)();
|
|
7978
7970
|
const [hoveredPoint, setHoveredPoint] = (0, import_react33.useState)(null);
|
|
7979
7971
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
7980
7972
|
const {
|
|
@@ -8217,7 +8209,7 @@ var AreaChart = ({
|
|
|
8217
8209
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
8218
8210
|
"linearGradient",
|
|
8219
8211
|
{
|
|
8220
|
-
id: `area-gradient-${i}`,
|
|
8212
|
+
id: `area-gradient-${chartId}-${i}`,
|
|
8221
8213
|
x1: "0",
|
|
8222
8214
|
y1: "0",
|
|
8223
8215
|
x2: "0",
|
|
@@ -8260,7 +8252,7 @@ var AreaChart = ({
|
|
|
8260
8252
|
"path",
|
|
8261
8253
|
{
|
|
8262
8254
|
d: areaPath,
|
|
8263
|
-
fill: `url(#area-gradient-${seriesIndex})`,
|
|
8255
|
+
fill: `url(#area-gradient-${chartId}-${seriesIndex})`,
|
|
8264
8256
|
style: animate ? {
|
|
8265
8257
|
opacity: 0,
|
|
8266
8258
|
animation: `fadeIn ${animationDuration}ms ease-out forwards`
|