@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.mjs
CHANGED
|
@@ -5968,11 +5968,7 @@ function useResponsiveChart({
|
|
|
5968
5968
|
height = providedHeight || defaultHeight;
|
|
5969
5969
|
effectiveAspectRatio = width / height;
|
|
5970
5970
|
}
|
|
5971
|
-
const containerStyle = responsive ? {
|
|
5972
|
-
width: "100%",
|
|
5973
|
-
aspectRatio: `${effectiveAspectRatio}`,
|
|
5974
|
-
...maxHeight !== void 0 && { maxHeight, overflow: "hidden" }
|
|
5975
|
-
} : { width, height: "auto" };
|
|
5971
|
+
const containerStyle = responsive ? maxHeight !== void 0 ? { width: "100%", height: maxHeight } : { width: "100%", aspectRatio: `${effectiveAspectRatio}` } : { width, height: "auto" };
|
|
5976
5972
|
const svgStyle = responsive ? { width: "100%", height: "100%", display: "block" } : {};
|
|
5977
5973
|
const svgWidth = responsive ? "100%" : width;
|
|
5978
5974
|
const svgHeight = responsive ? "100%" : height;
|
|
@@ -6182,47 +6178,38 @@ function formatPercent(value, options = {}) {
|
|
|
6182
6178
|
const percent = multiply ? value * 100 : value;
|
|
6183
6179
|
return `${percent.toFixed(precision)}%`;
|
|
6184
6180
|
}
|
|
6181
|
+
var MONTHS4 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
6182
|
+
function formatTimeUTC(date, showSeconds = false) {
|
|
6183
|
+
const hours = date.getUTCHours();
|
|
6184
|
+
const minutes = date.getUTCMinutes().toString().padStart(2, "0");
|
|
6185
|
+
const seconds = date.getUTCSeconds().toString().padStart(2, "0");
|
|
6186
|
+
const ampm = hours >= 12 ? "PM" : "AM";
|
|
6187
|
+
const hour12 = hours % 12 || 12;
|
|
6188
|
+
const hourStr = hour12.toString().padStart(2, "0");
|
|
6189
|
+
return showSeconds ? `${hourStr}:${minutes}:${seconds} ${ampm}` : `${hourStr}:${minutes} ${ampm}`;
|
|
6190
|
+
}
|
|
6185
6191
|
function formatDate(date, rangeMs) {
|
|
6186
6192
|
const minute = 60 * 1e3;
|
|
6187
6193
|
const hour = 60 * minute;
|
|
6188
6194
|
const day = 24 * hour;
|
|
6189
6195
|
const month = 30 * day;
|
|
6190
6196
|
const year = 365 * day;
|
|
6197
|
+
const monthName = MONTHS4[date.getUTCMonth()];
|
|
6198
|
+
const dayNum = date.getUTCDate();
|
|
6199
|
+
const yearNum = date.getUTCFullYear();
|
|
6191
6200
|
if (!rangeMs) {
|
|
6192
|
-
return
|
|
6193
|
-
month: "short",
|
|
6194
|
-
day: "numeric",
|
|
6195
|
-
year: "numeric"
|
|
6196
|
-
});
|
|
6201
|
+
return `${monthName} ${dayNum}, ${yearNum}`;
|
|
6197
6202
|
}
|
|
6198
6203
|
if (rangeMs < hour) {
|
|
6199
|
-
return date
|
|
6200
|
-
hour: "2-digit",
|
|
6201
|
-
minute: "2-digit",
|
|
6202
|
-
second: "2-digit"
|
|
6203
|
-
});
|
|
6204
|
+
return formatTimeUTC(date, true);
|
|
6204
6205
|
} else if (rangeMs < day) {
|
|
6205
|
-
return date
|
|
6206
|
-
hour: "2-digit",
|
|
6207
|
-
minute: "2-digit"
|
|
6208
|
-
});
|
|
6206
|
+
return formatTimeUTC(date, false);
|
|
6209
6207
|
} else if (rangeMs < month) {
|
|
6210
|
-
return date
|
|
6211
|
-
month: "short",
|
|
6212
|
-
day: "numeric",
|
|
6213
|
-
hour: "2-digit",
|
|
6214
|
-
minute: "2-digit"
|
|
6215
|
-
});
|
|
6208
|
+
return `${monthName} ${dayNum}, ${formatTimeUTC(date, false)}`;
|
|
6216
6209
|
} else if (rangeMs < year) {
|
|
6217
|
-
return
|
|
6218
|
-
month: "short",
|
|
6219
|
-
day: "numeric"
|
|
6220
|
-
});
|
|
6210
|
+
return `${monthName} ${dayNum}`;
|
|
6221
6211
|
} else {
|
|
6222
|
-
return
|
|
6223
|
-
month: "short",
|
|
6224
|
-
year: "numeric"
|
|
6225
|
-
});
|
|
6212
|
+
return `${monthName} ${yearNum}`;
|
|
6226
6213
|
}
|
|
6227
6214
|
}
|
|
6228
6215
|
function createTickFormatter(domain) {
|