@entur/datepicker 11.8.1 → 12.0.0-next.1

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.
@@ -1,6 +1,6 @@
1
- import { useRandomId, ConditionalWrapper, mergeRefs, useWindowDimensions, useOnClickOutside, useOnEscape, useOnMount, warnAboutMissingStyles } from "@entur/utils";
1
+ import { ConditionalWrapper, mergeRefs, useWindowDimensions, useOnClickOutside, useOnEscape, useOnMount, warnAboutMissingStyles } from "@entur/utils";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
- import React, { useRef, useEffect, useState } from "react";
3
+ import React, { useRef, useEffect, useId, useState } from "react";
4
4
  import { useDateFieldState, useDatePickerState, useTimeFieldState } from "@react-stately/datepicker";
5
5
  import { useDateSegment, useDateField, useDatePicker, useTimeField } from "@react-aria/datepicker";
6
6
  import { useLocale, I18nProvider } from "@react-aria/i18n";
@@ -258,7 +258,7 @@ const DateField = ({
258
258
  const dateFieldRef = useRef(null);
259
259
  const { labelProps, fieldProps } = useDateField(_props, state, dateFieldRef);
260
260
  useEffect(() => onValidate?.(!state.isInvalid), [state.isInvalid]);
261
- const id = useRandomId("datefield");
261
+ const id = `datefield${useId()}`;
262
262
  return /* @__PURE__ */ jsx(
263
263
  ConditionalWrapper,
264
264
  {
@@ -311,7 +311,7 @@ const CalendarGrid = ({
311
311
  weekNumberHeader,
312
312
  renderCell
313
313
  }) => {
314
- const calendarGridId = useRandomId("eds-calendar");
314
+ const calendarGridId = `eds-calendar${useId()}`;
315
315
  const { locale } = useLocale();
316
316
  const gridStartDate = startDate ?? state.visibleRange.start;
317
317
  const { gridProps, headerProps, weekDays } = useCalendarGrid(
@@ -957,7 +957,7 @@ const NativeDatePicker = React.forwardRef(
957
957
  prepend = /* @__PURE__ */ jsx(DateIcon, { inline: true }),
958
958
  ...rest
959
959
  }, ref) => {
960
- const nativedatepickerId = useRandomId("eds-nativetimepicker");
960
+ const nativedatepickerId = `eds-nativetimepicker${useId()}`;
961
961
  return /* @__PURE__ */ jsx(
962
962
  BaseFormControl,
963
963
  {
@@ -1074,7 +1074,7 @@ const TimePicker = ({
1074
1074
  }) => {
1075
1075
  let { locale } = useLocale();
1076
1076
  if (customLocale) locale = customLocale;
1077
- const timePickerId = useRandomId("eds-timepicker");
1077
+ const timePickerId = `eds-timepicker${useId()}`;
1078
1078
  const timeZone = forcedTimeZone ?? (selectedTime !== null && "timeZone" in selectedTime ? selectedTime.timeZone : "Europe/Oslo");
1079
1079
  const handleOnChange2 = (value) => {
1080
1080
  if (forcedReturnType !== void 0 || !selectedTime) {
@@ -1105,7 +1105,7 @@ const TimePicker = ({
1105
1105
  state,
1106
1106
  timeFieldRef
1107
1107
  );
1108
- const id = useRandomId("timepicker");
1108
+ const id = `timepicker${useId()}`;
1109
1109
  const getCurrentTime = () => {
1110
1110
  const getCurrentTimeWithCorrectType = convertValueToType({
1111
1111
  value: now(timeZone),
@@ -1205,7 +1205,7 @@ const TimePicker = ({
1205
1205
  };
1206
1206
  const NativeTimePicker = React.forwardRef(
1207
1207
  ({ className, style, onChange, label, feedback, variant, prepend, ...rest }, ref) => {
1208
- const nativetimepickerId = useRandomId("eds-native-timepicker");
1208
+ const nativetimepickerId = `eds-native-timepicker${useId()}`;
1209
1209
  return /* @__PURE__ */ jsx(
1210
1210
  BaseFormControl,
1211
1211
  {