@norges-domstoler/dds-components 0.0.0-dev-20240110151153 → 0.0.0-dev-20240112130219

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.d.mts CHANGED
@@ -11,8 +11,8 @@ import { Environment } from '@norges-domstoler/development-utils';
11
11
  import { OptionProps, GroupBase, SingleValueProps, Props, SelectInstance } from 'react-select';
12
12
  import { DateValue, AriaCalendarProps } from '@react-aria/calendar';
13
13
  import { AriaDatePickerProps } from '@react-types/datepicker';
14
- import { AriaDateFieldOptions, useDatePicker, TimeValue, AriaTimeFieldProps } from '@react-aria/datepicker';
15
- import { DateValue as DateValue$1, CalendarDate } from '@internationalized/date';
14
+ import { AriaDateFieldOptions, useDatePicker, AriaTimeFieldProps } from '@react-aria/datepicker';
15
+ import { DateValue as DateValue$1, CalendarDate, Time } from '@internationalized/date';
16
16
  import { InputProps as InputProps$1 } from '@norges-domstoler/dds-components';
17
17
 
18
18
  interface SvgChevronProps {
@@ -2300,16 +2300,16 @@ type DateFieldProps<T extends DateValue$1 = CalendarDate> = AriaDateFieldOptions
2300
2300
  buttonProps?: ReturnType<typeof useDatePicker>['buttonProps'];
2301
2301
  } & Pick<InputProps$1, 'componentSize' | 'errorMessage' | 'tip' | 'disabled' | 'style'>;
2302
2302
 
2303
- interface DatePickerProps extends AriaDatePickerProps<CalendarDate>, Pick<DateFieldProps<CalendarDate>, 'componentSize' | 'tip' | 'style'> {
2303
+ interface DatePickerProps extends Omit<AriaDatePickerProps<CalendarDate>, 'granularity'>, Pick<DateFieldProps<CalendarDate>, 'componentSize' | 'tip' | 'style'> {
2304
2304
  label?: string;
2305
2305
  errorMessage?: string;
2306
2306
  }
2307
2307
  declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<HTMLElement>>;
2308
2308
 
2309
- type TimePickerProps<T extends TimeValue = TimeValue> = AriaTimeFieldProps<T> & {
2309
+ type TimePickerProps = Omit<AriaTimeFieldProps<Time>, 'hideTimeZone'> & {
2310
2310
  className?: string;
2311
2311
  } & Pick<InputProps$1, 'componentSize' | 'errorMessage' | 'tip' | 'disabled' | 'style'>;
2312
- declare const TimePicker: react.ForwardRefExoticComponent<AriaTimeFieldProps<TimeValue> & {
2312
+ declare const TimePicker: react.ForwardRefExoticComponent<Omit<AriaTimeFieldProps<Time>, "hideTimeZone"> & {
2313
2313
  className?: string | undefined;
2314
2314
  } & Pick<InputProps$1, "style" | "disabled" | "tip" | "errorMessage" | "componentSize"> & react.RefAttributes<HTMLDivElement>>;
2315
2315
 
package/dist/index.d.ts CHANGED
@@ -11,8 +11,8 @@ import { Environment } from '@norges-domstoler/development-utils';
11
11
  import { OptionProps, GroupBase, SingleValueProps, Props, SelectInstance } from 'react-select';
12
12
  import { DateValue, AriaCalendarProps } from '@react-aria/calendar';
13
13
  import { AriaDatePickerProps } from '@react-types/datepicker';
14
- import { AriaDateFieldOptions, useDatePicker, TimeValue, AriaTimeFieldProps } from '@react-aria/datepicker';
15
- import { DateValue as DateValue$1, CalendarDate } from '@internationalized/date';
14
+ import { AriaDateFieldOptions, useDatePicker, AriaTimeFieldProps } from '@react-aria/datepicker';
15
+ import { DateValue as DateValue$1, CalendarDate, Time } from '@internationalized/date';
16
16
  import { InputProps as InputProps$1 } from '@norges-domstoler/dds-components';
17
17
 
18
18
  interface SvgChevronProps {
@@ -2300,16 +2300,16 @@ type DateFieldProps<T extends DateValue$1 = CalendarDate> = AriaDateFieldOptions
2300
2300
  buttonProps?: ReturnType<typeof useDatePicker>['buttonProps'];
2301
2301
  } & Pick<InputProps$1, 'componentSize' | 'errorMessage' | 'tip' | 'disabled' | 'style'>;
2302
2302
 
2303
- interface DatePickerProps extends AriaDatePickerProps<CalendarDate>, Pick<DateFieldProps<CalendarDate>, 'componentSize' | 'tip' | 'style'> {
2303
+ interface DatePickerProps extends Omit<AriaDatePickerProps<CalendarDate>, 'granularity'>, Pick<DateFieldProps<CalendarDate>, 'componentSize' | 'tip' | 'style'> {
2304
2304
  label?: string;
2305
2305
  errorMessage?: string;
2306
2306
  }
2307
2307
  declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<HTMLElement>>;
2308
2308
 
2309
- type TimePickerProps<T extends TimeValue = TimeValue> = AriaTimeFieldProps<T> & {
2309
+ type TimePickerProps = Omit<AriaTimeFieldProps<Time>, 'hideTimeZone'> & {
2310
2310
  className?: string;
2311
2311
  } & Pick<InputProps$1, 'componentSize' | 'errorMessage' | 'tip' | 'disabled' | 'style'>;
2312
- declare const TimePicker: react.ForwardRefExoticComponent<AriaTimeFieldProps<TimeValue> & {
2312
+ declare const TimePicker: react.ForwardRefExoticComponent<Omit<AriaTimeFieldProps<Time>, "hideTimeZone"> & {
2313
2313
  className?: string | undefined;
2314
2314
  } & Pick<InputProps$1, "style" | "disabled" | "tip" | "errorMessage" | "componentSize"> & react.RefAttributes<HTMLDivElement>>;
2315
2315
 
package/dist/index.js CHANGED
@@ -11098,38 +11098,37 @@ var import_jsx_runtime237 = require("react/jsx-runtime");
11098
11098
  var refIsFocusable = (ref) => {
11099
11099
  return typeof ref === "object" && ref !== null && "focus" in ref;
11100
11100
  };
11101
- var DatePicker = (0, import_react85.forwardRef)(
11102
- ({ errorMessage, componentSize, tip, style, ...props }, forwardedRef) => {
11103
- const state = (0, import_datepicker4.useDatePickerState)(props);
11104
- const domRef = useFocusManagerRef(
11105
- refIsFocusable(import_react85.forwardRef) ? forwardedRef : null
11106
- );
11107
- const ref = (0, import_react85.useRef)(null);
11108
- const combinedRef = useCombinedRef(ref, domRef);
11109
- const { buttonProps, calendarProps, fieldProps } = (0, import_datepicker5.useDatePicker)(
11110
- props,
11111
- state,
11112
- ref
11113
- );
11114
- return /* @__PURE__ */ (0, import_jsx_runtime237.jsxs)(CalendarPopover, { isOpen: state.isOpen, onClose: state.close, children: [
11115
- /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(CalendarPopoverAnchor, { children: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(
11116
- DateField,
11117
- {
11118
- ...fieldProps,
11119
- ref: combinedRef,
11120
- componentSize,
11121
- tip,
11122
- label: props.label,
11123
- errorMessage,
11124
- buttonProps,
11125
- isOpen: state.isOpen,
11126
- style
11127
- }
11128
- ) }),
11129
- /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(CalendarPopoverContent, { children: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(Calendar, { ...calendarProps }) })
11130
- ] });
11131
- }
11132
- );
11101
+ function _DatePicker({ errorMessage, componentSize, tip, style, ...props }, forwardedRef) {
11102
+ const state = (0, import_datepicker4.useDatePickerState)(props);
11103
+ const domRef = useFocusManagerRef(
11104
+ refIsFocusable(import_react85.forwardRef) ? forwardedRef : null
11105
+ );
11106
+ const ref = (0, import_react85.useRef)(null);
11107
+ const combinedRef = useCombinedRef(ref, domRef);
11108
+ const { buttonProps, calendarProps, fieldProps } = (0, import_datepicker5.useDatePicker)(
11109
+ { ...props, granularity: "day" },
11110
+ state,
11111
+ ref
11112
+ );
11113
+ return /* @__PURE__ */ (0, import_jsx_runtime237.jsxs)(CalendarPopover, { isOpen: state.isOpen, onClose: state.close, children: [
11114
+ /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(CalendarPopoverAnchor, { children: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(
11115
+ DateField,
11116
+ {
11117
+ ...fieldProps,
11118
+ ref: combinedRef,
11119
+ componentSize,
11120
+ tip,
11121
+ label: props.label,
11122
+ errorMessage,
11123
+ buttonProps,
11124
+ isOpen: state.isOpen,
11125
+ style
11126
+ }
11127
+ ) }),
11128
+ /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(CalendarPopoverContent, { children: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(Calendar, { ...calendarProps }) })
11129
+ ] });
11130
+ }
11131
+ var DatePicker = (0, import_react85.forwardRef)(_DatePicker);
11133
11132
  DatePicker.displayName = "DatePicker";
11134
11133
 
11135
11134
  // src/components/date-inputs/TimePicker/TimePicker.tsx
@@ -11149,7 +11148,11 @@ function _TimePicker({ componentSize = "medium", style, ...props }, forwardedRef
11149
11148
  ...props,
11150
11149
  locale
11151
11150
  });
11152
- const { labelProps, fieldProps } = (0, import_datepicker6.useTimeField)(props, state, ref);
11151
+ const { labelProps, fieldProps } = (0, import_datepicker6.useTimeField)(
11152
+ { ...props, hideTimeZone: true, granularity: "hour" },
11153
+ state,
11154
+ ref
11155
+ );
11153
11156
  const disabled = props.isDisabled || !!fieldProps["aria-disabled"];
11154
11157
  return /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(
11155
11158
  DateInput,