Skip to content

Commit

Permalink
Merge pull request #482 from lyytioy/next
Browse files Browse the repository at this point in the history
Version 2.2.1
  • Loading branch information
Grzegorz Bach authored May 23, 2023
2 parents 4934438 + e57822f commit 30347c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@lyyti/design-system",
"description": "Lyyti Design System",
"homepage": "https://lyytioy.github.io/lyyti-design-system",
"version": "2.2.0",
"version": "2.2.1",
"engines": {
"node": "^18",
"npm": "^8"
Expand Down
5 changes: 2 additions & 3 deletions src/components/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
DatePickerProps as MuiDatepickerProps,
} from '@mui/x-date-pickers/DatePicker';
import { DesktopDatePicker as MuiDesktopDatePicker } from '@mui/x-date-pickers/DesktopDatePicker';
import { MobileDatePicker as MuiMobileDatePicker } from '@mui/x-date-pickers/MobileDatePicker';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import type { FormHelperTextProps, InputLabelProps, InputAdornmentProps as MuiInputAdornmentProps } from '@mui/material';

Expand All @@ -18,7 +17,7 @@ export interface DatePickerProps<TDate = unknown> extends Omit<MuiDatepickerProp
InputAdornmentProps?: Partial<MuiInputAdornmentProps>;
InputLabelProps?: Partial<InputLabelProps>
'data-testid'?: string;
variant: 'desktop' | 'mobile' | 'responsive';
variant?: 'desktop' | 'responsive';
}

export { AdapterDayjs }
Expand All @@ -41,7 +40,7 @@ const DatePicker = <TDate = unknown>(
...props
}: DatePickerProps<TDate>,
): JSX.Element => {
const MuiDatePicker = variant === 'responsive' ? MuiResponsiveDatePicker : variant === 'desktop' ? MuiDesktopDatePicker : MuiMobileDatePicker;
const MuiDatePicker = variant === 'desktop' ? MuiDesktopDatePicker : MuiResponsiveDatePicker;
return (
<MuiDatePicker
slots={{ openPickerIcon: (iconProps) => Calendar({ fontSize: 'small', ...iconProps }) }}
Expand Down
17 changes: 15 additions & 2 deletions src/components/TimePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
TimePicker as MuiTimePicker,
TimePicker as MuiResponsiveTimePicker,
TimePickerProps as MuiTimePickerProps,
} from '@mui/x-date-pickers/TimePicker';
import { DesktopTimePicker as MuiDesktopTimePicker } from '@mui/x-date-pickers/DesktopTimePicker';
import type { FormHelperTextProps, InputLabelProps, InputAdornmentProps as MuiInputAdornmentProps } from '@mui/material';
import { TextInputProps } from './TextField';

Expand All @@ -13,9 +14,21 @@ export interface TimePickerProps<TDate = unknown> extends Omit<MuiTimePickerProp
InputLabelProps?: Partial<InputLabelProps>;
OpenPickerButtonProps?: Record<string, unknown>;
'data-testid'?: string;
variant?: 'desktop' | 'responsive';
}

const TimePicker = <TDate = unknown>({ ampm = false, InputProps = {}, InputAdornmentProps = {}, OpenPickerButtonProps = {}, helperText, FormHelperTextProps, InputLabelProps, ...props }: TimePickerProps<TDate>): JSX.Element => {
const TimePicker = <TDate = unknown>({
ampm = false,
InputProps = {},
InputAdornmentProps = {},
OpenPickerButtonProps = {},
helperText,
FormHelperTextProps,
InputLabelProps,
variant = 'responsive',
...props
}: TimePickerProps<TDate>): JSX.Element => {
const MuiTimePicker = variant === 'desktop' ? MuiDesktopTimePicker : MuiResponsiveTimePicker;
return (
<MuiTimePicker
ampm={ampm}
Expand Down

0 comments on commit 30347c3

Please sign in to comment.