@docsvision/material-ui-pickers 3.2.0-beta.26 → 3.2.0-beta.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/{build/DatePicker → DatePicker}/DatePickerToolbar.js +3 -3
  2. package/{build/DateTimePicker → DateTimePicker}/DateTimePicker.d.ts +2 -2
  3. package/{build/DateTimePicker → DateTimePicker}/DateTimePicker.js +2 -2
  4. package/{build/DateTimePicker → DateTimePicker}/DateTimePickerToolbar.js +4 -4
  5. package/{build/MuiPickersUtilsProvider.d.ts → MuiPickersUtilsProvider.d.ts} +1 -1
  6. package/{build/Picker → Picker}/Picker.d.ts +3 -3
  7. package/{build/Picker → Picker}/Picker.js +1 -1
  8. package/{build/Picker → Picker}/WrappedPurePicker.js +2 -1
  9. package/{build/TimePicker → TimePicker}/TimePicker.d.ts +4 -2
  10. package/{build/TimePicker → TimePicker}/TimePicker.js +2 -2
  11. package/{build/TimePicker → TimePicker}/TimePickerToolbar.js +3 -3
  12. package/{build/_helpers → _helpers}/date-utils.d.ts +2 -2
  13. package/{build/_helpers → _helpers}/date-utils.js +3 -3
  14. package/_helpers/text-field-helper.d.ts +32 -0
  15. package/{build/_helpers → _helpers}/text-field-helper.js +1 -1
  16. package/{build/_helpers → _helpers}/time-utils.d.ts +2 -2
  17. package/{build/_shared → _shared}/WithUtils.d.ts +1 -1
  18. package/{build/_shared → _shared}/hooks/useKeyboardPickerState.js +1 -1
  19. package/{build/_shared → _shared}/hooks/useUtils.d.ts +2 -2
  20. package/{build/dist → dist}/material-ui-pickers.esm.js +1187 -834
  21. package/dist/material-ui-pickers.esm.js.map +1 -0
  22. package/{build/dist → dist}/material-ui-pickers.js +1187 -834
  23. package/dist/material-ui-pickers.js.map +1 -0
  24. package/{build/dist → dist}/material-ui-pickers.umd.js +1178 -825
  25. package/dist/material-ui-pickers.umd.min.js +1 -0
  26. package/{build/index.d.ts → index.d.ts} +11 -11
  27. package/package.json +62 -135
  28. package/{build/typings → typings}/BasePicker.d.ts +1 -1
  29. package/{build/views → views}/Calendar/Calendar.js +1 -1
  30. package/{build/views → views}/Calendar/CalendarHeader.js +1 -1
  31. package/{build/views → views}/Clock/Clock.js +1 -1
  32. package/{build/views → views}/Clock/ClockNumbers.d.ts +2 -2
  33. package/{build/views → views}/Clock/ClockView.js +1 -1
  34. package/{build/views → views}/Month/MonthView.js +1 -1
  35. package/{build/views → views}/Year/YearView.js +2 -2
  36. package/.size-snapshot.json +0 -26
  37. package/9db1cba1a61cb58db53f38425bbd1f95.7z +0 -0
  38. package/build/_helpers/text-field-helper.d.ts +0 -32
  39. package/build/dist/material-ui-pickers.esm.js.map +0 -1
  40. package/build/dist/material-ui-pickers.js.map +0 -1
  41. package/build/dist/material-ui-pickers.umd.min.js +0 -1
  42. package/build/package.json +0 -62
  43. package/copy.js +0 -58
  44. package/remove-prop-types.js +0 -37
  45. package/rollup.config.js +0 -145
  46. package/src/DatePicker/DatePicker.tsx +0 -91
  47. package/src/DatePicker/DatePickerToolbar.tsx +0 -75
  48. package/src/DatePicker/index.ts +0 -7
  49. package/src/DateTimePicker/DateTimePicker.tsx +0 -72
  50. package/src/DateTimePicker/DateTimePickerTabs.tsx +0 -86
  51. package/src/DateTimePicker/DateTimePickerToolbar.tsx +0 -123
  52. package/src/DateTimePicker/index.ts +0 -7
  53. package/src/MuiPickersUtilsProvider.tsx +0 -39
  54. package/src/Picker/Picker.tsx +0 -275
  55. package/src/Picker/WrappedKeyboardPicker.tsx +0 -136
  56. package/src/Picker/WrappedPurePicker.tsx +0 -128
  57. package/src/Rifm/Rifm.ts +0 -213
  58. package/src/TimePicker/TimePicker.tsx +0 -67
  59. package/src/TimePicker/TimePickerToolbar.tsx +0 -180
  60. package/src/TimePicker/index.tsx +0 -7
  61. package/src/__tests__/DatePicker/Calendar.test.tsx +0 -51
  62. package/src/__tests__/DatePicker/Month.test.tsx +0 -36
  63. package/src/__tests__/DatePicker/MonthSelection.test.tsx +0 -37
  64. package/src/__tests__/MuiPickersUtilsProvider.test.tsx +0 -21
  65. package/src/__tests__/TimePicker/Clock.test.tsx +0 -68
  66. package/src/__tests__/_helpers/date-utils.test.tsx +0 -197
  67. package/src/__tests__/_helpers/text-field-helper.test.tsx +0 -34
  68. package/src/__tests__/_shared/ModalDialog.test.tsx +0 -109
  69. package/src/__tests__/e2e/DatePicker.test.tsx +0 -233
  70. package/src/__tests__/e2e/DatePickerProps.test.tsx +0 -18
  71. package/src/__tests__/e2e/DatePickerRoot.test.tsx +0 -154
  72. package/src/__tests__/e2e/DateTimePicker.test.tsx +0 -86
  73. package/src/__tests__/e2e/DateTimePickerRoot.test.tsx +0 -72
  74. package/src/__tests__/e2e/KeyboardDatePicker.test.tsx +0 -140
  75. package/src/__tests__/e2e/KeyboardDateTimePicker.test.tsx +0 -48
  76. package/src/__tests__/e2e/Theme.test.tsx +0 -30
  77. package/src/__tests__/e2e/TimePicker.test.tsx +0 -121
  78. package/src/__tests__/e2e/commands.tsx +0 -8
  79. package/src/__tests__/setup.js +0 -26
  80. package/src/__tests__/test-utils.tsx +0 -45
  81. package/src/__tests__/tsconfig.json +0 -5
  82. package/src/_helpers/date-utils.ts +0 -92
  83. package/src/_helpers/text-field-helper.ts +0 -239
  84. package/src/_helpers/time-utils.ts +0 -83
  85. package/src/_helpers/utils.ts +0 -8
  86. package/src/_shared/KeyboardDateInput.tsx +0 -161
  87. package/src/_shared/ModalDialog.tsx +0 -114
  88. package/src/_shared/PickerToolbar.tsx +0 -52
  89. package/src/_shared/PureDateInput.tsx +0 -45
  90. package/src/_shared/ToolbarButton.tsx +0 -63
  91. package/src/_shared/ToolbarText.tsx +0 -49
  92. package/src/_shared/WithUtils.tsx +0 -19
  93. package/src/_shared/hooks/useIsLandscape.tsx +0 -27
  94. package/src/_shared/hooks/useKeyDown.ts +0 -34
  95. package/src/_shared/hooks/useKeyboardPickerState.ts +0 -72
  96. package/src/_shared/hooks/useOpenState.ts +0 -22
  97. package/src/_shared/hooks/usePickerState.ts +0 -134
  98. package/src/_shared/hooks/useUtils.ts +0 -20
  99. package/src/_shared/hooks/useViews.tsx +0 -31
  100. package/src/_shared/icons/ArrowLeftIcon.tsx +0 -11
  101. package/src/_shared/icons/ArrowRightIcon.tsx +0 -11
  102. package/src/_shared/icons/DateRangeIcon.tsx +0 -11
  103. package/src/_shared/icons/KeyboardIcon.tsx +0 -11
  104. package/src/_shared/icons/TimeIcon.tsx +0 -12
  105. package/src/constants/ClockType.ts +0 -11
  106. package/src/constants/dimensions.ts +0 -5
  107. package/src/constants/prop-types.ts +0 -37
  108. package/src/index.ts +0 -48
  109. package/src/typings/BasePicker.tsx +0 -60
  110. package/src/typings/date.ts +0 -3
  111. package/src/typings/extendMui.ts +0 -10
  112. package/src/typings/overrides.ts +0 -44
  113. package/src/views/Calendar/Calendar.tsx +0 -361
  114. package/src/views/Calendar/CalendarHeader.tsx +0 -141
  115. package/src/views/Calendar/Day.tsx +0 -97
  116. package/src/views/Calendar/DayWrapper.tsx +0 -33
  117. package/src/views/Calendar/SlideTransition.tsx +0 -100
  118. package/src/views/Clock/Clock.tsx +0 -172
  119. package/src/views/Clock/ClockNumber.tsx +0 -91
  120. package/src/views/Clock/ClockNumbers.tsx +0 -76
  121. package/src/views/Clock/ClockPointer.tsx +0 -104
  122. package/src/views/Clock/ClockView.tsx +0 -105
  123. package/src/views/Month/Month.tsx +0 -76
  124. package/src/views/Month/MonthView.tsx +0 -94
  125. package/src/views/Year/Year.tsx +0 -77
  126. package/src/views/Year/YearView.tsx +0 -91
  127. package/src/wrappers/InlineWrapper.tsx +0 -80
  128. package/src/wrappers/ModalWrapper.tsx +0 -113
  129. package/src/wrappers/StaticWrapper.tsx +0 -22
  130. package/src/wrappers/Wrapper.tsx +0 -75
  131. package/tsconfig.json +0 -21
  132. package/typings.d.ts +0 -6
  133. /package/{build/DatePicker → DatePicker}/DatePicker.d.ts +0 -0
  134. /package/{build/DatePicker → DatePicker}/DatePicker.js +0 -0
  135. /package/{build/DatePicker → DatePicker}/DatePickerToolbar.d.ts +0 -0
  136. /package/{build/DatePicker → DatePicker}/index.d.ts +0 -0
  137. /package/{build/DatePicker → DatePicker}/index.js +0 -0
  138. /package/{build/DateTimePicker → DateTimePicker}/DateTimePickerTabs.d.ts +0 -0
  139. /package/{build/DateTimePicker → DateTimePicker}/DateTimePickerTabs.js +0 -0
  140. /package/{build/DateTimePicker → DateTimePicker}/DateTimePickerToolbar.d.ts +0 -0
  141. /package/{build/DateTimePicker → DateTimePicker}/index.d.ts +0 -0
  142. /package/{build/DateTimePicker → DateTimePicker}/index.js +0 -0
  143. /package/{build/MuiPickersUtilsProvider.js → MuiPickersUtilsProvider.js} +0 -0
  144. /package/{build/Picker → Picker}/WrappedKeyboardPicker.d.ts +0 -0
  145. /package/{build/Picker → Picker}/WrappedKeyboardPicker.js +0 -0
  146. /package/{build/Picker → Picker}/WrappedPurePicker.d.ts +0 -0
  147. /package/{build/README.md → README.md} +0 -0
  148. /package/{build/Rifm → Rifm}/Rifm.d.ts +0 -0
  149. /package/{build/Rifm → Rifm}/Rifm.js +0 -0
  150. /package/{build/TimePicker → TimePicker}/TimePickerToolbar.d.ts +0 -0
  151. /package/{build/TimePicker → TimePicker}/index.d.ts +0 -0
  152. /package/{build/TimePicker → TimePicker}/index.js +0 -0
  153. /package/{build/_helpers → _helpers}/time-utils.js +0 -0
  154. /package/{build/_helpers → _helpers}/utils.d.ts +0 -0
  155. /package/{build/_helpers → _helpers}/utils.js +0 -0
  156. /package/{build/_shared → _shared}/KeyboardDateInput.d.ts +0 -0
  157. /package/{build/_shared → _shared}/KeyboardDateInput.js +0 -0
  158. /package/{build/_shared → _shared}/ModalDialog.d.ts +0 -0
  159. /package/{build/_shared → _shared}/ModalDialog.js +0 -0
  160. /package/{build/_shared → _shared}/PickerToolbar.d.ts +0 -0
  161. /package/{build/_shared → _shared}/PickerToolbar.js +0 -0
  162. /package/{build/_shared → _shared}/PureDateInput.d.ts +0 -0
  163. /package/{build/_shared → _shared}/PureDateInput.js +0 -0
  164. /package/{build/_shared → _shared}/ToolbarButton.d.ts +0 -0
  165. /package/{build/_shared → _shared}/ToolbarButton.js +0 -0
  166. /package/{build/_shared → _shared}/ToolbarText.d.ts +0 -0
  167. /package/{build/_shared → _shared}/ToolbarText.js +0 -0
  168. /package/{build/_shared → _shared}/WithUtils.js +0 -0
  169. /package/{build/_shared → _shared}/hooks/useIsLandscape.d.ts +0 -0
  170. /package/{build/_shared → _shared}/hooks/useIsLandscape.js +0 -0
  171. /package/{build/_shared → _shared}/hooks/useKeyDown.d.ts +0 -0
  172. /package/{build/_shared → _shared}/hooks/useKeyDown.js +0 -0
  173. /package/{build/_shared → _shared}/hooks/useKeyboardPickerState.d.ts +0 -0
  174. /package/{build/_shared → _shared}/hooks/useOpenState.d.ts +0 -0
  175. /package/{build/_shared → _shared}/hooks/useOpenState.js +0 -0
  176. /package/{build/_shared → _shared}/hooks/usePickerState.d.ts +0 -0
  177. /package/{build/_shared → _shared}/hooks/usePickerState.js +0 -0
  178. /package/{build/_shared → _shared}/hooks/useUtils.js +0 -0
  179. /package/{build/_shared → _shared}/hooks/useViews.d.ts +0 -0
  180. /package/{build/_shared → _shared}/hooks/useViews.js +0 -0
  181. /package/{build/_shared → _shared}/icons/ArrowLeftIcon.d.ts +0 -0
  182. /package/{build/_shared → _shared}/icons/ArrowLeftIcon.js +0 -0
  183. /package/{build/_shared → _shared}/icons/ArrowRightIcon.d.ts +0 -0
  184. /package/{build/_shared → _shared}/icons/ArrowRightIcon.js +0 -0
  185. /package/{build/_shared → _shared}/icons/DateRangeIcon.d.ts +0 -0
  186. /package/{build/_shared → _shared}/icons/DateRangeIcon.js +0 -0
  187. /package/{build/_shared → _shared}/icons/KeyboardIcon.d.ts +0 -0
  188. /package/{build/_shared → _shared}/icons/KeyboardIcon.js +0 -0
  189. /package/{build/_shared → _shared}/icons/TimeIcon.d.ts +0 -0
  190. /package/{build/_shared → _shared}/icons/TimeIcon.js +0 -0
  191. /package/{build/constants → constants}/ClockType.d.ts +0 -0
  192. /package/{build/constants → constants}/ClockType.js +0 -0
  193. /package/{build/constants → constants}/dimensions.d.ts +0 -0
  194. /package/{build/constants → constants}/dimensions.js +0 -0
  195. /package/{build/constants → constants}/prop-types.d.ts +0 -0
  196. /package/{build/constants → constants}/prop-types.js +0 -0
  197. /package/{build/index.js → index.js} +0 -0
  198. /package/{build/typings → typings}/BasePicker.js +0 -0
  199. /package/{build/typings → typings}/date.d.ts +0 -0
  200. /package/{build/typings → typings}/date.js +0 -0
  201. /package/{build/typings → typings}/extendMui.d.ts +0 -0
  202. /package/{build/typings → typings}/extendMui.js +0 -0
  203. /package/{build/typings → typings}/overrides.d.ts +0 -0
  204. /package/{build/typings → typings}/overrides.js +0 -0
  205. /package/{build/views → views}/Calendar/Calendar.d.ts +0 -0
  206. /package/{build/views → views}/Calendar/CalendarHeader.d.ts +0 -0
  207. /package/{build/views → views}/Calendar/Day.d.ts +0 -0
  208. /package/{build/views → views}/Calendar/Day.js +0 -0
  209. /package/{build/views → views}/Calendar/DayWrapper.d.ts +0 -0
  210. /package/{build/views → views}/Calendar/DayWrapper.js +0 -0
  211. /package/{build/views → views}/Calendar/SlideTransition.d.ts +0 -0
  212. /package/{build/views → views}/Calendar/SlideTransition.js +0 -0
  213. /package/{build/views → views}/Clock/Clock.d.ts +0 -0
  214. /package/{build/views → views}/Clock/ClockNumber.d.ts +0 -0
  215. /package/{build/views → views}/Clock/ClockNumber.js +0 -0
  216. /package/{build/views → views}/Clock/ClockNumbers.js +0 -0
  217. /package/{build/views → views}/Clock/ClockPointer.d.ts +0 -0
  218. /package/{build/views → views}/Clock/ClockPointer.js +0 -0
  219. /package/{build/views → views}/Clock/ClockView.d.ts +0 -0
  220. /package/{build/views → views}/Month/Month.d.ts +0 -0
  221. /package/{build/views → views}/Month/Month.js +0 -0
  222. /package/{build/views → views}/Month/MonthView.d.ts +0 -0
  223. /package/{build/views → views}/Year/Year.d.ts +0 -0
  224. /package/{build/views → views}/Year/Year.js +0 -0
  225. /package/{build/views → views}/Year/YearView.d.ts +0 -0
  226. /package/{build/wrappers → wrappers}/InlineWrapper.d.ts +0 -0
  227. /package/{build/wrappers → wrappers}/InlineWrapper.js +0 -0
  228. /package/{build/wrappers → wrappers}/ModalWrapper.d.ts +0 -0
  229. /package/{build/wrappers → wrappers}/ModalWrapper.js +0 -0
  230. /package/{build/wrappers → wrappers}/StaticWrapper.d.ts +0 -0
  231. /package/{build/wrappers → wrappers}/StaticWrapper.js +0 -0
  232. /package/{build/wrappers → wrappers}/Wrapper.d.ts +0 -0
  233. /package/{build/wrappers → wrappers}/Wrapper.js +0 -0
@@ -1,62 +0,0 @@
1
- {
2
- "name": "@docsvision/material-ui-pickers",
3
- "version": "3.2.0-beta.26",
4
- "description": "Fork @material-ui/pickers that implements advanced features required for DocsVision WebClient. Original repository https://github.com/mui-org/material-ui-pickers",
5
- "keywords": [
6
- "material-ui",
7
- "pickers",
8
- "@material-ui/pickers",
9
- "datepicker",
10
- "timepicker",
11
- "date-picker",
12
- "time-picker",
13
- "react",
14
- "react-component",
15
- "material design",
16
- "Docsvision",
17
- "WebClient"
18
- ],
19
- "sideEffects": false,
20
- "license": "MIT",
21
- "author": {
22
- "name": "Docsvision"
23
- },
24
- "peerDependencies": {
25
- "@date-io/core": "^1.3.6",
26
- "@material-ui/core": "^4.0.0",
27
- "prop-types": "^15.6.0",
28
- "react": "^16.8.6",
29
- "react-dom": "^16.8.6"
30
- },
31
- "dependencies": {
32
- "@types/styled-jsx": "^2.2.8",
33
- "clsx": "^1.0.2",
34
- "react-transition-group": "^4.0.0",
35
- "tslib": "^1.9.3"
36
- },
37
- "size-limit": [
38
- {
39
- "path": "build/dist/@material-ui/pickers.esm.js",
40
- "limit": "30 KB"
41
- }
42
- ],
43
- "scripts": {
44
- "test": "jest",
45
- "test:date-fns": "UTILS=date-fns npm run test",
46
- "test:luxon": "UTILS=luxon npm run test",
47
- "test:moment": "UTILS=moment npm run test",
48
- "start": "rollup --config rollup.config.dev.js --watch & npx tsc --watch",
49
- "prebuild": "rimraf build",
50
- "build:copy": "node copy.js",
51
- "build:bundle": "rollup --config",
52
- "build:typescript": "tsc --project tsconfig.json",
53
- "build": "npm run build:typescript && npm run build:bundle && npm run build:copy",
54
- "build:analyze": "npm run build",
55
- "release": "yarn test && yarn version && yarn build && yarn publish --non-interactive build",
56
- "publish": "npm publish build"
57
- },
58
- "private": false,
59
- "main": "./dist/material-ui-pickers.js",
60
- "module": "./dist/material-ui-pickers.esm.js",
61
- "typings": "./index.d.ts"
62
- }
package/copy.js DELETED
@@ -1,58 +0,0 @@
1
- const path = require('path');
2
- const fse = require('fs-extra');
3
-
4
- function copyReadme() {
5
- return fse
6
- .copyFile(
7
- path.resolve(__dirname, '..', 'README.md'),
8
- path.resolve(__dirname, 'build', 'README.md')
9
- )
10
- .then(() => console.log('Copied README.md'));
11
- }
12
-
13
- function createPackageFile() {
14
- return new Promise(resolve => {
15
- fse.readFile(path.resolve(__dirname, 'package.json'), 'utf8', (err, data) => {
16
- if (err) {
17
- throw err;
18
- }
19
-
20
- resolve(data);
21
- });
22
- })
23
- .then(data => JSON.parse(data))
24
- .then(packageData => {
25
- // cleanup produced package
26
- const {
27
- devDependencies,
28
- jest,
29
- husky,
30
- main,
31
- module,
32
- 'lint-staged': ls,
33
- ...other
34
- } = packageData;
35
-
36
- const newPackage = {
37
- ...other,
38
- private: false,
39
- main: './dist/material-ui-pickers.js',
40
- module: './dist/material-ui-pickers.esm.js',
41
- typings: './index.d.ts',
42
- };
43
-
44
- return new Promise(resolve => {
45
- const buildPath = path.resolve(__dirname, 'build', 'package.json');
46
- const data = JSON.stringify(newPackage, null, 2);
47
- fse.writeFile(buildPath, data, err => {
48
- if (err) throw err;
49
- console.log(`Created package.json in ${buildPath}`);
50
- resolve();
51
- });
52
- });
53
- });
54
- }
55
-
56
- createPackageFile()
57
- .then(() => copyReadme())
58
- .then(console.error);
@@ -1,37 +0,0 @@
1
- const removePropTypes = api => {
2
- const { types, template } = api;
3
- const visitedKey = `remove-prop-types-${Date.now()}`;
4
- return {
5
- visitor: {
6
- AssignmentExpression(path) {
7
- if (
8
- types.isMemberExpression(path.node.left) &&
9
- types.isIdentifier(path.node.left.property) &&
10
- path.node.left.property.name === 'propTypes'
11
- ) {
12
- // Prevent infinity loop.
13
- if (path.node[visitedKey]) {
14
- return;
15
- }
16
- path.node[visitedKey] = true;
17
-
18
- const unsafeWrapTemplate = template(
19
- `
20
- if (process.env.NODE_ENV !== "production") {
21
- NODE;
22
- }
23
- `,
24
- { placeholderPattern: /^NODE$/ }
25
- );
26
- path.replaceWith(
27
- unsafeWrapTemplate({
28
- NODE: path.node,
29
- })
30
- );
31
- }
32
- },
33
- },
34
- };
35
- };
36
-
37
- module.exports = removePropTypes;
package/rollup.config.js DELETED
@@ -1,145 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import path from 'path';
3
- // @ts-ignore
4
- import pkg from './package.json';
5
- import typescript from 'typescript';
6
- import babel from 'rollup-plugin-babel';
7
- import replace from 'rollup-plugin-replace';
8
- import commonjs from 'rollup-plugin-commonjs';
9
- import nodeResolve from 'rollup-plugin-node-resolve';
10
- import typescriptPlugin from 'rollup-plugin-typescript';
11
- import { terser } from 'rollup-plugin-terser';
12
- import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
13
-
14
- const tsconfig = path.join(__dirname, 'tsconfig.json');
15
- console.info(`Using tsconfig: ${tsconfig}`);
16
-
17
- const currentSourceFolder = path.join(__dirname, 'src\\');
18
-
19
- // treat as externals not relative and not absolute paths
20
- const external = id => {
21
- // console.log(id);
22
- return !id.startsWith('.') && !id.startsWith('/') && !id.includes(currentSourceFolder);
23
- };
24
-
25
- const input = './src/index.ts';
26
- const globals = {
27
- react: 'React',
28
- 'react-dom': 'ReactDOM',
29
- 'prop-types': 'PropTypes',
30
- '@material-ui/core/Icon': 'material-ui.Icon',
31
- '@material-ui/core/Button/': 'material-ui/Button.',
32
- '@material-ui/core/IconButton': 'material-ui.IconButton',
33
- '@material-ui/core/InputAdornment': 'material-ui.InputAdornment',
34
- '@material-ui/core/TextField': 'material-ui.TextField',
35
- '@material-ui/core/Button': 'material-ui.Button',
36
- '@material-ui/core/Dialog': 'material-ui.Dialog',
37
- '@material-ui/core/DialogActions': 'material-ui.DialogActions',
38
- '@material-ui/core/DialogContent': 'material-ui.DialogContent',
39
- '@material-ui/styles/withStyles': 'material-ui.withStyles',
40
- '@material-ui/styles/createStyles': 'material-ui.createStyles',
41
- '@material-ui/core/Toolbar': 'material-ui.Toolbar',
42
- '@material-ui/core/Typography': 'material-ui.Typography',
43
- '@material-ui/core/Popover': 'material-ui.Popover',
44
- '@material-ui/core/Paper': 'material-ui.Paper',
45
- '@material-ui/styles/withTheme': 'material-ui.withTheme',
46
- '@material-ui/core/Tab': 'material-ui.Tab',
47
- '@material-ui/core/Tabs': 'material-ui.Tabs',
48
- '@material-ui/styles': 'material-ui.styles',
49
- '@material-ui/core/SvgIcon': 'material-ui.SvgIcon',
50
- '@material-ui/core/styles/colorManipulator': 'material-ui.styles.colorManipulator',
51
- };
52
-
53
- const extensions = ['.ts', '.tsx'];
54
-
55
- const babelOptions = {
56
- babelrc: false,
57
- extensions,
58
- plugins: ['./remove-prop-types.js'],
59
- };
60
-
61
- const commonjsOptions = {
62
- include: /node_modules/,
63
- namedExports: {
64
- 'react-is': ['ForwardRef'],
65
- },
66
- };
67
-
68
- export default [
69
- {
70
- input,
71
- external,
72
- output: {
73
- file: 'build/dist/material-ui-pickers.js',
74
- format: 'cjs',
75
- sourcemap: true,
76
- },
77
- plugins: [
78
- nodeResolve({ extensions }),
79
- typescriptPlugin({ typescript, tsconfig }),
80
- babel(babelOptions),
81
- ],
82
- },
83
-
84
- {
85
- input,
86
- external,
87
- output: {
88
- file: 'build/dist/material-ui-pickers.esm.js',
89
- format: 'esm',
90
- sourcemap: true,
91
- },
92
- plugins: [
93
- nodeResolve({ extensions }),
94
- typescriptPlugin({ typescript, tsconfig }),
95
- babel(babelOptions),
96
- replace({
97
- delimiters: ['', ''],
98
- values: { '/** @class */': '/*@__PURE__*/' },
99
- }),
100
- sizeSnapshot(),
101
- ],
102
- },
103
-
104
- {
105
- input,
106
- external: Object.keys(globals),
107
- output: {
108
- globals,
109
- format: 'umd',
110
- name: pkg.name,
111
- file: 'build/dist/material-ui-pickers.umd.js',
112
- },
113
-
114
- plugins: [
115
- nodeResolve({ extensions }),
116
- typescriptPlugin({ typescript, tsconfig }),
117
- babel(babelOptions),
118
- commonjs(commonjsOptions),
119
- replace({ 'process.env.NODE_ENV': JSON.stringify('development') }),
120
- sizeSnapshot(),
121
- ],
122
- },
123
-
124
- {
125
- input,
126
- external: Object.keys(globals),
127
- output: {
128
- globals,
129
- format: 'umd',
130
- name: pkg.name,
131
- file: 'build/dist/material-ui-pickers.umd.min.js',
132
- },
133
- plugins: [
134
- nodeResolve({ extensions }),
135
- typescriptPlugin({ typescript, tsconfig }),
136
- babel(babelOptions),
137
- commonjs(commonjsOptions),
138
- replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
139
- sizeSnapshot(),
140
- terser({
141
- mangle: false,
142
- }),
143
- ],
144
- },
145
- ];
@@ -1,91 +0,0 @@
1
- import { useUtils } from '../_shared/hooks/useUtils';
2
- import { DatePickerToolbar } from './DatePickerToolbar';
3
- import { MaterialUiPickersDate } from '../typings/date';
4
- import { getFormatByViews } from '../_helpers/date-utils';
5
- import { OutterCalendarProps } from '../views/Calendar/Calendar';
6
- import { datePickerDefaultProps, ParsableDate } from '../constants/prop-types';
7
- import { WrappedPurePickerProps, makePurePicker } from '../Picker/WrappedPurePicker';
8
- import { makeKeyboardPicker, WrappedKeyboardPickerProps } from '../Picker/WrappedKeyboardPicker';
9
-
10
- export type DatePickerView = 'year' | 'date' | 'month';
11
-
12
- export interface BaseDatePickerProps extends OutterCalendarProps {
13
- /**
14
- * Min selectable date
15
- * @default Date(1900-01-01)
16
- */
17
- minDate?: ParsableDate;
18
- /**
19
- * Max selectable date
20
- * @default Date(2200-01-01)
21
- */
22
- maxDate?: ParsableDate;
23
-
24
- /**
25
- * Compare dates by the exact timestamp, instead of start/end of date
26
- * @default false
27
- */
28
- strictCompareDates?: boolean;
29
-
30
- /**
31
- * Disable past dates
32
- * @default false
33
- */
34
- disablePast?: boolean;
35
- /**
36
- * Disable future dates
37
- * @default false
38
- */
39
- disableFuture?: boolean;
40
- /**
41
- * To animate scrolling to current year (using scrollIntoView)
42
- * @default false
43
- */
44
- animateYearScrolling?: boolean;
45
- /** Callback firing on year change */
46
- onYearChange?: (date: MaterialUiPickersDate) => void;
47
- }
48
-
49
- export interface DatePickerViewsProps extends BaseDatePickerProps {
50
- /**
51
- * Array of views to show
52
- * @type {Array<"year" | "date" | "month">}
53
- */
54
- views?: DatePickerView[];
55
- /** Open to DatePicker */
56
- openTo?: DatePickerView;
57
- }
58
-
59
- export type DatePickerProps = WrappedPurePickerProps & DatePickerViewsProps;
60
-
61
- export type KeyboardDatePickerProps = WrappedKeyboardPickerProps & DatePickerViewsProps;
62
-
63
- const defaultProps = {
64
- ...datePickerDefaultProps,
65
- openTo: 'date' as DatePickerView,
66
- views: ['year', 'date'] as DatePickerView[],
67
- showActionsBar: false,
68
- todayLabel: 'TODAY',
69
- };
70
-
71
- function useOptions(props: DatePickerViewsProps) {
72
- const utils = useUtils();
73
-
74
- return {
75
- getDefaultFormat: () => getFormatByViews(props.views!, utils),
76
- };
77
- }
78
-
79
- export const DatePicker = makePurePicker<DatePickerViewsProps>({
80
- useOptions,
81
- DefaultToolbarComponent: DatePickerToolbar,
82
- });
83
-
84
- export const KeyboardDatePicker = makeKeyboardPicker<DatePickerViewsProps>({
85
- useOptions,
86
- DefaultToolbarComponent: DatePickerToolbar,
87
- });
88
-
89
- DatePicker.defaultProps = defaultProps;
90
-
91
- KeyboardDatePicker.defaultProps = defaultProps;
@@ -1,75 +0,0 @@
1
- import * as React from 'react';
2
- import clsx from 'clsx';
3
- import ToolbarButton from '../_shared/ToolbarButton';
4
- import PickerToolbar from '../_shared/PickerToolbar';
5
- import { useUtils } from '../_shared/hooks/useUtils';
6
- import { makeStyles } from '@material-ui/core/styles';
7
- import { ToolbarComponentProps } from '../Picker/Picker';
8
- import { isYearAndMonthViews, isYearOnlyView } from '../_helpers/date-utils';
9
-
10
- export const useStyles = makeStyles(
11
- {
12
- toolbar: {
13
- flexDirection: 'column',
14
- alignItems: 'flex-start',
15
- },
16
- toolbarLandscape: {
17
- padding: 16,
18
- },
19
- dateLandscape: {
20
- marginRight: 16,
21
- },
22
- },
23
- { name: 'MuiPickersDatePickerRoot' }
24
- );
25
-
26
- export const DatePickerToolbar: React.FC<ToolbarComponentProps> = ({
27
- date,
28
- views,
29
- setOpenView,
30
- isLandscape,
31
- openView,
32
- }) => {
33
- const utils = useUtils();
34
- const classes = useStyles();
35
-
36
- const isYearOnly = React.useMemo(() => isYearOnlyView(views as any), [views]);
37
- const isYearAndMonth = React.useMemo(() => isYearAndMonthViews(views as any), [views]);
38
-
39
- return (
40
- <PickerToolbar
41
- isLandscape={isLandscape}
42
- className={clsx({
43
- [classes.toolbar]: !isYearOnly,
44
- [classes.toolbarLandscape]: isLandscape,
45
- })}
46
- >
47
- <ToolbarButton
48
- variant={isYearOnly ? 'h3' : 'subtitle1'}
49
- onClick={() => setOpenView('year')}
50
- selected={openView === 'year'}
51
- label={utils.getYearText(date)}
52
- />
53
-
54
- {!isYearOnly && !isYearAndMonth && (
55
- <ToolbarButton
56
- variant="h4"
57
- selected={openView === 'date'}
58
- onClick={() => setOpenView('date')}
59
- align={isLandscape ? 'left' : 'center'}
60
- label={utils.getDatePickerHeaderText(date)}
61
- className={clsx({ [classes.dateLandscape]: isLandscape })}
62
- />
63
- )}
64
-
65
- {isYearAndMonth && (
66
- <ToolbarButton
67
- variant="h4"
68
- onClick={() => setOpenView('month')}
69
- selected={openView === 'month'}
70
- label={utils.getMonthText(date)}
71
- />
72
- )}
73
- </PickerToolbar>
74
- );
75
- };
@@ -1,7 +0,0 @@
1
- import { DatePickerProps, KeyboardDatePickerProps } from './DatePicker';
2
-
3
- export type DatePickerProps = DatePickerProps;
4
-
5
- export type KeyboardDatePickerProps = KeyboardDatePickerProps;
6
-
7
- export { KeyboardDatePicker, DatePicker } from './DatePicker';
@@ -1,72 +0,0 @@
1
- import { useUtils } from '../_shared/hooks/useUtils';
2
- import { BaseDatePickerProps } from '../DatePicker/DatePicker';
3
- import { BaseTimePickerProps } from '../TimePicker/TimePicker';
4
- import { DateTimePickerToolbar } from './DateTimePickerToolbar';
5
- import { pick12hOr24hFormat } from '../_helpers/text-field-helper';
6
- import { dateTimePickerDefaultProps } from '../constants/prop-types';
7
- import { WrappedPurePickerProps, makePurePicker } from '../Picker/WrappedPurePicker';
8
- import { makeKeyboardPicker, WrappedKeyboardPickerProps } from '../Picker/WrappedKeyboardPicker';
9
-
10
- export type DateTimePickerView = 'year' | 'date' | 'month' | 'hours' | 'minutes';
11
-
12
- export type BaseDateTimePickerProps = BaseTimePickerProps & BaseDatePickerProps;
13
-
14
- export interface DateTimePickerViewsProps extends BaseDateTimePickerProps {
15
- /** Array of views to show */
16
- views?: ('year' | 'date' | 'month' | 'hours' | 'minutes')[];
17
- /** Open to DatePicker */
18
- openTo?: 'year' | 'date' | 'month' | 'hours' | 'minutes';
19
- /** To show tabs */
20
- hideTabs?: boolean;
21
- /** Date tab icon */
22
- dateRangeIcon?: React.ReactNode;
23
- /** Time tab icon */
24
- timeIcon?: React.ReactNode;
25
- }
26
-
27
- export type DateTimePickerProps = WrappedPurePickerProps & DateTimePickerViewsProps;
28
-
29
- export type KeyboardDateTimePickerProps = WrappedKeyboardPickerProps & DateTimePickerViewsProps;
30
-
31
- const defaultProps = {
32
- ...dateTimePickerDefaultProps,
33
- showActionsBar: false,
34
- todayLabel: 'TODAY',
35
- wider: true,
36
- orientation: 'portrait' as const,
37
- openTo: 'date' as DateTimePickerView,
38
- views: ['year', 'date', 'hours', 'minutes'] as DateTimePickerView[],
39
- };
40
-
41
- function useOptions(props: DateTimePickerProps | KeyboardDateTimePickerProps) {
42
- const utils = useUtils();
43
-
44
- if (props.orientation !== 'portrait') {
45
- throw new Error('We are not supporting custom orientation for DateTimePicker yet :(');
46
- }
47
-
48
- return {
49
- getDefaultFormat: () =>
50
- pick12hOr24hFormat(props.format, props.ampm, {
51
- '12h': utils.dateTime12hFormat,
52
- '24h': utils.dateTime24hFormat,
53
- }),
54
- };
55
- }
56
-
57
- export const DateTimePicker = makePurePicker<DateTimePickerProps>({
58
- useOptions,
59
- DefaultToolbarComponent: DateTimePickerToolbar,
60
- });
61
-
62
- export const KeyboardDateTimePicker = makeKeyboardPicker<KeyboardDateTimePickerProps>({
63
- useOptions,
64
- DefaultToolbarComponent: DateTimePickerToolbar,
65
- getCustomProps: props => ({
66
- refuse: props.ampm ? /[^\dap]+/gi : /[^\d]+/gi,
67
- }),
68
- });
69
-
70
- DateTimePicker.defaultProps = defaultProps;
71
-
72
- KeyboardDateTimePicker.defaultProps = defaultProps;
@@ -1,86 +0,0 @@
1
- import * as React from 'react';
2
- import Tab from '@material-ui/core/Tab';
3
- import Tabs from '@material-ui/core/Tabs';
4
- import Paper from '@material-ui/core/Paper';
5
- import { TimeIcon } from '../_shared/icons/TimeIcon';
6
- import { DateTimePickerView } from './DateTimePicker';
7
- import { DateRangeIcon } from '../_shared/icons/DateRangeIcon';
8
- import { makeStyles, useTheme } from '@material-ui/core/styles';
9
-
10
- const viewToTabIndex = (openView: DateTimePickerView) => {
11
- if (openView === 'date' || openView === 'year') {
12
- return 'date';
13
- }
14
-
15
- return 'time';
16
- };
17
-
18
- const tabIndexToView = (tab: DateTimePickerView) => {
19
- if (tab === 'date') {
20
- return 'date';
21
- }
22
-
23
- return 'hours';
24
- };
25
-
26
- export interface DateTimePickerTabsProps {
27
- view: DateTimePickerView;
28
- onChange: (view: DateTimePickerView) => void;
29
- dateRangeIcon?: React.ReactNode;
30
- timeIcon?: React.ReactNode;
31
- }
32
-
33
- export const useStyles = makeStyles(
34
- theme => {
35
- // prettier-ignore
36
- const tabsBackground = theme.palette.type === 'light'
37
- ? theme.palette.primary.main
38
- : theme.palette.background.default;
39
-
40
- return {
41
- tabs: {
42
- color: theme.palette.getContrastText(tabsBackground),
43
- backgroundColor: tabsBackground,
44
- },
45
- };
46
- },
47
- { name: 'MuiPickerDTTabs' }
48
- );
49
-
50
- export const DateTimePickerTabs: React.SFC<DateTimePickerTabsProps> = ({
51
- view,
52
- onChange,
53
- dateRangeIcon,
54
- timeIcon,
55
- }) => {
56
- const classes = useStyles();
57
- const theme = useTheme();
58
- const indicatorColor = theme.palette.type === 'light' ? 'secondary' : 'primary';
59
- const handleChange = (e: React.ChangeEvent<{}>, value: DateTimePickerView) => {
60
- if (value !== viewToTabIndex(view)) {
61
- onChange(tabIndexToView(value));
62
- }
63
- };
64
-
65
- return (
66
- <Paper>
67
- <Tabs
68
- variant="fullWidth"
69
- value={viewToTabIndex(view)}
70
- onChange={handleChange}
71
- className={classes.tabs}
72
- indicatorColor={indicatorColor}
73
- >
74
- <Tab value="date" icon={<>{dateRangeIcon}</>} />
75
- <Tab value="time" icon={<>{timeIcon}</>} />
76
- </Tabs>
77
- </Paper>
78
- );
79
- };
80
-
81
- DateTimePickerTabs.defaultProps = {
82
- dateRangeIcon: <DateRangeIcon />,
83
- timeIcon: <TimeIcon />,
84
- };
85
-
86
- export default DateTimePickerTabs;