@krizaka/ui 3.33.1 → 3.34.0
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/date-picker.js +17 -2
- package/dist/date-picker.js.map +1 -1
- package/dist/map.d.ts +5 -1
- package/dist/map.js +13 -7
- package/dist/map.js.map +1 -1
- package/dist/motion.css +1 -1
- package/dist/number-ticker.d.ts +7 -3
- package/dist/number-ticker.js +24 -11
- package/dist/number-ticker.js.map +1 -1
- package/dist/terminal-replay.d.ts +6 -1
- package/dist/terminal-replay.js +6 -3
- package/dist/terminal-replay.js.map +1 -1
- package/package.json +5 -5
- package/registry/date-picker.json +1 -1
- package/registry/index.json +5 -5
- package/registry/map.json +30 -2
- package/registry/nav-bar.json +1 -1
- package/registry/number-ticker.json +19 -5
- package/registry/rail-nav.json +1 -1
- package/registry/site-footer.json +1 -1
- package/registry/terminal-replay.json +15 -1
package/dist/date-picker.js
CHANGED
|
@@ -942,14 +942,29 @@ function DayStrip({ label, locale, value: valueProp, defaultValue = null, onValu
|
|
|
942
942
|
const reduce = usePrefersReducedMotion();
|
|
943
943
|
const weekday = getDateTimeFormat3(locale, { weekday: "short" });
|
|
944
944
|
const monthTitle = getDateTimeFormat3(locale, { month: "long", year: "numeric" }).format(toLocalDate(value ?? first));
|
|
945
|
+
const scrollTrackTo = (el, where, smooth) => {
|
|
946
|
+
const strip = track.current;
|
|
947
|
+
if (!strip) return;
|
|
948
|
+
const box = el.getBoundingClientRect();
|
|
949
|
+
const frame = strip.getBoundingClientRect();
|
|
950
|
+
const offset = box.left - frame.left;
|
|
951
|
+
let left = strip.scrollLeft;
|
|
952
|
+
if (where === "center") left += offset - (strip.clientWidth - box.width) / 2;
|
|
953
|
+
else if (offset < 0) left += offset;
|
|
954
|
+
else if (offset + box.width > strip.clientWidth) left += offset + box.width - strip.clientWidth;
|
|
955
|
+
if (left === strip.scrollLeft) return;
|
|
956
|
+
if (typeof strip.scrollTo === "function") strip.scrollTo({ left, behavior: smooth ? "smooth" : "auto" });
|
|
957
|
+
else strip.scrollLeft = left;
|
|
958
|
+
};
|
|
945
959
|
const reveal = (iso, focus) => {
|
|
946
960
|
const el = track.current?.querySelector(`[data-date="${iso}"]`);
|
|
947
961
|
if (!el) return;
|
|
948
962
|
if (focus) el.focus({ preventScroll: true });
|
|
949
|
-
el
|
|
963
|
+
scrollTrackTo(el, "nearest", !reduce);
|
|
950
964
|
};
|
|
951
965
|
React6.useEffect(() => {
|
|
952
|
-
|
|
966
|
+
const el = value ? track.current?.querySelector(`[data-date="${value}"]`) : null;
|
|
967
|
+
if (el) scrollTrackTo(el, "center", false);
|
|
953
968
|
}, []);
|
|
954
969
|
const onKeyDown = (event) => {
|
|
955
970
|
const i = enabled.indexOf(tabStop ?? "");
|