forked from mui/material-ui
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Infrastructure preparation for DateRangePicker (mui#1573)
* Make value for picker be a generic type * Spread new props from passing to the dom element * Split makePickerWith state hoc * Better type inference for new makePickerWithWrapper * Refactor and opimize shared prop types inference for pickers * Rename eome type names and files * Integrate validation back to usePickerState * Remove DateRangePicker code * Remove DateRangePickerUsage from index module * Fix small linter and ts errors * Fix build erros * Run prettier manually
- Loading branch information
1 parent
ba80c7e
commit 35e6b2d
Showing
28 changed files
with
324 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
docs/pages/demo/daterangepicker/BasicDateRangePicker.example.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React, { useState } from 'react'; | ||
import { DatePicker as DateRangePicker } from '@material-ui/pickers'; | ||
|
||
function BasicDateRangePicker() { | ||
const [selectedDate, handleDateChange] = useState([new Date(), null]); | ||
|
||
return <DateRangePicker value={selectedDate} onChange={date => handleDateChange(date)} />; | ||
} | ||
|
||
export default BasicDateRangePicker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Ad from '_shared/Ad'; | ||
import Example from '_shared/Example'; | ||
import PageMeta from '_shared/PageMeta'; | ||
import LinkedComponents from '_shared/LinkedComponents'; | ||
|
||
import * as BasicDateRangePicker from './BasicDateRangePicker.example'; | ||
|
||
<PageMeta component="Datepicker" /> | ||
|
||
## Date picker | ||
|
||
[Date pickers](https://material.io/components/pickers/) let users select a date, or a range of dates. They should be suitable for the context in which they appear. | ||
|
||
<Ad /> | ||
|
||
#### Basic usage | ||
|
||
Will be rendered to modal dialog on mobile and textfield with popover on desktop. | ||
|
||
<Example testId="datepicker-example" source={BasicDateRangePicker} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
{ | ||
"build/dist/material-ui-pickers.esm.js": { | ||
"bundled": 143471, | ||
"minified": 78671, | ||
"gzipped": 21103, | ||
"bundled": 145384, | ||
"minified": 79576, | ||
"gzipped": 21474, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 64934, | ||
"code": 65692, | ||
"import_statements": 2099 | ||
}, | ||
"webpack": { | ||
"code": 72410 | ||
"code": 73171 | ||
} | ||
} | ||
}, | ||
"build/dist/material-ui-pickers.umd.js": { | ||
"bundled": 597704, | ||
"minified": 222450, | ||
"gzipped": 45688 | ||
"bundled": 599635, | ||
"minified": 223221, | ||
"gzipped": 45558 | ||
}, | ||
"build/dist/material-ui-pickers.umd.min.js": { | ||
"bundled": 537438, | ||
"minified": 203944, | ||
"gzipped": 40910 | ||
"bundled": 539383, | ||
"minified": 204705, | ||
"gzipped": 40705 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { DateTimePickerView } from '../DateTimePicker'; | ||
import { BasePickerProps } from '../typings/BasePicker'; | ||
import { ExportedDateInputProps } from '../_shared/PureDateInput'; | ||
import { DateValidationProps } from '../_helpers/text-field-helper'; | ||
import { WithDateAdapterProps } from '../_shared/withDateAdapterProp'; | ||
|
||
export type AnyPickerView = DateTimePickerView; | ||
|
||
export type AllSharedPickerProps = WithDateAdapterProps & | ||
BasePickerProps & | ||
ExportedDateInputProps & | ||
DateValidationProps; | ||
|
||
export interface WithViewsProps<T extends AnyPickerView> { | ||
/** | ||
* Array of views to show | ||
*/ | ||
views?: T[]; | ||
/** First view to show */ | ||
openTo?: T; | ||
} | ||
|
||
export type WithDateInputProps = DateValidationProps & BasePickerProps & ExportedDateInputProps; |
Oops, something went wrong.