@marcoschwartz/lite-ui 0.26.1 → 0.26.3
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 +20 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6144,11 +6144,7 @@ function useResponsiveChart({
|
|
|
6144
6144
|
height = providedHeight || defaultHeight;
|
|
6145
6145
|
effectiveAspectRatio = width / height;
|
|
6146
6146
|
}
|
|
6147
|
-
const containerStyle = responsive ? {
|
|
6148
|
-
width: "100%",
|
|
6149
|
-
aspectRatio: `${effectiveAspectRatio}`,
|
|
6150
|
-
...maxHeight !== void 0 && { maxHeight, overflow: "hidden" }
|
|
6151
|
-
} : { width, height: "auto" };
|
|
6147
|
+
const containerStyle = responsive ? maxHeight !== void 0 ? { width: "100%", height: maxHeight } : { width: "100%", aspectRatio: `${effectiveAspectRatio}` } : { width, height: "auto" };
|
|
6152
6148
|
const svgStyle = responsive ? { width: "100%", height: "100%", display: "block" } : {};
|
|
6153
6149
|
const svgWidth = responsive ? "100%" : width;
|
|
6154
6150
|
const svgHeight = responsive ? "100%" : height;
|
|
@@ -6358,47 +6354,38 @@ function formatPercent(value, options = {}) {
|
|
|
6358
6354
|
const percent = multiply ? value * 100 : value;
|
|
6359
6355
|
return `${percent.toFixed(precision)}%`;
|
|
6360
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
|
+
}
|
|
6361
6367
|
function formatDate(date, rangeMs) {
|
|
6362
6368
|
const minute = 60 * 1e3;
|
|
6363
6369
|
const hour = 60 * minute;
|
|
6364
6370
|
const day = 24 * hour;
|
|
6365
6371
|
const month = 30 * day;
|
|
6366
6372
|
const year = 365 * day;
|
|
6373
|
+
const monthName = MONTHS4[date.getUTCMonth()];
|
|
6374
|
+
const dayNum = date.getUTCDate();
|
|
6375
|
+
const yearNum = date.getUTCFullYear();
|
|
6367
6376
|
if (!rangeMs) {
|
|
6368
|
-
return
|
|
6369
|
-
month: "short",
|
|
6370
|
-
day: "numeric",
|
|
6371
|
-
year: "numeric"
|
|
6372
|
-
});
|
|
6377
|
+
return `${monthName} ${dayNum}, ${yearNum}`;
|
|
6373
6378
|
}
|
|
6374
6379
|
if (rangeMs < hour) {
|
|
6375
|
-
return date
|
|
6376
|
-
hour: "2-digit",
|
|
6377
|
-
minute: "2-digit",
|
|
6378
|
-
second: "2-digit"
|
|
6379
|
-
});
|
|
6380
|
+
return formatTimeUTC(date, true);
|
|
6380
6381
|
} else if (rangeMs < day) {
|
|
6381
|
-
return date
|
|
6382
|
-
hour: "2-digit",
|
|
6383
|
-
minute: "2-digit"
|
|
6384
|
-
});
|
|
6382
|
+
return formatTimeUTC(date, false);
|
|
6385
6383
|
} else if (rangeMs < month) {
|
|
6386
|
-
return date
|
|
6387
|
-
month: "short",
|
|
6388
|
-
day: "numeric",
|
|
6389
|
-
hour: "2-digit",
|
|
6390
|
-
minute: "2-digit"
|
|
6391
|
-
});
|
|
6384
|
+
return `${monthName} ${dayNum}, ${formatTimeUTC(date, false)}`;
|
|
6392
6385
|
} else if (rangeMs < year) {
|
|
6393
|
-
return
|
|
6394
|
-
month: "short",
|
|
6395
|
-
day: "numeric"
|
|
6396
|
-
});
|
|
6386
|
+
return `${monthName} ${dayNum}`;
|
|
6397
6387
|
} else {
|
|
6398
|
-
return
|
|
6399
|
-
month: "short",
|
|
6400
|
-
year: "numeric"
|
|
6401
|
-
});
|
|
6388
|
+
return `${monthName} ${yearNum}`;
|
|
6402
6389
|
}
|
|
6403
6390
|
}
|
|
6404
6391
|
function createTickFormatter(domain) {
|