@entur/datepicker 11.7.0 → 11.8.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.
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { AriaCalendarProps } from '@react-aria/calendar';
3
- import { CalendarDate, DateValue } from '@internationalized/date';
3
+ import { CalendarDate, DateDuration, DateValue } from '@internationalized/date';
4
4
  import { MappedDateValue } from '@react-types/datepicker';
5
5
  import { DateFieldProps } from './DateField';
6
6
  type ExtendedCalendarProps<DateType extends DateValue> = Omit<AriaCalendarProps<DateType>, keyof BaseCalendarProps<DateType> | 'value' | 'label' | 'hideTimeZone' | 'placeholder' | 'placeholderValue' | 'defaultValue' | 'minValue' | 'maxValue'>;
@@ -59,6 +59,11 @@ type BaseCalendarProps<DateType extends DateValue> = {
59
59
  locale?: string;
60
60
  calendarRef?: React.MutableRefObject<HTMLDivElement | null>;
61
61
  forcedReturnType?: DateFieldProps<DateType>['forcedReturnType'];
62
+ /** Vis flere måneder samtidig i kalenderen.
63
+ * @default {months: 1}
64
+ * @example {months: 2}
65
+ */
66
+ visibleDuration?: Pick<DateDuration, 'months'>;
62
67
  };
63
68
  export type CalendarProps<DateType extends DateValue> = BaseCalendarProps<DateType> & ExtendedCalendarProps<DateType>;
64
69
  export declare const Calendar: <DateType extends DateValue>({ locale: localOverride, ...rest }: CalendarProps<DateType>) => React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ import { CalendarState, RangeCalendarState } from '@react-stately/calendar';
3
+ import { CalendarDate } from '@internationalized/date';
4
+ import { AriaButtonProps } from '@react-types/button';
5
+ type CalendarBaseProps = {
6
+ state: CalendarState | RangeCalendarState;
7
+ calendarProps: React.HTMLAttributes<HTMLElement>;
8
+ prevButtonProps: AriaButtonProps;
9
+ nextButtonProps: AriaButtonProps;
10
+ title: string;
11
+ calendarRef?: React.Ref<HTMLDivElement>;
12
+ style?: React.CSSProperties;
13
+ className?: string;
14
+ navigationDescription?: string;
15
+ showWeekNumbers: boolean;
16
+ weekNumberHeader: string;
17
+ renderCell: (date: CalendarDate, currentMonth: CalendarDate, weekNumberString: string, ariaDescribedBy: string) => React.ReactNode;
18
+ };
19
+ export declare const CalendarBase: ({ state, calendarProps, prevButtonProps, nextButtonProps, title, calendarRef, style, className, navigationDescription, showWeekNumbers, weekNumberHeader, renderCell, }: CalendarBaseProps) => React.JSX.Element;
20
+ export {};
@@ -4,6 +4,7 @@ import { CalendarDate } from '@internationalized/date';
4
4
  type CalendarCellProps = {
5
5
  state: CalendarState;
6
6
  date: CalendarDate;
7
+ currentMonth: CalendarDate;
7
8
  weekNumberString: string;
8
9
  showOutsideMonth?: boolean;
9
10
  onSelectedCellClick?: () => void;
@@ -11,5 +12,5 @@ type CalendarCellProps = {
11
12
  classNameForDate?: (date: CalendarDate) => string;
12
13
  ariaLabelForDate?: (date: CalendarDate) => string;
13
14
  };
14
- export declare const CalendarCell: ({ state, date, showOutsideMonth, onSelectedCellClick, onCellClick, weekNumberString, classNameForDate, ariaLabelForDate, ...rest }: CalendarCellProps) => React.JSX.Element;
15
+ export declare const CalendarCell: ({ state, date, currentMonth, showOutsideMonth, onSelectedCellClick, onCellClick, weekNumberString, classNameForDate, ariaLabelForDate, ...rest }: CalendarCellProps) => React.JSX.Element;
15
16
  export {};
@@ -1,16 +1,13 @@
1
1
  import { default as React } from 'react';
2
- import { CalendarState } from '@react-stately/calendar';
2
+ import { CalendarState, RangeCalendarState } from '@react-stately/calendar';
3
3
  import { CalendarDate } from '@internationalized/date';
4
4
  type CalendarGridProps = {
5
- state: CalendarState;
5
+ state: CalendarState | RangeCalendarState;
6
+ startDate?: CalendarDate;
6
7
  navigationDescription?: string;
7
8
  showWeekNumbers: boolean;
8
9
  weekNumberHeader: string;
9
- showOutsideMonth?: boolean;
10
- onSelectedCellClick?: () => void;
11
- onCellClick?: () => void;
12
- classNameForDate?: (date: CalendarDate) => string;
13
- ariaLabelForDate?: (date: CalendarDate) => string;
10
+ renderCell: (date: CalendarDate, currentMonth: CalendarDate, weekNumberString: string, ariaDescribedBy: string) => React.ReactNode;
14
11
  };
15
- export declare const CalendarGrid: ({ state, navigationDescription, onSelectedCellClick, onCellClick, showWeekNumbers, weekNumberHeader, showOutsideMonth, classNameForDate, ariaLabelForDate, ...rest }: CalendarGridProps) => React.JSX.Element;
12
+ export declare const CalendarGrid: ({ state, startDate, navigationDescription, showWeekNumbers, weekNumberHeader, renderCell, }: CalendarGridProps) => React.JSX.Element;
16
13
  export {};