@helpwave/hightide 0.5.2 → 0.5.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.mjs CHANGED
@@ -7455,7 +7455,14 @@ var DayPicker = ({
7455
7455
  "border-transparent": !(isToday && markToday)
7456
7456
  }
7457
7457
  ),
7458
- onClick: () => onChange?.(date),
7458
+ onClick: () => onChange?.(new Date(
7459
+ date.getFullYear(),
7460
+ date.getMonth(),
7461
+ date.getDate(),
7462
+ selected.getHours(),
7463
+ selected.getMinutes(),
7464
+ selected.getSeconds()
7465
+ )),
7459
7466
  children: date.getDate()
7460
7467
  },
7461
7468
  date.getDate()
@@ -8871,8 +8878,11 @@ function useFloatingElement({
8871
8878
  const [style, setStyle] = useState12();
8872
8879
  const isMounted = useIsMounted();
8873
8880
  const calculate = useCallback5(() => {
8874
- const containerRect = containerRef.current.getBoundingClientRect();
8875
- const windowRect = windowRef?.current.getBoundingClientRect() ?? {
8881
+ const containerRect = containerRef.current?.getBoundingClientRect();
8882
+ if (!containerRect) {
8883
+ return;
8884
+ }
8885
+ const windowRect = windowRef?.current?.getBoundingClientRect() ?? {
8876
8886
  top: 0,
8877
8887
  bottom: window.innerHeight,
8878
8888
  left: 0,
@@ -8908,6 +8918,9 @@ function useFloatingElement({
8908
8918
  }
8909
8919
  }, [calculate, active, isMounted, height, width]);
8910
8920
  useEffect13(() => {
8921
+ if (!containerRef.current && active) {
8922
+ return;
8923
+ }
8911
8924
  window.addEventListener("resize", calculate);
8912
8925
  let timeout;
8913
8926
  if (isPolling) {
@@ -8919,7 +8932,7 @@ function useFloatingElement({
8919
8932
  clearInterval(timeout);
8920
8933
  }
8921
8934
  };
8922
- }, [calculate, isPolling, pollingInterval]);
8935
+ }, [active, calculate, containerRef, isPolling, pollingInterval]);
8923
8936
  return style;
8924
8937
  }
8925
8938
 
@@ -13862,7 +13875,7 @@ var DateTimeInput = ({
13862
13875
  Input,
13863
13876
  {
13864
13877
  ...cleanInputProps,
13865
- placeholder: translation("clickToAdd"),
13878
+ placeholder: translation("clickToSelect"),
13866
13879
  value: date ? DateUtils.formatAbsolute(date, locale, mode === "dateTime") : "",
13867
13880
  onClick: (event) => {
13868
13881
  setIsOpen(true);
@@ -13942,7 +13955,7 @@ var DateTimeInputUncontrolled = ({
13942
13955
  date: initialDate,
13943
13956
  ...props
13944
13957
  }) => {
13945
- const [date, setDate] = useOverwritableState(useMemo8(() => initialDate ?? /* @__PURE__ */ new Date(), [initialDate]));
13958
+ const [date, setDate] = useOverwritableState(initialDate);
13946
13959
  return /* @__PURE__ */ jsx65(
13947
13960
  DateTimeInput,
13948
13961
  {
@@ -13953,7 +13966,7 @@ var DateTimeInputUncontrolled = ({
13953
13966
  props.onValueChange?.(newDate);
13954
13967
  },
13955
13968
  onRemove: () => {
13956
- setDate(/* @__PURE__ */ new Date());
13969
+ setDate(void 0);
13957
13970
  props.onRemove?.();
13958
13971
  }
13959
13972
  }