Skip to content

Commit

Permalink
[DatePicker] Remove unused type parameters (#24257)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jan 4, 2021
1 parent 4934209 commit 81dc2d1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import { isRangeValid } from '../internal/pickers/date-utils';
import { BasePickerProps } from '../internal/pickers/typings/BasePicker';
import { calculateRangeChange } from './date-range-manager';
import { useUtils } from '../internal/pickers/hooks/useUtils';
import { SharedPickerProps } from '../internal/pickers/Picker/SharedPickerProps';
import DateRangePickerToolbar from './DateRangePickerToolbar';
import { useCalendarState } from '../DayPicker/useCalendarState';
import { DateRangePickerViewMobile } from './DateRangePickerViewMobile';
import { WrapperVariantContext } from '../internal/pickers/wrappers/WrapperVariantContext';
import { MobileKeyboardInputView } from '../internal/pickers/Picker/Picker';
import DateRangePickerInput, { DateRangeInputProps } from './DateRangePickerInput';
import { RangeInput, DateRange, CurrentlySelectingRangeEndProps } from './RangeTypes';
import { DateRange, CurrentlySelectingRangeEndProps } from './RangeTypes';
import { ExportedDayPickerProps, defaultReduceAnimations } from '../DayPicker/DayPicker';
import DateRangePickerViewDesktop, {
ExportedDesktopDateRangeCalendarProps,
} from './DateRangePickerViewDesktop';
import { PickerSelectionState } from '../internal/pickers/hooks/usePickerState';
import { WrapperVariant } from '../internal/pickers/wrappers/Wrapper';

type BaseCalendarPropsToReuse<TDate> = Omit<
ExportedDayPickerProps<TDate>,
Expand All @@ -35,11 +36,19 @@ export interface ExportedDateRangePickerViewProps<TDate>

interface DateRangePickerViewProps<TDate>
extends CurrentlySelectingRangeEndProps,
ExportedDateRangePickerViewProps<TDate>,
SharedPickerProps<RangeInput<TDate>, DateRange<TDate>, DateRangeInputProps> {
ExportedDateRangePickerViewProps<TDate> {
open: boolean;
startText: React.ReactNode;
endText: React.ReactNode;
isMobileKeyboardViewOpen: boolean;
toggleMobileKeyboardView: () => void;
DateInputProps: DateRangeInputProps;
date: DateRange<TDate>;
onDateChange: (
date: DateRange<TDate>,
currentWrapperVariant: WrapperVariant,
isFinish?: PickerSelectionState,
) => void;
}

/**
Expand Down
21 changes: 15 additions & 6 deletions packages/material-ui-lab/src/internal/pickers/Picker/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import { KeyboardDateInput } from '../KeyboardDateInput';
import { useIsLandscape } from '../hooks/useIsLandscape';
import { DIALOG_WIDTH, VIEW_HEIGHT } from '../constants/dimensions';
import { WrapperVariantContext } from '../wrappers/WrapperVariantContext';
import { WrapperVariant } from '../wrappers/Wrapper';
import { DateInputPropsLike } from '../wrappers/WrapperProps';
import { PickerSelectionState } from '../hooks/usePickerState';
import { BasePickerProps, CalendarAndClockProps } from '../typings/BasePicker';
import { WithViewsProps, SharedPickerProps } from './SharedPickerProps';
import { WithViewsProps } from './SharedPickerProps';
import { AllAvailableViews, TimePickerView, DatePickerView } from '../typings/Views';
import PickerView from './PickerView';

Expand All @@ -22,11 +24,18 @@ export interface ExportedPickerProps<TView extends AllAvailableViews>
timeIcon?: React.ReactNode;
}

export type PickerProps<
TView extends AllAvailableViews,
TInputValue = any,
TDateValue = any
> = ExportedPickerProps<TView> & SharedPickerProps<TInputValue, TDateValue>;
export interface PickerProps<TView extends AllAvailableViews, TDateValue = any>
extends ExportedPickerProps<TView> {
isMobileKeyboardViewOpen: boolean;
toggleMobileKeyboardView: () => void;
DateInputProps: DateInputPropsLike;
date: TDateValue;
onDateChange: (
date: TDateValue,
currentWrapperVariant: WrapperVariant,
isFinish?: PickerSelectionState,
) => void;
}

export const MobileKeyboardInputView = styled('div')(
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { BasePickerProps } from '../typings/BasePicker';
import { ExportedDateInputProps } from '../PureDateInput';
import { WithDateAdapterProps } from '../withDateAdapterProp';
import { PickerSelectionState } from '../hooks/usePickerState';
import { DateInputPropsLike } from '../wrappers/WrapperProps';
import { AllAvailableViews } from '../typings/Views';
import { WrapperVariant } from '../wrappers/Wrapper';

export type AllSharedPickerProps<TInputValue = any, TDateValue = any> = BasePickerProps<
TInputValue,
Expand All @@ -13,18 +10,6 @@ export type AllSharedPickerProps<TInputValue = any, TDateValue = any> = BasePick
ExportedDateInputProps<TInputValue, TDateValue> &
WithDateAdapterProps<TDateValue>;

export interface SharedPickerProps<TInputValue, TDateValue, TInputProps = DateInputPropsLike> {
isMobileKeyboardViewOpen: boolean;
toggleMobileKeyboardView: () => void;
DateInputProps: TInputProps;
date: TDateValue;
onDateChange: (
date: TDateValue,
currentWrapperVariant: WrapperVariant,
isFinish?: PickerSelectionState,
) => void;
}

export interface WithViewsProps<T extends AllAvailableViews> {
/**
* Array of views to show.
Expand Down

0 comments on commit 81dc2d1

Please sign in to comment.