@up42/up-components 5.17.0 → 6.0.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.
@@ -2,8 +2,8 @@ import { DatePickerProps as MuiDatePickerProps } from '@mui/x-date-pickers-pro';
2
2
  import { Dayjs } from 'dayjs';
3
3
  import React from 'react';
4
4
  import { type DatePickerWrapperProps } from '../FormDatePickerWrapper';
5
- export type DatePickerDateType = Dayjs | null | undefined;
6
- type NonGenericMuiDatePickerProps = MuiDatePickerProps<DatePickerDateType>;
5
+ export type FormDatePickerDateType = Date | Dayjs | null | undefined;
6
+ type NonGenericMuiDatePickerProps = MuiDatePickerProps<FormDatePickerDateType>;
7
7
  export type FormDatePickerProps = NonGenericMuiDatePickerProps & DatePickerWrapperProps;
8
8
  export declare const FormDatePicker: React.ForwardRefExoticComponent<NonGenericMuiDatePickerProps & DatePickerWrapperProps & React.RefAttributes<HTMLDivElement>>;
9
9
  export {};
@@ -1,23 +1,35 @@
1
- import { DatePickerProps as MuiDatePickerProps } from '@mui/x-date-pickers-pro';
2
1
  import React from 'react';
3
- import type { MUIGlobalOmit } from '@global/utils/types';
4
- import { DatePickerDateType, FormDatePickerProps } from '../FormDatePicker/FormDatePicker';
5
- type NonGenericMuiDatePickerProps = MuiDatePickerProps<DatePickerDateType>;
6
- export type FormDateRangePickerProps = Omit<MUIGlobalOmit<NonGenericMuiDatePickerProps>, 'value' | 'onChange'> & {
7
- start: DatePickerDateType;
8
- onStartChange: (date: DatePickerDateType) => void;
9
- end: DatePickerDateType;
10
- onEndChange: (date: DatePickerDateType) => void;
11
- label?: string;
12
- startPickerProps?: {
13
- slotProps: FormDatePickerProps['slotProps'];
14
- };
15
- endPickerProps?: {
16
- slotProps: FormDatePickerProps['slotProps'];
17
- };
2
+ import { DateRangePickerProps } from '@mui/x-date-pickers-pro/DateRangePicker';
3
+ import { type DatePickerWrapperProps } from '../FormDatePickerWrapper';
4
+ import { FormDatePickerDateType } from '../FormDatePicker/FormDatePicker';
5
+ export type DateRange = {
6
+ start: FormDatePickerDateType;
7
+ end: FormDatePickerDateType;
18
8
  };
9
+ export declare const DEFAULT_FORMAT = "YYYY\u2013MM\u2013DD";
10
+ export type FormDateRangePickerProps = {
11
+ startLabel?: string;
12
+ startPlaceholder?: string;
13
+ endLabel?: string;
14
+ endPlaceholder?: string;
15
+ value: DateRange | null;
16
+ onChange?: (value: DateRange | null) => void;
17
+ disabled?: boolean;
18
+ /**
19
+ * Defines whether or not the user can input values and navigate in the calendars using the keyboard.
20
+ */
21
+ allowKeyboard?: boolean;
22
+ /**
23
+ * Defines the minimum number of days after the "start date" that the "end date" can be selected.
24
+ */
25
+ minEndDateOffset?: number;
26
+ /**
27
+ * Defines the maximum number of days after the "start date" that the "end date" can be selected.
28
+ */
29
+ maxEndDateOffset?: number;
30
+ } & DatePickerWrapperProps & Omit<DateRangePickerProps<FormDatePickerDateType | Date>, 'value' | 'onChange'>;
19
31
  /**
20
- * Documentation: https://up-components.up42.com/?path=/docs/patterns-form-formdaterangepicker--docs
32
+ * FormDateRangePicker allows users to choose two dates (start and end) using calendar view.
33
+ * Documentation: https://up-components.up42.com/?path=/docs-patterns-form-formdaterangepicker--docs
21
34
  */
22
- export declare const FormDateRangePicker: ({ start, onStartChange, end, onEndChange, label, minDate, maxDate, startPickerProps, endPickerProps, ...props }: FormDateRangePickerProps) => React.JSX.Element;
23
- export {};
35
+ export declare const FormDateRangePicker: ({ value, onChange, label, helperText, error, startLabel, endLabel, disabled, minEndDateOffset, maxEndDateOffset, allowKeyboard, startPlaceholder, endPlaceholder, format, ...props }: FormDateRangePickerProps) => React.JSX.Element;
@@ -1,36 +1,17 @@
1
1
  import React from 'react';
2
- import { DateRangePickerProps } from '@mui/x-date-pickers-pro/DateRangePicker';
3
2
  import { type DatePickerWrapperProps } from '../FormDatePickerWrapper';
4
- import { DatePickerDateType } from '../FormDatePicker/FormDatePicker';
5
- export type DateRange = {
6
- start: DatePickerDateType | Date;
7
- end: DatePickerDateType | Date;
8
- };
3
+ import { FormDateRangePickerProps, DateRange } from '../FormDateRangePicker/FormDateRangePicker';
9
4
  export type FormDateRangePickerListProps = {
10
- startLabel?: string;
11
- endLabel?: string;
12
5
  value: DateRange[];
13
6
  onChange?: (value: DateRange[]) => void;
14
7
  disabled?: boolean;
15
- /**
16
- * Defines whether or not the user can input values and navigate in the calendars using the keyboard.
17
- */
18
- allowKeyboard?: boolean;
19
- /**
20
- * Defines the minimum number of days after the "start date" that the "end date" can be selected.
21
- */
22
- minEndDateOffset?: number;
23
- /**
24
- * Defines the maximum number of days after the "start date" that the "end date" can be selected.
25
- */
26
- maxEndDateOffset?: number;
27
8
  /**
28
9
  * Defines the text to display in the action button to add a new Date Range.
29
10
  * It defaults to "Add new date".
30
11
  */
31
12
  addButtonText?: string;
32
- } & DatePickerWrapperProps & Omit<DateRangePickerProps<DatePickerDateType | Date>, 'value' | 'onChange'>;
13
+ } & DatePickerWrapperProps & Omit<FormDateRangePickerProps, 'value' | 'onChange'>;
33
14
  /**
34
15
  * Documentation: https://up-components.up42.com/?path=/docs/patterns-form-formdaterangepickerlist--docs
35
16
  */
36
- export declare const FormDateRangePickerList: ({ value, onChange, label, helperText, error, startLabel, endLabel, disabled, minEndDateOffset, maxEndDateOffset, allowKeyboard, addButtonText, ...props }: FormDateRangePickerListProps) => React.JSX.Element;
17
+ export declare const FormDateRangePickerList: ({ value, onChange, label, helperText, error, disabled, addButtonText, ...props }: FormDateRangePickerListProps) => React.JSX.Element;
@@ -10,10 +10,10 @@ export { GridContainer, type GridContainerProps, GridItem, type GridItemProps }
10
10
  export { PageContainer, type PageContainerProps } from './components/PageContainer/PageContainer';
11
11
  export { Checkbox, type CheckboxProps } from './components/Checkbox/Checkbox';
12
12
  export { FormCheckbox, type FormCheckboxProps } from './components/FormCheckbox/FormCheckbox';
13
- export { FormDatePicker, type FormDatePickerProps, type DatePickerDateType, } from './components/FormDatePickers/FormDatePicker/FormDatePicker';
14
- export { FormDateRangePicker, type FormDateRangePickerProps, } from './components/FormDatePickers/FormDateRangePicker/FormDateRangePicker';
13
+ export { FormDatePicker, type FormDatePickerProps, type FormDatePickerDateType, } from './components/FormDatePickers/FormDatePicker/FormDatePicker';
14
+ export { FormDateRangePicker, type FormDateRangePickerProps, type DateRange, } from './components/FormDatePickers/FormDateRangePicker/FormDateRangePicker';
15
15
  export { FormDateTimePicker, type FormDateTimePickerProps, } from './components/FormDatePickers/FormDateTimePicker/FormDateTimePicker';
16
- export { FormDateRangePickerList, type FormDateRangePickerListProps, type DateRange, } from './components/FormDatePickers/FormDateRangePickerList/FormDateRangePickerList';
16
+ export { FormDateRangePickerList, type FormDateRangePickerListProps, } from './components/FormDatePickers/FormDateRangePickerList/FormDateRangePickerList';
17
17
  export { Radio, type RadioProps } from './components/Radio/Radio';
18
18
  export { FormRadio, type FormRadioProps } from './components/FormRadio/FormRadio';
19
19
  export { Switch, type SwitchProps } from './components/Switch/Switch';