@up42/up-components 5.12.0-date-pickers.0 → 5.12.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 FormDatePickerDateType = Date | Dayjs | null | undefined;
6
- type NonGenericMuiDatePickerProps = MuiDatePickerProps<FormDatePickerDateType>;
5
+ export type DatePickerDateType = Dayjs | null | undefined;
6
+ type NonGenericMuiDatePickerProps = MuiDatePickerProps<DatePickerDateType>;
7
7
  export type FormDatePickerProps = NonGenericMuiDatePickerProps & DatePickerWrapperProps;
8
8
  export declare const FormDatePicker: React.ForwardRefExoticComponent<NonGenericMuiDatePickerProps & DatePickerWrapperProps & React.RefAttributes<HTMLDivElement>>;
9
9
  export {};
@@ -1,34 +1,23 @@
1
+ import { DatePickerProps as MuiDatePickerProps } from '@mui/x-date-pickers-pro';
1
2
  import React from 'react';
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;
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
+ };
8
18
  };
9
- export type FormDateRangePickerProps = {
10
- startLabel?: string;
11
- startPlaceholder?: string;
12
- endLabel?: string;
13
- endPlaceholder?: string;
14
- value: DateRange | null;
15
- onChange?: (value: DateRange | null) => void;
16
- disabled?: boolean;
17
- /**
18
- * Defines whether or not the user can input values and navigate in the calendars using the keyboard.
19
- */
20
- allowKeyboard?: boolean;
21
- /**
22
- * Defines the minimum number of days after the "start date" that the "end date" can be selected.
23
- */
24
- minEndDateOffset?: number;
25
- /**
26
- * Defines the maximum number of days after the "start date" that the "end date" can be selected.
27
- */
28
- maxEndDateOffset?: number;
29
- } & DatePickerWrapperProps & Omit<DateRangePickerProps<FormDatePickerDateType | Date>, 'value' | 'onChange'>;
30
19
  /**
31
- * FormDateRangePicker allows users to choose two dates (start and end) using calendar view.
32
- * Documentation: https://up-components.up42.com/?path=/docs-patterns-form-formdaterangepicker--docs
20
+ * Documentation: https://up-components.up42.com/?path=/docs/patterns-form-formdaterangepicker--docs
33
21
  */
34
- export declare const FormDateRangePicker: ({ value, onChange, label, helperText, error, startLabel, endLabel, disabled, minEndDateOffset, maxEndDateOffset, allowKeyboard, startPlaceholder, endPlaceholder, ...props }: FormDateRangePickerProps) => React.JSX.Element;
22
+ export declare const FormDateRangePicker: ({ start, onStartChange, end, onEndChange, label, minDate, maxDate, startPickerProps, endPickerProps, ...props }: FormDateRangePickerProps) => React.JSX.Element;
23
+ export {};
@@ -1,17 +1,36 @@
1
1
  import React from 'react';
2
+ import { DateRangePickerProps } from '@mui/x-date-pickers-pro/DateRangePicker';
2
3
  import { type DatePickerWrapperProps } from '../FormDatePickerWrapper';
3
- import { FormDateRangePickerProps, DateRange } from '../FormDateRangePicker/FormDateRangePicker';
4
+ import { DatePickerDateType } from '../FormDatePicker/FormDatePicker';
5
+ export type DateRange = {
6
+ start: DatePickerDateType | Date;
7
+ end: DatePickerDateType | Date;
8
+ };
4
9
  export type FormDateRangePickerListProps = {
10
+ startLabel?: string;
11
+ endLabel?: string;
5
12
  value: DateRange[];
6
13
  onChange?: (value: DateRange[]) => void;
7
14
  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;
8
27
  /**
9
28
  * Defines the text to display in the action button to add a new Date Range.
10
29
  * It defaults to "Add new date".
11
30
  */
12
31
  addButtonText?: string;
13
- } & DatePickerWrapperProps & Omit<FormDateRangePickerProps, 'value' | 'onChange'>;
32
+ } & DatePickerWrapperProps & Omit<DateRangePickerProps<DatePickerDateType | Date>, 'value' | 'onChange'>;
14
33
  /**
15
34
  * Documentation: https://up-components.up42.com/?path=/docs/patterns-form-formdaterangepickerlist--docs
16
35
  */
17
- export declare const FormDateRangePickerList: ({ value, onChange, label, helperText, error, disabled, addButtonText, ...props }: FormDateRangePickerListProps) => React.JSX.Element;
36
+ export declare const FormDateRangePickerList: ({ value, onChange, label, helperText, error, startLabel, endLabel, disabled, minEndDateOffset, maxEndDateOffset, allowKeyboard, 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 FormDatePickerDateType, } from './components/FormDatePickers/FormDatePicker/FormDatePicker';
14
- export { FormDateRangePicker, type FormDateRangePickerProps, type DateRange, } from './components/FormDatePickers/FormDateRangePicker/FormDateRangePicker';
13
+ export { FormDatePicker, type FormDatePickerProps, type DatePickerDateType, } from './components/FormDatePickers/FormDatePicker/FormDatePicker';
14
+ export { FormDateRangePicker, type FormDateRangePickerProps, } from './components/FormDatePickers/FormDateRangePicker/FormDateRangePicker';
15
15
  export { FormDateTimePicker, type FormDateTimePickerProps, } from './components/FormDatePickers/FormDateTimePicker/FormDateTimePicker';
16
- export { FormDateRangePickerList, type FormDateRangePickerListProps, } from './components/FormDatePickers/FormDateRangePickerList/FormDateRangePickerList';
16
+ export { FormDateRangePickerList, type FormDateRangePickerListProps, type DateRange, } 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';
package/dist/index.d.ts CHANGED
@@ -177,22 +177,43 @@ type DatePickerWrapperProps = {
177
177
  helperText?: string;
178
178
  };
179
179
 
180
- type FormDatePickerDateType = Date | Dayjs | null | undefined;
181
- type NonGenericMuiDatePickerProps = DatePickerProps<FormDatePickerDateType>;
182
- type FormDatePickerProps = NonGenericMuiDatePickerProps & DatePickerWrapperProps;
183
- declare const FormDatePicker: React__default.ForwardRefExoticComponent<NonGenericMuiDatePickerProps & DatePickerWrapperProps & React__default.RefAttributes<HTMLDivElement>>;
180
+ type DatePickerDateType = Dayjs | null | undefined;
181
+ type NonGenericMuiDatePickerProps$1 = DatePickerProps<DatePickerDateType>;
182
+ type FormDatePickerProps = NonGenericMuiDatePickerProps$1 & DatePickerWrapperProps;
183
+ declare const FormDatePicker: React__default.ForwardRefExoticComponent<NonGenericMuiDatePickerProps$1 & DatePickerWrapperProps & React__default.RefAttributes<HTMLDivElement>>;
184
+
185
+ type NonGenericMuiDatePickerProps = DatePickerProps<DatePickerDateType>;
186
+ type FormDateRangePickerProps = Omit<MUIGlobalOmit<NonGenericMuiDatePickerProps>, 'value' | 'onChange'> & {
187
+ start: DatePickerDateType;
188
+ onStartChange: (date: DatePickerDateType) => void;
189
+ end: DatePickerDateType;
190
+ onEndChange: (date: DatePickerDateType) => void;
191
+ label?: string;
192
+ startPickerProps?: {
193
+ slotProps: FormDatePickerProps['slotProps'];
194
+ };
195
+ endPickerProps?: {
196
+ slotProps: FormDatePickerProps['slotProps'];
197
+ };
198
+ };
199
+ /**
200
+ * Documentation: https://up-components.up42.com/?path=/docs/patterns-form-formdaterangepicker--docs
201
+ */
202
+ declare const FormDateRangePicker: ({ start, onStartChange, end, onEndChange, label, minDate, maxDate, startPickerProps, endPickerProps, ...props }: FormDateRangePickerProps) => React__default.JSX.Element;
203
+
204
+ type NonGenericMuiDateTimePickerProps = DateTimePickerProps<Dayjs | null | undefined>;
205
+ type FormDateTimePickerProps = NonGenericMuiDateTimePickerProps & DatePickerWrapperProps;
206
+ declare const FormDateTimePicker: React__default.ForwardRefExoticComponent<NonGenericMuiDateTimePickerProps & DatePickerWrapperProps & React__default.RefAttributes<HTMLDivElement>>;
184
207
 
185
208
  type DateRange = {
186
- start: FormDatePickerDateType;
187
- end: FormDatePickerDateType;
209
+ start: DatePickerDateType | Date;
210
+ end: DatePickerDateType | Date;
188
211
  };
189
- type FormDateRangePickerProps = {
212
+ type FormDateRangePickerListProps = {
190
213
  startLabel?: string;
191
- startPlaceholder?: string;
192
214
  endLabel?: string;
193
- endPlaceholder?: string;
194
- value: DateRange | null;
195
- onChange?: (value: DateRange | null) => void;
215
+ value: DateRange[];
216
+ onChange?: (value: DateRange[]) => void;
196
217
  disabled?: boolean;
197
218
  /**
198
219
  * Defines whether or not the user can input values and navigate in the calendars using the keyboard.
@@ -206,31 +227,16 @@ type FormDateRangePickerProps = {
206
227
  * Defines the maximum number of days after the "start date" that the "end date" can be selected.
207
228
  */
208
229
  maxEndDateOffset?: number;
209
- } & DatePickerWrapperProps & Omit<DateRangePickerProps<FormDatePickerDateType | Date>, 'value' | 'onChange'>;
210
- /**
211
- * FormDateRangePicker allows users to choose two dates (start and end) using calendar view.
212
- * Documentation: https://up-components.up42.com/?path=/docs-patterns-form-formdaterangepicker--docs
213
- */
214
- declare const FormDateRangePicker: ({ value, onChange, label, helperText, error, startLabel, endLabel, disabled, minEndDateOffset, maxEndDateOffset, allowKeyboard, startPlaceholder, endPlaceholder, ...props }: FormDateRangePickerProps) => React__default.JSX.Element;
215
-
216
- type NonGenericMuiDateTimePickerProps = DateTimePickerProps<Dayjs | null | undefined>;
217
- type FormDateTimePickerProps = NonGenericMuiDateTimePickerProps & DatePickerWrapperProps;
218
- declare const FormDateTimePicker: React__default.ForwardRefExoticComponent<NonGenericMuiDateTimePickerProps & DatePickerWrapperProps & React__default.RefAttributes<HTMLDivElement>>;
219
-
220
- type FormDateRangePickerListProps = {
221
- value: DateRange[];
222
- onChange?: (value: DateRange[]) => void;
223
- disabled?: boolean;
224
230
  /**
225
231
  * Defines the text to display in the action button to add a new Date Range.
226
232
  * It defaults to "Add new date".
227
233
  */
228
234
  addButtonText?: string;
229
- } & DatePickerWrapperProps & Omit<FormDateRangePickerProps, 'value' | 'onChange'>;
235
+ } & DatePickerWrapperProps & Omit<DateRangePickerProps<DatePickerDateType | Date>, 'value' | 'onChange'>;
230
236
  /**
231
237
  * Documentation: https://up-components.up42.com/?path=/docs/patterns-form-formdaterangepickerlist--docs
232
238
  */
233
- declare const FormDateRangePickerList: ({ value, onChange, label, helperText, error, disabled, addButtonText, ...props }: FormDateRangePickerListProps) => React__default.JSX.Element;
239
+ declare const FormDateRangePickerList: ({ value, onChange, label, helperText, error, startLabel, endLabel, disabled, minEndDateOffset, maxEndDateOffset, allowKeyboard, addButtonText, ...props }: FormDateRangePickerListProps) => React__default.JSX.Element;
234
240
 
235
241
  type RadioProps = MUIGlobalOmit<RadioProps$1>;
236
242
  /**
@@ -5924,4 +5930,4 @@ type ContextState = {
5924
5930
  declare const useAlert: () => ContextState;
5925
5931
 
5926
5932
  export { Alert, Avatar, Badge, Banner, Button, Checkbox, CodeBlock, CodeInline, CodeSnippet, ContactBox, ControlButton, CopyButton, DataGrid, DateTime, Divider, DocumentationPopover, EditTagsButton, EmptyState, FeatureCard, FeatureCardHeader, FeatureCardHeaderActions, FeatureFlagCheckbox, FormCheckbox, FormDatePicker, FormDateRangePicker, FormDateRangePickerList, FormDateTimePicker, FormInput, FormRadio, FormSelect, FormSwitch, GridContainer, GridItem, Icon, Illustration, InfoCard, InfoModal, InfoPopover, Input, Link, Loading, Logo, NotFound, PageContainer, PageHeader, PageHeaderV2, Popover, Radio, Select, Slider, StatusLight, Switch, Tab, TabGroup, Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel, Tabs, Tag, TagsList, ToggleButton, Typography, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, generateQueryKey, theme, useAlert, useCursorPagination, useDebounce, useQueryParams, useRemotePagination, useToggle };
5927
- export type { AlertProps, AvatarProps, BadgeProps, BannerProps, ButtonProps, CheckboxProps, CodeBlockProps, CodeInlineProps, CodeSnippetItemProps, CodeSnippetProps, ContactBoxProps, ControlButtonProps, CopyButtonProps, CreateAlertProps, CreateSnackbarProps, CursorPaginatedResponse, DateRange, DateTimeProps, DividerProps, DocumentationPopoverProps, EditTagsButtonProps, EmptyStateProps, FeatureCardHeaderActionsProps, FeatureCardHeaderProps, FeatureCardProps, FeatureFlagCheckboxProps, FormCheckboxProps, FormDatePickerDateType, FormDatePickerProps, FormDateRangePickerListProps, FormDateRangePickerProps, FormDateTimePickerProps, FormInputProps, FormRadioProps, FormSelectProps, FormSwitchProps, GridContainerProps, GridItemProps, IconAction, IconProps$1 as IconProps, IllustrationProps, InfoCardProps, InfoModalProps, InfoPopoverProps, InputProps, LinkProps, LoadingProps, LogoProps, MenuAction, NotFoundProps, PageContainerProps, PageHeaderProps, PageHeaderV2Props, PaginatedResponse, PopoverProps, RadioProps, SelectProps, SliderProps, StatusLightProps, SwitchProps, TabGroupProps, TabProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TableSortLabelProps, TabsProps, TagItem, TagProps, TagsListProps, ToggleButtonProps, TypographyProps, UseToggleResult };
5933
+ export type { AlertProps, AvatarProps, BadgeProps, BannerProps, ButtonProps, CheckboxProps, CodeBlockProps, CodeInlineProps, CodeSnippetItemProps, CodeSnippetProps, ContactBoxProps, ControlButtonProps, CopyButtonProps, CreateAlertProps, CreateSnackbarProps, CursorPaginatedResponse, DatePickerDateType, DateRange, DateTimeProps, DividerProps, DocumentationPopoverProps, EditTagsButtonProps, EmptyStateProps, FeatureCardHeaderActionsProps, FeatureCardHeaderProps, FeatureCardProps, FeatureFlagCheckboxProps, FormCheckboxProps, FormDatePickerProps, FormDateRangePickerListProps, FormDateRangePickerProps, FormDateTimePickerProps, FormInputProps, FormRadioProps, FormSelectProps, FormSwitchProps, GridContainerProps, GridItemProps, IconAction, IconProps$1 as IconProps, IllustrationProps, InfoCardProps, InfoModalProps, InfoPopoverProps, InputProps, LinkProps, LoadingProps, LogoProps, MenuAction, NotFoundProps, PageContainerProps, PageHeaderProps, PageHeaderV2Props, PaginatedResponse, PopoverProps, RadioProps, SelectProps, SliderProps, StatusLightProps, SwitchProps, TabGroupProps, TabProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TableSortLabelProps, TabsProps, TagItem, TagProps, TagsListProps, ToggleButtonProps, TypographyProps, UseToggleResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@up42/up-components",
3
- "version": "5.12.0-date-pickers.0",
3
+ "version": "5.12.0",
4
4
  "description": "UP42 Component Library",
5
5
  "author": "Axel Fuhrmann axel.fuhrmann@up42.com",
6
6
  "license": "ISC",
@@ -120,4 +120,4 @@
120
120
  "tmp": ">=0.2.4"
121
121
  }
122
122
  }
123
- }
123
+ }