(createUtilsService
export const withUtilsService = (Component: React.ComponentType
) => {
const withUtilsService: React.SFC> = props => (
- {service => }
+ {service => }
);
diff --git a/docs/pages/guides/StaticComponents.example.jsx b/docs/pages/guides/StaticComponents.example.jsx
index 3798fa942..521a342fb 100644
--- a/docs/pages/guides/StaticComponents.example.jsx
+++ b/docs/pages/guides/StaticComponents.example.jsx
@@ -9,7 +9,6 @@ function StaticPickers() {
{ value, onChange: handleDateChange },
{
getDefaultFormat: () => 'MM/dd/yyyy',
- getValidationError: () => null,
}
);
diff --git a/lib/src/Picker/WrappedKeyboardPicker.tsx b/lib/src/Picker/WrappedKeyboardPicker.tsx
index 5d000a63a..e64dd7408 100644
--- a/lib/src/Picker/WrappedKeyboardPicker.tsx
+++ b/lib/src/Picker/WrappedKeyboardPicker.tsx
@@ -13,15 +13,17 @@ export type WrappedKeyboardPickerProps = DateValidationProps &
BaseKeyboardPickerProps &
ExtendWrapper;
-export interface MakePickerOptions {
+export interface MakePickerOptions {
useOptions: (props: any) => StateHookOptions;
ToolbarComponent: React.ComponentType;
}
+// Mostly duplicate of ./WrappedPurePicker.tsx to enable tree-shaking of keyboard logic
+// TODO investigate how to reduce duplications
export function makeKeyboardPicker({
useOptions,
ToolbarComponent,
-}: MakePickerOptions): React.FC {
+}: MakePickerOptions): React.FC {
function WrappedKeyboardPicker(props: WrappedKeyboardPickerProps & T) {
const {
allowKeyboardControl,
diff --git a/lib/src/Picker/WrappedPurePicker.tsx b/lib/src/Picker/WrappedPurePicker.tsx
index 0c52f53d7..ad2af46e8 100644
--- a/lib/src/Picker/WrappedPurePicker.tsx
+++ b/lib/src/Picker/WrappedPurePicker.tsx
@@ -14,7 +14,7 @@ export type WrappedPurePickerProps = DateValidationProps &
export function makePurePicker({
useOptions,
ToolbarComponent,
-}: MakePickerOptions): React.FC {
+}: MakePickerOptions): React.FC {
function WrappedPurePicker(props: WrappedPurePickerProps & T) {
const {
allowKeyboardControl,
diff --git a/lib/src/__tests__/DatePicker/Calendar.test.tsx b/lib/src/__tests__/DatePicker/Calendar.test.tsx
index 50b4bd9cd..9b5238970 100644
--- a/lib/src/__tests__/DatePicker/Calendar.test.tsx
+++ b/lib/src/__tests__/DatePicker/Calendar.test.tsx
@@ -49,39 +49,3 @@ describe('Calendar - disabled selected date on mount', () => {
expect(onChange).toHaveBeenCalledWith(utilsToUse.date('01-01-2018'), false);
});
});
-
-describe('Calendar - pop and push loading queue', () => {
- let component: ShallowWrapper;
-
- beforeEach(() => {
- component = shallowRender(props => (
-
- ));
- });
-
- it('Push two times to loading queue', () => {
- (component.instance() as Calendar).pushToLoadingQueue();
- (component.instance() as Calendar).pushToLoadingQueue();
-
- expect(component.state('loadingQueue')).toEqual(2);
- });
-
- it('Pop from empty loading queue', () => {
- (component.instance() as Calendar).popFromLoadingQueue();
-
- expect(component.state('loadingQueue')).toEqual(0);
- });
-
- it('Push and pop loading queue', () => {
- (component.instance() as Calendar).pushToLoadingQueue();
- (component.instance() as Calendar).popFromLoadingQueue();
-
- expect(component.state('loadingQueue')).toEqual(0);
- });
-});
diff --git a/lib/src/__tests__/e2e/DatePickerRoot.test.tsx b/lib/src/__tests__/e2e/DatePickerRoot.test.tsx
index 7b1b5555e..496f83e28 100644
--- a/lib/src/__tests__/e2e/DatePickerRoot.test.tsx
+++ b/lib/src/__tests__/e2e/DatePickerRoot.test.tsx
@@ -1,5 +1,6 @@
import * as React from 'react';
import { ReactWrapper } from 'enzyme';
+import { clickOKButton } from './commands';
import { mount, utilsToUse } from '../test-utils';
import { DatePicker, DatePickerProps } from '../../DatePicker';
@@ -12,6 +13,7 @@ describe('e2e - DatePicker', () => {
component = mount(
{
.find('Year')
.at(1)
.simulate('click');
+
+ clickOKButton(component);
expect(onChangeMock).toHaveBeenCalled();
});
});
@@ -78,7 +82,7 @@ describe('e2e -- DatePicker views year', () => {
.at(1)
.simulate('click');
- expect(onChangeMock).toHaveBeenCalled();
+ clickOKButton(component);
expect(onYearChangeMock).toHaveBeenCalled();
});
});
@@ -93,6 +97,7 @@ describe('e2e -- DatePicker views year and month', () => {
component = mount(
{
.first()
.simulate('click');
- expect(onChangeMock).toHaveBeenCalled();
expect(onMonthChangeMock).toHaveBeenCalled();
});
@@ -135,6 +139,7 @@ describe('e2e -- DatePicker views year and month open from year', () => {
component = mount(
{
@@ -27,18 +28,19 @@ describe('e2e - DateTimePicker', () => {
expect(component).toBeTruthy();
});
- it('Should render year selection', () => {
+ it('Should display year view', () => {
component
.find('ToolbarButton')
.first()
.simulate('click');
expect(component.find('Year').length).toBe(201);
-
component
.find('Year')
.at(1)
.simulate('click');
+
+ clickOKButton(component);
expect(onChangeMock).toHaveBeenCalled();
});
@@ -64,11 +66,7 @@ describe('e2e - DateTimePicker', () => {
.at(5)
.simulate('click');
- if (process.env.UTILS === 'moment') {
- expect(onChangeMock).toHaveBeenCalled();
- return;
- }
-
- expect(onChangeMock).toHaveBeenCalledWith(utilsToUse.date('2018-01-01T12:00:00.000Z'));
+ clickOKButton(component);
+ toHaveBeenCalledExceptMoment(onChangeMock, [utilsToUse.date('2018-01-01T12:00:00.000Z')]);
});
});
diff --git a/lib/src/__tests__/e2e/TimePicker.test.tsx b/lib/src/__tests__/e2e/TimePicker.test.tsx
index 2cc41848e..9915699b8 100644
--- a/lib/src/__tests__/e2e/TimePicker.test.tsx
+++ b/lib/src/__tests__/e2e/TimePicker.test.tsx
@@ -1,5 +1,6 @@
import * as React from 'react';
import { ReactWrapper } from 'enzyme';
+import { clickOKButton } from './commands';
import { TimePicker, TimePickerProps } from '../../TimePicker/TimePicker';
import { mount, utilsToUse, toHaveBeenCalledExceptMoment } from '../test-utils';
@@ -28,24 +29,20 @@ describe('e2e - TimePicker', () => {
it('Should submit onChange on moving', () => {
component.find('Clock div[role="menu"]').simulate('mouseMove', fakeTouchEvent);
-
- expect(onChangeMock).toHaveBeenCalled();
- });
-
- it('Should submit hourview (mouse move)', () => {
- component
- .find('WithStyles(ToolbarButton)')
- .at(1)
- .simulate('click');
component.find('Clock div[role="menu"]').simulate('mouseUp', fakeTouchEvent);
- expect(onChangeMock).toHaveBeenCalled();
+ expect(
+ component
+ .find('WithStyles(ToolbarButton)')
+ .at(0)
+ .text()
+ ).toBe('11');
});
it('Should change minutes (touch)', () => {
component
.find('WithStyles(ToolbarButton)')
- .at(2)
+ .at(1)
.simulate('click');
component.find('Clock div[role="menu"]').simulate('touchMove', {
@@ -58,19 +55,12 @@ describe('e2e - TimePicker', () => {
],
});
- expect(onChangeMock).toHaveBeenCalled();
-
- component.find('Clock div[role="menu"]').simulate('touchEnd', {
- buttons: 1,
- changedTouches: [
- {
- clientX: 20,
- clientY: 15,
- },
- ],
- });
-
- expect(onChangeMock).toHaveBeenCalled();
+ expect(
+ component
+ .find('WithStyles(ToolbarButton)')
+ .at(1)
+ .text()
+ ).toBe('53');
});
it('Should change meridiem mode', () => {
@@ -79,6 +69,7 @@ describe('e2e - TimePicker', () => {
.at(3)
.simulate('click');
+ clickOKButton(component);
toHaveBeenCalledExceptMoment(onChangeMock, [utilsToUse.date('2018-01-01T12:00:00.000')]);
});
});
@@ -124,6 +115,7 @@ describe('e2e - TimePicker with seconds', () => {
],
});
+ clickOKButton(component);
toHaveBeenCalledExceptMoment(onChangeMock, [utilsToUse.date('2018-01-01T00:00:53.000')]);
});
});
diff --git a/lib/src/__tests__/e2e/commands.tsx b/lib/src/__tests__/e2e/commands.tsx
new file mode 100644
index 000000000..e48478656
--- /dev/null
+++ b/lib/src/__tests__/e2e/commands.tsx
@@ -0,0 +1,8 @@
+import { ReactWrapper } from 'enzyme';
+
+export const clickOKButton = (component: ReactWrapper) => {
+ component
+ .find('ForwardRef(DialogActions) WithStyles(ForwardRef(Button))')
+ .at(1)
+ .simulate('click');
+};
diff --git a/lib/src/_shared/WithUtils.tsx b/lib/src/_shared/WithUtils.tsx
index 238aa463b..288321a2c 100644
--- a/lib/src/_shared/WithUtils.tsx
+++ b/lib/src/_shared/WithUtils.tsx
@@ -11,7 +11,7 @@ export interface WithUtilsProps {
export const withUtils = () => (Component: React.ComponentType
) => {
const WithUtils: React.SFC> = props => {
const utils = useUtils();
- return ;
+ return ;
};
WithUtils.displayName = `WithUtils(${Component.displayName || Component.name})`;
diff --git a/lib/src/_shared/hooks/useKeyDown.ts b/lib/src/_shared/hooks/useKeyDown.ts
index 20f9a9bc0..df17316ee 100644
--- a/lib/src/_shared/hooks/useKeyDown.ts
+++ b/lib/src/_shared/hooks/useKeyDown.ts
@@ -29,5 +29,5 @@ export function useKeyDown(active: boolean, keyHandlers: KeyHandlers) {
window.removeEventListener('keydown', handleKeyDown);
};
}
- }, [active]);
+ }, [active, keyHandlers]);
}
diff --git a/lib/src/_shared/hooks/useKeyboardPickerState.ts b/lib/src/_shared/hooks/useKeyboardPickerState.ts
index 32ddd93de..65953c36f 100644
--- a/lib/src/_shared/hooks/useKeyboardPickerState.ts
+++ b/lib/src/_shared/hooks/useKeyboardPickerState.ts
@@ -40,7 +40,7 @@ export function useKeyboardPickerState(props: BaseKeyboardPickerProps, options:
}
}, [format, props, props.value, utils]);
- function handleChange(date: MaterialUiPickersDate) {
+ function handleKeyboardChange(date: MaterialUiPickersDate) {
const dateString = date === null ? null : utils.format(date, format);
props.onChange(date, dateString);
@@ -48,13 +48,13 @@ export function useKeyboardPickerState(props: BaseKeyboardPickerProps, options:
const { inputProps: innerInputProps, wrapperProps, pickerProps } = usePickerState(
// Extend props interface
- { ...props, value: dateValue, onChange: handleChange },
+ { ...props, value: dateValue, onChange: handleKeyboardChange },
options
);
const inputProps = useMemo(
() => ({
- ...innerInputProps,
+ ...innerInputProps, // reuse validation and open/close logic
format: wrapperProps.format,
inputValue: props.inputValue || innerInputValue,
onChange: (value: string) => {
diff --git a/lib/src/_shared/hooks/useOpenState.ts b/lib/src/_shared/hooks/useOpenState.ts
new file mode 100644
index 000000000..b67cfe02a
--- /dev/null
+++ b/lib/src/_shared/hooks/useOpenState.ts
@@ -0,0 +1,30 @@
+/* eslint-disable react-hooks/rules-of-hooks */
+import { useCallback, useState } from 'react';
+import { BasePickerProps } from '../../typings/BasePicker';
+
+function makeControlledOpenProps(props: BasePickerProps) {
+ return {
+ isOpen: props.open!,
+ setIsOpen: (newIsOpen: boolean) => {
+ return newIsOpen ? props.onOpen && props.onOpen() : props.onClose && props.onClose();
+ },
+ };
+}
+
+export function useOpenState(props: BasePickerProps) {
+ if (props.open !== undefined && props.open !== null) {
+ return makeControlledOpenProps(props);
+ }
+
+ const [isOpen, setIsOpenState] = useState(false);
+ // prettier-ignore
+ const setIsOpen = useCallback((newIsOpen: boolean) => {
+ setIsOpenState(newIsOpen);
+
+ return newIsOpen
+ ? props.onOpen && props.onOpen()
+ : props.onClose && props.onClose();
+ }, [props]);
+
+ return { isOpen, setIsOpen };
+}
diff --git a/lib/src/_shared/hooks/usePickerState.ts b/lib/src/_shared/hooks/usePickerState.ts
index 987eadd8e..838e8cc61 100644
--- a/lib/src/_shared/hooks/usePickerState.ts
+++ b/lib/src/_shared/hooks/usePickerState.ts
@@ -2,13 +2,13 @@ import { useMemo } from 'react';
import { useUtils } from './useUtils';
import { IUtils } from '@date-io/core/IUtils';
import { MaterialUiPickersDate } from '../..';
+import { useOpenState } from './useOpenState';
import { BasePickerProps } from '../../typings/BasePicker';
+import { useCallback, useDebugValue, useEffect, useState } from 'react';
import { getDisplayDate, validate } from '../../_helpers/text-field-helper';
-import { useCallback, useDebugValue, useEffect, useRef, useState } from 'react';
export interface StateHookOptions {
getDefaultFormat: () => string;
- getValidationError?: () => React.ReactNode;
}
const valueToDate = (
@@ -24,112 +24,82 @@ const valueToDate = (
function useDateValues(props: BasePickerProps, options: StateHookOptions) {
const utils = useUtils();
const date = valueToDate(utils, props);
- const acceptedDateRef = useRef(date);
const format = props.format || options.getDefaultFormat();
- return { acceptedDateRef, date, format };
+ return { date, format };
}
-function makeControlledOpenProps(props: BasePickerProps) {
- return {
- isOpen: props.open!,
- setIsOpen: (newIsOpen: boolean) => {
- return newIsOpen ? props.onOpen && props.onOpen() : props.onClose && props.onClose();
- },
- };
-}
-
-/* eslint-disable react-hooks/rules-of-hooks */
-function useOpenState(props: BasePickerProps) {
- if (props.open !== undefined && props.open !== null) {
- return makeControlledOpenProps(props);
- }
-
- const [isOpen, setIsOpenState] = useState(false);
- // prettier-ignore
- const setIsOpen = useCallback((newIsOpen: boolean) => {
- setIsOpenState(newIsOpen);
-
- return newIsOpen
- ? props.onOpen && props.onOpen()
- : props.onClose && props.onClose()
- }, [props]);
-
- return { isOpen, setIsOpen };
-}
-/* eslint-enable react-hooks/rules-of-hooks */
-
export function usePickerState(props: BasePickerProps, options: StateHookOptions) {
const utils = useUtils();
const { isOpen, setIsOpen } = useOpenState(props);
- const { acceptedDateRef, date, format } = useDateValues(props, options);
+ const { date, format } = useDateValues(props, options);
+ const [pickerDate, setPickerDate] = useState(date);
- if (!isOpen) {
- // if value was changed in closed state treat it as accepted
- acceptedDateRef.current = date;
- }
-
- const validationError = validate(props.value, utils, props);
useEffect(() => {
- if (validationError && props.onError) {
- props.onError(validationError, props.value);
+ // if value was changed in closed state - treat it as accepted
+ if (!isOpen && !utils.isEqual(pickerDate, date)) {
+ setPickerDate(date);
}
- }, [props, validationError]);
-
- const inputProps = useMemo(
- () => ({
- validationError,
- onClick: () => !props.disabled && setIsOpen(true),
- inputValue: getDisplayDate(
- acceptedDateRef.current,
- format,
- utils,
- props.value === null,
- props
- ),
- }),
- [acceptedDateRef, format, props, setIsOpen, utils, validationError]
- );
+ }, [date, isOpen, pickerDate, utils]);
- // prettier-ignore
- const acceptDate = useCallback((acceptedDate: MaterialUiPickersDate) => {
- acceptedDateRef.current = acceptedDate;
+ const acceptDate = useCallback(
+ (acceptedDate: MaterialUiPickersDate) => {
+ setIsOpen(false);
+ props.onChange(acceptedDate);
- setIsOpen(false);
- props.onChange(acceptedDate);
-
- if (props.onAccept) {
- props.onAccept(acceptedDate);
- }
- }, [acceptedDateRef, setIsOpen, props]);
+ if (props.onAccept) {
+ props.onAccept(acceptedDate);
+ }
+ },
+ [setIsOpen, props]
+ );
const wrapperProps = useMemo(
() => ({
format,
open: isOpen,
- onAccept: () => acceptDate(date),
+ onAccept: () => acceptDate(pickerDate),
onClear: () => acceptDate(null),
onSetToday: () => props.onChange(utils.date()),
onDismiss: () => {
setIsOpen(false);
- props.onChange(acceptedDateRef.current);
},
}),
- [acceptDate, acceptedDateRef, date, format, isOpen, props, setIsOpen, utils]
+ [acceptDate, format, isOpen, pickerDate, props, setIsOpen, utils]
);
const pickerProps = useMemo(
() => ({
- date,
+ date: pickerDate,
onChange: (newDate: MaterialUiPickersDate, isFinish = true) => {
- props.onChange(newDate);
+ setPickerDate(newDate);
+
+ if (props.variant === 'inline') {
+ props.onChange(newDate);
+ }
if (isFinish && props.autoOk) {
acceptDate(newDate);
}
},
}),
- [acceptDate, date, props]
+ [acceptDate, pickerDate, props]
+ );
+
+ const validationError = validate(props.value, utils, props);
+ useEffect(() => {
+ if (validationError && props.onError) {
+ props.onError(validationError, props.value);
+ }
+ }, [props, validationError]);
+
+ const inputProps = useMemo(
+ () => ({
+ validationError,
+ onClick: () => !props.disabled && setIsOpen(true),
+ inputValue: getDisplayDate(date, format, utils, props.value === null, props),
+ }),
+ [date, format, props, setIsOpen, utils, validationError]
);
const pickerState = { pickerProps, inputProps, wrapperProps };
diff --git a/lib/src/typings/BasePicker.tsx b/lib/src/typings/BasePicker.tsx
index 089504576..0f3f1b36e 100644
--- a/lib/src/typings/BasePicker.tsx
+++ b/lib/src/typings/BasePicker.tsx
@@ -1,4 +1,5 @@
import { MaterialUiPickersDate } from './date';
+import { WrapperVariant } from '../wrappers/Wrapper';
import { ParsableDate } from '../constants/prop-types';
export interface BasePickerProps {
@@ -44,6 +45,7 @@ export interface BasePickerProps {
* @default false
*/
disableToolbar?: boolean;
+ variant?: WrapperVariant;
mergePreviousDateOnChange?: boolean;
forwardedRef?: any;
}
diff --git a/yarn.lock b/yarn.lock
index 3e476e4d6..229234be6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1061,24 +1061,24 @@
unist-util-visit "^1.1.3"
"@material-ui/core@^4.0.0", "@material-ui/core@^4.0.0-beta.1":
- version "4.0.1"
- resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.0.1.tgz#7fe3bcb1a89b01376b181358a5ded58291da0016"
- integrity sha512-cw2Qs3BLem8FOrp/knfjJkwJXG4dZO/HGyWwZV71UWiqDIOF3plHZ7duCbOMIWwKgSUJ85k9omlSHUTT63E/pw==
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.0.2.tgz#c7a07c1d1b13b94adf479d7267b51cb682fcb279"
+ integrity sha512-k7o95UIupTp14lsO9hejmswuPZsmWUafOBNaptHN+Pv8CBp/vW+hD6peuThgUpeGesrCuL2/yTpHB/9JkO9rNg==
dependencies:
"@babel/runtime" "^7.2.0"
- "@material-ui/styles" "^4.0.1"
- "@material-ui/system" "^4.0.1"
+ "@material-ui/styles" "^4.0.2"
+ "@material-ui/system" "^4.0.2"
"@material-ui/types" "^4.0.1"
"@material-ui/utils" "^4.0.1"
"@types/react-transition-group" "^2.0.16"
clsx "^1.0.2"
- convert-css-length "^1.0.2"
+ convert-css-length "^2.0.0"
csstype "^2.5.2"
debounce "^1.1.0"
deepmerge "^3.0.0"
hoist-non-react-statics "^3.2.1"
- is-plain-object "^2.0.4"
- normalize-scroll-left "^0.1.2"
+ is-plain-object "^3.0.0"
+ normalize-scroll-left "^0.2.0"
popper.js "^1.14.1"
prop-types "^15.7.2"
react-event-listener "^0.6.6"
@@ -1093,10 +1093,10 @@
"@babel/runtime" "^7.2.0"
recompose "0.28.0 - 0.30.0"
-"@material-ui/styles@^4.0.0", "@material-ui/styles@^4.0.0-alpha.7", "@material-ui/styles@^4.0.1":
- version "4.0.1"
- resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.0.1.tgz#67e880d490f010c9f2956c572b07d218bfa255d7"
- integrity sha512-SywkWzBzXvm9dUY2rtmzTc/FTlKGctVYGb8hzPZyHU3OI4X9jQH4YnR/OiqTwg4jNpFnASJX5rW1rEUJM+ZnhA==
+"@material-ui/styles@^4.0.0", "@material-ui/styles@^4.0.0-alpha.7", "@material-ui/styles@^4.0.2":
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.0.2.tgz#05805b26bfcd876f883b098e4be50d813b1c5fde"
+ integrity sha512-RUM+2G++2X4M6cbZ/K/PzAdxdSdqIU4zhZ82YYIcEz/OgCx72HC68+VrYxoy7nEjZ9E6R+9JmPPS7CO8O1oPmw==
dependencies:
"@babel/runtime" "^7.2.0"
"@emotion/hash" "^0.7.1"
@@ -1116,10 +1116,10 @@
prop-types "^15.7.2"
warning "^4.0.1"
-"@material-ui/system@^4.0.1":
- version "4.0.1"
- resolved "https://registry.yarnpkg.com/@material-ui/system/-/system-4.0.1.tgz#d78969f3dd9eb6baf82ded0ef183368d8befb00b"
- integrity sha512-NlMF4jZk1xx7taUOT+QhrJw7v7uUi9Ae+G8C8fowGgP5x04whxOuSuSmN9a8u2j7dc8XqahR0OJeA6Xch8ymog==
+"@material-ui/system@^4.0.2":
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/@material-ui/system/-/system-4.0.2.tgz#224a75b4168994cb2e903849cc1d608e3cc327f1"
+ integrity sha512-gpLYcDycJjK8tvWI9ZKrVLdGjFQ/YJM74TvhIMkP5ML453ZtPuFzMLt6FVEKp8okWxFEgYXVBNNSB4IF3Yig8g==
dependencies:
"@babel/runtime" "^7.2.0"
deepmerge "^3.0.0"
@@ -1369,15 +1369,10 @@
dependencies:
"@types/node" "*"
-"@types/node@*":
- version "12.0.4"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.4.tgz#46832183115c904410c275e34cf9403992999c32"
- integrity sha512-j8YL2C0fXq7IONwl/Ud5Kt0PeXw22zGERt+HSSnwbKOJVsAGkEz3sFCYwaF9IOuoG1HOtE0vKCj6sXF7Q0+Vaw==
-
-"@types/node@^11.13.9":
- version "11.13.10"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.10.tgz#4df59e5966b56f512bac98898bcbee5067411f0f"
- integrity sha512-leUNzbFTMX94TWaIKz8N15Chu55F9QSH+INKayQr5xpkasBQBRF3qQXfo3/dOnMU/dEIit+Y/SU8HyOjq++GwA==
+"@types/node@*", "@types/node@^12.0.3":
+ version "12.0.7"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.7.tgz#4f2563bad652b2acb1722d7e7aae2b0ff62d192c"
+ integrity sha512-1YKeT4JitGgE4SOzyB9eMwO0nGVNkNEsm9qlIt1Lqm/tG2QEiSMTD4kS3aO6L+w5SClLVxALmIBESK6Mk5wX0A==
"@types/prettier@^1.16.0":
version "1.16.4"
@@ -1432,9 +1427,9 @@
"@types/webpack" "*"
"@types/react-transition-group@^2.0.15", "@types/react-transition-group@^2.0.16":
- version "2.9.1"
- resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-2.9.1.tgz#66c9ca5d0b20bae72fe6b797e0d362b996d55e9f"
- integrity sha512-1usq4DRUVBFnxc9KGJAlJO9EpQrLZGDDEC8wDOn2+2ODSyudYo8FiIzPDRaX/hfQjHqGeeoNaNdA2bj0l35hZQ==
+ version "2.9.2"
+ resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-2.9.2.tgz#c48cf2a11977c8b4ff539a1c91d259eaa627028d"
+ integrity sha512-5Fv2DQNO+GpdPZcxp2x/OQG/H19A01WlmpjVD9cKvVFmoVLOZ9LvBgSWG6pSXIU4og5fgbvGPaCV5+VGkWAEHA==
dependencies:
"@types/react" "*"
@@ -2885,12 +2880,12 @@ check-types@^7.3.0:
integrity sha512-YbulWHdfP99UfZ73NcUDlNJhEIDgm9Doq9GhpyXbF+7Aegi3CVV7qqMCKTTqJxlvEvnQBp9IA+dxsGN6xK/nSg==
cheerio@^1.0.0-rc.2:
- version "1.0.0-rc.2"
- resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db"
- integrity sha1-S59TqBsn5NXawxwP/Qz6A8xoMNs=
+ version "1.0.0-rc.3"
+ resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.3.tgz#094636d425b2e9c0f4eb91a46c05630c9a1a8bf6"
+ integrity sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==
dependencies:
css-select "~1.2.0"
- dom-serializer "~0.1.0"
+ dom-serializer "~0.1.1"
entities "~1.1.1"
htmlparser2 "^3.9.1"
lodash "^4.15.0"
@@ -3231,10 +3226,10 @@ content-type@~1.0.4:
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"
integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==
-convert-css-length@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/convert-css-length/-/convert-css-length-1.0.2.tgz#32f38a8ac55d78372ff43562532564366c871ccc"
- integrity sha512-ecV7j3hXyXN1X2XfJBzhMR0o1Obv0v3nHmn0UiS3ACENrzbxE/EknkiunS/fCwQva0U62X1GChi8GaPh4oTlLg==
+convert-css-length@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/convert-css-length/-/convert-css-length-2.0.0.tgz#0c60ff686e70625ef7f3fd305a2f61f33a96c289"
+ integrity sha512-ygBgHNzImHJ/kjgqdzC0oaY2+EMID3s88/CZD2C9O1stM3PwsOwXzzlFTTkZy/bPZe0wjyt1UoYjilfunQGjlw==
dependencies:
console-polyfill "^0.1.2"
parse-unit "^1.0.1"
@@ -3691,9 +3686,9 @@ date-fns@^1.27.2:
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
date-fns@^2.0.0-alpha.27:
- version "2.0.0-alpha.27"
- resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.27.tgz#5ecd4204ef0e7064264039570f6e8afbc014481c"
- integrity sha512-cqfVLS+346P/Mpj2RpDrBv0P4p2zZhWWvfY5fuWrXNR/K38HaAGEkeOwb47hIpQP9Jr/TIxjZ2/sNMQwdXuGMg==
+ version "2.0.0-alpha.31"
+ resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.31.tgz#51bcfdca25dfc9bea334a556ab33dfc0bb00421c"
+ integrity sha512-S19PwMqnbYsqcbCg02Yj9gv4veVNZ0OX7v2+zcd+Mq0RI7LoDKJipJjnMrTZ3Cc6blDuTce5G/pHXcVIGRwJWQ==
date-now@^0.1.4:
version "0.1.4"
@@ -3923,7 +3918,7 @@ dom-helpers@^3.4.0:
dependencies:
"@babel/runtime" "^7.1.2"
-dom-serializer@0, dom-serializer@~0.1.0:
+dom-serializer@0, dom-serializer@~0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0"
integrity sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==
@@ -4105,9 +4100,9 @@ entities@^1.1.1, entities@~1.1.1:
integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==
enzyme-adapter-react-16@^1.9.1:
- version "1.13.2"
- resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.13.2.tgz#8a574d7cbbef7ef0cab2022e9bfc12aeaebb7ae5"
- integrity sha512-h0neTuAAFfQUgEZ+PPHVIMDFJ9+CGafI8AjojNlSVh4Fd1pLDgtl2OeVkm4yKF7RSgzrPAwugq4JW8Jjo2iRJA==
+ version "1.14.0"
+ resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.14.0.tgz#204722b769172bcf096cb250d33e6795c1f1858f"
+ integrity sha512-7PcOF7pb4hJUvjY7oAuPGpq3BmlCig3kxXGi2kFx0YzJHppqX1K8IIV9skT1IirxXlu8W7bneKi+oQ10QRnhcA==
dependencies:
enzyme-adapter-utils "^1.12.0"
has "^1.0.3"
@@ -4131,9 +4126,9 @@ enzyme-adapter-utils@^1.12.0:
semver "^5.6.0"
enzyme@^3.8.0:
- version "3.9.0"
- resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.9.0.tgz#2b491f06ca966eb56b6510068c7894a7e0be3909"
- integrity sha512-JqxI2BRFHbmiP7/UFqvsjxTirWoM1HfeaJrmVSZ9a1EADKkZgdPcAuISPMpoUiHlac9J4dYt81MC5BBIrbJGMg==
+ version "3.10.0"
+ resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.10.0.tgz#7218e347c4a7746e133f8e964aada4a3523452f6"
+ integrity sha512-p2yy9Y7t/PFbPoTvrWde7JIYB2ZyGC+NgTNbVEGvZ5/EyoYSr9aG/2rSbVvyNvMHEhw9/dmGUJHWtfQIEiX9pg==
dependencies:
array.prototype.flat "^1.2.1"
cheerio "^1.0.0-rc.2"
@@ -5308,9 +5303,9 @@ html-comment-regex@^1.1.0:
integrity sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==
html-element-map@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/html-element-map/-/html-element-map-1.0.0.tgz#19a41940225153ecdfead74f8509154ff1cdc18b"
- integrity sha512-/SP6aOiM5Ai9zALvCxDubIeez0LvG3qP7R9GcRDnJEP/HBmv0A8A9K0o8+HFudcFt46+i921ANjzKsjPjb7Enw==
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/html-element-map/-/html-element-map-1.0.1.tgz#3c4fcb4874ebddfe4283b51c8994e7713782b592"
+ integrity sha512-BZSfdEm6n706/lBfXKWa4frZRZcT5k1cOusw95ijZsHlI+GdgY0v95h6IzO3iIDf2ROwq570YTwqNPqHcNMozw==
dependencies:
array-filter "^1.0.0"
@@ -5869,6 +5864,13 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4:
dependencies:
isobject "^3.0.1"
+is-plain-object@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.0.tgz#47bfc5da1b5d50d64110806c199359482e75a928"
+ integrity sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==
+ dependencies:
+ isobject "^4.0.0"
+
is-promise@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
@@ -5981,6 +5983,11 @@ isobject@^3.0.0, isobject@^3.0.1:
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
+isobject@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0"
+ integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==
+
isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
@@ -6630,63 +6637,63 @@ jss-nested@^6.0.1:
warning "^3.0.0"
jss-plugin-camel-case@^10.0.0-alpha.16:
- version "10.0.0-alpha.16"
- resolved "https://registry.yarnpkg.com/jss-plugin-camel-case/-/jss-plugin-camel-case-10.0.0-alpha.16.tgz#36023c9aa35fd2e898f117be136f31dfa76ffef9"
- integrity sha512-nki+smHEsFyoZ0OlOYtaxVqcQA0ZHVJCE1slRnk+1TklbmxbBiO4TwITMTEaNIDv0U0Uyb0Z8wVgFgRwCCIFog==
+ version "10.0.0-alpha.17"
+ resolved "https://registry.yarnpkg.com/jss-plugin-camel-case/-/jss-plugin-camel-case-10.0.0-alpha.17.tgz#6f7c9d9742e349bb061e53cd9b1c3cb006169a67"
+ integrity sha512-aPY4kr6MwliH7KToLRzeSk1NxXUo9n7MQsAa0Hghwj01x9UnMkDkGAKENMKUtPjGkQZfiJpB9tTLFrSJ/6VrIQ==
dependencies:
"@babel/runtime" "^7.3.1"
hyphenate-style-name "^1.0.3"
- jss "10.0.0-alpha.16"
+ jss "10.0.0-alpha.17"
jss-plugin-default-unit@^10.0.0-alpha.16:
- version "10.0.0-alpha.16"
- resolved "https://registry.yarnpkg.com/jss-plugin-default-unit/-/jss-plugin-default-unit-10.0.0-alpha.16.tgz#ef96b529fcb9f8d730c14a489a1d7e71e243447e"
- integrity sha512-jjGW4F/r9yKvoyUk22M8nWhdMfvoWzJw/oFO2cDRXCk2onnWFiRALfqeUsEDyocwdZbyVF9WhZbSHn4GL03kSw==
+ version "10.0.0-alpha.17"
+ resolved "https://registry.yarnpkg.com/jss-plugin-default-unit/-/jss-plugin-default-unit-10.0.0-alpha.17.tgz#4e3bf6d8e9691a8e05d50b5abf300515eb0f67ee"
+ integrity sha512-KQgiXczvzJ9AlFdD8NS7FZLub0NSctSrCA9Yi/GqdsfJg4ZCriU4DzIybCZBHCi/INFGJmLIESYWSxnuhAzgSQ==
dependencies:
"@babel/runtime" "^7.3.1"
- jss "10.0.0-alpha.16"
+ jss "10.0.0-alpha.17"
jss-plugin-global@^10.0.0-alpha.16:
- version "10.0.0-alpha.16"
- resolved "https://registry.yarnpkg.com/jss-plugin-global/-/jss-plugin-global-10.0.0-alpha.16.tgz#6da34ad63e0a4669a35412d716d39820bd10ede4"
- integrity sha512-B1mm2ZF9OEsWPmzkG5ZUXqV88smDqpc4unILLXhWVuj0U5JeT0DNitH+QbXFrSueDJzkWVfvqyckvWDR/0qeDg==
+ version "10.0.0-alpha.17"
+ resolved "https://registry.yarnpkg.com/jss-plugin-global/-/jss-plugin-global-10.0.0-alpha.17.tgz#13005f6b963aee3c1498fe2bad767967ad2eb838"
+ integrity sha512-WYxiwwI+CLk0ozW8loeceqXBAZXBMsLBEZeRwVf9WX+FljdJkGwVZpRCk6LBX4aXnqAGyKqCxIAIJ3KP2yBdEg==
dependencies:
"@babel/runtime" "^7.3.1"
- jss "10.0.0-alpha.16"
+ jss "10.0.0-alpha.17"
jss-plugin-nested@^10.0.0-alpha.16:
- version "10.0.0-alpha.16"
- resolved "https://registry.yarnpkg.com/jss-plugin-nested/-/jss-plugin-nested-10.0.0-alpha.16.tgz#282ce431cc6c7c4b2e2509b80dc5cc1de7f7102f"
- integrity sha512-3l/MB6COnIpq4GOXQFae6UydoaIPa81UxhuBTEQuiAojgTeUla9L7nB3h18Q4zAhQQpjxaEsyppAKuEzIP7kPQ==
+ version "10.0.0-alpha.17"
+ resolved "https://registry.yarnpkg.com/jss-plugin-nested/-/jss-plugin-nested-10.0.0-alpha.17.tgz#cb1c20cdc81558c164eaa333bbb24c88bef12202"
+ integrity sha512-onpFqv904KCujryf2t6IIV1/QoB7cSF7ojrd4UujcN5TPvYOvXF5bchi7jnHG5U0SLlRSDGMLJ9fhtoCknhEbw==
dependencies:
"@babel/runtime" "^7.3.1"
- jss "10.0.0-alpha.16"
+ jss "10.0.0-alpha.17"
tiny-warning "^1.0.2"
jss-plugin-props-sort@^10.0.0-alpha.16:
- version "10.0.0-alpha.16"
- resolved "https://registry.yarnpkg.com/jss-plugin-props-sort/-/jss-plugin-props-sort-10.0.0-alpha.16.tgz#d91566d6c73ebd906ff81fdfb93135d16bbfb067"
- integrity sha512-+Yn9nugHAH58nf/d43H2uxMvlCFPDgLKRSmKO4Q4m1IGYjMbHsWt1Rk2HfC9IiCanqcqpc8hstwtzf+HG7PWFQ==
+ version "10.0.0-alpha.17"
+ resolved "https://registry.yarnpkg.com/jss-plugin-props-sort/-/jss-plugin-props-sort-10.0.0-alpha.17.tgz#a49be72b8dc8e2861f8136661c53d130abb07ccd"
+ integrity sha512-KnbyrxCbtQTqpDx2mSZU/r/E5QnDPIVfIxRi8K+W/q4gZpomBvqWC+xgvAk9hbpmA6QBoQaOilV8o12w2IZ6fg==
dependencies:
"@babel/runtime" "^7.3.1"
- jss "10.0.0-alpha.16"
+ jss "10.0.0-alpha.17"
jss-plugin-rule-value-function@^10.0.0-alpha.16:
- version "10.0.0-alpha.16"
- resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.0.0-alpha.16.tgz#42bf684dae0a73a02df0a3297b747becf9854449"
- integrity sha512-MQap9ne6ZGZH0NlpSQTMSm6QalBTF0hYpd2uaGQwam+GlT7IKeO+sTjd46I1WgO3kyOmwb0pIY6CnuLQGXKtSA==
+ version "10.0.0-alpha.17"
+ resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.0.0-alpha.17.tgz#45617ccc2d695d77287554e7dbe3b9c37f5f5af4"
+ integrity sha512-8AuJB44Q+ehfkWVRi2XlRbUf6SrLmrHTa5EXd6dgQRCCRuvGmqX8Dl4fZvNeKRFjTLPZgzg9+31rqeOMhKa2vA==
dependencies:
"@babel/runtime" "^7.3.1"
- jss "10.0.0-alpha.16"
+ jss "10.0.0-alpha.17"
jss-plugin-vendor-prefixer@^10.0.0-alpha.16:
- version "10.0.0-alpha.16"
- resolved "https://registry.yarnpkg.com/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.0.0-alpha.16.tgz#f59d92db7331d6615b33aa108ee54cbf1ab6ce84"
- integrity sha512-70yJ6QE5dN8VlPUGKld5jK2SKyrteheEL/ismexpybIufunMs6iJgkhDndbOfv8ia13yZgUVqeakMdhRKYwK1A==
+ version "10.0.0-alpha.17"
+ resolved "https://registry.yarnpkg.com/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.0.0-alpha.17.tgz#7bb05076d1a14d20b567231c36e57ebf6cb6625f"
+ integrity sha512-wDq9EL0QaoMGSGifPEBb+/SA9LBcqPEW0jpL9ht+Z2t+lV7NNz0j7uCEOuE6FvNWqHzUKTsiATs1rTHPkzNBEQ==
dependencies:
"@babel/runtime" "^7.3.1"
css-vendor "^2.0.1"
- jss "10.0.0-alpha.16"
+ jss "10.0.0-alpha.17"
jss-preset-default@^4.3.0:
version "4.5.0"
@@ -6730,10 +6737,10 @@ jss-vendor-prefixer@^7.0.0:
dependencies:
css-vendor "^0.3.8"
-jss@10.0.0-alpha.16, jss@^10.0.0-alpha.16:
- version "10.0.0-alpha.16"
- resolved "https://registry.yarnpkg.com/jss/-/jss-10.0.0-alpha.16.tgz#0555e8b667e08dbd2cc94f6125be5a8b8b022833"
- integrity sha512-HmKNNnr82TR5jkWjBcbrx/uim2ief588pWp7zsf4GQpL125zRkEaWYL1SXv5bR6bBvAoTtvJsTAOxDIlLxUNZg==
+jss@10.0.0-alpha.17, jss@^10.0.0-alpha.16:
+ version "10.0.0-alpha.17"
+ resolved "https://registry.yarnpkg.com/jss/-/jss-10.0.0-alpha.17.tgz#3057c85a846c3bd207c04aafd91c8277955d9c57"
+ integrity sha512-egGIUg+YRu0+U+XXlD0gmVtU/gW5sn7+qmDv7opwK5s8emZBE/VoN55X6CaMrAa0kLeGMldnI43KOWea6M9/mA==
dependencies:
"@babel/runtime" "^7.3.1"
is-in-browser "^1.1.3"
@@ -7826,10 +7833,10 @@ normalize-path@^3.0.0:
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
-normalize-scroll-left@^0.1.2:
- version "0.1.2"
- resolved "https://registry.yarnpkg.com/normalize-scroll-left/-/normalize-scroll-left-0.1.2.tgz#6b79691ba79eb5fb107fa5edfbdc06b55caee2aa"
- integrity sha512-F9YMRls0zCF6BFIE2YnXDRpHPpfd91nOIaNdDgrx5YMoPLo8Wqj+6jNXHQsYBavJeXP4ww8HCt0xQAKc5qk2Fg==
+normalize-scroll-left@^0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/normalize-scroll-left/-/normalize-scroll-left-0.2.0.tgz#9445d74275f303cc661e113329aefa492f58114c"
+ integrity sha512-t5oCENZJl8TGusJKoCJm7+asaSsPuNmK6+iEjrZ5TyBj2f02brCRsd4c83hwtu+e5d4LCSBZ0uoDlMjBo+A8yA==
normalize-url@^3.0.0:
version "3.3.0"
@@ -8831,9 +8838,9 @@ prelude-ls@~1.1.2:
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
prettier@^1.14.3:
- version "1.17.1"
- resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.1.tgz#ed64b4e93e370cb8a25b9ef7fef3e4fd1c0995db"
- integrity sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg==
+ version "1.18.2"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
+ integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
pretty-format@^23.6.0:
version "23.6.0"
@@ -9260,9 +9267,9 @@ read-pkg@^4.0.1:
util-deprecate "~1.0.1"
readable-stream@^3.1.1:
- version "3.1.1"
- resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.1.1.tgz#ed6bbc6c5ba58b090039ff18ce670515795aeb06"
- integrity sha512-DkN66hPyqDhnIQ6Jcsvx9bFjhw214O4poMBcIMgPVpQvNy9a0e0Uhg5SqySyDKAmUlwt8LonTBz1ezOnM8pUdA==
+ version "3.4.0"
+ resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc"
+ integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==
dependencies:
inherits "^2.0.3"
string_decoder "^1.1.1"
@@ -9596,10 +9603,10 @@ resolve@1.x, resolve@^1.4.0, resolve@^1.8.1:
dependencies:
path-parse "^1.0.6"
-resolve@^1.10.0, resolve@^1.3.2:
- version "1.11.0"
- resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232"
- integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==
+resolve@^1.10.0:
+ version "1.11.1"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e"
+ integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==
dependencies:
path-parse "^1.0.6"
@@ -9610,6 +9617,13 @@ resolve@^1.10.1:
dependencies:
path-parse "^1.0.6"
+resolve@^1.3.2:
+ version "1.11.0"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232"
+ integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==
+ dependencies:
+ path-parse "^1.0.6"
+
restore-cursor@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541"
@@ -9682,9 +9696,9 @@ rollup-plugin-commonjs@^9.2.0:
rollup-pluginutils "^2.6.0"
rollup-plugin-node-resolve@^4.0.1:
- version "4.2.3"
- resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.2.3.tgz#638a373a54287d19fcc088fdd1c6fd8a58e4d90a"
- integrity sha512-r+WaesPzdGEynpLZLALFEDugA4ACa5zn7bc/+LVX4vAXQQ8IgDHv0xfsSvJ8tDXUtprfBtrDtRFg27ifKjcJTg==
+ version "4.2.4"
+ resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.2.4.tgz#7d370f8d6fd3031006a0032c38262dd9be3c6250"
+ integrity sha512-t/64I6l7fZ9BxqD3XlX4ZeO6+5RLKyfpwE2CiPNUKa+GocPlQhf/C208ou8y3AwtNsc6bjSk/8/6y/YAyxCIvw==
dependencies:
"@types/resolve" "0.0.8"
builtin-modules "^3.1.0"
@@ -9750,12 +9764,12 @@ rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0:
micromatch "^3.1.10"
rollup@^1.1.2:
- version "1.11.3"
- resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.11.3.tgz#6f436db2a2d6b63f808bf60ad01a177643dedb81"
- integrity sha512-81MR7alHcFKxgWzGfG7jSdv+JQxSOIOD/Fa3iNUmpzbd7p+V19e1l9uffqT8/7YAHgGOzmoPGN3Fx3L2ptOf5g==
+ version "1.14.4"
+ resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.14.4.tgz#f9af78f142e8c5851e3392bda488df489181ac60"
+ integrity sha512-sR5/cqbQUg72Lm2TZgjzI3/Q1V7osP/PXlqNpSLCMSTnSg8xQ9ECFQSNEG1OOjKzPMqboEqeayRyYzi+IfkDgQ==
dependencies:
"@types/estree" "0.0.39"
- "@types/node" "^11.13.9"
+ "@types/node" "^12.0.3"
acorn "^6.1.1"
rst-selector-parser@^2.2.3:
From 68779c7237976c8f56278322885aee980cbc3ed5 Mon Sep 17 00:00:00 2001
From: Dmitriy Kovalenko
Date: Sun, 9 Jun 2019 11:03:22 +0300
Subject: [PATCH 24/76] [docs] Add fetching data example (#1097)
* Use inner state for displayed date in calendar
* Make inline pickers controlled by default
* Fix tests
* Fix deadlock on rendering with usePickerState
* Fix crashing on utils change
* [docs] Add fetching data example
* Change text and remove unnecessary details from example
* Adjust some props description
---
.../demo/datepicker/CustomDay.example.jsx | 12 +--
.../demo/datepicker/ServerRequest.example.jsx | 42 +++++++++
docs/pages/demo/datepicker/index.mdx | 8 ++
docs/prop-types.json | 90 ++++++++++++-------
docs/utils/helpers.ts | 2 +-
lib/src/DatePicker/DatePicker.tsx | 2 +-
lib/src/DatePicker/components/Calendar.tsx | 12 ++-
7 files changed, 124 insertions(+), 44 deletions(-)
create mode 100644 docs/pages/demo/datepicker/ServerRequest.example.jsx
diff --git a/docs/pages/demo/datepicker/CustomDay.example.jsx b/docs/pages/demo/datepicker/CustomDay.example.jsx
index e8c2ff430..cc223f4fa 100644
--- a/docs/pages/demo/datepicker/CustomDay.example.jsx
+++ b/docs/pages/demo/datepicker/CustomDay.example.jsx
@@ -6,10 +6,10 @@ import endOfWeek from 'date-fns/endOfWeek';
import React, { PureComponent } from 'react';
import startOfWeek from 'date-fns/startOfWeek';
import isWithinInterval from 'date-fns/isWithinInterval';
-// @ts-ignore this guy required only on the docs site to work with dynamic date library
-import { cloneCrossUtils } from 'utils/helpers';
import { DatePicker } from '@material-ui/pickers';
import { createStyles } from '@material-ui/styles';
+// this guy required only on the docs site to work with dynamic date library
+import { makeJSDateObject } from '../../../utils/helpers';
import { IconButton, withStyles } from '@material-ui/core';
class CustomElements extends PureComponent {
@@ -18,11 +18,11 @@ class CustomElements extends PureComponent {
};
handleWeekChange = date => {
- this.setState({ selectedDate: startOfWeek(cloneCrossUtils(date)) });
+ this.setState({ selectedDate: startOfWeek(makeJSDateObject(date)) });
};
formatWeekSelectLabel = (date, invalidLabel) => {
- let dateClone = cloneCrossUtils(date);
+ let dateClone = makeJSDateObject(date);
return dateClone && isValid(dateClone)
? `Week of ${format(startOfWeek(dateClone), 'MMM do')}`
@@ -31,8 +31,8 @@ class CustomElements extends PureComponent {
renderWrappedWeekDay = (date, selectedDate, dayInCurrentMonth) => {
const { classes } = this.props;
- let dateClone = cloneCrossUtils(date);
- let selectedDateClone = cloneCrossUtils(selectedDate);
+ let dateClone = makeJSDateObject(date);
+ let selectedDateClone = makeJSDateObject(selectedDate);
const start = startOfWeek(selectedDateClone);
const end = endOfWeek(selectedDateClone);
diff --git a/docs/pages/demo/datepicker/ServerRequest.example.jsx b/docs/pages/demo/datepicker/ServerRequest.example.jsx
new file mode 100644
index 000000000..8c4bb8db6
--- /dev/null
+++ b/docs/pages/demo/datepicker/ServerRequest.example.jsx
@@ -0,0 +1,42 @@
+import React, { Fragment, useState } from 'react';
+import { Badge } from '@material-ui/core';
+import { DatePicker } from '@material-ui/pickers';
+import { makeJSDateObject } from '../../../utils/helpers';
+
+function getRandomNumber(min, max) {
+ return Math.round(Math.random() * (max - min) + min);
+}
+
+function ServerRequest() {
+ const [selectedDays, setSelectedDays] = useState([1, 2, 15]);
+ const [selectedDate, handleDateChange] = useState(new Date());
+
+ const handleMonthChange = async () => {
+ return new Promise(resolve => {
+ setTimeout(() => {
+ setSelectedDays([1, 2, 3].map(() => getRandomNumber(1, 28)));
+ resolve();
+ }, 1000);
+ });
+ };
+
+ return (
+
+ {
+ const date = makeJSDateObject(day); // skip this step, it is required to support date libs
+ const isSelected = isInCurrentMonth && selectedDays.includes(date.getDate());
+
+ // You can also use our internal component
+ return {dayComponent};
+ }}
+ />
+
+ );
+}
+
+export default ServerRequest;
diff --git a/docs/pages/demo/datepicker/index.mdx b/docs/pages/demo/datepicker/index.mdx
index 2cebda1df..0090c2b1d 100644
--- a/docs/pages/demo/datepicker/index.mdx
+++ b/docs/pages/demo/datepicker/index.mdx
@@ -4,6 +4,7 @@ import PageMeta from '_shared/PageMeta'
import LinkedComponents from '_shared/LinkedComponents'
import * as CustomDay from './CustomDay.example'
+import * as ServerRequest from './ServerRequest.example'
import * as BasicDatePicker from './BasicDatePicker.example'
import * as ViewsDatePicker from './ViewsDatePicker.example'
import * as InlineDatePicker from './InlineDatePicker.example'
@@ -50,6 +51,13 @@ The displaying of dates is heavily cusomizable. Thus you can add badges or fully
+#### Dynamic data
+
+Sometimes it's required to displaying additional info right in calendar.
+For this just return `Promise` in `onMonthChange`.
+
+
+
#### Components API
diff --git a/docs/prop-types.json b/docs/prop-types.json
index 13ad591ab..a5f0227ff 100644
--- a/docs/prop-types.json
+++ b/docs/prop-types.json
@@ -281,8 +281,12 @@
"defaultValue": { "value": "'dialog'" },
"description": "Displaying variant",
"name": "variant",
+ "parent": {
+ "fileName": "material-ui-pickers/lib/src/typings/BasePicker.tsx",
+ "name": "BasePickerProps"
+ },
"required": false,
- "type": { "name": "\"dialog\" | \"inline\"" }
+ "type": { "name": "WrapperVariant" }
},
"PopoverProps": {
"defaultValue": null,
@@ -363,7 +367,7 @@
},
"strictCompareDates": {
"defaultValue": { "value": "false" },
- "description": "Compare date isBefore or isAfter without utils endOfDay or startOfDay",
+ "description": "Compare dates by the exact timestamp, instead of start/end of date",
"name": "strictCompareDates",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/DatePicker.tsx",
@@ -497,7 +501,7 @@
},
"onMonthChange": {
"defaultValue": null,
- "description": "Callback firing on month change",
+ "description": "Callback firing on month change. Return promise to render spinner till it will not be resolved",
"name": "onMonthChange",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/components/Calendar.tsx",
@@ -618,6 +622,17 @@
"required": false,
"type": { "name": "string" }
},
+ "variant": {
+ "defaultValue": { "value": "'dialog'" },
+ "description": "Displaying variant",
+ "name": "variant",
+ "parent": {
+ "fileName": "material-ui-pickers/lib/src/typings/BasePicker.tsx",
+ "name": "BasePickerProps"
+ },
+ "required": false,
+ "type": { "name": "WrapperVariant" }
+ },
"onError": {
"defaultValue": null,
"description": "Callback fired when new error should be displayed",
@@ -728,13 +743,6 @@
"required": false,
"type": { "name": "boolean" }
},
- "variant": {
- "defaultValue": { "value": "'dialog'" },
- "description": "Displaying variant",
- "name": "variant",
- "required": false,
- "type": { "name": "\"dialog\" | \"inline\"" }
- },
"PopoverProps": {
"defaultValue": null,
"description": "Popover props passed to material-ui Popover (with variant=\"inline\")",
@@ -880,7 +888,7 @@
},
"strictCompareDates": {
"defaultValue": { "value": "false" },
- "description": "Compare date isBefore or isAfter without utils endOfDay or startOfDay",
+ "description": "Compare dates by the exact timestamp, instead of start/end of date",
"name": "strictCompareDates",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/DatePicker.tsx",
@@ -1014,7 +1022,7 @@
},
"onMonthChange": {
"defaultValue": null,
- "description": "Callback firing on month change",
+ "description": "Callback firing on month change. Return promise to render spinner till it will not be resolved",
"name": "onMonthChange",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/components/Calendar.tsx",
@@ -1238,8 +1246,12 @@
"defaultValue": { "value": "'dialog'" },
"description": "Displaying variant",
"name": "variant",
+ "parent": {
+ "fileName": "material-ui-pickers/lib/src/typings/BasePicker.tsx",
+ "name": "BasePickerProps"
+ },
"required": false,
- "type": { "name": "\"dialog\" | \"inline\"" }
+ "type": { "name": "WrapperVariant" }
},
"PopoverProps": {
"defaultValue": null,
@@ -1408,6 +1420,17 @@
"required": false,
"type": { "name": "string" }
},
+ "variant": {
+ "defaultValue": { "value": "'dialog'" },
+ "description": "Displaying variant",
+ "name": "variant",
+ "parent": {
+ "fileName": "material-ui-pickers/lib/src/typings/BasePicker.tsx",
+ "name": "BasePickerProps"
+ },
+ "required": false,
+ "type": { "name": "WrapperVariant" }
+ },
"onError": {
"defaultValue": null,
"description": "Callback fired when new error should be displayed",
@@ -1529,13 +1552,6 @@
"required": false,
"type": { "name": "boolean" }
},
- "variant": {
- "defaultValue": { "value": "'dialog'" },
- "description": "Displaying variant",
- "name": "variant",
- "required": false,
- "type": { "name": "\"dialog\" | \"inline\"" }
- },
"PopoverProps": {
"defaultValue": null,
"description": "Popover props passed to material-ui Popover (with variant=\"inline\")",
@@ -1883,8 +1899,12 @@
"defaultValue": { "value": "'dialog'" },
"description": "Displaying variant",
"name": "variant",
+ "parent": {
+ "fileName": "material-ui-pickers/lib/src/typings/BasePicker.tsx",
+ "name": "BasePickerProps"
+ },
"required": false,
- "type": { "name": "\"dialog\" | \"inline\"" }
+ "type": { "name": "WrapperVariant" }
},
"PopoverProps": {
"defaultValue": null,
@@ -2020,7 +2040,7 @@
},
"strictCompareDates": {
"defaultValue": { "value": "false" },
- "description": "Compare date isBefore or isAfter without utils endOfDay or startOfDay",
+ "description": "Compare dates by the exact timestamp, instead of start/end of date",
"name": "strictCompareDates",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/DatePicker.tsx",
@@ -2154,7 +2174,7 @@
},
"onMonthChange": {
"defaultValue": null,
- "description": "Callback firing on month change",
+ "description": "Callback firing on month change. Return promise to render spinner till it will not be resolved",
"name": "onMonthChange",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/components/Calendar.tsx",
@@ -2264,6 +2284,17 @@
"required": false,
"type": { "name": "string" }
},
+ "variant": {
+ "defaultValue": { "value": "'dialog'" },
+ "description": "Displaying variant",
+ "name": "variant",
+ "parent": {
+ "fileName": "material-ui-pickers/lib/src/typings/BasePicker.tsx",
+ "name": "BasePickerProps"
+ },
+ "required": false,
+ "type": { "name": "WrapperVariant" }
+ },
"onError": {
"defaultValue": null,
"description": "Callback fired when new error should be displayed",
@@ -2385,13 +2416,6 @@
"required": false,
"type": { "name": "boolean" }
},
- "variant": {
- "defaultValue": { "value": "'dialog'" },
- "description": "Displaying variant",
- "name": "variant",
- "required": false,
- "type": { "name": "\"dialog\" | \"inline\"" }
- },
"PopoverProps": {
"defaultValue": null,
"description": "Popover props passed to material-ui Popover (with variant=\"inline\")",
@@ -2592,7 +2616,7 @@
},
"strictCompareDates": {
"defaultValue": { "value": "false" },
- "description": "Compare date isBefore or isAfter without utils endOfDay or startOfDay",
+ "description": "Compare dates by the exact timestamp, instead of start/end of date",
"name": "strictCompareDates",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/DatePicker.tsx",
@@ -2726,7 +2750,7 @@
},
"onMonthChange": {
"defaultValue": null,
- "description": "Callback firing on month change",
+ "description": "Callback firing on month change. Return promise to render spinner till it will not be resolved",
"name": "onMonthChange",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/components/Calendar.tsx",
@@ -2895,7 +2919,7 @@
},
"onMonthChange": {
"defaultValue": null,
- "description": "Callback firing on month change",
+ "description": "Callback firing on month change. Return promise to render spinner till it will not be resolved",
"name": "onMonthChange",
"parent": {
"fileName": "material-ui-pickers/lib/src/DatePicker/components/Calendar.tsx",
diff --git a/docs/utils/helpers.ts b/docs/utils/helpers.ts
index def305167..72ea9c5ee 100644
--- a/docs/utils/helpers.ts
+++ b/docs/utils/helpers.ts
@@ -2,7 +2,7 @@ import dayjs, { Dayjs } from 'dayjs';
import moment, { Moment } from 'moment';
import { DateTime } from 'luxon';
-export function cloneCrossUtils(date: Date | Moment | DateTime | Dayjs) {
+export function makeJSDateObject(date: Date | Moment | DateTime | Dayjs) {
if (date instanceof dayjs) {
return (date as Dayjs).clone().toDate();
}
diff --git a/lib/src/DatePicker/DatePicker.tsx b/lib/src/DatePicker/DatePicker.tsx
index 456c457ca..346deb59c 100644
--- a/lib/src/DatePicker/DatePicker.tsx
+++ b/lib/src/DatePicker/DatePicker.tsx
@@ -22,7 +22,7 @@ export interface BaseDatePickerProps extends OutterCalendarProps {
maxDate?: ParsableDate;
/**
- * Compare date isBefore or isAfter without utils endOfDay or startOfDay
+ * Compare dates by the exact timestamp, instead of start/end of date
* @default false
*/
strictCompareDates?: boolean;
diff --git a/lib/src/DatePicker/components/Calendar.tsx b/lib/src/DatePicker/components/Calendar.tsx
index 24f5b8a5a..3a9eed3a6 100644
--- a/lib/src/DatePicker/components/Calendar.tsx
+++ b/lib/src/DatePicker/components/Calendar.tsx
@@ -3,11 +3,11 @@ import * as PropTypes from 'prop-types';
import Day from './Day';
import DayWrapper from './DayWrapper';
import CalendarHeader from './CalendarHeader';
+import CircularProgress from '@material-ui/core/CircularProgress';
import SlideTransition, { SlideDirection } from './SlideTransition';
import { Theme } from '@material-ui/core';
-import CircularProgress from '@material-ui/core/CircularProgress';
-import { runKeyHandler } from '../../_shared/hooks/useKeyDown';
import { MaterialUiPickersDate } from '../../typings/date';
+import { runKeyHandler } from '../../_shared/hooks/useKeyDown';
import { IconButtonProps } from '@material-ui/core/IconButton';
import { withStyles, WithStyles } from '@material-ui/core/styles';
import { findClosestEnabledDate } from '../../_helpers/date-utils';
@@ -42,7 +42,7 @@ export interface OutterCalendarProps {
rightArrowButtonProps?: Partial;
/** Disable specific date */
shouldDisableDate?: (day: MaterialUiPickersDate) => boolean;
- /** Callback firing on month change */
+ /** Callback firing on month change. Return promise to render spinner till it will not be resolved */
onMonthChange?: (date: MaterialUiPickersDate) => void | Promise;
/** Custom loading indicator */
loadingIndicator?: JSX.Element;
@@ -207,7 +207,13 @@ export class Calendar extends React.Component {
};
public moveToDay = (day: MaterialUiPickersDate) => {
+ const { utils } = this.props;
+
if (day && !this.shouldDisableDate(day)) {
+ if (utils.getMonth(day) !== utils.getMonth(this.state.currentMonth)) {
+ this.handleChangeMonth(utils.startOfMonth(day), 'left');
+ }
+
this.onDateSelect(day, false);
}
};
From 9addb037fd0ce4c695416fb53269565f02a6097f Mon Sep 17 00:00:00 2001
From: Dmitriy Kovalenko
Date: Sun, 9 Jun 2019 11:48:35 +0300
Subject: [PATCH 25/76] [Refactoring] Reorganize folder structure (#1098)
* Regorganize folder structure
* Create new views folder with all components
* Remove unnecessary theme type annotations
* Restore lost in merge changes
* Fix imports in tests
---
docs/_shared/Ad.tsx | 5 +--
docs/_shared/PropTypesTable.tsx | 3 +-
lib/src/DatePicker/DatePicker.tsx | 2 +-
lib/src/DateTimePicker/DateTimePickerTabs.tsx | 3 +-
lib/src/Picker/Picker.tsx | 12 +++---
.../__tests__/DatePicker/Calendar.test.tsx | 2 +-
lib/src/__tests__/DatePicker/Month.test.tsx | 2 +-
.../DatePicker/MonthSelection.test.tsx | 4 +-
lib/src/__tests__/TimePicker/Clock.test.tsx | 2 +-
lib/src/_shared/PickerToolbar.tsx | 42 +++++++++----------
lib/src/_shared/ToolbarText.tsx | 3 +-
lib/src/index.ts | 8 ++--
lib/src/typings/overrides.ts | 24 +++++------
.../Calendar}/Calendar.tsx | 0
.../Calendar}/CalendarHeader.tsx | 0
.../components => views/Calendar}/Day.tsx | 3 +-
.../Calendar}/DayWrapper.tsx | 0
.../Calendar}/SlideTransition.tsx | 4 +-
.../components => views/Clock}/Clock.tsx | 3 +-
.../Clock}/ClockNumber.tsx | 4 +-
.../Clock}/ClockNumbers.tsx | 0
.../Clock}/ClockPointer.tsx | 0
.../Clock/ClockView.tsx} | 0
.../components => views/Month}/Month.tsx | 0
.../Month/MonthView.tsx} | 2 -
.../components => views/Year}/Year.tsx | 4 +-
.../Year/YearView.tsx} | 4 +-
27 files changed, 63 insertions(+), 73 deletions(-)
rename lib/src/{DatePicker/components => views/Calendar}/Calendar.tsx (100%)
rename lib/src/{DatePicker/components => views/Calendar}/CalendarHeader.tsx (100%)
rename lib/src/{DatePicker/components => views/Calendar}/Day.tsx (97%)
rename lib/src/{DatePicker/components => views/Calendar}/DayWrapper.tsx (100%)
rename lib/src/{DatePicker/components => views/Calendar}/SlideTransition.tsx (96%)
rename lib/src/{TimePicker/components => views/Clock}/Clock.tsx (97%)
rename lib/src/{TimePicker/components => views/Clock}/ClockNumber.tsx (95%)
rename lib/src/{TimePicker/components => views/Clock}/ClockNumbers.tsx (100%)
rename lib/src/{TimePicker/components => views/Clock}/ClockPointer.tsx (100%)
rename lib/src/{TimePicker/components/TimePickerView.tsx => views/Clock/ClockView.tsx} (100%)
rename lib/src/{DatePicker/components => views/Month}/Month.tsx (100%)
rename lib/src/{DatePicker/components/MonthSelection.tsx => views/Month/MonthView.tsx} (98%)
rename lib/src/{DatePicker/components => views/Year}/Year.tsx (95%)
rename lib/src/{DatePicker/components/YearSelection.tsx => views/Year/YearView.tsx} (96%)
diff --git a/docs/_shared/Ad.tsx b/docs/_shared/Ad.tsx
index 1dacaa09c..12dc05335 100644
--- a/docs/_shared/Ad.tsx
+++ b/docs/_shared/Ad.tsx
@@ -1,9 +1,8 @@
import * as React from 'react';
import { loadScript } from 'utils/helpers';
-import { Grid, Theme } from '@material-ui/core';
-import { makeStyles } from '@material-ui/styles';
+import { Grid, makeStyles } from '@material-ui/core';
-const useStyles = makeStyles((theme: Theme) => ({
+const useStyles = makeStyles(theme => ({
'@global': {
'#codefund': {
'& .cf-wrapper': {
diff --git a/docs/_shared/PropTypesTable.tsx b/docs/_shared/PropTypesTable.tsx
index 86063537b..2b78c4a72 100644
--- a/docs/_shared/PropTypesTable.tsx
+++ b/docs/_shared/PropTypesTable.tsx
@@ -12,11 +12,10 @@ import {
TableRow,
makeStyles,
Typography,
- Theme,
Grid,
} from '@material-ui/core';
-const useStyles = makeStyles((theme: Theme) => ({
+const useStyles = makeStyles(theme => ({
header: {
marginTop: 24,
},
diff --git a/lib/src/DatePicker/DatePicker.tsx b/lib/src/DatePicker/DatePicker.tsx
index 346deb59c..1b1fbd45c 100644
--- a/lib/src/DatePicker/DatePicker.tsx
+++ b/lib/src/DatePicker/DatePicker.tsx
@@ -2,7 +2,7 @@ import { useUtils } from '../_shared/hooks/useUtils';
import { DatePickerToolbar } from './DatePickerToolbar';
import { MaterialUiPickersDate } from '../typings/date';
import { getFormatByViews } from '../_helpers/date-utils';
-import { OutterCalendarProps } from './components/Calendar';
+import { OutterCalendarProps } from '../views/Calendar/Calendar';
import { datePickerDefaultProps, ParsableDate } from '../constants/prop-types';
import { WrappedPurePickerProps, makePurePicker } from '../Picker/WrappedPurePicker';
import { makeKeyboardPicker, WrappedKeyboardPickerProps } from '../Picker/WrappedKeyboardPicker';
diff --git a/lib/src/DateTimePicker/DateTimePickerTabs.tsx b/lib/src/DateTimePicker/DateTimePickerTabs.tsx
index a203bea4e..7f7f85dd6 100644
--- a/lib/src/DateTimePicker/DateTimePickerTabs.tsx
+++ b/lib/src/DateTimePicker/DateTimePickerTabs.tsx
@@ -2,7 +2,6 @@ import * as React from 'react';
import Tab from '@material-ui/core/Tab';
import Tabs from '@material-ui/core/Tabs';
import Paper from '@material-ui/core/Paper';
-import { Theme } from '@material-ui/core';
import { TimeIcon } from '../_shared/icons/TimeIcon';
import { DateTimePickerView } from './DateTimePicker';
import { DateRangeIcon } from '../_shared/icons/DateRangeIcon';
@@ -32,7 +31,7 @@ export interface DateTimePickerTabsProps {
}
export const useStyles = makeStyles(
- (theme: Theme) => {
+ theme => {
// prettier-ignore
const tabsBackground = theme.palette.type === 'light'
? theme.palette.primary.main
diff --git a/lib/src/Picker/Picker.tsx b/lib/src/Picker/Picker.tsx
index ea4883d15..fafed6ec3 100644
--- a/lib/src/Picker/Picker.tsx
+++ b/lib/src/Picker/Picker.tsx
@@ -1,15 +1,15 @@
import * as React from 'react';
-import Calendar from '../DatePicker/components/Calendar';
-import YearSelection from '../DatePicker/components/YearSelection';
-import MonthSelection from '../DatePicker/components/MonthSelection';
-import { MaterialUiPickersDate } from '..';
-import { useViews } from '../_shared/hooks/useViews';
+import Calendar from '../views/Calendar/Calendar';
import { useUtils } from '../_shared/hooks/useUtils';
+import { useViews } from '../_shared/hooks/useViews';
import { makeStyles } from '@material-ui/core/styles';
+import { YearSelection } from '../views/Year/YearView';
+import { MaterialUiPickersDate } from '../typings/date';
+import { MonthSelection } from '../views/Month/MonthView';
+import { TimePickerView } from '../views/Clock/ClockView';
import { BaseTimePickerProps } from '../TimePicker/TimePicker';
import { BaseDatePickerProps } from '../DatePicker/DatePicker';
import { datePickerDefaultProps } from '../constants/prop-types';
-import { TimePickerView } from '../TimePicker/components/TimePickerView';
const viewsMap = {
year: YearSelection,
diff --git a/lib/src/__tests__/DatePicker/Calendar.test.tsx b/lib/src/__tests__/DatePicker/Calendar.test.tsx
index 9b5238970..23bcb3f5f 100644
--- a/lib/src/__tests__/DatePicker/Calendar.test.tsx
+++ b/lib/src/__tests__/DatePicker/Calendar.test.tsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import { ShallowWrapper } from 'enzyme';
import { shallowRender, utilsToUse } from '../test-utils';
-import { Calendar, CalendarProps } from '../../DatePicker/components/Calendar';
+import { Calendar, CalendarProps } from '../../views/Calendar/Calendar';
describe('Calendar', () => {
let component: ShallowWrapper;
diff --git a/lib/src/__tests__/DatePicker/Month.test.tsx b/lib/src/__tests__/DatePicker/Month.test.tsx
index 05e58f56d..475072c68 100644
--- a/lib/src/__tests__/DatePicker/Month.test.tsx
+++ b/lib/src/__tests__/DatePicker/Month.test.tsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import { ShallowWrapper } from 'enzyme';
import { shallow, utilsToUse } from '../test-utils';
-import { Month, MonthProps } from '../../DatePicker/components/Month';
+import { Month, MonthProps } from '../../views/Month/Month';
describe('Month', () => {
let component: ShallowWrapper;
diff --git a/lib/src/__tests__/DatePicker/MonthSelection.test.tsx b/lib/src/__tests__/DatePicker/MonthSelection.test.tsx
index 0f01acb7e..49a0b3608 100644
--- a/lib/src/__tests__/DatePicker/MonthSelection.test.tsx
+++ b/lib/src/__tests__/DatePicker/MonthSelection.test.tsx
@@ -1,8 +1,8 @@
import * as React from 'react';
-import Month from '../../DatePicker/components/Month';
+import Month from '../../views/Month/Month';
import { ReactWrapper } from 'enzyme';
import { mount, utilsToUse } from '../test-utils';
-import { MonthSelection, MonthSelectionProps } from '../../DatePicker/components/MonthSelection';
+import { MonthSelection, MonthSelectionProps } from '../../views/Month/MonthView';
describe('MonthSelection', () => {
let component: ReactWrapper;
diff --git a/lib/src/__tests__/TimePicker/Clock.test.tsx b/lib/src/__tests__/TimePicker/Clock.test.tsx
index 52087eac1..773331bc0 100644
--- a/lib/src/__tests__/TimePicker/Clock.test.tsx
+++ b/lib/src/__tests__/TimePicker/Clock.test.tsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import { ShallowWrapper } from 'enzyme';
import { shallow } from '../test-utils';
-import { Clock, ClockProps } from '../../TimePicker/components/Clock';
+import { Clock, ClockProps } from '../../views/Clock/Clock';
const mouseClockEvent = {
preventDefault: jest.fn(),
diff --git a/lib/src/_shared/PickerToolbar.tsx b/lib/src/_shared/PickerToolbar.tsx
index cc6acceea..bbd02e9be 100644
--- a/lib/src/_shared/PickerToolbar.tsx
+++ b/lib/src/_shared/PickerToolbar.tsx
@@ -1,27 +1,11 @@
import * as React from 'react';
import clsx from 'clsx';
import Toolbar, { ToolbarProps } from '@material-ui/core/Toolbar';
-import { Theme } from '@material-ui/core';
import { ExtendMui } from '../typings/extendMui';
-import { createStyles, WithStyles, withStyles } from '@material-ui/core/styles';
+import { makeStyles } from '@material-ui/core/styles';
-export interface PickerToolbarProps extends ExtendMui, WithStyles {}
-
-const PickerToolbar: React.SFC = ({
- children,
- className = null,
- classes,
- ...other
-}) => {
- return (
-
- {children}
-
- );
-};
-
-export const styles = (theme: Theme) =>
- createStyles({
+export const useStyles = makeStyles(
+ theme => ({
toolbar: {
display: 'flex',
flexDirection: 'column',
@@ -33,6 +17,22 @@ export const styles = (theme: Theme) =>
? theme.palette.primary.main
: theme.palette.background.default,
},
- });
+ }),
+ { name: 'MuiPickersToolbar' }
+);
+
+const PickerToolbar: React.SFC> = ({
+ children,
+ className = null,
+ ...other
+}) => {
+ const classes = useStyles();
+
+ return (
+
+ {children}
+
+ );
+};
-export default withStyles(styles, { name: 'MuiPickersToolbar' })(PickerToolbar);
+export default PickerToolbar;
diff --git a/lib/src/_shared/ToolbarText.tsx b/lib/src/_shared/ToolbarText.tsx
index 5a3a7d9f3..f1b1ae313 100644
--- a/lib/src/_shared/ToolbarText.tsx
+++ b/lib/src/_shared/ToolbarText.tsx
@@ -1,7 +1,6 @@
import * as React from 'react';
import clsx from 'clsx';
import Typography, { TypographyProps } from '@material-ui/core/Typography';
-import { Theme } from '@material-ui/core';
import { ExtendMui } from '../typings/extendMui';
import { makeStyles, fade } from '@material-ui/core/styles';
@@ -11,7 +10,7 @@ export interface ToolbarTextProps extends ExtendMui {
}
export const useStyles = makeStyles(
- (theme: Theme) => {
+ theme => {
const textColor =
theme.palette.type === 'light'
? theme.palette.primary.contrastText
diff --git a/lib/src/index.ts b/lib/src/index.ts
index e41ea9efb..3dd0796f8 100644
--- a/lib/src/index.ts
+++ b/lib/src/index.ts
@@ -23,13 +23,13 @@ export { TimePicker, KeyboardTimePicker } from './TimePicker';
export { DateTimePicker, KeyboardDateTimePicker } from './DateTimePicker';
-export { default as Calendar } from './DatePicker/components/Calendar';
+export { default as Calendar } from './views/Calendar/Calendar';
-export { default as Day } from './DatePicker/components/Day';
+export { default as Day } from './views/Calendar/Day';
-export { default as TimePickerView } from './TimePicker/components/TimePickerView';
+export { default as TimePickerView } from './views/Clock/ClockView';
-export { default as Clock } from './TimePicker/components/Clock';
+export { default as Clock } from './views/Clock/Clock';
export { Picker } from './Picker/Picker';
diff --git a/lib/src/typings/overrides.ts b/lib/src/typings/overrides.ts
index d578a88b3..607dd34af 100644
--- a/lib/src/typings/overrides.ts
+++ b/lib/src/typings/overrides.ts
@@ -1,23 +1,23 @@
+import { styles as ClockStyles } from '../views/Clock/Clock';
+import { useStyles as DayStyles } from '../views/Calendar/Day';
import { styles as ModalDialogStyles } from '../_shared/ModalDialog';
-import { useStyles as DayStyles } from '../DatePicker/components/Day';
-import { styles as ClockStyles } from '../TimePicker/components/Clock';
-import { styles as PickerToolbarStyles } from '../_shared/PickerToolbar';
+import { styles as CalendarStyles } from '../views/Calendar/Calendar';
+import { useStyles as MuiPickersYearStyles } from '../views/Year/Year';
import { styles as ToolbarButtonStyles } from '../_shared/ToolbarButton';
-import { styles as CalendarStyles } from '../DatePicker/components/Calendar';
+import { useStyles as MuiPickersMonthStyles } from '../views/Month/Month';
+import { styles as ClockPointerStyles } from '../views/Clock/ClockPointer';
+import { useStyles as PickerToolbarStyles } from '../_shared/PickerToolbar';
+import { useStyles as ClockNumberStyles } from '../views/Clock/ClockNumber';
import { useStyles as DTTabsStyles } from '../DateTimePicker/DateTimePickerTabs';
-import { useStyles as MuiPickersYearStyles } from '../DatePicker/components/Year';
import { useStyles as DatePickerRootStyles } from '../DatePicker/DatePickerToolbar';
-import { useStyles as MuiPickersMonthStyles } from '../DatePicker/components/Month';
-import { styles as ClockPointerStyles } from '../TimePicker/components/ClockPointer';
+import { useStyles as MuiPickersYearSelectionStyles } from '../views/Year/YearView';
import { StyleRules, StyleRulesCallback } from '@material-ui/core/styles/withStyles';
-import { useStyles as ClockNumberStyles } from '../TimePicker/components/ClockNumber';
+import { useStyles as CalendarHeaderStyles } from '../views/Calendar/CalendarHeader';
import { useStyles as DTHeaderStyles } from '../DateTimePicker/DateTimePickerToolbar';
import { useStyles as TimePickerToolbarStyles } from '../TimePicker/TimePickerToolbar';
-import { useStyles as CalendarHeaderStyles } from '../DatePicker/components/CalendarHeader';
-import { useStyles as SlideTransitionStyles } from '../DatePicker/components/SlideTransition';
+import { useStyles as SlideTransitionStyles } from '../views/Calendar/SlideTransition';
+import { useStyles as MuiPickersMonthSelectionStyles } from '../views/Month/MonthView';
import { useStyles as MuiPickerDTToolbarStyles } from '../DateTimePicker/DateTimePickerToolbar';
-import { useStyles as MuiPickersYearSelectionStyles } from '../DatePicker/components/YearSelection';
-import { useStyles as MuiPickersMonthSelectionStyles } from '../DatePicker/components/MonthSelection';
type Classes = Partial<
StyleRules<
diff --git a/lib/src/DatePicker/components/Calendar.tsx b/lib/src/views/Calendar/Calendar.tsx
similarity index 100%
rename from lib/src/DatePicker/components/Calendar.tsx
rename to lib/src/views/Calendar/Calendar.tsx
diff --git a/lib/src/DatePicker/components/CalendarHeader.tsx b/lib/src/views/Calendar/CalendarHeader.tsx
similarity index 100%
rename from lib/src/DatePicker/components/CalendarHeader.tsx
rename to lib/src/views/Calendar/CalendarHeader.tsx
diff --git a/lib/src/DatePicker/components/Day.tsx b/lib/src/views/Calendar/Day.tsx
similarity index 97%
rename from lib/src/DatePicker/components/Day.tsx
rename to lib/src/views/Calendar/Day.tsx
index efd354a70..2e212ab9e 100644
--- a/lib/src/DatePicker/components/Day.tsx
+++ b/lib/src/views/Calendar/Day.tsx
@@ -3,11 +3,10 @@ import * as PropTypes from 'prop-types';
import clsx from 'clsx';
import IconButton from '@material-ui/core/IconButton';
import Typography from '@material-ui/core/Typography';
-import { Theme } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
export const useStyles = makeStyles(
- (theme: Theme) => ({
+ theme => ({
day: {
width: 36,
height: 36,
diff --git a/lib/src/DatePicker/components/DayWrapper.tsx b/lib/src/views/Calendar/DayWrapper.tsx
similarity index 100%
rename from lib/src/DatePicker/components/DayWrapper.tsx
rename to lib/src/views/Calendar/DayWrapper.tsx
diff --git a/lib/src/DatePicker/components/SlideTransition.tsx b/lib/src/views/Calendar/SlideTransition.tsx
similarity index 96%
rename from lib/src/DatePicker/components/SlideTransition.tsx
rename to lib/src/views/Calendar/SlideTransition.tsx
index e89cf9a0b..9e616fae4 100644
--- a/lib/src/DatePicker/components/SlideTransition.tsx
+++ b/lib/src/views/Calendar/SlideTransition.tsx
@@ -1,6 +1,6 @@
import * as React from 'react';
import clsx from 'clsx';
-import { makeStyles, Theme } from '@material-ui/core/styles';
+import { makeStyles } from '@material-ui/core/styles';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
export type SlideDirection = 'right' | 'left';
@@ -13,7 +13,7 @@ interface SlideTransitionProps {
const animationDuration = 350;
export const useStyles = makeStyles(
- (theme: Theme) => {
+ theme => {
const slideTransition = theme.transitions.create('transform', {
duration: animationDuration,
easing: 'cubic-bezier(0.35, 0.8, 0.4, 1)',
diff --git a/lib/src/TimePicker/components/Clock.tsx b/lib/src/views/Clock/Clock.tsx
similarity index 97%
rename from lib/src/TimePicker/components/Clock.tsx
rename to lib/src/views/Clock/Clock.tsx
index f7a8600a7..d3a567277 100644
--- a/lib/src/TimePicker/components/Clock.tsx
+++ b/lib/src/views/Clock/Clock.tsx
@@ -2,9 +2,8 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import ClockPointer from './ClockPointer';
import ClockType, { ClockViewType } from '../../constants/ClockType';
-import { Theme } from '@material-ui/core';
import { getHours, getMinutes } from '../../_helpers/time-utils';
-import { withStyles, createStyles, WithStyles } from '@material-ui/core/styles';
+import { withStyles, createStyles, WithStyles, Theme } from '@material-ui/core/styles';
export interface ClockProps extends WithStyles {
type: ClockViewType;
diff --git a/lib/src/TimePicker/components/ClockNumber.tsx b/lib/src/views/Clock/ClockNumber.tsx
similarity index 95%
rename from lib/src/TimePicker/components/ClockNumber.tsx
rename to lib/src/views/Clock/ClockNumber.tsx
index 1e9f5b370..f017fc1b1 100644
--- a/lib/src/TimePicker/components/ClockNumber.tsx
+++ b/lib/src/views/Clock/ClockNumber.tsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import clsx from 'clsx';
import Typography from '@material-ui/core/Typography';
-import { Theme, makeStyles } from '@material-ui/core/styles';
+import { makeStyles } from '@material-ui/core/styles';
const positions: Record = {
0: [0, 40],
@@ -38,7 +38,7 @@ export interface ClockNumberProps {
}
export const useStyles = makeStyles(
- (theme: Theme) => {
+ theme => {
const size = theme.spacing(4);
return {
diff --git a/lib/src/TimePicker/components/ClockNumbers.tsx b/lib/src/views/Clock/ClockNumbers.tsx
similarity index 100%
rename from lib/src/TimePicker/components/ClockNumbers.tsx
rename to lib/src/views/Clock/ClockNumbers.tsx
diff --git a/lib/src/TimePicker/components/ClockPointer.tsx b/lib/src/views/Clock/ClockPointer.tsx
similarity index 100%
rename from lib/src/TimePicker/components/ClockPointer.tsx
rename to lib/src/views/Clock/ClockPointer.tsx
diff --git a/lib/src/TimePicker/components/TimePickerView.tsx b/lib/src/views/Clock/ClockView.tsx
similarity index 100%
rename from lib/src/TimePicker/components/TimePickerView.tsx
rename to lib/src/views/Clock/ClockView.tsx
diff --git a/lib/src/DatePicker/components/Month.tsx b/lib/src/views/Month/Month.tsx
similarity index 100%
rename from lib/src/DatePicker/components/Month.tsx
rename to lib/src/views/Month/Month.tsx
diff --git a/lib/src/DatePicker/components/MonthSelection.tsx b/lib/src/views/Month/MonthView.tsx
similarity index 98%
rename from lib/src/DatePicker/components/MonthSelection.tsx
rename to lib/src/views/Month/MonthView.tsx
index 110fa273b..514193998 100644
--- a/lib/src/DatePicker/components/MonthSelection.tsx
+++ b/lib/src/views/Month/MonthView.tsx
@@ -92,5 +92,3 @@ export const MonthSelection: React.FC = ({
);
};
-
-export default MonthSelection;
diff --git a/lib/src/DatePicker/components/Year.tsx b/lib/src/views/Year/Year.tsx
similarity index 95%
rename from lib/src/DatePicker/components/Year.tsx
rename to lib/src/views/Year/Year.tsx
index e053535a2..895bf0f88 100644
--- a/lib/src/DatePicker/components/Year.tsx
+++ b/lib/src/views/Year/Year.tsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import clsx from 'clsx';
import Typography from '@material-ui/core/Typography';
-import { Theme, makeStyles } from '@material-ui/core/styles';
+import { makeStyles } from '@material-ui/core/styles';
export interface YearProps {
children: React.ReactNode;
@@ -13,7 +13,7 @@ export interface YearProps {
}
export const useStyles = makeStyles(
- (theme: Theme) => ({
+ theme => ({
root: {
height: theme.spacing(5),
display: 'flex',
diff --git a/lib/src/DatePicker/components/YearSelection.tsx b/lib/src/views/Year/YearView.tsx
similarity index 96%
rename from lib/src/DatePicker/components/YearSelection.tsx
rename to lib/src/views/Year/YearView.tsx
index d6ba7b171..5b35078dc 100644
--- a/lib/src/DatePicker/components/YearSelection.tsx
+++ b/lib/src/views/Year/YearView.tsx
@@ -26,7 +26,7 @@ export const useStyles = makeStyles(
{ name: 'MuiPickersYearSelection' }
);
-const YearSelection: React.FC = ({
+export const YearSelection: React.FC = ({
date,
onChange,
onYearChange,
@@ -86,5 +86,3 @@ const YearSelection: React.FC = ({
);
};
-
-export default YearSelection;
From 5dee239b010b546cf12a23315fa05fd7907d11b4 Mon Sep 17 00:00:00 2001
From: Dmitriy Kovalenko
Date: Sun, 9 Jun 2019 11:54:34 +0300
Subject: [PATCH 26/76] [Refactoring] Refactor Calendar.tsx
---
lib/src/views/Calendar/Calendar.tsx | 64 ++++++++++++++---------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/lib/src/views/Calendar/Calendar.tsx b/lib/src/views/Calendar/Calendar.tsx
index 3a9eed3a6..7da7ddb3e 100644
--- a/lib/src/views/Calendar/Calendar.tsx
+++ b/lib/src/views/Calendar/Calendar.tsx
@@ -85,13 +85,13 @@ const KeyDownListener = ({ onKeyDown }: { onKeyDown: (e: KeyboardEvent) => void
};
export class Calendar extends React.Component {
- public static propTypes: any = {
+ static propTypes: any = {
renderDay: PropTypes.func,
shouldDisableDate: PropTypes.func,
allowKeyboardControl: PropTypes.bool,
};
- public static defaultProps: Partial = {
+ static defaultProps: Partial = {
minDate: new Date('1900-01-01'),
maxDate: new Date('2100-01-01'),
disablePast: false,
@@ -99,7 +99,7 @@ export class Calendar extends React.Component {
allowKeyboardControl: true,
};
- public static getDerivedStateFromProps(nextProps: CalendarProps, state: CalendarState) {
+ static getDerivedStateFromProps(nextProps: CalendarProps, state: CalendarState) {
const { utils, date: nextDate } = nextProps;
if (!utils.isEqual(nextDate, state.lastDate)) {
@@ -122,13 +122,13 @@ export class Calendar extends React.Component {
return null;
}
- public state: CalendarState = {
+ state: CalendarState = {
slideDirection: 'left',
currentMonth: this.props.utils.startOfMonth(this.props.date),
loadingQueue: 0,
};
- public componentDidMount() {
+ componentDidMount() {
const { date, minDate, maxDate, utils, disablePast, disableFuture } = this.props;
if (this.shouldDisableDate(date)) {
@@ -142,17 +142,22 @@ export class Calendar extends React.Component {
shouldDisableDate: this.shouldDisableDate,
});
- this.onDateSelect(closestEnabledDate, false);
+ this.handleDaySelect(closestEnabledDate, false);
}
}
- public onDateSelect = (day: MaterialUiPickersDate, isFinish = true) => {
- const { date, utils } = this.props;
+ private pushToLoadingQueue = () => {
+ const loadingQueue = this.state.loadingQueue + 1;
+ this.setState({ loadingQueue });
+ };
- this.props.onChange(utils.mergeDateAndTime(day, date), isFinish);
+ private popFromLoadingQueue = () => {
+ let loadingQueue = this.state.loadingQueue;
+ loadingQueue = loadingQueue <= 0 ? 0 : loadingQueue - 1;
+ this.setState({ loadingQueue });
};
- public handleChangeMonth = (newMonth: MaterialUiPickersDate, slideDirection: SlideDirection) => {
+ handleChangeMonth = (newMonth: MaterialUiPickersDate, slideDirection: SlideDirection) => {
this.setState({ currentMonth: newMonth, slideDirection });
if (this.props.onMonthChange) {
@@ -166,7 +171,7 @@ export class Calendar extends React.Component {
}
};
- public validateMinMaxDate = (day: MaterialUiPickersDate) => {
+ validateMinMaxDate = (day: MaterialUiPickersDate) => {
const { minDate, maxDate, utils, disableFuture, disablePast } = this.props;
const now = utils.date();
@@ -178,7 +183,7 @@ export class Calendar extends React.Component {
);
};
- public shouldDisablePrevMonth = () => {
+ shouldDisablePrevMonth = () => {
const { utils, disablePast, minDate } = this.props;
const now = utils.date();
@@ -189,7 +194,7 @@ export class Calendar extends React.Component {
return !utils.isBefore(firstEnabledMonth, this.state.currentMonth);
};
- public shouldDisableNextMonth = () => {
+ shouldDisableNextMonth = () => {
const { utils, disableFuture, maxDate } = this.props;
const now = utils.date();
@@ -200,13 +205,19 @@ export class Calendar extends React.Component {
return !utils.isAfter(lastEnabledMonth, this.state.currentMonth);
};
- public shouldDisableDate = (day: MaterialUiPickersDate) => {
+ shouldDisableDate = (day: MaterialUiPickersDate) => {
const { shouldDisableDate } = this.props;
return this.validateMinMaxDate(day) || Boolean(shouldDisableDate && shouldDisableDate(day));
};
- public moveToDay = (day: MaterialUiPickersDate) => {
+ handleDaySelect = (day: MaterialUiPickersDate, isFinish = true) => {
+ const { date, utils } = this.props;
+
+ this.props.onChange(utils.mergeDateAndTime(day, date), isFinish);
+ };
+
+ moveToDay = (day: MaterialUiPickersDate) => {
const { utils } = this.props;
if (day && !this.shouldDisableDate(day)) {
@@ -214,11 +225,11 @@ export class Calendar extends React.Component {
this.handleChangeMonth(utils.startOfMonth(day), 'left');
}
- this.onDateSelect(day, false);
+ this.handleDaySelect(day, false);
}
};
- public handleKeyDown = (event: KeyboardEvent) => {
+ handleKeyDown = (event: KeyboardEvent) => {
const { theme, date, utils } = this.props;
runKeyHandler(event, {
@@ -229,7 +240,7 @@ export class Calendar extends React.Component {
});
};
- public renderWeeks = () => {
+ private renderWeeks = () => {
const { utils, classes } = this.props;
const weeks = utils.getWeekArray(this.state.currentMonth);
@@ -240,7 +251,7 @@ export class Calendar extends React.Component {
));
};
- public renderDays = (week: MaterialUiPickersDate[]) => {
+ private renderDays = (week: MaterialUiPickersDate[]) => {
const { date, renderDay, utils } = this.props;
const now = utils.date();
@@ -272,7 +283,7 @@ export class Calendar extends React.Component {
key={day!.toString()}
disabled={disabled}
dayInCurrentMonth={isDayInCurrentMonth}
- onSelect={this.onDateSelect}
+ onSelect={this.handleDaySelect}
>
{dayComponent}
@@ -280,7 +291,7 @@ export class Calendar extends React.Component {
});
};
- public render() {
+ render() {
const { currentMonth, slideDirection } = this.state;
const {
classes,
@@ -323,17 +334,6 @@ export class Calendar extends React.Component {